added level editor support for Mirror Magic (and Deflektor) game elements
authorHolger Schemel <info@artsoft.org>
Wed, 15 Feb 2017 19:40:13 +0000 (20:40 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:07 +0000 (23:21 +0100)
src/editor.c
src/files.c
src/init.c
src/libgame/system.h

index 3d6b09809c7bcccd6fe643d415d0c2704c0a2013..6338734733b0ea65a74856e13b654570a0eb090b 100644 (file)
@@ -4215,6 +4215,116 @@ static int *editor_el_dx_boulderdash_ptr = editor_el_dx_boulderdash;
 static int num_editor_hl_dx_boulderdash = SIZEOF_ARRAY_INT(editor_hl_dx_boulderdash);
 static int num_editor_el_dx_boulderdash = SIZEOF_ARRAY_INT(editor_el_dx_boulderdash);
 
+static int editor_hl_mirror_magic[] =
+{
+  EL_INTERNAL_CASCADE_MM_ACTIVE,
+  EL_CHAR('M'),
+  EL_CHAR('M'),
+  EL_EMPTY,
+};
+
+static int editor_el_mirror_magic[] =
+{
+  EL_MM_MCDUFFIN_RIGHT,
+  EL_MM_MCDUFFIN_UP,
+  EL_MM_MCDUFFIN_LEFT,
+  EL_MM_MCDUFFIN_DOWN,
+
+  EL_MM_MIRROR_START,
+  EL_MM_MIRROR_FIXED_START,
+  EL_MM_POLARISATOR_START,
+  EL_MM_POLARISATOR_CROSS_START,
+
+  EL_MM_BEAMER_RED_START,
+  EL_MM_BEAMER_YELLOW_START,
+  EL_MM_BEAMER_GREEN_START,
+  EL_MM_BEAMER_BLUE_START,
+
+  EL_MM_PRISM,
+  EL_MM_FUSE_ACTIVE,
+  EL_MM_PACMAN_RIGHT,
+  EL_MM_EXIT_CLOSED,
+
+  EL_MM_KETTLE,
+  EL_MM_BOMB,
+  EL_MM_KEY,
+  EL_MM_FUEL_FULL,
+
+  EL_MM_LIGHTBULB,
+  EL_MM_LIGHTBULB_ACTIVE,
+  EL_MM_GRAY_BALL,
+  EL_MM_LIGHTBALL,
+
+  EL_MM_STEEL_WALL,
+  EL_MM_WOODEN_WALL,
+  EL_MM_ICE_WALL,
+  EL_MM_AMOEBA_WALL,
+
+  EL_MM_STEEL_LOCK,
+  EL_MM_WOODEN_LOCK,
+  EL_MM_STEEL_BLOCK,
+  EL_MM_WOODEN_BLOCK,
+
+  EL_MM_STEEL_GRID_FIXED_1,
+  EL_MM_STEEL_GRID_FIXED_2,
+  EL_MM_STEEL_GRID_FIXED_3,
+  EL_MM_STEEL_GRID_FIXED_4,
+
+  EL_MM_WOODEN_GRID_FIXED_1,
+  EL_MM_WOODEN_GRID_FIXED_2,
+  EL_MM_WOODEN_GRID_FIXED_3,
+  EL_MM_WOODEN_GRID_FIXED_4
+};
+static int *editor_hl_mirror_magic_ptr = editor_hl_mirror_magic;
+static int *editor_el_mirror_magic_ptr = editor_el_mirror_magic;
+static int num_editor_hl_mirror_magic = SIZEOF_ARRAY_INT(editor_hl_mirror_magic);
+static int num_editor_el_mirror_magic = SIZEOF_ARRAY_INT(editor_el_mirror_magic);
+
+static int editor_hl_deflektor[] =
+{
+  EL_INTERNAL_CASCADE_DF_ACTIVE,
+  EL_CHAR('D'),
+  EL_CHAR('F'),
+  EL_EMPTY,
+};
+
+static int editor_el_deflektor[] =
+{
+  EL_DF_LASER_RIGHT,
+  EL_DF_LASER_UP,
+  EL_DF_LASER_LEFT,
+  EL_DF_LASER_DOWN,
+
+  EL_DF_RECEIVER_RIGHT,
+  EL_DF_RECEIVER_UP,
+  EL_DF_RECEIVER_LEFT,
+  EL_DF_RECEIVER_DOWN,
+
+  EL_DF_MIRROR_START,
+  EL_DF_MIRROR_ROTATING_START,
+  EL_DF_CELL,
+  EL_DF_MINE,
+
+  EL_DF_FIBRE_OPTIC_RED_1,
+  EL_DF_FIBRE_OPTIC_YELLOW_1,
+  EL_DF_FIBRE_OPTIC_GREEN_1,
+  EL_DF_FIBRE_OPTIC_BLUE_1,
+
+  EL_DF_STEEL_GRID_FIXED_START,
+  EL_DF_STEEL_GRID_ROTATING_START,
+  EL_DF_WOODEN_GRID_FIXED_START,
+  EL_DF_WOODEN_GRID_ROTATING_START,
+
+  EL_DF_STEEL_WALL,
+  EL_DF_WOODEN_WALL,
+  EL_DF_REFRACTOR,
+  EL_EMPTY
+};
+static int *editor_hl_deflektor_ptr = editor_hl_deflektor;
+static int *editor_el_deflektor_ptr = editor_el_deflektor;
+static int num_editor_hl_deflektor = SIZEOF_ARRAY_INT(editor_hl_deflektor);
+static int num_editor_el_deflektor = SIZEOF_ARRAY_INT(editor_el_deflektor);
+
 static int editor_hl_chars[] =
 {
   EL_INTERNAL_CASCADE_CHARS_ACTIVE,
@@ -4984,6 +5094,18 @@ editor_elements_info[] =
     &editor_hl_dx_boulderdash_ptr,     &num_editor_hl_dx_boulderdash,
     &editor_el_dx_boulderdash_ptr,     &num_editor_el_dx_boulderdash
   },
+  {
+    &setup.editor.el_classic,
+    &setup.editor_cascade.el_mm,
+    &editor_hl_mirror_magic_ptr,       &num_editor_hl_mirror_magic,
+    &editor_el_mirror_magic_ptr,       &num_editor_el_mirror_magic
+  },
+  {
+    &setup.editor.el_classic,
+    &setup.editor_cascade.el_df,
+    &editor_hl_deflektor_ptr,          &num_editor_hl_deflektor,
+    &editor_el_deflektor_ptr,          &num_editor_el_deflektor
+  },
   {
     &setup.editor.el_classic,
     &setup.editor_cascade.el_chars,
@@ -5236,7 +5358,7 @@ static void ReinitializeElementList()
        Error(ERR_WARN, "editor element %d is runtime element", element);
 
       if (strEqual(getElementInfoText(element), INFOTEXT_UNKNOWN_ELEMENT))
-       Error(ERR_WARN, "no element description for element %d", element);
+       Error(ERR_WARN, "no element description text for element %d", element);
     }
   }
 
@@ -7802,7 +7924,8 @@ void CheckElementDescriptions()
 
   for (i = 0; i < NUM_FILE_ELEMENTS; i++)
     if (getElementDescriptionFilename(i) == NULL && !IS_OBSOLETE(i))
-      Error(ERR_WARN, "no element description for element '%s'", EL_NAME(i));
+      Error(ERR_WARN, "no element description file for element '%s'",
+           EL_NAME(i));
 }
 
 static int getMaxEdFieldX(boolean has_scrollbar)
index e387efc789eab8e6cfb9fedf6e033a8ab28a533f..ebb61203b4793a13dfc02be87f13d176fe036af3 100644 (file)
@@ -8331,6 +8331,8 @@ static struct TokenInfo editor_cascade_setup_tokens[] =
   { TYPE_SWITCH, &seci.el_sp,          "editor.cascade.el_sp"          },
   { TYPE_SWITCH, &seci.el_dc,          "editor.cascade.el_dc"          },
   { TYPE_SWITCH, &seci.el_dx,          "editor.cascade.el_dx"          },
+  { TYPE_SWITCH, &seci.el_mm,          "editor.cascade.el_mm"          },
+  { TYPE_SWITCH, &seci.el_df,          "editor.cascade.el_df"          },
   { TYPE_SWITCH, &seci.el_chars,       "editor.cascade.el_chars"       },
   { TYPE_SWITCH, &seci.el_steel_chars, "editor.cascade.el_steel_chars" },
   { TYPE_SWITCH, &seci.el_ce,          "editor.cascade.el_ce"          },
@@ -8524,6 +8526,10 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->editor.el_supaplex               = TRUE;
   si->editor.el_diamond_caves          = TRUE;
   si->editor.el_dx_boulderdash         = TRUE;
+
+  si->editor.el_mirror_magic           = TRUE;
+  si->editor.el_deflektor              = TRUE;
+
   si->editor.el_chars                  = TRUE;
   si->editor.el_steel_chars            = TRUE;
 
@@ -8659,6 +8665,9 @@ static void setSetupInfoToDefaults_EditorCascade(struct SetupInfo *si)
   si->editor_cascade.el_dc             = TRUE;
   si->editor_cascade.el_dx             = TRUE;
 
+  si->editor_cascade.el_mm             = TRUE;
+  si->editor_cascade.el_df             = TRUE;
+
   si->editor_cascade.el_chars          = FALSE;
   si->editor_cascade.el_steel_chars    = FALSE;
   si->editor_cascade.el_ce             = FALSE;
index 6980eb9aecf61ac491540be33597d16563365fb1..48cb8973be387bf5d7d68985b3cfcd9cf2c275ec 100644 (file)
@@ -4261,6 +4261,8 @@ void InitElementPropertiesStatic()
     EL_INTERNAL_CASCADE_SP_ACTIVE,
     EL_INTERNAL_CASCADE_DC_ACTIVE,
     EL_INTERNAL_CASCADE_DX_ACTIVE,
+    EL_INTERNAL_CASCADE_MM_ACTIVE,
+    EL_INTERNAL_CASCADE_DF_ACTIVE,
     EL_INTERNAL_CASCADE_CHARS_ACTIVE,
     EL_INTERNAL_CASCADE_STEEL_CHARS_ACTIVE,
     EL_INTERNAL_CASCADE_CE_ACTIVE,
@@ -4282,6 +4284,8 @@ void InitElementPropertiesStatic()
     EL_INTERNAL_CASCADE_SP,
     EL_INTERNAL_CASCADE_DC,
     EL_INTERNAL_CASCADE_DX,
+    EL_INTERNAL_CASCADE_MM,
+    EL_INTERNAL_CASCADE_DF,
     EL_INTERNAL_CASCADE_CHARS,
     EL_INTERNAL_CASCADE_STEEL_CHARS,
     EL_INTERNAL_CASCADE_CE,
index efc4490d7e2fdaf65e9d6b92349ea44459007a8f..730c8a7fd1e3c245bc8283aac4886b271358ac6d 100644 (file)
@@ -994,6 +994,10 @@ struct SetupEditorInfo
   boolean el_supaplex;
   boolean el_diamond_caves;
   boolean el_dx_boulderdash;
+
+  boolean el_mirror_magic;
+  boolean el_deflektor;
+
   boolean el_chars;
   boolean el_steel_chars;
 
@@ -1022,6 +1026,8 @@ struct SetupEditorCascadeInfo
   boolean el_sp;
   boolean el_dc;
   boolean el_dx;
+  boolean el_mm;
+  boolean el_df;
   boolean el_chars;
   boolean el_steel_chars;
   boolean el_ce;