From a4895cb270bff7edfd1f2c93f846c9b76f4e3573 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 15 Apr 2021 13:35:42 +1000 Subject: [PATCH] - All Games: Allow for HUD interpolation to be disabled. * Requested by users, really don't know why... * Interpolation values are guarded by the CVAR. * For Blood, integer truncation is employed just like original game. * For all games where more precise sine/cosine math has been utilised, no changes have been made. --- source/core/gamecvars.cpp | 1 + source/core/gamecvars.h | 1 + source/core/gameinput.h | 14 +++- source/games/blood/src/hudsprites.cpp | 16 +++- source/games/duke/src/game_misc.cpp | 2 +- source/games/duke/src/hudweapon_d.cpp | 104 +++++++++++++------------- source/games/duke/src/hudweapon_r.cpp | 42 +++++++---- source/games/duke/src/inlines.h | 6 -- source/games/exhumed/src/gameloop.cpp | 2 +- source/games/exhumed/src/gun.cpp | 20 +++-- source/games/sw/src/draw.cpp | 2 +- source/games/sw/src/panel.cpp | 21 +++++- 12 files changed, 137 insertions(+), 94 deletions(-) diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index 7fea2c6f6..f4b0c3de0 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -81,6 +81,7 @@ CVARD(Bool, cl_smoothsway, false, CVAR_ARCHIVE, "move SW weapon left and right s CVARD(Bool, cl_showmagamt, false, CVAR_ARCHIVE, "show the amount of rounds left in the magazine of your weapon on the modern HUD") CVARD(Bool, cl_nomeleeblur, false, CVAR_ARCHIVE, "enable/disable blur effect with melee weapons in SW") CVARD(Bool, cl_exhumedoldturn, false, CVAR_ARCHIVE, "enable/disable legacy turning speed for Powerslave/Exhumed") +CVARD(Bool, cl_hudinterpolation, true, CVAR_ARCHIVE, "enable/disable HUD (weapon drawer) interpolation") CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable weapon autoaim") diff --git a/source/core/gamecvars.h b/source/core/gamecvars.h index fa2115037..7e3a19259 100644 --- a/source/core/gamecvars.h +++ b/source/core/gamecvars.h @@ -26,6 +26,7 @@ EXTERN_CVAR(Bool, cl_smoothsway) EXTERN_CVAR(Bool, cl_showmagamt) EXTERN_CVAR(Bool, cl_nomeleeblur) EXTERN_CVAR(Bool, cl_exhumedoldturn) +EXTERN_CVAR(Bool, cl_hudinterpolation) EXTERN_CVAR(Bool, demorec_seeds_cvar) EXTERN_CVAR(Bool, demoplay_diffs) diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 3280a1351..9e671e7c1 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -94,6 +94,11 @@ struct PlayerHorizon return q16horiz(interpolatedvalue(osum().asq16(), sum().asq16(), smoothratio)); } + double horizsumfrac(bool const precise, double const smoothratio) + { + return !precise ? sum().asq16() >> 20 : (!SyncInput() ? sum() : interpolatedsum(smoothratio)).asbuildf() * (1. / 16.); // Used within draw code for Duke. + } + private: fixedhoriz target; double adjustment; @@ -221,9 +226,14 @@ struct PlayerAngle return interpolatedangle(orotscrnang, rotscrnang, smoothratio); } - double look_anghalf(double const smoothratio) + double look_anghalf(bool const precise, double const smoothratio) { - return (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).signedbuildf() * 0.5; // Used within draw code for weapon and crosshair when looking left/right. + return !precise ? look_ang.signedbam() >> 22 : (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).signedbuildf() * 0.5; // Used within draw code for weapon and crosshair when looking left/right. + } + + double looking_arc(bool const precise, double const smoothratio) + { + return !precise ? abs(look_ang.signedbuild()) / 9 : fabs((!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).signedbuildf()) * (1. / 9.); // Used within draw code for weapon and crosshair when looking left/right. } private: diff --git a/source/games/blood/src/hudsprites.cpp b/source/games/blood/src/hudsprites.cpp index 867bef3d6..668e9ee69 100644 --- a/source/games/blood/src/hudsprites.cpp +++ b/source/games/blood/src/hudsprites.cpp @@ -91,20 +91,28 @@ static void viewBurnTime(int gScale) void hudDraw(PLAYER *gView, int nSectnum, double bobx, double boby, double zDelta, int basepal, double smoothratio) { - double look_anghalf = gView->angle.look_anghalf(smoothratio); + double look_anghalf = gView->angle.look_anghalf(cl_hudinterpolation, smoothratio); DrawCrosshair(kCrosshairTile, gView->pXSprite->health >> 4, -look_anghalf, 0, 2); if (gViewPos == 0) { - double looking_arc = fabs(look_anghalf) / 4.5; + double looking_arc = gView->angle.looking_arc(cl_hudinterpolation, smoothratio); double cX = 160 - look_anghalf; double cY = 220 + looking_arc; if (cl_weaponsway) { - cX += (bobx / 256.); - cY += (boby / 256.) + (zDelta / 128.); + if (cl_hudinterpolation) + { + cX += (bobx / 256.); + cY += (boby / 256.) + (zDelta / 128.); + } + else + { + cX += (int(bobx) >> 8); + cY += (int(boby) >> 8) + (int(zDelta) >> 7); + } } else { diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 81d20ff1e..0524a6e0b 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -293,7 +293,7 @@ void drawoverlays(double smoothratio) if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr) { - DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -pp->angle.look_anghalf(smoothratio), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1); + DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -pp->angle.look_anghalf(cl_hudinterpolation, smoothratio), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1); } if (paused == 2) diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index 360032b9f..d9a246cf8 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -39,9 +39,9 @@ source as it is released. BEGIN_DUKE_NS -double getavel(int snum) +inline static double getavel(int snum) { - return FixedToFloat(PlayerInputAngVel(screenpeek)); + return PlayerInputAngVel(screenpeek) * (2048. / 360.); } //--------------------------------------------------------------------------- @@ -87,18 +87,16 @@ void displayloogie(short snum) // //--------------------------------------------------------------------------- -int animatefist(int gs, int snum, double look_anghalf) +int animatefist(int gs, int snum, double look_anghalf, double looking_arc, double plravel) { short fisti, fistpal; int fistzoom; - double looking_arc, fistz; + double fistz; fisti = ps[snum].fist_incs; if (fisti > 32) fisti = 32; if (fisti <= 0) return 0; - looking_arc = fabs(look_anghalf) / 4.5; - fistzoom = 65536L - bcosf(fisti << 6, 2); if (fistzoom > 90612L) fistzoom = 90612L; @@ -112,7 +110,7 @@ int animatefist(int gs, int snum, double look_anghalf) fistpal = sector[ps[snum].cursectnum].floorpal; hud_drawsprite( - (-fisti + 222 + (getavel(snum) / 16.)), + (-fisti + 222 + plravel), (looking_arc + fistz), fistzoom, 0, FIST, gs, fistpal, 2); @@ -125,17 +123,14 @@ int animatefist(int gs, int snum, double look_anghalf) // //--------------------------------------------------------------------------- -int animateknee(int gs, int snum, double hard_landing, double look_anghalf, double horiz16th) +int animateknee(int gs, int snum, double look_anghalf, double looking_arc, double horiz16th, double plravel) { static const short knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 }; short pal; - double looking_arc; if (ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0; - looking_arc = knee_y[ps[snum].knee_incs] + (fabs(look_anghalf) / 4.5); - - looking_arc -= hard_landing * 8.; + looking_arc += knee_y[ps[snum].knee_incs]; if (ps[snum].GetActor()->s.pal == 1) pal = 1; @@ -146,7 +141,7 @@ int animateknee(int gs, int snum, double hard_landing, double look_anghalf, doub pal = ps[snum].palookup; } - hud_drawpal(105 + (getavel(snum) / 16.) - look_anghalf + (knee_y[ps[snum].knee_incs] >> 2), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal); + hud_drawpal(105 + plravel - look_anghalf + (knee_y[ps[snum].knee_incs] >> 2), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal); return 1; } @@ -157,24 +152,19 @@ int animateknee(int gs, int snum, double hard_landing, double look_anghalf, doub // //--------------------------------------------------------------------------- -int animateknuckles(int gs, int snum, double hard_landing, double look_anghalf, double horiz16th) +int animateknuckles(int gs, int snum, double look_anghalf, double looking_arc, double horiz16th, double plravel) { static const short knuckle_frames[] = { 0,1,2,2,3,3,3,2,2,1,0 }; short pal; - double looking_arc; if (isWW2GI() || ps[snum].over_shoulder_on != 0 || ps[snum].knuckle_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0; - looking_arc = fabs(look_anghalf) / 4.5; - - looking_arc -= hard_landing * 8.; - if (ps[snum].GetActor()->s.pal == 1) pal = 1; else pal = sector[ps[snum].cursectnum].floorpal; - hud_drawpal(160 + (getavel(snum) / 16.) - look_anghalf, looking_arc + 180 - horiz16th, CRACKKNUCKLES + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal); + hud_drawpal(160 + plravel - look_anghalf, looking_arc + 180 - horiz16th, CRACKKNUCKLES + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal); return 1; } @@ -209,23 +199,19 @@ void displaymasks_d(int snum, double) // //--------------------------------------------------------------------------- -static int animatetip(int gs, int snum, double hard_landing, double look_anghalf, double horiz16th) +static int animatetip(int gs, int snum, double look_anghalf, double looking_arc, double horiz16th, double plravel) { int p; - double looking_arc; static const short tip_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16 }; if (ps[snum].tipincs == 0) return 0; - looking_arc = fabs(look_anghalf) / 4.5; - looking_arc -= hard_landing * 8.; - if (ps[snum].GetActor()->s.pal == 1) p = 1; else p = sector[ps[snum].cursectnum].floorpal; - hud_drawpal(170 + (getavel(snum) / 16.) - look_anghalf, + hud_drawpal(170 + plravel - look_anghalf, (tip_y[ps[snum].tipincs] >> 1) + looking_arc + 240 - horiz16th, TIP + ((26 - ps[snum].tipincs) >> 4), gs, 0, p); return 1; @@ -237,25 +223,23 @@ static int animatetip(int gs, int snum, double hard_landing, double look_anghalf // //--------------------------------------------------------------------------- -int animateaccess(int gs,int snum,double hard_landing,double look_anghalf,double horiz16th) +int animateaccess(int gs, int snum, double look_anghalf, double looking_arc, double horiz16th, double plravel) { static const short access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16}; - double looking_arc; char p; if(ps[snum].access_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0; - looking_arc = access_y[ps[snum].access_incs] + (fabs(look_anghalf) / 4.5); - looking_arc -= hard_landing * 8.; + looking_arc += access_y[ps[snum].access_incs]; if(ps[snum].access_spritenum != nullptr) p = ps[snum].access_spritenum->s.pal; else p = 0; if((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3) - hud_drawpal(170+(getavel(snum)/16.)-look_anghalf+(access_y[ps[snum].access_incs]>>2),looking_arc+266-horiz16th,HANDHOLDINGLASER+(ps[snum].access_incs>>3),gs,0,p); + hud_drawpal(170 + plravel - look_anghalf + (access_y[ps[snum].access_incs] >> 2), looking_arc + 266 - horiz16th, HANDHOLDINGLASER + (ps[snum].access_incs >> 3), gs, 0, p); else - hud_drawpal(170+(getavel(snum)/16.)-look_anghalf+(access_y[ps[snum].access_incs]>>2),looking_arc+266-horiz16th,HANDHOLDINGACCESS,gs,4,p); + hud_drawpal(170 + plravel - look_anghalf + (access_y[ps[snum].access_incs] >> 2), looking_arc + 266 - horiz16th, HANDHOLDINGACCESS, gs, 4, p); return 1; } @@ -271,7 +255,7 @@ void displayweapon_d(int snum, double smoothratio) int cw; int i, j; int o,pal; - double weapon_sway, weapon_xoffset, gun_pos, looking_arc, kickback_pic, random_club_frame, hard_landing, look_anghalf, horiz16th; + double weapon_sway, weapon_xoffset, gun_pos, looking_arc, kickback_pic, random_club_frame, hard_landing, look_anghalf, horiz16th, plravel; signed char shade; struct player_struct *p; @@ -281,36 +265,48 @@ void displayweapon_d(int snum, double smoothratio) o = 0; - horiz16th = get16thOfHoriz(snum, SyncInput(), smoothratio); - look_anghalf = p->angle.look_anghalf(smoothratio); - looking_arc = fabs(look_anghalf) / 4.5; - weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio); - kickback_pic = interpolatedvaluef(p->okickback_pic, p->kickback_pic, smoothratio); - random_club_frame = interpolatedvaluef(p->orandom_club_frame, p->random_club_frame, smoothratio); - hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio); + if (cl_hudinterpolation) + { + weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio); + kickback_pic = interpolatedvaluef(p->okickback_pic, p->kickback_pic, smoothratio); + random_club_frame = interpolatedvaluef(p->orandom_club_frame, p->random_club_frame, smoothratio); + hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio); + gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio); + } + else + { + weapon_sway = p->weapon_sway; + kickback_pic = p->kickback_pic; + random_club_frame = p->random_club_frame; + hard_landing = p->hard_landing; + gun_pos = 80 - (p->weapon_pos * p->weapon_pos); + } + + plravel = getavel(snum) * (1. / 16.); + horiz16th = p->horizon.horizsumfrac(cl_hudinterpolation, smoothratio); + look_anghalf = p->angle.look_anghalf(cl_hudinterpolation, smoothratio); + looking_arc = p->angle.looking_arc(cl_hudinterpolation, smoothratio); + hard_landing *= 8.; + + gun_pos -= fabs(p->GetActor()->s.xrepeat < 32 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10)); + gun_pos -= hard_landing; + + weapon_xoffset = (160)-90; + weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.); + weapon_xoffset -= 58 + p->weapon_ang; shade = p->GetActor()->s.shade; if(shade > 24) shade = 24; + auto adjusted_arc = looking_arc - hard_landing; bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0); - bool playerAnims = animatefist(shade,snum,look_anghalf) || animateknuckles(shade,snum,hard_landing,look_anghalf,horiz16th) || - animatetip(shade,snum,hard_landing,look_anghalf,horiz16th) || animateaccess(shade,snum,hard_landing,look_anghalf,horiz16th); + bool playerAnims = animatefist(shade, snum, look_anghalf, looking_arc, plravel) || animateknuckles(shade, snum, look_anghalf, adjusted_arc, horiz16th, plravel) || + animatetip(shade, snum, look_anghalf, adjusted_arc, horiz16th, plravel) || animateaccess(shade, snum, look_anghalf, adjusted_arc, horiz16th, plravel); if(playerVars || playerAnims) return; - animateknee(shade,snum,hard_landing,look_anghalf,horiz16th); - - gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio); - - weapon_xoffset = (160)-90; - weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.); - weapon_xoffset -= 58 + p->weapon_ang; - if( p->GetActor()->s.xrepeat < 32 ) - gun_pos -= fabs(bsinf(weapon_sway * 4., -9)); - else gun_pos -= fabs(bsinf(weapon_sway * 0.5, -10)); - - gun_pos -= hard_landing * 8.; + animateknee(shade, snum, look_anghalf, adjusted_arc, horiz16th, plravel); if (isWW2GI()) { diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index 4698ab3fa..f661a6246 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -116,7 +116,7 @@ void displayweapon_r(int snum, double smoothratio) { int cw; int i, j; - double weapon_sway, weapon_xoffset, gun_pos, looking_arc, look_anghalf, TiltStatus; + double weapon_sway, weapon_xoffset, gun_pos, looking_arc, look_anghalf, hard_landing, TiltStatus; char o,pal; signed char shade; @@ -125,10 +125,31 @@ void displayweapon_r(int snum, double smoothratio) o = 0; - look_anghalf = p->angle.look_anghalf(smoothratio); - looking_arc = fabs(look_anghalf) / 4.5; - weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio); - TiltStatus = !SyncInput() ? p->TiltStatus : interpolatedvaluef(p->oTiltStatus, p->TiltStatus, smoothratio); + if (cl_hudinterpolation) + { + weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio); + hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio); + gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio); + TiltStatus = !SyncInput() ? p->TiltStatus : interpolatedvaluef(p->oTiltStatus, p->TiltStatus, smoothratio); + } + else + { + weapon_sway = p->weapon_sway; + hard_landing = p->hard_landing; + gun_pos = 80 - (p->weapon_pos * p->weapon_pos); + TiltStatus = p->TiltStatus; + } + + look_anghalf = p->angle.look_anghalf(cl_hudinterpolation, smoothratio); + looking_arc = p->angle.looking_arc(cl_hudinterpolation, smoothratio); + hard_landing *= 8.; + + gun_pos -= fabs(p->GetActor()->s.xrepeat < 8 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10)); + gun_pos -= hard_landing; + + weapon_xoffset = (160)-90; + weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.); + weapon_xoffset -= 58 + p->weapon_ang; if (shadedsector[p->cursectnum] == 1) shade = 16; @@ -139,17 +160,6 @@ void displayweapon_r(int snum, double smoothratio) if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0)) return; - gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio); - - weapon_xoffset = (160)-90; - weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.); - weapon_xoffset -= 58 + p->weapon_ang; - if( p->GetActor()->s.xrepeat < 8 ) - gun_pos -= fabs(bsinf(weapon_sway * 4., -9)); - else gun_pos -= fabs(bsinf(weapon_sway * 0.5, -10)); - - gun_pos -= interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio) * 8.; - if(p->last_weapon >= 0) cw = p->last_weapon; else cw = p->curr_weapon; diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 345633f80..10a8bb6af 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -187,12 +187,6 @@ inline bool playrunning() return (paused == 0 || (paused == 1 && (ud.recstat == 2 || ud.multimode > 1))); } -// the weapon display code uses this. -inline double get16thOfHoriz(int const snum, bool const interpolate, double const smoothratio) -{ - return (!interpolate ? ps[snum].horizon.sum() : ps[snum].horizon.interpolatedsum(smoothratio)).asq16() * (0.0625 / FRACUNIT); -} - inline void doslopetilting(player_struct* p, double const scaleAdjust = 1) { bool const canslopetilt = p->on_ground && sector[p->cursectnum].lotag != ST_2_UNDERWATER && (sector[p->cursectnum].floorstat & 2); diff --git a/source/games/exhumed/src/gameloop.cpp b/source/games/exhumed/src/gameloop.cpp index 949670c75..2392a9760 100644 --- a/source/games/exhumed/src/gameloop.cpp +++ b/source/games/exhumed/src/gameloop.cpp @@ -93,7 +93,7 @@ void GameInterface::Render() DrawView(smoothratio); DrawStatusBar(); - DrawCrosshair(MAXTILES, PlayerList[nLocalPlayer].nHealth >> 3, -PlayerList[nLocalPlayer].angle.look_anghalf(smoothratio), 0, 1); + DrawCrosshair(MAXTILES, PlayerList[nLocalPlayer].nHealth >> 3, -PlayerList[nLocalPlayer].angle.look_anghalf(cl_hudinterpolation, smoothratio), 0, 1); if (paused && !M_Active()) { diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index d01748a68..38947cc20 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -964,9 +964,19 @@ void DrawWeapons(double smooth) if (cl_weaponsway) { - // CHECKME - not & 0x7FF? - double nBobAngle = interpolatedangle(buildang(obobangle), buildang(bobangle), smooth).asbuildf(); - double nVal = interpolatedvaluef(ototalvel[nLocalPlayer], totalvel[nLocalPlayer], smooth, 17); + double nBobAngle, nVal; + + if (cl_hudinterpolation) + { + nBobAngle = interpolatedangle(buildang(obobangle), buildang(bobangle), smooth).asbuildf(); + nVal = interpolatedvaluef(ototalvel[nLocalPlayer], totalvel[nLocalPlayer], smooth, 17); + } + else + { + nBobAngle = bobangle; + nVal = totalvel[nLocalPlayer]; + } + yOffset = MulScaleF(nVal, bsinf(fmod(nBobAngle, 1024.), -8), 9); if (var_34 == 1) @@ -987,8 +997,8 @@ void DrawWeapons(double smooth) nShade = sprite[PlayerList[nLocalPlayer].nSprite].shade; } - double const look_anghalf = PlayerList[nLocalPlayer].angle.look_anghalf(smooth); - double const looking_arc = fabs(look_anghalf) / 4.5; + double const look_anghalf = PlayerList[nLocalPlayer].angle.look_anghalf(cl_hudinterpolation, smooth); + double const looking_arc = PlayerList[nLocalPlayer].angle.looking_arc(cl_hudinterpolation, smooth); xOffset -= look_anghalf; yOffset += looking_arc; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index a89eba696..eacdfc21e 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1100,7 +1100,7 @@ void DrawCrosshair(PLAYERp pp) if (!(CameraTestMode)) { USERp u = User[pp->PlayerSprite]; - ::DrawCrosshair(2326, u->Health, -pp->angle.look_anghalf(smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10)); + ::DrawCrosshair(2326, u->Health, -pp->angle.look_anghalf(cl_hudinterpolation, smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10)); } } diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 04f1acd19..5c13c16e5 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -6897,16 +6897,29 @@ pDisplaySprites(PLAYERp pp, double smoothratio) short ang; int flags; - double const look_anghalf = pp->angle.look_anghalf(smoothratio); - double const looking_arc = fabs(look_anghalf) / 4.5; + double const look_anghalf = pp->angle.look_anghalf(cl_hudinterpolation, smoothratio); + double const looking_arc = pp->angle.looking_arc(cl_hudinterpolation, smoothratio); TRAVERSE(&pp->PanelSpriteList, psp, next) { ang = psp->rotate_ang; shade = 0; flags = 0; - x = interpolatedvaluef(psp->ox, psp->x, smoothratio) - look_anghalf; - y = interpolatedvaluef(psp->oy, psp->y, smoothratio) + looking_arc; + if (cl_hudinterpolation) + { + x = interpolatedvaluef(psp->ox, psp->x, smoothratio); + y = interpolatedvaluef(psp->oy, psp->y, smoothratio); + + } + else + { + x = psp->x; + y = psp->y; + } + + x -= look_anghalf; + y += looking_arc; + // initilize pal here - jack with it below pal = psp->pal;