From 996bddd602fe2015fbdc1d44fae7650d8cc715d7 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 29 Dec 2017 09:42:03 +0200 Subject: [PATCH] Exposed pixel stretch to ZScript as member variable instead of function https://forum.zdoom.org/viewtopic.php?t=58539 --- src/g_level.cpp | 20 +++----------------- src/g_levellocals.h | 2 +- wadsrc/static/zscript/base.txt | 2 +- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index c333ba074..cb5bc4baf 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1481,6 +1481,8 @@ void G_InitLevelLocals () level.outsidefogdensity = info->outsidefogdensity; level.skyfog = info->skyfog; + level.pixelstretch = info->pixelstretch; + compatflags.Callback(); compatflags2.Callback(); @@ -1952,23 +1954,6 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic) return 0; } -//========================================================================== -// -// -// -//========================================================================== - -float FLevelLocals::PixelStretch() -{ - return level.info->pixelstretch; -} - -DEFINE_ACTION_FUNCTION(FLevelLocals, GetPixelStretch) -{ - PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals); - ACTION_RETURN_FLOAT(self->PixelStretch()); -} - //========================================================================== // // @@ -2011,6 +1996,7 @@ DEFINE_FIELD(FLevelLocals, teamdamage) DEFINE_FIELD(FLevelLocals, fogdensity) DEFINE_FIELD(FLevelLocals, outsidefogdensity) DEFINE_FIELD(FLevelLocals, skyfog) +DEFINE_FIELD(FLevelLocals, pixelstretch) DEFINE_FIELD_BIT(FLevelLocals, flags, noinventorybar, LEVEL_NOINVENTORYBAR) DEFINE_FIELD_BIT(FLevelLocals, flags, monsterstelefrag, LEVEL_MONSTERSTELEFRAG) DEFINE_FIELD_BIT(FLevelLocals, flags, actownspecial, LEVEL_ACTOWNSPECIAL) diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 024e6302d..60cb30df0 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -46,7 +46,6 @@ struct FLevelLocals void Tick (); void AddScroller (int secnum); void SetInterMusic(const char *nextmap); - float PixelStretch(); uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded. int time; // time in the hub @@ -149,6 +148,7 @@ struct FLevelLocals int outsidefogdensity; int skyfog; + float pixelstretch; bool IsJumpingAllowed() const; bool IsCrouchingAllowed() const; diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 237f8a084..4ffe34dce 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -536,6 +536,7 @@ struct LevelLocals native native readonly int fogdensity; native readonly int outsidefogdensity; native readonly int skyfog; + native readonly float pixelstretch; // level_info_t *info cannot be done yet. native String GetUDMFString(int type, int index, Name key); @@ -547,7 +548,6 @@ struct LevelLocals native native static void WorldDone(); native static void RemoveAllBots(bool fromlist); native void SetInterMusic(String nextmap); - native double GetPixelStretch(); native String FormatMapName(int mapnamecolor); native bool IsJumpingAllowed() const; native bool IsCrouchingAllowed() const;