Accel press to trick

This commit is contained in:
AJ Martinez 2024-05-01 00:05:15 -07:00
parent 9605abf66c
commit e2db57d141
4 changed files with 63 additions and 7 deletions

View file

@ -809,6 +809,7 @@ struct player_t
fixed_t trickboostpower; // Save the rough speed multiplier. Used for upwards tricks.
UINT8 trickboostdecay; // used to know how long you've waited
UINT8 trickboost; // Trick boost. This one is weird and has variable speed. Dear god.
UINT8 tricklock; // Input safety for 2.2 lenient tricks.
UINT8 dashRingPullTics; // Timer during which the player is pulled towards a dash ring
UINT8 dashRingPushTics; // Timer during which the player displays effects and has no gravity after being thrust by a dash ring

View file

@ -8816,6 +8816,18 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->ringdelay)
player->ringdelay--;
if (player->trickpanel == TRICKSTATE_READY)
{
if (!player->throwdir && !cmd->turning)
player->tricklock = TICRATE/10;
else if (player->tricklock)
player->tricklock--;
}
else
{
player->tricklock = 0;
}
if (P_PlayerInPain(player))
{
player->ringboost = 0;
@ -10437,10 +10449,14 @@ INT16 K_GetKartTurnValue(const player_t *player, INT16 turnvalue)
return 0;
}
if (player->trickpanel == TRICKSTATE_READY || player->trickpanel == TRICKSTATE_FORWARD)
// Staff ghosts - direction-only trickpanel behavior
if (G_CompatLevel(0x000A) || K_PlayerUsesBotMovement(player))
{
// Forward trick or rising from trickpanel
return 0;
if (player->trickpanel == TRICKSTATE_READY || player->trickpanel == TRICKSTATE_FORWARD)
{
// Forward trick or rising from trickpanel
return 0;
}
}
if (player->justDI > 0)
@ -10599,6 +10615,18 @@ INT16 K_GetKartTurnValue(const player_t *player, INT16 turnvalue)
turnfixed /= 2;
}
// 2.2 - Presteering allowed in trickpanels
if (!G_CompatLevel(0x000A) && !K_PlayerUsesBotMovement(player))
{
if (player->trickpanel == TRICKSTATE_READY || player->trickpanel == TRICKSTATE_FORWARD)
{
// Forward trick or rising from trickpanel
turnfixed /= 2;
if (player->tricklock)
turnfixed /= (player->tricklock/2 + 1);
}
}
return (turnfixed / FRACUNIT);
}
@ -13381,6 +13409,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
INT16 aimingcompare = abs(cmd->throwdir) - abs(cmd->turning);
// 2.2 - Pre-steering trickpanels
if (!G_CompatLevel(0x000A) && !K_PlayerUsesBotMovement(player))
{
if (!(player->cmd.buttons & BT_ACCELERATE))
{
aimingcompare = 0;
}
}
// Uses cmd->turning over steering intentionally.
#define TRICKTHRESHOLD (KART_FULLTURN/2)
if (aimingcompare < -TRICKTHRESHOLD) // side trick
@ -13611,12 +13648,24 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->trickboostdecay = 0;
}
// Wait until we let go off the control stick to remove the delay
// buttons must be neutral after the initial trick delay. This prevents weirdness where slight nudges after blast off would send you flying.
if ((player->pflags & PF_TRICKDELAY) && !player->throwdir && !cmd->turning && (player->tricktime >= TRICKDELAY))
// 2.2 - Lenient trickpanels
if (G_CompatLevel(0x000A) || K_PlayerUsesBotMovement(player))
{
player->pflags &= ~PF_TRICKDELAY;
// Wait until we let go off the control stick to remove the delay
// buttons must be neutral after the initial trick delay. This prevents weirdness where slight nudges after blast off would send you flying.
if ((player->pflags & PF_TRICKDELAY) && !player->throwdir && !cmd->turning && (player->tricktime >= TRICKDELAY))
{
player->pflags &= ~PF_TRICKDELAY;
}
}
else
{
if ((player->pflags & PF_TRICKDELAY) && !(player->cmd.buttons & BT_ACCELERATE) && (player->tricktime >= TRICKDELAY))
{
player->pflags &= ~PF_TRICKDELAY;
}
}
}
K_KartDrift(player, onground);

View file

@ -476,6 +476,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->trickboostdecay);
else if (fastcmp(field,"trickboost"))
lua_pushinteger(L, plr->trickboost);
else if (fastcmp(field,"tricklock"))
lua_pushinteger(L, plr->tricklock);
else if (fastcmp(field,"dashringpulltics"))
lua_pushinteger(L, plr->dashRingPullTics);
else if (fastcmp(field,"dashringpushtics"))
@ -1026,6 +1028,8 @@ static int player_set(lua_State *L)
plr->trickboostdecay = luaL_checkinteger(L, 3);
else if (fastcmp(field,"trickboost"))
plr->trickboost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tricklock"))
plr->tricklock = luaL_checkinteger(L, 3);
else if (fastcmp(field,"dashringpulltics"))
plr->dashRingPullTics = luaL_checkinteger(L, 3);
else if (fastcmp(field,"dashringpushtics"))

View file

@ -540,6 +540,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT32(save->p, players[i].trickboostpower);
WRITEUINT8(save->p, players[i].trickboostdecay);
WRITEUINT8(save->p, players[i].trickboost);
WRITEUINT8(save->p, players[i].tricklock);
WRITEUINT8(save->p, players[i].dashRingPullTics);
WRITEUINT8(save->p, players[i].dashRingPushTics);
@ -1138,6 +1139,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].trickboostpower = READUINT32(save->p);
players[i].trickboostdecay = READUINT8(save->p);
players[i].trickboost = READUINT8(save->p);
players[i].tricklock = READUINT8(save->p);
players[i].dashRingPullTics = READUINT8(save->p);
players[i].dashRingPushTics = READUINT8(save->p);