Split shield popping from hnextlist and fix shield ring issues

This commit is contained in:
NepDisk 2025-07-28 22:18:22 -04:00
parent bf7abee652
commit da5a45a932
6 changed files with 59 additions and 36 deletions

View file

@ -104,6 +104,7 @@ extern "C" {
// Special Hashing.
//#define NOMD5
//#define NOFILEHASH
//#define NOVERIFYIWADS
// Uncheck this to compile debugging code
//#define RANGECHECK

View file

@ -538,7 +538,7 @@ static void K_BubbleShieldCollideDrain(player_t *player, mobj_t *bubble)
if (player->bubblepop > 1)
{
K_DropHnextList(player, false);
K_PopPlayerShield(player);
}
}

View file

@ -6066,13 +6066,12 @@ void K_UpdateHnextList(player_t *player, boolean clean)
}
// For getting hit!
void K_DropHnextList(player_t *player, boolean keepshields)
void K_DropHnextList(player_t *player)
{
mobj_t *work = player->mo, *nextwork, *dropwork;
INT32 flip;
mobjtype_t type;
boolean orbit, ponground, dropall = true;
INT32 shield = K_GetShieldFromPlayer(player);
if (work == NULL || P_MobjWasRemoved(work))
{
@ -6082,27 +6081,6 @@ void K_DropHnextList(player_t *player, boolean keepshields)
flip = P_MobjFlip(player->mo);
ponground = P_IsObjectOnGround(player->mo);
if (shield != KSHIELD_NONE && !keepshields)
{
switch (shield)
{
case KSHIELD_THUNDER:
K_DoThunderShield(player);
break;
case KSHIELD_BUBBLE:
S_StartSound(player->mo, sfx_s3k4b);
break;
case KSHIELD_FLAME:
S_StartSound(player->mo, sfx_s3k47);
break;
}
player->curshield = KSHIELD_NONE;
player->itemtype = KITEM_NONE;
player->itemamount = 0;
K_UnsetItemOut(player);
}
nextwork = work->hnext;
while ((work = nextwork) && !(work == NULL || P_MobjWasRemoved(work)))
@ -6256,6 +6234,45 @@ void K_DropHnextList(player_t *player, boolean keepshields)
}
}
// For getting hit!
void K_PopPlayerShield(player_t *player)
{
INT32 shield = K_GetShieldFromPlayer(player);
// Doesn't apply if player is invalid.
if (player->mo == NULL || P_MobjWasRemoved(player->mo))
{
return;
}
switch (shield)
{
case KSHIELD_THUNDER:
K_DoThunderShield(player);
break;
case KSHIELD_BUBBLE:
S_StartSound(player->mo, sfx_s3k4b);
break;
case KSHIELD_FLAME:
S_StartSound(player->mo, sfx_s3k47);
break;
}
player->curshield = KSHIELD_NONE;
player->itemtype = KITEM_NONE;
player->itemamount = 0;
player->flametimer = 0;
//player->flamestore = 0
//player->flamedash = 0;
player->bubbleblowup = 0;
player->bubblecool = 0;
player->bubblepop = 0;
K_UnsetItemOut(player);
}
mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 flip, UINT8 type, UINT8 amount)
{
mobj_t *drop = P_SpawnMobj(x, y, z, MT_FLOATINGITEM);
@ -6343,7 +6360,7 @@ mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8
// For getting EXTRA hit!
void K_DropItems(player_t *player)
{
K_DropHnextList(player, true);
K_DropHnextList(player);
if (player->mo && !P_MobjWasRemoved(player->mo) && player->itemamount > 0)
{
@ -8057,7 +8074,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
{
S_StopSoundByID(player->mo, sfx_s3kc2l);
S_StartSound(player->mo, sfx_s3k47);
K_DropHnextList(player, false);
K_PopPlayerShield(player);
}
}
else
@ -10831,7 +10848,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{
player->flametimer = 0;
S_StartSound(player->mo, sfx_s3k47);
K_DropHnextList(player, false);
K_PopPlayerShield(player);
}
/*if (!onground)

View file

@ -240,7 +240,8 @@ UINT16 K_GetInvincibilityTime(player_t *player);
void K_DoInvincibility(player_t *player, tic_t time);
void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source);
void K_UpdateHnextList(player_t *player, boolean clean);
void K_DropHnextList(player_t *player, boolean keepshields);
void K_DropHnextList(player_t *player);
void K_PopPlayerShield(player_t *player);
void K_RepairOrbitChain(mobj_t *orbit);
void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, fixed_t height, boolean flip, boolean player);
player_t *K_FindJawzTarget(mobj_t *actor, player_t *source);

View file

@ -528,7 +528,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->bubbleblowup > 0)
{
K_DropHnextList(player, false);
K_PopPlayerShield(player);
special->extravalue1 = 2; // WAIT...
special->extravalue2 = 52; // Slightly over the respawn timer length
return;
@ -537,7 +537,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->invincibilitytimer > 0 || player->growshrinktimer > 0 || player->hyudorotimer > 0)
{
//player->flashing = 0;
K_DropHnextList(player, false);
K_DropHnextList(player);
K_StripItems(player);
}
@ -2275,9 +2275,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
player->driftboost = 0;
player->bubblepop = 0;
player->flametimer = 0;
//player->flamestore = 0
//player->flamedash = 0;
player->ringboost = 0;
player->glanceDir = 0;
player->pflags &= ~PF_GAINAX;
@ -2369,13 +2366,20 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
break;
}
// Have a shield? You get hit, but don't lose your rings!
if (K_GetShieldFromPlayer(player) != KSHIELD_NONE)
{
ringburst = 0;
}
player->flashing = K_GetKartFlashing(player);
P_PlayRinglossSound(target);
K_PopPlayerShield(player);
if (ringburst > 0)
{
P_PlayerRingBurst(player, ringburst);
P_PlayRinglossSound(target);
}
if (inflictor)
@ -2412,7 +2416,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
else
{
K_DropHnextList(player, false);
K_DropHnextList(player);
}
player->instashield = 15;

View file

@ -2203,7 +2203,7 @@ void *W_CachePatchLongName(const char *name, INT32 tag)
*/
void W_VerifyFileHash(UINT16 wadfilenum, UINT64 matchhash)
{
#ifdef NOFILEHASH
#if defined(NOVERIFYIWADS) || defined(NOFILEHASH)
(void)wadfilenum;
(void)matchhash;
#else