Aded FLIPSPRITEOFFSET<X/Y> for actors and bFlipOffset<X/Y> for visual thinkers.

- Inverts the direction that (Sprite)Offset pushes the sprite without affecting *any* other offsets, allowing them to combine seemlessly.
This commit is contained in:
Major Cooke 2024-01-19 21:29:57 -06:00 committed by Rachael Alexanderson
commit 278ebf3202
8 changed files with 37 additions and 11 deletions

View file

@ -1206,7 +1206,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DVisualThinker, SetTranslation, SetTranslation)
static int IsFrozen(DVisualThinker * self)
{
return (self->Level->isFrozen() && !(self->PT.flags & SPF_NOTIMEFREEZE));
return !!(self->Level->isFrozen() && !(self->PT.flags & SPF_NOTIMEFREEZE));
}
bool DVisualThinker::isFrozen()
@ -1242,6 +1242,14 @@ int DVisualThinker::GetRenderStyle()
return PT.style;
}
float DVisualThinker::GetOffset(bool y) const // Needed for the renderer.
{
if (y)
return (float)(bFlipOffsetY ? Offset.Y : -Offset.Y);
else
return (float)(bFlipOffsetX ? Offset.X : -Offset.X);
}
void DVisualThinker::Serialize(FSerializer& arc)
{
Super::Serialize(arc);
@ -1264,6 +1272,8 @@ void DVisualThinker::Serialize(FSerializer& arc)
("flipy", bYFlip)
("dontinterpolate", bDontInterpolate)
("addlightlevel", bAddLightLevel)
("flipoffsetx", bFlipOffsetX)
("flipoffsetY", bFlipOffsetY)
("lightlevel", LightLevel)
("flags", PT.flags);
@ -1289,3 +1299,5 @@ DEFINE_FIELD(DVisualThinker, bXFlip);
DEFINE_FIELD(DVisualThinker, bYFlip);
DEFINE_FIELD(DVisualThinker, bDontInterpolate);
DEFINE_FIELD(DVisualThinker, bAddLightLevel);
DEFINE_FIELD(DVisualThinker, bFlipOffsetX);
DEFINE_FIELD(DVisualThinker, bFlipOffsetY);