From 1906de5d0c24d85d1933926da102c08f490f4522 Mon Sep 17 00:00:00 2001 From: Mitch Richters Date: Sat, 13 Nov 2021 21:14:37 +1100 Subject: [PATCH] - Adjust `PlayerHorizon` and `PlayerAngle` struct member `scaletozero()` to consistently return to zero at the same speed for synchronised and unsynchronised input at any framerate from 60 fps to at least 1000 fps. --- source/core/gameinput.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 7f421bb8b..0c2ddb23f 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -75,12 +75,12 @@ struct PlayerHorizon { return buildfhoriz(scaleAdjust * (((object ? object->asbuildf() : 1.) * getTicrateScale(value)) + push)); } - void scaletozero(fixedhoriz& object, double const value, double const scaleAdjust, double const push = 0.) + void scaletozero(fixedhoriz& object, double const value, double const scaleAdjust, double const push = DBL_MAX) { if (object.asq16()) { auto sgn = Sgn(object.asq16()); - object -= getscaledhoriz(value, scaleAdjust, &object, push == 0 ? sgn * (1. / 3.) : push); + object -= getscaledhoriz(value, scaleAdjust, &object, push == DBL_MAX ? sgn * (2. / 9.) * (scaleAdjust < 1. ? (1. - scaleAdjust * 0.5) * 1.5 : 1.) : push); if (sgn != Sgn(object.asq16())) object = q16horiz(0); } } @@ -195,12 +195,12 @@ struct PlayerAngle { return buildfang(scaleAdjust * (((object ? object->signedbuildf() : 1.) * getTicrateScale(value)) + push)); } - void scaletozero(binangle& object, double const value, double const scaleAdjust, double const push = 0.) + void scaletozero(binangle& object, double const value, double const scaleAdjust, double const push = DBL_MAX) { if (object.asbam()) { auto sgn = Sgn(object.signedbam()); - object -= getscaledangle(value, scaleAdjust, &object, push == 0 ? sgn * (1. / 3.) : push); + object -= getscaledangle(value, scaleAdjust, &object, push == DBL_MAX ? sgn * (2. / 9.) * (scaleAdjust < 1. ? (1. - scaleAdjust * 0.5) * 1.5 : 1.) : push); if (sgn != Sgn(object.signedbam())) object = bamang(0); } }