added configurable delay times for some MM style elements (MM engine)
authorHolger Schemel <info@artsoft.org>
Thu, 11 May 2017 21:22:41 +0000 (23:22 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:13 +0000 (23:21 +0100)
src/editor.c
src/files.c
src/game_mm/export.h
src/game_mm/mm_files.c
src/game_mm/mm_game.c
src/main.h

index 92b35d0f5f4f135fd8536dc2288bca9f7eb27a4e..c806313b87e379dcb9d2c05ad6e28bfeff567354 100644 (file)
@@ -9114,6 +9114,10 @@ static void DrawPropertiesInfo()
 #define TEXT_CRACKING          "Score for cracking"
 #define TEXT_AMOEBA_SPEED      "Speed of amoeba growth"
 #define TEXT_DURATION          "Duration when activated"
+#define TEXT_DELAY_ON          "Delay before activating"
+#define TEXT_DELAY_OFF         "Delay before deactivating"
+#define TEXT_DELAY_EXPLODING   "Delay before exploding"
+#define TEXT_DELAY_MOVING      "Delay before moving"
 #define TEXT_BALL_DELAY                "Element generation delay"
 #define TEXT_MOVE_SPEED                "Speed of android moving"
 #define TEXT_CLONE_SPEED       "Speed of android cloning"
@@ -9239,10 +9243,11 @@ static struct
   { EL_SPRING,         &level.slurp_score,             TEXT_SLURPING   },
   { EL_EMC_LENSES,     &level.lenses_time,             TEXT_DURATION   },
   { EL_EMC_MAGNIFIER,  &level.magnify_time,            TEXT_DURATION   },
-#if 0
-  /* defined, but currently not used in MM engine */
-  { EL_MM_FUSE_ACTIVE, &level.mm_time_fuse,            TEXT_DURATION   },
-#endif
+  { EL_MM_FUSE_ACTIVE, &level.mm_time_fuse,            TEXT_DELAY_OFF  },
+  { EL_MM_BOMB,                &level.mm_time_bomb,            TEXT_DELAY_EXPLODING },
+  { EL_MM_GRAY_BALL,   &level.mm_time_ball,            TEXT_DELAY_ON   },
+  { EL_MM_STEEL_BLOCK, &level.mm_time_block,           TEXT_DELAY_MOVING },
+  { EL_MM_WOODEN_BLOCK,        &level.mm_time_block,           TEXT_DELAY_MOVING },
 
   { -1,                        NULL,                           NULL            }
 };
index d42a2cd55e9effbcbdbb942dd06a167749b9354c..1af36af69caa494312ef5e9b8a1b955eb9cbb629 100644 (file)
@@ -839,9 +839,24 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
   },
 
   {
-    EL_MM_FUSE,                                -1,
+    EL_MM_FUSE_ACTIVE,                 -1,
     TYPE_INTEGER,                      CONF_VALUE_16_BIT(1),
-    &li.mm_time_fuse,                  0
+    &li.mm_time_fuse,                  25
+  },
+  {
+    EL_MM_BOMB,                                -1,
+    TYPE_INTEGER,                      CONF_VALUE_16_BIT(1),
+    &li.mm_time_bomb,                  75
+  },
+  {
+    EL_MM_GRAY_BALL,                   -1,
+    TYPE_INTEGER,                      CONF_VALUE_16_BIT(1),
+    &li.mm_time_ball,                  75
+  },
+  {
+    EL_MM_STEEL_BLOCK,                 -1,
+    TYPE_INTEGER,                      CONF_VALUE_16_BIT(1),
+    &li.mm_time_block,                 75
   },
   {
     EL_MM_LIGHTBALL,                   -1,
@@ -3997,7 +4012,10 @@ void CopyNativeLevel_RND_to_MM(struct LevelInfo *level)
   level_mm->score[SC_ELEM_BONUS] = level->score[SC_ELEM_BONUS];
 
   level_mm->amoeba_speed = level->amoeba_speed;
-  level_mm->time_fuse = level->mm_time_fuse;
+  level_mm->time_fuse    = level->mm_time_fuse;
+  level_mm->time_bomb    = level->mm_time_bomb;
+  level_mm->time_ball    = level->mm_time_ball;
+  level_mm->time_block   = level->mm_time_block;
 
   for (x = 0; x < level->fieldx; x++)
     for (y = 0; y < level->fieldy; y++)
@@ -4033,8 +4051,11 @@ void CopyNativeLevel_MM_to_RND(struct LevelInfo *level)
   level->score[SC_TIME_BONUS] = level_mm->score[SC_TIME_BONUS];
   level->score[SC_ELEM_BONUS] = level_mm->score[SC_ELEM_BONUS];
 
-  level->amoeba_speed = level_mm->amoeba_speed;
-  level->mm_time_fuse = level_mm->time_fuse;
+  level->amoeba_speed  = level_mm->amoeba_speed;
+  level->mm_time_fuse  = level_mm->time_fuse;
+  level->mm_time_bomb  = level_mm->time_bomb;
+  level->mm_time_ball  = level_mm->time_ball;
+  level->mm_time_block = level_mm->time_block;
 
   for (x = 0; x < level->fieldx; x++)
     for (y = 0; y < level->fieldy; y++)
index 31c01770df18c90b5f1ad8a9f046ff18441ab0d3..f48cd4738eb8d28d20c51455eccb2c14d7088da0 100644 (file)
@@ -171,6 +171,9 @@ struct LevelInfo_MM
   int score[MM_LEVEL_SCORE_ELEMENTS];
   int amoeba_speed;
   int time_fuse;
+  int time_bomb;
+  int time_ball;
+  int time_block;
 
   short field[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
 };
index 0b88735ec920e8bcac421222359fdc7bf4882ec6..1def7cc3eaf5459dca625a549a2c7f667f5084d6 100644 (file)
@@ -108,7 +108,10 @@ void setLevelInfoToDefaults_MM()
   native_mm_level.kettles_needed = 0;
   native_mm_level.auto_count_kettles = TRUE;
   native_mm_level.amoeba_speed = 0;
-  native_mm_level.time_fuse = 0;
+  native_mm_level.time_fuse = 25;
+  native_mm_level.time_bomb = 75;
+  native_mm_level.time_ball = 75;
+  native_mm_level.time_block = 75;
   native_mm_level.laser_red = FALSE;
   native_mm_level.laser_green = FALSE;
   native_mm_level.laser_blue = TRUE;
@@ -182,6 +185,10 @@ static int LoadLevel_MM_HEAD(File *file, int chunk_size,
   level->amoeba_speed          = getFile8Bit(file);
   level->time_fuse             = getFile8Bit(file);
 
+  // fuse time was 0 and hardcoded in game engine in level files up to 2.0.x
+  if (level->file_version <= MM_FILE_VERSION_2_0)
+    level->time_fuse = 25;
+
   laser_color                  = getFile8Bit(file);
   level->laser_red             = (laser_color >> 2) & 0x01;
   level->laser_green           = (laser_color >> 1) & 0x01;
index 1e6c30615c7f5b4b6b0473dedad998a4fadffcee..bb579712588767f19b1536b968c009973a61e1b9 100644 (file)
@@ -3303,7 +3303,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
   CT -= Ct;
 
-  if (element == EL_BOMB && CT > 75)
+  if (element == EL_BOMB && CT > native_mm_level.time_bomb)
   {
     if (game_mm.cheat_no_explosion)
       return;
@@ -3341,7 +3341,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     return;
   }
 
-  if (element == EL_FUSE_ON && CT > 25)
+  if (element == EL_FUSE_ON && CT > native_mm_level.time_fuse)
   {
     laser.fuse_off = TRUE;
     laser.fuse_x = ELX;
@@ -3351,7 +3351,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE);
   }
 
-  if (element == EL_BALL_GRAY && CT > 75)
+  if (element == EL_BALL_GRAY && CT > native_mm_level.time_ball)
   {
     static int new_elements[] =
     {
@@ -3638,7 +3638,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
   }
 
   if ((element == EL_BLOCK_WOOD || element == EL_BLOCK_STONE) &&
-      laser.stops_inside_element && CT > 75)
+      laser.stops_inside_element && CT > native_mm_level.time_block)
   {
     int x, y;
     int k;
index da76f7df76c26d96fc22ea35d9db4d97e2300635..d75c0ae1eb4fc3d247ee93b04cb66738f09a728a 100644 (file)
@@ -3061,6 +3061,9 @@ struct LevelInfo
   boolean mm_laser_red, mm_laser_green, mm_laser_blue;
   boolean df_laser_red, df_laser_green, df_laser_blue;
   int mm_time_fuse;
+  int mm_time_bomb;
+  int mm_time_ball;
+  int mm_time_block;
 
   /* ('int' instead of 'boolean' because used as selectbox value in editor) */
   int use_step_counter;                /* count steps instead of seconds for level */