From: Holger Schemel Date: Tue, 5 Feb 2008 01:02:54 +0000 (+0100) Subject: rnd-20080205-1-src X-Git-Tag: 3.2.6.0^2~15 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=59ee2ed2390984e3dbe586363ee6ae01802916a7;p=rocksndiamonds.git rnd-20080205-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 8159e8c2..ad266fc2 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2008-02-04 01:02" +#define COMPILE_DATE_STRING "2008-02-05 01:45" diff --git a/src/editor.c b/src/editor.c index ff9906d4..c3583d4b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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(); diff --git a/src/files.c b/src/files.c index 7a29e1ee..dd9a274d 100644 --- a/src/files.c +++ b/src/files.c @@ -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); diff --git a/src/game.c b/src/game.c index 451c167f..4bd9bdc1 100644 --- a/src/game.c +++ b/src/game.c @@ -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", diff --git a/src/init.c b/src/init.c index 8f2fdf7d..2d565ca7 100644 --- a/src/init.c +++ b/src/init.c @@ -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; diff --git a/src/init.h b/src/init.h index 3df39d26..4226241a 100644 --- a/src/init.h +++ b/src/init.h @@ -36,6 +36,7 @@ void ResolveGroupElement(int); void InitElementPropertiesStatic(void); void InitElementPropertiesEngine(int); void InitElementPropertiesAfterLoading(int); +void InitElementPropertiesGfxElement(); void ReloadCustomArtwork(int); void RedrawBackground(); diff --git a/src/main.h b/src/main.h index 4bd83354..a20cb5ff 100644 --- a/src/main.h +++ b/src/main.h @@ -358,6 +358,7 @@ #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 @@ -754,8 +755,12 @@ #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 */