added option to rotate newly created gray ball content for MM engine
authorHolger Schemel <info@artsoft.org>
Fri, 17 Feb 2023 20:15:00 +0000 (21:15 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 17 Feb 2023 20:15:00 +0000 (21:15 +0100)
src/editor.c
src/files.c
src/game_mm/export.h
src/game_mm/mm_game.c
src/main.h

index 23fb6db22508a537398438d1900225177307132b..c0fc04466e000ece5d8a5de2f9a75314f08214c7 100644 (file)
@@ -687,6 +687,7 @@ enum
   GADGET_ID_DF_LASER_RED,
   GADGET_ID_DF_LASER_GREEN,
   GADGET_ID_DF_LASER_BLUE,
+  GADGET_ID_ROTATE_MM_BALL_CONTENT,
   GADGET_ID_CUSTOM_INDESTRUCTIBLE,
   GADGET_ID_CUSTOM_CAN_EXPLODE,
   GADGET_ID_CUSTOM_EXPLODE_FIRE,
@@ -1000,6 +1001,7 @@ enum
   ED_CHECKBUTTON_ID_DF_LASER_RED,
   ED_CHECKBUTTON_ID_DF_LASER_GREEN,
   ED_CHECKBUTTON_ID_DF_LASER_BLUE,
+  ED_CHECKBUTTON_ID_ROTATE_MM_BALL_CONTENT,
   ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC,
   ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1,
   ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE,
@@ -3378,6 +3380,13 @@ static struct
     NULL, NULL,
     "blue",                            "use blue color components in laser"
   },
+  {
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(5),
+    GADGET_ID_ROTATE_MM_BALL_CONTENT,  GADGET_ID_NONE,
+    &level.rotate_mm_ball_content,
+    NULL, NULL,
+    "randomly rotate created content", "randomly rotate newly created content"
+  },
 
   // ---------- element settings: configure 1 (custom elements) ---------------
 
@@ -10137,6 +10146,7 @@ static void DrawPropertiesConfig(void)
     {
       MapCounterButtons(ED_COUNTER_ID_MM_BALL_CONTENT);
       MapSelectboxGadget(ED_SELECTBOX_ID_MM_BALL_CHOICE_MODE);
+      MapCheckbuttonGadget(ED_CHECKBUTTON_ID_ROTATE_MM_BALL_CONTENT);
 
       DrawMMBallContentArea();
     }
index 5439ca15d7e9cbf711c4e3a812ac3c19e60662d1..bd631a46fb31f38fb395d7d83246f33da60932c0 100644 (file)
@@ -921,6 +921,11 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.mm_ball_content,               EL_EMPTY, NULL,
     &li.num_mm_ball_contents,          8, MAX_MM_BALL_CONTENTS
   },
+  {
+    EL_MM_GRAY_BALL,                   -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(1),
+    &li.rotate_mm_ball_content,                TRUE
+  },
 
   {
     EL_MM_STEEL_BLOCK,                 -1,
@@ -4186,6 +4191,7 @@ static void CopyNativeLevel_RND_to_MM(struct LevelInfo *level)
 
   level_mm->num_ball_contents = level->num_mm_ball_contents;
   level_mm->ball_choice_mode = level->mm_ball_choice_mode;
+  level_mm->rotate_ball_content = level->rotate_mm_ball_content;
 
   for (i = 0; i < level->num_mm_ball_contents; i++)
     level_mm->ball_content[i] =
@@ -4237,6 +4243,7 @@ static void CopyNativeLevel_MM_to_RND(struct LevelInfo *level)
 
   level->num_mm_ball_contents = level_mm->num_ball_contents;
   level->mm_ball_choice_mode = level_mm->ball_choice_mode;
+  level->rotate_mm_ball_content = level_mm->rotate_ball_content;
 
   for (i = 0; i < level->num_mm_ball_contents; i++)
     level->mm_ball_content[i] =
index 8b92ab0a0a135cff67ae86e80328b6708bc458a7..7f31d68cdb2eeb741e6b8b06d5c166049997a12e 100644 (file)
@@ -179,6 +179,7 @@ struct LevelInfo_MM
   int num_ball_contents;
   int ball_choice_mode;
   int ball_content[MM_MAX_BALL_CONTENTS];
+  boolean rotate_ball_content;
 
   short field[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
 };
index 63d7690b72b232c420d817d5731eb8eb3508c073..267f4c5e106dc3b96ef89e4cedf1a0768910fc3a 100644 (file)
@@ -3493,7 +3493,11 @@ static void GameActions_MM_Ext(void)
 
       int new_element = native_mm_level.ball_content[element_pos];
 
-      Store[ELX][ELY] = get_rotated_element(new_element, RND(16));
+      // randomly rotate newly created game element, if needed
+      if (native_mm_level.rotate_ball_content)
+       new_element = get_rotated_element(new_element, RND(16));
+
+      Store[ELX][ELY] = new_element;
       Store2[ELX][ELY] = TRUE;
     }
 
index 4a81627afb45579af18e8b40a053b15021028d15..188f00b3dea4c07fd95817a094dcd65cd9f8289e 100644 (file)
@@ -3308,6 +3308,7 @@ struct LevelInfo
   int num_mm_ball_contents;
   int mm_ball_choice_mode;
   int mm_ball_content[MAX_MM_BALL_CONTENTS];
+  boolean rotate_mm_ball_content;
 
   // ('int' instead of 'boolean' because used as selectbox value in editor)
   int use_step_counter;                // count steps instead of seconds for level