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 if (game_frame_delay_value > 0) /* do not redraw values in warp mode */
108 DrawGameDoorValues_EM();
112 if (lev.time_initial == 0)
114 else if (lev.time > 0)
119 if (lev.time_initial > 0 &&
120 lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0 && setup.time_limit)
121 play_sound(-1, -1, SAMPLE_time);
126 /* read input device for players */
128 void readjoy(byte action)
130 unsigned int north = 0, east = 0, south = 0, west = 0;
131 unsigned int snap = 0, drop = 0;
133 if (action & JOY_LEFT)
136 if (action & JOY_RIGHT)
142 if (action & JOY_DOWN)
145 if (action & JOY_BUTTON_1)
148 if (action & JOY_BUTTON_2)
152 ply1.joy_snap = snap;
153 ply1.joy_drop = drop;
154 if (ply1.joy_stick || (north | east | south | west))
164 ply2.joy_snap = snap;
165 ply2.joy_drop = drop;
166 if (ply2.joy_stick || (north | east | south | west))