mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 20:20:54 +00:00
- SW: Uplift playerSetHoriz()
similar to uplift to playerSetAngle()
in b832442e31
.
This commit is contained in:
parent
b832442e31
commit
e24521b189
3 changed files with 23 additions and 3 deletions
|
@ -1009,7 +1009,7 @@ struct PLAYERstruct
|
|||
|
||||
// Input helper variables and setters.
|
||||
double horizAdjust, angAdjust, pitchAdjust;
|
||||
fixed_t angTarget;
|
||||
fixed_t horizTarget, angTarget;
|
||||
void addang(int v) { q16ang = (q16ang + IntToFixed(v)) & 0x7FFFFFF; }
|
||||
void setang(int v) { q16ang = IntToFixed(v); }
|
||||
void addhoriz(int v) { q16horiz += (IntToFixed(v)); }
|
||||
|
|
|
@ -284,7 +284,18 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
|
|||
DoPlayerHorizon(pp, q16horz, scaleAdjust);
|
||||
}
|
||||
|
||||
if (pp->horizAdjust)
|
||||
if (pp->horizTarget)
|
||||
{
|
||||
fixed_t horizDelta = pp->horizTarget - pp->q16horiz;
|
||||
pp->q16horiz += xs_CRoundToInt(scaleAdjust * horizDelta);
|
||||
|
||||
if (abs(pp->q16horiz) >= abs(horizDelta))
|
||||
{
|
||||
pp->q16horiz = pp->horizTarget;
|
||||
pp->horizTarget = 0;
|
||||
}
|
||||
}
|
||||
else if (pp->horizAdjust)
|
||||
{
|
||||
pp->q16horiz += FloatToFixed(scaleAdjust * pp->horizAdjust);
|
||||
}
|
||||
|
|
|
@ -7834,7 +7834,16 @@ void playerSetHoriz(PLAYERp pp, double horiz)
|
|||
{
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
pp->horizAdjust += -1. * ((pp->q16horiz / 65536.) - horiz);
|
||||
// Cancel out any horizon adjustments as we're setting horizon now.
|
||||
pp->horizAdjust = 0;
|
||||
|
||||
// Add slight offset if input horizon is coming in as absolute 0.
|
||||
if (horiz == 0)
|
||||
{
|
||||
horiz += 0.1;
|
||||
}
|
||||
|
||||
pp->horizTarget = FloatToFixed(horiz);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue