1 /* 2000-08-13T15:29:40Z
3 * handle input from x11 and keyboard and joystick
17 struct LevelInfo_EM native_em_level;
19 unsigned short **Boom;
20 unsigned short **Cave;
21 unsigned short **Next;
22 unsigned short **Draw;
24 static unsigned short *Index[4][HEIGHT];
25 static unsigned short Array[4][HEIGHT][WIDTH];
27 extern unsigned int screen_x;
28 extern unsigned int screen_y;
30 void game_init_vars(void)
36 for (y = 0; y < HEIGHT; y++)
37 for (x = 0; x < WIDTH; x++)
38 Array[0][y][x] = ZBORDER;
39 for (y = 0; y < HEIGHT; y++)
40 for (x = 0; x < WIDTH; x++)
41 Array[1][y][x] = ZBORDER;
42 for (y = 0; y < HEIGHT; y++)
43 for (x = 0; x < WIDTH; x++)
44 Array[2][y][x] = ZBORDER;
45 for (y = 0; y < HEIGHT; y++)
46 for (x = 0; x < WIDTH; x++)
47 Array[3][y][x] = Xblank;
49 for (y = 0; y < HEIGHT; y++)
50 Index[0][y] = Array[0][y];
51 for (y = 0; y < HEIGHT; y++)
52 Index[1][y] = Array[1][y];
53 for (y = 0; y < HEIGHT; y++)
54 Index[2][y] = Array[2][y];
55 for (y = 0; y < HEIGHT; y++)
56 Index[3][y] = Array[3][y];
64 void InitGameEngine_EM()
72 void GameActions_EM(byte action)
74 static unsigned long game_frame_delay = 0;
75 unsigned long game_frame_delay_value = getGameFrameDelay_EM(25);
78 /* this is done in screens.c/HandleGameActions() by calling BackToFront() */
79 XSync(display, False); /* block until all graphics are drawn */
82 WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value);
86 Random = Random * 129 + 1;
88 frame = (frame - 1) & 7;
92 UpdateEngineValues(screen_x / TILEX, screen_y / TILEY);
105 DrawGameDoorValues_EM(lev.required, ply1.dynamite, lev.score,
111 /* read input device for players */
113 void readjoy(byte action)
115 unsigned int north = 0, east = 0, south = 0, west = 0, fire = 0;
117 if (action & JOY_LEFT)
120 if (action & JOY_RIGHT)
126 if (action & JOY_DOWN)
129 if (action & JOY_BUTTON_1)
132 ply1.joy_fire = fire;
133 if (ply1.joy_stick || (north | east | south | west))