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:
Major Cooke 2020-09-30 15:38:58 -05:00 committed by Christoph Oelckers
parent 8f74cebd44
commit 4a3a5c3877
5 changed files with 9 additions and 12 deletions

View File

@ -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, bPivotPercent, PSPF_PIVOTPERCENT)
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),
oldrotation(.0),
PivotPercent(true),
PivotScreen(false),
PivotOffsetRel(false)
PivotScreen(false)
{
alpha = 1;
Renderstyle = STYLE_Normal;
@ -671,6 +669,7 @@ enum WOFFlags
WOF_KEEPY = 1 << 1,
WOF_ADD = 1 << 2,
WOF_INTERPOLATE = 1 << 3,
WOF_RELATIVE = 1 << 4,
};
DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)

View File

@ -73,7 +73,6 @@ enum PSPFlags
PSPF_PLAYERTRANSLATED = 1 << 10,
PSPF_PIVOTPERCENT = 1 << 11,
PSPF_PIVOTSCREEN = 1 << 12,
PSPF_PIVOTOFFSETREL = 1 << 13,
};
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 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 oldpx, oldpy;
double rotation; // How much rotation to apply.

View File

@ -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)
{
float radang = psp->rotation * (pi::pi() / 180.);
float cosang = -cos(radang);
float sinang = -sin(radang);
float cosang = cos(radang);
float sinang = sin(radang);
float xcenter, ycenter;
@ -535,16 +535,16 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
float ssy = (float)psp->scaley;
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 yy2 = ycenter + ssy * (x1 * sinang - y2 * cosang);
float yy2 = ycenter - ssy * (x1 * sinang - y2 * cosang);
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 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[1].Set(xx2, yy2, 0, u1, v2);

View File

@ -2580,7 +2580,6 @@ class PSprite : Object native play
native bool bPlayerTranslated;
native bool bPivotPercent;
native bool bPivotScreen;
native bool bPivotOffsetRel;
native void SetState(State newstate, bool pending = false);

View File

@ -694,6 +694,7 @@ enum EWeaponOffsetFlags
WOF_KEEPY = 1 << 1,
WOF_ADD = 1 << 2,
WOF_INTERPOLATE = 1 << 3,
WOF_RELATIVE = 1 << 4,
};
// Flags for psprite layers