mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Air failsafe boost
While in the air: release accelerate while at nearly-still speeds, and you'll preform a minisucle air drift boost. This mechanic is meant to fix the long-standing issue where you can get stuck in 0 speed in the air and not be able to do anything.
This commit is contained in:
parent
c7783945ca
commit
93c5942ceb
7 changed files with 63 additions and 1 deletions
|
|
@ -617,6 +617,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||||
|
|
||||||
rsp->airtime = (tic_t)LONG(players[i].airtime);
|
rsp->airtime = (tic_t)LONG(players[i].airtime);
|
||||||
rsp->driftInput = players[i].driftInput;
|
rsp->driftInput = players[i].driftInput;
|
||||||
|
rsp->airFailsafe = players[i].airFailsafe;
|
||||||
|
|
||||||
rsp->trickpanel = (UINT8)players[i].trickpanel;
|
rsp->trickpanel = (UINT8)players[i].trickpanel;
|
||||||
rsp->trickdelay = (boolean)players[i].trickdelay;
|
rsp->trickdelay = (boolean)players[i].trickdelay;
|
||||||
|
|
@ -779,6 +780,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||||
|
|
||||||
players[i].airtime = (tic_t)LONG(rsp->airtime);
|
players[i].airtime = (tic_t)LONG(rsp->airtime);
|
||||||
players[i].driftInput = (boolean)rsp->driftInput;
|
players[i].driftInput = (boolean)rsp->driftInput;
|
||||||
|
players[i].airFailsafe = (boolean)rsp->airFailsafe;
|
||||||
|
|
||||||
players[i].trickpanel = (UINT8)rsp->trickpanel;
|
players[i].trickpanel = (UINT8)rsp->trickpanel;
|
||||||
players[i].trickdelay = (boolean)rsp->trickdelay;
|
players[i].trickdelay = (boolean)rsp->trickdelay;
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,7 @@ typedef struct
|
||||||
INT32 kartstuff[NUMKARTSTUFF];
|
INT32 kartstuff[NUMKARTSTUFF];
|
||||||
tic_t airtime;
|
tic_t airtime;
|
||||||
boolean driftInput;
|
boolean driftInput;
|
||||||
|
boolean airFailsafe;
|
||||||
UINT8 trickpanel;
|
UINT8 trickpanel;
|
||||||
boolean trickdelay;
|
boolean trickdelay;
|
||||||
fixed_t trickmomx;
|
fixed_t trickmomx;
|
||||||
|
|
|
||||||
|
|
@ -525,6 +525,7 @@ typedef struct player_s
|
||||||
respawnvars_t respawn; // Respawn info
|
respawnvars_t respawn; // Respawn info
|
||||||
tic_t airtime; // Keep track of how long you've been in the air
|
tic_t airtime; // Keep track of how long you've been in the air
|
||||||
boolean driftInput; // Whenever or not try drifting.
|
boolean driftInput; // Whenever or not try drifting.
|
||||||
|
boolean airFailsafe; // Whenever or not try the air boost
|
||||||
|
|
||||||
UINT8 trickpanel; // Trick panel state
|
UINT8 trickpanel; // Trick panel state
|
||||||
boolean trickdelay; // Prevent tricks until control stick is neutral
|
boolean trickdelay; // Prevent tricks until control stick is neutral
|
||||||
|
|
|
||||||
50
src/k_kart.c
50
src/k_kart.c
|
|
@ -6984,6 +6984,7 @@ INT32 K_GetKartDriftSparkValue(player_t *player)
|
||||||
Stage 1: red sparks
|
Stage 1: red sparks
|
||||||
Stage 2: blue sparks
|
Stage 2: blue sparks
|
||||||
Stage 3: big large rainbow sparks
|
Stage 3: big large rainbow sparks
|
||||||
|
Stage 0: air failsafe
|
||||||
*/
|
*/
|
||||||
void K_SpawnDriftBoostExplosion(player_t *player, int stage)
|
void K_SpawnDriftBoostExplosion(player_t *player, int stage)
|
||||||
{
|
{
|
||||||
|
|
@ -7014,6 +7015,11 @@ void K_SpawnDriftBoostExplosion(player_t *player, int stage)
|
||||||
S_StartSound(player->mo, sfx_kc5b);
|
S_StartSound(player->mo, sfx_kc5b);
|
||||||
S_StartSound(player->mo, sfx_s3kc4l);
|
S_StartSound(player->mo, sfx_s3kc4l);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
overlay->color = SKINCOLOR_SILVER;
|
||||||
|
overlay->fuse = 16;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay->extravalue1 = stage;
|
overlay->extravalue1 = stage;
|
||||||
|
|
@ -7574,6 +7580,39 @@ static void K_KartSpindash(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void K_AirFailsafe(player_t *player)
|
||||||
|
{
|
||||||
|
const fixed_t maxSpeed = 6*player->mo->scale;
|
||||||
|
const fixed_t thrustSpeed = 6*player->mo->scale; // 10*player->mo->scale
|
||||||
|
|
||||||
|
ticcmd_t *cmd = &player->cmd;
|
||||||
|
|
||||||
|
if (player->speed > maxSpeed)
|
||||||
|
{
|
||||||
|
// Above the max speed that you're allowed to use this technique.
|
||||||
|
player->airFailsafe = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((cmd->buttons & BT_ACCELERATE) || K_GetForwardMove(player) != 0)
|
||||||
|
{
|
||||||
|
// Queue up later
|
||||||
|
player->airFailsafe = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player->airFailsafe == true)
|
||||||
|
{
|
||||||
|
// Push the player forward
|
||||||
|
P_Thrust(player->mo, K_MomentumAngle(player->mo), thrustSpeed);
|
||||||
|
|
||||||
|
S_StartSound(player->mo, sfx_s23c);
|
||||||
|
K_SpawnDriftBoostExplosion(player, 0);
|
||||||
|
|
||||||
|
player->airFailsafe = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// K_AdjustPlayerFriction
|
// K_AdjustPlayerFriction
|
||||||
//
|
//
|
||||||
|
|
@ -8447,9 +8486,18 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
K_KartDrift(player, P_IsObjectOnGround(player->mo)); // Not using onground, since we don't want this affected by spring pads
|
K_KartDrift(player, onground);
|
||||||
K_KartSpindash(player);
|
K_KartSpindash(player);
|
||||||
|
|
||||||
|
if (onground == false)
|
||||||
|
{
|
||||||
|
K_AirFailsafe(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player->airFailsafe = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Play the starting countdown sounds
|
// Play the starting countdown sounds
|
||||||
if (player == &players[g_localplayers[0]]) // Don't play louder in splitscreen
|
if (player == &players[g_localplayers[0]]) // Don't play louder in splitscreen
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,8 @@ static int player_get(lua_State *L)
|
||||||
lua_pushinteger(L, plr->airtime);
|
lua_pushinteger(L, plr->airtime);
|
||||||
else if (fastcmp(field,"driftInput"))
|
else if (fastcmp(field,"driftInput"))
|
||||||
lua_pushboolean(L, plr->driftInput);
|
lua_pushboolean(L, plr->driftInput);
|
||||||
|
else if (fastcmp(field,"airFailsafe"))
|
||||||
|
lua_pushboolean(L, plr->airFailsafe);
|
||||||
else if (fastcmp(field,"tumbleBounces"))
|
else if (fastcmp(field,"tumbleBounces"))
|
||||||
lua_pushinteger(L, plr->tumbleBounces);
|
lua_pushinteger(L, plr->tumbleBounces);
|
||||||
else if (fastcmp(field,"tumbleHeight"))
|
else if (fastcmp(field,"tumbleHeight"))
|
||||||
|
|
@ -533,6 +535,8 @@ static int player_set(lua_State *L)
|
||||||
plr->airtime = (tic_t)luaL_checkinteger(L, 3);
|
plr->airtime = (tic_t)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"driftInput"))
|
else if (fastcmp(field,"driftInput"))
|
||||||
plr->driftInput = luaL_checkboolean(L, 3);
|
plr->driftInput = luaL_checkboolean(L, 3);
|
||||||
|
else if (fastcmp(field,"airFailsafe"))
|
||||||
|
plr->airFailsafe = luaL_checkboolean(L, 3);
|
||||||
else if (fastcmp(field,"tumbleBounces"))
|
else if (fastcmp(field,"tumbleBounces"))
|
||||||
plr->tumbleBounces = (UINT8)luaL_checkinteger(L, 3);
|
plr->tumbleBounces = (UINT8)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"tumbleHeight"))
|
else if (fastcmp(field,"tumbleHeight"))
|
||||||
|
|
|
||||||
|
|
@ -6743,6 +6743,10 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
||||||
if (mobj->fuse == 16)/* to red*/
|
if (mobj->fuse == 16)/* to red*/
|
||||||
K_SpawnDriftBoostClip(mobj->target->player);
|
K_SpawnDriftBoostClip(mobj->target->player);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0:/* air failsafe boost */
|
||||||
|
mobj->color = SKINCOLOR_SILVER; // force white
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,7 @@ static void P_NetArchivePlayers(void)
|
||||||
|
|
||||||
WRITEUINT32(save_p, players[i].airtime);
|
WRITEUINT32(save_p, players[i].airtime);
|
||||||
WRITEUINT8(save_p, players[i].driftInput);
|
WRITEUINT8(save_p, players[i].driftInput);
|
||||||
|
WRITEUINT8(save_p, players[i].airFailsafe);
|
||||||
|
|
||||||
WRITEUINT8(save_p, players[i].trickpanel);
|
WRITEUINT8(save_p, players[i].trickpanel);
|
||||||
WRITEUINT8(save_p, players[i].trickdelay);
|
WRITEUINT8(save_p, players[i].trickdelay);
|
||||||
|
|
@ -463,6 +464,7 @@ static void P_NetUnArchivePlayers(void)
|
||||||
|
|
||||||
players[i].airtime = READUINT32(save_p);
|
players[i].airtime = READUINT32(save_p);
|
||||||
players[i].driftInput = (boolean)READUINT8(save_p);
|
players[i].driftInput = (boolean)READUINT8(save_p);
|
||||||
|
players[i].airFailsafe = (boolean)READUINT8(save_p);
|
||||||
|
|
||||||
players[i].trickpanel = READUINT8(save_p);
|
players[i].trickpanel = READUINT8(save_p);
|
||||||
players[i].trickdelay = READUINT8(save_p);
|
players[i].trickdelay = READUINT8(save_p);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue