mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
SW: Migrate the player's RevolveAng field to Q16.16 format.
This fixes truncations of q16ang in MovePlayer. One known fixed issue is a minor micro-shaking effect, reproduced while standing on a non-moving SO (e.g., the bus in level 1). The latter is also related to the use of camq16ang. Based in idea on patch from mjr4077au.
This commit is contained in:
parent
ef85bc58c3
commit
5a0e54b63e
2 changed files with 8 additions and 7 deletions
|
@ -1185,7 +1185,8 @@ struct PLAYERstruct
|
|||
|
||||
int oldposx,oldposy,oldposz;
|
||||
int RevolveX, RevolveY;
|
||||
short RevolveDeltaAng, RevolveAng;
|
||||
short RevolveDeltaAng;
|
||||
fix16_t RevolveQ16Ang;
|
||||
|
||||
// under vars are for wading and swimming
|
||||
short PlayerSprite, PlayerUnderSprite;
|
||||
|
|
|
@ -789,7 +789,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
|
|||
|
||||
if (pp->posx > xlow && pp->posx < xhigh && pp->posy > ylow && pp->posy < yhigh)
|
||||
{
|
||||
pp->RevolveAng = fix16_to_int(pp->q16ang);
|
||||
pp->RevolveQ16Ang = pp->q16ang;
|
||||
pp->RevolveX = pp->posx;
|
||||
pp->RevolveY = pp->posy;
|
||||
pp->RevolveDeltaAng = 0;
|
||||
|
@ -1652,7 +1652,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
|||
{
|
||||
SET(pp->Flags, PF_PLAYER_RIDING);
|
||||
|
||||
pp->RevolveAng = fix16_to_int(pp->q16ang);
|
||||
pp->RevolveQ16Ang = pp->q16ang;
|
||||
pp->RevolveX = pp->posx;
|
||||
pp->RevolveY = pp->posy;
|
||||
|
||||
|
@ -1681,7 +1681,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
|||
// save the current information so when Player stops
|
||||
// moving then you
|
||||
// know where he was last
|
||||
pp->RevolveAng = fix16_to_int(pp->q16ang);
|
||||
pp->RevolveQ16Ang = pp->q16ang;
|
||||
pp->RevolveX = pp->posx;
|
||||
pp->RevolveY = pp->posy;
|
||||
|
||||
|
@ -1697,7 +1697,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
|||
pp->RevolveY += BOUND_4PIX(ny);
|
||||
|
||||
// Last known angle is now adjusted by the delta angle
|
||||
pp->RevolveAng = NORM_ANGLE(fix16_to_int(pp->q16ang) - pp->RevolveDeltaAng);
|
||||
pp->RevolveQ16Ang = NORM_Q16ANGLE(pp->q16ang - fix16_from_int(pp->RevolveDeltaAng));
|
||||
}
|
||||
|
||||
// increment Players delta angle
|
||||
|
@ -1711,9 +1711,9 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
|||
|
||||
// New angle is formed by taking last known angle and
|
||||
// adjusting by the delta angle
|
||||
pp->camq16ang += fix16_from_int(NORM_ANGLE(pp->RevolveAng + pp->RevolveDeltaAng)) - pp->q16ang;
|
||||
pp->camq16ang += NORM_Q16ANGLE(pp->RevolveQ16Ang + fix16_from_int(pp->RevolveDeltaAng)) - pp->q16ang;
|
||||
pp->camq16ang = NORM_Q16ANGLE(pp->camq16ang);
|
||||
pp->q16ang = fix16_from_int(NORM_ANGLE(pp->RevolveAng + pp->RevolveDeltaAng));
|
||||
pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + fix16_from_int(pp->RevolveDeltaAng));
|
||||
|
||||
if (!InterpolateSectObj)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue