mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-17 17:41:23 +00:00
Added PSPF_MIRROR.
- Flips the sprite's drawing and position over entirely. Automatically implies PSPF_FLIP.
This commit is contained in:
parent
d633e8afc1
commit
a111c59286
4 changed files with 13 additions and 2 deletions
|
@ -98,7 +98,7 @@ void GLSceneDrawer::DrawPSprite (player_t * player,DPSprite *psp, float sx, floa
|
||||||
// calculate edges of the shape
|
// calculate edges of the shape
|
||||||
scalex = (320.0f / (240.0f * r_viewwindow.WidescreenRatio)) * vw / 320;
|
scalex = (320.0f / (240.0f * r_viewwindow.WidescreenRatio)) * vw / 320;
|
||||||
|
|
||||||
tx = sx - (160 - r.left);
|
tx = (psp->Flags & PSPF_MIRROR) ? ((160 - r.width) - (sx + r.left)) : (sx - (160 - r.left));
|
||||||
x1 = tx * scalex + vw/2;
|
x1 = tx * scalex + vw/2;
|
||||||
if (x1 > vw) return; // off the right side
|
if (x1 > vw) return; // off the right side
|
||||||
x1 += viewwindowx;
|
x1 += viewwindowx;
|
||||||
|
@ -107,6 +107,13 @@ void GLSceneDrawer::DrawPSprite (player_t * player,DPSprite *psp, float sx, floa
|
||||||
x2 = tx * scalex + vw / 2;
|
x2 = tx * scalex + vw / 2;
|
||||||
if (x2 < 0) return; // off the left side
|
if (x2 < 0) return; // off the left side
|
||||||
x2 += viewwindowx;
|
x2 += viewwindowx;
|
||||||
|
/*
|
||||||
|
if (psp->Flags & PSPF_MIRROR)
|
||||||
|
{
|
||||||
|
float dist = 320.f - sx;
|
||||||
|
x1 += dist * scalex;
|
||||||
|
x2 += dist * scalex;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// killough 12/98: fix psprite positioning problem
|
// killough 12/98: fix psprite positioning problem
|
||||||
|
@ -130,7 +137,8 @@ void GLSceneDrawer::DrawPSprite (player_t * player,DPSprite *psp, float sx, floa
|
||||||
y1 = viewwindowy + vh / 2 - (ftexturemid * scale);
|
y1 = viewwindowy + vh / 2 - (ftexturemid * scale);
|
||||||
y2 = y1 + (r.height * scale) + 1;
|
y2 = y1 + (r.height * scale) + 1;
|
||||||
|
|
||||||
if (!(mirror) != !(psp->Flags & PSPF_FLIP))
|
|
||||||
|
if (!(mirror) != !(psp->Flags & (PSPF_FLIP|PSPF_MIRROR)))
|
||||||
{
|
{
|
||||||
fU2 = tex->GetSpriteUL();
|
fU2 = tex->GetSpriteUL();
|
||||||
fV1 = tex->GetSpriteVT();
|
fV1 = tex->GetSpriteVT();
|
||||||
|
|
|
@ -141,6 +141,7 @@ DEFINE_FIELD_BIT(DPSprite, Flags, bAddBob, PSPF_ADDBOB)
|
||||||
DEFINE_FIELD_BIT(DPSprite, Flags, bPowDouble, PSPF_POWDOUBLE)
|
DEFINE_FIELD_BIT(DPSprite, Flags, bPowDouble, PSPF_POWDOUBLE)
|
||||||
DEFINE_FIELD_BIT(DPSprite, Flags, bCVarFast, PSPF_CVARFAST)
|
DEFINE_FIELD_BIT(DPSprite, Flags, bCVarFast, PSPF_CVARFAST)
|
||||||
DEFINE_FIELD_BIT(DPSprite, Flags, bFlip, PSPF_FLIP)
|
DEFINE_FIELD_BIT(DPSprite, Flags, bFlip, PSPF_FLIP)
|
||||||
|
DEFINE_FIELD_BIT(DPSprite, Flags, bMirror, PSPF_MIRROR)
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
@ -68,6 +68,7 @@ enum PSPFlags
|
||||||
PSPF_FLIP = 1 << 6,
|
PSPF_FLIP = 1 << 6,
|
||||||
PSPF_FORCEALPHA = 1 << 7,
|
PSPF_FORCEALPHA = 1 << 7,
|
||||||
PSPF_FORCESTYLE = 1 << 8,
|
PSPF_FORCESTYLE = 1 << 8,
|
||||||
|
PSPF_MIRROR = 1 << 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DPSprite : public DObject
|
class DPSprite : public DObject
|
||||||
|
|
|
@ -726,6 +726,7 @@ enum EPSpriteFlags
|
||||||
PSPF_FLIP = 1 << 6,
|
PSPF_FLIP = 1 << 6,
|
||||||
PSPF_FORCEALPHA = 1 << 7,
|
PSPF_FORCEALPHA = 1 << 7,
|
||||||
PSPF_FORCESTYLE = 1 << 8,
|
PSPF_FORCESTYLE = 1 << 8,
|
||||||
|
PSPF_MIRROR = 1 << 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Default psprite layers
|
// Default psprite layers
|
||||||
|
|
Loading…
Reference in a new issue