From 924cd3ef3856822f8754dc75987e04a456134146 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 11 Oct 2012 03:38:12 +0000 Subject: [PATCH] - Added sqrt, fixedsqrt, and vectorlength to ACS. SVN r3883 (trunk) --- src/p_acs.cpp | 13 +++++++++++++ src/p_acs.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index daffe0eae..8f604e782 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -6560,6 +6560,14 @@ 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; @@ -6573,6 +6581,11 @@ 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 c2e0e9155..04384dd73 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -602,6 +602,9 @@ public: /*360*/ PCD_CALLSTACK, // from Eternity PCD_SCRIPTWAITNAMED, PCD_TRANSLATIONRANGE3, + PCD_SQRT, + PCD_FIXEDSQRT, + PCD_VECTORLENGTH, /*361*/ PCODE_COMMAND_COUNT };