fixed element scores for MM style elements (MM engine)
[rocksndiamonds.git] / src / editor.c
index 39f479822b30a51bd5d81619db7e192caf7f46f2..92b35d0f5f4f135fd8536dc2288bca9f7eb27a4e 100644 (file)
 #define ED_NUM_SELECTBOX                       29
 
 #define ED_SELECTBOX_ID_LEVEL_FIRST    ED_SELECTBOX_ID_TIME_OR_STEPS
-#define ED_SELECTBOX_ID_LEVEL_LAST     ED_SELECTBOX_ID_WIND_DIRECTION
+#define ED_SELECTBOX_ID_LEVEL_LAST     ED_SELECTBOX_ID_GAME_ENGINE_TYPE
 
 #define ED_SELECTBOX_ID_CUSTOM1_FIRST  ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE
 #define ED_SELECTBOX_ID_CUSTOM1_LAST   ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION
@@ -1332,7 +1332,7 @@ static struct
     "score for each second/step left:",        NULL, NULL
   },
   {
-    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(13),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(12),
     0,                                 9999,
     GADGET_ID_LEVEL_RANDOM_SEED_DOWN,  GADGET_ID_LEVEL_RANDOM_SEED_UP,
     GADGET_ID_LEVEL_RANDOM_SEED_TEXT,  GADGET_ID_NONE,
@@ -2347,24 +2347,24 @@ static struct
     NULL, "(0 => no limit)",           "time or step limit"
   },
   {
-    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(12),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(11),
     GADGET_ID_GAME_ENGINE_TYPE,                GADGET_ID_NONE,
     -1,
     options_game_engine_type,
     &level.game_engine_type,
     "game engine:", NULL,              "game engine"
   },
+
+  /* ---------- element settings: configure (several elements) ------------- */
+
   {
-    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(11),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
     GADGET_ID_WIND_DIRECTION,          GADGET_ID_NONE,
     -1,
     options_wind_direction,
     &level.wind_direction_initial,
     "initial wind direction:", NULL,   "initial wind direction"
   },
-
-  /* ---------- element settings: configure (several elements) ------------- */
-
   {
     ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(7),
     GADGET_ID_PLAYER_SPEED,            GADGET_ID_NONE,
@@ -5659,7 +5659,7 @@ static void ReinitializeElementList()
 
 void PrintEditorElementList()
 {
-  boolean *stop = &setup.editor.el_user_defined;
+  boolean *stop = &setup_editor_el_user_defined;
   int i, j;
 
   for (i = 0; editor_elements_info[i].setup_value != stop; i++)
@@ -8148,8 +8148,16 @@ static int getMaxEdFieldY(boolean has_scrollbar)
   return max_ed_fieldy;
 }
 
-void InitZoomLevelSettings()
+void InitZoomLevelSettings(int zoom_tilesize)
 {
+  if (zoom_tilesize == -1)
+    zoom_tilesize = setup.auto_setup.editor_zoom_tilesize;
+
+  // limit zoom tilesize by upper and lower bound
+  zoom_tilesize = MIN(MAX(MICRO_TILESIZE, zoom_tilesize), TILESIZE);
+
+  ed_tilesize = setup.auto_setup.editor_zoom_tilesize = zoom_tilesize;
+
   MAX_ED_FIELDX = getMaxEdFieldX(FALSE);
   MAX_ED_FIELDY = getMaxEdFieldY(FALSE);
 }
@@ -8170,7 +8178,7 @@ void DrawLevelEd()
 
   ClearField();
 
-  InitZoomLevelSettings();
+  InitZoomLevelSettings(-1);
 
   OpenDoor(DOOR_OPEN_1 | DOOR_OPEN_2 | DOOR_NO_DELAY);
 
@@ -9187,6 +9195,15 @@ static struct
   { EL_EMC_KEY_7,      &level.score[SC_KEY],           TEXT_COLLECTING },
   { EL_EMC_KEY_8,      &level.score[SC_KEY],           TEXT_COLLECTING },
   { EL_DC_KEY_WHITE,   &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_MM_KETTLE,      &level.score[SC_EMERALD],       TEXT_COLLECTING },
+  { EL_DF_CELL,                &level.score[SC_EMERALD],       TEXT_COLLECTING },
+  { EL_MM_KEY,         &level.score[SC_KEY],           TEXT_COLLECTING },
+  { EL_MM_LIGHTBALL,   &level.score[SC_ELEM_BONUS],    TEXT_COLLECTING },
+  { EL_MM_PACMAN,      &level.score[SC_PACMAN],        TEXT_SMASHING   },
+  { EL_MM_PACMAN_RIGHT,        &level.score[SC_PACMAN],        TEXT_SMASHING   },
+  { EL_MM_PACMAN_UP,   &level.score[SC_PACMAN],        TEXT_SMASHING   },
+  { EL_MM_PACMAN_LEFT, &level.score[SC_PACMAN],        TEXT_SMASHING   },
+  { EL_MM_PACMAN_DOWN, &level.score[SC_PACMAN],        TEXT_SMASHING   },
   { EL_AMOEBA_WET,     &level.amoeba_speed,            TEXT_AMOEBA_SPEED },
   { EL_AMOEBA_DRY,     &level.amoeba_speed,            TEXT_AMOEBA_SPEED },
   { EL_AMOEBA_FULL,    &level.amoeba_speed,            TEXT_AMOEBA_SPEED },
@@ -9237,6 +9254,7 @@ static boolean checkPropertiesConfig(int element)
   if (IS_GEM(element) ||
       IS_CUSTOM_ELEMENT(element) ||
       IS_GROUP_ELEMENT(element) ||
+      IS_BALLOON_ELEMENT(element) ||
       IS_ENVELOPE(element) ||
       IS_MM_MCDUFFIN(element) ||
       IS_DF_LASER(element) ||
@@ -9450,7 +9468,8 @@ static void DrawPropertiesConfig()
       ED_ELEMENT_SETTINGS_XPOS(IS_CUSTOM_ELEMENT(properties_element) ? 1 : 0);
     checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].y =
       ED_ELEMENT_SETTINGS_YPOS(IS_CUSTOM_ELEMENT(properties_element) ? 6 :
-                      HAS_EDITOR_CONTENT(properties_element) ? 1 : 0);
+                              IS_BALLOON_ELEMENT(properties_element) ||
+                              HAS_EDITOR_CONTENT(properties_element) ? 1 : 0);
 
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID);
   }
@@ -9477,6 +9496,9 @@ static void DrawPropertiesConfig()
       properties_element == EL_SOKOBAN_FIELD_FULL)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN);
 
+  if (IS_BALLOON_ELEMENT(properties_element))
+    MapSelectboxGadget(ED_SELECTBOX_ID_WIND_DIRECTION);
+
   if (IS_ENVELOPE(properties_element))
   {
     int counter1_id = ED_COUNTER_ID_ENVELOPE_XSIZE;
@@ -12881,7 +12903,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
       // limit zoom level by upper and lower bound
       ed_tilesize = MIN(MAX(MICRO_TILESIZE, ed_tilesize), TILESIZE);
 
-      InitZoomLevelSettings();
+      InitZoomLevelSettings(ed_tilesize);
 
       if (edit_mode == ED_MODE_DRAWING)
       {
@@ -12891,6 +12913,9 @@ static void HandleControlButtons(struct GadgetInfo *gi)
        PrintEditorGadgetInfoText(level_editor_gadget[id]);
       }
 
+      /* save current editor zoom tilesize */
+      SaveSetup_AutoSetup();
+
       break;
 
     case GADGET_ID_CUSTOM_COPY_FROM: