diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 00ca9b2ab1..1263b8c050 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,10 @@ +May 27, 2006 (Changes by Graf Zahl) +- Fixed: FString::FormatHelper must not alter the null string. +- Fixed: FString::FormatHelper should use ReallocBuffer instead of directly + calling Realloc. This caused crashes with the ACS print function. +- Fixed: The dummy player spawned in G_FinishTravel must not start any ENTER + scripts. + May 26, 2006 - Changed makewad's zip routines so that it simply stores files that cannot be compressed smaller instead of using deflate anyway. Saves 133 bytes currently. diff --git a/src/g_level.cpp b/src/g_level.cpp index 0acaac1675..3c3c4d3a51 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -2004,7 +2004,11 @@ void G_FinishTravel () else { oldpawn = pawndup; - P_SpawnPlayer (&playerstarts[pawn->player - players]); + + // The player being spawned here is a short lived dummy and + // must not start any ENTER script or big problems will happen. + P_SpawnPlayer (&playerstarts[pawn->player - players], false); + pawndup = pawn->player->mo; if (!startkeepfacing) { diff --git a/src/p_local.h b/src/p_local.h index fa4fe7b0b0..2118a5e762 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -90,7 +90,7 @@ void P_UnPredictPlayer (); extern fixed_t FloatBobOffsets[64]; extern AActor *MissileActor; -void P_SpawnPlayer (mapthing2_t* mthing); +void P_SpawnPlayer (mapthing2_t* mthing, bool startenterscripts = true); void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move); int P_FaceMobj (AActor *source, AActor *target, angle_t *delta); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b5350b95d9..b9b97e056c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3292,7 +3292,7 @@ void AActor::AdjustFloorClip () EXTERN_CVAR (Bool, chasedemo) extern bool demonew; -void P_SpawnPlayer (mapthing2_t *mthing) +void P_SpawnPlayer (mapthing2_t *mthing, bool startenterscripts) { int playernum; player_t *p; @@ -3428,7 +3428,12 @@ void P_SpawnPlayer (mapthing2_t *mthing) p->cheats = CF_CHASECAM; // setup gun psprite - P_SetupPsprites (p); + if (startenterscripts) + { + // This can also start a script so don't do it for + // the dummy player. + P_SetupPsprites (p); + } // give all cards in death match mode if (deathmatch) @@ -3472,13 +3477,16 @@ void P_SpawnPlayer (mapthing2_t *mthing) P_PlayerStartStomp (mobj); // [BC] Do script stuff - if (state == PST_ENTER || (state == PST_LIVE && !savegamerestore)) + if (startenterscripts) { - FBehavior::StaticStartTypedScripts (SCRIPT_Enter, p->mo, true); - } - else if (state == PST_REBORN) - { - FBehavior::StaticStartTypedScripts (SCRIPT_Respawn, p->mo, true); + if (state == PST_ENTER || (state == PST_LIVE && !savegamerestore)) + { + FBehavior::StaticStartTypedScripts (SCRIPT_Enter, p->mo, true); + } + else if (state == PST_REBORN) + { + FBehavior::StaticStartTypedScripts (SCRIPT_Respawn, p->mo, true); + } } } diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 8dd7d5f156..6c1c2fdb69 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -46,8 +46,6 @@ #include "v_palette.h" #include "a_sharedglobal.h" -extern void P_SpawnPlayer (mapthing2_t *mthing); - static void CopyPlayer (player_t *dst, player_t *src, const char *name); static void ReadOnePlayer (FArchive &arc); static void ReadMultiplePlayers (FArchive &arc, int numPlayers, int numPlayersNow); diff --git a/src/zstring.cpp b/src/zstring.cpp index f05753c86a..829ded1cb7 100644 --- a/src/zstring.cpp +++ b/src/zstring.cpp @@ -218,9 +218,9 @@ int FString::FormatHelper (void *data, const char *cstr, int len) { FString *str = (FString *)data; size_t len1 = str->Len(); - if (len1 + len > str->Data()->AllocLen) + if (len1 + len > str->Data()->AllocLen || str->Chars == &NullString.Nothing[0]) { - str->Chars = (char *)(str->Data()->Realloc((len1 + len + 127) & ~127) + 1); + str->ReallocBuffer((len1 + len + 127) & ~127); } StrCopy (str->Chars + len1, cstr, len); str->Data()->Len = (unsigned int)(len1 + len); diff --git a/tools/dehsupp/scanner.c b/tools/dehsupp/scanner.c index c44b2df880..ce434068fb 100644 --- a/tools/dehsupp/scanner.c +++ b/tools/dehsupp/scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.10.3 on Wed May 24 23:26:39 2006 */ +/* Generated by re2c 0.10.3 on Sat May 27 10:44:26 2006 */ #line 1 "scanner.re" #include #include