mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
All Games: Make more precise use of 'scaleAdjustmentToInterval()'.
- Inline function returns a double, therefore we should use it and not potentially truncate the mantissa. - Use divisors to get true numbers of some floats (3.333 -> 10/3, etc). - Remove a few brackets/parentheses where possible from what are already exceedingly bracketed lines.
This commit is contained in:
parent
e6431a756b
commit
db428a4f03
5 changed files with 60 additions and 60 deletions
|
@ -339,9 +339,9 @@ void ctrlGetInput(void)
|
|||
turnHeldTime = 0;
|
||||
|
||||
if (turnLeft)
|
||||
input.q16turn = fix16_ssub(input.q16turn, fix16_from_float(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2)));
|
||||
input.q16turn = fix16_ssub(input.q16turn, fix16_from_dbl(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2)));
|
||||
if (turnRight)
|
||||
input.q16turn = fix16_sadd(input.q16turn, fix16_from_float(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2)));
|
||||
input.q16turn = fix16_sadd(input.q16turn, fix16_from_dbl(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2)));
|
||||
|
||||
if ((run2 || run) && turnHeldTime > 24)
|
||||
input.q16turn <<= 1;
|
||||
|
@ -391,17 +391,17 @@ void ctrlGetInput(void)
|
|||
int downAngle = -347;
|
||||
double lookStepUp = 4.0*upAngle/60.0;
|
||||
double lookStepDown = -4.0*downAngle/60.0;
|
||||
gViewAngle = (gViewAngle + input.q16turn + fix16_from_float(scaleAdjustmentToInterval(gViewAngleAdjust))) & 0x7ffffff;
|
||||
gViewAngle = (gViewAngle + input.q16turn + fix16_from_dbl(scaleAdjustmentToInterval(gViewAngleAdjust))) & 0x7ffffff;
|
||||
if (gViewLookRecenter)
|
||||
{
|
||||
if (gViewLook < 0)
|
||||
gViewLook = fix16_min(gViewLook+fix16_from_float(scaleAdjustmentToInterval(lookStepDown)), fix16_from_int(0));
|
||||
gViewLook = fix16_min(gViewLook+fix16_from_dbl(scaleAdjustmentToInterval(lookStepDown)), fix16_from_int(0));
|
||||
if (gViewLook > 0)
|
||||
gViewLook = fix16_max(gViewLook-fix16_from_float(scaleAdjustmentToInterval(lookStepUp)), fix16_from_int(0));
|
||||
gViewLook = fix16_max(gViewLook-fix16_from_dbl(scaleAdjustmentToInterval(lookStepUp)), fix16_from_int(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
gViewLook = fix16_clamp(gViewLook+fix16_from_float(scaleAdjustmentToInterval(gViewLookAdjust)), fix16_from_int(downAngle), fix16_from_int(upAngle));
|
||||
gViewLook = fix16_clamp(gViewLook+fix16_from_dbl(scaleAdjustmentToInterval(gViewLookAdjust)), fix16_from_int(downAngle), fix16_from_int(upAngle));
|
||||
}
|
||||
gViewLook = fix16_clamp(gViewLook+(input.q16mlook << 3), fix16_from_int(downAngle), fix16_from_int(upAngle));
|
||||
}
|
||||
|
|
|
@ -3157,12 +3157,12 @@ void P_GetInput(int const playerNum)
|
|||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
}
|
||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
}
|
||||
else
|
||||
turnHeldTime = 0;
|
||||
|
@ -3332,7 +3332,7 @@ void P_GetInput(int const playerNum)
|
|||
}
|
||||
else if (pPlayer->return_to_center > 0 || thisPlayer.horizRecenter)
|
||||
{
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(F16(66.666) - fix16_sdiv(pPlayer->q16horiz, F16(1.5))))));
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_from_dbl(200 / 3) - fix16_sdiv(pPlayer->q16horiz, F16(1.5))))));
|
||||
|
||||
if ((!pPlayer->return_to_center && thisPlayer.horizRecenter) || (pPlayer->q16horiz >= F16(99.9) && pPlayer->q16horiz <= F16(100.1)))
|
||||
{
|
||||
|
@ -3358,23 +3358,23 @@ void P_GetInput(int const playerNum)
|
|||
{
|
||||
int const slopeZ = getflorzofslope(pPlayer->cursectnum, adjustedPosition.x, adjustedPosition.y);
|
||||
if ((pPlayer->cursectnum == currentSector) || (klabs(getflorzofslope(currentSector, adjustedPosition.x, adjustedPosition.y) - slopeZ) <= ZOFFSET6))
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(mulscale16(pPlayer->truefz - slopeZ, 160))));
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(mulscale16(pPlayer->truefz - slopeZ, 160))));
|
||||
}
|
||||
}
|
||||
|
||||
if (pPlayer->q16horizoff > 0)
|
||||
{
|
||||
pPlayer->q16horizoff = fix16_ssub(pPlayer->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_ssub(pPlayer->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl((pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_max(pPlayer->q16horizoff, 0);
|
||||
}
|
||||
else if (pPlayer->q16horizoff < 0)
|
||||
{
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((-pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl((-pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_min(pPlayer->q16horizoff, 0);
|
||||
}
|
||||
|
||||
if (thisPlayer.horizSkew)
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(thisPlayer.horizSkew))));
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(thisPlayer.horizSkew))));
|
||||
|
||||
pPlayer->q16horiz = fix16_clamp(pPlayer->q16horiz, F16(HORIZ_MIN), F16(HORIZ_MAX));
|
||||
}
|
||||
|
|
|
@ -258,7 +258,7 @@ void PlayerInterruptKeys()
|
|||
}
|
||||
|
||||
//if ((counter++) % 4 == 0) // what was this for???
|
||||
input.nAngle = fix16_sadd(input.nAngle, fix16_from_float(scaleAdjustmentToInterval(turn * 2)));
|
||||
input.nAngle = fix16_sadd(input.nAngle, fix16_from_dbl(scaleAdjustmentToInterval(turn * 2)));
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ void PlayerInterruptKeys()
|
|||
{
|
||||
bLockPan = kFalse;
|
||||
if (PlayerList[nLocalPlayer].q16horiz < fix16_from_int(180)) {
|
||||
PlayerList[nLocalPlayer].q16horiz = fix16_sadd(PlayerList[nLocalPlayer].q16horiz, fix16_from_float(scaleAdjustmentToInterval(4)));
|
||||
PlayerList[nLocalPlayer].q16horiz = fix16_sadd(PlayerList[nLocalPlayer].q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(4)));
|
||||
}
|
||||
|
||||
bPlayerPan = kTrue;
|
||||
|
@ -301,7 +301,7 @@ void PlayerInterruptKeys()
|
|||
{
|
||||
bLockPan = kFalse;
|
||||
if (PlayerList[nLocalPlayer].q16horiz > fix16_from_int(4)) {
|
||||
PlayerList[nLocalPlayer].q16horiz = fix16_ssub(PlayerList[nLocalPlayer].q16horiz, fix16_from_float(scaleAdjustmentToInterval(4)));
|
||||
PlayerList[nLocalPlayer].q16horiz = fix16_ssub(PlayerList[nLocalPlayer].q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(4)));
|
||||
}
|
||||
|
||||
bPlayerPan = kTrue;
|
||||
|
|
|
@ -3297,12 +3297,12 @@ void P_GetInput(int const playerNum)
|
|||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
}
|
||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
}
|
||||
else
|
||||
turnHeldTime = 0;
|
||||
|
@ -3516,7 +3516,7 @@ void P_GetInput(int const playerNum)
|
|||
}
|
||||
else if (pPlayer->return_to_center > 0 || thisPlayer.horizRecenter)
|
||||
{
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(F16(66.666) - fix16_sdiv(pPlayer->q16horiz, F16(1.5))))));
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_from_dbl(200 / 3) - fix16_sdiv(pPlayer->q16horiz, F16(1.5))))));
|
||||
|
||||
if ((!pPlayer->return_to_center && thisPlayer.horizRecenter) || (pPlayer->q16horiz >= F16(99.9) && pPlayer->q16horiz <= F16(100.1)))
|
||||
{
|
||||
|
@ -3542,23 +3542,23 @@ void P_GetInput(int const playerNum)
|
|||
{
|
||||
int const slopeZ = getflorzofslope(pPlayer->cursectnum, adjustedPosition.x, adjustedPosition.y);
|
||||
if ((pPlayer->cursectnum == currentSector) || (klabs(getflorzofslope(currentSector, adjustedPosition.x, adjustedPosition.y) - slopeZ) <= ZOFFSET6))
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(mulscale16(pPlayer->truefz - slopeZ, 160))));
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(mulscale16(pPlayer->truefz - slopeZ, 160))));
|
||||
}
|
||||
}
|
||||
|
||||
if (pPlayer->q16horizoff > 0)
|
||||
{
|
||||
pPlayer->q16horizoff = fix16_ssub(pPlayer->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_ssub(pPlayer->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl((pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_max(pPlayer->q16horizoff, 0);
|
||||
}
|
||||
else if (pPlayer->q16horizoff < 0)
|
||||
{
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((-pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl((-pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_min(pPlayer->q16horizoff, 0);
|
||||
}
|
||||
|
||||
if (thisPlayer.horizSkew)
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(thisPlayer.horizSkew))));
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(thisPlayer.horizSkew))));
|
||||
|
||||
pPlayer->q16horiz = fix16_clamp(pPlayer->q16horiz, F16(HORIZ_MIN), F16(HORIZ_MAX));
|
||||
}
|
||||
|
@ -3703,16 +3703,16 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
if (turnHeldTime >= TURBOTURNTIME && pPlayer->moto_speed > 0)
|
||||
{
|
||||
if (moveBack)
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval(turnAmount)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount)));
|
||||
else
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval(turnAmount)));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount)));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (moveBack)
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnAmount / 2.667))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (8 / 3))));
|
||||
else
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnAmount / 2.667))));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (8 / 3))));
|
||||
}
|
||||
}
|
||||
else if (turnRight || pPlayer->moto_drink > 0)
|
||||
|
@ -3724,16 +3724,16 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
if (turnHeldTime >= TURBOTURNTIME && pPlayer->moto_speed > 0)
|
||||
{
|
||||
if (moveBack)
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval(turnAmount)));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount)));
|
||||
else
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval(turnAmount)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount)));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (moveBack)
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnAmount / 2.667))));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (8 / 3))));
|
||||
else
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnAmount / 2.667))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (8 / 3))));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3896,15 +3896,15 @@ void P_GetInputBoat(int playerNum)
|
|||
if (pPlayer->tilt_status < -10)
|
||||
pPlayer->tilt_status = -10;
|
||||
if (turnHeldTime >= TURBOTURNTIME)
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval(turnAmount)));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount)));
|
||||
else
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnAmount / 3.333))));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (10 / 3))));
|
||||
}
|
||||
else
|
||||
if (turnHeldTime >= TURBOTURNTIME)
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnAmount / 3))));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / 3)));
|
||||
else
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval(((turnAmount / 3.333) / 3))));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnAmount / (10 / 3)) / 3)));
|
||||
}
|
||||
else if (turnRight || pPlayer->moto_drink > 0)
|
||||
{
|
||||
|
@ -3915,15 +3915,15 @@ void P_GetInputBoat(int playerNum)
|
|||
if (pPlayer->tilt_status > 10)
|
||||
pPlayer->tilt_status = 10;
|
||||
if (turnHeldTime >= TURBOTURNTIME)
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval(turnAmount)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount)));
|
||||
else
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnAmount / 3.333))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (10 / 3))));
|
||||
}
|
||||
else
|
||||
if (turnHeldTime >= TURBOTURNTIME)
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnAmount / 3))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / 3)));
|
||||
else
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval(((turnAmount / 3.333) / 3))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnAmount / (10 / 3)) / 3)));
|
||||
}
|
||||
else if (!pPlayer->not_on_water)
|
||||
{
|
||||
|
@ -4061,12 +4061,12 @@ void P_DHGetInput(int const playerNum)
|
|||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
}
|
||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1))));
|
||||
}
|
||||
else
|
||||
turnHeldTime = 0;
|
||||
|
@ -4136,7 +4136,7 @@ void P_DHGetInput(int const playerNum)
|
|||
}
|
||||
else if (pPlayer->return_to_center > 0 || thisPlayer.horizRecenter)
|
||||
{
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(F16(66.666) - fix16_sdiv(pPlayer->q16horiz, F16(1.5))))));
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_from_dbl(200 / 3) - fix16_sdiv(pPlayer->q16horiz, F16(1.5))))));
|
||||
|
||||
if ((!pPlayer->return_to_center && thisPlayer.horizRecenter) || (pPlayer->q16horiz >= F16(99.9) && pPlayer->q16horiz <= F16(100.1)))
|
||||
{
|
||||
|
@ -4150,17 +4150,17 @@ void P_DHGetInput(int const playerNum)
|
|||
|
||||
if (pPlayer->q16horizoff > 0)
|
||||
{
|
||||
pPlayer->q16horizoff = fix16_ssub(pPlayer->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_ssub(pPlayer->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl((pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_max(pPlayer->q16horizoff, 0);
|
||||
}
|
||||
else if (pPlayer->q16horizoff < 0)
|
||||
{
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((-pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_sadd(pPlayer->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl((-pPlayer->q16horizoff >> 3) + fix16_one))));
|
||||
pPlayer->q16horizoff = fix16_min(pPlayer->q16horizoff, 0);
|
||||
}
|
||||
|
||||
if (thisPlayer.horizSkew)
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(thisPlayer.horizSkew))));
|
||||
pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(thisPlayer.horizSkew))));
|
||||
|
||||
pPlayer->q16horiz = fix16_clamp(pPlayer->q16horiz, F16(HORIZ_MIN), F16(HORIZ_MAX));
|
||||
|
||||
|
|
|
@ -3252,12 +3252,12 @@ void getinput(int const playerNum)
|
|||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
turnheldtime += synctics;
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)));
|
||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)));
|
||||
}
|
||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
{
|
||||
turnheldtime += synctics;
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3309,7 +3309,7 @@ void getinput(int const playerNum)
|
|||
// the rest will follow
|
||||
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_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_sdiv(fix16_abs(delta_q16ang), fix16_from_int(TURN_SHIFT))))))) & 0x7FFFFFF;
|
||||
|
||||
SET(pp->Flags, PF_TURN_180);
|
||||
}
|
||||
|
@ -3325,7 +3325,7 @@ void getinput(int const playerNum)
|
|||
fix16_t delta_q16ang;
|
||||
|
||||
delta_q16ang = GetDeltaAngleQ16(pp->turn180_target, pp->q16ang);
|
||||
pp->q16ang = fix16_sadd(pp->q16ang, 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_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_sdiv(fix16_abs(delta_q16ang), fix16_from_int(TURN_SHIFT)))))) & 0x7FFFFFF;
|
||||
|
||||
sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang);
|
||||
if (!Prediction)
|
||||
|
@ -3395,7 +3395,7 @@ void getinput(int const playerNum)
|
|||
if ((pp->cursectnum == tempsect) ||
|
||||
(klabs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8)))
|
||||
{
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(mulscale16((j - k), 160))));
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(mulscale16((j - k), 160))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3405,7 +3405,7 @@ void getinput(int const playerNum)
|
|||
{
|
||||
// tilt when climbing but you can't even really tell it
|
||||
if (pp->q16horizoff < fix16_from_int(100))
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(((fix16_from_int(100) - pp->q16horizoff) >> 3) + fix16_one))));
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(((fix16_from_int(100) - pp->q16horizoff) >> 3) + fix16_one))));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3413,12 +3413,12 @@ void getinput(int const playerNum)
|
|||
// you're not on a slope
|
||||
if (pp->q16horizoff > 0)
|
||||
{
|
||||
pp->q16horizoff = fix16_ssub(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((pp->q16horizoff >> 3) + fix16_one))));
|
||||
pp->q16horizoff = fix16_ssub(pp->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl((pp->q16horizoff >> 3) + fix16_one))));
|
||||
pp->q16horizoff = fix16_max(pp->q16horizoff, 0);
|
||||
}
|
||||
else if (pp->q16horizoff < 0)
|
||||
{
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((-pp->q16horizoff >> 3) + fix16_one))));
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl((-pp->q16horizoff >> 3) + fix16_one))));
|
||||
pp->q16horizoff = fix16_min(pp->q16horizoff, 0);
|
||||
}
|
||||
}
|
||||
|
@ -3444,11 +3444,11 @@ void getinput(int const playerNum)
|
|||
|
||||
// adjust pp->q16horiz negative
|
||||
if (TEST_SYNC_KEY(pp, SK_SNAP_DOWN))
|
||||
pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval((HORIZ_SPEED/2))));
|
||||
pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_dbl(scaleAdjustmentToInterval(HORIZ_SPEED / 2)));
|
||||
|
||||
// adjust pp->q16horiz positive
|
||||
if (TEST_SYNC_KEY(pp, SK_SNAP_UP))
|
||||
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval((HORIZ_SPEED/2))));
|
||||
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_dbl(scaleAdjustmentToInterval(HORIZ_SPEED / 2)));
|
||||
}
|
||||
|
||||
// this is the unlocked type
|
||||
|
@ -3459,11 +3459,11 @@ void getinput(int const playerNum)
|
|||
|
||||
// adjust pp->q16horiz negative
|
||||
if (TEST_SYNC_KEY(pp, SK_LOOK_DOWN))
|
||||
pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(HORIZ_SPEED)));
|
||||
pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_dbl(scaleAdjustmentToInterval(HORIZ_SPEED)));
|
||||
|
||||
// adjust pp->q16horiz positive
|
||||
if (TEST_SYNC_KEY(pp, SK_LOOK_UP))
|
||||
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(HORIZ_SPEED)));
|
||||
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_dbl(scaleAdjustmentToInterval(HORIZ_SPEED)));
|
||||
}
|
||||
|
||||
if (!TEST(pp->Flags, PF_LOCK_HORIZ))
|
||||
|
@ -3479,7 +3479,7 @@ void getinput(int const playerNum)
|
|||
for (i = 1; i; i--)
|
||||
{
|
||||
// this formula does not work for pp->q16horiz = 101-103
|
||||
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(fix16_ssub(fix16_from_int(25), fix16_sdiv(pp->q16horizbase, fix16_from_int(4)))))));
|
||||
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_ssub(fix16_from_int(25), fix16_sdiv(pp->q16horizbase, fix16_from_int(4)))))));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3495,9 +3495,9 @@ void getinput(int const playerNum)
|
|||
|
||||
// bound adjust q16horizoff
|
||||
if (pp->q16horizbase + pp->q16horizoff < fix16_from_int(PLAYER_HORIZ_MIN))
|
||||
pp->q16horizoff = fix16_ssub(fix16_from_float(scaleAdjustmentToInterval(PLAYER_HORIZ_MIN)), pp->q16horizbase);
|
||||
pp->q16horizoff = fix16_ssub(fix16_from_int(PLAYER_HORIZ_MIN), pp->q16horizbase);
|
||||
else if (pp->q16horizbase + pp->q16horizoff > fix16_from_int(PLAYER_HORIZ_MAX))
|
||||
pp->q16horizoff = fix16_ssub(fix16_from_float(scaleAdjustmentToInterval(PLAYER_HORIZ_MAX)), pp->q16horizbase);
|
||||
pp->q16horizoff = fix16_ssub(fix16_from_int(PLAYER_HORIZ_MAX), pp->q16horizbase);
|
||||
|
||||
// add base and offsets
|
||||
pp->q16horiz = fix16_clamp((pp->q16horizbase + pp->q16horizoff), fix16_from_int(PLAYER_HORIZ_MIN), fix16_from_int(PLAYER_HORIZ_MAX));
|
||||
|
|
Loading…
Reference in a new issue