- fixed serialization of ACS thinker.

This commit is contained in:
Christoph Oelckers 2019-01-06 10:24:27 +01:00
parent a11eea98b5
commit 55339761f6
5 changed files with 48 additions and 29 deletions

View file

@ -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);

View file

@ -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<int, DLevelScript *> 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);

View file

@ -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<int, DLevelScript *> 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;
};

View file

@ -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

View file

@ -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();