From bc82328353e98ff487a87b95a884363cfbfcf102 Mon Sep 17 00:00:00 2001 From: Matthew Coppola Date: Wed, 13 Nov 2024 02:52:58 -0500 Subject: [PATCH] Improve crosshair position accuracy by rounding --- src/game/sight.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/game/sight.c b/src/game/sight.c index b32e4c87a..0764caf5d 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -1602,6 +1602,16 @@ Gfx *sightDraw(Gfx *gdl, bool sighton, s32 sight) return gdl; } +#ifndef PLATFORM_N64 + // Rounding the crosshair positions allow them to more accurately follow the + // gun's vector. Without this, the mantissa isn't factored in at all (cast + // to integer), which leads to some awkward behavior, such as the crosshair + // taking a long time to return to the center of the screen when coming from + // an up and/or left direction. + g_Vars.currentplayer->crosspos[0] = roundf(g_Vars.currentplayer->crosspos[0]); + g_Vars.currentplayer->crosspos[1] = roundf(g_Vars.currentplayer->crosspos[1]); +#endif + #if PAL g_ScaleX = 1; #else