From: Holger Schemel Date: Fri, 29 Nov 2024 19:04:55 +0000 (+0100) Subject: added newly born player being invulnerable for exactly one frame X-Git-Tag: 4.4.0.0-test-4~15 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=70584ce2d3b0c5491f2d31bfa4023db9b2bdf0ff;p=rocksndiamonds.git added newly born player being invulnerable for exactly one frame If player is hatched from inbox and all pre-birth effect elements are processed, add one single game frame of invulnerability for the player against being instantly killed by enemies by using a special element. by using a special element This is needed to be able to solve level 017 of "Arno Dash 02". --- diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index 520c3fa4..7227a5cb 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -1573,9 +1573,11 @@ void gd_drawcave_game(const GdCave *cave, } elemmapping[O_PLAYER] = map; + elemmapping[O_PLAYER_START] = map; elemmapping[O_PLAYER_GLUED] = map; elemdrawing[O_PLAYER] = draw; + elemdrawing[O_PLAYER_START] = draw; elemdrawing[O_PLAYER_GLUED] = draw; // player with bomb/rocketlauncher does not blink or tap - no graphics drawn for that. diff --git a/src/game_bd/bd_cavedb.c b/src/game_bd/bd_cavedb.c index 5ddc802a..5798638a 100644 --- a/src/game_bd/bd_cavedb.c +++ b/src/game_bd/bd_cavedb.c @@ -1263,6 +1263,16 @@ GdElementProperty gd_element_properties[] = P_GROWING, "GUYBIRTH3", 0, 34, 34, 34 }, + { + O_PLAYER_START, O_PLAYER_START_scanned, N_("Player start"), + P_PLAYER | P_CAN_DIG, + "GUYSTART", 0, i_player, i_player, 35, 32 + }, // has ckdelay + { + O_PLAYER_START_scanned, O_PLAYER_START, N_("Player start (scanned)"), + P_SCANNED, + "SCANN_GUYSTART", 0, i_player, i_player, 35 + }, { O_PLAYER, O_PLAYER_scanned, N_("Player"), P_BLOWS_UP_FLIES | P_EXPLODES_BY_HIT | P_PLAYER | P_CAN_DIG, diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index c6b8a30b..2db332a2 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -968,6 +968,7 @@ static void explode(GdCave *cave, int x, int y) break; case O_PLAYER: + case O_PLAYER_START: case O_PLAYER_BOMB: case O_PLAYER_GLUED: case O_PLAYER_STIRRING: @@ -1967,6 +1968,10 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, // P L A Y E R S // ====================================================================================== + case O_PLAYER_START: + store(cave, x, y, O_PLAYER); + // FALL THROUGH + case O_PLAYER: if (cave->kill_player) { @@ -3604,6 +3609,7 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, // if scanning stopped by a player... start falling! if (get(cave, x, yy) == O_PLAYER || + get(cave, x, yy) == O_PLAYER_START || get(cave, x, yy) == O_PLAYER_GLUED || get(cave, x, yy) == O_PLAYER_BOMB) { @@ -3862,7 +3868,7 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, if (!cave->hatched) // no player birth before hatching break; cave->player_seen_ago = 0; - store(cave, x, y, O_PLAYER); + store(cave, x, y, O_PLAYER_START); // newly born player invulnerable for one frame break; case O_PRE_DIA_1: diff --git a/src/game_bd/bd_elements.h b/src/game_bd/bd_elements.h index 032eabba..6b306a9f 100644 --- a/src/game_bd/bd_elements.h +++ b/src/game_bd/bd_elements.h @@ -262,6 +262,8 @@ typedef enum _element O_PRE_PL_1, O_PRE_PL_2, O_PRE_PL_3, + O_PLAYER_START, + O_PLAYER_START_scanned, O_PLAYER, O_PLAYER_scanned, O_PLAYER_BOMB, diff --git a/src/game_bd/main_bd.c b/src/game_bd/main_bd.c index 6a1aab9a..1bcd740b 100644 --- a/src/game_bd/main_bd.c +++ b/src/game_bd/main_bd.c @@ -381,6 +381,7 @@ void GameActions_BD(byte action[MAX_PLAYERS]) int element = *cave->getp(cave, x, y); if (element == O_PLAYER || + element == O_PLAYER_START || element == O_PLAYER_BOMB || element == O_PLAYER_STIRRING || element == O_PLAYER_PNEUMATIC_LEFT || diff --git a/src/tools.c b/src/tools.c index e59ee2c3..054ae399 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6955,6 +6955,10 @@ bd_object_mapping_list[] = O_PRE_PL_3, FALSE, EL_BDX_PLAYER, ACTION_GROWING, -1 }, + { + O_PLAYER_START, TRUE, + EL_BDX_PLAYER, -1, -1 + }, { O_PLAYER, TRUE, EL_BDX_PLAYER, -1, -1