- Added TF_FORCED for A_Teleport. Forces the actor to move to the spot.

This commit is contained in:
MajorCooke 2014-10-31 15:41:23 -05:00
parent 0ff65bb430
commit 938b54ccb5
2 changed files with 19 additions and 3 deletions

View File

@ -4054,6 +4054,7 @@ enum T_Flags
{
TF_TELEFRAG = 1, // Allow telefrag in order to teleport.
TF_RANDOMDECIDE = 2, // Randomly fail based on health. (A_Srcr2Decide)
TF_FORCED = 4, // Forget what's in the way. TF_Telefrag takes precedence though.
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
@ -4103,7 +4104,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
fixed_t prevX = self->x;
fixed_t prevY = self->y;
fixed_t prevZ = self->z;
if (P_TeleportMove (self, spot->x, spot->y, spot->z, Flags & TF_TELEFRAG))
bool teleResult = false;
//Take precedence and cooperate with telefragging first.
if (P_TeleportMove(self, spot->x, spot->y, spot->z, Flags & TF_TELEFRAG))
teleResult = true;
if ((!(teleResult)) && (Flags & TF_FORCED))
{
//If for some reason the original move didn't work, regardless of telefrag, force it to move.
self->SetOrigin(spot->x, spot->y, spot->z);
teleResult = true;
}
if (teleResult)
{
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
@ -4509,7 +4523,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
self->PrevY = self->y + reference->PrevY - reference->y;
self->PrevZ = self->z + reference->PrevZ - reference->z;
}
else if (! (flags & WARPF_INTERPOLATE))
else if (!(flags & WARPF_INTERPOLATE))
{
self->PrevX = self->x;
self->PrevY = self->y;

View File

@ -181,7 +181,9 @@ const int FPF_AIMATANGLE = 1;
const int FPF_TRANSFERTRANSLATION = 2;
// Flags for A_Teleport
const int TF_TELEFRAG = 1;const int TF_RANDOMDECIDE = 2;
const int TF_TELEFRAG = 1;
const int TF_RANDOMDECIDE = 2;
const int TF_FORCED = 4;
// Flags for A_WolfAttack
const int WAF_NORANDOM = 1;