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
|
@ -1493,31 +1493,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
P_SetMobjState(special, special->info->deathstate);
|
P_SetMobjState(special, special->info->deathstate);
|
||||||
return;
|
return;
|
||||||
case MT_SPECIALSPIKEBALL:
|
case MT_SPECIALSPIKEBALL:
|
||||||
if (!(!useNightsSS && G_IsSpecialStage(gamemap))) // Only for old special stages
|
if (!useNightsSS && G_IsSpecialStage(gamemap)) // Only for old special stages
|
||||||
{
|
P_SpecialStageDamage(player, special, NULL);
|
||||||
|
else
|
||||||
P_DamageMobj(toucher, special, special, 1, 0);
|
P_DamageMobj(toucher, special, special, 1, 0);
|
||||||
return;
|
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.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
P_PlayRinglossSound(toucher);
|
|
||||||
if (player->rings >= 10)
|
|
||||||
player->rings -= 10;
|
|
||||||
else
|
|
||||||
player->rings = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
P_DoPlayerPain(player, special, NULL);
|
|
||||||
return;
|
|
||||||
case MT_EGGMOBILE2_POGO:
|
case MT_EGGMOBILE2_POGO:
|
||||||
// sanity checks
|
// sanity checks
|
||||||
if (!special->target || !special->target->health)
|
if (!special->target || !special->target->health)
|
||||||
|
@ -3008,6 +2988,38 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
|
||||||
player->rings = 0;
|
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.
|
/** Damages an object, which may or may not be a player.
|
||||||
* For melee attacks, source and inflictor are the same.
|
* 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_ForceConstant(const BasicFF_t *FFInfo);
|
||||||
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End);
|
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End);
|
||||||
void P_RemoveShield(player_t *player);
|
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);
|
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_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
|
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);
|
S_StartSound(player->mo, sfx_itemup);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 11: // Special Stage Damage - Kind of like a mini-P_DamageMobj()
|
case 11: // Special Stage Damage
|
||||||
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super] || player->exiting || player->bot)
|
if (player->exiting || player->bot) // Don't do anything for bots or players who have just finished
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!(player->powers[pw_shield] || player->rings > 0)) // Don't do anything if no shield or rings anyway
|
if (!(player->powers[pw_shield] || player->rings > 0)) // Don't do anything if no shield or rings anyway
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (player->powers[pw_shield])
|
P_SpecialStageDamage(player, NULL, NULL);
|
||||||
{
|
|
||||||
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);
|
|
||||||
break;
|
break;
|
||||||
case 12: // Space Countdown
|
case 12: // Space Countdown
|
||||||
if (!(player->powers[pw_shield] & SH_PROTECTWATER) && !player->powers[pw_spacetime])
|
if (!(player->powers[pw_shield] & SH_PROTECTWATER) && !player->powers[pw_spacetime])
|
||||||
|
|
Loading…
Reference in New Issue