From b12de0425811a4647e38c3c9e8601325ff3e281c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 30 Jan 2019 00:58:44 +0100 Subject: [PATCH] - fixed the remaining deprecation warnings in the base script. All these required access to the sector's Level reference. The remaining references to the global 'level' variable are all in deprecated functions which is ok. --- src/scripting/vmthunks.cpp | 1 + wadsrc/static/zscript/base.txt | 28 ++++++++++---------- wadsrc/static/zscript/mapdata.txt | 13 ++++----- wadsrc/static/zscript/shared/specialspot.txt | 2 +- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index 6e3705781..b5fa6a918 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -2926,6 +2926,7 @@ DEFINE_FIELD_X(Sector, sector_t, terrainnum) DEFINE_FIELD_X(Sector, sector_t, floordata) DEFINE_FIELD_X(Sector, sector_t, ceilingdata) DEFINE_FIELD_X(Sector, sector_t, lightingdata) +DEFINE_FIELD_X(Sector, sector_t, Level) DEFINE_FIELD_X(Sector, sector_t, interpolations) DEFINE_FIELD_X(Sector, sector_t, soundtraversed) DEFINE_FIELD_X(Sector, sector_t, stairlock) diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 2860273c8..070f3f033 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -693,7 +693,7 @@ struct LevelLocals native native String GetUDMFString(int type, int index, Name key); native int GetUDMFInt(int type, int index, Name key); native double GetUDMFFloat(int type, int index, Name key); - native int ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0); + native play int ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0); native void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true); native void StartSlideshow(Name whichone = 'none'); native void WorldDone(); @@ -705,35 +705,35 @@ struct LevelLocals native native bool IsCrouchingAllowed() const; native bool IsFreelookAllowed() const; native void StartIntermission(Name type, int state) const; - native SpotState GetSpotState(bool create = true); + native play SpotState GetSpotState(bool create = true); native int FindUniqueTid(int start = 0, int limit = 0); native uint GetSkyboxPortal(Actor actor); native void ReplaceTextures(String from, String to, int flags); clearscope native HealthGroup FindHealthGroup(int id); native vector3, int PickDeathmatchStart(); native vector3, int PickPlayerStart(int pnum, int flags = 0); - native int isFrozen(); + native int isFrozen() const; native void setFrozen(bool on); - native clearscope Sector PointInSector(Vector2 pt); + native clearscope Sector PointInSector(Vector2 pt) const; - native clearscope bool IsPointInLevel(vector3 p); + native clearscope bool IsPointInLevel(vector3 p) const; deprecated("3.8") clearscope static bool IsPointInMap(vector3 p) { return level.IsPointInLevel(p); } - native clearscope vector2 Vec2Diff(vector2 v1, vector2 v2); - native clearscope vector3 Vec3Diff(vector3 v1, vector3 v2); - native clearscope vector3 SphericalCoords(vector3 viewpoint, vector3 targetPos, vector2 viewAngles = (0, 0), bool absolute = false); + native clearscope vector2 Vec2Diff(vector2 v1, vector2 v2) const; + native clearscope vector3 Vec3Diff(vector3 v1, vector3 v2) const; + native clearscope vector3 SphericalCoords(vector3 viewpoint, vector3 targetPos, vector2 viewAngles = (0, 0), bool absolute = false) const; - native clearscope vector2 Vec2Offset(vector2 pos, vector2 dir, bool absolute = false); - native clearscope vector3 Vec2OffsetZ(vector2 pos, vector2 dir, double atz, bool absolute = false); - native clearscope vector3 Vec3Offset(vector3 pos, vector3 dir, bool absolute = false); + native clearscope vector2 Vec2Offset(vector2 pos, vector2 dir, bool absolute = false) const; + native clearscope vector3 Vec2OffsetZ(vector2 pos, vector2 dir, double atz, bool absolute = false) const; + native clearscope vector3 Vec3Offset(vector3 pos, vector3 dir, bool absolute = false) const; native String GetChecksum() const; - native void ChangeSky( TextureID sky1, TextureID sky2 ); + native void ChangeSky(TextureID sky1, TextureID sky2 ); native SectorTagIterator CreateSectorTagIterator(int tag, line defline = null); native LineIdIterator CreateLineIdIterator(int tag); @@ -745,8 +745,8 @@ struct LevelLocals native return String.Format("%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60); } - native bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = 0 /*Floor.crushDoom*/); - native bool CreateFloor(sector sec, int floortype, line ln, double speed, double height = 0, int crush = -1, int change = 0, bool crushmode = false, bool hereticlower = false); + native play bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = 0 /*Floor.crushDoom*/); + native play bool CreateFloor(sector sec, int floortype, line ln, double speed, double height = 0, int crush = -1, int change = 0, bool crushmode = false, bool hereticlower = false); } diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index 4a1154feb..02e78fe7f 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -97,15 +97,15 @@ struct Side native play int GetUDMFInt(Name nm) { - return Level.GetUDMFInt(LevelLocals.UDMF_Side, Index(), nm); + return sector.Level.GetUDMFInt(LevelLocals.UDMF_Side, Index(), nm); } double GetUDMFFloat(Name nm) { - return Level.GetUDMFFloat(LevelLocals.UDMF_Side, Index(), nm); + return sector.Level.GetUDMFFloat(LevelLocals.UDMF_Side, Index(), nm); } String GetUDMFString(Name nm) { - return Level.GetUDMFString(LevelLocals.UDMF_Side, Index(), nm); + return sector.Level.GetUDMFString(LevelLocals.UDMF_Side, Index(), nm); } }; @@ -180,15 +180,15 @@ struct Line native play int GetUDMFInt(Name nm) { - return Level.GetUDMFInt(LevelLocals.UDMF_Line, Index(), nm); + return frontsector.Level.GetUDMFInt(LevelLocals.UDMF_Line, Index(), nm); } double GetUDMFFloat(Name nm) { - return Level.GetUDMFFloat(LevelLocals.UDMF_Line, Index(), nm); + return frontsector.Level.GetUDMFFloat(LevelLocals.UDMF_Line, Index(), nm); } String GetUDMFString(Name nm) { - return Level.GetUDMFString(LevelLocals.UDMF_Line, Index(), nm); + return frontsector.Level.GetUDMFString(LevelLocals.UDMF_Line, Index(), nm); } native clearscope int GetHealth(); @@ -259,6 +259,7 @@ struct Sector native play native SectorEffect floordata; native SectorEffect ceilingdata; native SectorEffect lightingdata; + native readonly LevelLocals Level; enum EPlane { diff --git a/wadsrc/static/zscript/shared/specialspot.txt b/wadsrc/static/zscript/shared/specialspot.txt index fdf357b2a..fd6192d87 100644 --- a/wadsrc/static/zscript/shared/specialspot.txt +++ b/wadsrc/static/zscript/shared/specialspot.txt @@ -1,4 +1,4 @@ -class SpotState : Object native +class SpotState : Object native play { deprecated ("3.8") static SpotState GetSpotState(bool create = true) {