From: Holger Schemel Date: Mon, 21 Jun 2004 07:40:58 +0000 (+0200) Subject: rnd-20040621-1-src X-Git-Tag: 3.1.1^2~86 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=940ec320c7cdae17cda81436408c2f75b8c9a524;p=rocksndiamonds.git rnd-20040621-1-src * fixed engine change that broke 3.0.8 levels like "Walpurgis Gardens" * fixed the above fix because it broke level set "machine" (*sigh*) * fixed random element placement in level editor to work as expected * fixed undefined graphic of runtime element "EL_AMOEBA_TO_DIAMOND" --- diff --git a/ChangeLog b/ChangeLog index 877fded1..6888cd7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-06-20 + * fixed engine change that broke 3.0.8 levels like "Walpurgis Gardens" + * fixed the above fix because it broke level set "machine" (*sigh*) + * fixed random element placement in level editor to work as expected + * fixed undefined graphic of runtime element "EL_AMOEBA_TO_DIAMOND" + 2004-06-15 * re-recorded tape for BD2K3, level 010 (broken due to bugfix) diff --git a/src/conftime.h b/src/conftime.h index ebd1d098..bf22a8e7 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-06-14 00:25]" +#define COMPILE_DATE_STRING "[2004-06-21 01:39]" diff --git a/src/editor.c b/src/editor.c index e8a4d645..5dc75613 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7996,37 +7996,38 @@ static void CopyLevelToUndoBuffer(int mode) static void RandomPlacement(int new_element) { static boolean free_position[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; - int num_free_positions; - int num_percentage; - int num_elements; + int num_free_positions = 0; + int num_percentage, num_elements; int x, y; - /* determine number of free positions for the new elements */ - /* (maybe this statement should be formatted a bit more readable...) */ - num_free_positions = 0; - for (x = 0; x < lev_fieldx; x++) - for (y = 0; y < lev_fieldy; y++) - if ((free_position[x][y] = - ((random_placement_background_restricted && - Feld[x][y] == random_placement_background_element) || - (!random_placement_background_restricted && - Feld[x][y] != new_element))) == TRUE) - num_free_positions++; + /* determine number of free positions for randomly placing the new element */ + for (x = 0; x < lev_fieldx; x++) for (y = 0; y < lev_fieldy; y++) + { + free_position[x][y] = + (random_placement_background_restricted ? + Feld[x][y] == random_placement_background_element : + Feld[x][y] != new_element); + + if (free_position[x][y]) + num_free_positions++; + } /* determine number of new elements to place there */ num_percentage = num_free_positions * random_placement_value / 100; num_elements = (random_placement_method == RANDOM_USE_PERCENTAGE ? num_percentage : random_placement_value); - /* if not more free positions than elements to place, fill whole level */ - if (num_elements >= num_free_positions) + /* if less free positions than elements to place, fill all these positions */ + if (num_free_positions < num_elements) { for (x = 0; x < lev_fieldx; x++) for (y = 0; y < lev_fieldy; y++) - Feld[x][y] = new_element; + if (free_position[x][y]) + Feld[x][y] = new_element; DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos); CopyLevelToUndoBuffer(UNDO_IMMEDIATE); + return; } diff --git a/src/files.c b/src/files.c index 7280860b..b6a462e6 100644 --- a/src/files.c +++ b/src/files.c @@ -3606,6 +3606,8 @@ void DumpTape(struct TapeInfo *tape) printf_line("-", 79); printf("Tape of Level %03d (file version %08d, game version %08d)\n", tape->level_nr, tape->file_version, tape->game_version); + printf(" (effective engine version %08d)\n", + tape->engine_version); printf("Level series identifier: '%s'\n", tape->level_identifier); printf_line("-", 79); diff --git a/src/game.c b/src/game.c index 9645f08e..bf9b3892 100644 --- a/src/game.c +++ b/src/game.c @@ -37,6 +37,8 @@ #define USE_NEW_SP_SLIPPERY TRUE * USE_NEW_STUFF * 1 #define USE_NEW_RANDOMIZE TRUE * USE_NEW_STUFF * 1 +#define USE_PUSH_BUGFIX TRUE * 1 + /* for DigField() */ #define DF_NO_PUSH 0 #define DF_DIG 1 @@ -1194,6 +1196,40 @@ static void InitGameEngine() game.engine_version = (tape.playing ? tape.engine_version : level.game_version); + /* ---------------------------------------------------------------------- */ + /* set flags for bugs and changes according to active game engine version */ + /* ---------------------------------------------------------------------- */ + + /* + Type of bug/change: + Before 3.1.0, custom elements that "change when pushing" changed directly + after the player started pushing them (until then handled in "DigField()"). + Since 3.1.0, these custom elements are not changed until the "pushing" + move of the element is finished (now handled in "ContinueMoving()"). + + Affected levels/tapes: + The first condition is generally needed for all levels/tapes before version + 3.1.0, which might use the old behaviour before it was changed; known tapes + that are affected are some tapes from the level set "Walpurgis Gardens" by + Jamie Cullen. + The second condition is an exception from the above case and is needed for + the special case of tapes recorded with game (not engine!) version 3.1.0 or + above (including some development versions of 3.1.0), but before it was + known that this change would break tapes like the above and was fixed in + 3.1.1, so that the changed behaviour was active although the engine version + while recording maybe was before 3.1.0. There is at least one tape that is + affected by this exception, which is the tape for the one-level set "Bug + Machine" by Juergen Bonhagen. + */ + + game.use_bug_change_when_pushing = + (game.engine_version < VERSION_IDENT(3,1,0,0) && + !(tape.playing && + tape.game_version >= VERSION_IDENT(3,1,0,0) && + tape.game_version < VERSION_IDENT(3,1,1,0))); + + /* ---------------------------------------------------------------------- */ + /* dynamically adjust element properties according to game engine version */ InitElementPropertiesEngine(game.engine_version); @@ -4636,7 +4672,7 @@ inline static void TurnRoundExt(int x, int y) yy = y + move_xy[MovDir[x][y]].y; #if 1 - /* !!! this bugfix breaks at least BD2K3, level 010 !!! */ + /* !!! this bugfix breaks at least BD2K3, level 010 !!! [re-recorded] */ if (!IN_LEV_FIELD(xx, yy) || (!IS_FREE(xx, yy) && !IS_FOOD_PIG(Feld[xx][yy]))) MovDir[x][y] = old_move_dir; @@ -6492,7 +6528,17 @@ void ContinueMoving(int x, int y) #endif #if 1 + +#if USE_PUSH_BUGFIX +#if 1 + if (pushed_by_player && !game.use_bug_change_when_pushing) +#else + if (pushed_by_player && game.engine_version >= VERSION_IDENT(3,1,0,0)) +#endif +#else if (pushed_by_player) +#endif + { #if 1 int dig_side = MV_DIR_OPPOSITE(direction); @@ -8652,7 +8698,7 @@ void GameActions() #endif #if 1 - /* for downwards compatibility, the following code emulates a fixed bug that + /* for backwards compatibility, the following code emulates a fixed bug that occured when pushing elements (causing elements that just made their last pushing step to already (if possible) make their first falling step in the same game frame, which is bad); this code is also needed to use the famous @@ -11701,12 +11747,28 @@ int DigField(struct PlayerInfo *player, else player->push_delay_value = -1; /* get new value later */ +#if USE_PUSH_BUGFIX + /* now: check for element change _after_ element has been pushed! */ +#if 1 + if (game.use_bug_change_when_pushing) +#else + if (game.engine_version < VERSION_IDENT(3,1,0,0)) +#endif + { + CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER, + player->index_bit, dig_side); + CheckTriggeredElementChangeByPlayer(x,y,element,CE_OTHER_GETS_PUSHED, + player->index_bit, dig_side); + } + +#else + #if 1 /* check for element change _after_ element has been pushed! */ #else #if 1 - /* !!! TEST ONLY !!! */ + /* !!! TEST ONLY !!! */ CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER, player->index_bit, dig_side); CheckTriggeredElementChangeByPlayer(x, y, element,CE_OTHER_GETS_PUSHED, @@ -11717,6 +11779,8 @@ int DigField(struct PlayerInfo *player, CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER, player->index_bit, dig_side); #endif +#endif + #endif break; diff --git a/src/init.c b/src/init.c index c62b8c4e..0e69d662 100644 --- a/src/init.c +++ b/src/init.c @@ -560,6 +560,11 @@ void InitElementGraphicInfo() } } +#if 1 + /* set hardcoded definitions for some runtime elements without graphic */ + element_info[EL_AMOEBA_TO_DIAMOND].graphic[ACTION_DEFAULT] = IMG_AMOEBA_DEAD; +#endif + #if 1 /* now set all undefined/invalid graphics to -1 to set to default after it */ for (i = 0; i < MAX_NUM_ELEMENTS; i++) @@ -646,6 +651,7 @@ void InitElementGraphicInfo() default_action_crumbled = element_info[EL_SB_DEFAULT].crumbled[act]; #if 1 + /* !!! needed because EL_EMPTY_SPACE treated as IS_SP_ELEMENT !!! */ /* !!! make this better !!! */ if (i == EL_EMPTY_SPACE) { diff --git a/src/main.h b/src/main.h index 506fecb5..7b6b6f5d 100644 --- a/src/main.h +++ b/src/main.h @@ -1580,6 +1580,10 @@ struct GameInfo int initial_move_delay_value; int initial_push_delay_value; + /* flags to handle bugs in and changes between different engine versions */ + /* (for the latest engine version, these flags should always be "FALSE") */ + boolean use_bug_change_when_pushing; + /* variable within running game */ int yamyam_content_nr; boolean magic_wall_active;