Early item fade, fix gametypes / edge cases

This commit is contained in:
Antonio Martinez 2025-05-13 16:49:32 -04:00
parent 25de15672e
commit 77167d1e32
7 changed files with 40 additions and 11 deletions

View file

@ -727,7 +727,7 @@ struct player_t
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 cangrabitems;
UINT8 cangrabitems;
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

View file

@ -2429,7 +2429,13 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
bigwaypointgap = 0;
tallyactive = false;
cangrabitems = false;
cangrabitems = 0;
if (gametyperules & GTR_SPHERES
|| gametyperules & GTR_CATCHER
|| G_TimeAttackStart()
|| gametype == GT_TUTORIAL)
cangrabitems = EARLY_ITEM_FLICKER;
}
else
{

View file

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

View file

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

View file

@ -265,7 +265,7 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"flipdi"))
lua_pushboolean(L, plr->flipDI);
else if (fastcmp(field,"cangrabitems"))
lua_pushboolean(L, plr->cangrabitems);
lua_pushinteger(L, plr->cangrabitems);
else if (fastcmp(field,"analoginput"))
lua_pushboolean(L, plr->analoginput);
else if (fastcmp(field,"transfer"))
@ -879,7 +879,7 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"flipdi"))
plr->flipDI = luaL_checkboolean(L, 3);
else if (fastcmp(field,"cangrabitems"))
plr->cangrabitems = luaL_checkboolean(L, 3);
plr->cangrabitems = luaL_checkinteger(L, 3);
else if (fastcmp(field,"incontrol"))
plr->incontrol = luaL_checkinteger(L, 3);
else if (fastcmp(field,"progressivethrust"))

View file

@ -115,15 +115,34 @@ void Obj_RandomItemVisuals(mobj_t *mobj)
if (mobj->type != MT_RANDOMITEM)
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++)
{
UINT32 flag = K_GetPlayerDontDrawFlag(&players[displayplayers[i]]);
if (!players[displayplayers[i]].cangrabitems)
mobj->renderflags |= flag;
else
mobj->renderflags &= ~(flag);
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);
}
}

View file

@ -1099,7 +1099,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].justDI = READUINT8(save->p);
players[i].flipDI = (boolean)READUINT8(save->p);
players[i].cangrabitems = (boolean)READUINT8(save->p);
players[i].cangrabitems = READUINT8(save->p);
players[i].drift = READSINT8(save->p);
players[i].driftcharge = READFIXED(save->p);