rnd-20080205-1-src
authorHolger Schemel <info@artsoft.org>
Tue, 5 Feb 2008 01:02:54 +0000 (02:02 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:56:55 +0000 (10:56 +0200)
src/conftime.h
src/editor.c
src/files.c
src/game.c
src/init.c
src/init.h
src/main.h

index 8159e8c281060074c32d3e5d37a07c6ec0aa1c7b..ad266fc2f60de967605c4bbee32da7b1403b8dbc 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2008-02-04 01:02"
+#define COMPILE_DATE_STRING "2008-02-05 01:45"
index ff9906d457abe9c68002cc6020bf25cada810a1f..c3583d4b61f7be115a5733d068301d8ceab4e70d 100644 (file)
@@ -1714,6 +1714,7 @@ static struct ValueTextInfo options_action_type[] =
   { CA_HEADLINE_CE_ACTIONS,    "[CE]"                          },
   { CA_SET_CE_VALUE,           "set CE value"                  },
   { CA_SET_CE_SCORE,           "set CE score"                  },
+  { CA_SET_CE_ARTWORK,         "set artwork"                   },
   { CA_UNDEFINED,              " "                             },
   { CA_HEADLINE_ENGINE_ACTIONS,        "[engine]"                      },
   { CA_SET_ENGINE_SCAN_MODE,   "set scan mode"                 },
@@ -2037,6 +2038,7 @@ action_arg_options[] =
   { CA_SET_PLAYER_INVENTORY,   0,      options_action_arg_inventory,   },
   { CA_SET_CE_VALUE,           3,      options_action_arg_value,       },
   { CA_SET_CE_SCORE,           3,      options_action_arg_value,       },
+  { CA_SET_CE_ARTWORK,         1,      options_action_arg_artwork,     },
   { CA_SET_ENGINE_SCAN_MODE,   1,      options_action_arg_scan_mode,   },
 
   { -1,                                FALSE,  NULL                            }
@@ -3100,7 +3102,7 @@ static struct
   {
     -1,                                        ED_AREA_1X1_SETTINGS_YPOS(1),
     GADGET_ID_CUSTOM_GRAPHIC,          GADGET_ID_CUSTOM_USE_GRAPHIC,
-    &custom_element.gfx_element,       1, 1,
+    &custom_element.gfx_element_initial,1, 1,
     NULL, NULL, NULL,                  "custom graphic element"
   },
 
@@ -7166,6 +7168,8 @@ void DrawLevelEd()
   ReinitializeElementList();           /* update dynamic level element list */
   ReinitializeElementListButtons();    /* custom element may look different */
 
+  InitElementPropertiesGfxElement();
+
 #if 1
   UnmapAllGadgets();
 #else
@@ -8538,8 +8542,12 @@ static void DrawPropertiesWindow()
 
 static void UpdateCustomElementGraphicGadgets()
 {
+  struct ElementInfo *ei = &element_info[properties_element];
   int i;
 
+  ei->gfx_element = (ei->use_gfx_element ? ei->gfx_element_initial :
+                    properties_element);
+
   ModifyEditorElementList();
   RedrawDrawingElements();
 
index 7a29e1eebac839ff06d01b1bc3a068a3404a3c38..dd9a274db79e574f7cdcc42d2b975d3fa92c585d 100644 (file)
@@ -870,8 +870,8 @@ static struct LevelFileConfigInfo chunk_config_CUSX_base[] =
   {
     -1,                                        -1,
     TYPE_ELEMENT,                      CONF_VALUE_16_BIT(1),
-    &xx_ei.gfx_element,                        EL_EMPTY_SPACE,
-    &yy_ei.gfx_element
+    &xx_ei.gfx_element_initial,                EL_EMPTY_SPACE,
+    &yy_ei.gfx_element_initial
   },
 
   {
@@ -1202,7 +1202,7 @@ static struct LevelFileConfigInfo chunk_config_GRPX[] =
   {
     -1,                                        -1,
     TYPE_ELEMENT,                      CONF_VALUE_16_BIT(1),
-    &xx_ei.gfx_element,                        EL_EMPTY_SPACE
+    &xx_ei.gfx_element_initial,                EL_EMPTY_SPACE
   },
 
   {
@@ -2428,7 +2428,7 @@ static int LoadLevel_CUS3(FILE *file, int chunk_size, struct LevelInfo *level)
     ReadUnusedBytesFromFile(file, 7);
 
     ei->use_gfx_element = getFile8Bit(file);
-    ei->gfx_element = getMappedElement(getFile16BitBE(file));
+    ei->gfx_element_initial = getMappedElement(getFile16BitBE(file));
 
     ei->collect_score_initial = getFile8Bit(file);
     ei->collect_count_initial = getFile8Bit(file);
@@ -2527,7 +2527,7 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level)
   ei->use_last_ce_value = getFile8Bit(file);
 
   ei->use_gfx_element = getFile8Bit(file);
-  ei->gfx_element = getMappedElement(getFile16BitBE(file));
+  ei->gfx_element_initial = getMappedElement(getFile16BitBE(file));
 
   ei->collect_score_initial = getFile8Bit(file);
   ei->collect_count_initial = getFile8Bit(file);
@@ -2660,7 +2660,7 @@ static int LoadLevel_GRP1(FILE *file, int chunk_size, struct LevelInfo *level)
   group->num_elements = getFile8Bit(file);
 
   ei->use_gfx_element = getFile8Bit(file);
-  ei->gfx_element = getMappedElement(getFile16BitBE(file));
+  ei->gfx_element_initial = getMappedElement(getFile16BitBE(file));
 
   group->choice_mode = getFile8Bit(file);
 
@@ -6493,6 +6493,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename)
   /* initialize element properties for level editor etc. */
   InitElementPropertiesEngine(level->game_version);
   InitElementPropertiesAfterLoading(level->game_version);
+  InitElementPropertiesGfxElement();
 }
 
 static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename)
@@ -6871,7 +6872,7 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level,
        WriteUnusedBytesToFile(file, 7);
 
        putFile8Bit(file, ei->use_gfx_element);
-       putFile16BitBE(file, ei->gfx_element);
+       putFile16BitBE(file, ei->gfx_element_initial);
 
        putFile8Bit(file, ei->collect_score_initial);
        putFile8Bit(file, ei->collect_count_initial);
@@ -6950,7 +6951,7 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element)
   putFile8Bit(file, ei->use_last_ce_value);
 
   putFile8Bit(file, ei->use_gfx_element);
-  putFile16BitBE(file, ei->gfx_element);
+  putFile16BitBE(file, ei->gfx_element_initial);
 
   putFile8Bit(file, ei->collect_score_initial);
   putFile8Bit(file, ei->collect_count_initial);
@@ -7061,7 +7062,7 @@ static void SaveLevel_GRP1(FILE *file, struct LevelInfo *level, int element)
   putFile8Bit(file, group->num_elements);
 
   putFile8Bit(file, ei->use_gfx_element);
-  putFile16BitBE(file, ei->gfx_element);
+  putFile16BitBE(file, ei->gfx_element_initial);
 
   putFile8Bit(file, group->choice_mode);
 
index 451c167fffe2cbd25c86fd8ad349912e123e7a47..4bd9bdc1614747b5e00bfad4a193e007c0358935 100644 (file)
@@ -10168,12 +10168,18 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
     (level.time > 0 ? TimeLeft :
      TimePlayed);
 
-  int action_arg_element =
+  int action_arg_element_raw =
     (action_arg == CA_ARG_PLAYER_TRIGGER  ? change->actual_trigger_player :
      action_arg == CA_ARG_ELEMENT_TRIGGER ? change->actual_trigger_element :
      action_arg == CA_ARG_ELEMENT_TARGET  ? change->target_element :
      action_arg == CA_ARG_ELEMENT_ACTION  ? change->action_element :
      EL_EMPTY);
+  int action_arg_element = GetElementFromGroupElement(action_arg_element_raw);
+
+#if 0
+  if (action_arg_element_raw == EL_GROUP_START)
+    printf("::: %d,%d: %d ('%s')\n", x, y, element, EL_NAME(element));
+#endif
 
   int action_arg_direction =
     (action_arg >= CA_ARG_DIRECTION_LEFT &&
@@ -10607,6 +10613,38 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
       break;
     }
 
+    case CA_SET_CE_ARTWORK:
+    {
+      int artwork_element = action_arg_element;
+      boolean reset_frame = FALSE;
+      int xx, yy;
+
+      if (action_arg == CA_ARG_ELEMENT_RESET)
+       artwork_element = (ei->use_gfx_element ? ei->gfx_element_initial :
+                          element);
+
+      if (ei->gfx_element != artwork_element)
+       reset_frame = TRUE;
+
+      ei->gfx_element = artwork_element;
+
+      SCAN_PLAYFIELD(xx, yy)
+      {
+       if (Feld[xx][yy] == element)
+       {
+         if (reset_frame)
+         {
+           ResetGfxAnimation(xx, yy);
+           ResetRandomAnimationValue(xx, yy);
+         }
+
+         TEST_DrawLevelField(xx, yy);
+       }
+      }
+
+      break;
+    }
+
     /* ---------- engine actions  ------------------------------------------ */
 
     case CA_SET_ENGINE_SCAN_MODE:
@@ -11169,6 +11207,15 @@ static boolean CheckTriggeredElementChangeExt(int trigger_x, int trigger_y,
            {
              if (change->can_change && !change_done)
              {
+#if USE_FIX_NO_ACTION_AFTER_CHANGE
+               /* if element already changed in this frame, not only prevent
+                  another element change (checked in ChangeElement()), but
+                  also prevent additional element actions for this element */
+
+               if (ChangeCount[x][y] >= game.max_num_changes_per_frame &&
+                   !level.use_action_after_change_bug)
+                 continue;
+#endif
 
 #if 0
                printf("::: TRIGGERED CHANGE FOUND: %d ['%s'], %d -- CHANGE\n",
index 8f2fdf7d61696fa9e6623c6ecaedbe8f3129d78c..2d565ca7b4ab47fd904a1e01daa8252a2c7ed0e9 100644 (file)
@@ -4884,6 +4884,18 @@ void InitElementPropertiesAfterLoading(int engine_version)
   }
 }
 
+void InitElementPropertiesGfxElement()
+{
+  int i;
+
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
+  {
+    struct ElementInfo *ei = &element_info[i];
+
+    ei->gfx_element = (ei->use_gfx_element ? ei->gfx_element_initial : i);
+  }
+}
+
 static void InitGlobal()
 {
   int graphic;
index 3df39d265cb852d02c3d5f2325124f7c1ee75970..4226241afc7bfe467ead6e61854c153e1c7a48a2 100644 (file)
@@ -36,6 +36,7 @@ void ResolveGroupElement(int);
 void InitElementPropertiesStatic(void);
 void InitElementPropertiesEngine(int);
 void InitElementPropertiesAfterLoading(int);
+void InitElementPropertiesGfxElement();
 
 void ReloadCustomArtwork(int);
 void RedrawBackground();
index 4bd8335428844ae4078f843f5ca7e46d77ecb714..a20cb5ff496470201abefcad7e3c8e523d06f23c 100644 (file)
 #define CA_SET_CE_VALUE                        16
 #define CA_SET_ENGINE_SCAN_MODE                17
 #define CA_SET_PLAYER_INVENTORY                18
+#define CA_SET_CE_ARTWORK              19
 
 #define CA_HEADLINE_LEVEL_ACTIONS      250
 #define CA_HEADLINE_PLAYER_ACTIONS     251
 #define IS_DC_STEELWALL_2(e)   ((e) >= EL_DC_STEELWALL_2_LEFT &&       \
                                 (e) <= EL_DC_STEELWALL_2_SINGLE)
 
+#if 1
+#define GFX_ELEMENT(e)         (element_info[e].gfx_element)
+#else
 #define GFX_ELEMENT(e)         (element_info[e].use_gfx_element ?      \
                                 element_info[e].gfx_element : e)
+#endif
 
 /* !!! CHECK THIS !!! */
 #if 1
@@ -2516,7 +2521,7 @@ struct ElementInfo
   unsigned long properties[NUM_EP_BITFIELDS];  /* element base properties */
 
   boolean use_gfx_element;     /* use custom graphic element */
-  int gfx_element;             /* optional custom graphic element */
+  int gfx_element_initial;     /* initial optional custom graphic element */
 
   int access_direction;                /* accessible from which direction */
 
@@ -2567,6 +2572,8 @@ struct ElementInfo
 
   boolean in_group[NUM_GROUP_ELEMENTS];
 
+  int gfx_element;             /* runtime optional custom graphic element */
+
   int collect_score;           /* runtime score value for collecting */
 
   /* count of this element on playfield, calculated after each frame */