X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame_em%2Finput.c;h=27814ee84d9d0ce324d140d6eae27ea3a4968a6f;hp=f7542440b6e3270185962a36e1cd3c1a9570920c;hb=115ce6f2da1914d68b0fe0e5f9082973190dacdd;hpb=77912538a71fe4bba85b97b873f937569d88998f diff --git a/src/game_em/input.c b/src/game_em/input.c index f7542440..27814ee8 100644 --- a/src/game_em/input.c +++ b/src/game_em/input.c @@ -58,7 +58,7 @@ void game_init_vars(void) Boom = Index[3]; } -void InitGameEngine_EM() +void InitGameEngine_EM(void) { prepare_em_level(); @@ -67,7 +67,7 @@ void InitGameEngine_EM() RedrawPlayfield_EM(FALSE); } -void UpdateGameDoorValues_EM() +void UpdateGameDoorValues_EM(void) { } @@ -83,7 +83,7 @@ void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode) for (i = 0; i < MAX_PLAYERS; i++) readjoy(action[i], &ply[i]); - UpdateEngineValues(screen_x / TILEX, screen_y / TILEY); + UpdateEngineValues(screen_x / TILEX, screen_y / TILEY, ply[0].x, ply[0].y); if (frame == 7) { @@ -119,6 +119,9 @@ void readjoy(byte action, struct PLAYER *ply) int north = 0, east = 0, south = 0, west = 0; int snap = 0, drop = 0; + 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; @@ -137,19 +140,34 @@ void readjoy(byte action, struct PLAYER *ply) if (action & JOY_BUTTON_2) drop = 1; - ply->joy_snap = snap; + /* always update drop action */ ply->joy_drop = drop; - if (ply->joy_stick || (north | east | south | west)) + if (ply->joy_stick || (north | east | south | west)) /* (no "| snap"!) */ { ply->joy_n = north; ply->joy_e = east; ply->joy_s = south; ply->joy_w = west; + + /* when storing last action, only update snap action with direction */ + /* (prevents clearing direction if snapping stopped before frame 7) */ + ply->joy_snap = snap; } + + /* if no direction was stored before, allow setting snap to current state */ + if (!ply->joy_n && + !ply->joy_e && + !ply->joy_s && + !ply->joy_w) + ply->joy_snap = snap; + + /* use bug with snap key (mainly TAS keys) sometimes moving the player */ + if (game_em.use_snap_key_bug) + ply->joy_snap = snap; } -void SaveEngineSnapshotValues_EM() +void SaveEngineSnapshotValues_EM(void) { int i, j, k; @@ -176,7 +194,7 @@ void SaveEngineSnapshotValues_EM() engine_snapshot_em.Array[i][j][k] = Array[i][j][k]; } -void LoadEngineSnapshotValues_EM() +void LoadEngineSnapshotValues_EM(void) { int i, j, k;