mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-20 00:11:19 +00:00
Made P_SpecialStageDamage for the lose 10 rings damaging code shared by spikeballs and SS damage sector special
This commit is contained in:
parent
34908c9b29
commit
a0204c6722
3 changed files with 39 additions and 43 deletions
|
@ -1493,30 +1493,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
P_SetMobjState(special, special->info->deathstate);
|
||||
return;
|
||||
case MT_SPECIALSPIKEBALL:
|
||||
if (!(!useNightsSS && G_IsSpecialStage(gamemap))) // Only for old special stages
|
||||
{
|
||||
P_DamageMobj(toucher, special, special, 1, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->powers[pw_invulnerability] || player->powers[pw_flashing]
|
||||
|| player->powers[pw_super])
|
||||
return;
|
||||
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
|
||||
{
|
||||
P_RemoveShield(player);
|
||||
S_StartSound(toucher, sfx_shldls); // Ba-Dum! Shield loss.
|
||||
}
|
||||
if (!useNightsSS && G_IsSpecialStage(gamemap)) // Only for old special stages
|
||||
P_SpecialStageDamage(player, special, NULL);
|
||||
else
|
||||
{
|
||||
P_PlayRinglossSound(toucher);
|
||||
if (player->rings >= 10)
|
||||
player->rings -= 10;
|
||||
else
|
||||
player->rings = 0;
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, special, NULL);
|
||||
P_DamageMobj(toucher, special, special, 1, 0);
|
||||
return;
|
||||
case MT_EGGMOBILE2_POGO:
|
||||
// sanity checks
|
||||
|
@ -3008,6 +2988,38 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
|
|||
player->rings = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// P_SpecialStageDamage
|
||||
//
|
||||
// Do old special stage-style damaging
|
||||
// Removes 10 rings from the player, or knocks off their shield if they have one.
|
||||
// If they don't have anything, just knock the player back anyway (this doesn't kill them).
|
||||
//
|
||||
void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super])
|
||||
return;
|
||||
|
||||
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
|
||||
{
|
||||
P_RemoveShield(player);
|
||||
S_StartSound(player->mo, sfx_shldls); // Ba-Dum! Shield loss.
|
||||
}
|
||||
else
|
||||
{
|
||||
P_PlayRinglossSound(player->mo);
|
||||
if (player->rings >= 10)
|
||||
player->rings -= 10;
|
||||
else
|
||||
player->rings = 0;
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, inflictor, source);
|
||||
|
||||
if (gametype == GT_CTF && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||
P_PlayerFlagBurst(player, false);
|
||||
}
|
||||
|
||||
/** Damages an object, which may or may not be a player.
|
||||
* For melee attacks, source and inflictor are the same.
|
||||
*
|
||||
|
|
|
@ -414,6 +414,7 @@ void P_ForceFeed(const player_t *player, INT32 attack, INT32 fade, tic_t duratio
|
|||
void P_ForceConstant(const BasicFF_t *FFInfo);
|
||||
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End);
|
||||
void P_RemoveShield(player_t *player);
|
||||
void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source);
|
||||
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype);
|
||||
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
|
||||
void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c
|
||||
|
|
23
src/p_spec.c
23
src/p_spec.c
|
@ -3660,31 +3660,14 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
|||
S_StartSound(player->mo, sfx_itemup);
|
||||
}
|
||||
break;
|
||||
case 11: // Special Stage Damage - Kind of like a mini-P_DamageMobj()
|
||||
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super] || player->exiting || player->bot)
|
||||
case 11: // Special Stage Damage
|
||||
if (player->exiting || player->bot) // Don't do anything for bots or players who have just finished
|
||||
break;
|
||||
|
||||
if (!(player->powers[pw_shield] || player->rings > 0)) // Don't do anything if no shield or rings anyway
|
||||
break;
|
||||
|
||||
if (player->powers[pw_shield])
|
||||
{
|
||||
P_RemoveShield(player);
|
||||
S_StartSound(player->mo, sfx_shldls); // Ba-Dum! Shield loss.
|
||||
}
|
||||
else if (player->rings > 0)
|
||||
{
|
||||
P_PlayRinglossSound(player->mo);
|
||||
if (player->rings >= 10)
|
||||
player->rings -= 10;
|
||||
else
|
||||
player->rings = 0;
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, NULL, NULL); // this does basically everything that was here before
|
||||
|
||||
if (gametype == GT_CTF && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||
P_PlayerFlagBurst(player, false);
|
||||
P_SpecialStageDamage(player, NULL, NULL);
|
||||
break;
|
||||
case 12: // Space Countdown
|
||||
if (!(player->powers[pw_shield] & SH_PROTECTWATER) && !player->powers[pw_spacetime])
|
||||
|
|
Loading…
Reference in a new issue