- moved the scripted creation functions for tag iterators to LevelLocals

The old static methods are now deprecated, this was done to clarify the relationships at play here.
This commit is contained in:
Christoph Oelckers 2019-01-24 02:17:10 +01:00
parent 97495e1857
commit 1f2162fea8
4 changed files with 22 additions and 14 deletions

View file

@ -276,6 +276,7 @@ void FLevelLocals::ClearLevelData()
ClearPortals();
tagManager.Clear();
Behaviors.UnloadModules();
SpotState = nullptr;
ACSThinker = nullptr;
FraggleScriptThinker = nullptr;
@ -343,8 +344,6 @@ void P_FreeLevelData ()
SN_StopAllSequences ();
DThinker::DestroyAllThinkers ();
level.Behaviors.UnloadModules ();
P_FreeStrifeConversations ();
level.ClearLevelData();
}

View file

@ -252,17 +252,17 @@ public:
IMPLEMENT_CLASS(DSectorTagIterator, true, false);
static DSectorTagIterator *CreateSTI(int tag, line_t *line)
static DSectorTagIterator *CreateSTI(FLevelLocals *Level, int tag, line_t *line)
{
return Create<DSectorTagIterator>(level.tagManager, tag, line);
return Create<DSectorTagIterator>(Level->tagManager, tag, line);
}
DEFINE_ACTION_FUNCTION_NATIVE(DSectorTagIterator, Create, CreateSTI)
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, CreateSectorTagIterator, CreateSTI)
{
PARAM_PROLOGUE;
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_INT(tag);
PARAM_POINTER(line, line_t);
ACTION_RETURN_POINTER(CreateSTI(tag, line));
ACTION_RETURN_POINTER(CreateSTI(self, tag, line));
}
int NextSTI(DSectorTagIterator *self)
@ -308,16 +308,16 @@ public:
IMPLEMENT_CLASS(DLineIdIterator, true, false);
static DLineIdIterator *CreateLTI(int tag)
static DLineIdIterator *CreateLTI(FLevelLocals *Level, int tag)
{
return Create<DLineIdIterator>(level.tagManager, tag);
return Create<DLineIdIterator>(Level->tagManager, tag);
}
DEFINE_ACTION_FUNCTION_NATIVE(DLineIdIterator, Create, CreateLTI)
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, CreateLineIDIterator, CreateLTI)
{
PARAM_PROLOGUE;
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_INT(tag);
ACTION_RETURN_POINTER(CreateLTI(tag));
ACTION_RETURN_POINTER(CreateLTI(self, tag));
}
int NextLTI(DLineIdIterator *self)

View file

@ -706,6 +706,9 @@ struct LevelLocals native
native void ChangeSky( TextureID sky1, TextureID sky2 );
native SectorTagIterator CreateSectorTagIterator(int tag, line defline = null);
native LineIdIterator CreateLineIdIterator(int tag);
String TimeFormatted(bool totals = false)
{
int sec = Thinker.Tics2Seconds(totals? totaltime : time);

View file

@ -531,13 +531,19 @@ struct Sector native play
class SectorTagIterator : Object native
{
native static SectorTagIterator Create(int tag, line defline = null);
deprecated("3.8") static SectorTagIterator Create(int tag, line defline = null)
{
return level.CreateSectorTagIterator(tag, defline);
}
native int Next();
native int NextCompat(bool compat, int secnum);
}
class LineIdIterator : Object native
{
native static LineIdIterator Create(int tag);
deprecated("3.8") static LineIdIterator Create(int tag)
{
return level.CreateLineIdIterator(tag);
}
native int Next();
}