From e0f35d207ff12eee1e183d367b057842ee038fd0 Mon Sep 17 00:00:00 2001
From: fickleheart <fickle@tinted.red>
Date: Mon, 30 Dec 2019 14:01:14 -0600
Subject: [PATCH] Convert analog/directionchar cvars into 2-long arrays

---
 src/b_bot.c    |  2 +-
 src/d_main.c   |  2 +-
 src/d_netcmd.c | 22 ++++++++++----------
 src/doomstat.h |  2 +-
 src/g_game.c   | 54 ++++++++++++++++++++++++++++----------------------
 src/g_game.h   |  5 ++---
 src/m_cheat.c  |  2 +-
 src/m_menu.c   | 22 ++++++++++----------
 src/m_misc.c   |  4 ++--
 src/p_map.c    |  6 +++---
 src/p_setup.c  | 24 +++++++++++-----------
 src/p_user.c   | 14 ++++++-------
 src/r_main.c   | 12 +++++------
 13 files changed, 88 insertions(+), 83 deletions(-)

diff --git a/src/b_bot.c b/src/b_bot.c
index dfb5ee1cf2..cd5edf9908 100644
--- a/src/b_bot.c
+++ b/src/b_bot.c
@@ -379,7 +379,7 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
 	}
 
 	// Bot AI isn't programmed in analog.
-	CV_SetValue(&cv_analog2, false);
+	CV_SetValue(&cv_analog[1], false);
 
 #ifdef HAVE_BLUA
 	// Let Lua scripts build ticcmds
diff --git a/src/d_main.c b/src/d_main.c
index c4b0d7117e..f3e84985a7 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -781,7 +781,7 @@ void D_StartTitle(void)
 		CV_SetValue(&cv_usemouse, tutorialusemouse);
 		CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
 		CV_SetValue(&cv_mousemove, tutorialmousemove);
-		CV_SetValue(&cv_analog, tutorialanalog);
+		CV_SetValue(&cv_analog[0], tutorialanalog);
 		M_StartMessage("Do you want to \x82save the recommended \x82movement controls?\x80\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls",
 			M_TutorialSaveControlResponse, MM_YESNO);
 	}
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index ffb5b90cac..df6d704467 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -816,14 +816,14 @@ void D_RegisterClientCommands(void)
 	CV_RegisterVar(&cv_joyscale2);
 
 	// Analog Control
-	CV_RegisterVar(&cv_analog);
-	CV_RegisterVar(&cv_analog2);
-	CV_RegisterVar(&cv_useranalog);
-	CV_RegisterVar(&cv_useranalog2);
+	CV_RegisterVar(&cv_analog[0]);
+	CV_RegisterVar(&cv_analog[1]);
+	CV_RegisterVar(&cv_useranalog[0]);
+	CV_RegisterVar(&cv_useranalog[1]);
 
 	// deez New User eXperiences
-	CV_RegisterVar(&cv_directionchar);
-	CV_RegisterVar(&cv_directionchar2);
+	CV_RegisterVar(&cv_directionchar[0]);
+	CV_RegisterVar(&cv_directionchar[1]);
 	CV_RegisterVar(&cv_autobrake);
 	CV_RegisterVar(&cv_autobrake2);
 
@@ -1510,9 +1510,9 @@ void SendWeaponPref(void)
 	buf[0] = 0;
 	if (cv_flipcam.value)
 		buf[0] |= 1;
-	if (cv_analog.value)
+	if (cv_analog[0].value)
 		buf[0] |= 2;
-	if (cv_directionchar.value)
+	if (cv_directionchar[0].value)
 		buf[0] |= 4;
 	if (cv_autobrake.value)
 		buf[0] |= 8;
@@ -1526,9 +1526,9 @@ void SendWeaponPref2(void)
 	buf[0] = 0;
 	if (cv_flipcam2.value)
 		buf[0] |= 1;
-	if (cv_analog2.value)
+	if (cv_analog[1].value)
 		buf[0] |= 2;
-	if (cv_directionchar2.value)
+	if (cv_directionchar[1].value)
 		buf[0] |= 4;
 	if (cv_autobrake2.value)
 		buf[0] |= 8;
@@ -2036,7 +2036,7 @@ static void Command_Map_f(void)
 		CV_SetValue(&cv_usemouse, tutorialusemouse);
 		CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
 		CV_SetValue(&cv_mousemove, tutorialmousemove);
-		CV_SetValue(&cv_analog, tutorialanalog);
+		CV_SetValue(&cv_analog[0], tutorialanalog);
 	}
 	tutorialmode = false; // warping takes us out of tutorial mode
 
diff --git a/src/doomstat.h b/src/doomstat.h
index 3c0b4773a6..cc4e0ca98c 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -137,7 +137,7 @@ extern INT32 tutorialgcs; // which control scheme is loaded?
 extern INT32 tutorialusemouse; // store cv_usemouse user value
 extern INT32 tutorialfreelook; // store cv_alwaysfreelook user value
 extern INT32 tutorialmousemove; // store cv_mousemove user value
-extern INT32 tutorialanalog; // store cv_analog user value
+extern INT32 tutorialanalog; // store cv_analog[0] user value
 
 extern boolean looptitle;
 
diff --git a/src/g_game.c b/src/g_game.c
index 471c6db6ce..df5e2afd11 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -139,7 +139,7 @@ INT32 tutorialgcs = gcs_custom; // which control scheme is loaded?
 INT32 tutorialusemouse = 0; // store cv_usemouse user value
 INT32 tutorialfreelook = 0; // store cv_alwaysfreelook user value
 INT32 tutorialmousemove = 0; // store cv_mousemove user value
-INT32 tutorialanalog = 0; // store cv_analog user value
+INT32 tutorialanalog = 0; // store cv_analog[0] user value
 
 boolean looptitle = false;
 
@@ -388,15 +388,21 @@ consvar_t cv_mousemove2 = {"mousemove2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL
 
 // previously "analog", "analog2", "useranalog", and "useranalog2", invalidating 2.1-era copies of config.cfg
 // changed because it'd be nice to see people try out our actually good controls with gamepads now autobrake exists
-consvar_t cv_analog = {"sessionanalog", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, Analog_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_analog2 = {"sessionanalog2", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, Analog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_useranalog = {"configanalog", "Off", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_useranalog2 = {"configanalog2", "Off", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_analog[2] = {
+	{"sessionanalog", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, Analog_OnChange, 0, NULL, NULL, 0, 0, NULL},
+	{"sessionanalog2", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, Analog2_OnChange, 0, NULL, NULL, 0, 0, NULL}
+};
+consvar_t cv_useranalog[2] = {
+	{"configanalog", "Off", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL},
+	{"configanalog2", "Off", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL}
+};
 
 // deez New User eXperiences
 static CV_PossibleValue_t directionchar_cons_t[] = {{0, "Camera"}, {1, "Movement"}, {0, NULL}};
-consvar_t cv_directionchar = {"directionchar", "Movement", CV_SAVE|CV_CALL, directionchar_cons_t, DirectionChar_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_directionchar2 = {"directionchar2", "Movement", CV_SAVE|CV_CALL, directionchar_cons_t, DirectionChar2_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_directionchar[2] = {
+	{"directionchar", "Movement", CV_SAVE|CV_CALL, directionchar_cons_t, DirectionChar_OnChange, 0, NULL, NULL, 0, 0, NULL},
+	{"directionchar2", "Movement", CV_SAVE|CV_CALL, directionchar_cons_t, DirectionChar2_OnChange, 0, NULL, NULL, 0, 0, NULL}
+};
 consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake_OnChange, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_autobrake2 = {"autobrake2", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake2_OnChange, 0, NULL, NULL, 0, 0, NULL};
 
@@ -1159,7 +1165,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
 		chasefreelook = cv_chasefreelook.value;
 		alwaysfreelook = cv_alwaysfreelook.value;
 		usejoystick = cv_usejoystick.value;
-		analog = cv_analog.value;
+		analog = cv_analog[0].value;
 		invertmouse = cv_invertmouse.value;
 		mousemove = cv_mousemove.value;
 		mx = &mousex;
@@ -1173,7 +1179,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
 		chasefreelook = cv_chasefreelook2.value;
 		alwaysfreelook = cv_alwaysfreelook2.value;
 		usejoystick = cv_usejoystick2.value;
-		analog = cv_analog2.value;
+		analog = cv_analog[1].value;
 		invertmouse = cv_invertmouse2.value;
 		mousemove = cv_mousemove2.value;
 		mx = &mouse2x;
@@ -1412,7 +1418,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
 	{
 		if (abilitydirection && !ticcmd_centerviewdown[forplayer] && !G_RingSlingerGametype())
 		{
-			CV_SetValue((ssplayer == 1 ? &cv_directionchar : &cv_directionchar2), 0);
+			CV_SetValue((ssplayer == 1 ? &cv_directionchar[0] : &cv_directionchar[1]), 0);
 			*myangle = player->mo->angle;
 			*myaiming = 0;
 
@@ -1427,7 +1433,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
 		if (abilitydirection)
 		{
 			P_SetTarget(&ticcmd_ztargetfocus[forplayer], NULL);
-			CV_SetValue((ssplayer == 1 ? &cv_directionchar : &cv_directionchar2), 1);
+			CV_SetValue((ssplayer == 1 ? &cv_directionchar[0] : &cv_directionchar[1]), 1);
 		}
 
 		ticcmd_centerviewdown[forplayer] = false;
@@ -1606,7 +1612,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
 		if (!player->powers[pw_tailsfly] && (cmd->forwardmove || cmd->sidemove || cmd->buttons))
 		{
 			player->bot = 2; // A player-controlled bot. Returns to AI when it respawns.
-			CV_SetValue(&cv_analog2, true);
+			CV_SetValue(&cv_analog[1], true);
 		}
 		else
 		{
@@ -1726,20 +1732,20 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
 // fudging with it.
 static void UserAnalog_OnChange(void)
 {
-	if (cv_useranalog.value)
-		CV_SetValue(&cv_analog, 1);
+	if (cv_useranalog[0].value)
+		CV_SetValue(&cv_analog[0], 1);
 	else
-		CV_SetValue(&cv_analog, 0);
+		CV_SetValue(&cv_analog[0], 0);
 }
 
 static void UserAnalog2_OnChange(void)
 {
 	if (botingame)
 		return;
-	if (cv_useranalog2.value)
-		CV_SetValue(&cv_analog2, 1);
+	if (cv_useranalog[1].value)
+		CV_SetValue(&cv_analog[1], 1);
 	else
-		CV_SetValue(&cv_analog2, 0);
+		CV_SetValue(&cv_analog[1], 0);
 }
 
 static void Analog_OnChange(void)
@@ -1749,8 +1755,8 @@ static void Analog_OnChange(void)
 
 	// cameras are not initialized at this point
 
-	if (!cv_chasecam.value && cv_analog.value) {
-		CV_SetValue(&cv_analog, 0);
+	if (!cv_chasecam.value && cv_analog[0].value) {
+		CV_SetValue(&cv_analog[0], 0);
 		return;
 	}
 
@@ -1764,8 +1770,8 @@ static void Analog2_OnChange(void)
 
 	// cameras are not initialized at this point
 
-	if (!cv_chasecam2.value && cv_analog2.value) {
-		CV_SetValue(&cv_analog2, 0);
+	if (!cv_chasecam2.value && cv_analog[1].value) {
+		CV_SetValue(&cv_analog[1], 0);
 		return;
 	}
 
@@ -5956,12 +5962,12 @@ void G_BeginRecording(void)
 			buf |= 0x01;
 			pflags |= PF_FLIPCAM;
 		}
-		if (cv_analog.value)
+		if (cv_analog[0].value)
 		{
 			buf |= 0x02;
 			pflags |= PF_ANALOGMODE;
 		}
-		if (cv_directionchar.value)
+		if (cv_directionchar[0].value)
 		{
 			buf |= 0x04;
 			pflags |= PF_DIRECTIONCHAR;
diff --git a/src/g_game.h b/src/g_game.h
index 5f094fbda2..b2a237d7ec 100644
--- a/src/g_game.h
+++ b/src/g_game.h
@@ -68,9 +68,8 @@ extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime,
 extern consvar_t cv_crosshair, cv_crosshair2;
 extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove;
 extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2;
-extern consvar_t cv_useranalog, cv_useranalog2;
-extern consvar_t cv_analog, cv_analog2;
-extern consvar_t cv_directionchar, cv_directionchar2;
+extern consvar_t cv_useranalog[2], cv_analog[2];
+extern consvar_t cv_directionchar[2];
 extern consvar_t cv_autobrake, cv_autobrake2;
 extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis,cv_deadzone,cv_digitaldeadzone;
 extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2,cv_deadzone2,cv_digitaldeadzone2;
diff --git a/src/m_cheat.c b/src/m_cheat.c
index e31ce7869c..66d09fabac 100644
--- a/src/m_cheat.c
+++ b/src/m_cheat.c
@@ -1316,7 +1316,7 @@ void OP_ObjectplaceMovement(player_t *player)
 {
 	ticcmd_t *cmd = &player->cmd;
 
-	if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING)))
+	if (!player->climbing && (netgame || !cv_analog[0].value || (player->pflags & PF_SPINNING)))
 		player->drawangle = player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
 
 	ticruned++;
diff --git a/src/m_menu.c b/src/m_menu.c
index 0675dceb95..c5691a7c30 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1038,7 +1038,7 @@ static menuitem_t OP_P1ControlsMenu[] =
 
 	{IT_SUBMENU | IT_STRING, NULL, "Camera Options...", &OP_CameraOptionsDef,	50},
 
-	//{IT_STRING  | IT_CVAR, NULL, "Character angle", &cv_directionchar,  70},
+	//{IT_STRING  | IT_CVAR, NULL, "Character angle", &cv_directionchar[0],  70},
 	{IT_STRING  | IT_CVAR, NULL, "Automatic braking", &cv_autobrake,  70},
 	{IT_CALL    | IT_STRING, NULL, "Play Style...", M_Setup1PPlaystyleMenu, 80},
 	//{IT_STRING  | IT_CVAR, NULL, "Ability angle", &cv_abilitydirection[0],  90},
@@ -1052,7 +1052,7 @@ static menuitem_t OP_P2ControlsMenu[] =
 
 	{IT_SUBMENU | IT_STRING, NULL, "Camera Options...", &OP_Camera2OptionsDef,	50},
 
-	//{IT_STRING  | IT_CVAR, NULL, "Character angle", &cv_directionchar2,  70},
+	//{IT_STRING  | IT_CVAR, NULL, "Character angle", &cv_directionchar[1],  70},
 	{IT_STRING  | IT_CVAR, NULL, "Automatic braking", &cv_autobrake2,  70},
 	{IT_CALL    | IT_STRING, NULL, "Play Style...", M_Setup2PPlaystyleMenu, 80},
 	//{IT_STRING  | IT_CVAR, NULL, "Ability angle", &cv_abilitydirection[1],  90},
@@ -4318,7 +4318,7 @@ static void M_DrawControlsDefMenu(void)
 
 	if (currentMenu == &OP_P1ControlsDef)
 	{
-		opt = cv_useranalog.value ? 3 : (cv_abilitydirection[0].value ? 2 : cv_directionchar.value);
+		opt = cv_useranalog[0].value ? 3 : (cv_abilitydirection[0].value ? 2 : cv_directionchar[0].value);
 
 		if (opt == 2)
 		{
@@ -4333,7 +4333,7 @@ static void M_DrawControlsDefMenu(void)
 	}
 	else
 	{
-		opt = cv_useranalog2.value ? 3 : (cv_abilitydirection[1].value ? 2 : cv_directionchar2.value);
+		opt = cv_useranalog[1].value ? 3 : (cv_abilitydirection[1].value ? 2 : cv_directionchar[1].value);
 
 		if (opt == 2)
 		{
@@ -7773,7 +7773,7 @@ void M_TutorialSaveControlResponse(INT32 ch)
 		CV_Set(&cv_usemouse, cv_usemouse.defaultvalue);
 		CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue);
 		CV_Set(&cv_mousemove, cv_mousemove.defaultvalue);
-		CV_Set(&cv_analog, cv_analog.defaultvalue);
+		CV_Set(&cv_analog[0], cv_analog[0].defaultvalue);
 		S_StartSound(NULL, sfx_itemup);
 	}
 	else
@@ -7791,13 +7791,13 @@ static void M_TutorialControlResponse(INT32 ch)
 			tutorialusemouse = cv_usemouse.value;
 			tutorialfreelook = cv_alwaysfreelook.value;
 			tutorialmousemove = cv_mousemove.value;
-			tutorialanalog = cv_analog.value;
+			tutorialanalog = cv_analog[0].value;
 
 			G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gcl_tutorial_full, num_gcl_tutorial_full);
 			CV_Set(&cv_usemouse, cv_usemouse.defaultvalue);
 			CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue);
 			CV_Set(&cv_mousemove, cv_mousemove.defaultvalue);
-			CV_Set(&cv_analog, cv_analog.defaultvalue);
+			CV_Set(&cv_analog[0], cv_analog[0].defaultvalue);
 
 			//S_StartSound(NULL, sfx_itemup);
 		}
@@ -11619,7 +11619,7 @@ static void M_Setup1PPlaystyleMenu(INT32 choice)
 	(void)choice;
 
 	playstyle_activeplayer = 0;
-	playstyle_currentchoice = cv_useranalog.value ? 3 : (cv_abilitydirection[0].value ? 2 : cv_directionchar.value);
+	playstyle_currentchoice = cv_useranalog[0].value ? 3 : (cv_abilitydirection[0].value ? 2 : cv_directionchar[0].value);
 	OP_PlaystyleDef.prevMenu = &OP_P1ControlsDef;
 	M_SetupNextMenu(&OP_PlaystyleDef);
 }
@@ -11629,7 +11629,7 @@ static void M_Setup2PPlaystyleMenu(INT32 choice)
 	(void)choice;
 
 	playstyle_activeplayer = 1;
-	playstyle_currentchoice = cv_useranalog2.value ? 3 : (cv_abilitydirection[1].value ? 2 : cv_directionchar2.value);
+	playstyle_currentchoice = cv_useranalog[1].value ? 3 : (cv_abilitydirection[1].value ? 2 : cv_directionchar[1].value);
 	OP_PlaystyleDef.prevMenu = &OP_P2ControlsDef;
 	M_SetupNextMenu(&OP_PlaystyleDef);
 }
@@ -11670,8 +11670,8 @@ static void M_HandlePlaystyleMenu(INT32 choice)
 			else
 				CV_UpdateCamDist();
 		}
-		CV_SetValue((playstyle_activeplayer ? &cv_directionchar2 : &cv_directionchar), playstyle_currentchoice ? 1 : 0);
-		CV_SetValue((playstyle_activeplayer ? &cv_useranalog2 : &cv_useranalog), 0);
+		CV_SetValue((playstyle_activeplayer ? &cv_directionchar[1] : &cv_directionchar[0]), playstyle_currentchoice ? 1 : 0);
+		CV_SetValue((playstyle_activeplayer ? &cv_useranalog[1] : &cv_useranalog[0]), 0);
 
 		M_SetupNextMenu(currentMenu->prevMenu);
 		break;
diff --git a/src/m_misc.c b/src/m_misc.c
index 83c0c7bec2..0fe1b6087a 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -600,12 +600,12 @@ void M_SaveConfig(const char *filename)
 		CV_SetValue(&cv_usemouse, tutorialusemouse);
 		CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
 		CV_SetValue(&cv_mousemove, tutorialmousemove);
-		CV_SetValue(&cv_analog, tutorialanalog);
+		CV_SetValue(&cv_analog[0], tutorialanalog);
 		CV_SaveVariables(f);
 		CV_Set(&cv_usemouse, cv_usemouse.defaultvalue);
 		CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue);
 		CV_Set(&cv_mousemove, cv_mousemove.defaultvalue);
-		CV_Set(&cv_analog, cv_analog.defaultvalue);
+		CV_Set(&cv_analog[0], cv_analog[0].defaultvalue);
 	}
 	else
 		CV_SaveVariables(f);
diff --git a/src/p_map.c b/src/p_map.c
index 2d36f747cc..20b0eae056 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -632,7 +632,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
 		&& P_MobjFlip(tails->mo)*sonic->mo->momz <= 0)
 	{
 		if (sonic-players == consoleplayer && botingame)
-			CV_SetValue(&cv_analog2, false);
+			CV_SetValue(&cv_analog[1], false);
 		P_ResetPlayer(sonic);
 		P_SetTarget(&sonic->mo->tracer, tails->mo);
 		sonic->powers[pw_carry] = CR_PLAYER;
@@ -644,7 +644,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
 	}
 	else {
 		if (sonic-players == consoleplayer && botingame)
-			CV_SetValue(&cv_analog2, true);
+			CV_SetValue(&cv_analog[1], true);
 		P_SetTarget(&sonic->mo->tracer, NULL);
 		sonic->powers[pw_carry] = CR_NONE;
 	}
@@ -1621,7 +1621,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
 	}
 	else if (thing->player) {
 		if (thing->player-players == consoleplayer && botingame)
-			CV_SetValue(&cv_analog2, true);
+			CV_SetValue(&cv_analog[1], true);
 		if (thing->player->powers[pw_carry] == CR_PLAYER)
 		{
 			P_SetTarget(&thing->tracer, NULL);
diff --git a/src/p_setup.c b/src/p_setup.c
index e6bf684d72..babe0265e2 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -2304,7 +2304,7 @@ static void P_LevelInitStuff(void)
 	}
 
 	if (botingame)
-		CV_SetValue(&cv_analog2, true);
+		CV_SetValue(&cv_analog[1], true);
 }
 
 //
@@ -3180,26 +3180,26 @@ boolean P_SetupLevel(boolean skipprecip)
 		if (!cv_cam2_rotate.changed)
 			CV_Set(&cv_cam2_rotate, cv_cam2_rotate.defaultvalue);
 
-		if (!cv_analog.changed)
-			CV_SetValue(&cv_analog, 0);
-		if (!cv_analog2.changed)
-			CV_SetValue(&cv_analog2, 0);
+		if (!cv_analog[0].changed)
+			CV_SetValue(&cv_analog[0], 0);
+		if (!cv_analog[1].changed)
+			CV_SetValue(&cv_analog[1], 0);
 
 		displayplayer = consoleplayer; // Start with your OWN view, please!
 	}
 
-	if (cv_useranalog.value)
-		CV_SetValue(&cv_analog, true);
+	if (cv_useranalog[0].value)
+		CV_SetValue(&cv_analog[0], true);
 
-	if (splitscreen && cv_useranalog2.value)
-		CV_SetValue(&cv_analog2, true);
+	if (splitscreen && cv_useranalog[1].value)
+		CV_SetValue(&cv_analog[1], true);
 	else if (botingame)
-		CV_SetValue(&cv_analog2, true);
+		CV_SetValue(&cv_analog[1], true);
 
 	if (twodlevel)
 	{
-		CV_SetValue(&cv_analog2, false);
-		CV_SetValue(&cv_analog, false);
+		CV_SetValue(&cv_analog[1], false);
+		CV_SetValue(&cv_analog[0], false);
 	}
 
 	// clear special respawning que
diff --git a/src/p_user.c b/src/p_user.c
index bf6651a72f..215cd88eeb 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -1064,7 +1064,7 @@ void P_ResetPlayer(player_t *player)
 	player->onconveyor = 0;
 	player->skidtime = 0;
 	if (player-players == consoleplayer && botingame)
-		CV_SetValue(&cv_analog2, true);
+		CV_SetValue(&cv_analog[1], true);
 }
 
 // P_PlayerCanDamage
@@ -4438,7 +4438,7 @@ void P_DoJump(player_t *player, boolean soundandstate)
 			player->powers[pw_carry] = CR_NONE;
 			P_SetTarget(&player->mo->tracer, NULL);
 			if (player-players == consoleplayer && botingame)
-				CV_SetValue(&cv_analog2, true);
+				CV_SetValue(&cv_analog[1], true);
 		}
 		else if (player->powers[pw_carry] == CR_GENERIC)
 		{
@@ -9823,8 +9823,8 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
 		thiscam->angle = (thiscam == &camera) ? localangle : localangle2;
 		thiscam->aiming = (thiscam == &camera) ? localaiming : localaiming2;
 	}
-	else if (!(thiscam == &camera && (cv_cam_still.value || cv_analog.value))
-	&& !(thiscam == &camera2 && (cv_cam2_still.value || cv_analog2.value)))
+	else if (!(thiscam == &camera && (cv_cam_still.value || cv_analog[0].value))
+	&& !(thiscam == &camera2 && (cv_cam2_still.value || cv_analog[1].value)))
 	{
 		thiscam->angle = player->mo->angle;
 		thiscam->aiming = 0;
@@ -10029,14 +10029,14 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
 	else
 		angle = focusangle + FixedAngle(camrotate*FRACUNIT);
 
-	if (!resetcalled && (cv_analog.value || demoplayback) && ((thiscam == &camera && t_cam_rotate != -42) || (thiscam == &camera2
+	if (!resetcalled && (cv_analog[0].value || demoplayback) && ((thiscam == &camera && t_cam_rotate != -42) || (thiscam == &camera2
 		&& t_cam2_rotate != -42)))
 	{
 		angle = FixedAngle(camrotate*FRACUNIT);
 		thiscam->angle = angle;
 	}
 
-	if ((((thiscam == &camera) && cv_analog.value) || ((thiscam != &camera) && cv_analog2.value) || demoplayback) && !sign && !objectplacing && !(twodlevel || (mo->flags2 & MF2_TWOD)) && (player->powers[pw_carry] != CR_NIGHTSMODE) && displayplayer == consoleplayer)
+	if ((((thiscam == &camera) && cv_analog[0].value) || ((thiscam != &camera) && cv_analog[1].value) || demoplayback) && !sign && !objectplacing && !(twodlevel || (mo->flags2 & MF2_TWOD)) && (player->powers[pw_carry] != CR_NIGHTSMODE) && displayplayer == consoleplayer)
 	{
 #ifdef REDSANALOG
 		if ((player->cmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) == (BT_CAMLEFT|BT_CAMRIGHT)); else
@@ -12625,7 +12625,7 @@ void P_PlayerAfterThink(player_t *player)
 					P_SetTarget(&player->mo->tracer, NULL);
 
 				if (player-players == consoleplayer && botingame)
-					CV_SetValue(&cv_analog2, (player->powers[pw_carry] != CR_PLAYER));
+					CV_SetValue(&cv_analog[1], (player->powers[pw_carry] != CR_PLAYER));
 				break;
 			}
 			case CR_GENERIC: // being carried by some generic item
diff --git a/src/r_main.c b/src/r_main.c
index efea00af86..9cb0f3edbe 100644
--- a/src/r_main.c
+++ b/src/r_main.c
@@ -185,20 +185,20 @@ void SplitScreen_OnChange(void)
 
 static void ChaseCam_OnChange(void)
 {
-	if (!cv_chasecam.value || !cv_useranalog.value)
-		CV_SetValue(&cv_analog, 0);
+	if (!cv_chasecam.value || !cv_useranalog[0].value)
+		CV_SetValue(&cv_analog[0], 0);
 	else
-		CV_SetValue(&cv_analog, 1);
+		CV_SetValue(&cv_analog[0], 1);
 }
 
 static void ChaseCam2_OnChange(void)
 {
 	if (botingame)
 		return;
-	if (!cv_chasecam2.value || !cv_useranalog2.value)
-		CV_SetValue(&cv_analog2, 0);
+	if (!cv_chasecam2.value || !cv_useranalog[1].value)
+		CV_SetValue(&cv_analog[1], 0);
 	else
-		CV_SetValue(&cv_analog2, 1);
+		CV_SetValue(&cv_analog[1], 1);
 }
 
 static void FlipCam_OnChange(void)
-- 
GitLab