diff --git a/src/dobjgc.h b/src/dobjgc.h index 9fbad404ec..ed0370728f 100644 --- a/src/dobjgc.h +++ b/src/dobjgc.h @@ -180,6 +180,20 @@ public: return *this; } + T operator=(nullptr_t nul) + { + o = nullptr; + return nullptr; + } + + // To allow NULL, too. + T operator=(const int val) + { + assert(val == 0); + o = nullptr; + return nullptr; + } + operator T() throw() { return GC::ReadBarrier(pp); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 577ac1a459..648b8eae1f 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -765,33 +765,6 @@ private: 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 ScriptMap; - ScriptMap RunningScripts; // Array of all synchronous scripts - - void DumpScriptStatus(); - void StopScriptsFor(AActor *actor); - -private: - DLevelScript *LastScript; - DLevelScript *Scripts; // List of all running scripts - - friend class DLevelScript; - friend class FBehavior; - friend struct FBehaviorContainer; -}; - - static DLevelScript *P_GetScriptGoing (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module, const int *args, int argcount, int flags); diff --git a/src/p_acs.h b/src/p_acs.h index 0c7f1b5837..f3c724353e 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -36,6 +36,7 @@ #define __P_ACS_H__ #include "doomtype.h" +#include "dthinker.h" #define LOCAL_SIZE 20 #define NUM_MAPVARS 128 @@ -445,6 +446,34 @@ struct FBehaviorContainer }; +class DLevelScript; + +class DACSThinker : public DThinker +{ + DECLARE_CLASS(DACSThinker, DThinker) + HAS_OBJECT_POINTERS +public: + DACSThinker(); + ~DACSThinker(); + + void Serialize(FSerializer &arc); + void Tick(); + + typedef TMap ScriptMap; + ScriptMap RunningScripts; // Array of all synchronous scripts + + void DumpScriptStatus(); + void StopScriptsFor(AActor *actor); + +private: + DLevelScript *LastScript; + DLevelScript *Scripts; // List of all running scripts + + friend class DLevelScript; + friend class FBehavior; + friend struct FBehaviorContainer; +}; + diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 5b16797450..db93ef8d84 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -978,7 +978,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload) .Array("level.bodyque", level.bodyque, level.BODYQUESIZE) ("level.corpsequeue", level.CorpseQueue) ("level.spotstate", level.SpotState) - ("level.fragglethinker", level.FraggleScriptThinker); + ("level.fragglethinker", level.FraggleScriptThinker) ("level.acsthinker", level.ACSThinker); // Hub transitions must keep the current total time diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 6a022fb061..3cd8792449 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -68,9 +68,10 @@ #include "types.h" #include "i_time.h" #include "scripting/vm/vm.h" -#include "fragglescript/t_fs.h" #include "a_specialspot.h" #include "maploader/maploader.h" +#include "p_acs.h" +#include "fragglescript/t_script.h" void P_ClearUDMFKeys(); @@ -275,6 +276,8 @@ void FLevelLocals::ClearLevelData() ClearPortals(); SpotState = nullptr; + ACSThinker = nullptr; + FraggleScriptThinker = nullptr; CorpseQueue.Clear(); canvasTextureInfo.EmptyList(); sections.Clear();