diff --git a/src/g_demo.c b/src/g_demo.c index fc9181717..8f2a111dc 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -3658,7 +3658,6 @@ void G_StopDemo(void) democam.soundmobj = NULL; democam.localangle = 0; democam.localaiming = 0; - democam.turnheld = false; democam.keyboardlook = false; if (gamestate == GS_INTERMISSION) diff --git a/src/g_game.c b/src/g_game.c index 9a766dc42..c018ef746 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -867,8 +867,6 @@ static void G_HandleAxisDeadZone(UINT8 splitnum, joystickvector2_t *joystickvect INT32 localaiming[MAXSPLITSCREENPLAYERS]; angle_t localangle[MAXSPLITSCREENPLAYERS]; -static INT32 angleturn[2] = {KART_FULLTURN, KART_FULLTURN / 4}; // + slow turn - void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { const UINT8 forplayer = ssplayer-1; @@ -879,11 +877,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) const boolean gamepadjoystickmove = cv_usejoystick[forplayer].value && Joystick[forplayer].bGamepadStyle; const boolean usejoystick = (analogjoystickmove || gamepadjoystickmove); - static INT32 turnheld[MAXSPLITSCREENPLAYERS]; // for accelerative turning static boolean keyboard_look[MAXSPLITSCREENPLAYERS]; // true if lookup/down using keyboard static boolean resetdown[MAXSPLITSCREENPLAYERS]; // don't cam reset every frame - INT32 tspeed, forward, axis; + INT32 forward, axis; joystickvector2_t joystickvector; @@ -891,11 +888,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) player_t *player = &players[g_localplayers[forplayer]]; camera_t *thiscam = &camera[forplayer]; - INT32 *th = &turnheld[forplayer]; boolean *kbl = &keyboard_look[forplayer]; boolean *rd = &resetdown[forplayer]; const boolean mouseaiming = player->spectator; + (void)realtics; + if (demo.playback) return; // Is there any reason this can't just be I_BaseTiccmd? @@ -958,39 +956,27 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) } forward = 0; - // use two stage accelerative turning - // on the keyboard and joystick - if (turnleft || turnright) - *th += realtics; - else - *th = 0; - - if (*th < SLOWTURNTICS) - tspeed = 1; // slow turn - else - tspeed = 0; - cmd->turning = 0; // let movement keys cancel each other out if (turnright && !(turnleft)) { - cmd->turning = (INT16)(cmd->turning - (angleturn[tspeed])); + cmd->turning -= KART_FULLTURN; } else if (turnleft && !(turnright)) { - cmd->turning = (INT16)(cmd->turning + (angleturn[tspeed])); + cmd->turning += KART_FULLTURN; } if (analogjoystickmove && joystickvector.xaxis != 0) { - cmd->turning = (INT16)(cmd->turning - (((joystickvector.xaxis * angleturn[0]) >> 10))); + cmd->turning -= (joystickvector.xaxis * KART_FULLTURN) >> 10; } // Specator mouse turning if (player->spectator) { - cmd->turning = (INT16)(cmd->turning - ((mousex*(encoremode ? -1 : 1)*8))); + cmd->turning -= (mousex * 8) * (encoremode ? -1 : 1); } if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls @@ -1125,7 +1111,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) cmd->forwardmove += (SINT8)forward; - cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations + cmd->latency = (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations cmd->flags = 0; if (chat_on || CON_Ready()) @@ -1156,10 +1142,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) else if (cmd->forwardmove < -MAXPLMOVE) cmd->forwardmove = -MAXPLMOVE; - if (cmd->turning > (angleturn[0])) - cmd->turning = (angleturn[0]); - else if (cmd->turning < (-angleturn[0])) - cmd->turning = (-angleturn[0]); + if (cmd->turning > KART_FULLTURN) + cmd->turning = KART_FULLTURN; + else if (cmd->turning < -KART_FULLTURN) + cmd->turning = -KART_FULLTURN; // Reset away view if a command is given. if ((cmd->forwardmove || cmd->buttons) diff --git a/src/m_menu.c b/src/m_menu.c index 28570c699..1a3c54738 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6146,7 +6146,6 @@ static void M_PlaybackToggleFreecam(INT32 choice) demo.freecam = false; // reset democam vars: democam.cam = NULL; - democam.turnheld = false; democam.keyboardlook = false; // reset only these. localangle / aiming gets set before the cam does anything anyway } } diff --git a/src/p_user.c b/src/p_user.c index 7b79d5627..10cb61335 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2771,9 +2771,7 @@ fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42}; // Heavily simplified version of G_BuildTicCmd that only takes the local first player's control input and converts it to readable ticcmd_t // we then throw that ticcmd garbage in the camera and make it move - -// redefine this -static fixed_t angleturn[2] = {KART_FULLTURN, KART_FULLTURN/4}; // + slow turn +// TODO: please just use the normal ticcmd function somehow static ticcmd_t cameracmd; @@ -2787,7 +2785,7 @@ void P_InitCameraCmd(void) static ticcmd_t *P_CameraCmd(camera_t *cam) { - INT32 th, tspeed, forward, axis; //i + INT32 forward, axis; //i // these ones used for multiple conditions boolean turnleft, turnright, mouseaiming; boolean invertmouse, lookaxis, usejoystick, kbl; @@ -2800,7 +2798,6 @@ static ticcmd_t *P_CameraCmd(camera_t *cam) if (!demo.playback) return cmd; // empty cmd, no. - th = democam.turnheld; kbl = democam.keyboardlook; G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver @@ -2830,31 +2827,19 @@ static ticcmd_t *P_CameraCmd(camera_t *cam) } forward = 0; - // use two stage accelerative turning - // on the keyboard and joystick - if (turnleft || turnright) - th += 1; - else - th = 0; - - if (th < SLOWTURNTICS) - tspeed = 1; // slow turn - else - tspeed = 0; - cmd->turning = 0; // let movement keys cancel each other out if (turnright && !(turnleft)) { - cmd->turning = (INT16)(cmd->turning - (angleturn[tspeed])); + cmd->turning -= KART_FULLTURN; } else if (turnleft && !(turnright)) { - cmd->turning = (INT16)(cmd->turning + (angleturn[tspeed])); + cmd->turning += KART_FULLTURN; } - cmd->turning = (INT16)(cmd->turning - ((mousex*(encoremode ? -1 : 1)*8))); + cmd->turning -= (mousex * 8) * (encoremode ? -1 : 1); axis = PlayerJoyAxis(1, AXISMOVE); if (PlayerInputDown(1, gc_accelerate) || (usejoystick && axis > 0)) @@ -2912,7 +2897,11 @@ static ticcmd_t *P_CameraCmd(camera_t *cam) else if (cmd->forwardmove < -MAXPLMOVE) cmd->forwardmove = -MAXPLMOVE; - democam.turnheld = th; + if (cmd->turning > KART_FULLTURN) + cmd->turning = KART_FULLTURN; + else if (cmd->turning < -KART_FULLTURN) + cmd->turning = -KART_FULLTURN; + democam.keyboardlook = kbl; return cmd;