mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-26 05:41:07 +00:00
- Added functionality to WOF_Relative. Untested until the relative code from GetWeaponRect is taken out.
- Fixed A_OverlayPivot carrying over copying of X to Y if Y is zero. This is meant to be exclusive to A_OverlayScale only. - Added WOF_ZeroY to prevent copying X to Y for A_OverlayScale when desired, mirroring A_SetScale's behavior.
This commit is contained in:
parent
4a3a5c3877
commit
f9f6e896f3
3 changed files with 25 additions and 29 deletions
|
@ -670,6 +670,7 @@ enum WOFFlags
|
||||||
WOF_ADD = 1 << 2,
|
WOF_ADD = 1 << 2,
|
||||||
WOF_INTERPOLATE = 1 << 3,
|
WOF_INTERPOLATE = 1 << 3,
|
||||||
WOF_RELATIVE = 1 << 4,
|
WOF_RELATIVE = 1 << 4,
|
||||||
|
WOF_ZEROY = 1 << 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
||||||
|
@ -680,7 +681,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
||||||
PARAM_FLOAT(wy)
|
PARAM_FLOAT(wy)
|
||||||
PARAM_INT(flags)
|
PARAM_INT(flags)
|
||||||
|
|
||||||
if (!ACTION_CALL_FROM_PSPRITE())
|
if (!ACTION_CALL_FROM_PSPRITE() || ((flags & WOF_KEEPX) && (flags & WOF_KEEPY)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DPSprite *pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));
|
DPSprite *pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));
|
||||||
|
@ -688,20 +689,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
||||||
if (pspr == nullptr)
|
if (pspr == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (flags & WOF_ADD)
|
if (!(flags & WOF_ZEROY) && wy == 0.0)
|
||||||
{
|
wy = wx;
|
||||||
|
|
||||||
if (!(flags & WOF_KEEPX))
|
if (!(flags & WOF_KEEPX))
|
||||||
pspr->scalex += wx;
|
pspr->scalex = (flags & WOF_ADD) ? pspr->scalex + wx : wx;
|
||||||
if (!(flags & WOF_KEEPY))
|
if (!(flags & WOF_KEEPY))
|
||||||
pspr->scaley += (wy != 0.0 ? wy : wx);
|
pspr->scaley = (flags & WOF_ADD) ? pspr->scaley + wy : wy;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(flags & WOF_KEEPX))
|
|
||||||
pspr->scalex = wx;
|
|
||||||
if (!(flags & WOF_KEEPY))
|
|
||||||
pspr->scaley = (wy != 0.0 ? wy : wx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(flags & WOF_INTERPOLATE))
|
if (!(flags & WOF_INTERPOLATE))
|
||||||
{
|
{
|
||||||
|
@ -755,7 +749,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayPivot)
|
||||||
PARAM_FLOAT(wy)
|
PARAM_FLOAT(wy)
|
||||||
PARAM_INT(flags)
|
PARAM_INT(flags)
|
||||||
|
|
||||||
if (!ACTION_CALL_FROM_PSPRITE())
|
if (!ACTION_CALL_FROM_PSPRITE() || ((flags & WOF_KEEPX) && (flags & WOF_KEEPY)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DPSprite *pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));
|
DPSprite *pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));
|
||||||
|
@ -763,20 +757,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayPivot)
|
||||||
if (pspr == nullptr)
|
if (pspr == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (flags & WOF_ADD)
|
if (flags & WOF_RELATIVE)
|
||||||
{
|
{
|
||||||
if (!(flags & WOF_KEEPX))
|
DAngle rot = pspr->rotation;
|
||||||
pspr->px += wx;
|
double c = rot.Cos(), s = rot.Sin();
|
||||||
if (!(flags & WOF_KEEPY))
|
double nx = wx * c + wy * s;
|
||||||
pspr->py += (wy != 0.0 ? wy : wx);
|
double ny = wx * s - wy * c;
|
||||||
|
wx = nx; wy = ny;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(flags & WOF_KEEPX))
|
if (!(flags & WOF_KEEPX))
|
||||||
pspr->px = wx;
|
pspr->px = (flags & WOF_ADD) ? pspr->px + wx : wx;
|
||||||
if (!(flags & WOF_KEEPY))
|
if (!(flags & WOF_KEEPY))
|
||||||
pspr->py = (wy != 0.0 ? wy : wx);
|
pspr->py = (flags & WOF_ADD) ? pspr->py + wy : wy;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(flags & WOF_INTERPOLATE))
|
if (!(flags & WOF_INTERPOLATE))
|
||||||
{
|
{
|
||||||
|
|
|
@ -489,7 +489,9 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
||||||
// Big thanks to IvanDobrovski who helped me modify this.
|
// Big thanks to IvanDobrovski who helped me modify this.
|
||||||
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.);
|
FAngle rot = (float)psp->rotation;
|
||||||
|
rot.Normalized360();
|
||||||
|
float radang = rot.Radians();
|
||||||
float cosang = cos(radang);
|
float cosang = cos(radang);
|
||||||
float sinang = sin(radang);
|
float sinang = sin(radang);
|
||||||
|
|
||||||
|
|
|
@ -695,6 +695,7 @@ enum EWeaponOffsetFlags
|
||||||
WOF_ADD = 1 << 2,
|
WOF_ADD = 1 << 2,
|
||||||
WOF_INTERPOLATE = 1 << 3,
|
WOF_INTERPOLATE = 1 << 3,
|
||||||
WOF_RELATIVE = 1 << 4,
|
WOF_RELATIVE = 1 << 4,
|
||||||
|
WOF_ZEROY = 1 << 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for psprite layers
|
// Flags for psprite layers
|
||||||
|
|
Loading…
Reference in a new issue