1 /* 2000-08-13T15:29:40Z
3 * handle input from x11 and keyboard and joystick
17 unsigned short **Boom;
18 unsigned short **Cave;
19 unsigned short **Next;
20 unsigned short **Draw;
22 static unsigned short *Index[4][HEIGHT];
23 static unsigned short Array[4][HEIGHT][WIDTH];
25 extern unsigned int screen_x;
26 extern unsigned int screen_y;
28 void game_init_vars(void)
34 for (y = 0; y < HEIGHT; y++)
35 for (x = 0; x < WIDTH; x++)
36 Array[0][y][x] = ZBORDER;
37 for (y = 0; y < HEIGHT; y++)
38 for (x = 0; x < WIDTH; x++)
39 Array[1][y][x] = ZBORDER;
40 for (y = 0; y < HEIGHT; y++)
41 for (x = 0; x < WIDTH; x++)
42 Array[2][y][x] = ZBORDER;
43 for (y = 0; y < HEIGHT; y++)
44 for (x = 0; x < WIDTH; x++)
45 Array[3][y][x] = Xblank;
47 for (y = 0; y < HEIGHT; y++)
48 Index[0][y] = Array[0][y];
49 for (y = 0; y < HEIGHT; y++)
50 Index[1][y] = Array[1][y];
51 for (y = 0; y < HEIGHT; y++)
52 Index[2][y] = Array[2][y];
53 for (y = 0; y < HEIGHT; y++)
54 Index[3][y] = Array[3][y];
62 void InitGameEngine_EM()
70 void GameActions_EM(byte action)
72 static unsigned long game_frame_delay = 0;
74 unsigned long game_frame_delay_value = getGameFrameDelay_EM(20);
76 unsigned long game_frame_delay_value = getGameFrameDelay_EM(25);
80 /* this is done in screens.c/HandleGameActions() by calling BackToFront() */
81 XSync(display, False); /* block until all graphics are drawn */
84 WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value);
88 Random = Random * 129 + 1;
90 frame = (frame - 1) & 7;
94 UpdateEngineValues(screen_x / TILEX, screen_y / TILEY);
107 DrawGameDoorValues_EM(lev.required, ply1.dynamite, lev.score,
108 DISPLAY_TIME(lev.time));
113 /* read input device for players */
115 void readjoy(byte action)
117 unsigned int north = 0, east = 0, south = 0, west = 0, fire = 0;
119 if (action & JOY_LEFT)
122 if (action & JOY_RIGHT)
128 if (action & JOY_DOWN)
131 if (action & JOY_BUTTON_1)
135 ply1.joy_fire = fire;
136 if (ply1.joy_stick || (north | east | south | west))
144 ply2.joy_fire = fire;
145 if (ply2.joy_stick || (north | east | south | west))