From 65bb04b7e8aa33c0a29b27289f37278ba5e8dcdf Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 3 Oct 2006 03:14:28 +0000 Subject: [PATCH] - Fixed: V_BreakLines() failed to produce output for the final line if it was only one character long. - Fixed: When players respawned in multiplayer, scripts that started on their old body kept executing on that body instead of being transferred to the new one. I'm doing this with general pointer substitution now, so everything that pointed to the old body will use the new one; not sure if that's best, or if it should applied exclusively to scripts, though. - Fixed: Hexen's delay ACS command actually waited one extra tic. Now if you're playing Hexen and an old-style ACS script delays it will wait one extra tic in ZDoom as well. - Fixed: When G_FinishTravel() created a temporary player, P_SpawnPlayer() thought the old player actor was a voodoo doll and stopped its scripts and moved its inventory. SVN r347 (trunk) --- docs/rh-log.txt | 15 +++++++++++++++ src/g_level.cpp | 2 +- src/p_acs.cpp | 6 +++--- src/p_local.h | 2 +- src/p_mobj.cpp | 10 ++++++---- src/v_text.cpp | 2 +- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index e4ebf9370..09c03856a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,18 @@ +October 2, 2006 +- Fixed: V_BreakLines() failed to produce output for the final line if it was + only one character long. +- Fixed: When players respawned in multiplayer, scripts that started on their + old body kept executing on that body instead of being transferred to the new + one. I'm doing this with general pointer substitution now, so everything + that pointed to the old body will use the new one; not sure if that's best, + or if it should applied exclusively to scripts, though. +- Fixed: Hexen's delay ACS command actually waited one extra tic. Now if + you're playing Hexen and an old-style ACS script delays it will wait one + extra tic in ZDoom as well. +- Fixed: When G_FinishTravel() created a temporary player, P_SpawnPlayer() + thought the old player actor was a voodoo doll and stopped its scripts + and moved its inventory. + September 30, 2006 - Fixed: player_t::GetSpawnClass() always returned the spawn flags for the local player, so co-op games would spawn only the things relevant for the diff --git a/src/g_level.cpp b/src/g_level.cpp index 6fbef2b51..e04364e5c 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -2102,7 +2102,7 @@ void G_FinishTravel () // 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); + P_SpawnPlayer (&playerstarts[pawn->player - players], true); pawndup = pawn->player->mo; if (!startkeepfacing) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 890146096..25fc5b17e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3389,7 +3389,7 @@ int DLevelScript::RunScript () break; case PCD_DELAY: - statedata = STACK(1); + statedata = STACK(1) + (fmt == ACS_Old && gameinfo.gametype == GAME_Hexen); if (statedata > 0) { state = SCRIPT_Delayed; @@ -3398,7 +3398,7 @@ int DLevelScript::RunScript () break; case PCD_DELAYDIRECT: - statedata = NEXTWORD; + statedata = NEXTWORD + (fmt == ACS_Old && gameinfo.gametype == GAME_Hexen); if (statedata > 0) { state = SCRIPT_Delayed; @@ -3406,7 +3406,7 @@ int DLevelScript::RunScript () break; case PCD_DELAYDIRECTB: - statedata = *(BYTE *)pc; + statedata = *(BYTE *)pc + (fmt == ACS_Old && gameinfo.gametype == GAME_Hexen); if (statedata > 0) { state = SCRIPT_Delayed; diff --git a/src/p_local.h b/src/p_local.h index 5fc02706c..f134a1447 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, bool startenterscripts = true); +void P_SpawnPlayer (mapthing2_t* mthing, bool tempplayer=false); 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 b37ba323d..adcfaa13a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3367,7 +3367,7 @@ void AActor::AdjustFloorClip () EXTERN_CVAR (Bool, chasedemo) extern bool demonew; -void P_SpawnPlayer (mapthing2_t *mthing, bool startenterscripts) +void P_SpawnPlayer (mapthing2_t *mthing, bool tempplayer) { int playernum; player_t *p; @@ -3436,7 +3436,7 @@ void P_SpawnPlayer (mapthing2_t *mthing, bool startenterscripts) { G_PlayerReborn (playernum); } - else if (oldactor != NULL && oldactor->player == p) + else if (oldactor != NULL && oldactor->player == p && !tempplayer) { // Move the voodoo doll's inventory to the new player. mobj->ObtainInventory (oldactor); @@ -3495,7 +3495,7 @@ void P_SpawnPlayer (mapthing2_t *mthing, bool startenterscripts) p->cheats = CF_CHASECAM; // setup gun psprite - if (startenterscripts) + if (!tempplayer) { // This can also start a script so don't do it for // the dummy player. @@ -3538,7 +3538,7 @@ void P_SpawnPlayer (mapthing2_t *mthing, bool startenterscripts) P_PlayerStartStomp (mobj); // [BC] Do script stuff - if (startenterscripts) + if (!tempplayer) { if (state == PST_ENTER || (state == PST_LIVE && !savegamerestore)) { @@ -3546,6 +3546,8 @@ void P_SpawnPlayer (mapthing2_t *mthing, bool startenterscripts) } else if (state == PST_REBORN) { + assert (oldactor != NULL); + DObject::PointerSubstitution (oldactor, p->mo); FBehavior::StaticStartTypedScripts (SCRIPT_Respawn, p->mo, true); } } diff --git a/src/v_text.cpp b/src/v_text.cpp index 35c62e3b2..8314fa4fe 100644 --- a/src/v_text.cpp +++ b/src/v_text.cpp @@ -406,7 +406,7 @@ FBrokenLines *V_BreakLines (FFont *font, int maxwidth, const BYTE *string) } // String here is pointing one character after the '\0' - if (i < 128 && --string - start > 1) + if (i < 128 && --string - start >= 1) { const BYTE *s = start;