From 1703842a9404f8c12ced1a2547714f05bfea5873 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 6 Jun 2016 10:48:40 +0200 Subject: [PATCH] - fixed some issues with teleport fog: * many calls didn't use TELEFOGHEIGHT, mostly those coming from external code submissions that never were tested on anything but Doom. Addressed by adding this value inside P_SpawnTeleportFog and making the distinction between projectiles and non-projectiles from P_Teleport also part of this function. * there were still a few places which spawned the teleport fog directly, skipping all the added features of P_SpawnTeleportFog. --- src/g_heretic/a_dsparil.cpp | 3 +-- src/g_heretic/a_hereticmisc.cpp | 1 + src/g_strife/a_rebels.cpp | 2 +- src/p_mobj.cpp | 6 +++--- src/p_teleport.cpp | 6 +++--- src/p_things.cpp | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/g_heretic/a_dsparil.cpp b/src/g_heretic/a_dsparil.cpp index a978f3097..124cb1403 100644 --- a/src/g_heretic/a_dsparil.cpp +++ b/src/g_heretic/a_dsparil.cpp @@ -287,8 +287,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard) self->SetState (self->FindState(NAME_Death)); self->flags &= ~MF_MISSILE; mo->master = self->target; - // Heretic did not offset it by TELEFOGHEIGHT, so I won't either. - Spawn (self->Pos(), ALLOW_REPLACE); + P_SpawnTeleportFog(self, self->Pos(), false, true); } } return 0; diff --git a/src/g_heretic/a_hereticmisc.cpp b/src/g_heretic/a_hereticmisc.cpp index c8a330536..95c2ae6d0 100644 --- a/src/g_heretic/a_hereticmisc.cpp +++ b/src/g_heretic/a_hereticmisc.cpp @@ -17,6 +17,7 @@ #include "farchive.h" #include "d_player.h" #include "a_morph.h" +#include "p_spec.h" // Include all the other Heretic stuff here to reduce compile time #include "a_chicken.cpp" diff --git a/src/g_strife/a_rebels.cpp b/src/g_strife/a_rebels.cpp index dd5267c60..f2031a7a3 100644 --- a/src/g_strife/a_rebels.cpp +++ b/src/g_strife/a_rebels.cpp @@ -115,7 +115,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon) rebel->SetState (rebel->SeeState); rebel->Angles.Yaw = self->Angles.Yaw; - Spawn (rebel->Vec3Angle(20., self->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE); + P_SpawnTeleportFog(rebel, rebel->Vec3Angle(20., self->Angles.Yaw, 0), false, true); if (--self->health < 0) { self->SetState(self->FindState(NAME_Death)); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 97167f245..21455207b 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2789,10 +2789,10 @@ void P_NightmareRespawn (AActor *mobj) mo->Prev.Z = z; // Do not interpolate Z position if we changed it since spawning. // spawn a teleport fog at old spot because of removal of the body? - P_SpawnTeleportFog(mobj, mobj->PosPlusZ(TELEFOGHEIGHT), true, true); + P_SpawnTeleportFog(mobj, mobj->Pos(), true, true); // spawn a teleport fog at the new spot - P_SpawnTeleportFog(mobj, DVector3(mobj->SpawnPoint, z + TELEFOGHEIGHT), false, true); + P_SpawnTeleportFog(mobj, DVector3(mobj->SpawnPoint, z), false, true); // remove the old monster mobj->Destroy (); @@ -4685,7 +4685,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) if (multiplayer) { - Spawn ("TeleportFog", mobj->Vec3Angle(20., mobj->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE); + P_SpawnTeleportFog(mobj, mobj->Vec3Angle(20., mobj->Angles.Yaw, 0.), false, true); } // "Fix" for one of the starts on exec.wad MAP01: If you start inside the ceiling, diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index a3dbd0899..f65e2f402 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -88,7 +88,8 @@ void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele, bool } else { - mo = Spawn((beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType), pos, ALLOW_REPLACE); + double fogDelta = mobj->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT; + mo = Spawn((beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType), DVector3(pos, pos.Z + fogDelta), ALLOW_REPLACE); } if (mo != NULL && setTarget) @@ -191,10 +192,9 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags) { if (!predicting) { - double fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT; DVector2 vector = angle.ToVector(20); DVector2 fogpos = P_GetOffsetPosition(pos.X, pos.Y, vector.X, vector.Y); - P_SpawnTeleportFog(thing, DVector3(fogpos, thing->Z() + fogDelta), false, true); + P_SpawnTeleportFog(thing, DVector3(fogpos, thing->Z()), false, true); } if (thing->player) diff --git a/src/p_things.cpp b/src/p_things.cpp index 374be69d6..98826268c 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -98,7 +98,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, i mobj->Angles.Yaw = (angle != 1000000. ? angle : spot->Angles.Yaw); if (fog) { - P_SpawnTeleportFog(mobj, spot->PosPlusZ(TELEFOGHEIGHT), false, true); + P_SpawnTeleportFog(mobj, spot->Pos(), false, true); } if (mobj->flags & MF_SPECIAL) mobj->flags |= MF_DROPPED; // Don't respawn