+#define PAC_DEATH_FRAMES 8
+
+#define GHOST_TRACE ( LEVWIDTH * LEVHEIGHT )
+
+typedef struct
+{
+ int vx, vy;
+} tracevec_struct;
+
+typedef enum
+ { inbox = 0, goingout, randdir, chasing, hiding, goingin } GhostState;
+typedef enum
+ { ps_eating = 0, ps_chasing, ps_hiding, ps_random, ps_dieing } PacmanState;
+typedef enum
+{ GHOST_DANGER, GHOST_EATEN } GameState;
+
+typedef struct
+{
+ volatile unsigned int col, row;
+ unsigned int lastbox, nextcol, nextrow;
+ int dead;
+ int cfactor, rfactor;
+ int cf, rf;
+ int oldcf, oldrf;
+ volatile int timeleft;
+ GhostState aistate;
+ int speed;
+ XPoint delta;
+ XPoint err;
+ int flash_scared;
+ int trace_idx;
+ tracevec_struct trace[GHOST_TRACE];
+ int home_idx;
+ volatile int home_count;
+ tracevec_struct way_home[GHOST_TRACE];
+ volatile int wait_pos; /* a cycle before calculating the position */
+#if 0 /* Used for debugging */
+ int ndirs;
+ int oldndirs;
+#endif
+
+#if 0 /* Used for debugging */
+ char last_stat[1024];
+#endif