mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Replaced PSPF_PIVOTOFFSETREL with WOF_RELATIVE.
The idea behind this is to outright remove the relative position adding from the engine side and let it happen with A_OverlayOffset instead. Still more work to do.
This commit is contained in:
parent
8f74cebd44
commit
4a3a5c3877
5 changed files with 9 additions and 12 deletions
|
@ -155,7 +155,6 @@ DEFINE_FIELD_BIT(DPSprite, Flags, bMirror, PSPF_MIRROR)
|
||||||
DEFINE_FIELD_BIT(DPSprite, Flags, bPlayerTranslated, PSPF_PLAYERTRANSLATED)
|
DEFINE_FIELD_BIT(DPSprite, Flags, bPlayerTranslated, PSPF_PLAYERTRANSLATED)
|
||||||
DEFINE_FIELD_BIT(DPSprite, Flags, bPivotPercent, PSPF_PIVOTPERCENT)
|
DEFINE_FIELD_BIT(DPSprite, Flags, bPivotPercent, PSPF_PIVOTPERCENT)
|
||||||
DEFINE_FIELD_BIT(DPSprite, Flags, bPivotScreen, PSPF_PIVOTSCREEN)
|
DEFINE_FIELD_BIT(DPSprite, Flags, bPivotScreen, PSPF_PIVOTSCREEN)
|
||||||
DEFINE_FIELD_BIT(DPSprite, Flags, bPivotOffsetRel, PSPF_PIVOTOFFSETREL)
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -184,8 +183,7 @@ DPSprite::DPSprite(player_t *owner, AActor *caller, int id)
|
||||||
oldpx(.0), oldpy(.0),
|
oldpx(.0), oldpy(.0),
|
||||||
oldrotation(.0),
|
oldrotation(.0),
|
||||||
PivotPercent(true),
|
PivotPercent(true),
|
||||||
PivotScreen(false),
|
PivotScreen(false)
|
||||||
PivotOffsetRel(false)
|
|
||||||
{
|
{
|
||||||
alpha = 1;
|
alpha = 1;
|
||||||
Renderstyle = STYLE_Normal;
|
Renderstyle = STYLE_Normal;
|
||||||
|
@ -671,6 +669,7 @@ enum WOFFlags
|
||||||
WOF_KEEPY = 1 << 1,
|
WOF_KEEPY = 1 << 1,
|
||||||
WOF_ADD = 1 << 2,
|
WOF_ADD = 1 << 2,
|
||||||
WOF_INTERPOLATE = 1 << 3,
|
WOF_INTERPOLATE = 1 << 3,
|
||||||
|
WOF_RELATIVE = 1 << 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
||||||
|
|
|
@ -73,7 +73,6 @@ enum PSPFlags
|
||||||
PSPF_PLAYERTRANSLATED = 1 << 10,
|
PSPF_PLAYERTRANSLATED = 1 << 10,
|
||||||
PSPF_PIVOTPERCENT = 1 << 11,
|
PSPF_PIVOTPERCENT = 1 << 11,
|
||||||
PSPF_PIVOTSCREEN = 1 << 12,
|
PSPF_PIVOTSCREEN = 1 << 12,
|
||||||
PSPF_PIVOTOFFSETREL = 1 << 13,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DPSprite : public DObject
|
class DPSprite : public DObject
|
||||||
|
@ -102,7 +101,6 @@ public:
|
||||||
|
|
||||||
bool PivotScreen; // If true, the pivot is based on the entire screen width/height instead of the image's dimensions/position.
|
bool PivotScreen; // If true, the pivot is based on the entire screen width/height instead of the image's dimensions/position.
|
||||||
bool PivotPercent; // If true, the pivot goes between [0.0, 1.0]. Otherwise, it's a pixel position offset from the image size.
|
bool PivotPercent; // If true, the pivot goes between [0.0, 1.0]. Otherwise, it's a pixel position offset from the image size.
|
||||||
bool PivotOffsetRel; // If true, x & y are relative to rotation. Otherwise, x is left/right and y is up/down.
|
|
||||||
double px, py; // pivot points
|
double px, py; // pivot points
|
||||||
double oldpx, oldpy;
|
double oldpx, oldpy;
|
||||||
double rotation; // How much rotation to apply.
|
double rotation; // How much rotation to apply.
|
||||||
|
|
|
@ -490,8 +490,8 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
||||||
if (psp->rotation != 0.0 || psp->scalex != 1.0 || psp->scaley != 1.0)
|
if (psp->rotation != 0.0 || psp->scalex != 1.0 || psp->scaley != 1.0)
|
||||||
{
|
{
|
||||||
float radang = psp->rotation * (pi::pi() / 180.);
|
float radang = psp->rotation * (pi::pi() / 180.);
|
||||||
float cosang = -cos(radang);
|
float cosang = cos(radang);
|
||||||
float sinang = -sin(radang);
|
float sinang = sin(radang);
|
||||||
|
|
||||||
float xcenter, ycenter;
|
float xcenter, ycenter;
|
||||||
|
|
||||||
|
@ -535,16 +535,16 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
||||||
float ssy = (float)psp->scaley;
|
float ssy = (float)psp->scaley;
|
||||||
|
|
||||||
float xx1 = xcenter + ssx * (x1 * cosang + y1 * sinang);
|
float xx1 = xcenter + ssx * (x1 * cosang + y1 * sinang);
|
||||||
float yy1 = ycenter + ssy * (x1 * sinang - y1 * cosang);
|
float yy1 = ycenter - ssy * (x1 * sinang - y1 * cosang);
|
||||||
|
|
||||||
float xx2 = xcenter + ssx * (x1 * cosang + y2 * sinang);
|
float xx2 = xcenter + ssx * (x1 * cosang + y2 * sinang);
|
||||||
float yy2 = ycenter + ssy * (x1 * sinang - y2 * cosang);
|
float yy2 = ycenter - ssy * (x1 * sinang - y2 * cosang);
|
||||||
|
|
||||||
float xx3 = xcenter + ssx * (x2 * cosang + y1 * sinang);
|
float xx3 = xcenter + ssx * (x2 * cosang + y1 * sinang);
|
||||||
float yy3 = ycenter + ssy * (x2 * sinang - y1 * cosang);
|
float yy3 = ycenter - ssy * (x2 * sinang - y1 * cosang);
|
||||||
|
|
||||||
float xx4 = xcenter + ssx * (x2 * cosang + y2 * sinang);
|
float xx4 = xcenter + ssx * (x2 * cosang + y2 * sinang);
|
||||||
float yy4 = ycenter + ssy * (x2 * sinang - y2 * cosang);
|
float yy4 = ycenter - ssy * (x2 * sinang - y2 * cosang);
|
||||||
|
|
||||||
verts.first[0].Set(xx1, yy1, 0, u1, v1);
|
verts.first[0].Set(xx1, yy1, 0, u1, v1);
|
||||||
verts.first[1].Set(xx2, yy2, 0, u1, v2);
|
verts.first[1].Set(xx2, yy2, 0, u1, v2);
|
||||||
|
|
|
@ -2580,7 +2580,6 @@ class PSprite : Object native play
|
||||||
native bool bPlayerTranslated;
|
native bool bPlayerTranslated;
|
||||||
native bool bPivotPercent;
|
native bool bPivotPercent;
|
||||||
native bool bPivotScreen;
|
native bool bPivotScreen;
|
||||||
native bool bPivotOffsetRel;
|
|
||||||
|
|
||||||
native void SetState(State newstate, bool pending = false);
|
native void SetState(State newstate, bool pending = false);
|
||||||
|
|
||||||
|
|
|
@ -694,6 +694,7 @@ enum EWeaponOffsetFlags
|
||||||
WOF_KEEPY = 1 << 1,
|
WOF_KEEPY = 1 << 1,
|
||||||
WOF_ADD = 1 << 2,
|
WOF_ADD = 1 << 2,
|
||||||
WOF_INTERPOLATE = 1 << 3,
|
WOF_INTERPOLATE = 1 << 3,
|
||||||
|
WOF_RELATIVE = 1 << 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for psprite layers
|
// Flags for psprite layers
|
||||||
|
|
Loading…
Reference in a new issue