From 0c687cdf67421d2ea7dc701780d00f54f05605e7 Mon Sep 17 00:00:00 2001 From: Ryan Baldwin Date: Sat, 25 Feb 2023 13:25:07 -0500 Subject: [PATCH] Allow selection of cnub look in options menu, correctly map sensitivity to cnub --- source/in_null.c | 7 ++----- source/menu.c | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/source/in_null.c b/source/in_null.c index 79d2ed8..6a90b2f 100644 --- a/source/in_null.c +++ b/source/in_null.c @@ -28,8 +28,6 @@ extern bool new3ds_flag; circlePosition cstick; -cvar_t csensitivity = {"csensitivity","3", true}; - extern cvar_t in_analog_strafe; extern cvar_t in_x_axis_adjust; extern cvar_t in_y_axis_adjust; @@ -37,7 +35,6 @@ extern cvar_t in_mlook; //Heffo - mlook cvar void IN_Init (void) { - Cvar_RegisterVariable (&csensitivity); Cvar_RegisterVariable (&in_analog_strafe); } @@ -147,8 +144,8 @@ void IN_Move (usercmd_t *cmd) } - cstick.dx = abs(cstick.dx) < 10 ? 0 : cstick.dx * csensitivity.value * 0.01; - cstick.dy = abs(cstick.dy) < 10 ? 0 : cstick.dy * csensitivity.value * 0.01; + cstick.dx = abs(cstick.dx) < 10 ? 0 : cstick.dx * sensitivity.value * 0.01; + cstick.dy = abs(cstick.dy) < 10 ? 0 : cstick.dy * sensitivity.value * 0.01; cl.viewangles[YAW] -= cstick.dx; cl.viewangles[PITCH] += cstick.dy; diff --git a/source/menu.c b/source/menu.c index 980024c..994d959 100644 --- a/source/menu.c +++ b/source/menu.c @@ -1031,7 +1031,7 @@ void M_Menu_CustomMaps_Key (int key) //============================================================================= /* OPTIONS MENU */ -#define OPTIONS_ITEMS 13 +#define OPTIONS_ITEMS 14 #define SLIDER_RANGE 10 int options_cursor; @@ -1114,6 +1114,10 @@ void M_AdjustSliders (int dir) case 11: // lookstrafe Cvar_SetValue ("lookstrafe", !lookstrafe.value); break; + + case 12: // in_analog_strafe (Cnub aim) + Cvar_SetValue ("in_analog_strafe", !in_analog_strafe.value); + break; } } @@ -1190,8 +1194,11 @@ void M_Options_Draw (void) M_Print (16, 120, " Lookstrafe"); M_DrawCheckbox (220, 120, lookstrafe.value); + M_Print (16, 128, "Analog Strafe (CNub Aim)"); + M_DrawCheckbox (220, 128, in_analog_strafe.value); + if (vid_menudrawfn) - M_Print (16, 128, " Video Options"); + M_Print (16, 136, " Video Options"); // cursor M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1)); @@ -1217,7 +1224,7 @@ void M_Options_Key (int k) case 2: Cbuf_AddText ("exec default.cfg\n"); break; - case 12: + case 13: M_Menu_Video_f (); break; default: @@ -1257,10 +1264,10 @@ void M_Options_Key (int k) break; } - if (options_cursor == 12 && vid_menudrawfn == NULL) + if (options_cursor == 13 && vid_menudrawfn == NULL) { if (k == K_UPARROW) - options_cursor = 11; + options_cursor = 12; else options_cursor = 0; }