Merge branch 'easy-top-bounce' into 'master'

Slow down top if player's out of control

Closes #627

See merge request KartKrew/Kart!1836
This commit is contained in:
Sal 2024-01-14 21:04:21 +00:00
commit 65aaf679b6
6 changed files with 38 additions and 2 deletions

View file

@ -953,6 +953,8 @@ struct player_t
UINT8 lastsafelap;
fixed_t topAccel; // Reduced on straight wall collisions to give players extra recovery time
mobj_t *stumbleIndicator;
mobj_t *wavedashIndicator;
mobj_t *trickIndicator;

View file

@ -2363,6 +2363,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
p->ringvolume = 255;
p->topAccel = MAXTOPACCEL;
p->botvars.rubberband = FRACUNIT;
p->spectatorReentry = spectatorReentry;

View file

@ -3531,7 +3531,7 @@ fixed_t K_GetKartAccel(const player_t *player)
// Marble Garden Top gets 1200% accel
if (player->curshield == KSHIELD_TOP)
{
k_accel *= 12;
k_accel = FixedMul(k_accel, player->topAccel);
}
if (K_PodiumSequence() == true)
@ -3646,7 +3646,17 @@ SINT8 K_GetForwardMove(const player_t *player)
}
else
{
forwardmove = MAXPLMOVE;
// forwardmove = MAXPLMOVE;
UINT8 minmove = MAXPLMOVE/10;
fixed_t assistmove = (MAXPLMOVE - minmove) * FRACUNIT;
angle_t topdelta = player->mo->angle - K_MomentumAngle(player->mo);
fixed_t topmult = FINECOSINE(topdelta >> ANGLETOFINESHIFT);
topmult = (topmult/2) + (FRACUNIT/2);
assistmove = FixedMul(topmult, assistmove);
forwardmove = minmove + FixedInt(assistmove);
}
}
@ -8718,6 +8728,17 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
}
}
// Players that bounce far off walls get reduced Top accel, to give them some time to get their bearings.
if ((player->mo->eflags & MFE_JUSTBOUNCEDWALL) && player->curshield == KSHIELD_TOP)
{
angle_t topdelta = player->mo->angle - K_MomentumAngle(player->mo);
fixed_t topmult = FINECOSINE(topdelta >> ANGLETOFINESHIFT);
topmult = (topmult/2) + (FRACUNIT/2); // 0 to original
player->topAccel = FixedMul(topmult, player->topAccel);
}
player->topAccel = min(player->topAccel + TOPACCELREGEN, MAXTOPACCEL);
if (player->stealingtimer == 0
&& player->rocketsneakertimer
&& onground == true)

View file

@ -52,6 +52,9 @@ Make sure this matches the actual number of states
#define RINGVOLUMEUSEPENALTY 15
#define RINGVOLUMEREGEN 1
#define MAXTOPACCEL (12*FRACUNIT)
#define TOPACCELREGEN (FRACUNIT/16)
// Mispredicted turns can generate phantom sliptide inputs for a few tics.
// Delay the wavedash visuals until we're reasonably sure that it's a deliberate turn.
#define HIDEWAVEDASHCHARGE (60)

View file

@ -345,6 +345,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->finalfailsafe);
else if (fastcmp(field,"lastsafelap"))
lua_pushinteger(L, plr->lastsafelap);
else if (fastcmp(field,"topAccel"))
lua_pushinteger(L, plr->topAccel);
else if (fastcmp(field,"instaWhipCharge"))
lua_pushinteger(L, plr->instaWhipCharge);
else if (fastcmp(field,"defenseLockout"))
@ -865,6 +867,8 @@ static int player_set(lua_State *L)
plr->finalfailsafe = luaL_checkinteger(L, 3);
else if (fastcmp(field,"lastsafelap"))
plr->lastsafelap = luaL_checkinteger(L, 3);
else if (fastcmp(field,"topAccel"))
plr->topAccel = luaL_checkinteger(L, 3);
else if (fastcmp(field,"instaWhipCharge"))
plr->instaWhipCharge = luaL_checkinteger(L, 3);
else if (fastcmp(field,"defenseLockout"))

View file

@ -571,6 +571,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].lastsafelap);
WRITEFIXED(save->p, players[i].topAccel);
WRITEMEM(save->p, players[i].public_key, PUBKEYLENGTH);
WRITEUINT8(save->p, players[i].instaWhipCharge);
@ -1142,6 +1144,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].lastsafelap = READUINT8(save->p);
players[i].topAccel = READFIXED(save->p);
READMEM(save->p, players[i].public_key, PUBKEYLENGTH);
players[i].instaWhipCharge = READUINT8(save->p);