Fix spritexoffset not playing nice with affines
This commit is contained in:
parent
da10eb5a75
commit
532826f61d
2 changed files with 15 additions and 3 deletions
|
|
@ -1849,6 +1849,15 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
use_xoffset = spr_width - spr_offset;
|
||||
}
|
||||
|
||||
if (thing->renderflags & RF_ABSOLUTEOFFSETS)
|
||||
{
|
||||
use_xoffset = FixedDiv(interp.spritexoffset,highresscale);
|
||||
}
|
||||
else
|
||||
{
|
||||
use_xoffset += (FixedDiv(interp.spritexoffset,highresscale) * (flip ? -1 : 1));
|
||||
}
|
||||
|
||||
affine_pivotoffsetdiff.x = FIXED_TO_FLOAT(affine_pivot.x - use_xoffset);
|
||||
affine_pivotoffsetdiff.y = FIXED_TO_FLOAT(affine_pivot.y - spr_topoffset);
|
||||
|
||||
|
|
|
|||
|
|
@ -2361,6 +2361,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
if (spritexscale < 1 || spriteyscale < 1)
|
||||
return;
|
||||
|
||||
fixed_t use_sprxoff = interp.spritexoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// initialize and rotate pitch/roll vectors
|
||||
visoffs.x = 0;
|
||||
|
|
@ -2369,7 +2371,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
rotoffset.y = 0;
|
||||
|
||||
const fixed_t visoffs_xsc = (affinesprite) ? xscale : FixedDiv(FRACUNIT, mapobjectscale);
|
||||
|
||||
const fixed_t visoffymul = (vflip ? -FRACUNIT : FRACUNIT);
|
||||
|
||||
if (R_ThingIsUsingBakedOffsets(interptarg))
|
||||
|
|
@ -2449,6 +2450,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
affine_pivotoffsetdiff.x *= FIXED_TO_FLOAT(affine_scale.x);
|
||||
affine_pivotoffsetdiff.y *= FIXED_TO_FLOAT(affine_scale.y);
|
||||
|
||||
use_sprxoff = FixedMul(interp.spritexoffset, affine_scale.x);
|
||||
|
||||
spr_width = (affine_bounds.xlen * FRACUNIT);
|
||||
spr_offset = (affine_bounds.xleft * FRACUNIT) - FLOAT_TO_FIXED(affine_pivotoffsetdiff.x);
|
||||
|
||||
|
|
@ -2460,7 +2463,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
|
||||
if (thing->renderflags & RF_ABSOLUTEOFFSETS)
|
||||
{
|
||||
spr_offset = FixedDiv(interp.spritexoffset, highresscale);
|
||||
spr_offset = FixedDiv(use_sprxoff, highresscale);
|
||||
#ifdef ROTSPRITE
|
||||
spr_topoffset = thingyoffset;
|
||||
#else
|
||||
|
|
@ -2474,7 +2477,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
if ((thing->renderflags & RF_FLIPOFFSETS) && flip)
|
||||
flipoffset = -1;
|
||||
|
||||
spr_offset += FixedDiv(interp.spritexoffset, highresscale) * flipoffset;
|
||||
spr_offset += FixedDiv(use_sprxoff, highresscale) * flipoffset;
|
||||
#ifdef ROTSPRITE
|
||||
thingyoffset *= flipoffset;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue