From 4a2492e8e1e798c478c8756acd0dde0b3c3dae6c Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 30 Dec 2019 15:34:43 -0600 Subject: [PATCH] Fix camera reset button --- src/d_netcmd.c | 8 ++++---- src/g_game.c | 7 +++++-- src/m_menu.c | 12 ++++++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 12a62a6b8..c7f1b765d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1508,9 +1508,9 @@ void SendWeaponPref(void) buf[0] = 0; if (cv_flipcam.value) buf[0] |= 1; - if (cv_analog[0].value) + if (cv_analog[0].value && cv_directionchar[0].value != 2) buf[0] |= 2; - if (cv_directionchar[0].value) + if (cv_directionchar[0].value == 1) buf[0] |= 4; if (cv_autobrake.value) buf[0] |= 8; @@ -1524,9 +1524,9 @@ void SendWeaponPref2(void) buf[0] = 0; if (cv_flipcam2.value) buf[0] |= 1; - if (cv_analog[1].value) + if (cv_analog[1].value && cv_directionchar[1].value != 2) buf[0] |= 2; - if (cv_directionchar[1].value) + if (cv_directionchar[1].value == 1) buf[0] |= 4; if (cv_autobrake2.value) buf[0] |= 8; diff --git a/src/g_game.c b/src/g_game.c index ce661cc97..86e0491cf 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -398,7 +398,7 @@ consvar_t cv_useranalog[2] = { }; // deez New User eXperiences -static CV_PossibleValue_t directionchar_cons_t[] = {{0, "Camera"}, {1, "Movement"}, {0, NULL}}; +static CV_PossibleValue_t directionchar_cons_t[] = {{0, "Camera"}, {1, "Movement"}, {2, "Simple Locked"}, {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} @@ -1412,7 +1412,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { if (controlstyle == CS_SIMPLE && !ticcmd_centerviewdown[forplayer] && !G_RingSlingerGametype()) { - CV_SetValue(&cv_directionchar[forplayer], 0); ///@TODO will break things + CV_SetValue(&cv_directionchar[forplayer], 2); *myangle = player->mo->angle; *myaiming = 0; @@ -1487,6 +1487,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) } } + if (ticcmd_centerviewdown[forplayer] && controlstyle == CS_SIMPLE) + controlstyle = CS_LEGACY; + if (PLAYERINPUTDOWN(ssplayer, gc_camreset)) { if (camera.chase && !resetdown[forplayer]) diff --git a/src/m_menu.c b/src/m_menu.c index ead0fe544..01baa9963 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4306,6 +4306,8 @@ const char *PlaystyleDesc[4] = { "instead!" }; +static UINT8 playstyle_activeplayer = 0, playstyle_currentchoice = 0; + static void M_DrawControlsDefMenu(void) { UINT8 opt = 0; @@ -4314,7 +4316,8 @@ static void M_DrawControlsDefMenu(void) if (currentMenu == &OP_P1ControlsDef) { - opt = cv_useranalog[0].value ? 3 - cv_directionchar[0].value : cv_directionchar[0].value; + opt = cv_directionchar[0].value ? 1 : 0; + opt = playstyle_currentchoice = cv_useranalog[0].value ? 3 - opt : opt; if (opt == 2) { @@ -4329,7 +4332,8 @@ static void M_DrawControlsDefMenu(void) } else { - opt = cv_useranalog[1].value ? 3 - cv_directionchar[1].value : cv_directionchar[1].value; + opt = cv_directionchar[1].value ? 1 : 0; + opt = playstyle_currentchoice = cv_useranalog[1].value ? 3 - opt : opt; if (opt == 2) { @@ -11608,14 +11612,11 @@ static void M_ChangeControl(INT32 choice) M_StartMessage(tmp, M_ChangecontrolResponse, MM_EVENTHANDLER); } -static UINT8 playstyle_activeplayer = 0, playstyle_currentchoice = 0; - static void M_Setup1PPlaystyleMenu(INT32 choice) { (void)choice; playstyle_activeplayer = 0; - playstyle_currentchoice = cv_useranalog[0].value ? 3 - cv_directionchar[0].value : cv_directionchar[0].value; OP_PlaystyleDef.prevMenu = &OP_P1ControlsDef; M_SetupNextMenu(&OP_PlaystyleDef); } @@ -11625,7 +11626,6 @@ static void M_Setup2PPlaystyleMenu(INT32 choice) (void)choice; playstyle_activeplayer = 1; - playstyle_currentchoice = cv_useranalog[1].value ? 3 - cv_directionchar[1].value : cv_directionchar[1].value; OP_PlaystyleDef.prevMenu = &OP_P2ControlsDef; M_SetupNextMenu(&OP_PlaystyleDef); }