1 /* 2000-08-13T15:29:40Z
3 * handle input from x11 and keyboard and joystick
9 unsigned long RandomEM;
12 struct PLAYER ply[MAX_PLAYERS];
19 static short *Index[4][HEIGHT];
20 static short Array[4][HEIGHT][WIDTH];
25 void game_init_vars(void)
29 RandomEM = 1684108901;
31 for (y = 0; y < HEIGHT; y++)
32 for (x = 0; x < WIDTH; x++)
33 Array[0][y][x] = ZBORDER;
34 for (y = 0; y < HEIGHT; y++)
35 for (x = 0; x < WIDTH; x++)
36 Array[1][y][x] = ZBORDER;
37 for (y = 0; y < HEIGHT; y++)
38 for (x = 0; x < WIDTH; x++)
39 Array[2][y][x] = ZBORDER;
40 for (y = 0; y < HEIGHT; y++)
41 for (x = 0; x < WIDTH; x++)
42 Array[3][y][x] = Xblank;
44 for (y = 0; y < HEIGHT; y++)
45 Index[0][y] = Array[0][y];
46 for (y = 0; y < HEIGHT; y++)
47 Index[1][y] = Array[1][y];
48 for (y = 0; y < HEIGHT; y++)
49 Index[2][y] = Array[2][y];
50 for (y = 0; y < HEIGHT; y++)
51 Index[3][y] = Array[3][y];
59 void InitGameEngine_EM()
67 void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
73 RandomEM = RandomEM * 129 + 1;
75 frame = (frame - 1) & 7;
77 for (i = 0; i < MAX_PLAYERS; i++)
78 readjoy(action[i], &ply[i]);
80 UpdateEngineValues(screen_x / TILEX, screen_y / TILEY);
93 if (!warp_mode) /* do not redraw values in warp mode */
94 DrawGameDoorValues_EM();
98 /* read input device for players */
100 void readjoy(byte action, struct PLAYER *ply)
102 int north = 0, east = 0, south = 0, west = 0;
103 int snap = 0, drop = 0;
105 if (action & JOY_LEFT)
108 if (action & JOY_RIGHT)
114 if (action & JOY_DOWN)
117 if (action & JOY_BUTTON_1)
120 if (action & JOY_BUTTON_2)
123 ply->joy_snap = snap;
124 ply->joy_drop = drop;
126 if (ply->joy_stick || (north | east | south | west))