From 67ebbe3ed4bb2028c8850157d9e551569cc0aaba Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 May 2014 09:15:56 +0200 Subject: [PATCH] made some changes to turn the CF_INTERPVIEW flag when changing angles into an op-in feature instead of making it automatic. --- src/p_acs.cpp | 8 ++++---- src/p_mobj.cpp | 8 ++++---- src/thingdef/thingdef_codeptr.cpp | 18 ++++++++++-------- wadsrc/static/actors/actor.txt | 2 +- wadsrc/static/actors/constants.txt | 3 ++- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index d70cc2c0b..8326d7b82 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8251,7 +8251,7 @@ scriptwait: { if (activator != NULL) { - activator->SetAngle(STACK(1) << 16); + activator->SetAngle(STACK(1) << 16, false); } } else @@ -8261,7 +8261,7 @@ scriptwait: while ( (actor = iterator.Next ()) ) { - actor->SetAngle(STACK(1) << 16); + actor->SetAngle(STACK(1) << 16, false); } } sp -= 2; @@ -8272,7 +8272,7 @@ scriptwait: { if (activator != NULL) { - activator->SetPitch(STACK(1) << 16); + activator->SetPitch(STACK(1) << 16, false); } } else @@ -8282,7 +8282,7 @@ scriptwait: while ( (actor = iterator.Next ()) ) { - actor->SetPitch(STACK(1) << 16); + actor->SetPitch(STACK(1) << 16, false); } } sp -= 2; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 69d4203fe..2bcae99b0 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2962,24 +2962,24 @@ void AActor::SetShade (int r, int g, int b) fillcolor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b); } -void AActor::SetPitch(int p) +void AActor::SetPitch(int p, bool interpolate) { if (p != pitch) { pitch = p; - if (player != NULL) + if (player != NULL && interpolate) { player->cheats |= CF_INTERPVIEW; } } } -void AActor::SetAngle(angle_t ang) +void AActor::SetAngle(angle_t ang, bool interpolate) { if (ang != angle) { angle = ang; - if (player != NULL) + if (player != NULL && interpolate) { player->cheats |= CF_INTERPVIEW; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d48b18a2a..251a5de91 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3930,12 +3930,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MonsterRefire) // Set actor's angle (in degrees). // //=========================================================================== +enum +{ + SPF_FORCECLAMP = 1, // players always clamp + SPF_INTERPOLATE = 2, +}; + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle) { - ACTION_PARAM_START(1); + ACTION_PARAM_START(2); ACTION_PARAM_ANGLE(angle, 0); - self->SetAngle(angle); + ACTION_PARAM_INT(flags, 1) + self->SetAngle(angle, !!(flags & SPF_INTERPOLATE)); } //=========================================================================== @@ -3946,11 +3953,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle) // //=========================================================================== -enum -{ - SPF_FORCECLAMP = 1, // players always clamp -}; - DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) { ACTION_PARAM_START(2); @@ -3973,7 +3975,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) } pitch = clamp(pitch, min, max); } - self->SetPitch(pitch); + self->SetPitch(pitch, !!(flags & SPF_INTERPOLATE)); } //=========================================================================== diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 73119c941..1eb00440c 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -289,7 +289,7 @@ ACTOR Actor native //: Thinker action native A_DropWeaponPieces(class p1, class p2, class p3); action native A_PigPain (); action native A_MonsterRefire(int chance, state label); - action native A_SetAngle(float angle = 0); + action native A_SetAngle(float angle = 0, int flags = 0); action native A_SetPitch(float pitch, int flags = 0); action native A_ScaleVelocity(float scale); action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index dee498b6a..b252e3194 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -304,8 +304,9 @@ Const Int WARPF_STOP = 0x80; Const Int WARPF_TOFLOOR = 0x100; Const Int WARPF_TESTONLY = 0x200; -// flags for A_SetPitch +// flags for A_SetPitch/SetAngle const int SPF_FORCECLAMP = 1; +const int SPF_INTERPOLATE = 2; // flags for A_CheckLOF