Sprite lean/angled roll with geometric consistency in multiplayer and mirrors. An ANGLEDROLL flag ties actor's sprite-rolling axis to physical direction instead of viewpoint. Y-Billboarding occurs about a rolled axis (unlike flatsprites which don't billboard). This makes roll consistent when viewed from all angles and in reflections. Useful for sprite-based laser beams and lean mechanics with third-person cameras and/or multiplayer mods.

This commit is contained in:
Dileep V. Reddy 2025-07-17 17:34:16 -06:00 committed by Ricardo Luís Vaz Silva
commit 19291c5e5c
7 changed files with 73 additions and 3 deletions

View file

@ -391,6 +391,7 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(RF2, SQUAREPIXELS, AActor, renderflags2),
DEFINE_FLAG(RF2, STRETCHPIXELS, AActor, renderflags2),
DEFINE_FLAG(RF2, LIGHTMULTALPHA, AActor, renderflags2),
DEFINE_FLAG(RF2, ANGLEDROLL, AActor, renderflags2),
// Bounce flags
DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags),

View file

@ -602,6 +602,16 @@ DEFINE_PROPERTY(tag, S, Actor)
defaults->SetTag(str);
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(leanroll, 0, Actor)
{
// sets the standard flags for angle-dependent roll
defaults->renderflags|=RF_ROLLSPRITE;
defaults->renderflags2|=RF2_STRETCHPIXELS|RF2_ANGLEDROLL;
}
//==========================================================================
//
//==========================================================================
@ -1023,6 +1033,15 @@ DEFINE_PROPERTY(spriteangle, F, Actor)
defaults->SpriteAngle = DAngle::fromDeg(i);
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(angledrolloffset, F, Actor)
{
PROP_DOUBLE_PARM(i, 0);
defaults->AngledRollOffset = DAngle::fromDeg(i);
}
//==========================================================================
//
//==========================================================================

View file

@ -1951,6 +1951,7 @@ DEFINE_FIELD(AActor, WorldOffset)
DEFINE_FIELD(AActor, Prev)
DEFINE_FIELD(AActor, SpriteAngle)
DEFINE_FIELD(AActor, SpriteRotation)
DEFINE_FIELD(AActor, AngledRollOffset)
DEFINE_FIELD(AActor, VisibleStartAngle)
DEFINE_FIELD(AActor, VisibleStartPitch)
DEFINE_FIELD(AActor, VisibleEndAngle)