Skip to content

Commit

Permalink
Added (SPF_)STRETCHPIXELS.
Browse files Browse the repository at this point in the history
This counteracts the squaring implied by rolling sprites.
  • Loading branch information
MajorCooke authored and madame-rachelle committed Oct 14, 2024
1 parent 3e33e31 commit fa46707
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/playsim/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,8 @@ enum ActorRenderFlag2
RF2_CAMFOLLOWSPLAYER = 0x0040, // Matches the cam's base position and angles to the main viewpoint.
RF2_NOMIPMAP = 0x0080, // [Nash] forces no mipmapping on sprites. Useful for tiny sprites that need to remain visually crisp
RF2_ISOMETRICSPRITES = 0x0100,
RF2_SQUAREPIXELS = 0x0200, // apply +ROLLSPRITE scaling math so that non rolling sprites get the same scaling
RF2_SQUAREPIXELS = 0x0200, // apply +ROLLSPRITE scaling math so that non rolling sprites get the same scaling
RF2_STRETCHPIXELS = 0x0400, // don't apply SQUAREPIXELS for ROLLSPRITES
};

// This translucency value produces the closest match to Heretic's TINTTAB.
Expand Down
1 change: 1 addition & 0 deletions src/playsim/p_effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ enum EParticleFlags
SPF_NOFACECAMERA = 1 << 12,
SPF_ROLLCENTER = 1 << 13,
SPF_NOMIPMAP = 1 << 14,
SPF_STRETCHPIXELS = 1 << 15,
};

class DVisualThinker;
Expand Down
4 changes: 2 additions & 2 deletions src/rendering/hwrenderer/scene/hw_sprites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t

r.Scale(sprscale.X, isSpriteShadow ? sprscale.Y * 0.15 * thing->isoscaleY : sprscale.Y * thing->isoscaleY);

if ((thing->renderflags & RF_ROLLSPRITE) || (thing->renderflags2 & RF2_SQUAREPIXELS))
if (((thing->renderflags & RF_ROLLSPRITE) || (thing->renderflags2 & RF2_SQUAREPIXELS)) && !(thing->renderflags2 & RF2_STRETCHPIXELS))
{
double ps = di->Level->pixelstretch;
double mult = 1.0 / sqrt(ps); // shrink slightly
Expand Down Expand Up @@ -1621,7 +1621,7 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t
auto r = spi.GetSpriteRect();
r.Scale(spr->Scale.X, spr->Scale.Y);

if (spr->PT.flags & SPF_ROLL)
if ((spr->PT.flags & SPF_ROLL) && !(spr->PT.flags & SPF_STRETCHPIXELS))
{
double ps = di->Level->pixelstretch;
double mult = 1.0 / sqrt(ps); // shrink slightly
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/constants.zs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ enum EParticleFlags
SPF_NOFACECAMERA = 1 << 12,
SPF_ROLLCENTER = 1 << 13,
SPF_NOMIPMAP = 1 << 14,
SPF_STRETCHPIXELS = 1 << 15,

SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG
};
Expand Down

0 comments on commit fa46707

Please sign in to comment.