- changed FraggleScript setup so that the MapLoader does not use the global level variable anymore.
This involves passing the level explicitly to many functions. What was done here may seem a bit excessive but at least it covers everything. Most importantly, the global ActiveThinker pointer has been moved into FLevelLocals and is now getting tracked properly by the level without using dangerous assumptions about how the game organizes its data.
This commit is contained in:
parent
95995e4aa3
commit
7b16433e97
16 changed files with 108 additions and 86 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#include "t_script.h"
|
||||
#include "a_pickups.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -122,7 +123,7 @@ const char *stringvalue(const svalue_t & v)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
AActor* actorvalue(const svalue_t &svalue)
|
||||
AActor* actorvalue(FLevelLocals *Level, const svalue_t &svalue)
|
||||
{
|
||||
int intval;
|
||||
|
||||
|
|
@ -138,9 +139,9 @@ AActor* actorvalue(const svalue_t &svalue)
|
|||
}
|
||||
else
|
||||
{
|
||||
auto &SpawnedThings = DFraggleThinker::ActiveThinker->SpawnedThings;
|
||||
auto &SpawnedThings = Level->FraggleScriptThinker->SpawnedThings;
|
||||
// this requires some creativity. We use the intvalue
|
||||
// as the thing number of a thing in the level.
|
||||
// as the thing number of a thing in the level
|
||||
intval = intvalue(svalue);
|
||||
|
||||
if(intval < 0 || intval >= (int)SpawnedThings.Size())
|
||||
|
|
@ -234,7 +235,7 @@ void DFsVariable::GetValue(svalue_t &returnvar)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFsVariable::SetValue(const svalue_t &newvalue)
|
||||
void DFsVariable::SetValue(FLevelLocals *Level, const svalue_t &newvalue)
|
||||
{
|
||||
if(type == svt_const)
|
||||
{
|
||||
|
|
@ -264,7 +265,7 @@ void DFsVariable::SetValue(const svalue_t &newvalue)
|
|||
break;
|
||||
|
||||
case svt_mobj:
|
||||
actor = actorvalue(newvalue);
|
||||
actor = actorvalue(Level, newvalue);
|
||||
break;
|
||||
|
||||
case svt_pInt:
|
||||
|
|
@ -272,7 +273,7 @@ void DFsVariable::SetValue(const svalue_t &newvalue)
|
|||
break;
|
||||
|
||||
case svt_pMobj:
|
||||
*value.pMobj = actorvalue(newvalue);
|
||||
*value.pMobj = actorvalue(Level, newvalue);
|
||||
break;
|
||||
|
||||
case svt_function:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue