- added DavidPH's PoisonDamageType submission.

SVN r3235 (trunk)
This commit is contained in:
Christoph Oelckers 2011-06-13 10:39:14 +00:00
parent a587ffed57
commit 44921297d3
6 changed files with 27 additions and 13 deletions

View file

@ -874,10 +874,12 @@ public:
line_t *BlockingLine; // Line that blocked the last move
int PoisonDamage; // Damage received per tic from poison.
FNameNoInit PoisonDamageType; // Damage type dealt by poison.
int PoisonDuration; // Duration left for receiving poison damage.
int PoisonPeriod; // How often poison damage is applied. (Every X tics.)
int PoisonDamageReceived; // Damage received per tic from poison.
FNameNoInit PoisonDamageTypeReceived; // Damage type received by poison.
int PoisonDurationReceived; // Duration left for receiving poison damage.
int PoisonPeriodReceived; // How often poison damage is applied. (Every X tics.)
TObjPtr<AActor> Poisoner; // Last source of received poison damage.

View file

@ -1368,11 +1368,8 @@ dopain:
target->flags |= MF_JUSTHIT; // fight back!
}
void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int duration, int period)
void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int duration, int period, FName type)
{
int olddamage = target->PoisonDamageReceived;
int oldduration = target->PoisonDurationReceived;
// Check for invulnerability.
if (!(inflictor->flags6 & MF6_POISONALWAYS))
{
@ -1393,6 +1390,8 @@ void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage
}
target->Poisoner = source;
target->PoisonDamageTypeReceived = type;
target->PoisonPeriodReceived = period;
if (inflictor->flags6 & MF6_ADDITIVEPOISONDAMAGE)
{
@ -1412,7 +1411,6 @@ void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage
target->PoisonDurationReceived = duration;
}
target->PoisonPeriodReceived = period;
}
bool AActor::OkayToSwitchTarget (AActor *other)

View file

@ -479,7 +479,7 @@ extern FBlockNode** blocklinks; // for thing chains
//
void P_TouchSpecialThing (AActor *special, AActor *toucher);
void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags=0);
void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int duration, int period);
void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int duration, int period, FName type);
bool P_GiveBody (AActor *actor, int num);
bool P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poison);
void P_PoisonDamage (player_t *player, AActor *source, int damage, bool playPainSound);

View file

@ -1118,7 +1118,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
// Do poisoning (if using new style poison)
if (tm.thing->PoisonDamage > 0 && tm.thing->PoisonDuration != INT_MIN)
{
P_PoisonMobj(thing, tm.thing, tm.thing->target, tm.thing->PoisonDamage, tm.thing->PoisonDuration, tm.thing->PoisonPeriod);
P_PoisonMobj(thing, tm.thing, tm.thing->target, tm.thing->PoisonDamage, tm.thing->PoisonDuration, tm.thing->PoisonPeriod, tm.thing->PoisonDamageType);
}
damage = tm.thing->GetMissileDamage (3, 2);
@ -1146,7 +1146,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
// Do poisoning (if using new style poison)
if (tm.thing->PoisonDamage > 0 && tm.thing->PoisonDuration != INT_MIN)
{
P_PoisonMobj(thing, tm.thing, tm.thing->target, tm.thing->PoisonDamage, tm.thing->PoisonDuration, tm.thing->PoisonPeriod);
P_PoisonMobj(thing, tm.thing, tm.thing->target, tm.thing->PoisonDamage, tm.thing->PoisonDuration, tm.thing->PoisonPeriod, tm.thing->PoisonDamageType);
}
// Do damage
@ -3526,7 +3526,7 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
// Allow puffs to inflict poison damage, so that hitscans can poison, too.
if (puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN)
{
P_PoisonMobj(trace.Actor, puff ? puff : t1, t1, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod);
P_PoisonMobj(trace.Actor, puff ? puff : t1, t1, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType);
}
// [GZ] If MF6_FORCEPAIN is set, we need to call P_DamageMobj even if damage is 0!
@ -3900,7 +3900,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
if (spawnpuff) P_SpawnPuff (source, puffclass, x, y, z, (source->angle + angleoffset) - ANG90, 1, PF_HITTHING);
if (puffDefaults && puffDefaults->PoisonDamage > 0 && puffDefaults->PoisonDuration != INT_MIN)
P_PoisonMobj(RailHits[i].HitActor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod);
P_PoisonMobj(RailHits[i].HitActor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType);
P_DamageMobj (RailHits[i].HitActor, thepuff? thepuff:source, source, damage, damagetype, DMG_INFLICTOR_IS_PUFF);
}

View file

@ -313,8 +313,12 @@ void AActor::Serialize (FArchive &arc)
<< DamageFactor
<< WeaveIndexXY << WeaveIndexZ
<< PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner
<< PoisonDamage << PoisonDuration << PoisonPeriod
<< ConversationRoot << Conversation;
<< PoisonDamage << PoisonDuration << PoisonPeriod;
if (SaveVersion >= 3235)
{
arc << PoisonDamageType << PoisonDamageTypeReceived;
}
arc << ConversationRoot << Conversation;
{
FString tagstr;
@ -3231,7 +3235,7 @@ void AActor::Tick ()
// Check for poison damage, but only once per PoisonPeriod tics (or once per second if none).
if (PoisonDurationReceived && (level.time % (PoisonPeriodReceived ? PoisonPeriodReceived : TICRATE) == 0))
{
P_DamageMobj(this, NULL, Poisoner, PoisonDamageReceived, NAME_Poison, 0);
P_DamageMobj(this, NULL, Poisoner, PoisonDamageReceived, PoisonDamageTypeReceived ? PoisonDamageTypeReceived : (FName)NAME_Poison, 0);
--PoisonDurationReceived;

View file

@ -1090,6 +1090,16 @@ DEFINE_PROPERTY(poisondamage, Iii, Actor)
}
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(poisondamagetype, S, Actor)
{
PROP_STRING_PARM(poisondamagetype, 0);
defaults->PoisonDamageType = poisondamagetype;
}
//==========================================================================
//
//==========================================================================