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 /* blit playfield from scroll buffer to normal back buffer for fading in */
68 BlitScreenToBitmap_EM(backbuffer);
72 void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
79 if (action[0] == 0 && foo != 0)
80 printf("KEY RELEASED @ %05d\n", FrameCounter);
87 if (FrameCounter % 10 == 0)
89 printf("::: %05d: %lu, %d\n", FrameCounter, RandomEM, frame);
102 RandomEM = RandomEM * 129 + 1;
104 frame = (frame - 1) & 7;
106 for (i = 0; i < MAX_PLAYERS; i++)
107 readjoy(action[i], &ply[i]);
109 UpdateEngineValues(screen_x / TILEX, screen_y / TILEY);
122 if (!warp_mode) /* do not redraw values in warp mode */
123 DrawGameDoorValues_EM();
127 /* read input device for players */
129 void readjoy(byte action, struct PLAYER *ply)
131 int north = 0, east = 0, south = 0, west = 0;
132 int snap = 0, drop = 0;
134 if (action & JOY_LEFT)
137 if (action & JOY_RIGHT)
143 if (action & JOY_DOWN)
146 if (action & JOY_BUTTON_1)
149 if (action & JOY_BUTTON_2)
152 ply->joy_snap = snap;
153 ply->joy_drop = drop;
155 if (ply->joy_stick || (north | east | south | west))