added newly born player being invulnerable for exactly one frame
authorHolger Schemel <holger.schemel@virtion.de>
Fri, 29 Nov 2024 19:04:55 +0000 (20:04 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Fri, 29 Nov 2024 15:11:24 +0000 (16:11 +0100)
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".

src/game_bd/bd_cave.c
src/game_bd/bd_cavedb.c
src/game_bd/bd_caveengine.c
src/game_bd/bd_elements.h
src/game_bd/main_bd.c
src/tools.c

index 520c3fa42b8e6e50fc8012d301bdb7a14cea3638..7227a5cbc7cf523d75415599a9a9c08430cc7985 100644 (file)
@@ -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.
index 5ddc802a000c17b6cfa3eea3a083fc7dc8375eb2..5798638a2c88be0fbdd9d4fe017dd7a460bd260f 100644 (file)
@@ -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,
index c6b8a30b7403c4345b3354755df0f2ebebb3825e..2db332a22da01d7b2ddbdabae73b5c2abc136495 100644 (file)
@@ -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:
index 032eabba8e1591af15b1be28c4c2e37a647d59e7..6b306a9fe6ffd02840daee52c8f9c2cabf5f6090 100644 (file)
@@ -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,
index 6a1aab9a6271f720922bee35d3fba1918812c979..1bcd740bdb2946d6807f4b54f08ad70391816f55 100644 (file)
@@ -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 ||
index e59ee2c3a2a7bf1f6c0bf336f49bd2c8c43bf57b..054ae399950b13c21d13010bcb77158b34b1b979 100644 (file)
@@ -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