From 64a2fe141060f29eb40e85470a684dece9802277 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 3 Jan 2025 07:33:28 +0100 Subject: [PATCH] clean shit up even more + fix cam aiming reset dont really care about which input anyways. --- src/g_game.c | 17 ++++++----------- src/p_user.c | 9 ++++++--- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 207513fd7..ad14a83f6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -846,20 +846,14 @@ static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // but we need this if we dont want spectators to move but be able to go to freecam from watching someone static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer) { - boolean forward = false; + boolean moveinput = false; INT32 axis = 0; const UINT8 forplayer = (ssplayer-1); const boolean usejoystick = (cv_usejoystick[forplayer].value); - boolean turn = (InputDown(gc_turnleft, ssplayer) || InputDown(gc_turnright, ssplayer)); - axis = JoyAxis(AXISTURN, ssplayer); - boolean side = (turn || (usejoystick && axis != 0)); - - axis = JoyAxis(AXISAIM, ssplayer); - if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0)) - forward = true; - if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0)) - forward = true; + moveinput = (InputDown(gc_turnleft, ssplayer) || InputDown(gc_turnright, ssplayer) + || InputDown(gc_aimforward, ssplayer) || InputDown(gc_aimbackward, ssplayer) || + (usejoystick && JoyAxis(AXISAIM, ssplayer) != 0) || (usejoystick && JoyAxis(AXISTURN, ssplayer) != 0)); // check for inputs and return button commands // for stuff like joining with item button, etc. @@ -878,11 +872,12 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer) #undef CHECKINPUT // Reset to our spec player if we watch someone else. - if ((forward || side || cmd->buttons) + if ((moveinput || cmd->buttons) && displayplayers[0] != consoleplayer && ssplayer == 1) { displayplayers[0] = consoleplayer; R_ResetViewInterpolation(0); + camera[0].reset_aiming = true; } } diff --git a/src/p_user.c b/src/p_user.c index 6f4b2c471..9182001c6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3144,7 +3144,9 @@ void P_ToggleDemoCamera(UINT8 viewnum) // dont let freecam be toggled when in spec lel if (players[displayplayers[viewnum]].spectator) + { return; + } if (!cam->freecam) // toggle on { @@ -3328,13 +3330,14 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num) // let centerview work proper if (InputDown(gc_centerview, forplayer)) + { cam->aiming = 0; + cam->reset_aiming = false; + } if (cmd->aiming != 0) { cam->aiming = cmd->aiming << FRACBITS; - - cam->reset_aiming = false; } cam->angle = cmd->angleturn << 16; @@ -3366,7 +3369,7 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num) // if you hold item, you will lock on to displayplayer. (The last player you were ""f12-ing"") // well this only really works in replays for us, since we still move our spec player around which causes displayplayer to be the spec player - if (cmd->buttons & BT_ATTACK) + if (cam->freecam && cmd->buttons & BT_ATTACK) { lastp = &players[displayplayers[0]]; // Fun fact, I was trying displayplayers[0]->mo as if it was Lua like an absolute idiot.