added support for initially moving spring to R'n'D game engine
authorHolger Schemel <info@artsoft.org>
Fri, 21 Aug 2020 16:45:04 +0000 (18:45 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 21 Aug 2020 18:01:44 +0000 (20:01 +0200)
src/conf_gfx.c
src/editor.c
src/game.c
src/init.c
src/main.c
src/main.h
src/tools.c

index 854fa2648da8cb81ab15d528c3a3d1edd5dfe292..daf471eb8fc95a23b0702f079c6e4b144004d6b7 100644 (file)
@@ -1764,6 +1764,11 @@ struct ConfigInfo image_config[] =
   { "spring.ypos",                             "13"                    },
   { "spring.frames",                           "1"                     },
 
+  { "spring.left",                             UNDEFINED_FILENAME      },
+  { "spring.left.clone_from",                  "spring"                },
+  { "spring.right",                            UNDEFINED_FILENAME      },
+  { "spring.right.clone_from",                 "spring"                },
+
   { "emc_steelwall_1",                         "RocksDC.png"           },
   { "emc_steelwall_1.xpos",                    "14"                    },
   { "emc_steelwall_1.ypos",                    "0"                     },
index 7931d89665ee533c75f9b6346322840ac4a597c9..edbef12d9b9237e3f6edd9c35075868ad147b022 100644 (file)
@@ -4056,13 +4056,13 @@ static int editor_el_emerald_mine_club[] =
 
   EL_EMC_MAGIC_BALL,
   EL_EMC_MAGIC_BALL_SWITCH,
-  EL_SPRING,
-  EL_EMC_SPRING_BUMPER,
-
   EL_EMC_LENSES,
   EL_EMC_MAGNIFIER,
-  EL_EMPTY,
-  EL_EMPTY,
+
+  EL_SPRING_LEFT,
+  EL_SPRING,
+  EL_SPRING_RIGHT,
+  EL_EMC_SPRING_BUMPER,
 
   EL_BALLOON,
   EL_YAMYAM_UP,
@@ -9741,6 +9741,8 @@ static struct
   { EL_EMC_LENSES,     &level.lenses_score,            TEXT_COLLECTING },
   { EL_EMC_MAGNIFIER,  &level.magnify_score,           TEXT_COLLECTING },
   { EL_SPRING,         &level.slurp_score,             TEXT_SLURPING   },
+  { EL_SPRING_LEFT,    &level.slurp_score,             TEXT_SLURPING   },
+  { EL_SPRING_RIGHT,   &level.slurp_score,             TEXT_SLURPING   },
   { EL_EMC_LENSES,     &level.lenses_time,             TEXT_DURATION   },
   { EL_EMC_MAGNIFIER,  &level.magnify_time,            TEXT_DURATION   },
   { EL_MM_FUSE_ACTIVE, &level.mm_time_fuse,            TEXT_DELAY_OFF  },
@@ -10016,7 +10018,9 @@ static void DrawPropertiesConfig(void)
   if (MAYBE_DONT_COLLIDE_WITH(properties_element))
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH);
 
-  if (properties_element == EL_SPRING)
+  if (properties_element == EL_SPRING ||
+      properties_element == EL_SPRING_LEFT ||
+      properties_element == EL_SPRING_RIGHT)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_SPRING_BUG);
 
   if (properties_element == EL_TIME_ORB_FULL)
index 8c243a4954c3bbec07e28c79afa20bfbbc1cec21..18a45fcf236d7d3a7f043bf286d1deb83bbf59ae 100644 (file)
@@ -1877,6 +1877,8 @@ static void InitField(int x, int y, boolean init_game)
     case EL_MOLE_RIGHT:
     case EL_MOLE_UP:
     case EL_MOLE_DOWN:
+    case EL_SPRING_LEFT:
+    case EL_SPRING_RIGHT:
       InitMovDir(x, y);
       break;
 
@@ -4489,6 +4491,12 @@ void InitMovDir(int x, int y)
       MovDir[x][y] = direction[2][element - EL_MOLE_LEFT];
       break;
 
+    case EL_SPRING_LEFT:
+    case EL_SPRING_RIGHT:
+      Feld[x][y] = EL_SPRING;
+      MovDir[x][y] = direction[2][element - EL_SPRING_LEFT];
+      break;
+
     default:
       if (IS_CUSTOM_ELEMENT(element))
       {
index 04d7f32a228cc26d53b5e85ce8143c3f6b83c194..708b7dd70c74377d84096b035bf3e9549aa79e67 100644 (file)
@@ -77,6 +77,11 @@ static int copy_properties[][5] =
     EL_MOLE_LEFT,              EL_MOLE_RIGHT,
     EL_MOLE_UP,                        EL_MOLE_DOWN
   },
+  {
+    EL_SPRING,
+    EL_SPRING_LEFT,            EL_SPRING_RIGHT,
+    EL_SPRING_LEFT,            EL_SPRING_RIGHT,        // (to match array size)
+  },
   {
     -1,
     -1, -1, -1, -1
@@ -2357,6 +2362,8 @@ static int get_special_property_bit(int element, int property_bit_nr)
     { EL_SP_ELECTRON,          15      },
     { EL_BALLOON,              16      },
     { EL_SPRING,               17      },
+    { EL_SPRING_LEFT,          17      },
+    { EL_SPRING_RIGHT,         17      },
     { EL_EMC_ANDROID,          18      },
 
     { -1,                      -1      },
index cb083658537519b87601c8137ac7adcc99a6174e..760d3c1508bd07c218a5f581c8915b510a59e1cb 100644 (file)
@@ -6269,6 +6269,16 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "df_wooden_wall",
     "wooden wall (DF style)",
   },
+  {
+    "spring.left",
+    "spring",
+    "spring (starts moving left)"
+  },
+  {
+    "spring.right",
+    "spring",
+    "spring (starts moving right)"
+  },
 
   // --------------------------------------------------------------------------
   // "real" (and therefore drawable) runtime elements
index ae52c9feefde0829d432c9da56e220abc83e8ae1..15b99ab6d298811d249e92eb8cd2c88ae02316e3 100644 (file)
 #define EL_MM_END_2                    (EL_DF_START2 + 430)
 #define EL_MM_END                      EL_MM_END_2
 
-#define NUM_FILE_ELEMENTS              1215
+#define EL_SPRING_LEFT                 1215
+#define EL_SPRING_RIGHT                        1216
+
+#define NUM_FILE_ELEMENTS              1217
 
 
 // "real" (and therefore drawable) runtime elements
index 70441d1c649eb06074c3fe77ef482de307668ac8..32d33f4d76d275195f200d63f5cdece94ce6142d 100644 (file)
@@ -6536,11 +6536,11 @@ em_object_mapping_list[GAME_TILE_MAX + 1] =
   },
   {
     Xspring_e,                         FALSE,  FALSE,
-    EL_SPRING,                         -1, -1
+    EL_SPRING_RIGHT,                   -1, -1
   },
   {
     Xspring_w,                         FALSE,  FALSE,
-    EL_SPRING,                         -1, -1
+    EL_SPRING_LEFT,                    -1, -1
   },
   {
     Xspring_fall,                      FALSE,  FALSE,
@@ -6628,12 +6628,12 @@ em_object_mapping_list[GAME_TILE_MAX + 1] =
     EL_NUT,                            -1, MV_BIT_LEFT
   },
   {
-    Xpush_spring_e,                    FALSE,  FALSE,
-    EL_SPRING,                         -1, MV_BIT_RIGHT
+    Xpush_spring_e,                    TRUE,   FALSE,
+    EL_SPRING_RIGHT,                   -1, MV_BIT_RIGHT
   },
   {
-    Xpush_spring_w,                    FALSE,  FALSE,
-    EL_SPRING,                         -1, MV_BIT_LEFT
+    Xpush_spring_w,                    TRUE,   FALSE,
+    EL_SPRING_LEFT,                    -1, MV_BIT_LEFT
   },
 
   {