From: Holger Schemel Date: Mon, 19 Apr 2004 00:16:37 +0000 (+0200) Subject: rnd-20040419-1-src X-Git-Tag: 3.1.0^2~19 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d04e03c1d739a7ff4ec46e144a49770476fd0e19;p=rocksndiamonds.git rnd-20040419-1-src * fixed graphic bug when player is snapping while moving in old levels * fixed bug when a moving custom element leaves a player element behind * fixed bug with mole not disappearing when moving into acid pool * fixed bug with incomplete path setting when using "--basepath" option * moving CE can now leave walkable elements behind under the player * when relocating, player can be set on walkable element now * fixed another gravity movement bug * uploaded pre-release (test) version 3.1.0-2 binary and source code --- diff --git a/ChangeLog b/ChangeLog index f153f082..49e07999 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-04-18 + * fixed graphic bug when player is snapping while moving in old levels + * fixed bug when a moving custom element leaves a player element behind + * fixed bug with mole not disappearing when moving into acid pool + * fixed bug with incomplete path setting when using "--basepath" option + * moving CE can now leave walkable elements behind under the player + * when relocating, player can be set on walkable element now + * fixed another gravity movement bug + +2004-04-12 + * uploaded pre-release (test) version 3.1.0-2 binary and source code + 2004-04-10 * added "collectible" and "removable" to extended replacement types (where "removable" replaces "diggable" and "collectible" elements) diff --git a/src/conftime.h b/src/conftime.h index b334e945..14deee9d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-04-12 23:15]" +#define COMPILE_DATE_STRING "[2004-04-19 02:05]" diff --git a/src/game.c b/src/game.c index 97139231..72bfc042 100644 --- a/src/game.c +++ b/src/game.c @@ -770,6 +770,7 @@ static void InitPlayerField(int x, int y, int element, boolean init_game) } Feld[x][y] = EL_EMPTY; + player->jx = player->last_jx = x; player->jy = player->last_jy = y; } @@ -2653,6 +2654,7 @@ void CheckDynamite(int x, int y) void RelocatePlayer(int x, int y, int element_raw) { + int old_element = Feld[x][y]; int element = (element_raw == EL_SP_MURPHY ? EL_PLAYER_1 : element_raw); struct PlayerInfo *player = &stored_player[element - EL_PLAYER_1]; boolean ffwd_delay = (tape.playing && tape.fast_forward); @@ -2664,8 +2666,11 @@ void RelocatePlayer(int x, int y, int element_raw) if (player->GameOver) /* do not reanimate dead player */ return; - RemoveField(x, y); /* temporarily remove newly placed player */ - DrawLevelField(x, y); + if (ELEM_IS_PLAYER(old_element)) /* player already set */ + { + RemoveField(x, y); /* temporarily remove newly placed player */ + DrawLevelField(x, y); + } if (player->present) { @@ -2693,6 +2698,12 @@ void RelocatePlayer(int x, int y, int element_raw) Feld[x][y] = element; InitPlayerField(x, y, element, TRUE); + if (!ELEM_IS_PLAYER(old_element)) /* player set on walkable element */ + { + Feld[x][y] = old_element; + InitField(x, y, FALSE); + } + if (player != local_player) /* do not visually relocate other players */ return; @@ -2849,6 +2860,11 @@ void RelocatePlayer(int x, int y, int element_raw) } #endif } + +#if 1 + TestIfHeroTouchesBadThing(x, y); + TestIfPlayerTouchesCustomElement(x, y); +#endif } void Explode(int ex, int ey, int phase, int mode) @@ -5931,7 +5947,13 @@ void ContinueMoving(int x, int y) Feld[newx][newy] = element; MovPos[x][y] = 0; /* force "not moving" for "crumbled sand" */ - if (element == EL_MOLE) +#if 1 + if (Store[x][y] == EL_ACID) /* element is moving into acid pool */ + { + element = Feld[newx][newy] = EL_ACID; + } +#endif + else if (element == EL_MOLE) { Feld[x][y] = EL_SAND; @@ -5990,10 +6012,12 @@ void ContinueMoving(int x, int y) Back[x][y] = Back[newx][newy] = 0; } +#if 0 else if (Store[x][y] == EL_ACID) { element = Feld[newx][newy] = EL_ACID; } +#endif #if 0 else if (IS_CUSTOM_ELEMENT(element) && !IS_PLAYER(x, y) && ei->move_leave_element != EL_EMPTY && @@ -6039,18 +6063,27 @@ void ContinueMoving(int x, int y) ResetGfxAnimation(x, y); /* reset animation values for old field */ #if 1 - if (IS_CUSTOM_ELEMENT(element) && !IS_PLAYER(x, y) && - ei->move_leave_element != EL_EMPTY && - (ei->move_leave_type == LEAVE_TYPE_UNLIMITED || - stored != EL_EMPTY)) + /* some elements can leave other elements behind after moving */ +#if 1 + if (IS_CUSTOM_ELEMENT(element) && ei->move_leave_element != EL_EMPTY && + (ei->move_leave_type == LEAVE_TYPE_UNLIMITED || stored != EL_EMPTY) && + (!IS_PLAYER(x, y) || IS_WALKABLE(ei->move_leave_element))) +#else + if (IS_CUSTOM_ELEMENT(element) && ei->move_leave_element != EL_EMPTY && + (ei->move_leave_type == LEAVE_TYPE_UNLIMITED || stored != EL_EMPTY) && + !IS_PLAYER(x, y)) +#endif { - /* some elements can leave other elements behind after moving */ + int move_leave_element = ei->move_leave_element; - Feld[x][y] = ei->move_leave_element; + Feld[x][y] = move_leave_element; InitField(x, y, FALSE); if (GFX_CRUMBLED(Feld[x][y])) DrawLevelFieldCrumbledSandNeighbours(x, y); + + if (ELEM_IS_PLAYER(move_leave_element)) + RelocatePlayer(x, y, move_leave_element); } #endif @@ -7212,6 +7245,9 @@ static void ChangeActiveTrap(int x, int y) static void ChangeElementNowExt(int x, int y, int target_element) { int previous_move_direction = MovDir[x][y]; + boolean add_player = (ELEM_IS_PLAYER(target_element) && + IS_WALKABLE(Feld[x][y]) && + !IS_MOVING(x, y)); /* check if element under player changes from accessible to unaccessible (needed for special case of dropping element which then changes) */ @@ -7222,36 +7258,58 @@ static void ChangeElementNowExt(int x, int y, int target_element) return; } - RemoveField(x, y); - Feld[x][y] = target_element; +#if 1 + if (!add_player) +#endif + { +#if 1 + if (IS_MOVING(x, y) || IS_BLOCKED(x, y)) + RemoveMovingField(x, y); + else + RemoveField(x, y); - Changed[x][y] |= ChangeEvent[x][y]; /* ignore same changes in this frame */ + Feld[x][y] = target_element; +#else + RemoveField(x, y); + Feld[x][y] = target_element; +#endif - ResetGfxAnimation(x, y); - ResetRandomAnimationValue(x, y); + ResetGfxAnimation(x, y); + ResetRandomAnimationValue(x, y); - if (element_info[Feld[x][y]].move_direction_initial == MV_START_PREVIOUS) - MovDir[x][y] = previous_move_direction; + if (element_info[Feld[x][y]].move_direction_initial == MV_START_PREVIOUS) + MovDir[x][y] = previous_move_direction; #if 1 - InitField_WithBug1(x, y, FALSE); + InitField_WithBug1(x, y, FALSE); #else - InitField(x, y, FALSE); - if (CAN_MOVE(Feld[x][y])) - InitMovDir(x, y); + InitField(x, y, FALSE); + if (CAN_MOVE(Feld[x][y])) + InitMovDir(x, y); #endif - DrawLevelField(x, y); + DrawLevelField(x, y); - if (GFX_CRUMBLED(Feld[x][y])) - DrawLevelFieldCrumbledSandNeighbours(x, y); + if (GFX_CRUMBLED(Feld[x][y])) + DrawLevelFieldCrumbledSandNeighbours(x, y); + } + + Changed[x][y] |= ChangeEvent[x][y]; /* ignore same changes in this frame */ +#if 0 TestIfBadThingTouchesHero(x, y); TestIfPlayerTouchesCustomElement(x, y); TestIfElementTouchesCustomElement(x, y); +#endif if (ELEM_IS_PLAYER(target_element)) RelocatePlayer(x, y, target_element); + +#if 1 + TestIfBadThingTouchesHero(x, y); + TestIfPlayerTouchesCustomElement(x, y); + TestIfElementTouchesCustomElement(x, y); +#endif } static boolean ChangeElementNow(int x, int y, int element, int page) @@ -7336,8 +7394,10 @@ static boolean ChangeElementNow(int x, int y, int element, int page) #if 1 #if 1 - is_empty = (IS_FREE(ex, ey) || (IS_FREE_OR_PLAYER(ex, ey) && - IS_WALKABLE(content_element))); + is_empty = (IS_FREE(ex, ey) || + (IS_PLAYER(ex, ey) && IS_WALKABLE(content_element)) || + (IS_WALKABLE(e) && ELEM_IS_PLAYER(content_element) && + !IS_MOVING(ex, ey) && !IS_BLOCKED(ex, ey))); #else is_empty = (IS_FREE(ex, ey) || (IS_PLAYER(ex, ey) && IS_WALKABLE(content_element))); @@ -10494,6 +10554,20 @@ int DigField(struct PlayerInfo *player, game.engine_version >= VERSION_IDENT(2,2,0,0)) return MF_NO_ACTION; +#if 1 + if (game.gravity && !player->is_auto_moving && + canFallDown(player) && move_direction != MV_DOWN && + !canMoveToValidFieldWithGravity(jx, jy, move_direction)) + return MF_NO_ACTION; /* player cannot walk here due to gravity */ +#endif + +#if 0 + if (element == EL_EMPTY_SPACE && + game.gravity && !player->is_auto_moving && + canFallDown(player) && move_direction != MV_DOWN) + return MF_NO_ACTION; /* player cannot walk here due to gravity */ +#endif + switch (element) { #if 0 @@ -10626,7 +10700,7 @@ int DigField(struct PlayerInfo *player, return MF_NO_ACTION; /* field not accessible from this direction */ #endif -#if 1 +#if 0 if (element == EL_EMPTY_SPACE && game.gravity && !player->is_auto_moving && canFallDown(player) && move_direction != MV_DOWN) @@ -11185,10 +11259,10 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) dy == +1 ? MV_DOWN : MV_NO_MOVING); #if 0 - if (player->MovPos) + if (player->MovPos != 0) return FALSE; #else - if (player->MovPos && game.engine_version >= VERSION_IDENT(2,2,0,0)) + if (player->MovPos != 0 && game.engine_version >= VERSION_IDENT(2,2,0,0)) return FALSE; #endif @@ -11245,8 +11319,16 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) player->is_collecting = FALSE; } +#if 1 + if (player->MovPos != 0) /* prevent graphic bugs in versions < 2.2.0 */ + DrawLevelField(player->last_jx, player->last_jy); +#endif + DrawLevelField(x, y); + +#if 0 BackToFront(); +#endif return TRUE; } diff --git a/src/init.c b/src/init.c index 0b925c68..58595e5b 100644 --- a/src/init.c +++ b/src/init.c @@ -2271,6 +2271,7 @@ void InitElementPropertiesStatic() EL_PLAYER_4, EL_SP_MURPHY, EL_SOKOBAN_FIELD_PLAYER, + EL_TRIGGER_PLAYER, -1 }; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index a7eeb72f..ba379625 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -615,9 +615,17 @@ void GetOptions(char *argv[], void (*print_usage_function)(void)) if (option_arg == next_option) options_left++; - /* adjust path for level directory accordingly */ + /* adjust paths for sub-directories in base directory accordingly */ options.level_directory = getPath2(options.ro_base_directory, LEVELS_DIRECTORY); + options.graphics_directory = + getPath2(options.ro_base_directory, GRAPHICS_DIRECTORY); + options.sounds_directory = + getPath2(options.ro_base_directory, SOUNDS_DIRECTORY); + options.music_directory = + getPath2(options.ro_base_directory, MUSIC_DIRECTORY); + options.docs_directory = + getPath2(options.ro_base_directory, DOCS_DIRECTORY); } else if (strncmp(option, "-levels", option_len) == 0) { diff --git a/src/main.h b/src/main.h index e89d1fee..29c8537c 100644 --- a/src/main.h +++ b/src/main.h @@ -1240,7 +1240,7 @@ #define PROGRAM_VERSION_MAJOR 3 #define PROGRAM_VERSION_MINOR 1 #define PROGRAM_VERSION_PATCH 0 -#define PROGRAM_VERSION_BUILD 2 +#define PROGRAM_VERSION_BUILD 3 #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel"