- PlayerCheckDeath

This commit is contained in:
Christoph Oelckers 2021-11-05 22:43:59 +01:00
parent 14b3a68e8c
commit 2b4ed0eaf3
6 changed files with 70 additions and 72 deletions

View file

@ -745,6 +745,7 @@ struct PLAYERstruct
DSWActor* remoteActor; DSWActor* remoteActor;
DSWActor* PlayerUnderActor; DSWActor* PlayerUnderActor;
DSWActor* KillerActor; //who killed me DSWActor* KillerActor; //who killed me
DSWActor* HitBy; // SpriteNum of whatever player was last hit by
// interpolation // interpolation
int oposx, oposy, oposz; int oposx, oposy, oposz;
@ -910,7 +911,6 @@ struct PLAYERstruct
bool NukeInitialized; // Nuke already has counted down bool NukeInitialized; // Nuke already has counted down
short FistAng; // KungFu attack angle short FistAng; // KungFu attack angle
uint8_t WpnKungFuMove; // KungFu special moves uint8_t WpnKungFuMove; // KungFu special moves
short HitBy; // SpriteNum of whatever player was last hit by
short Reverb; // Player's current reverb setting short Reverb; // Player's current reverb setting
short Heads; // Number of Accursed Heads orbiting player short Heads; // Number of Accursed Heads orbiting player
int PlayerVersion; int PlayerVersion;

View file

@ -1417,7 +1417,7 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
{ {
PlayerUpdateHealth(npp, -npp->Actor()->u()->Health); // Make sure he dies! PlayerUpdateHealth(npp, -npp->Actor()->u()->Health); // Make sure he dies!
// telefraged by teleporting player // telefraged by teleporting player
PlayerCheckDeath(npp, pp->PlayerSprite); PlayerCheckDeath(npp, pp->Actor());
} }
} }
} }
@ -1940,7 +1940,7 @@ void DoPlayerSlide(PLAYERp pp)
if (!TEST(pp->Flags, PF_DEAD)) if (!TEST(pp->Flags, PF_DEAD))
{ {
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
@ -1955,7 +1955,7 @@ void DoPlayerSlide(PLAYERp pp)
if (!TEST(pp->Flags, PF_DEAD)) if (!TEST(pp->Flags, PF_DEAD))
{ {
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
@ -2104,7 +2104,7 @@ void DoPlayerMove(PLAYERp pp)
if (!TEST(pp->Flags, PF_DEAD)) if (!TEST(pp->Flags, PF_DEAD))
{ {
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
@ -2131,7 +2131,7 @@ void DoPlayerMove(PLAYERp pp)
if (!TEST(pp->Flags, PF_DEAD)) if (!TEST(pp->Flags, PF_DEAD))
{ {
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
@ -2520,8 +2520,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y)
damage = -(u->Health + 100); damage = -(u->Health + 100);
PlayerDamageSlide(u->PlayerP, damage, pp->angle.ang.asbuild()); PlayerDamageSlide(u->PlayerP, damage, pp->angle.ang.asbuild());
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
//PlayerCheckDeath(u->PlayerP, -1); PlayerCheckDeath(u->PlayerP, pp->Actor());
PlayerCheckDeath(u->PlayerP, pp->PlayerSprite);
} }
} }
@ -3130,7 +3129,7 @@ void DoPlayerFall(PLAYERp pp)
u->Health = 0; u->Health = 0;
} }
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
@ -4466,7 +4465,7 @@ void DoPlayerDive(PLAYERp pp)
//PlayerUpdateHealth(pp, PLAYER_DIVE_DAMAGE_AMOUNT); //PlayerUpdateHealth(pp, PLAYER_DIVE_DAMAGE_AMOUNT);
PlayerSound(DIGI_WANGDROWNING, v3df_dontpan|v3df_follow, pp); PlayerSound(DIGI_WANGDROWNING, v3df_dontpan|v3df_follow, pp);
PlayerUpdateHealth(pp, -3 -(RandomRange(7<<8)>>8)); PlayerUpdateHealth(pp, -3 -(RandomRange(7<<8)>>8));
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
} }
@ -4634,7 +4633,7 @@ int DoPlayerTestPlaxDeath(PLAYERp pp)
if (pp->lo_sectp && TEST(pp->lo_sectp->floorstat, FLOOR_STAT_PLAX)) if (pp->lo_sectp && TEST(pp->lo_sectp->floorstat, FLOOR_STAT_PLAX))
{ {
PlayerUpdateHealth(pp, -u->Health); PlayerUpdateHealth(pp, -u->Health);
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
return true; return true;
} }
@ -4661,7 +4660,7 @@ void DoPlayerCurrent(PLAYERp pp)
USERp u = pp->Actor()->u(); USERp u = pp->Actor()->u();
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
@ -4678,7 +4677,7 @@ void DoPlayerCurrent(PLAYERp pp)
USERp u = pp->Actor()->u(); USERp u = pp->Actor()->u();
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies! PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;
@ -5428,7 +5427,7 @@ char *KilledPlayerMessage(PLAYERp pp, PLAYERp killer)
const char *p1 = pp->PlayerName; const char *p1 = pp->PlayerName;
const char *p2 = killer->PlayerName; const char *p2 = killer->PlayerName;
if (pp->HitBy == killer->PlayerSprite) if (pp->HitBy == killer->Actor())
{ {
sprintf(ds,"%s was killed by %s.",p1,p2); sprintf(ds,"%s was killed by %s.",p1,p2);
return ds; return ds;
@ -6670,7 +6669,7 @@ void PlayerGlobal(PLAYERp pp)
////DSPRINTF(ds,"Squish diff %d, min %d, cz %d, fz %d, lo %d, hi %d",labs(pp->loz - pp->hiz)>>8,min_height>>8, pp->ceiling_dist>>8, pp->floor_dist>>8,pp->lo_sectp-sector,pp->hi_sectp-sector); ////DSPRINTF(ds,"Squish diff %d, min %d, cz %d, fz %d, lo %d, hi %d",labs(pp->loz - pp->hiz)>>8,min_height>>8, pp->ceiling_dist>>8, pp->floor_dist>>8,pp->lo_sectp-sector,pp->hi_sectp-sector);
//MONO_PRINT(ds); //MONO_PRINT(ds);
PlayerUpdateHealth(pp, -pp->Actor()->u()->Health); // Make sure he dies! PlayerUpdateHealth(pp, -pp->Actor()->u()->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
if (TEST(pp->Flags, PF_DEAD)) if (TEST(pp->Flags, PF_DEAD))
return; return;

View file

@ -67,7 +67,7 @@ bool TestVatorMatchActive(short match);
bool TestSpikeMatchActive(short match); bool TestSpikeMatchActive(short match);
bool TestRotatorMatchActive(short match); bool TestRotatorMatchActive(short match);
bool TestSlidorMatchActive(short match); bool TestSlidorMatchActive(short match);
int PlayerCheckDeath(PLAYERp, short); int PlayerCheckDeath(PLAYERp, DSWActor*);
void DoVatorOperate(PLAYERp, short); void DoVatorOperate(PLAYERp, short);
void DoVatorMatch(PLAYERp pp, short match); void DoVatorMatch(PLAYERp pp, short match);
void DoRotatorOperate(PLAYERp, short); void DoRotatorOperate(PLAYERp, short);
@ -2131,7 +2131,7 @@ short PlayerTakeSectorDamage(PLAYERp pp)
u->DamageTics = DAMAGE_TIME; u->DamageTics = DAMAGE_TIME;
PlayerUpdateHealth(pp, -sectu->damage); PlayerUpdateHealth(pp, -sectu->damage);
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
} }
return 0; return 0;
} }

View file

@ -5507,15 +5507,14 @@ RadiusGetDamage(short SpriteNum, short Weapon, int max_damage)
} }
int int PlayerCheckDeath(PLAYERp pp, DSWActor* weapActor)
PlayerCheckDeath(PLAYERp pp, short Weapon)
{ {
SPRITEp sp = &pp->Actor()->s(); SPRITEp sp = &pp->Actor()->s();
USERp u = pp->Actor()->u(); USERp u = pp->Actor()->u();
// Store off what player was struck by // Store off what player was struck by
pp->HitBy = Weapon; pp->HitBy = weapActor;
if (u->Health <= 0 && !TEST(pp->Flags, PF_DEAD)) if (u->Health <= 0 && !TEST(pp->Flags, PF_DEAD))
{ {
@ -5528,24 +5527,23 @@ PlayerCheckDeath(PLAYERp pp, short Weapon)
else else
pp->DeathType = PLAYER_DEATH_FLIP; pp->DeathType = PLAYER_DEATH_FLIP;
if (Weapon < 0) if (weapActor == nullptr)
{ {
pp->KillerActor = nullptr;; pp->KillerActor = nullptr;
DoPlayerBeginDie(pp); DoPlayerBeginDie(pp);
return true; return true;
} }
auto weapActor = &swActors[Weapon];
SPRITEp wp = &weapActor->s(); SPRITEp wp = &weapActor->s();
USERp wu = weapActor->u(); USERp wu = weapActor->u();
if (Weapon > -1 && (wu->ID == RIPPER_RUN_R0 || wu->ID == RIPPER2_RUN_R0)) if (weapActor != nullptr && (wu->ID == RIPPER_RUN_R0 || wu->ID == RIPPER2_RUN_R0))
pp->DeathType = PLAYER_DEATH_RIPPER; pp->DeathType = PLAYER_DEATH_RIPPER;
if (Weapon > -1 && wu->ID == CALTROPS) if (weapActor != nullptr && wu->ID == CALTROPS)
pp->DeathType = PLAYER_DEATH_FLIP; pp->DeathType = PLAYER_DEATH_FLIP;
if (Weapon > -1 && wu->ID == NINJA_RUN_R0 && wu->PlayerP) if (weapActor != nullptr && wu->ID == NINJA_RUN_R0 && wu->PlayerP)
{ {
pp->DeathType = PLAYER_DEATH_FLIP; pp->DeathType = PLAYER_DEATH_FLIP;
wu->PlayerP->Bloody = true; wu->PlayerP->Bloody = true;
@ -5753,7 +5751,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, weapActor->GetSpriteIndex()); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -5823,7 +5821,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
if (u->PlayerP->Armor) if (u->PlayerP->Armor)
PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler); PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler);
@ -5857,7 +5855,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -5887,7 +5885,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -5917,7 +5915,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -5947,7 +5945,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
if (PlayerCheckDeath(u->PlayerP, Weapon)) if (PlayerCheckDeath(u->PlayerP, weapActor))
{ {
PlaySound(DIGI_RIPPERHEARTOUT,u->PlayerP,v3df_dontpan|v3df_doppler); PlaySound(DIGI_RIPPERHEARTOUT,u->PlayerP,v3df_dontpan|v3df_doppler);
@ -5981,7 +5979,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
if (PlayerCheckDeath(u->PlayerP, Weapon)) if (PlayerCheckDeath(u->PlayerP, weapActor))
{ {
PlaySound(DIGI_RIPPERHEARTOUT,u->PlayerP,v3df_dontpan|v3df_doppler); PlaySound(DIGI_RIPPERHEARTOUT,u->PlayerP,v3df_dontpan|v3df_doppler);
@ -6016,7 +6014,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
if (PlayerCheckDeath(u->PlayerP, Weapon)) if (PlayerCheckDeath(u->PlayerP, weapActor))
{ {
DoBunnyRipHeart(weapActor); DoBunnyRipHeart(weapActor);
} }
@ -6047,7 +6045,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6087,7 +6085,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
} }
@ -6124,7 +6122,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
if (u->PlayerP->Armor) if (u->PlayerP->Armor)
PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler); PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler);
@ -6158,7 +6156,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
if (u->PlayerP->Armor) if (u->PlayerP->Armor)
PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler); PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler);
@ -6191,7 +6189,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6222,7 +6220,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6258,7 +6256,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
if (u->PlayerP->Armor) if (u->PlayerP->Armor)
PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler); PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler);
@ -6307,7 +6305,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
if (u->PlayerP->Armor) if (u->PlayerP->Armor)
PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler); PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler);
@ -6356,7 +6354,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6383,7 +6381,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6408,7 +6406,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6442,7 +6440,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
if (u->PlayerP->Armor) if (u->PlayerP->Armor)
PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler); PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler);
@ -6482,7 +6480,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6512,7 +6510,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6545,7 +6543,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6576,7 +6574,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6607,7 +6605,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
if (PlayerCheckDeath(u->PlayerP, Weapon)) if (PlayerCheckDeath(u->PlayerP, weapActor))
{ {
// degrade blood worm life // degrade blood worm life
wu->Counter3 += (4*120)/MISSILEMOVETICS; wu->Counter3 += (4*120)/MISSILEMOVETICS;
@ -6644,7 +6642,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6681,7 +6679,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6717,7 +6715,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6750,7 +6748,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6789,7 +6787,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6828,7 +6826,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6856,7 +6854,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6881,7 +6879,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6915,7 +6913,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6946,7 +6944,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -6979,7 +6977,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
if (u->PlayerP->Armor) if (u->PlayerP->Armor)
PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler); PlaySound(DIGI_ARMORHIT,u->PlayerP,v3df_dontpan|v3df_follow|v3df_doppler);
@ -7010,7 +7008,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (PlayerTakeDamage(u->PlayerP, weapActor)) if (PlayerTakeDamage(u->PlayerP, weapActor))
{ {
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -7037,7 +7035,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
PlayerSound(DIGI_GASHURT, v3df_dontpan|v3df_follow|v3df_doppler,pp); PlayerSound(DIGI_GASHURT, v3df_dontpan|v3df_follow|v3df_doppler,pp);
PlayerUpdateHealth(u->PlayerP, damage-1000); PlayerUpdateHealth(u->PlayerP, damage-1000);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -7063,7 +7061,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
else if (u->PlayerP) else if (u->PlayerP)
{ {
//PlayerUpdateHealth(u->PlayerP, damage); //PlayerUpdateHealth(u->PlayerP, damage);
//PlayerCheckDeath(u->PlayerP, Weapon); //PlayerCheckDeath(u->PlayerP, weapActor);
} }
else else
{ {
@ -7105,7 +7103,7 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
if (RANDOM_P2(1024<<4)>>4 < 800) if (RANDOM_P2(1024<<4)>>4 < 800)
PlayerSound(DIGI_STEPONCALTROPS, v3df_follow|v3df_dontpan, u->PlayerP); PlayerSound(DIGI_STEPONCALTROPS, v3df_follow|v3df_dontpan, u->PlayerP);
PlayerUpdateHealth(u->PlayerP, damage); PlayerUpdateHealth(u->PlayerP, damage);
PlayerCheckDeath(u->PlayerP, Weapon); PlayerCheckDeath(u->PlayerP, weapActor);
} }
} }
else else
@ -7172,9 +7170,10 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
} }
// Select death text based on ID // Select death text based on ID
const char *DeathString(short SpriteNum) const char *DeathString(DSWActor* actor)
{ {
USERp ku = User[SpriteNum].Data(); if (!actor->hasU()) return " ";
USERp ku = actor->u();
switch (ku->ID) switch (ku->ID)
{ {
@ -12985,7 +12984,7 @@ int InitFistAttack(PLAYERp pp)
if (PlayerTakeDamage(pp, nullptr)) if (PlayerTakeDamage(pp, nullptr))
{ {
PlayerUpdateHealth(pp, -(RandomRange(2<<8)>>8)); PlayerUpdateHealth(pp, -(RandomRange(2<<8)>>8));
PlayerCheckDeath(pp, -1); PlayerCheckDeath(pp, nullptr);
} }
} }
} }

View file

@ -92,7 +92,7 @@ bool MissileSetPos(DSWActor*,ANIMATORp DoWeapon,int dist);
int ActorPain(short SpriteNum); int ActorPain(short SpriteNum);
int SpawnBreakFlames(DSWActor*); int SpawnBreakFlames(DSWActor*);
bool PlayerTakeDamage(PLAYERp pp, DSWActor* weapActor); bool PlayerTakeDamage(PLAYERp pp, DSWActor* weapActor);
const char *DeathString(short SpriteNum); const char *DeathString(DSWActor*);
// //
// Damage Amounts defined in damage.h // Damage Amounts defined in damage.h
@ -233,7 +233,7 @@ void SpriteQueueDelete(DSWActor* actor);
int HelpMissileLateral(DSWActor*, int dist); int HelpMissileLateral(DSWActor*, int dist);
void AddSpriteToSectorObject(DSWActor*,SECTOR_OBJECTp sop); void AddSpriteToSectorObject(DSWActor*,SECTOR_OBJECTp sop);
void QueueReset(void); void QueueReset(void);
int PlayerCheckDeath(PLAYERp pp,short Weapon); int PlayerCheckDeath(PLAYERp pp,DSWActor*);
bool SpriteWarpToUnderwater(DSWActor* actor); bool SpriteWarpToUnderwater(DSWActor* actor);
int PlayerDamageSlide(PLAYERp pp,int damage,short ang); int PlayerDamageSlide(PLAYERp pp,int damage,short ang);
bool VehicleMoveHit(DSWActor*); bool VehicleMoveHit(DSWActor*);

View file

@ -307,7 +307,7 @@ struct SWPlayer native
native bool NukeInitialized; // Nuke already has counted down native bool NukeInitialized; // Nuke already has counted down
native int16 FistAng; // KungFu attack angle native int16 FistAng; // KungFu attack angle
native uint8 WpnKungFuMove; // KungFu special moves native uint8 WpnKungFuMove; // KungFu special moves
native int16 HitBy; // SpriteNum of whatever player was last hit by //native int16 HitBy; // SpriteNum of whatever player was last hit by
native int16 Reverb; // Player's current reverb setting native int16 Reverb; // Player's current reverb setting
native int16 Heads; // Number of Accursed Heads orbiting player native int16 Heads; // Number of Accursed Heads orbiting player
native int PlayerVersion; native int PlayerVersion;