Save shield health on respawn

This commit is contained in:
GenericHeroGuy 2025-11-01 03:13:28 +01:00
parent ea6bab146d
commit 6be6e19fba
2 changed files with 13 additions and 1 deletions

View file

@ -2744,6 +2744,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
INT32 previtemroulette;
INT32 roulettetype;
INT32 growshrinktimer;
UINT8 bubblehealth;
INT32 bumper;
INT32 karmapoints;
INT32 wanted;
@ -2812,6 +2813,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
itemtype = 0;
itemamount = 0;
growshrinktimer = 0;
bubblehealth = 0;
bumper = ((gametyperules & GTR_BUMPERS) ? K_StartingBumperCount() : 0);
karmapoints = 0;
wanted = 0;
@ -2867,6 +2869,14 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
else
growshrinktimer = 0;
// deplete your item stack if you died with zero bubble health
bubblehealth = players[player].bubblehealth;
if (bubblehealth == 0 && itemtype == KITEM_BUBBLESHIELD && itemamount > 0)
{
if (--itemamount == 0)
itemtype = 0;
}
bumper = players[player].bumper;
karmapoints = players[player].karmapoints;
wanted = players[player].wanted;
@ -3001,6 +3011,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
p->itemtype = itemtype;
p->itemamount = itemamount;
p->growshrinktimer = growshrinktimer;
p->bubblehealth = bubblehealth;
p->bumper = bumper;
p->karmadelay = comebacktime;
p->karmapoints = karmapoints;

View file

@ -10763,7 +10763,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
P_SetTarget(&shield->target, player->mo);
P_SetTarget(&player->shieldtracer, shield);
S_StartSound(player->mo, sfx_s3k3f);
player->bubblehealth = MAXBUBBLEHEALTH;
if (player->bubblehealth <= 0 || player->bubblehealth > MAXBUBBLEHEALTH)
player->bubblehealth = MAXBUBBLEHEALTH;
}
if (!HOLDING_ITEM && NO_HYUDORO)