From d1c23d1ad029a3897580b8000457a7bf184c0890 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 27 Mar 2021 14:18:33 +0100 Subject: [PATCH] - fixed wall sprite rendering. --- source/core/gamefuncs.cpp | 8 ++++---- source/core/rendering/scene/hw_drawinfo.cpp | 7 +++---- source/core/rendering/scene/hw_walls.cpp | 7 ++++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 43bb4571d..98fe3baf6 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -215,13 +215,13 @@ void GetWallSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool int width, leftofs; if (render && hw_hightile && TileFiles.tiledata[spr->picnum].h_xsize) { - width = TileFiles.tiledata[spr->picnum].h_xsize * spr->xrepeat; - leftofs = (TileFiles.tiledata[spr->picnum].h_xoffs + spr->xoffset) * spr->xrepeat; + width = TileFiles.tiledata[spr->picnum].h_xsize; + leftofs = (TileFiles.tiledata[spr->picnum].h_xoffs + spr->xoffset); } else { - width = tex->GetTexelWidth() * spr->xrepeat; - leftofs = (tex->GetTexelLeftOffset() + spr->xoffset) * spr->xrepeat; + width = tex->GetTexelWidth(); + leftofs = (tex->GetTexelLeftOffset() + spr->xoffset); } int x = bsin(spr->ang) * spr->xrepeat; diff --git a/source/core/rendering/scene/hw_drawinfo.cpp b/source/core/rendering/scene/hw_drawinfo.cpp index 48119969c..52e64171e 100644 --- a/source/core/rendering/scene/hw_drawinfo.cpp +++ b/source/core/rendering/scene/hw_drawinfo.cpp @@ -283,10 +283,6 @@ void HWDrawInfo::DispatchSprites() setgotpic(tilenum); - if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_SLAB) - tileUpdatePicnum(&tilenum, spritenum + 32768, 0); - - while (!(spriteext[spritenum].flags & SPREXT_NOTMD)) { int pt = Ptile2tile(tspr->picnum, tspr->pal); @@ -326,6 +322,9 @@ void HWDrawInfo::DispatchSprites() tspr->pos.y -= bsin(tspr->ang, -13); } + tileUpdatePicnum(&tilenum, sprite->owner + 32768, 0); + tspr->picnum = tilenum; + switch (tspr->cstat & CSTAT_SPRITE_ALIGNMENT) { case CSTAT_SPRITE_ALIGNMENT_FACING: diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 88b04f5e1..34f0e513c 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -1128,10 +1128,10 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect glseg.y2 = pos[1].y * (1 / -16.f); tcs[LOLFT].u = tcs[UPLFT].u = (spr->cstat & CSTAT_SPRITE_XFLIP) ? 1.f : 0.f; tcs[LORGT].u = tcs[UPRGT].u = (spr->cstat & CSTAT_SPRITE_XFLIP) ? 0.f : 1.f; - tcs[UPLFT].v = tcs[UPRGT].u = (spr->cstat & CSTAT_SPRITE_YFLIP) ? 0.f : 1.f; - tcs[LOLFT].v = tcs[LORGT].u = (spr->cstat & CSTAT_SPRITE_YFLIP) ? 0.f : 1.f; - ztop[0] = ztop[1] = (sprz - height) * (1 / -256.); + tcs[UPLFT].v = tcs[UPRGT].v = (spr->cstat & CSTAT_SPRITE_YFLIP) ? 1.f : 0.f; + tcs[LOLFT].v = tcs[LORGT].v = (spr->cstat & CSTAT_SPRITE_YFLIP) ? 0.f : 1.f; zbottom[0] = zbottom[1] = (sprz) * (1 / -256.); + ztop[0] = ztop[1] = (sprz - ((height * spr->yrepeat) << 2)) * (1 / -256.); // Clip sprites to ceilings/floors @@ -1157,4 +1157,5 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect zbottom[0] = zbottom[1] = floorz; } } + PutWall(di, trans); } \ No newline at end of file