- wrap repeats in the renderer.

This commit is contained in:
Christoph Oelckers 2022-10-06 00:12:23 +02:00
parent cf5d787f40
commit c678298141
4 changed files with 12 additions and 10 deletions

View file

@ -675,7 +675,7 @@ void BunchDrawer::ProcessSection(int sectionnum, bool portal)
CoreSectIterator it(sectnum);
while (auto actor = it.Next())
{
if ((actor->spr.cstat & CSTAT_SPRITE_INVISIBLE) || actor->spr.xrepeat == 0 || actor->spr.yrepeat == 0) // skip invisible sprites
if ((actor->spr.cstat & CSTAT_SPRITE_INVISIBLE) || actor->spr.ScaleX() == 0 || actor->spr.ScaleY() == 0) // skip invisible sprites
continue;
auto viewvec = actor->spr.pos.XY() - DVector2(viewx, -viewy); // note that viewy is in render coordinates

View file

@ -278,7 +278,7 @@ void HWDrawInfo::DispatchSprites()
int tilenum = tspr->picnum;
auto actor = tspr->ownerActor;
if (actor == nullptr || tspr->xrepeat == 0 || tspr->yrepeat == 0 || (unsigned)tilenum >= MAXTILES)
if (actor == nullptr || tspr->ScaleX() == 0 || tspr->ScaleY() == 0 || (unsigned)tilenum >= MAXTILES)
continue;
actor->spr.cstat2 |= CSTAT2_SPRITE_MAPPED;

View file

@ -371,12 +371,14 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int
}
// convert to render space.
float width = (xsize * spr->xrepeat) * (0.2f / 16.f); // weird Build fuckery. Face sprites are rendered at 80% width only.
float height = (ysize * spr->yrepeat) * (0.25f / 16.f);
float xoff = (tilexoff * spr->xrepeat) * (0.2f / 16.f);
float yoff = (tileyoff * spr->yrepeat) * (0.25f / 16.f);
float sx = (float)spr->ScaleX() * 0.8f; // weird Build fuckery. Face sprites are rendered at 80% width only.
float sy = (float)spr->ScaleY();
float width = xsize * sx;
float height = ysize * sy;
float xoff = tilexoff * sx;
float yoff = tileyoff * sy;
if (xsize & 1) xoff -= spr->xrepeat * (0.1f / 16.f); // Odd xspans (taken from polymost as-is)
if (xsize & 1) xoff -= sx * 0.5; // Odd xspans (taken from polymost as-is)
if (spr->cstat & CSTAT_SPRITE_YCENTER)
{
@ -477,7 +479,7 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, tspritetype* spr, s
FVector3 translatevec = { 0, 0, voxel->zadd * voxel->scale };
float basescale = voxel->bscale / 64.f;
float sprxscale = (float)spr->xrepeat * (256.f / 320.f) * basescale;
float sprxscale = (float)spr->ScaleX() * (256.f / 5) * basescale;
if ((spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_WALL)
{
sprxscale *= 1.25f;

View file

@ -1104,10 +1104,10 @@ int HWWall::CheckWallSprite(tspritetype* spr, tspritetype* last)
if (spr->pos.XY() != last->pos.XY() || spr->sectp != last->sectp || spr->angle != last->angle) return 3;
// if the horizontal orientation changes we need to recalculate the walls this attaches to, but not the positioning.
if (spr->xrepeat != last->xrepeat || spr->xoffset != last->xoffset || spr->picnum != last->picnum || ((spr->cstat ^ last->cstat) & CSTAT_SPRITE_XFLIP)) return 2;
if (spr->ScaleX() != last->ScaleX() || spr->xoffset != last->xoffset || spr->picnum != last->picnum || ((spr->cstat ^ last->cstat) & CSTAT_SPRITE_XFLIP)) return 2;
// only y-positioning changed - we need to re-check the wall tiers this sprite attaches to
if(spr->yrepeat != last->yrepeat || spr->yoffset != last->yoffset || ((spr->cstat ^ last->cstat) & (CSTAT_SPRITE_YFLIP|CSTAT_SPRITE_YCENTER))) return 1;
if(spr->ScaleY() != last->ScaleY() || spr->yoffset != last->yoffset || ((spr->cstat ^ last->cstat) & (CSTAT_SPRITE_YFLIP | CSTAT_SPRITE_YCENTER))) return 1;
// all remaining properties only affect the render style which is not relevant for positioning a wall sprite
return 0;