port: add radial menu sensitivity slider

This commit is contained in:
fgsfds committed 2023-10-30 19:00:26 +01:00
1 parent ed65f7971a
commit afb91ab9e9
5 files changed
+35 -2

No files matched your search

+2
View File
@@ -64,6 +64,7 @@ static void gameLoadConfig(void)
g_PlayerMouseAimMode = configGetIntClamped("Game.MouseAimMode", g_PlayerMouseAimMode, 0, 1);
g_PlayerMouseAimSpeedX = configGetFloatClamped("Game.MouseAimSpeedX", g_PlayerMouseAimSpeedX, 0.f, 10.f);
g_PlayerMouseAimSpeedY = configGetFloatClamped("Game.MouseAimSpeedY", g_PlayerMouseAimSpeedY, 0.f, 10.f);
g_PlayerRadialMenuSpeed = configGetFloatClamped("Game.RadialMenuSpeed", g_PlayerRadialMenuSpeed, 0.f, 10.f);
g_PlayerFovAffectsZoom = configGetIntClamped("Game.FovAffectsZoom", g_PlayerFovAffectsZoom, 0, 1);
g_PlayerFovZoomMultiplier = g_PlayerFovAffectsZoom ? g_PlayerDefaultFovY / 60.0f : 1.0f;
g_PlayerClassicCrouch = configGetIntClamped("Game.ClassicCrouch", 0, 0, 1);
@@ -83,6 +84,7 @@ static void gameSaveConfig(void)
configSetInt("Game.MouseAimMode", g_PlayerMouseAimMode);
configSetFloat("Game.MouseAimSpeedX", g_PlayerMouseAimSpeedX);
configSetFloat("Game.MouseAimSpeedY", g_PlayerMouseAimSpeedY);
configSetFloat("Game.RadialMenuSpeed", g_PlayerRadialMenuSpeed);
configSetFloat("Game.CrosshairSway", g_PlayerCrosshairSway);
configSetFloat("Game.ScreenShakeIntensity", g_ViShakeIntensityMult);
}
+29
View File
@@ -130,6 +130,27 @@ static MenuItemHandlerResult menuhandlerMouseAimSpeedY(s32 operation, struct men
return 0;
}
static MenuItemHandlerResult menuhandlerRadialMenuSpeed(s32 operation, struct menuitem *item, union handlerdata *data)
{
switch (operation) {
case MENUOP_GETSLIDER:
if (g_PlayerRadialMenuSpeed < 0.f) {
data->slider.value = 0;
} else if (g_PlayerRadialMenuSpeed> 10.f) {
data->slider.value = 100;
} else {
data->slider.value = g_PlayerRadialMenuSpeed * 10.f + 0.5f;
}
break;
case MENUOP_SET:
g_PlayerRadialMenuSpeed = (f32)data->slider.value / 10.f;
break;
}
return 0;
}
struct menuitem g_ExtendedMouseMenuItems[] = {
{
MENUITEMTYPE_CHECKBOX,
@@ -187,6 +208,14 @@ struct menuitem g_ExtendedMouseMenuItems[] = {
100,
menuhandlerMouseAimSpeedY,
},
{
MENUITEMTYPE_SLIDER,
0,
MENUITEMFLAG_LITERAL_TEXT | MENUITEMFLAG_SLIDER_WIDE,
(uintptr_t)"Radial Menu Speed",
100,
menuhandlerRadialMenuSpeed,
},
{
MENUITEMTYPE_SEPARATOR,
0,
+2 -2
View File
@@ -80,8 +80,8 @@ void amTick(void)
struct activemenu *am = &g_AmMenus[g_AmIndex];
inputMouseGetAbsScaledDelta(&mdx, &mdy);
if (mdx || mdy) {
am->mousex += mdx * 4.f;
am->mousey += mdy * 4.f;
am->mousex += mdx * g_PlayerRadialMenuSpeed;
am->mousey += mdy * g_PlayerRadialMenuSpeed;
am->mousex = (am->mousex > 127.f) ? 127.f : (am->mousex < -128.f) ? -128.f : am->mousex;
am->mousey = (am->mousey > 127.f) ? 127.f : (am->mousey < -128.f) ? -128.f : am->mousey;
}
+1
View File
@@ -208,6 +208,7 @@ f32 g_PlayerCrosshairSway = 1.f;
s32 g_PlayerMouseAimMode = MOUSEAIM_CLASSIC;
f32 g_PlayerMouseAimSpeedX = 0.7f;
f32 g_PlayerMouseAimSpeedY = 0.7f;
f32 g_PlayerRadialMenuSpeed = 4.0f;
s32 g_PlayerFovAffectsZoom = 1;
f32 g_PlayerFovZoomMultiplier = 1.0f;
s32 g_PlayerClassicCrouch = true;
+1
View File
@@ -540,6 +540,7 @@ extern f32 g_PlayerDefaultFovY;
extern s32 g_PlayerMouseAimMode;
extern f32 g_PlayerMouseAimSpeedX;
extern f32 g_PlayerMouseAimSpeedY;
extern f32 g_PlayerRadialMenuSpeed;
extern s32 g_PlayerFovAffectsZoom;
extern f32 g_PlayerFovZoomMultiplier;
extern s32 g_PlayerClassicCrouch;