- floatified sprext.position_offset

This commit is contained in:
Christoph Oelckers 2022-08-22 18:17:39 +02:00
parent 2954603573
commit c59e4f8a10
3 changed files with 10 additions and 9 deletions

View file

@ -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"))
{

View file

@ -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;
};

View file

@ -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))