mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 12:31:32 +00:00
Merge branch 'recap-flip-spin' into 'next'
Fix interpolation when curling up or scaling while flipped Closes #983 See merge request STJr/SRB2!1979
This commit is contained in:
commit
5dba53009e
5 changed files with 20 additions and 5 deletions
|
@ -5378,6 +5378,9 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
if (vflip)
|
if (vflip)
|
||||||
{
|
{
|
||||||
|
if (thing->scale != thing->old_scale) // Interpolate heights in reverse gravity when scaling mobjs
|
||||||
|
gz = FIXED_TO_FLOAT(interp.z + FixedMul(thing->height, FixedDiv(interp.scale, thing->scale))) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
||||||
|
else
|
||||||
gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
|
||||||
gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale);
|
gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1585,7 +1585,12 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
||||||
p.y = FIXED_TO_FLOAT(interp.y)+md2->offset;
|
p.y = FIXED_TO_FLOAT(interp.y)+md2->offset;
|
||||||
|
|
||||||
if (flip)
|
if (flip)
|
||||||
|
{
|
||||||
|
if (spr->mobj->scale != spr->mobj->old_scale) // Interpolate heights in reverse gravity when scaling mobjs
|
||||||
|
p.z = FIXED_TO_FLOAT(interp.z + FixedMul(spr->mobj->height, FixedDiv(interp.scale, spr->mobj->scale)));
|
||||||
|
else
|
||||||
p.z = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
p.z = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
p.z = FIXED_TO_FLOAT(interp.z);
|
p.z = FIXED_TO_FLOAT(interp.z);
|
||||||
|
|
||||||
|
|
|
@ -12617,7 +12617,7 @@ static boolean P_SetupNiGHTSDrone(mapthing_t *mthing, mobj_t *mobj)
|
||||||
dronemangoaldiff = max(mobjinfo[MT_NIGHTSDRONE_MAN].height - mobjinfo[MT_NIGHTSDRONE_GOAL].height, 0);
|
dronemangoaldiff = max(mobjinfo[MT_NIGHTSDRONE_MAN].height - mobjinfo[MT_NIGHTSDRONE_GOAL].height, 0);
|
||||||
|
|
||||||
if (flip && mobj->height != oldheight)
|
if (flip && mobj->height != oldheight)
|
||||||
P_MoveOrigin(mobj, mobj->x, mobj->y, mobj->z - (mobj->height - oldheight));
|
P_SetOrigin(mobj, mobj->x, mobj->y, mobj->z - (mobj->height - oldheight));
|
||||||
|
|
||||||
if (!flip)
|
if (!flip)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8717,7 +8717,10 @@ void P_MovePlayer(player_t *player)
|
||||||
player->mo->height = P_GetPlayerHeight(player);
|
player->mo->height = P_GetPlayerHeight(player);
|
||||||
|
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP && player->mo->height != oldheight) // adjust z height for reverse gravity, similar to how it's done for scaling
|
if (player->mo->eflags & MFE_VERTICALFLIP && player->mo->height != oldheight) // adjust z height for reverse gravity, similar to how it's done for scaling
|
||||||
|
{
|
||||||
player->mo->z -= player->mo->height - oldheight;
|
player->mo->z -= player->mo->height - oldheight;
|
||||||
|
player->mo->old_z -= player->mo->height - oldheight; // Snap the Z adjustment, while keeping the Z interpolation
|
||||||
|
}
|
||||||
|
|
||||||
// Crush test...
|
// Crush test...
|
||||||
if ((player->mo->ceilingz - player->mo->floorz < player->mo->height)
|
if ((player->mo->ceilingz - player->mo->floorz < player->mo->height)
|
||||||
|
|
|
@ -2114,6 +2114,10 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
// When vertical flipped, draw sprites from the top down, at least as far as offsets are concerned.
|
// When vertical flipped, draw sprites from the top down, at least as far as offsets are concerned.
|
||||||
// sprite height - sprite topoffset is the proper inverse of the vertical offset, of course.
|
// sprite height - sprite topoffset is the proper inverse of the vertical offset, of course.
|
||||||
// remember gz and gzt should be seperated by sprite height, not thing height - thing height can be shorter than the sprite itself sometimes!
|
// remember gz and gzt should be seperated by sprite height, not thing height - thing height can be shorter than the sprite itself sometimes!
|
||||||
|
|
||||||
|
if (oldthing->scale != oldthing->old_scale) // Interpolate heights in reverse gravity when scaling mobjs
|
||||||
|
gz = interp.z + FixedMul(oldthing->height, FixedDiv(interp.scale, oldthing->scale)) - FixedMul(spr_topoffset, FixedMul(spriteyscale, this_scale));
|
||||||
|
else
|
||||||
gz = interp.z + oldthing->height - FixedMul(spr_topoffset, FixedMul(spriteyscale, this_scale));
|
gz = interp.z + oldthing->height - FixedMul(spr_topoffset, FixedMul(spriteyscale, this_scale));
|
||||||
gzt = gz + FixedMul(spr_height, FixedMul(spriteyscale, this_scale));
|
gzt = gz + FixedMul(spr_height, FixedMul(spriteyscale, this_scale));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue