From 938b54ccb5f62f864edcc1edf26fcd42304ddb84 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Fri, 31 Oct 2014 15:41:23 -0500 Subject: [PATCH] - Added TF_FORCED for A_Teleport. Forces the actor to move to the spot. --- src/thingdef/thingdef_codeptr.cpp | 18 ++++++++++++++++-- wadsrc/static/actors/constants.txt | 4 +++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 80583b5870..2732337c72 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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; diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index a43d90f96f..78741e059f 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -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;