- did a bit of header cleanup to reduce the dependency on dobject.h.
This commit is contained in:
parent
1c81c40c59
commit
a4710bcdb0
48 changed files with 226 additions and 274 deletions
133
src/p_acs.cpp
133
src/p_acs.cpp
|
|
@ -659,6 +659,134 @@ struct CallReturn
|
|||
unsigned int EntryInstrCount;
|
||||
};
|
||||
|
||||
|
||||
class DLevelScript : public DObject
|
||||
{
|
||||
DECLARE_CLASS(DLevelScript, DObject)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
|
||||
|
||||
enum EScriptState
|
||||
{
|
||||
SCRIPT_Running,
|
||||
SCRIPT_Suspended,
|
||||
SCRIPT_Delayed,
|
||||
SCRIPT_TagWait,
|
||||
SCRIPT_PolyWait,
|
||||
SCRIPT_ScriptWaitPre,
|
||||
SCRIPT_ScriptWait,
|
||||
SCRIPT_PleaseRemove,
|
||||
SCRIPT_DivideBy0,
|
||||
SCRIPT_ModulusBy0,
|
||||
};
|
||||
|
||||
DLevelScript(AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module,
|
||||
const int *args, int argcount, int flags);
|
||||
~DLevelScript();
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
int RunScript();
|
||||
|
||||
inline void SetState(EScriptState newstate) { state = newstate; }
|
||||
inline EScriptState GetState() { return state; }
|
||||
|
||||
DLevelScript *GetNext() const { return next; }
|
||||
|
||||
void MarkLocalVarStrings() const
|
||||
{
|
||||
GlobalACSStrings.MarkStringArray(&Localvars[0], Localvars.Size());
|
||||
}
|
||||
void LockLocalVarStrings() const
|
||||
{
|
||||
GlobalACSStrings.LockStringArray(&Localvars[0], Localvars.Size());
|
||||
}
|
||||
void UnlockLocalVarStrings() const
|
||||
{
|
||||
GlobalACSStrings.UnlockStringArray(&Localvars[0], Localvars.Size());
|
||||
}
|
||||
|
||||
protected:
|
||||
DLevelScript *next, *prev;
|
||||
int script;
|
||||
TArray<int32_t> Localvars;
|
||||
int *pc;
|
||||
EScriptState state;
|
||||
int statedata;
|
||||
TObjPtr<AActor*> activator;
|
||||
line_t *activationline;
|
||||
bool backSide;
|
||||
FFont *activefont;
|
||||
int hudwidth, hudheight;
|
||||
int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight;
|
||||
int WrapWidth;
|
||||
bool HandleAspect;
|
||||
FBehavior *activeBehavior;
|
||||
int InModuleScriptNumber;
|
||||
|
||||
void Link();
|
||||
void Unlink();
|
||||
void PutLast();
|
||||
void PutFirst();
|
||||
static int Random(int min, int max);
|
||||
static int ThingCount(int type, int stringid, int tid, int tag);
|
||||
static void ChangeFlat(int tag, int name, bool floorOrCeiling);
|
||||
static int CountPlayers();
|
||||
static void SetLineTexture(int lineid, int side, int position, int name);
|
||||
static int DoSpawn(int type, const DVector3 &pos, int tid, DAngle angle, bool force);
|
||||
static int DoSpawn(int type, int x, int y, int z, int tid, int angle, bool force);
|
||||
static bool DoCheckActorTexture(int tid, AActor *activator, int string, bool floor);
|
||||
int DoSpawnSpot(int type, int spot, int tid, int angle, bool forced);
|
||||
int DoSpawnSpotFacing(int type, int spot, int tid, bool forced);
|
||||
int DoClassifyActor(int tid);
|
||||
int CallFunction(int argCount, int funcIndex, int32_t *args);
|
||||
|
||||
void DoFadeTo(int r, int g, int b, int a, int time);
|
||||
void DoFadeRange(int r1, int g1, int b1, int a1,
|
||||
int r2, int g2, int b2, int a2, int time);
|
||||
void DoSetFont(int fontnum);
|
||||
void SetActorProperty(int tid, int property, int value);
|
||||
void DoSetActorProperty(AActor *actor, int property, int value);
|
||||
int GetActorProperty(int tid, int property);
|
||||
int CheckActorProperty(int tid, int property, int value);
|
||||
int GetPlayerInput(int playernum, int inputnum);
|
||||
|
||||
int LineFromID(int id);
|
||||
int SideFromID(int id, int side);
|
||||
|
||||
private:
|
||||
DLevelScript();
|
||||
|
||||
friend class DACSThinker;
|
||||
};
|
||||
|
||||
class DACSThinker : public DThinker
|
||||
{
|
||||
DECLARE_CLASS(DACSThinker, DThinker)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
DACSThinker();
|
||||
~DACSThinker();
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
|
||||
typedef TMap<int, DLevelScript *> ScriptMap;
|
||||
ScriptMap RunningScripts; // Array of all synchronous scripts
|
||||
static TObjPtr<DACSThinker*> ActiveThinker;
|
||||
|
||||
void DumpScriptStatus();
|
||||
void StopScriptsFor(AActor *actor);
|
||||
|
||||
private:
|
||||
DLevelScript *LastScript;
|
||||
DLevelScript *Scripts; // List of all running scripts
|
||||
|
||||
friend class DLevelScript;
|
||||
friend class FBehavior;
|
||||
};
|
||||
|
||||
|
||||
static DLevelScript *P_GetScriptGoing (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module,
|
||||
const int *args, int argcount, int flags);
|
||||
|
||||
|
|
@ -10863,6 +10991,11 @@ CCMD(acsprofile)
|
|||
ShowProfileData(FuncProfiles, limit, sorter, true);
|
||||
}
|
||||
|
||||
void MarkACSThinker()
|
||||
{
|
||||
GC::Mark(DACSThinker::ActiveThinker);
|
||||
}
|
||||
|
||||
ADD_STAT(ACS)
|
||||
{
|
||||
return FStringf("ACS time: %f ms", ACSTime.TimeMS());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue