From dc6904fad29d9beb25e307a4f0be6554147e2c89 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 2aaece85e..2199fe6d5 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -844,20 +844,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. @@ -876,11 +870,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 6325e662e..673601dc4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3141,7 +3141,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 { @@ -3322,13 +3324,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 = (angle_t)cmd->angleturn << 16; @@ -3360,7 +3363,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.