mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
Merge pull request #491 from MajorCooke/TF_SensitiveZ2
A_Teleport TF_SensitiveZ
This commit is contained in:
commit
8b4194a3e0
2 changed files with 17 additions and 1 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))
|
||||
{
|
||||
|
|
|
@ -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