Allow selection of cnub look in options menu, correctly map sensitivity to cnub

This commit is contained in:
Ryan Baldwin 2023-02-25 13:25:07 -05:00
parent 2cc40bc478
commit 0c687cdf67
2 changed files with 14 additions and 10 deletions

View file

@ -28,8 +28,6 @@ extern bool new3ds_flag;
circlePosition cstick; circlePosition cstick;
cvar_t csensitivity = {"csensitivity","3", true};
extern cvar_t in_analog_strafe; extern cvar_t in_analog_strafe;
extern cvar_t in_x_axis_adjust; extern cvar_t in_x_axis_adjust;
extern cvar_t in_y_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) void IN_Init (void)
{ {
Cvar_RegisterVariable (&csensitivity);
Cvar_RegisterVariable (&in_analog_strafe); 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.dx = abs(cstick.dx) < 10 ? 0 : cstick.dx * sensitivity.value * 0.01;
cstick.dy = abs(cstick.dy) < 10 ? 0 : cstick.dy * csensitivity.value * 0.01; cstick.dy = abs(cstick.dy) < 10 ? 0 : cstick.dy * sensitivity.value * 0.01;
cl.viewangles[YAW] -= cstick.dx; cl.viewangles[YAW] -= cstick.dx;
cl.viewangles[PITCH] += cstick.dy; cl.viewangles[PITCH] += cstick.dy;

View file

@ -1031,7 +1031,7 @@ void M_Menu_CustomMaps_Key (int key)
//============================================================================= //=============================================================================
/* OPTIONS MENU */ /* OPTIONS MENU */
#define OPTIONS_ITEMS 13 #define OPTIONS_ITEMS 14
#define SLIDER_RANGE 10 #define SLIDER_RANGE 10
int options_cursor; int options_cursor;
@ -1114,6 +1114,10 @@ void M_AdjustSliders (int dir)
case 11: // lookstrafe case 11: // lookstrafe
Cvar_SetValue ("lookstrafe", !lookstrafe.value); Cvar_SetValue ("lookstrafe", !lookstrafe.value);
break; 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_Print (16, 120, " Lookstrafe");
M_DrawCheckbox (220, 120, lookstrafe.value); 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) if (vid_menudrawfn)
M_Print (16, 128, " Video Options"); M_Print (16, 136, " Video Options");
// cursor // cursor
M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1)); M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
@ -1217,7 +1224,7 @@ void M_Options_Key (int k)
case 2: case 2:
Cbuf_AddText ("exec default.cfg\n"); Cbuf_AddText ("exec default.cfg\n");
break; break;
case 12: case 13:
M_Menu_Video_f (); M_Menu_Video_f ();
break; break;
default: default:
@ -1257,10 +1264,10 @@ void M_Options_Key (int k)
break; break;
} }
if (options_cursor == 12 && vid_menudrawfn == NULL) if (options_cursor == 13 && vid_menudrawfn == NULL)
{ {
if (k == K_UPARROW) if (k == K_UPARROW)
options_cursor = 11; options_cursor = 12;
else else
options_cursor = 0; options_cursor = 0;
} }