mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Fixed an issue which caused A_Teleport to set the caller and itself to SpotZ's z position.
This commit is contained in:
commit
93aff2413f
2 changed files with 17 additions and 2 deletions
|
@ -4265,6 +4265,7 @@ enum T_Flags
|
|||
TF_USEACTORFOG = 0x00000100, // Use the actor's TeleFogSourceType and TeleFogDestType fogs.
|
||||
TF_NOJUMP = 0x00000200, // Don't jump after teleporting.
|
||||
TF_OVERRIDE = 0x00000400, // Ignore NOTELEPORT.
|
||||
TF_SENSITIVEZ = 0x00000800, // Fail if the actor wouldn't fit in the position (for Z).
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
|
||||
|
@ -4329,6 +4330,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
// [MC] By default, the function adjusts the actor's Z if it's below the floor or above the ceiling.
|
||||
// This can be an issue as actors designed to maintain specific z positions wind up teleporting
|
||||
// anyway when they should not, such as a floor rising above or ceiling lowering below the position
|
||||
// of the spot.
|
||||
if (flags & TF_SENSITIVEZ)
|
||||
{
|
||||
fixed_t posz = (flags & TF_USESPOTZ) ? spot->Z() : spot->floorz;
|
||||
if ((posz + ref->height > spot->ceilingz) || (posz < spot->floorz))
|
||||
{
|
||||
ACTION_SET_RESULT(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
fixedvec3 prev = ref->Pos();
|
||||
fixed_t aboveFloor = spot->Z() - spot->floorz;
|
||||
fixed_t finalz = spot->floorz + aboveFloor;
|
||||
|
@ -4339,7 +4354,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
|
|||
finalz = spot->floorz;
|
||||
|
||||
//Take precedence and cooperate with telefragging first.
|
||||
bool tele_result = P_TeleportMove(ref, spot->X(), spot->Y(), finalz, flags & TF_TELEFRAG);
|
||||
bool tele_result = P_TeleportMove(ref, spot->X(), spot->Y(), finalz, !!(flags & TF_TELEFRAG));
|
||||
|
||||
if (!tele_result && (flags & TF_FORCED))
|
||||
{
|
||||
|
@ -4380,7 +4395,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
|
|||
}
|
||||
|
||||
ref->SetZ((flags & TF_USESPOTZ) ? spot->Z() : ref->floorz, false);
|
||||
self->SetZ((flags & TF_USESPOTZ) ? spot->Z() : self->floorz, false);
|
||||
|
||||
if (!(flags & TF_KEEPANGLE))
|
||||
ref->angle = spot->angle;
|
||||
|
|
|
@ -208,6 +208,7 @@ enum
|
|||
TF_USEACTORFOG = 0x00000100, // Use the actor's TeleFogSourceType and TeleFogDestType fogs.
|
||||
TF_NOJUMP = 0x00000200, // Don't jump after teleporting.
|
||||
TF_OVERRIDE = 0x00000400, // Ignore NOTELEPORT.
|
||||
TF_SENSITIVEZ = 0x00000800, // Fail if the actor wouldn't fit in the position (for Z).
|
||||
|
||||
TF_KEEPORIENTATION = TF_KEEPVELOCITY|TF_KEEPANGLE,
|
||||
TF_NOFOG = TF_NOSRCFOG|TF_NODESTFOG,
|
||||
|
|
Loading…
Reference in a new issue