From: Holger Schemel Date: Tue, 25 Aug 2020 17:48:51 +0000 (+0200) Subject: fixed handling of pushed objects in EM engine for old tapes X-Git-Tag: 4.2.0.2~24 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=63539da7f2d5e1ca071f0e4a9d897df0595d6ae5;p=rocksndiamonds.git fixed handling of pushed objects in EM engine for old tapes This change fixes problems with emulating the behaviour of initially pushed objects for old tapes. (With the new EM game engine, objects that are pushed towards the player when initially created always kill the player, while the object just stopped with the old engine.) This is an addition to commit 1dd2190d. --- diff --git a/src/game.c b/src/game.c index 46f173b4..adfeb9f4 100644 --- a/src/game.c +++ b/src/game.c @@ -2996,6 +2996,9 @@ static void InitGameEngine(void) game_em.use_old_android = (game.engine_version < VERSION_IDENT(4,1,4,2)); + game_em.use_old_push_elements = + (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 5c5e79be..8589ba2e 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -462,6 +462,7 @@ void prepare_em_level(void) // - game_em.use_snap_key_bug (default: FALSE) // - 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_wrap_around (default: TRUE) game_em.level_solved = FALSE; diff --git a/src/game_em/export.h b/src/game_em/export.h index ddd32c9f..252a950f 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -47,6 +47,7 @@ struct GameInfo_EM boolean use_snap_key_bug; boolean use_old_explosions; boolean use_old_android; + boolean use_old_push_elements; boolean use_wrap_around; }; diff --git a/src/game_em/logic.c b/src/game_em/logic.c index 3c68bfb9..7840734e 100644 --- a/src/game_em/logic.c +++ b/src/game_em/logic.c @@ -245,6 +245,15 @@ static void Lboom_next_new(int x, int y, int element) next[x][y] = element; } +static void Lpush_element_old(int x, int y, int element) +{ + if (!game_em.use_old_push_elements) + return; + + cave[x][y] = element; + next[x][y] = element; +} + static boolean player_killed(struct PLAYER *ply) { int x = ply->x; @@ -5709,6 +5718,9 @@ static void Lpush_emerald_e(int x, int y) switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -5720,6 +5732,7 @@ static void Lpush_emerald_e(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xemerald); return; #ifdef ACID_ROLL @@ -5751,6 +5764,9 @@ static void Lpush_emerald_w(int x, int y) switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -5762,6 +5778,7 @@ static void Lpush_emerald_w(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xemerald); return; #ifdef ACID_ROLL @@ -5793,6 +5810,9 @@ static void Lpush_diamond_e(int x, int y) switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -5804,6 +5824,7 @@ static void Lpush_diamond_e(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xdiamond); return; #ifdef ACID_ROLL @@ -5835,6 +5856,9 @@ static void Lpush_diamond_w(int x, int y) switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -5846,6 +5870,7 @@ static void Lpush_diamond_w(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xdiamond); return; #ifdef ACID_ROLL @@ -5877,6 +5902,9 @@ static void Lpush_stone_e(int x, int y) switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -5888,6 +5916,7 @@ static void Lpush_stone_e(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xstone); return; #ifdef ACID_ROLL @@ -5919,6 +5948,9 @@ static void Lpush_stone_w(int x, int y) switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -5930,6 +5962,7 @@ static void Lpush_stone_w(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xstone); return; #ifdef ACID_ROLL @@ -5961,6 +5994,9 @@ static void Lpush_bomb_e(int x, int y) switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -5972,6 +6008,7 @@ static void Lpush_bomb_e(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xbomb); return; #ifdef ACID_ROLL @@ -6003,6 +6040,9 @@ static void Lpush_bomb_w(int x, int y) switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -6014,6 +6054,7 @@ static void Lpush_bomb_w(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xbomb); return; #ifdef ACID_ROLL @@ -6045,6 +6086,9 @@ static void Lpush_nut_e(int x, int y) switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -6056,6 +6100,7 @@ static void Lpush_nut_e(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xnut); return; #ifdef ACID_ROLL @@ -6087,6 +6132,9 @@ static void Lpush_nut_w(int x, int y) switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -6098,6 +6146,7 @@ static void Lpush_nut_w(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xnut); return; #ifdef ACID_ROLL @@ -6129,6 +6178,9 @@ static void Lpush_spring_e(int x, int y) switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -6140,6 +6192,7 @@ static void Lpush_spring_e(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xspring); return; #ifdef ACID_ROLL @@ -6171,6 +6224,9 @@ static void Lpush_spring_w(int x, int y) switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; case Zborder: case Zbug: case Ztank: @@ -6182,6 +6238,7 @@ static void Lpush_spring_w(int x, int y) case Xboom_tank: case Xboom_android: case Xboom_1: + Lpush_element_old(x, y, Xspring); return; #ifdef ACID_ROLL