From 7c895b9f697d02516bab6bacecd40b44504a5211 Mon Sep 17 00:00:00 2001 From: opencode Date: Wed, 2 Dec 2026 09:01:53 +0000 Subject: [PATCH] fix: weapon-wheel crosshair selection, gold highlight, ring edge smoothing (issue #31) --- src/extras/weaponwheel.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/extras/weaponwheel.cpp b/src/extras/weaponwheel.cpp index 55c8b96e..b14f08f1 100644 --- a/src/extras/weaponwheel.cpp +++ b/src/extras/weaponwheel.cpp @@ -102,7 +102,7 @@ enum #define WHEEL_CURSOR_DEADZONE 0.06f #define WHEEL_CURSOR_ARM 0.012f // marker arm length, fraction of screen height #define WHEEL_CURSOR_THICK 0.0018f // marker thickness, fraction of screen height -#define WHEEL_RING_FEATHER 0.0015f // alpha-feather band on the procedural ring edges +#define WHEEL_RING_FEATHER 0.003f // alpha-feather band on the procedural ring edges #define WHEEL_ART_WW_PATH "weapon_wheel/ww%d.png" #define WHEEL_ART_ICON_PATH "weapon_wheel/icon%d.png" @@ -814,7 +814,14 @@ Wheel_UpdateInput(void) } } - if (bestMag > 0.0f) + // The mouse is authoritative once the crosshair leaves the deadzone: the + // maintainer's round-3 report was exactly "crosshair moves but selection + // never changes", caused by updating the cursor without ever assigning + // ms_nHovered from it. Stick/keyboard still drive selection while the + // crosshair is parked at the centre. + if (cursorDist > WHEEL_CURSOR_DEADZONE * SCREEN_HEIGHT) + ms_nHovered = Wheel_SegmentFromVector(cursorDX, cursorDY); + else if (bestMag > 0.0f) ms_nHovered = Wheel_SegmentFromVector(bestX, bestY); if (ms_nHovered >= 0) { @@ -1173,9 +1180,14 @@ Wheel_Draw(void) bool highlightAvailable = highlight >= 0 && highlight < WHEEL_SEGMENTS && player != nil && Wheel_SelectedWeapon(player, highlight) >= 0 && Wheel_SegmentArtMatches(player, highlight); - if (highlightAvailable && ms_apWwArt[highlight] != nil) + if (highlightAvailable && ms_apWwArt[highlight] != nil) { + // The wwN art is ~95% opaque white. Tint it warm gold; the texture + // is premultiplied and Wheel_DrawArt uses ONE/INVSRCALPHA, so the + // vertex colour multiplies the premultiplied texels and keeps the + // gradient while turning the block into a highlight. Wheel_DrawArt(ms_apWwArt[highlight], ms_aWwOffX[highlight], ms_aWwOffY[highlight], - ms_aWwW[highlight], ms_aWwH[highlight], CRGBA(255, 255, 255, 255)); + ms_aWwW[highlight], ms_aWwH[highlight], CRGBA(255, 205, 110, 255)); + } Wheel_DrawWeaponIcons(); }