- make roll and flat sprites square

This commit is contained in:
Rachael Alexanderson 2024-05-03 14:32:20 -04:00
parent bcad040fd3
commit 7ef6fa97a7
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0

View file

@ -355,11 +355,7 @@ void HandleSpriteOffsets(Matrix3x4 *mat, const FRotator *HW, FVector2 *offset, b
bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp) bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
{ {
float pixelstretch = 1.2; float pixelstretch = di->Level->pixelstretch;
if (actor && actor->Level)
pixelstretch = actor->Level->pixelstretch;
else if (particle && particle->subsector && particle->subsector->sector && particle->subsector->sector->Level)
pixelstretch = particle->subsector->sector->Level->pixelstretch;
FVector3 center = FVector3((x1 + x2) * 0.5, (y1 + y2) * 0.5, (z1 + z2) * 0.5); FVector3 center = FVector3((x1 + x2) * 0.5, (y1 + y2) * 0.5, (z1 + z2) * 0.5);
const auto& HWAngles = di->Viewpoint.HWAngles; const auto& HWAngles = di->Viewpoint.HWAngles;
@ -1005,6 +1001,13 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
r.Scale(sprscale.X, isSpriteShadow ? sprscale.Y * 0.15 : sprscale.Y); r.Scale(sprscale.X, isSpriteShadow ? sprscale.Y * 0.15 : sprscale.Y);
if (thing->renderflags & (RF_ROLLSPRITE|RF_FLATSPRITE))
{
double ps = di->Level->pixelstretch;
double mult = 2 * ps / (ps * ps + 1); // shrink slightly
r.Scale(mult * ps, mult);
}
float rightfac = -r.left; float rightfac = -r.left;
float leftfac = rightfac - r.width; float leftfac = rightfac - r.width;
z1 = z - r.top; z1 = z - r.top;
@ -1521,6 +1524,13 @@ void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t
auto r = spi.GetSpriteRect(); auto r = spi.GetSpriteRect();
r.Scale(spr->Scale.X, spr->Scale.Y); r.Scale(spr->Scale.X, spr->Scale.Y);
if (spr->PT.flags & SPF_ROLL)
{
double ps = di->Level->pixelstretch;
double mult = 2 * ps / (ps * ps + 1); // shrink slightly
r.Scale(mult * ps, mult);
}
if (spr->bXFlip) if (spr->bXFlip)
{ {
std::swap(ul,ur); std::swap(ul,ur);