Merge branch 'no-early-items' into 'master'

No early items

Closes #1453

See merge request kart-krew-dev/ring-racers-internal!2539
This commit is contained in:
Oni VelocitOni 2025-05-14 00:49:45 +00:00
commit c6cb319367
8 changed files with 64 additions and 0 deletions

View file

@ -727,6 +727,8 @@ struct player_t
UINT8 justDI; // Turn-lockout timer to briefly prevent unintended turning after DI, resets when actionable or no input UINT8 justDI; // Turn-lockout timer to briefly prevent unintended turning after DI, resets when actionable or no input
boolean flipDI; // Bananas flip the DI direction. Was a bug, but it made bananas much more interesting. boolean flipDI; // Bananas flip the DI direction. Was a bug, but it made bananas much more interesting.
UINT8 cangrabitems;
SINT8 drift; // (-5 to 5) - Drifting Left or Right, plus a bigger counter = sharper turn SINT8 drift; // (-5 to 5) - Drifting Left or Right, plus a bigger counter = sharper turn
fixed_t driftcharge; // Charge your drift so you can release a burst of speed fixed_t driftcharge; // Charge your drift so you can release a burst of speed
UINT16 driftboost; // (0 to 125 baseline) - Boost you get from drifting UINT16 driftboost; // (0 to 125 baseline) - Boost you get from drifting

View file

@ -2241,6 +2241,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
UINT8 botdiffincrease; UINT8 botdiffincrease;
boolean botrival; boolean botrival;
boolean cangrabitems;
SINT8 xtralife; SINT8 xtralife;
uint8_t public_key[PUBKEYLENGTH]; uint8_t public_key[PUBKEYLENGTH];
@ -2342,6 +2344,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
bot = players[player].bot; bot = players[player].bot;
botdifficulty = players[player].botvars.difficulty; botdifficulty = players[player].botvars.difficulty;
cangrabitems = players[player].cangrabitems;
botdiffincrease = players[player].botvars.diffincrease; botdiffincrease = players[player].botvars.diffincrease;
botrival = players[player].botvars.rival; botrival = players[player].botvars.rival;
@ -2425,6 +2429,13 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
bigwaypointgap = 0; bigwaypointgap = 0;
tallyactive = false; tallyactive = false;
cangrabitems = 0;
if (gametyperules & GTR_SPHERES
|| gametyperules & GTR_CATCHER
|| G_TimeAttackStart()
|| gametype == GT_TUTORIAL)
cangrabitems = EARLY_ITEM_FLICKER;
} }
else else
{ {
@ -2567,6 +2578,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
p->charflags = charflags; p->charflags = charflags;
p->lastfakeskin = lastfakeskin; p->lastfakeskin = lastfakeskin;
p->cangrabitems = cangrabitems;
memcpy(players[player].availabilities, availabilities, sizeof(availabilities)); memcpy(players[player].availabilities, availabilities, sizeof(availabilities));
p->followitem = followitem; p->followitem = followitem;

View file

@ -4235,6 +4235,8 @@ void K_CheckpointCrossAward(player_t *player)
return; return;
player->exp += K_GetExpAdjustment(player); player->exp += K_GetExpAdjustment(player);
if (!player->cangrabitems)
player->cangrabitems = 1;
K_AwardPlayerRings(player, (player->bot ? 20 : 10), true); K_AwardPlayerRings(player, (player->bot ? 20 : 10), true);
} }
@ -9578,6 +9580,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
player->invincibilitytimer--; player->invincibilitytimer--;
} }
if (player->cangrabitems && player->cangrabitems <= EARLY_ITEM_FLICKER)
player->cangrabitems++;
if (!player->invincibilitytimer) if (!player->invincibilitytimer)
player->invincibilityextensions = 0; player->invincibilityextensions = 0;

View file

@ -60,6 +60,8 @@ Make sure this matches the actual number of states
#define SCAMDIST (2000) #define SCAMDIST (2000)
#define EARLY_ITEM_FLICKER (NUMTRANSMAPS)
// 2023-08-26 +ang20 to Sal's OG values to make them friendlier - Tyron // 2023-08-26 +ang20 to Sal's OG values to make them friendlier - Tyron
#define STUMBLE_STEEP_VAL (ANG60 + ANG20) #define STUMBLE_STEEP_VAL (ANG60 + ANG20)
#define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10 + ANG20) #define STUMBLE_STEEP_VAL_AIR (ANG30 + ANG10 + ANG20)

View file

@ -264,6 +264,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->justDI); lua_pushinteger(L, plr->justDI);
else if (fastcmp(field,"flipdi")) else if (fastcmp(field,"flipdi"))
lua_pushboolean(L, plr->flipDI); lua_pushboolean(L, plr->flipDI);
else if (fastcmp(field,"cangrabitems"))
lua_pushinteger(L, plr->cangrabitems);
else if (fastcmp(field,"analoginput")) else if (fastcmp(field,"analoginput"))
lua_pushboolean(L, plr->analoginput); lua_pushboolean(L, plr->analoginput);
else if (fastcmp(field,"transfer")) else if (fastcmp(field,"transfer"))
@ -876,6 +878,8 @@ static int player_set(lua_State *L)
plr->justDI = luaL_checkinteger(L, 3); plr->justDI = luaL_checkinteger(L, 3);
else if (fastcmp(field,"flipdi")) else if (fastcmp(field,"flipdi"))
plr->flipDI = luaL_checkboolean(L, 3); plr->flipDI = luaL_checkboolean(L, 3);
else if (fastcmp(field,"cangrabitems"))
plr->cangrabitems = luaL_checkinteger(L, 3);
else if (fastcmp(field,"incontrol")) else if (fastcmp(field,"incontrol"))
plr->incontrol = luaL_checkinteger(L, 3); plr->incontrol = luaL_checkinteger(L, 3);
else if (fastcmp(field,"progressivethrust")) else if (fastcmp(field,"progressivethrust"))

View file

@ -115,6 +115,38 @@ void Obj_RandomItemVisuals(mobj_t *mobj)
if (mobj->type != MT_RANDOMITEM) if (mobj->type != MT_RANDOMITEM)
return; return;
// Fade items in as we cross the first checkpoint, but don't touch their visibility otherwise!
if (!((mobj->flags & MF_NOCLIPTHING) || mobj->fuse))
{
UINT8 maxgrab = 0;
for (UINT8 i = 0; i <= r_splitscreen; i++)
{
maxgrab = max(maxgrab, players[displayplayers[i]].cangrabitems);
}
if (maxgrab == 0)
mobj->renderflags |= RF_DONTDRAW;
else
mobj->renderflags &= ~RF_DONTDRAW;
if (maxgrab > 0 && maxgrab <= EARLY_ITEM_FLICKER)
{
UINT8 maxtranslevel = NUMTRANSMAPS;
UINT8 trans = maxgrab;
if (trans > maxtranslevel)
trans = maxtranslevel;
trans = NUMTRANSMAPS - trans;
mobj->renderflags &= ~(RF_TRANSMASK);
if (trans != 0)
mobj->renderflags |= (trans << RF_TRANSSHIFT);
}
}
// Respawn flow, documented by a dumb asshole: // Respawn flow, documented by a dumb asshole:
// P_TouchSpecialThing -> P_ItemPop sets fuse, NOCLIPTHING and DONTDRAW. // P_TouchSpecialThing -> P_ItemPop sets fuse, NOCLIPTHING and DONTDRAW.
// P_FuseThink does visual flicker, and when fuse is 0, unsets NOCLIPTHING/DONTDRAW/etc... // P_FuseThink does visual flicker, and when fuse is 0, unsets NOCLIPTHING/DONTDRAW/etc...

View file

@ -128,6 +128,9 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon)
if (weapon != 2 && player->instaWhipCharge) if (weapon != 2 && player->instaWhipCharge)
return false; return false;
if (weapon == 1 && !player->cangrabitems)
return false;
if (weapon) if (weapon)
{ {
// Item slot already taken up // Item slot already taken up

View file

@ -459,6 +459,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].justDI); WRITEUINT8(save->p, players[i].justDI);
WRITEUINT8(save->p, players[i].flipDI); WRITEUINT8(save->p, players[i].flipDI);
WRITEUINT8(save->p, players[i].cangrabitems);
WRITESINT8(save->p, players[i].drift); WRITESINT8(save->p, players[i].drift);
WRITEFIXED(save->p, players[i].driftcharge); WRITEFIXED(save->p, players[i].driftcharge);
WRITEUINT16(save->p, players[i].driftboost); WRITEUINT16(save->p, players[i].driftboost);
@ -1097,6 +1099,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].justDI = READUINT8(save->p); players[i].justDI = READUINT8(save->p);
players[i].flipDI = (boolean)READUINT8(save->p); players[i].flipDI = (boolean)READUINT8(save->p);
players[i].cangrabitems = READUINT8(save->p);
players[i].drift = READSINT8(save->p); players[i].drift = READSINT8(save->p);
players[i].driftcharge = READFIXED(save->p); players[i].driftcharge = READFIXED(save->p);
players[i].driftboost = READUINT16(save->p); players[i].driftboost = READUINT16(save->p);