mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'modify-throw-threshold' into 'master'
Make ticcmd throwdir -1, 0, or 1, add deadzone See merge request KartKrew/Kart!1802
This commit is contained in:
commit
3b610b140c
6 changed files with 36 additions and 33 deletions
|
|
@ -4799,7 +4799,7 @@ static void FuzzTiccmd(ticcmd_t* target)
|
|||
{
|
||||
target->forwardmove = P_RandomRange(PR_FUZZ, -MAXPLMOVE, MAXPLMOVE);
|
||||
target->turning = P_RandomRange(PR_FUZZ, -KART_FULLTURN, KART_FULLTURN);
|
||||
target->throwdir = P_RandomRange(PR_FUZZ, -KART_FULLTURN, KART_FULLTURN);
|
||||
target->throwdir = P_RandomRange(PR_FUZZ, -1, 1);
|
||||
target->buttons = P_RandomRange(PR_FUZZ, 0, 255);
|
||||
|
||||
// Make fuzzed players more likely to do impactful things
|
||||
|
|
@ -6002,7 +6002,7 @@ static void SV_Maketic(void)
|
|||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
packetloss[i][maketic%PACKETMEASUREWINDOW] = false;
|
||||
|
||||
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ class TiccmdBuilder
|
|||
|
||||
cmd->forwardmove = clamp(cmd->forwardmove, MAXPLMOVE);
|
||||
cmd->turning = clamp(cmd->turning, KART_FULLTURN);
|
||||
cmd->throwdir = clamp(cmd->throwdir, KART_FULLTURN);
|
||||
cmd->throwdir = clamp(cmd->throwdir, 1);
|
||||
|
||||
// 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.
|
||||
|
|
@ -338,9 +338,12 @@ class TiccmdBuilder
|
|||
}
|
||||
|
||||
// But forward/backward IS used for aiming.
|
||||
if (joystickvector.yaxis != 0)
|
||||
// throwdir > 0 throws forward, throwdir < 0 throws backward
|
||||
// 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 -= (joystickvector.yaxis * KART_FULLTURN) / JOYAXISRANGE;
|
||||
cmd->throwdir = -std::clamp(joystickvector.yaxis, -1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -374,7 +377,7 @@ class TiccmdBuilder
|
|||
kart_analog_input();
|
||||
|
||||
// Digital users can input diagonal-back for shallow turns.
|
||||
//
|
||||
//
|
||||
// There's probably some principled way of doing this in the gamepad handler itself,
|
||||
// by only applying this filtering to inputs sourced from an axis. This is a little
|
||||
// ugly with the current abstractions, though, and there's a fortunate trick here:
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ fixed_t K_BotMapModifier(void)
|
|||
{
|
||||
constexpr INT32 complexity_scale = 10000;
|
||||
constexpr fixed_t modifier_max = FRACUNIT * 2;
|
||||
|
||||
|
||||
const fixed_t complexity_value = std::clamp<fixed_t>(
|
||||
FixedDiv(K_GetTrackComplexity(), complexity_scale),
|
||||
-FixedDiv(FRACUNIT, modifier_max),
|
||||
|
|
@ -1206,10 +1206,10 @@ static void K_BotTrick(const player_t *player, ticcmd_t *cmd, const botcontrolle
|
|||
cmd->turning = -KART_FULLTURN;
|
||||
break;
|
||||
case TMBOTTR_UP:
|
||||
cmd->throwdir = KART_FULLTURN;
|
||||
cmd->throwdir = 1;
|
||||
break;
|
||||
case TMBOTTR_DOWN:
|
||||
cmd->throwdir = -KART_FULLTURN;
|
||||
cmd->throwdir = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1300,7 +1300,7 @@ static INT32 K_HandleBotTrack(const player_t *player, ticcmd_t *cmd, botpredicti
|
|||
{
|
||||
turnsign = 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
turnsign = -1;
|
||||
}
|
||||
|
|
@ -1436,7 +1436,7 @@ static INT32 K_HandleBotReverse(const player_t *player, ticcmd_t *cmd, botpredic
|
|||
turnsign = -1; // Turn right
|
||||
anglediff = AngleFixed(angle)>>FRACBITS;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
turnsign = 1; // Turn left
|
||||
anglediff = 360-(AngleFixed(angle)>>FRACBITS);
|
||||
|
|
@ -1457,7 +1457,7 @@ static INT32 K_HandleBotReverse(const player_t *player, ticcmd_t *cmd, botpredic
|
|||
{
|
||||
momdiff = AngleFixed(angle)>>FRACBITS;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
momdiff = 360-(AngleFixed(angle)>>FRACBITS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ static boolean K_BotGenericPressItem(const player_t *player, ticcmd_t *cmd, SINT
|
|||
return false;
|
||||
}
|
||||
|
||||
cmd->throwdir = KART_FULLTURN * dir;
|
||||
cmd->throwdir = std::clamp(static_cast<int>(dir), -1, 1);
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
//player->botvars.itemconfirm = 0;
|
||||
return true;
|
||||
|
|
@ -1023,7 +1023,7 @@ static void K_BotItemBallhog(const player_t *player, ticcmd_t *cmd)
|
|||
|
||||
if (hold == true)
|
||||
{
|
||||
cmd->throwdir = KART_FULLTURN * throwdir;
|
||||
cmd->throwdir = std::clamp(static_cast<int>(throwdir), -1, 1);
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
25
src/k_kart.c
25
src/k_kart.c
|
|
@ -3792,14 +3792,14 @@ void K_DoPowerClash(mobj_t *t1, mobj_t *t2) {
|
|||
{
|
||||
t1->player->instashield = 1;
|
||||
t1->player->speedpunt += 20;
|
||||
lag1 -= min(lag1, t1->player->speedpunt/10);
|
||||
lag1 -= min(lag1, t1->player->speedpunt/10);
|
||||
}
|
||||
|
||||
if (t2->player)
|
||||
{
|
||||
t2->player->instashield = 1;
|
||||
t2->player->speedpunt += 20;
|
||||
lag2 -= min(lag1, t2->player->speedpunt/10);
|
||||
lag2 -= min(lag1, t2->player->speedpunt/10);
|
||||
}
|
||||
|
||||
S_StartSound(t1, sfx_parry);
|
||||
|
|
@ -8151,7 +8151,7 @@ static void K_UpdateTripwire(player_t *player)
|
|||
if (triplevel != TRIPWIRE_CONSUME)
|
||||
player->tripwireLeniency = max(player->tripwireLeniency, TRIPWIRETIME);
|
||||
}
|
||||
|
||||
|
||||
// TRIPWIRE_CONSUME is only applied in very specific cases (currently, riding Garden Top)
|
||||
// and doesn't need leniency; however, it should track leniency from other pass conditions,
|
||||
// so that stripping Garden Top feels consistent.
|
||||
|
|
@ -8500,10 +8500,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
if (P_PlayerInPain(player))
|
||||
{
|
||||
player->ringboost = 0;
|
||||
player->ringboost = 0;
|
||||
}
|
||||
else if (player->ringboost)
|
||||
{
|
||||
{
|
||||
// These values can get FUCKED ever since ring-stacking speed changes.
|
||||
// If we're not actively being awarded rings, roll off extreme ringboost durations.
|
||||
if (player->superring == 0)
|
||||
|
|
@ -8528,7 +8528,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
if (player->flamedash)
|
||||
{
|
||||
player->flamedash--;
|
||||
|
||||
|
||||
if (player->flamedash == 0)
|
||||
S_StopSoundByID(player->mo, sfx_fshld1);
|
||||
else if (player->flamedash == 3 && player->curshield == KSHIELD_FLAME) // "Why 3?" We can't blend sounds so this is the best shit I've got
|
||||
|
|
@ -11595,7 +11595,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
UINT32 behind = K_GetItemRouletteDistance(player, player->itemRoulette.playing);
|
||||
UINT32 behindMulti = behind / 500;
|
||||
behindMulti = min(behindMulti, 60);
|
||||
|
||||
|
||||
|
||||
UINT32 award = 5*player->ringboxaward + 10;
|
||||
if (!cv_thunderdome.value)
|
||||
|
|
@ -12063,7 +12063,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->ballhogcharge++;
|
||||
if (player->ballhogcharge % BALLHOGINCREMENT == 0)
|
||||
{
|
||||
sfxenum_t hogsound[] =
|
||||
sfxenum_t hogsound[] =
|
||||
{
|
||||
sfx_bhog00,
|
||||
sfx_bhog01,
|
||||
|
|
@ -12608,11 +12608,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
const angle_t angledelta = FixedAngle(36*FRACUNIT);
|
||||
angle_t baseangle = player->mo->angle + angledelta/2;
|
||||
|
||||
INT16 aimingcompare = abs(cmd->throwdir) - abs(cmd->turning);
|
||||
boolean throwing = cmd->throwdir != 0;
|
||||
INT16 turnmagnitude = abs(cmd->turning);
|
||||
|
||||
// Uses cmd->turning over steering intentionally.
|
||||
#define TRICKTHRESHOLD (KART_FULLTURN/4)
|
||||
if (aimingcompare < -TRICKTHRESHOLD) // side trick
|
||||
if (abs(turnmagnitude) > TRICKTHRESHOLD && !throwing) // side trick
|
||||
{
|
||||
S_StartSoundAtVolume(player->mo, sfx_trick0, 255/2);
|
||||
player->dotrickfx = true;
|
||||
|
|
@ -12651,7 +12652,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetPlayerMobjState(player->mo, S_KART_FAST_LOOK_R);
|
||||
}
|
||||
}
|
||||
else if (aimingcompare > TRICKTHRESHOLD) // forward/back trick
|
||||
else if (abs(turnmagnitude) <= TRICKTHRESHOLD && throwing) // forward/back trick
|
||||
{
|
||||
S_StartSoundAtVolume(player->mo, sfx_trick0, 255/2);
|
||||
player->dotrickfx = true;
|
||||
|
|
@ -12722,7 +12723,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
if (P_MobjWasRemoved(player->trickIndicator) == false)
|
||||
trickcolor = player->trickIndicator->color;
|
||||
|
||||
if (player->trickpanel == TRICKSTATE_FORWARD)
|
||||
if (player->trickpanel == TRICKSTATE_FORWARD)
|
||||
{
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
|
|
|
|||
13
src/p_user.c
13
src/p_user.c
|
|
@ -2193,7 +2193,7 @@ static INT16 P_FindClosestTurningForAngle(player_t *player, INT32 targetAngle, I
|
|||
|
||||
// Slightly frumpy binary search for the ideal turning input.
|
||||
// We do this instead of reversing K_GetKartTurnValue so that future handling changes are automatically accounted for.
|
||||
|
||||
|
||||
while (attempts++ < 20) // Practical calls of this function search maximum 10 times, this is solely for safety.
|
||||
{
|
||||
// These need to be treated as signed, or situations where boundaries straddle 0 are a mess.
|
||||
|
|
@ -2314,7 +2314,7 @@ static void P_UpdatePlayerAngle(player_t *player)
|
|||
// Corrections via fake turn go through easing.
|
||||
// That means undoing them takes the same amount of time as doing them.
|
||||
// This can lead to oscillating death spiral states on a multi-tic correction, as we swing past the target angle.
|
||||
// So before we go into death-spirals, if our predicton is _almost_ right...
|
||||
// So before we go into death-spirals, if our predicton is _almost_ right...
|
||||
angle_t leniency = (4*ANG1/3) * min(player->cmd.latency, 6);
|
||||
// Don't force another turning tic, just give them the desired angle!
|
||||
|
||||
|
|
@ -2413,7 +2413,7 @@ void P_MovePlayer(player_t *player)
|
|||
//////////////////////
|
||||
|
||||
P_UpdatePlayerAngle(player);
|
||||
|
||||
|
||||
ticruned++;
|
||||
if (!(cmd->flags & TICCMD_RECEIVED))
|
||||
ticmiss++;
|
||||
|
|
@ -4131,12 +4131,11 @@ void P_PlayerThink(player_t *player)
|
|||
// Save the dir the player is holding
|
||||
// to allow items to be thrown forward or backward.
|
||||
{
|
||||
const INT16 threshold = 0; //(KART_FULLTURN / 2);
|
||||
if (cmd->throwdir > threshold)
|
||||
if (cmd->throwdir > 0)
|
||||
{
|
||||
player->throwdir = 1;
|
||||
}
|
||||
else if (cmd->throwdir < -threshold)
|
||||
else if (cmd->throwdir < 0)
|
||||
{
|
||||
player->throwdir = -1;
|
||||
}
|
||||
|
|
@ -4452,7 +4451,7 @@ void P_PlayerThink(player_t *player)
|
|||
{
|
||||
player->stairjank--;
|
||||
}
|
||||
|
||||
|
||||
// Random skin / "ironman"
|
||||
{
|
||||
UINT32 skinflags = (demo.playback)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue