fix: radio wheel input rework, weapon-apply guard, control-lock/close fixes (issue #31 review)
linux / build (push) Canceled after 33s

This commit is contained in:
2026-12-01 19:53:17 +00:00
parent 97f3c73cea
commit 4b683021c7
7 changed files with 45 additions and 15 deletions
+5 -1
View File
@@ -538,7 +538,11 @@ cMusicManager::ServiceGameMode()
#endif
}
#ifdef RADIO_SCROLL_TO_PREV_STATION
else if(!CPad::GetPad(0)->ArePlayerControlsDisabled() && (CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown())) {
else if(!CPad::GetPad(0)->ArePlayerControlsDisabled()
#ifdef IMPROVED_WEAPON_WHEEL
&& !Wheel_IsRadioWheelOpen() // the radio wheel owns the mouse wheel
#endif
&& (CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown())) {
int scrollNext = ControlsManager.GetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, MOUSE);
int scrollPrev = scrollNext == rsMOUSEWHEELUPBUTTON ? rsMOUSEWHEELDOWNBUTTON : scrollNext == rsMOUSEWHEELDOWNBUTTON ? rsMOUSEWHEELUPBUTTON : -1;
+11
View File
@@ -38,6 +38,10 @@
#include "Hud.h"
#include "IniFile.h"
#include "Lights.h"
#ifdef IMPROVED_WEAPON_WHEEL
#include "weaponwheel.h"
#endif
#include "MBlur.h"
#include "Messages.h"
#include "MemoryCard.h"
@@ -1028,6 +1032,13 @@ void CGame::Process(void)
FrontEndMenuManager.Process();
POP_MEMID();
#ifdef IMPROVED_WEAPON_WHEEL
// Wheel state must advance even when CHud::Draw is skipped (frontend menu,
// FADE_2, scene edit, death), otherwise an open wheel could leave
// PLAYERCONTROL_CAMERA set. CGame::Process runs every game frame from Idle.
Wheel_Process();
#endif
CStreaming::Update();
if (!CTimer::GetIsPaused())
{
+18
View File
@@ -35,6 +35,10 @@
#include "Wanted.h"
#include "General.h"
#ifdef IMPROVED_WEAPON_WHEEL
#include "weaponwheel.h"
#endif
#ifdef GTA_PS2
#include "eetypes.h"
#include "libpad.h"
@@ -1532,7 +1536,14 @@ int16 CPad::GetSteeringLeftRight(void)
case 2:
{
int16 axis = NewState.LeftStickX;
#ifdef IMPROVED_WEAPON_WHEEL
// D-pad left/right (and the arrow keys mapped to it) select radio
// stations while the radio wheel is open; the left stick still
// steers, so driving is not frozen.
int16 dpad = Wheel_IsRadioWheelOpen() ? 0 : (NewState.DPadRight - NewState.DPadLeft) / 2;
#else
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
#endif
if ( Abs(axis) > Abs(dpad) )
return axis;
@@ -1652,7 +1663,14 @@ int16 CPad::GetPedWalkLeftRight(void)
case 2:
{
int16 axis = NewState.LeftStickX;
#ifdef IMPROVED_WEAPON_WHEEL
// D-pad left/right (and the arrow keys mapped to it) select radio
// stations while the radio wheel is open; the left stick still
// steers, so driving is not frozen.
int16 dpad = Wheel_IsRadioWheelOpen() ? 0 : (NewState.DPadRight - NewState.DPadLeft) / 2;
#else
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
#endif
if ( Abs(axis) > Abs(dpad) )
return axis;
+5 -3
View File
@@ -347,9 +347,11 @@ enum Config {
// GTA V-style wheels (issue #31): a hold-to-open radial weapon wheel that replaces
// the icon + D-pad weapon cycling, and a radio station wheel that replaces the
// radio-switch station-name HUD. Entirely custom UI, so it lives behind this guard
// and in src/extras/weaponwheel.cpp; no reversed code is changed outside a few
// guarded seams in Pad.cpp, Hud.cpp and MusicManager.cpp.
// radio-switch station-name HUD. The weapon wheel is on-foot and freezes the
// player while held; the radio wheel is vehicle-only and leaves driving controls
// alive. Entirely custom UI, so it lives behind this guard and in
// src/extras/weaponwheel.cpp; no reversed code is changed outside a few guarded
// seams in Pad.cpp, Game.cpp, Hud.cpp and MusicManager.cpp.
// Off by default: guard-off builds are byte-identical to vanilla.
//#define IMPROVED_WEAPON_WHEEL
#ifdef IMPROVED_WEAPON_WHEEL
+1 -1
View File
@@ -974,7 +974,7 @@ DebugMenuPopulate(void)
#else
false;
#endif
DebugMenuAddVarBool8ReadOnly("Gameplay", "Radio wheel (R/L2)", &bRadioWheel);
DebugMenuAddVarBool8ReadOnly("Gameplay", "Radio wheel (R/R3)", &bRadioWheel);
static int spawnCarId = MI_LANDSTAL;
e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_GHOST, carnames);
+5 -3
View File
@@ -6,9 +6,11 @@
// Custom UI: this is not reversed code and only exists when IMPROVED_WEAPON_WHEEL
// is defined in src/core/config.h.
//
// The wheel is processed from CHud::Draw so it never runs outside the render/HUD
// path. Optional art (weapon_wheel/*.png next to the executable) is loaded at
// runtime and every piece falls back to the procedural wheel if it is absent.
// Wheel_Process() runs from CGame::Process (every game frame, including while
// the frontend menu, fades, scene edit or death skip CHud::Draw, so an open
// wheel is always closed promptly). Wheel_Draw() runs at the end of CHud::Draw.
// Optional art (weapon_wheel/*.png next to the executable) is loaded at runtime
// and every piece falls back to the procedural wheel if it is absent.
void Wheel_Process(void);
void Wheel_Draw(void);
-7
View File
@@ -459,13 +459,6 @@ void CHud::SetVehicleName(wchar *name)
void CHud::Draw()
{
#ifdef IMPROVED_WEAPON_WHEEL
// Custom UI (issue #31). Runs before the replay early-out so an open wheel
// can always release PLAYERCONTROL_CAMERA. Drawing itself happens at the
// end of the function so it sits above the rest of the HUD.
Wheel_Process();
#endif
// disable hud via second controller
if (CPad::GetPad(1)->GetStartJustDown())
m_Wants_To_Draw_Hud = !m_Wants_To_Draw_Hud;