diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 84fbe734a..f47b5b773 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -677,6 +677,8 @@ public: void Serialize(FSerializer &arc); int RunScript(); + PClass *GetClassForIndex(int index) const; + inline void SetState(EScriptState newstate) { state = newstate; } inline EScriptState GetState() { return state; } @@ -6759,6 +6761,11 @@ static bool CharArrayParms(int &capacity, int &offset, int &a, FACSStackMemory& return true; } +PClass *DLevelScript::GetClassForIndex(int index) const +{ + return PClass::FindActor(level.Behaviors.LookupString(index)); +} + int DLevelScript::RunScript () { DACSThinker *controller = level.ACSThinker; @@ -9618,7 +9625,7 @@ scriptwait: break; case PCD_SETWEAPON: - STACK(1) = ScriptUtil::Exec(NAME_SetWeapon, ScriptUtil::Pointer, activator, ScriptUtil::ACSClass, STACK(1), ScriptUtil::End); + STACK(1) = ScriptUtil::Exec(NAME_SetWeapon, ScriptUtil::Pointer, activator, ScriptUtil::Class, GetClassForIndex(STACK(1)), ScriptUtil::End); break; case PCD_SETMARINEWEAPON: @@ -9627,7 +9634,7 @@ scriptwait: break; case PCD_SETMARINESPRITE: - ScriptUtil::Exec(NAME_SetMarineSprite, ScriptUtil::Pointer, activator, ScriptUtil::Int, STACK(2), ScriptUtil::ACSClass, STACK(1), ScriptUtil::End); + ScriptUtil::Exec(NAME_SetMarineSprite, ScriptUtil::Pointer, activator, ScriptUtil::Int, STACK(2), ScriptUtil::Class, GetClassForIndex(STACK(1)), ScriptUtil::End); sp -= 2; break; diff --git a/src/scriptutil.cpp b/src/scriptutil.cpp index bcb5fe9d0..b47eaee4b 100644 --- a/src/scriptutil.cpp +++ b/src/scriptutil.cpp @@ -60,10 +60,6 @@ void ScriptUtil::BuildParameters(va_list ap) case Float: parameters.Push(VMValue(va_arg(ap, double))); break; - - case ACSClass: - parameters.Push(VMValue(PClass::FindActor(level.Behaviors.LookupString(va_arg(ap, int))))); - break; } } } diff --git a/src/scriptutil.h b/src/scriptutil.h index 12f137764..94b4ca08c 100644 --- a/src/scriptutil.h +++ b/src/scriptutil.h @@ -19,8 +19,6 @@ public: Float, String, Class, - ACSString, // convenience helpers taking an ACS string index instead of a string - ACSClass, }; static int Exec(FName functionname, ...);