added level editor option for buggy BD style teleporter
authorHolger Schemel <holger.schemel@virtion.de>
Sat, 5 Oct 2024 11:51:43 +0000 (13:51 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Sat, 5 Oct 2024 11:51:51 +0000 (13:51 +0200)
src/editor.c
src/files.c
src/game_bd/bd_cave.h
src/game_bd/bd_cavedb.c
src/game_bd/bd_caveengine.c
src/main.h

index 756dc18e87c6b95b723a98af1ec8cca0604fad98..d656d3b9f8f848cc5fb15a569866c2298b147f50 100644 (file)
@@ -870,6 +870,7 @@ enum
   GADGET_ID_BD_WATER_CANNOT_FLOW_DOWN,
   GADGET_ID_BD_HAMMER_WALLS_REAPPEAR,
   GADGET_ID_BD_INFINITE_ROCKETS,
+  GADGET_ID_BD_BUGGY_TELEPORTER,
   GADGET_ID_BD_CREATURES_START_BACKWARDS,
   GADGET_ID_BD_CREATURES_TURN_ON_HATCHING,
   GADGET_ID_BD_GRAVITY_SWITCH_ACTIVE,
@@ -1270,6 +1271,7 @@ enum
   ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN,
   ED_CHECKBUTTON_ID_BD_HAMMER_WALLS_REAPPEAR,
   ED_CHECKBUTTON_ID_BD_INFINITE_ROCKETS,
+  ED_CHECKBUTTON_ID_BD_BUGGY_TELEPORTER,
   ED_CHECKBUTTON_ID_BD_CREATURES_START_BACKWARDS,
   ED_CHECKBUTTON_ID_BD_CREATURES_TURN_ON_HATCHING,
   ED_CHECKBUTTON_ID_BD_GRAVITY_SWITCH_ACTIVE,
@@ -4418,6 +4420,14 @@ static struct
     NULL, NULL,
     "Infinite rockets",                                "Rocket launcher has infinite rockets"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_BUGGY_TELEPORTER,
+    ED_ELEMENT_SETTINGS_XPOS(0),               ED_ELEMENT_SETTINGS_YPOS(0),
+    GADGET_ID_BD_BUGGY_TELEPORTER,             GADGET_ID_NONE,
+    &level.bd_buggy_teleporter,
+    NULL, NULL,
+    "Use buggy teleporter",                    "Teleporter only works from two sides"
+  },
   {
     ED_CHECKBUTTON_ID_BD_CREATURES_START_BACKWARDS,
     ED_ELEMENT_SETTINGS_XPOS(0),               ED_ELEMENT_SETTINGS_YPOS(0),
@@ -12689,6 +12699,7 @@ static boolean checkPropertiesConfig(int element)
       element == EL_BDX_HEAVY_ROCK ||
       element == EL_BDX_BOMB ||
       element == EL_BDX_ROCKET_LAUNCHER ||
+      element == EL_BDX_TELEPORTER ||
       element == EL_BDX_NITRO_PACK ||
       element == EL_BDX_SWEET ||
       element == EL_BDX_VOODOO_DOLL ||
@@ -13151,6 +13162,11 @@ static void DrawPropertiesConfig(void)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_INFINITE_ROCKETS);
   }
 
+  if (properties_element == EL_BDX_TELEPORTER)
+  {
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_BUGGY_TELEPORTER);
+  }
+
   if (properties_element == EL_BDX_CREATURE_SWITCH)
   {
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CREATURES_START_BACKWARDS);
index 74fc442eac0a45fcc848943b602f81171da6bc18..50abce3a73d2931011226e86ce2d95b75819d73d 100644 (file)
@@ -1022,6 +1022,12 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.bd_infinite_rockets,           FALSE
   },
 
+  {
+    EL_BDX_TELEPORTER,                 -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(1),
+    &li.bd_buggy_teleporter,           FALSE
+  },
+
   {
     EL_BDX_SKELETON,                   -1,
     TYPE_INTEGER,                      CONF_VALUE_8_BIT(1),
@@ -4432,6 +4438,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
 
   cave->infinite_rockets               = level->bd_infinite_rockets;
 
+  cave->buggy_teleporter               = level->bd_buggy_teleporter;
+
   cave->skeletons_needed_for_pot       = level->bd_num_skeletons_needed_for_pot;
   cave->skeletons_worth_diamonds       = level->bd_skeleton_worth_num_diamonds;
 
@@ -4617,6 +4625,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
 
   level->bd_infinite_rockets           = cave->infinite_rockets;
 
+  level->bd_buggy_teleporter           = cave->buggy_teleporter;
+
   level->bd_num_skeletons_needed_for_pot= cave->skeletons_needed_for_pot;
   level->bd_skeleton_worth_num_diamonds        = cave->skeletons_worth_diamonds;
 
index 91d46cb60602b54406f33b61aaba5065714fffa3..0c7300e7b62df1f1dea0d7a970668623872144b0 100644 (file)
@@ -561,6 +561,8 @@ typedef struct _gd_cave
   boolean infinite_rockets;             // if true, the player which got a rocket launcher will be
                                         // able to launch an infinite number of rockets
 
+  boolean buggy_teleporter;            // use old, buggy teleporter behavior
+
   // internal variables, used during the game. private data :)
 
   // returns range corrected x/y position (points to perfect or line shifting get function)
index 247ea53e15fa911a4812733d9586618872062cb3..1e30fbb513fca696c47af3a992ee2cdb2c7b28d9 100644 (file)
@@ -2283,6 +2283,11 @@ const GdStructDescriptor gd_cave_properties[] =
     N_("Infinite rockets"), CAVE_OFFSET(infinite_rockets), 1,
     N_("If it is true, the player is able to launch an infinite number of rockets. Otherwise every rocket launcher contains only a single rocket.")
   },
+  {
+    "Teleporter.buggy", GD_TYPE_BOOLEAN, 0,
+    N_("Buggy teleporter"), CAVE_OFFSET(buggy_teleporter), 1,
+    N_("If it is true, the player can only enter a teleporter from two sides (right and bottom side). Otherwise, the teleporter works as expected, and the player can enter from all four sides.")
+  },
 
   // pneumatic hammer
   {
@@ -3210,6 +3215,9 @@ GdPropertyDefault gd_cave_defaults_gdash[] =
   // bladder
   { CAVE_OFFSET(bladder_converts_by),                          O_VOODOO                        },
 
+  // teleporter
+  { CAVE_OFFSET(buggy_teleporter),                             TRUE                            },
+
   // SOUND
   { CAVE_OFFSET(amoeba_sound),                                 TRUE                            },
   { CAVE_OFFSET(magic_wall_sound),                             TRUE                            },
index 99880bbbf9432a2241da05aeda5497ac81d37036..df6553dcf7421f59d05cc0ceef49f4eb8c2f43d4 100644 (file)
@@ -1183,9 +1183,9 @@ static GdElement player_eat_element(GdCave *cave, const GdElement element, int x
 // @return True, if the player is teleported, false, if no suitable teleporter found.
 static boolean do_teleporter(GdCave *cave, int px, int py, GdDirection player_move)
 {
-  // start at teleporter position (not at player position!)
-  int tx_start = px + gd_dx[player_move];
-  int ty_start = py + gd_dy[player_move];
+  // start at teleporter position (not at player position!) unless using buggy behaviour
+  int tx_start = px + (cave->buggy_teleporter ? 0 : gd_dx[player_move]);
+  int ty_start = py + (cave->buggy_teleporter ? 0 : gd_dy[player_move]);
   int tx = tx_start;
   int ty = ty_start;
 
index 5a5e89fdef671a842fbe8e45c071b78d9772627a..d7d32fbfa51013ad0b294b8b9827fd3fc19c8448 100644 (file)
@@ -3868,6 +3868,7 @@ struct LevelInfo
   boolean bd_hammer_walls_reappear;    // BD hammered walls are reappearing after some delay
   int bd_hammer_walls_reappear_delay;  // BD hammer time for reappearing walls (in BD frames)
   boolean bd_infinite_rockets;         // BD rocket launcher has infinite number of rockets
+  boolean bd_buggy_teleporter;         // BD teleporter setting to implement buggy behaviour
   int bd_num_skeletons_needed_for_pot; // BD skeletons amount must be collected to use a pot
   int bd_skeleton_worth_num_diamonds;  // BD skeleton collected is worth this number of diamonds
   int bd_expanding_wall_looks_like;    // BD expanding wall looks like this other game element