From f57f48cdc063590f02921611aaa54a5a399c5da1 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 25 Aug 2020 23:05:28 +0200 Subject: [PATCH] fixed pushed objects going into acid in EM engine for old tapes With the new EM game engine, objects that are pushed towards acid when initially created fall into acid instead of replacing it (like in the old engine). This change adds some compatibility code to use the old behaviour when replaying old tapes. This is an addition to commit f717d0c1. --- src/game.c | 3 +++ src/game_em/convert.c | 1 + src/game_em/export.h | 1 + src/game_em/logic.c | 24 ++++++++++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/src/game.c b/src/game.c index adfeb9f4..59882dac 100644 --- a/src/game.c +++ b/src/game.c @@ -2999,6 +2999,9 @@ static void InitGameEngine(void) game_em.use_old_push_elements = (game.engine_version < VERSION_IDENT(4,1,4,2)); + game_em.use_old_push_into_acid = + (game.engine_version < VERSION_IDENT(4,1,4,2)); + game_em.use_wrap_around = (game.engine_version > VERSION_IDENT(4,1,4,1)); diff --git a/src/game_em/convert.c b/src/game_em/convert.c index 8589ba2e..675f2235 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -463,6 +463,7 @@ void prepare_em_level(void) // - game_em.use_old_explosions (default: FALSE) // - game_em.use_old_android (default: FALSE) // - 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.level_solved = FALSE; diff --git a/src/game_em/export.h b/src/game_em/export.h index 252a950f..51401e67 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -48,6 +48,7 @@ struct GameInfo_EM boolean use_old_explosions; boolean use_old_android; boolean use_old_push_elements; + boolean use_old_push_into_acid; boolean use_wrap_around; }; diff --git a/src/game_em/logic.c b/src/game_em/logic.c index 7840734e..ba9c05e5 100644 --- a/src/game_em/logic.c +++ b/src/game_em/logic.c @@ -5744,6 +5744,8 @@ static void Lpush_emerald_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x+2][y-1] == Xblank) cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) @@ -5790,6 +5792,8 @@ static void Lpush_emerald_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x][y-1] == Xblank) cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) @@ -5836,6 +5840,8 @@ static void Lpush_diamond_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x+2][y-1] == Xblank) cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) @@ -5882,6 +5888,8 @@ static void Lpush_diamond_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x][y-1] == Xblank) cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) @@ -5928,6 +5936,8 @@ static void Lpush_stone_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x+2][y-1] == Xblank) cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) @@ -5974,6 +5984,8 @@ static void Lpush_stone_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x][y-1] == Xblank) cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) @@ -6020,6 +6032,8 @@ static void Lpush_bomb_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x+2][y-1] == Xblank) cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) @@ -6066,6 +6080,8 @@ static void Lpush_bomb_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x][y-1] == Xblank) cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) @@ -6112,6 +6128,8 @@ static void Lpush_nut_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x+2][y-1] == Xblank) cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) @@ -6158,6 +6176,8 @@ static void Lpush_nut_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x][y-1] == Xblank) cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) @@ -6204,6 +6224,8 @@ static void Lpush_spring_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x+2][y-1] == Xblank) cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) @@ -6250,6 +6272,8 @@ static void Lpush_spring_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + if (game_em.use_old_push_into_acid) + break; if (cave[x][y-1] == Xblank) cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) -- 2.34.1