- 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.
This commit is contained in:
Christoph Oelckers 2016-06-06 10:48:40 +02:00
parent 8a08fb2f6a
commit 1703842a94
6 changed files with 10 additions and 10 deletions

View file

@ -287,8 +287,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
self->SetState (self->FindState(NAME_Death)); self->SetState (self->FindState(NAME_Death));
self->flags &= ~MF_MISSILE; self->flags &= ~MF_MISSILE;
mo->master = self->target; mo->master = self->target;
// Heretic did not offset it by TELEFOGHEIGHT, so I won't either. P_SpawnTeleportFog(self, self->Pos(), false, true);
Spawn<ATeleportFog> (self->Pos(), ALLOW_REPLACE);
} }
} }
return 0; return 0;

View file

@ -17,6 +17,7 @@
#include "farchive.h" #include "farchive.h"
#include "d_player.h" #include "d_player.h"
#include "a_morph.h" #include "a_morph.h"
#include "p_spec.h"
// Include all the other Heretic stuff here to reduce compile time // Include all the other Heretic stuff here to reduce compile time
#include "a_chicken.cpp" #include "a_chicken.cpp"

View file

@ -115,7 +115,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
rebel->SetState (rebel->SeeState); rebel->SetState (rebel->SeeState);
rebel->Angles.Yaw = self->Angles.Yaw; rebel->Angles.Yaw = self->Angles.Yaw;
Spawn<ATeleportFog> (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) if (--self->health < 0)
{ {
self->SetState(self->FindState(NAME_Death)); self->SetState(self->FindState(NAME_Death));

View file

@ -2789,10 +2789,10 @@ void P_NightmareRespawn (AActor *mobj)
mo->Prev.Z = z; // Do not interpolate Z position if we changed it since spawning. 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? // 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 // 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 // remove the old monster
mobj->Destroy (); mobj->Destroy ();
@ -4685,7 +4685,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
if (multiplayer) 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, // "Fix" for one of the starts on exec.wad MAP01: If you start inside the ceiling,

View file

@ -88,7 +88,8 @@ void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele, bool
} }
else 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) if (mo != NULL && setTarget)
@ -191,10 +192,9 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
{ {
if (!predicting) if (!predicting)
{ {
double fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT;
DVector2 vector = angle.ToVector(20); DVector2 vector = angle.ToVector(20);
DVector2 fogpos = P_GetOffsetPosition(pos.X, pos.Y, vector.X, vector.Y); 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) if (thing->player)

View file

@ -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); mobj->Angles.Yaw = (angle != 1000000. ? angle : spot->Angles.Yaw);
if (fog) if (fog)
{ {
P_SpawnTeleportFog(mobj, spot->PosPlusZ(TELEFOGHEIGHT), false, true); P_SpawnTeleportFog(mobj, spot->Pos(), false, true);
} }
if (mobj->flags & MF_SPECIAL) if (mobj->flags & MF_SPECIAL)
mobj->flags |= MF_DROPPED; // Don't respawn mobj->flags |= MF_DROPPED; // Don't respawn