diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 295cdcb63..c2975314b 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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(); } diff --git a/src/scripting/vmiterators.cpp b/src/scripting/vmiterators.cpp index 897f6671a..dca90e1dc 100644 --- a/src/scripting/vmiterators.cpp +++ b/src/scripting/vmiterators.cpp @@ -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(level.tagManager, tag, line); + return Create(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(level.tagManager, tag); + return Create(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) diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 584863e58..fcfc22b54 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -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); diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index 53a6b4bad..c7a7a51fd 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -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(); }