From: Holger Schemel Date: Sat, 5 Aug 2006 12:46:08 +0000 (+0200) Subject: rnd-20060805-4-src X-Git-Tag: 3.2.1^2~20 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=efcb2b55f390a09641eab90dd3582bb3ef716664;p=rocksndiamonds.git rnd-20060805-4-src * added compatibility code to fix "Snake Bite" style levels that were broken due to a bugfix regarding EL_SOKOBAN_FIELD_PLAYER in 3.2.0 --- diff --git a/ChangeLog b/ChangeLog index daab85cc..43eb2e24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-08-05 + * added compatibility code to fix "Snake Bite" style levels that were + broken due to a bugfix regarding EL_SOKOBAN_FIELD_PLAYER in 3.2.0 + 2006-08-04 * fixed bug with scrollbars inside editor when using the Windows mouse enhancement tool "True X-Mouse" (which injects key events to the event diff --git a/src/conftime.h b/src/conftime.h index 33d11567..21cf0931 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-08-05 02:52]" +#define COMPILE_DATE_STRING "[2006-08-05 14:41]" diff --git a/src/files.c b/src/files.c index 0185e4f6..7430f2a7 100644 --- a/src/files.c +++ b/src/files.c @@ -4743,7 +4743,7 @@ void LoadLevelFromFilename(struct LevelInfo *level, char *filename) static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) { - int i; + int i, j; if (leveldir_current == NULL) /* only when dumping level */ return; @@ -4840,8 +4840,6 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) /* trigger settings did not exist before 3.1.0; set to default "any" */ if (level->game_version < VERSION_IDENT(3,1,0,0)) { - int i, j; - /* correct "can move into acid" settings (all zero in old levels) */ level->can_move_into_acid_bits = 0; /* nothing can move into acid */ @@ -4871,6 +4869,28 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) } } } + + /* try to detect and fix "Snake Bite" levels, which are broken with 3.2.0 */ + { + int element = EL_CUSTOM_START + 255; + struct ElementInfo *ei = &element_info[element]; + struct ElementChangeInfo *change = &ei->change_page[0]; + + /* This is needed to fix a problem that was caused by a bugfix in function + game.c/CreateFieldExt() introduced with 3.2.0 that corrects the behaviour + when a custom element changes to EL_SOKOBAN_FIELD_PLAYER (before, it did + not replace walkable elements, but instead just placed the player on it, + without placing the Sokoban field under the player). Unfortunately, this + breaks "Snake Bite" style levels when the snake is halfway through a door + that just closes (the snake head is still alive and can be moved in this + case). This can be fixed by replacing the EL_SOKOBAN_FIELD_PLAYER by the + player (without Sokoban element) which then gets killed as designed). */ + + if ((strncmp(leveldir_current->identifier, "snake_bite", 10) == 0 || + strncmp(ei->description, "pause b4 death", 14) == 0) && + change->target_element == EL_SOKOBAN_FIELD_PLAYER) + change->target_element = EL_PLAYER_1; + } } static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) diff --git a/src/game.c b/src/game.c index 54ae41a2..3ea77684 100644 --- a/src/game.c +++ b/src/game.c @@ -49,6 +49,9 @@ #define USE_QUICKSAND_IMPACT_BUGFIX (USE_NEW_STUFF * 0) +#define USE_CODE_THAT_BREAKS_SNAKE_BITE (USE_NEW_STUFF * 1) + + /* for DigField() */ #define DF_NO_PUSH 0 #define DF_DIG 1 @@ -8484,7 +8487,12 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change) #endif boolean new_element_is_player = ELEM_IS_PLAYER(new_element); boolean add_player_onto_element = (new_element_is_player && +#if USE_CODE_THAT_BREAKS_SNAKE_BITE + /* this breaks SnakeBite when a snake is + halfway through a door that closes */ + /* NOW FIXED AT LEVEL INIT IN files.c */ new_element != EL_SOKOBAN_FIELD_PLAYER && +#endif IS_WALKABLE(old_element)); #if 0