Merge commit '9caf5c641b374848c065059b5152339806fa7734'

This commit is contained in:
Rachael Alexanderson 2017-02-15 05:28:38 -05:00
commit 959ac8c65b
6 changed files with 51 additions and 19 deletions

View file

@ -192,7 +192,7 @@ private:
bool PutWallCompat(int passflag); bool PutWallCompat(int passflag);
void PutWall(bool translucent); void PutWall(bool translucent);
void PutPortal(int ptype); void PutPortal(int ptype);
void CheckTexturePosition(); void CheckTexturePosition(FTexCoordInfo *tci);
void RenderFogBoundaryCompat(); void RenderFogBoundaryCompat();
void RenderLightsCompat(int pass); void RenderLightsCompat(int pass);

View file

@ -626,7 +626,7 @@ bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float textureto
// //
//========================================================================== //==========================================================================
void GLWall::CheckTexturePosition() void GLWall::CheckTexturePosition(FTexCoordInfo *tci)
{ {
float sub; float sub;
@ -634,6 +634,8 @@ void GLWall::CheckTexturePosition()
// clamp texture coordinates to a reasonable range. // clamp texture coordinates to a reasonable range.
// Extremely large values can cause visual problems // Extremely large values can cause visual problems
if (tci->mScale.Y > 0)
{
if (tcs[UPLFT].v < tcs[UPRGT].v) if (tcs[UPLFT].v < tcs[UPRGT].v)
{ {
sub = float(xs_FloorToInt(tcs[UPLFT].v)); sub = float(xs_FloorToInt(tcs[UPLFT].v));
@ -652,6 +654,28 @@ void GLWall::CheckTexturePosition()
{ {
flags |= GLT_CLAMPY; flags |= GLT_CLAMPY;
} }
}
else
{
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[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. // Check if this is marked as a skybox and if so, do the same for x.
// This intentionally only tests the seg's frontsector. // This intentionally only tests the seg's frontsector.
@ -721,7 +745,7 @@ void GLWall::DoTexture(int _type,seg_t * seg, int peg,
else else
{ {
CheckTexturePosition(); CheckTexturePosition(&tci);
// Add this wall to the render list // Add this wall to the render list
sector_t * sec = sub ? sub->sector : seg->frontsector; 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[LOLFT].v = tci.FloatToTexV(to - ff_bottomleft);
tcs[LORGT].v = tci.FloatToTexV(to - ff_bottomright); tcs[LORGT].v = tci.FloatToTexV(to - ff_bottomright);
type = RENDERWALL_FFBLOCK; type = RENDERWALL_FFBLOCK;
CheckTexturePosition(); CheckTexturePosition(&tci);
} }
ztop[0] = ff_topleft; ztop[0] = ff_topleft;

View file

@ -448,6 +448,12 @@ DEFINE_ACTION_FUNCTION(DMenu, GetItem)
ACTION_RETURN_OBJECT(self->GetItem(name)); 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() bool DMenu::DimAllowed()

View file

@ -1256,6 +1256,7 @@ DEFINE_ACTION_FUNCTION(DObject, S_Sound)
PARAM_INT(channel); PARAM_INT(channel);
PARAM_FLOAT_DEF(volume); PARAM_FLOAT_DEF(volume);
PARAM_FLOAT_DEF(attn); PARAM_FLOAT_DEF(attn);
S_Sound(channel, id, volume, attn);
return 0; return 0;
} }

View file

@ -57,7 +57,7 @@ class OptionMenuDescriptor : MenuDescriptor native
native bool mDontDim; native bool mDontDim;
native void CalcIndent(); native void CalcIndent();
//native OptionMenuItem GetItem(Name iname); native OptionMenuItem GetItem(Name iname);
void Reset() void Reset()
{ {
// Reset the default settings (ignore all other values in the struct) // Reset the default settings (ignore all other values in the struct)

View file

@ -132,11 +132,11 @@ class OptionMenuItemCommand : OptionMenuItemSubmenu
override bool Activate() override bool Activate()
{ {
// This needs to perform a few checks to prevent abuse by malicious modders. // 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 // don't execute if no menu is active
if (m == null) return false; if (m == null) return false;
// don't execute if this item cannot be found in the current menu. // 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"); Menu.MenuSound("menu/choose");
DoCommand(mAction); DoCommand(mAction);
return true; return true;
@ -1197,6 +1197,7 @@ class OptionMenuItemNumberField : OptionMenuFieldBase
mCVar.SetFloat(value); mCVar.SetFloat(value);
Menu.MenuSound("menu/change"); Menu.MenuSound("menu/change");
} }
else return Super.MenuEvent(mkey, fromcontroller);
return true; return true;
} }