From: Holger Schemel Date: Fri, 24 Nov 2023 16:25:50 +0000 (+0100) Subject: added random push delay for rocks, nuts and bombs to EM game engine X-Git-Tag: 4.3.8.0~33 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8517e5eb6d3a4d17920a6705546d14593d3158e2;p=rocksndiamonds.git added random push delay for rocks, nuts and bombs to EM game engine Just like in the original Emerald Mine game, there is now a random delay when trying to push a rock, a nut or a bomb. While the chance for rocks being successfully pushed at first attempt will be around 50 %, the chance for nuts will be a bit lower than that for rocks, and the chance for bombs will be a bit lower than that for nuts, with a roughly similar overall delay as in the original game. --- diff --git a/src/game.c b/src/game.c index a7e05b85..dc1e2442 100644 --- a/src/game.c +++ b/src/game.c @@ -3095,6 +3095,9 @@ static void InitGameEngine(void) game_em.use_single_button = (game.engine_version > VERSION_IDENT(4,0,0,2)); + game_em.use_push_delay = + (game.engine_version > VERSION_IDENT(4,3,7,1)); + game_em.use_snap_key_bug = (game.engine_version < VERSION_IDENT(4,0,1,0)); diff --git a/src/game_em/convert.c b/src/game_em/convert.c index 4c34fd16..f8059b53 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -472,6 +472,10 @@ void prepare_em_level(void) // - game_em.use_old_push_elements (default: FALSE) // - game_em.use_old_push_into_acid (default: FALSE) // - game_em.use_wrap_around (default: TRUE) + // - game_em.use_push_delay (default: TRUE) + + if (native_em_level.file_version > FILE_VERSION_EM_V5) + game_em.use_push_delay = FALSE; game_em.level_solved = FALSE; game_em.game_over = FALSE; diff --git a/src/game_em/export.h b/src/game_em/export.h index 409a04e4..a2bbdef9 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -51,6 +51,7 @@ struct GameInfo_EM boolean use_old_push_elements; boolean use_old_push_into_acid; boolean use_wrap_around; + boolean use_push_delay; }; struct LevelInfo_EM diff --git a/src/game_em/logic.c b/src/game_em/logic.c index 61f3237c..b73edab2 100644 --- a/src/game_em/logic.c +++ b/src/game_em/logic.c @@ -777,6 +777,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dy) break; + if (game_em.use_push_delay && RANDOM(32) < 16) + goto stone_push_anim; + switch (cave[x+dx][y]) { case Xblank: @@ -817,6 +820,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; } + stone_push_anim: + ply->anim = PLY_push_n + anim; break; @@ -824,6 +829,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dy) break; + if (game_em.use_push_delay && RANDOM(32) < 22) + goto bomb_push_anim; + switch (cave[x+dx][y]) { case Xblank: @@ -864,6 +872,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; } + bomb_push_anim: + ply->anim = PLY_push_n + anim; break; @@ -871,6 +881,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dy) break; + if (game_em.use_push_delay && RANDOM(32) < 19) + goto nut_push_anim; + switch (cave[x+dx][y]) { case Xblank: @@ -911,6 +924,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; } + nut_push_anim: + ply->anim = PLY_push_n + anim; break; @@ -1469,6 +1484,8 @@ static void check_player(struct PLAYER *ply) ply->dynamite_cnt = 0; /* reset dynamite timer if we move */ + seed = game_em.random; + if (!ply->joy_snap) /* player wants to move */ { boolean moved = FALSE; @@ -1500,6 +1517,8 @@ static void check_player(struct PLAYER *ply) { game_em.any_player_snapping = player_digfield(ply, dx, dy); } + + game_em.random = seed; } static void set_nearest_player_xy(int x, int y, int *dx, int *dy)