From 7b1645d239808515a44f3d438474561d97d1983c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Feb 2017 16:50:10 +0100 Subject: [PATCH 1/4] - fixed the item check in OptionMenuItemCommand. This was calling the wrong GetItem function. --- src/menu/menu.cpp | 6 ++++++ wadsrc/static/zscript/menu/optionmenu.txt | 2 +- wadsrc/static/zscript/menu/optionmenuitems.txt | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 25506a877..9d8e5f4f3 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -448,6 +448,12 @@ DEFINE_ACTION_FUNCTION(DMenu, GetItem) ACTION_RETURN_OBJECT(self->GetItem(name)); } +DEFINE_ACTION_FUNCTION(DOptionMenuDescriptor, GetItem) +{ + PARAM_SELF_PROLOGUE(DOptionMenuDescriptor); + PARAM_NAME(name); + ACTION_RETURN_OBJECT(self->GetItem(name)); +} bool DMenu::DimAllowed() diff --git a/wadsrc/static/zscript/menu/optionmenu.txt b/wadsrc/static/zscript/menu/optionmenu.txt index 5e5b888b1..9eb26ac86 100644 --- a/wadsrc/static/zscript/menu/optionmenu.txt +++ b/wadsrc/static/zscript/menu/optionmenu.txt @@ -57,7 +57,7 @@ class OptionMenuDescriptor : MenuDescriptor native native bool mDontDim; native void CalcIndent(); - //native OptionMenuItem GetItem(Name iname); + native OptionMenuItem GetItem(Name iname); void Reset() { // Reset the default settings (ignore all other values in the struct) diff --git a/wadsrc/static/zscript/menu/optionmenuitems.txt b/wadsrc/static/zscript/menu/optionmenuitems.txt index 03aac8f61..d21c4ba66 100644 --- a/wadsrc/static/zscript/menu/optionmenuitems.txt +++ b/wadsrc/static/zscript/menu/optionmenuitems.txt @@ -132,11 +132,11 @@ class OptionMenuItemCommand : OptionMenuItemSubmenu override bool Activate() { // This needs to perform a few checks to prevent abuse by malicious modders. - let m = Menu.GetCurrentMenu(); + let m = OptionMenu(Menu.GetCurrentMenu()); // don't execute if no menu is active if (m == null) return false; // don't execute if this item cannot be found in the current menu. - if (m.GetItem(mAction) != self) return false; + if (m.mDesc.GetItem(mAction) != self) return false; Menu.MenuSound("menu/choose"); DoCommand(mAction); return true; From 2e11b4f346ff84ee3128f2acc17e71f4ebec4908 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Feb 2017 17:03:31 +0100 Subject: [PATCH 2/4] - fixed: The S_Sound script export did not call the actual function. --- src/s_sound.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index f01d3288c..5c0ae69e2 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -1256,6 +1256,7 @@ DEFINE_ACTION_FUNCTION(DObject, S_Sound) PARAM_INT(channel); PARAM_FLOAT_DEF(volume); PARAM_FLOAT_DEF(attn); + S_Sound(channel, id, volume, attn); return 0; } From 2e5ada5f25a1e0908466940c06cd8f12abc93a58 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Feb 2017 18:20:21 +0100 Subject: [PATCH 3/4] - fixed texture clamping calculations for negative scales. --- src/gl/scene/gl_wall.h | 2 +- src/gl/scene/gl_walls.cpp | 54 ++++++++++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index 7206c86c5..7337c4d3f 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -192,7 +192,7 @@ private: bool PutWallCompat(int passflag); void PutWall(bool translucent); void PutPortal(int ptype); - void CheckTexturePosition(); + void CheckTexturePosition(FTexCoordInfo *tci); void RenderFogBoundaryCompat(); void RenderLightsCompat(int pass); diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 5965eebc3..fc5606b47 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -626,7 +626,7 @@ bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float textureto // //========================================================================== -void GLWall::CheckTexturePosition() +void GLWall::CheckTexturePosition(FTexCoordInfo *tci) { float sub; @@ -634,23 +634,47 @@ void GLWall::CheckTexturePosition() // clamp texture coordinates to a reasonable range. // Extremely large values can cause visual problems - if (tcs[UPLFT].v < tcs[UPRGT].v) + if (tci->mScale.Y > 0) { - sub = float(xs_FloorToInt(tcs[UPLFT].v)); + if (tcs[UPLFT].v < tcs[UPRGT].v) + { + sub = float(xs_FloorToInt(tcs[UPLFT].v)); + } + else + { + sub = float(xs_FloorToInt(tcs[UPRGT].v)); + } + tcs[UPLFT].v -= sub; + tcs[UPRGT].v -= sub; + tcs[LOLFT].v -= sub; + tcs[LORGT].v -= sub; + + if ((tcs[UPLFT].v == 0.f && tcs[UPRGT].v == 0.f && tcs[LOLFT].v <= 1.f && tcs[LORGT].v <= 1.f) || + (tcs[UPLFT].v >= 0.f && tcs[UPRGT].v >= 0.f && tcs[LOLFT].v == 1.f && tcs[LORGT].v == 1.f)) + { + flags |= GLT_CLAMPY; + } } else { - sub = float(xs_FloorToInt(tcs[UPRGT].v)); - } - tcs[UPLFT].v -= sub; - tcs[UPRGT].v -= sub; - tcs[LOLFT].v -= sub; - tcs[LORGT].v -= sub; + if (tcs[LOLFT].v < tcs[LORGT].v) + { + sub = float(xs_FloorToInt(tcs[LOLFT].v)); + } + else + { + sub = float(xs_FloorToInt(tcs[LORGT].v)); + } + tcs[UPLFT].v -= sub; + tcs[UPRGT].v -= sub; + tcs[LOLFT].v -= sub; + tcs[LORGT].v -= sub; - if ((tcs[UPLFT].v == 0.f && tcs[UPRGT].v == 0.f && tcs[LOLFT].v <= 1.f && tcs[LORGT].v <= 1.f) || - (tcs[UPLFT].v >= 0.f && tcs[UPRGT].v >= 0.f && tcs[LOLFT].v == 1.f && tcs[LORGT].v == 1.f)) - { - flags |= GLT_CLAMPY; + if ((tcs[LOLFT].v == 0.f && tcs[LORGT].v == 0.f && tcs[UPLFT].v <= 1.f && tcs[UPRGT].v <= 1.f) || + (tcs[LOLFT].v >= 0.f && tcs[LORGT].v >= 0.f && tcs[UPLFT].v == 1.f && tcs[UPRGT].v == 1.f)) + { + flags |= GLT_CLAMPY; + } } // Check if this is marked as a skybox and if so, do the same for x. @@ -721,7 +745,7 @@ void GLWall::DoTexture(int _type,seg_t * seg, int peg, else { - CheckTexturePosition(); + CheckTexturePosition(&tci); // Add this wall to the render list sector_t * sec = sub ? sub->sector : seg->frontsector; @@ -1139,7 +1163,7 @@ void GLWall::BuildFFBlock(seg_t * seg, F3DFloor * rover, tcs[LOLFT].v = tci.FloatToTexV(to - ff_bottomleft); tcs[LORGT].v = tci.FloatToTexV(to - ff_bottomright); type = RENDERWALL_FFBLOCK; - CheckTexturePosition(); + CheckTexturePosition(&tci); } ztop[0] = ff_topleft; From 9caf5c641b374848c065059b5152339806fa7734 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Feb 2017 19:06:45 +0100 Subject: [PATCH 4/4] - don't let menu number widgets not lock up the menu if their associated CVAR does not exist. --- wadsrc/static/zscript/menu/optionmenuitems.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/wadsrc/static/zscript/menu/optionmenuitems.txt b/wadsrc/static/zscript/menu/optionmenuitems.txt index d21c4ba66..ad4e45677 100644 --- a/wadsrc/static/zscript/menu/optionmenuitems.txt +++ b/wadsrc/static/zscript/menu/optionmenuitems.txt @@ -1197,6 +1197,7 @@ class OptionMenuItemNumberField : OptionMenuFieldBase mCVar.SetFloat(value); Menu.MenuSound("menu/change"); } + else return Super.MenuEvent(mkey, fromcontroller); return true; }