MCPcopy Create free account
hub / github.com/NBlood/NBlood / PlayerCheckDeath

Function PlayerCheckDeath

source/sw/src/weapon.cpp:5744–5813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5742
5743
5744int
5745PlayerCheckDeath(PLAYERp pp, short Weapon)
5746{
5747 SPRITEp sp = pp->SpriteP;
5748 USERp u = User[pp->PlayerSprite];
5749 SPRITEp wp = &sprite[Weapon];
5750 USERp wu = User[Weapon];
5751 int SpawnZombie(PLAYERp pp, short);
5752
5753
5754 // Store off what player was struck by
5755 pp->HitBy = Weapon;
5756
5757 if (u->Health <= 0 && !TEST(pp->Flags, PF_DEAD))
5758 {
5759 void DoPlayerBeginDie(PLAYERp);
5760
5761 // pick a death type
5762 if (u->LastDamage >= PLAYER_DEATH_EXPLODE_DAMMAGE_AMT)
5763 pp->DeathType = PLAYER_DEATH_EXPLODE;
5764 else if (u->LastDamage >= PLAYER_DEATH_CRUMBLE_DAMMAGE_AMT)
5765 pp->DeathType = PLAYER_DEATH_CRUMBLE;
5766 else
5767 pp->DeathType = PLAYER_DEATH_FLIP;
5768
5769 if (Weapon < 0)
5770 {
5771 pp->Killer = -1;
5772 DoPlayerBeginDie(pp);
5773 return TRUE;
5774 }
5775
5776 if (Weapon > -1 && (wu->ID == RIPPER_RUN_R0 || wu->ID == RIPPER2_RUN_R0))
5777 pp->DeathType = PLAYER_DEATH_RIPPER;
5778
5779 if (Weapon > -1 && wu->ID == CALTROPS)
5780 pp->DeathType = PLAYER_DEATH_FLIP;
5781
5782 if (Weapon > -1 && wu->ID == NINJA_RUN_R0 && wu->PlayerP)
5783 {
5784 PLAYERp wp = wu->PlayerP;
5785
5786 pp->DeathType = PLAYER_DEATH_FLIP;
5787 wu->PlayerP->Bloody = TRUE;
5788 }
5789
5790 // keep track of who killed you for death purposes
5791 // need to check all Killer variables when an enemy dies
5792 if (pp->Killer < 0)
5793 {
5794 if (wp->owner >= 0)
5795 pp->Killer = wp->owner;
5796 else if (TEST(wp->extra, SPRX_PLAYER_OR_ENEMY))
5797 pp->Killer = Weapon;
5798 }
5799
5800 // start the death process
5801 DoPlayerBeginDie(pp);

Callers 12

PlayerTakeSectorDamageFunction · 0.85
DoDamageFunction · 0.85
InitFistAttackFunction · 0.85
DoPlayerWarpTeleporterFunction · 0.85
DoPlayerSlideFunction · 0.85
DoPlayerMoveFunction · 0.85
DriveCrushFunction · 0.85
DoPlayerFallFunction · 0.85
DoPlayerDiveFunction · 0.85
DoPlayerTestPlaxDeathFunction · 0.85
DoPlayerCurrentFunction · 0.85
PlayerGlobalFunction · 0.85

Calls 1

DoPlayerBeginDieFunction · 0.85

Tested by

no test coverage detected