mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- Fixed: Poison damage lost damage type information if the poisoner was destroyed before poisoncount
reached 0. - Fixed: Poisoners without a PainType should use their own DamageType to pick the Pain state to make the target enter, not the target's DamageType. SVN r3475 (trunk)
This commit is contained in:
parent
3e4ac58f7c
commit
49ea87f8bc
3 changed files with 36 additions and 10 deletions
|
@ -311,6 +311,8 @@ public:
|
|||
int damagecount, bonuscount;// for screen flashing
|
||||
int hazardcount; // for delayed Strife damage
|
||||
int poisoncount; // screen flash for poison damage
|
||||
FName poisontype; // type of poison damage to apply
|
||||
FName poisonpaintype; // type of Pain state to enter for poison damage
|
||||
TObjPtr<AActor> poisoner; // NULL for non-player actors
|
||||
TObjPtr<AActor> attacker; // who did damage (NULL for floors)
|
||||
int extralight; // so gun flashes light up areas
|
||||
|
|
|
@ -1488,6 +1488,15 @@ bool P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poi
|
|||
{
|
||||
player->poisoncount += poison;
|
||||
player->poisoner = poisoner;
|
||||
if (poisoner == NULL)
|
||||
{
|
||||
player->poisontype = player->poisonpaintype = NAME_None;
|
||||
}
|
||||
else
|
||||
{ // We need to record these in case the poisoner disappears before poisoncount reaches 0.
|
||||
player->poisontype = poisoner->DamageType;
|
||||
player->poisonpaintype = poisoner->PainType != NAME_None ? poisoner->PainType : poisoner->DamageType;
|
||||
}
|
||||
if(player->poisoncount > 100)
|
||||
{
|
||||
player->poisoncount = 100;
|
||||
|
@ -1528,12 +1537,12 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage,
|
|||
&& (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch)
|
||||
&& !player->morphTics)
|
||||
{ // Try to use some inventory health
|
||||
P_AutoUseHealth (player, damage - player->health+1);
|
||||
P_AutoUseHealth(player, damage - player->health+1);
|
||||
}
|
||||
player->health -= damage; // mirror mobj health here for Dave
|
||||
if (player->health < 50 && !deathmatch)
|
||||
{
|
||||
P_AutoUseStrifeHealth (player);
|
||||
P_AutoUseStrifeHealth(player);
|
||||
}
|
||||
if (player->health < 0)
|
||||
{
|
||||
|
@ -1547,30 +1556,35 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage,
|
|||
target->health -= damage;
|
||||
if (target->health <= 0)
|
||||
{ // Death
|
||||
if ( player->cheats & CF_BUDDHA )
|
||||
if (player->cheats & CF_BUDDHA)
|
||||
{ // [SP] Save the player...
|
||||
player->health = target->health = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
target->special1 = damage;
|
||||
if (player && inflictor && !player->morphTics)
|
||||
if (player && !player->morphTics)
|
||||
{ // Check for flame death
|
||||
if ((inflictor->DamageType == NAME_Fire)
|
||||
&& (target->health > -50) && (damage > 25))
|
||||
if ((player->poisontype == NAME_Fire) && (target->health > -50) && (damage > 25))
|
||||
{
|
||||
target->DamageType = NAME_Fire;
|
||||
}
|
||||
else target->DamageType = inflictor->DamageType;
|
||||
else
|
||||
{
|
||||
target->DamageType = player->poisontype;
|
||||
}
|
||||
}
|
||||
target->Die (source, source);
|
||||
target->Die(source, source);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!(level.time&63) && playPainSound)
|
||||
{
|
||||
FState * painstate = target->FindState(NAME_Pain,((inflictor && inflictor->PainType != NAME_None) ? inflictor->PainType : target->DamageType));
|
||||
if (painstate != NULL) target->SetState (painstate);
|
||||
FState *painstate = target->FindState(NAME_Pain, player->poisonpaintype);
|
||||
if (painstate != NULL)
|
||||
{
|
||||
target->SetState(painstate);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if((P_Random() < target->info->painchance)
|
||||
|
|
|
@ -2658,6 +2658,16 @@ void player_t::Serialize (FArchive &arc)
|
|||
<< original_cmd
|
||||
<< original_oldbuttons;
|
||||
|
||||
if (SaveVersion >= 3475)
|
||||
{
|
||||
arc << poisontype << poisonpaintype;
|
||||
}
|
||||
else if (poisoner != NULL)
|
||||
{
|
||||
poisontype = poisoner->DamageType;
|
||||
poisonpaintype = poisoner->PainType != NAME_None ? poisoner->PainType : poisoner->DamageType;
|
||||
}
|
||||
|
||||
if (isbot)
|
||||
{
|
||||
arc << angle
|
||||
|
|
Loading…
Reference in a new issue