- fixed issues with negative values being passed to sqrt für calculating RRRA's motorcyle and boat.

This commit is contained in:
Christoph Oelckers 2022-11-02 13:32:07 +01:00
parent 1cf954920c
commit f5ce60fa6e

View file

@ -595,7 +595,7 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool
turnvel -= isTurboTurnTime() && p->MotoSpeed > 0 ? baseVel : baseVel * velScale;
if (hidInput->mouseturnx < 0)
turnvel -= sqrt((p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * -(hidInput->mouseturnx / factor) * 2.);
turnvel -= Sgn(baseVel) * sqrt((p->MotoSpeed > 0 ? abs(baseVel) : abs(baseVel) * velScale) * -(hidInput->mouseturnx / factor) * 2.);
if (hidInput->dyaw < 0)
turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * hidInput->dyaw;
@ -614,7 +614,7 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool
turnvel += isTurboTurnTime() && p->MotoSpeed > 0 ? baseVel : baseVel * velScale;
if (hidInput->mouseturnx > 0)
turnvel += sqrt((p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * (hidInput->mouseturnx / factor) * 2.);
turnvel += Sgn(baseVel) * sqrt((p->MotoSpeed > 0 ? abs(baseVel) : abs(baseVel) * velScale) * (hidInput->mouseturnx / factor) * 2.);
if (hidInput->dyaw > 0)
turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * hidInput->dyaw;
@ -670,7 +670,7 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool
turnvel -= isTurboTurnTime() ? baseVel : baseVel * velScale;
if (hidInput->mouseturnx < 0)
turnvel -= sqrt(baseVel * -(hidInput->mouseturnx / factor) * 2.);
turnvel -= Sgn(baseVel) * sqrt(abs(baseVel) * -(hidInput->mouseturnx / factor) * 2.);
if (hidInput->dyaw < 0)
turnvel += baseVel * hidInput->dyaw;
@ -691,7 +691,7 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool
turnvel += isTurboTurnTime() ? baseVel : baseVel * velScale;
if (hidInput->mouseturnx > 0)
turnvel += sqrt(baseVel * (hidInput->mouseturnx / factor) * 2.);
turnvel += Sgn(baseVel) * sqrt(abs(baseVel) * (hidInput->mouseturnx / factor) * 2.);
if (hidInput->dyaw > 0)
turnvel += baseVel * hidInput->dyaw;