Skip to content

Add flags that bake 3D offsets into a sprite

Cheariisan requested to merge Chearii/RingRacers:sprvisoffsets into master

This adds the flags MF2_SPRVISOFFSET and MF2_SPRVISANGLED to mobjflag2_t, taking up free spaces 1<<1 and 1<<3.

When either flag is set, the sprxoff, spryoff, and sprzoff values are aligned to the actual sprite, giving the appearance of them being "baked" into the sprite.

The offsets, in this form, are also affected by a sprite's rotation values (rollangle, pitch, and roll), allowing modders to create the visual of something "attached" to the object without needing to manually set offsets.

MF2_SPRVISANGLED is largely the same as MF2_SPRVISOFFSET, but angles the baked 3D offsets to the actual object's angle in 3D space, making attachment visuals far easier.

This may seem redundant with the existing spritexoffset and spriteyoffset variables, but the pseudo-3D visuals present here would not normally be possible without potentially desync-prone usage of R_PointToAngle or R_PointToAnglePlayer.

sprvisangled.webm

messyteststuff.webm

sliptidedemo.webm

Although Legacy GL is deprecated, I've implemented rudimentary support of these flags for it where necessary. Some aspects, such as vertical/horizontal flips, may not look fully correct with 3D models.

sprvisangled_legacyglmodels.webm

sliptidedemo_ogl.webm

Everything has been tested in a Windows build.

Merge request reports

Loading