From 293c1af4c27573db745b170c27b4a395b3e05df1 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 4 Aug 2020 17:10:44 +1000 Subject: [PATCH] - interpolate `p->TiltStatus` for RR(RA). --- source/games/duke/src/hudweapon_r.cpp | 19 ++++++++++--------- source/games/duke/src/input.cpp | 1 + source/games/duke/src/types.h | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index cb9e2da28..77c267b57 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -113,7 +113,7 @@ void displayweapon_r(int snum, double smoothratio) { int cw; int i, j; - double weapon_sway, weapon_xoffset, gun_pos, looking_arc, look_anghalf; + double weapon_sway, weapon_xoffset, gun_pos, looking_arc, look_anghalf, TiltStatus; char o,pal; signed char gs; @@ -125,6 +125,7 @@ void displayweapon_r(int snum, double smoothratio) look_anghalf = getHalfLookAng(snum, cl_syncinput, smoothratio); looking_arc = fabs(look_anghalf) / 4.5; weapon_sway = p->oweapon_sway + fmulscale16((p->weapon_sway - p->oweapon_sway), smoothratio); + TiltStatus = !cl_syncinput ? p->TiltStatus : p->oTiltStatus + fmulscale16((p->TiltStatus - p->oTiltStatus), smoothratio); if (shadedsector[p->cursectnum] == 1) gs = 16; @@ -215,17 +216,17 @@ void displayweapon_r(int snum, double smoothratio) else pal = sector[p->cursectnum].floorpal; - if (p->TiltStatus >= 0) - ShowMotorcycle(160-look_anghalf, 174, temp_kb, gs, 0, pal, p->TiltStatus*5); + if (TiltStatus >= 0) + ShowMotorcycle(160-look_anghalf, 174, temp_kb, gs, 0, pal, TiltStatus*5); else if (p->TiltStatus < 0) - ShowMotorcycle(160-look_anghalf, 174, temp_kb, gs, 0, pal, p->TiltStatus*5+2047); + ShowMotorcycle(160-look_anghalf, 174, temp_kb, gs, 0, pal, TiltStatus*5+2047); return; } if (p->OnBoat) { int temp2, temp_kb, temp3; temp2 = 0; - if (p->TiltStatus > 0) + if (TiltStatus > 0) { if (*kb == 0) temp_kb = BOATHIT+1; @@ -242,7 +243,7 @@ void displayweapon_r(int snum, double smoothratio) else temp_kb = BOATHIT+1; } - else if (p->TiltStatus < 0) + else if (TiltStatus < 0) { if (*kb == 0) temp_kb = BOATHIT+2; @@ -290,10 +291,10 @@ void displayweapon_r(int snum, double smoothratio) if (temp2) gs = -96; - if (p->TiltStatus >= 0) - ShowBoat(160-look_anghalf, temp3, temp_kb, gs, 0, pal, p->TiltStatus); + if (TiltStatus >= 0) + ShowBoat(160-look_anghalf, temp3, temp_kb, gs, 0, pal, TiltStatus); else if (p->TiltStatus < 0) - ShowBoat(160-look_anghalf, temp3, temp_kb, gs, 0, pal, p->TiltStatus+2047); + ShowBoat(160-look_anghalf, temp3, temp_kb, gs, 0, pal, TiltStatus+2047); return; } diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index efc93e7e3..ac0361c58 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -927,6 +927,7 @@ static void processMovement(player_struct *p, input_t &input, ControlInfo &info, static double motoApplyTurn(player_struct* p, int turnl, int turnr, int bike_turn, bool goback, double factor) { int turnvel = 0; + p->oTiltStatus = p->TiltStatus; if (p->MotoSpeed == 0 || !p->on_ground) { diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 85d1b4b75..7eea9e0a0 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -202,7 +202,7 @@ struct player_struct int SeaSick; short MamaEnd; // raat609 short MotoSpeed, moto_drink; - float TiltStatus; + float TiltStatus, oTiltStatus; short VBumpNow, VBumpTarget, TurbCount; short drug_stat[3]; // raat5f1..5 uint8_t DrugMode, lotag800kill;