mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'trick-panel-controls' into 'master'
Accel press to trick See merge request KartKrew/Kart!2332
This commit is contained in:
commit
fb9aeb3466
9 changed files with 78 additions and 7 deletions
|
|
@ -810,6 +810,7 @@ struct player_t
|
||||||
fixed_t trickboostpower; // Save the rough speed multiplier. Used for upwards tricks.
|
fixed_t trickboostpower; // Save the rough speed multiplier. Used for upwards tricks.
|
||||||
UINT8 trickboostdecay; // used to know how long you've waited
|
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 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 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
|
UINT8 dashRingPushTics; // Timer during which the player displays effects and has no gravity after being thrust by a dash ring
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,7 @@ patch_t *kp_button_up[2];
|
||||||
patch_t *kp_button_down[2];
|
patch_t *kp_button_down[2];
|
||||||
patch_t *kp_button_right[2];
|
patch_t *kp_button_right[2];
|
||||||
patch_t *kp_button_left[2];
|
patch_t *kp_button_left[2];
|
||||||
|
patch_t *kp_button_dpad[2];
|
||||||
|
|
||||||
static void K_LoadButtonGraphics(patch_t *kp[2], int letter)
|
static void K_LoadButtonGraphics(patch_t *kp[2], int letter)
|
||||||
{
|
{
|
||||||
|
|
@ -910,6 +911,7 @@ void K_LoadKartHUDGraphics(void)
|
||||||
K_LoadButtonGraphics(kp_button_down, 'K');
|
K_LoadButtonGraphics(kp_button_down, 'K');
|
||||||
K_LoadButtonGraphics(kp_button_right, 'L');
|
K_LoadButtonGraphics(kp_button_right, 'L');
|
||||||
K_LoadButtonGraphics(kp_button_left, 'M');
|
K_LoadButtonGraphics(kp_button_left, 'M');
|
||||||
|
K_LoadButtonGraphics(kp_button_dpad, 'T');
|
||||||
}
|
}
|
||||||
|
|
||||||
// For the item toggle menu
|
// For the item toggle menu
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ extern patch_t *kp_button_up[2];
|
||||||
extern patch_t *kp_button_down[2];
|
extern patch_t *kp_button_down[2];
|
||||||
extern patch_t *kp_button_right[2];
|
extern patch_t *kp_button_right[2];
|
||||||
extern patch_t *kp_button_left[2];
|
extern patch_t *kp_button_left[2];
|
||||||
|
extern patch_t *kp_button_dpad[2];
|
||||||
|
|
||||||
extern patch_t *kp_eggnum[6];
|
extern patch_t *kp_eggnum[6];
|
||||||
extern patch_t *kp_facenum[MAXPLAYERS+1];
|
extern patch_t *kp_facenum[MAXPLAYERS+1];
|
||||||
|
|
|
||||||
64
src/k_kart.c
64
src/k_kart.c
|
|
@ -8836,6 +8836,18 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
if (player->ringdelay)
|
if (player->ringdelay)
|
||||||
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))
|
if (P_PlayerInPain(player))
|
||||||
{
|
{
|
||||||
player->ringboost = 0;
|
player->ringboost = 0;
|
||||||
|
|
@ -10460,10 +10472,14 @@ INT16 K_GetKartTurnValue(const player_t *player, INT16 turnvalue)
|
||||||
return 0;
|
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
|
if (player->trickpanel == TRICKSTATE_READY || player->trickpanel == TRICKSTATE_FORWARD)
|
||||||
return 0;
|
{
|
||||||
|
// Forward trick or rising from trickpanel
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->justDI > 0)
|
if (player->justDI > 0)
|
||||||
|
|
@ -10622,6 +10638,18 @@ INT16 K_GetKartTurnValue(const player_t *player, INT16 turnvalue)
|
||||||
turnfixed /= 2;
|
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);
|
return (turnfixed / FRACUNIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13410,6 +13438,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
player->tumbleHeight = 30; // Base tumble bounce height
|
player->tumbleHeight = 30; // Base tumble bounce height
|
||||||
player->trickpanel = TRICKSTATE_NONE;
|
player->trickpanel = TRICKSTATE_NONE;
|
||||||
P_SetPlayerMobjState(player->mo, S_KART_SPINOUT);
|
P_SetPlayerMobjState(player->mo, S_KART_SPINOUT);
|
||||||
|
K_AddMessageForPlayer(player, "Press <dpad> + <a> to trick!", true, false);
|
||||||
if (player->itemflags & (IF_ITEMOUT|IF_EGGMANOUT))
|
if (player->itemflags & (IF_ITEMOUT|IF_EGGMANOUT))
|
||||||
{
|
{
|
||||||
//K_PopPlayerShield(player); // shield is just being yeeted, don't pop
|
//K_PopPlayerShield(player); // shield is just being yeeted, don't pop
|
||||||
|
|
@ -13426,6 +13455,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
|
|
||||||
INT16 aimingcompare = abs(cmd->throwdir) - abs(cmd->turning);
|
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.
|
// Uses cmd->turning over steering intentionally.
|
||||||
#define TRICKTHRESHOLD (KART_FULLTURN/2)
|
#define TRICKTHRESHOLD (KART_FULLTURN/2)
|
||||||
if (aimingcompare < -TRICKTHRESHOLD) // side trick
|
if (aimingcompare < -TRICKTHRESHOLD) // side trick
|
||||||
|
|
@ -13656,12 +13694,24 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
player->trickboostdecay = 0;
|
player->trickboostdecay = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until we let go off the control stick to remove the delay
|
// 2.2 - Lenient trickpanels
|
||||||
// buttons must be neutral after the initial trick delay. This prevents weirdness where slight nudges after blast off would send you flying.
|
if (G_CompatLevel(0x000A) || K_PlayerUsesBotMovement(player))
|
||||||
if ((player->pflags & PF_TRICKDELAY) && !player->throwdir && !cmd->turning && (player->tricktime >= TRICKDELAY))
|
|
||||||
{
|
{
|
||||||
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);
|
K_KartDrift(player, onground);
|
||||||
|
|
|
||||||
|
|
@ -478,6 +478,8 @@ static int player_get(lua_State *L)
|
||||||
lua_pushinteger(L, plr->trickboostdecay);
|
lua_pushinteger(L, plr->trickboostdecay);
|
||||||
else if (fastcmp(field,"trickboost"))
|
else if (fastcmp(field,"trickboost"))
|
||||||
lua_pushinteger(L, plr->trickboost);
|
lua_pushinteger(L, plr->trickboost);
|
||||||
|
else if (fastcmp(field,"tricklock"))
|
||||||
|
lua_pushinteger(L, plr->tricklock);
|
||||||
else if (fastcmp(field,"dashringpulltics"))
|
else if (fastcmp(field,"dashringpulltics"))
|
||||||
lua_pushinteger(L, plr->dashRingPullTics);
|
lua_pushinteger(L, plr->dashRingPullTics);
|
||||||
else if (fastcmp(field,"dashringpushtics"))
|
else if (fastcmp(field,"dashringpushtics"))
|
||||||
|
|
@ -1030,6 +1032,8 @@ static int player_set(lua_State *L)
|
||||||
plr->trickboostdecay = luaL_checkinteger(L, 3);
|
plr->trickboostdecay = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"trickboost"))
|
else if (fastcmp(field,"trickboost"))
|
||||||
plr->trickboost = luaL_checkinteger(L, 3);
|
plr->trickboost = luaL_checkinteger(L, 3);
|
||||||
|
else if (fastcmp(field,"tricklock"))
|
||||||
|
plr->tricklock = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"dashringpulltics"))
|
else if (fastcmp(field,"dashringpulltics"))
|
||||||
plr->dashRingPullTics = luaL_checkinteger(L, 3);
|
plr->dashRingPullTics = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"dashringpushtics"))
|
else if (fastcmp(field,"dashringpushtics"))
|
||||||
|
|
|
||||||
|
|
@ -541,6 +541,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
WRITEUINT32(save->p, players[i].trickboostpower);
|
WRITEUINT32(save->p, players[i].trickboostpower);
|
||||||
WRITEUINT8(save->p, players[i].trickboostdecay);
|
WRITEUINT8(save->p, players[i].trickboostdecay);
|
||||||
WRITEUINT8(save->p, players[i].trickboost);
|
WRITEUINT8(save->p, players[i].trickboost);
|
||||||
|
WRITEUINT8(save->p, players[i].tricklock);
|
||||||
|
|
||||||
WRITEUINT8(save->p, players[i].dashRingPullTics);
|
WRITEUINT8(save->p, players[i].dashRingPullTics);
|
||||||
WRITEUINT8(save->p, players[i].dashRingPushTics);
|
WRITEUINT8(save->p, players[i].dashRingPushTics);
|
||||||
|
|
@ -1140,6 +1141,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
players[i].trickboostpower = READUINT32(save->p);
|
players[i].trickboostpower = READUINT32(save->p);
|
||||||
players[i].trickboostdecay = READUINT8(save->p);
|
players[i].trickboostdecay = READUINT8(save->p);
|
||||||
players[i].trickboost = READUINT8(save->p);
|
players[i].trickboost = READUINT8(save->p);
|
||||||
|
players[i].tricklock = READUINT8(save->p);
|
||||||
|
|
||||||
players[i].dashRingPullTics = READUINT8(save->p);
|
players[i].dashRingPullTics = READUINT8(save->p);
|
||||||
players[i].dashRingPushTics = READUINT8(save->p);
|
players[i].dashRingPushTics = READUINT8(save->p);
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ Draw::TextElement& Draw::TextElement::parse(std::string_view raw)
|
||||||
BUTTON("right", 0x02),
|
BUTTON("right", 0x02),
|
||||||
BUTTON("left", 0x03),
|
BUTTON("left", 0x03),
|
||||||
|
|
||||||
|
BUTTON("dpad", 0x04),
|
||||||
|
|
||||||
BUTTON("r", 0x07),
|
BUTTON("r", 0x07),
|
||||||
BUTTON("l", 0x08),
|
BUTTON("l", 0x08),
|
||||||
BUTTON("start", 0x09),
|
BUTTON("start", 0x09),
|
||||||
|
|
@ -197,6 +199,7 @@ patch_t** get_button_patch(Draw::Button type, int ver)
|
||||||
X(down);
|
X(down);
|
||||||
X(right);
|
X(right);
|
||||||
X(left);
|
X(left);
|
||||||
|
X(dpad);
|
||||||
|
|
||||||
#undef X
|
#undef X
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ public:
|
||||||
down,
|
down,
|
||||||
right,
|
right,
|
||||||
left,
|
left,
|
||||||
|
dpad,
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextElement
|
class TextElement
|
||||||
|
|
|
||||||
|
|
@ -2505,6 +2505,11 @@ static UINT8 V_GetButtonCodeWidth(UINT8 c)
|
||||||
x = 14;
|
x = 14;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x04:
|
||||||
|
// dpad
|
||||||
|
x = 14;
|
||||||
|
break;
|
||||||
|
|
||||||
case 0x0A:
|
case 0x0A:
|
||||||
case 0x0B:
|
case 0x0B:
|
||||||
case 0x0C:
|
case 0x0C:
|
||||||
|
|
@ -2700,6 +2705,8 @@ void V_DrawStringScaled(
|
||||||
case 0x02: return {{0, 3, Draw::Button::right}};
|
case 0x02: return {{0, 3, Draw::Button::right}};
|
||||||
case 0x03: return {{0, 3, Draw::Button::left}};
|
case 0x03: return {{0, 3, Draw::Button::left}};
|
||||||
|
|
||||||
|
case 0x04: return {{0, 4, Draw::Button::dpad}};
|
||||||
|
|
||||||
case 0x07: return {{0, 2, Draw::Button::r}};
|
case 0x07: return {{0, 2, Draw::Button::r}};
|
||||||
case 0x08: return {{0, 2, Draw::Button::l}};
|
case 0x08: return {{0, 2, Draw::Button::l}};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue