From c59e4f8a10b139d5d8c9dfa77e4bf2dd3216ce76 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 22 Aug 2022 18:17:39 +0200 Subject: [PATCH] - floatified sprext.position_offset --- source/core/maphack.cpp | 6 +++--- source/core/maptypes.h | 3 ++- source/core/rendering/scene/hw_sprites.cpp | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/source/core/maphack.cpp b/source/core/maphack.cpp index 907a59a58..5288976e6 100644 --- a/source/core/maphack.cpp +++ b/source/core/maphack.cpp @@ -297,17 +297,17 @@ static int32_t LoadMapHack(const char *filename, SpawnSpriteDef& sprites) else if (sc.Compare("mdposxoff") || sc.Compare("mdpositionxoff")) { if (sc.CheckNumber() && validateSprite()) - sprites.sprext[currentsprite].position_offset.X = sc.Number; + sprites.sprext[currentsprite].position_offset.X = sc.Number * maptoworld; } else if (sc.Compare("mdposyoff") || sc.Compare("mdpositionyoff")) { if (sc.CheckNumber() && validateSprite()) - sprites.sprext[currentsprite].position_offset.X = sc.Number; + sprites.sprext[currentsprite].position_offset.X = sc.Number * maptoworld; } else if (sc.Compare("mdposzoff") || sc.Compare("mdpositionzoff")) { if (sc.CheckNumber() && validateSprite()) - sprites.sprext[currentsprite].position_offset.X = sc.Number; + sprites.sprext[currentsprite].position_offset.X = sc.Number * zmaptoworld; } else if (sc.Compare("away1")) { diff --git a/source/core/maptypes.h b/source/core/maptypes.h index 4d7bf2988..b21c3e665 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -723,7 +723,8 @@ struct spriteext_t uint32_t mdanimtims; int16_t mdanimcur; int16_t angoff, pitch, roll; - vec3_t pivot_offset, position_offset; + vec3_t pivot_offset; + DVector3 position_offset; uint8_t renderflags; float alpha; }; diff --git a/source/core/rendering/scene/hw_sprites.cpp b/source/core/rendering/scene/hw_sprites.cpp index 1fee61385..5f1a905dc 100644 --- a/source/core/rendering/scene/hw_sprites.cpp +++ b/source/core/rendering/scene/hw_sprites.cpp @@ -504,13 +504,13 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, tspritetype* spr, s scalevec.Z *= sprzscale; translatevec.Z *= sprzscale; - float zpos = (float)(spr->int_pos().Z + ownerActor->sprext.position_offset.Z); - float zscale = ((spr->cstat & CSTAT_SPRITE_YFLIP) && (spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -4.f : 4.f; + float zpos = (float)(spr->pos.Z + ownerActor->sprext.position_offset.Z); + float zscale = ((spr->cstat & CSTAT_SPRITE_YFLIP) && (spr->ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != 0) ? -1.f/64.f : 1.f/64.f; zpos -= (spr->yoffset * spr->yrepeat) * zscale * voxel->bscale; - x = (spr->int_pos().X + ownerActor->sprext.position_offset.X) * (1 / 16.f); - z = zpos * (1 / -256.f); - y = (spr->int_pos().Y + ownerActor->sprext.position_offset.Y) * (1 / -16.f); + x = (spr->pos.X + ownerActor->sprext.position_offset.X); + z = -zpos; + y = -(spr->pos.Y + ownerActor->sprext.position_offset.Y); float zoff = voxel->siz.Z * .5f; if (!(spr->cstat & CSTAT_SPRITE_YCENTER))