-#define COMPILE_DATE_STRING "2008-02-04 01:02"
+#define COMPILE_DATE_STRING "2008-02-05 01:45"
{ 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" },
{ 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 }
{
-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"
},
ReinitializeElementList(); /* update dynamic level element list */
ReinitializeElementListButtons(); /* custom element may look different */
+ InitElementPropertiesGfxElement();
+
#if 1
UnmapAllGadgets();
#else
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();
{
-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
},
{
{
-1, -1,
TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
- &xx_ei.gfx_element, EL_EMPTY_SPACE
+ &xx_ei.gfx_element_initial, EL_EMPTY_SPACE
},
{
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);
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);
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);
/* 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)
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);
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);
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);
(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 &&
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:
{
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",
}
}
+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;
void InitElementPropertiesStatic(void);
void InitElementPropertiesEngine(int);
void InitElementPropertiesAfterLoading(int);
+void InitElementPropertiesGfxElement();
void ReloadCustomArtwork(int);
void RedrawBackground();
#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
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 */
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 */