From fa467073ebea5702d97ed60abaa7e3fd7c3b51e5 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Mon, 14 Oct 2024 14:15:30 -0500 Subject: [PATCH] Added (SPF_)STRETCHPIXELS. This counteracts the squaring implied by rolling sprites. --- src/playsim/actor.h | 3 ++- src/playsim/p_effect.h | 1 + src/rendering/hwrenderer/scene/hw_sprites.cpp | 4 ++-- wadsrc/static/zscript/constants.zs | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index eba4011a2e..708e06f4c6 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -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. diff --git a/src/playsim/p_effect.h b/src/playsim/p_effect.h index 5eafdcd4bb..4884739f2b 100644 --- a/src/playsim/p_effect.h +++ b/src/playsim/p_effect.h @@ -70,6 +70,7 @@ enum EParticleFlags SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, SPF_NOMIPMAP = 1 << 14, + SPF_STRETCHPIXELS = 1 << 15, }; class DVisualThinker; diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index 61c120f31e..91125b7504 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -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 @@ -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 diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index 3650d8b5c1..2e5ce524a4 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -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 };