rnd-20030209-1-src
[rocksndiamonds.git] / src / editor.c
index ed78feab149af7f69bbd7efbb7416d79d9ff8514..407d31073c8be9c6bd98c6f1a7e526297659a213 100644 (file)
 #define GADGET_ID_EM_SLIPPERY_GEMS     77
 #define GADGET_ID_CUSTOM_INDESTRUCTIBLE        78
 #define GADGET_ID_CUSTOM_CAN_FALL      79
-#define GADGET_ID_CUSTOM_SLIPPERY      80
+#define GADGET_ID_CUSTOM_CAN_SMASH     80
+#define GADGET_ID_CUSTOM_SLIPPERY      81
 
 /* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST    81
-#define GADGET_ID_ELEMENTLIST_LAST     (81 + ED_NUM_ELEMENTLIST_BUTTONS - 1)
+#define GADGET_ID_ELEMENTLIST_FIRST    82
+#define GADGET_ID_ELEMENTLIST_LAST     (GADGET_ID_ELEMENTLIST_FIRST +  \
+                                       ED_NUM_ELEMENTLIST_BUTTONS - 1)
 
 #define NUM_EDITOR_GADGETS             (GADGET_ID_ELEMENTLIST_LAST + 1)
 
 #define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS     4
 #define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE        5
 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL      6
-#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY      7
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH     7
+#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY      8
 
-#define ED_NUM_CHECKBUTTONS                    8
+#define ED_NUM_CHECKBUTTONS                    9
 
 #define ED_CHECKBUTTON_ID_LEVEL_FIRST  ED_CHECKBUTTON_ID_DOUBLE_SPEED
 #define ED_CHECKBUTTON_ID_LEVEL_LAST   ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
@@ -435,6 +438,7 @@ static struct
 {
   boolean indestructible;
   boolean can_fall;
+  boolean can_smash;
   boolean slippery;
 } custom_element_properties[NUM_CUSTOM_ELEMENTS];
 
@@ -707,6 +711,12 @@ static struct
   },
   {
     ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS(6),
+    GADGET_ID_CUSTOM_CAN_SMASH,
+    &custom_element_properties[0].can_smash,
+    "can smash",                       "element can smash other elements"
+  },
+  {
+    ED_SETTINGS_XPOS,                  ED_COUNTER_YPOS(7),
     GADGET_ID_CUSTOM_SLIPPERY,
     &custom_element_properties[0].slippery,
     "slippery",                                "other elements can fall down from it"
@@ -2477,6 +2487,9 @@ static void CopyCustomElementPropertiesToEditor()
     custom_element_properties[i].can_fall =
       ((properties & EP_BIT_CAN_FALL) != 0 ? TRUE : FALSE);
 
+    custom_element_properties[i].can_smash =
+      ((properties & EP_BIT_CAN_SMASH) != 0 ? TRUE : FALSE);
+
     custom_element_properties[i].slippery =
       ((properties & EP_BIT_SLIPPERY) != 0 ? TRUE : FALSE);
   }
@@ -2502,6 +2515,11 @@ static void CopyCustomElementPropertiesToGame()
     else
       Properties1[element] &= ~EP_BIT_CAN_FALL;
 
+    if (custom_element_properties[i].can_smash)
+      Properties1[element] |= EP_BIT_CAN_SMASH;
+    else
+      Properties1[element] &= ~EP_BIT_CAN_SMASH;
+
     if (custom_element_properties[i].slippery)
       Properties1[element] |= EP_BIT_SLIPPERY;
     else
@@ -3143,6 +3161,18 @@ static void DrawPropertiesWindow()
                 GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
     MapCheckbuttonGadget(i);
 
+    /* draw checkbutton gadget */
+    i = ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH;
+    x = checkbutton_info[i].x + xoffset_right2;
+    y = checkbutton_info[i].y + yoffset_right2;
+
+    checkbutton_info[i].value = &custom_element_properties[nr].can_smash;
+
+    DrawTextF(x, y, font_color, checkbutton_info[i].text);
+    ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
+                GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
+    MapCheckbuttonGadget(i);
+
     /* draw checkbutton gadget */
     i = ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY;
     x = checkbutton_info[i].x + xoffset_right2;