mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +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_INTERPOLATE = 1 << 3,
|
||||
WOF_RELATIVE = 1 << 4,
|
||||
WOF_ZEROY = 1 << 5,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
||||
|
@ -680,7 +681,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
|||
PARAM_FLOAT(wy)
|
||||
PARAM_INT(flags)
|
||||
|
||||
if (!ACTION_CALL_FROM_PSPRITE())
|
||||
if (!ACTION_CALL_FROM_PSPRITE() || ((flags & WOF_KEEPX) && (flags & WOF_KEEPY)))
|
||||
return 0;
|
||||
|
||||
DPSprite *pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));
|
||||
|
@ -688,20 +689,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayScale)
|
|||
if (pspr == nullptr)
|
||||
return 0;
|
||||
|
||||
if (flags & WOF_ADD)
|
||||
{
|
||||
if (!(flags & WOF_KEEPX))
|
||||
pspr->scalex += wx;
|
||||
if (!(flags & WOF_KEEPY))
|
||||
pspr->scaley += (wy != 0.0 ? wy : wx);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(flags & WOF_KEEPX))
|
||||
pspr->scalex = wx;
|
||||
if (!(flags & WOF_KEEPY))
|
||||
pspr->scaley = (wy != 0.0 ? wy : wx);
|
||||
}
|
||||
if (!(flags & WOF_ZEROY) && wy == 0.0)
|
||||
wy = wx;
|
||||
|
||||
if (!(flags & WOF_KEEPX))
|
||||
pspr->scalex = (flags & WOF_ADD) ? pspr->scalex + wx : wx;
|
||||
if (!(flags & WOF_KEEPY))
|
||||
pspr->scaley = (flags & WOF_ADD) ? pspr->scaley + wy : wy;
|
||||
|
||||
if (!(flags & WOF_INTERPOLATE))
|
||||
{
|
||||
|
@ -755,7 +749,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayPivot)
|
|||
PARAM_FLOAT(wy)
|
||||
PARAM_INT(flags)
|
||||
|
||||
if (!ACTION_CALL_FROM_PSPRITE())
|
||||
if (!ACTION_CALL_FROM_PSPRITE() || ((flags & WOF_KEEPX) && (flags & WOF_KEEPY)))
|
||||
return 0;
|
||||
|
||||
DPSprite *pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));
|
||||
|
@ -763,21 +757,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayPivot)
|
|||
if (pspr == nullptr)
|
||||
return 0;
|
||||
|
||||
if (flags & WOF_ADD)
|
||||
if (flags & WOF_RELATIVE)
|
||||
{
|
||||
if (!(flags & WOF_KEEPX))
|
||||
pspr->px += wx;
|
||||
if (!(flags & WOF_KEEPY))
|
||||
pspr->py += (wy != 0.0 ? wy : wx);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(flags & WOF_KEEPX))
|
||||
pspr->px = wx;
|
||||
if (!(flags & WOF_KEEPY))
|
||||
pspr->py = (wy != 0.0 ? wy : wx);
|
||||
DAngle rot = pspr->rotation;
|
||||
double c = rot.Cos(), s = rot.Sin();
|
||||
double nx = wx * c + wy * s;
|
||||
double ny = wx * s - wy * c;
|
||||
wx = nx; wy = ny;
|
||||
}
|
||||
|
||||
if (!(flags & WOF_KEEPX))
|
||||
pspr->px = (flags & WOF_ADD) ? pspr->px + wx : wx;
|
||||
if (!(flags & WOF_KEEPY))
|
||||
pspr->py = (flags & WOF_ADD) ? pspr->py + wy : wy;
|
||||
|
||||
if (!(flags & WOF_INTERPOLATE))
|
||||
{
|
||||
pspr->oldpx = pspr->px;
|
||||
|
|
|
@ -489,7 +489,9 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
|||
// Big thanks to IvanDobrovski who helped me modify this.
|
||||
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 sinang = sin(radang);
|
||||
|
||||
|
|
|
@ -695,6 +695,7 @@ enum EWeaponOffsetFlags
|
|||
WOF_ADD = 1 << 2,
|
||||
WOF_INTERPOLATE = 1 << 3,
|
||||
WOF_RELATIVE = 1 << 4,
|
||||
WOF_ZEROY = 1 << 5,
|
||||
};
|
||||
|
||||
// Flags for psprite layers
|
||||
|
|
Loading…
Reference in a new issue