mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 04:50:42 +00:00
SW: Smooth out 180 degree turn landing and replace some fix16_min/max with fix16_clamp.
This commit is contained in:
parent
2d73466425
commit
0996e87f79
2 changed files with 6 additions and 11 deletions
|
@ -1642,9 +1642,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fix16_t
|
||||||
zvect = 0;
|
zvect = 0;
|
||||||
|
|
||||||
// new horiz to player
|
// new horiz to player
|
||||||
*tq16horiz = fix16_from_int(100 - (zvect/256));
|
*tq16horiz = fix16_clamp(fix16_from_int(100 - (zvect/256)), fix16_from_int(PLAYER_HORIZ_MIN), fix16_from_int(PLAYER_HORIZ_MAX));
|
||||||
*tq16horiz = fix16_max(*tq16horiz, fix16_from_int(PLAYER_HORIZ_MIN));
|
|
||||||
*tq16horiz = fix16_min(*tq16horiz, fix16_from_int(PLAYER_HORIZ_MAX));
|
|
||||||
|
|
||||||
//DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,tq16horiz %d",xvect,yvect,zvect,*tq16horiz);
|
//DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,tq16horiz %d",xvect,yvect,zvect,*tq16horiz);
|
||||||
MONO_PRINT(ds);
|
MONO_PRINT(ds);
|
||||||
|
@ -2104,10 +2102,8 @@ drawscreen(PLAYERp pp)
|
||||||
tz += camerapp->bob_z;
|
tz += camerapp->bob_z;
|
||||||
|
|
||||||
// recoil only when not in camera
|
// recoil only when not in camera
|
||||||
//tq16horiz = tq16horiz + fix16_from_int(camerapp->recoil_horizoff);
|
//tq16horiz = fix16_clamp(fix16_sadd(tq16horiz, fix16_from_int(camerapp->recoil_horizoff)), fix16_from_int(PLAYER_HORIZ_MIN), fix16_from_int(PLAYER_HORIZ_MAX));
|
||||||
tq16horiz = tq16horiz + fix16_from_int(pp->recoil_horizoff);
|
tq16horiz = fix16_clamp(fix16_sadd(tq16horiz, fix16_from_int(pp->recoil_horizoff)), fix16_from_int(PLAYER_HORIZ_MIN), fix16_from_int(PLAYER_HORIZ_MAX));
|
||||||
tq16horiz = fix16_max(tq16horiz, fix16_from_int(PLAYER_HORIZ_MIN));
|
|
||||||
tq16horiz = fix16_min(tq16horiz, fix16_from_int(PLAYER_HORIZ_MAX));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_usenewaspect)
|
if (r_usenewaspect)
|
||||||
|
|
|
@ -3309,7 +3309,7 @@ void getinput(int const playerNum)
|
||||||
// the rest will follow
|
// the rest will follow
|
||||||
delta_q16ang = GetDeltaAngleQ16(pp->turn180_target, pp->q16ang);
|
delta_q16ang = GetDeltaAngleQ16(pp->turn180_target, pp->q16ang);
|
||||||
|
|
||||||
pp->q16ang = fix16_sadd(pp->q16ang, fix16_max(fix16_one,fix16_from_float(scaleAdjustmentToInterval(fix16_to_int(fix16_sdiv(fix16_abs(delta_q16ang), fix16_from_int(TURN_SHIFT))))))) & 0x7FFFFFF;
|
pp->q16ang = fix16_sadd(pp->q16ang, fix16_max(fix16_one, fix16_from_float(scaleAdjustmentToInterval(fix16_to_int(fix16_sdiv(fix16_abs(delta_q16ang), fix16_from_int(TURN_SHIFT))))))) & 0x7FFFFFF;
|
||||||
|
|
||||||
SET(pp->Flags, PF_TURN_180);
|
SET(pp->Flags, PF_TURN_180);
|
||||||
}
|
}
|
||||||
|
@ -3337,7 +3337,7 @@ void getinput(int const playerNum)
|
||||||
// get new delta to see how close we are
|
// get new delta to see how close we are
|
||||||
delta_q16ang = GetDeltaAngleQ16(pp->turn180_target, pp->q16ang);
|
delta_q16ang = GetDeltaAngleQ16(pp->turn180_target, pp->q16ang);
|
||||||
|
|
||||||
if (fix16_abs(delta_q16ang) < fix16_from_int(3 * TURN_SHIFT))
|
if (fix16_abs(delta_q16ang) < (fix16_one << 1))
|
||||||
{
|
{
|
||||||
pp->q16ang = pp->turn180_target;
|
pp->q16ang = pp->turn180_target;
|
||||||
RESET(pp->Flags, PF_TURN_180);
|
RESET(pp->Flags, PF_TURN_180);
|
||||||
|
@ -3491,8 +3491,7 @@ void getinput(int const playerNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
// bound the base
|
// bound the base
|
||||||
pp->q16horizbase = fix16_max(pp->q16horizbase, fix16_from_int(PLAYER_HORIZ_MIN));
|
pp->q16horizbase = fix16_clamp(pp->q16horizbase, fix16_from_int(PLAYER_HORIZ_MIN), fix16_from_int(PLAYER_HORIZ_MAX));
|
||||||
pp->q16horizbase = fix16_min(pp->q16horizbase, fix16_from_int(PLAYER_HORIZ_MAX));
|
|
||||||
|
|
||||||
// bound adjust q16horizoff
|
// bound adjust q16horizoff
|
||||||
if (pp->q16horizbase + pp->q16horizoff < fix16_from_int(PLAYER_HORIZ_MIN))
|
if (pp->q16horizbase + pp->q16horizoff < fix16_from_int(PLAYER_HORIZ_MIN))
|
||||||
|
|
Loading…
Reference in a new issue