Revert "Make ticcmd throwdir -1, 0, or 1, add deadzone"

This reverts commit 9028668104.
This commit is contained in:
AJ Martinez 2024-02-28 18:33:07 -07:00
parent e1db54198f
commit 64dd306138
6 changed files with 33 additions and 36 deletions

View file

@ -4739,7 +4739,7 @@ static void FuzzTiccmd(ticcmd_t* target)
{ {
target->forwardmove = P_RandomRange(PR_FUZZ, -MAXPLMOVE, MAXPLMOVE); target->forwardmove = P_RandomRange(PR_FUZZ, -MAXPLMOVE, MAXPLMOVE);
target->turning = P_RandomRange(PR_FUZZ, -KART_FULLTURN, KART_FULLTURN); target->turning = P_RandomRange(PR_FUZZ, -KART_FULLTURN, KART_FULLTURN);
target->throwdir = P_RandomRange(PR_FUZZ, -1, 1); target->throwdir = P_RandomRange(PR_FUZZ, -KART_FULLTURN, KART_FULLTURN);
target->buttons = P_RandomRange(PR_FUZZ, 0, 255); target->buttons = P_RandomRange(PR_FUZZ, 0, 255);
// Make fuzzed players more likely to do impactful things // Make fuzzed players more likely to do impactful things

View file

@ -164,7 +164,7 @@ class TiccmdBuilder
cmd->forwardmove = clamp(cmd->forwardmove, MAXPLMOVE); cmd->forwardmove = clamp(cmd->forwardmove, MAXPLMOVE);
cmd->turning = clamp(cmd->turning, KART_FULLTURN); cmd->turning = clamp(cmd->turning, KART_FULLTURN);
cmd->throwdir = clamp(cmd->throwdir, 1); cmd->throwdir = clamp(cmd->throwdir, KART_FULLTURN);
// Send leveltime when this tic was generated to the server for control lag calculations. // Send leveltime when this tic was generated to the server for control lag calculations.
// Only do this when in a level. Also do this after the hook, so that it can't overwrite this. // Only do this when in a level. Also do this after the hook, so that it can't overwrite this.
@ -343,12 +343,9 @@ class TiccmdBuilder
} }
// But forward/backward IS used for aiming. // But forward/backward IS used for aiming.
// throwdir > 0 throws forward, throwdir < 0 throws backward if (joystickvector.yaxis != 0)
// but we always use -1, 0 or 1 for consistency here.
// this allows the throw deadzone to be adjusted in the future without breaking demos
if (std::abs(joystickvector.yaxis) > JOYAXISRANGE / 2)
{ {
cmd->throwdir = -std::clamp(joystickvector.yaxis, -1, 1); cmd->throwdir -= (joystickvector.yaxis * KART_FULLTURN) / JOYAXISRANGE;
} }
} }

View file

@ -1210,10 +1210,10 @@ static void K_BotTrick(const player_t *player, ticcmd_t *cmd, const botcontrolle
cmd->turning = -KART_FULLTURN; cmd->turning = -KART_FULLTURN;
break; break;
case TMBOTTR_UP: case TMBOTTR_UP:
cmd->throwdir = 1; cmd->throwdir = KART_FULLTURN;
break; break;
case TMBOTTR_DOWN: case TMBOTTR_DOWN:
cmd->throwdir = -1; cmd->throwdir = -KART_FULLTURN;
break; break;
} }
} }

View file

@ -366,7 +366,7 @@ static boolean K_BotGenericPressItem(const player_t *player, ticcmd_t *cmd, SINT
return false; return false;
} }
cmd->throwdir = std::clamp(static_cast<int>(dir), -1, 1); cmd->throwdir = KART_FULLTURN * dir;
cmd->buttons |= BT_ATTACK; cmd->buttons |= BT_ATTACK;
//player->botvars.itemconfirm = 0; //player->botvars.itemconfirm = 0;
return true; return true;
@ -1023,7 +1023,7 @@ static void K_BotItemBallhog(const player_t *player, ticcmd_t *cmd)
if (hold == true) if (hold == true)
{ {
cmd->throwdir = std::clamp(static_cast<int>(throwdir), -1, 1); cmd->throwdir = KART_FULLTURN * throwdir;
cmd->buttons |= BT_ATTACK; cmd->buttons |= BT_ATTACK;
} }
} }

View file

@ -12800,12 +12800,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
const angle_t angledelta = FixedAngle(36*FRACUNIT); const angle_t angledelta = FixedAngle(36*FRACUNIT);
angle_t baseangle = player->mo->angle + angledelta/2; angle_t baseangle = player->mo->angle + angledelta/2;
boolean throwing = cmd->throwdir != 0; INT16 aimingcompare = abs(cmd->throwdir) - abs(cmd->turning);
INT16 turnmagnitude = abs(cmd->turning);
// Uses cmd->turning over steering intentionally. // Uses cmd->turning over steering intentionally.
#define TRICKTHRESHOLD (KART_FULLTURN/4) #define TRICKTHRESHOLD (KART_FULLTURN/4)
if (abs(turnmagnitude) > TRICKTHRESHOLD && !throwing) // side trick if (aimingcompare < -TRICKTHRESHOLD) // side trick
{ {
S_StartSoundAtVolume(player->mo, sfx_trick0, 255/2); S_StartSoundAtVolume(player->mo, sfx_trick0, 255/2);
player->dotrickfx = true; player->dotrickfx = true;
@ -12844,7 +12843,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
P_SetPlayerMobjState(player->mo, S_KART_FAST_LOOK_R); P_SetPlayerMobjState(player->mo, S_KART_FAST_LOOK_R);
} }
} }
else if (abs(turnmagnitude) <= TRICKTHRESHOLD && throwing) // forward/back trick else if (aimingcompare > TRICKTHRESHOLD) // forward/back trick
{ {
S_StartSoundAtVolume(player->mo, sfx_trick0, 255/2); S_StartSoundAtVolume(player->mo, sfx_trick0, 255/2);
player->dotrickfx = true; player->dotrickfx = true;

View file

@ -4075,11 +4075,12 @@ void P_PlayerThink(player_t *player)
// Save the dir the player is holding // Save the dir the player is holding
// to allow items to be thrown forward or backward. // to allow items to be thrown forward or backward.
{ {
if (cmd->throwdir > 0) const INT16 threshold = 0; //(KART_FULLTURN / 2);
if (cmd->throwdir > threshold)
{ {
player->throwdir = 1; player->throwdir = 1;
} }
else if (cmd->throwdir < 0) else if (cmd->throwdir < -threshold)
{ {
player->throwdir = -1; player->throwdir = -1;
} }