X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Fgame.c;h=3115fb5adf25ea10e3653cd7aca82f2e936e8a9a;hb=6eaf8f1f31cd229a7315063f4434389d00aa5cff;hp=38016ef7b16fe1c15681bec3dbba179fb3fbbe71;hpb=422c23d3171044fdf20ec2a713e2659f265e4890;p=rocksndiamonds.git diff --git a/src/game_em/game.c b/src/game_em/game.c index 38016ef7..3115fb5a 100644 --- a/src/game_em/game.c +++ b/src/game_em/game.c @@ -16,29 +16,33 @@ struct EngineSnapshotInfo_EM engine_snapshot_em; static void readjoy(byte action, struct PLAYER *ply) { - int north = 0, east = 0, south = 0, west = 0; - int snap = 0, drop = 0; + boolean north = FALSE; + boolean east = FALSE; + boolean south = FALSE; + boolean west = FALSE; + boolean snap = FALSE; + boolean drop = FALSE; if (game_em.use_single_button && action & (JOY_BUTTON_1 | JOY_BUTTON_2)) action |= JOY_BUTTON_1 | JOY_BUTTON_2; if (action & JOY_LEFT) - west = 1; + west = TRUE; if (action & JOY_RIGHT) - east = 1; + east = TRUE; if (action & JOY_UP) - north = 1; + north = TRUE; if (action & JOY_DOWN) - south = 1; + south = TRUE; if (action & JOY_BUTTON_1) - snap = 1; + snap = TRUE; if (action & JOY_BUTTON_2) - drop = 1; + drop = TRUE; /* always update drop action */ ply->joy_drop = drop; @@ -71,6 +75,8 @@ void InitGameEngine_EM(void) { prepare_em_level(); + logic_init(); + game_initscreen(); RedrawPlayfield_EM(FALSE); @@ -83,23 +89,17 @@ void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode) game_em.random = game_em.random * 129 + 1; - frame = (frame - 1) & 7; + frame = (frame + 1) % 8; for (i = 0; i < MAX_PLAYERS; i++) readjoy(action[i], &ply[i]); - UpdateEngineValues(screen_x / TILEX, screen_y / TILEY, ply[0].x, ply[0].y); - - if (frame == 7) - { - logic_players(); - logic_objects(); - } + UpdateEngineValues(CAVE_POS_X(screen_x / TILEX), + CAVE_POS_Y(screen_y / TILEY), + CAVE_POS_X(ply[0].x), + CAVE_POS_Y(ply[0].y)); - if (frame == 6) - { - logic_globals(); - } + logic(); for (i = 0; i < MAX_PLAYERS; i++) if (ply[i].joy_drop &&