From 441f6339835576bbe015c9984f5593f9ce028dfc Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Sat, 13 Oct 2012 22:55:44 +0000 Subject: [PATCH] - Moved Sqrt, FixedSqrt, and VectorLength to ACSF_ instead of adding new opcodes. SVN r3888 (trunk) --- src/p_acs.cpp | 25 ++++++++++++------------- src/p_acs.h | 5 +---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 8f604e782a..3feafc99ef 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3377,6 +3377,9 @@ enum EACSFunctions ACSF_ACS_NamedExecuteAlways, ACSF_UniqueTID, ACSF_IsTIDUsed, + ACSF_Sqrt, + ACSF_FixedSqrt, + ACSF_VectorLength, // ZDaemon ACSF_GetTeamScore = 19620, @@ -3901,6 +3904,15 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args) return P_IsTIDUsed(args[0]); break; + case ACSF_Sqrt: + return xs_FloorToInt(sqrt(double(args[0]))); + + case ACSF_FixedSqrt: + return FLOAT2FIXED(sqrt(FIXED2DBL(args[0]))); + + case ACSF_VectorLength: + return FLOAT2FIXED(TVector2(FIXED2DBL(args[0]), FIXED2DBL(args[1])).Length()); + default: break; } @@ -6560,14 +6572,6 @@ scriptwait: translation = NULL; break; - case PCD_SQRT: - STACK(1) = xs_FloorToInt(sqrt(double(STACK(1)))); - break; - - case PCD_FIXEDSQRT: - STACK(1) = FLOAT2FIXED(sqrt(FIXED2DBL(STACK(1)))); - break; - case PCD_SIN: STACK(1) = finesine[angle_t(STACK(1)<<16)>>ANGLETOFINESHIFT]; break; @@ -6581,11 +6585,6 @@ scriptwait: sp--; break; - case PCD_VECTORLENGTH: - STACK(2) = FLOAT2FIXED(TVector2(FIXED2DBL(STACK(2)), FIXED2DBL(STACK(1))).Length()); - sp--; - break; - case PCD_CHECKWEAPON: if (activator == NULL || activator->player == NULL || // Non-players do not have weapons activator->player->ReadyWeapon == NULL) diff --git a/src/p_acs.h b/src/p_acs.h index 04384dd735..d2ae2038b1 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -602,11 +602,8 @@ public: /*360*/ PCD_CALLSTACK, // from Eternity PCD_SCRIPTWAITNAMED, PCD_TRANSLATIONRANGE3, - PCD_SQRT, - PCD_FIXEDSQRT, - PCD_VECTORLENGTH, -/*361*/ PCODE_COMMAND_COUNT +/*363*/ PCODE_COMMAND_COUNT }; // Some constants used by ACS scripts