WIP: Start reward rework

This commit is contained in:
Antonio Martinez 2025-10-07 00:54:35 -04:00
parent 8ed4c1c081
commit 668a2d8d31
5 changed files with 99 additions and 28 deletions

View file

@ -154,6 +154,8 @@ typedef enum
PF2_SERVERTEMPMUTE = 1<<10, // Haven't met gamestochat requirement
PF2_SAMEFRAMESTUNG = 1<<11, // Goofy bullshit for tracking mutual ring sting
PF2_UNSTINGABLE = 1<<12, // Was bumped out of spindash
PF2_GIMMESTARTAWARDS = 1<<13, // Need to apply non-first start awards on a 1 tic delay to prevent port priority
PF2_GIMMEFIRSTBLOOD = 1<<14, // And need to differentiate between First Blood and everything else!
} pflags2_t;
typedef enum
@ -1129,7 +1131,7 @@ struct player_t
boolean dotrickfx;
boolean stingfx;
UINT8 bumperinflate;
boolean mfdfinish; // Did you cross the finish line while just about to explode?
UINT8 ringboxdelay; // Delay until Ring Box auto-activates

View file

@ -7980,8 +7980,16 @@ void K_drawKartHUD(void)
std::string arrow = (ahead == 1 || ahead == -2) ? "(" : ")";
// vibes offset
row.x(-35).colormap(skincolor).patch(R_CanShowSkinInDemo(skin) ? faceprefix[skin][FACE_MINIMAP] : kp_unknownminimap);
if (skin != -1)
{
// vibes offset
row.x(-35).colormap(skincolor).patch(R_CanShowSkinInDemo(skin) ? faceprefix[skin][FACE_MINIMAP] : kp_unknownminimap);
}
else
{
ahead = -1;
}
if (pos > 1)
row.x(-35).font(Draw::Font::kPing).text(va("%d", pos));

View file

@ -10180,6 +10180,61 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
Music_Stop("position");
}
if (player->pflags2 & PF2_GIMMESTARTAWARDS)
{
UINT16 maxduration = 125;
UINT16 duration = FixedRescale(leveltime - starttime, 0, TICRATE*2, Easing_Linear, maxduration, 0);
player->aciddropdashboost += duration;
S_StartSound(player->mo, sfx_s23c);
if (duration)
{
K_SpawnDriftBoostExplosion(player, FixedRescale(duration, 0, maxduration, Easing_Linear, 1, 3));
// K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
}
// CONS_Printf("%d %s %d giving start award %d\n", leveltime, player_names[player - players], leveltime - starttime, duration);
}
if (player->pflags2 & PF2_GIMMEFIRSTBLOOD)
{
if (K_InRaceDuel())
{
K_SpawnDriftElectricSparks(player, player->skincolor, false);
K_SpawnAmps(player, 20, player->mo);
}
else
{
S_StartSound(player->mo, sfx_s23c);
player->startboost = 125;
K_SpawnDriftBoostExplosion(player, 4);
K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
K_SpawnAmps(player, (K_InRaceDuel()) ? 20 : 20, player->mo);
if (g_teamplay)
{
for (UINT8 j = 0; j < MAXPLAYERS; j++)
{
if (!playeringame[j] || players[j].spectator || !players[j].mo || P_MobjWasRemoved(players[j].mo))
continue;
if (!G_SameTeam(player, &players[j]))
continue;
if (player == &players[j])
continue;
K_SpawnAmps(&players[j], 10, player->mo);
}
}
}
// CONS_Printf("%d %s giving first blood\n", leveltime, player_names[player - players]);
rainbowstartavailable = false;
}
player->pflags2 &= ~(PF2_GIMMESTARTAWARDS|PF2_GIMMEFIRSTBLOOD);
if (player->transfer)
{
if (player->fastfall)

View file

@ -57,6 +57,8 @@ Make sure this matches the actual number of states
#define MINCOMBOFLOAT (mapobjectscale*1)
#define MAXCOMBOTIME (TICRATE*4)
#define STARTBOOST_DURATION (125)
#define TIMEATTACK_START (TICRATE*10)
#define LIGHTNING_CHARGE (TICRATE*2)

View file

@ -1991,6 +1991,13 @@ static void K_HandleLapIncrement(player_t *player)
S_StartSound(player->mo, sfx_s3kb2);
}
player->karthud[khud_splitcolor] = 0;
player->karthud[khud_splitposition] = 1;
player->karthud[khud_splitskin] = -1;
player->karthud[khud_splittime] = (INT32)(starttime - leveltime);
player->karthud[khud_splittimer] = 3*TICRATE;
player->karthud[khud_splitwin] = -2;
return;
}
@ -2060,38 +2067,35 @@ static void K_HandleLapIncrement(player_t *player)
K_UpdateAllPlayerPositions(); // P_DoPlayerExit calls this
}
if (rainbowstartavailable == true && player->mo->hitlag == 0)
if (!G_TimeAttackStart() && player->laps == 1 && lapisfresh)
{
if (K_InRaceDuel())
if (rainbowstartavailable)
{
K_SpawnDriftElectricSparks(player, player->skincolor, false);
K_SpawnAmps(player, 20, player->mo);
// CONS_Printf("%d: %s gimme first blood\n", leveltime, player_names[player - players]);
player->pflags2 |= PF2_GIMMEFIRSTBLOOD;
}
else
{
S_StartSound(player->mo, sfx_s23c);
player->startboost = 125;
K_SpawnDriftBoostExplosion(player, 4);
K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
if (!G_TimeAttackStart())
K_SpawnAmps(player, (K_InRaceDuel()) ? 20 : 20, player->mo);
if (g_teamplay)
{
for (UINT8 j = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[j] || players[j].spectator || !players[j].mo || P_MobjWasRemoved(players[j].mo))
continue;
if (!G_SameTeam(player, &players[j]))
continue;
if (player == &players[j])
continue;
K_SpawnAmps(&players[j], 10, player->mo);
}
}
// CONS_Printf("%d: %s gimme start award\n", leveltime, player_names[player - players]);
player->pflags2 |= PF2_GIMMESTARTAWARDS;
}
player->karthud[khud_splitcolor] = 0;
player->karthud[khud_splitposition] = 1;
player->karthud[khud_splitskin] = -1;
player->karthud[khud_splittime] = (INT32)(starttime - leveltime);
player->karthud[khud_splittimer] = 2*TICRATE;
player->karthud[khud_splitwin] = (rainbowstartavailable) ? 2 : 0;
}
if (rainbowstartavailable == true && player->mo->hitlag == 0 && G_TimeAttackStart())
{
S_StartSound(player->mo, sfx_s23c);
player->startboost = 125;
K_SpawnDriftBoostExplosion(player, 4);
K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
rainbowstartavailable = false;
}