From b8e61376c3bac78bad81090556edfdcc1477a7cc Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 11 May 2006 05:00:35 +0000 Subject: [PATCH] - Fixed: When revisiting a map in a hub, the player could spawn at the wrong height if the floor had moved while they were there before. This was because the player was spawned on the original copy of the map before the changes to it were dearchived, so they didn't know about the new floor height. - Fixed: Calling BaseFileSearch() and letting it fill in the file's extension didn't work because the space for the path was deallocated before it returned. - Guess we're not leak-free yet. Try travelling around in a hub and see that it leaks. I don't have time to track it down right now. SVN r107 (trunk) --- docs/rh-log.txt | 9 +++++++++ src/d_main.cpp | 3 ++- src/g_game.cpp | 1 - src/g_level.cpp | 8 ++++++-- src/p_local.h | 2 ++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 06cb8c6f1..cc88fbaa3 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,13 @@ May 10, 2006 +- Fixed: When revisiting a map in a hub, the player could spawn at the wrong + height if the floor had moved while they were there before. This was because + the player was spawned on the original copy of the map before the changes to + it were dearchived, so they didn't know about the new floor height. +- Guess we're not leak-free yet. Try travelling around in a hub and see that + it leaks. I don't have time to track it down right now. +- Fixed: Calling BaseFileSearch() and letting it fill in the file's extension + didn't work because the space for the path was deallocated before it + returned. - Yay! We now seem to be free of memory leaks! The next step will be to merge a lot of these static destructor-only structs into regular functions added to the exit chain with atterm so that they can be called diff --git a/src/d_main.cpp b/src/d_main.cpp index 91b0b0f84..c526835c0 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1710,7 +1710,8 @@ static const char *BaseFileSearch (const char *file, const char *ext, bool lookf if (FileExists (file)) { - return file; + sprintf (wad, "%s", file); + return wad; } if (GameConfig->SetSection ("FileSearch.Directories")) diff --git a/src/g_game.cpp b/src/g_game.cpp index 3c5f518f1..e4feb1062 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1172,7 +1172,6 @@ void G_PlayerReborn (int player) // at the given mapthing2_t spot // because something is occupying it // -void P_SpawnPlayer (mapthing2_t* mthing); BOOL G_CheckSpot (int playernum, mapthing2_t *mthing) { diff --git a/src/g_level.cpp b/src/g_level.cpp index 3140d04ba..ac5da5f55 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1960,7 +1960,7 @@ void G_StartTravel () void G_FinishTravel () { TThinkerIterator it (STAT_TRAVELLING); - APlayerPawn *pawn, *pawndup, *next; + APlayerPawn *pawn, *pawndup, *oldpawn, *next; AInventory *inv; next = it.Next (); @@ -1977,6 +1977,9 @@ void G_FinishTravel () } else { + oldpawn = pawndup; + P_SpawnPlayer (&playerstarts[pawn->player - players]); + pawndup = pawn->player->mo; if (!startkeepfacing) { pawn->angle = pawndup->angle; @@ -2002,7 +2005,8 @@ void G_FinishTravel () pawn->lastenemy = NULL; pawn->AddToHash (); pawn->player->mo = pawn; - DObject::PointerSubstitution (pawndup, pawn); + DObject::PointerSubstitution (oldpawn, pawn); + oldpawn->Destroy(); pawndup->Destroy (); pawn->LinkToWorld (); pawn->AddToHash (); diff --git a/src/p_local.h b/src/p_local.h index 0308b0099..9b43e6232 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -92,6 +92,8 @@ void P_UnPredictPlayer (); extern fixed_t FloatBobOffsets[64]; extern AActor *MissileActor; +void P_SpawnPlayer (mapthing2_t* mthing); + void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move); int P_FaceMobj (AActor *source, AActor *target, angle_t *delta); bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax);