From 01b942e1fcecedc1f671abf78197e1bac678bdaf Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 2 Jan 2025 06:47:04 +0100 Subject: [PATCH] giga shizo spec synch "fix" ok so, for whatever dumb reason, spectatormovement will desynch at random, even on localhost. with this we just literally fucking ignore almost every button input locally and just wont move our spectator player at all. but since we are indeed still runiing specatotr movement code, and this is localcmd shit, the server just thinks we dont want to move and thus is "synchsave". sadly this does not fix desynchs from vanilla players the only code we keep is for button inputs that do certain actions like "item" so we can still join from spec with it and other crap --- src/g_game.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/p_user.c | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 385b7b6cf..59ff420cd 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -905,6 +905,46 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) break; } + if (player->spectator) + { + axis = JoyAxis(AXISMOVE, ssplayer); + if (InputDown(gc_accelerate, ssplayer) || (usejoystick && axis > 0)) + cmd->buttons |= BT_ACCELERATE; + axis = JoyAxis(AXISBRAKE, ssplayer); + if (InputDown(gc_brake, ssplayer) || (usejoystick && axis > 0)) + cmd->buttons |= BT_BRAKE; + axis = JoyAxis(AXISFIRE, ssplayer); + if (InputDown(gc_fire, ssplayer) || (usejoystick && axis > 0)) + cmd->buttons |= BT_ATTACK; + + // drift with any button/key + axis = JoyAxis(AXISDRIFT, ssplayer); + if (InputDown(gc_drift, ssplayer) || (usejoystick && axis > 0)) + cmd->buttons |= BT_DRIFT; + + // Lua scriptable buttons + axis = JoyAxis(AXISCUSTOM1, ssplayer); + if (InputDown(gc_custom1, ssplayer) || (usejoystick && axis > 0)) + cmd->buttons |= BT_CUSTOM1; + axis = JoyAxis(AXISCUSTOM2, ssplayer); + if (InputDown(gc_custom2, ssplayer) || (usejoystick && axis > 0)) + cmd->buttons |= BT_CUSTOM2; + axis = JoyAxis(AXISCUSTOM3, ssplayer); + if (InputDown(gc_custom3, ssplayer) || (usejoystick && axis > 0)) + cmd->buttons |= BT_CUSTOM3; + + // Reset camera + if (InputDown(gc_camreset, ssplayer)) + { + if (thiscam->chase && !rd) + P_ResetCamera(player, thiscam); + rd = true; + } + else + rd = false; + return; + } + // why build a ticcmd if we're paused? // Or, for that matter, if we're being reborn. // Kart, don't build a ticcmd if someone is resynching or the server is stopped too so we don't fly off course in bad conditions diff --git a/src/p_user.c b/src/p_user.c index 1919cc007..19a25513b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2109,7 +2109,7 @@ static void P_SpectatorMovement(player_t *player) { ticcmd_t *cmd = &player->cmd; - player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */); + player->mo->angle = (angle_t)(cmd->angleturn<<16 /* not FRACBITS */); ticruned++; if (!(cmd->angleturn & TICCMD_RECEIVED))