- Moved Sqrt, FixedSqrt, and VectorLength to ACSF_ instead of adding new opcodes.

SVN r3888 (trunk)
This commit is contained in:
Braden Obrzut 2012-10-13 22:55:44 +00:00
parent f3b40a9f36
commit 441f633983
2 changed files with 13 additions and 17 deletions

View file

@ -3377,6 +3377,9 @@ enum EACSFunctions
ACSF_ACS_NamedExecuteAlways, ACSF_ACS_NamedExecuteAlways,
ACSF_UniqueTID, ACSF_UniqueTID,
ACSF_IsTIDUsed, ACSF_IsTIDUsed,
ACSF_Sqrt,
ACSF_FixedSqrt,
ACSF_VectorLength,
// ZDaemon // ZDaemon
ACSF_GetTeamScore = 19620, ACSF_GetTeamScore = 19620,
@ -3901,6 +3904,15 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
return P_IsTIDUsed(args[0]); return P_IsTIDUsed(args[0]);
break; 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<double>(FIXED2DBL(args[0]), FIXED2DBL(args[1])).Length());
default: default:
break; break;
} }
@ -6560,14 +6572,6 @@ scriptwait:
translation = NULL; translation = NULL;
break; 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: case PCD_SIN:
STACK(1) = finesine[angle_t(STACK(1)<<16)>>ANGLETOFINESHIFT]; STACK(1) = finesine[angle_t(STACK(1)<<16)>>ANGLETOFINESHIFT];
break; break;
@ -6581,11 +6585,6 @@ scriptwait:
sp--; sp--;
break; break;
case PCD_VECTORLENGTH:
STACK(2) = FLOAT2FIXED(TVector2<double>(FIXED2DBL(STACK(2)), FIXED2DBL(STACK(1))).Length());
sp--;
break;
case PCD_CHECKWEAPON: case PCD_CHECKWEAPON:
if (activator == NULL || activator->player == NULL || // Non-players do not have weapons if (activator == NULL || activator->player == NULL || // Non-players do not have weapons
activator->player->ReadyWeapon == NULL) activator->player->ReadyWeapon == NULL)

View file

@ -602,11 +602,8 @@ public:
/*360*/ PCD_CALLSTACK, // from Eternity /*360*/ PCD_CALLSTACK, // from Eternity
PCD_SCRIPTWAITNAMED, PCD_SCRIPTWAITNAMED,
PCD_TRANSLATIONRANGE3, PCD_TRANSLATIONRANGE3,
PCD_SQRT,
PCD_FIXEDSQRT,
PCD_VECTORLENGTH,
/*361*/ PCODE_COMMAND_COUNT /*363*/ PCODE_COMMAND_COUNT
}; };
// Some constants used by ACS scripts // Some constants used by ACS scripts