mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 01:21:17 +00:00
- fixed: A global variable was used to pass MeansOfDeath to ClientObituary.
The problem here is that this affects the public scripting interface so it cannot be committed to master without further adjustments. # Conflicts: # src/p_interaction.cpp
This commit is contained in:
parent
1906245368
commit
f48b2d8b71
10 changed files with 32 additions and 33 deletions
|
@ -691,8 +691,8 @@ public:
|
|||
void CallDeactivate(AActor *activator);
|
||||
|
||||
// Called when actor dies
|
||||
virtual void Die (AActor *source, AActor *inflictor, int dmgflags = 0);
|
||||
void CallDie(AActor *source, AActor *inflictor, int dmgflags = 0);
|
||||
virtual void Die (AActor *source, AActor *inflictor, int dmgflags = 0, FName MeansOfDeath = NAME_None);
|
||||
void CallDie(AActor *source, AActor *inflictor, int dmgflags = 0, FName MeansOfDeath = NAME_None);
|
||||
|
||||
// Perform some special damage action. Returns the amount of damage to do.
|
||||
// Returning -1 signals the damage routine to exit immediately
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
virtual bool UseInventory (AInventory *item) override;
|
||||
virtual void MarkPrecacheSounds () const override;
|
||||
virtual void BeginPlay () override;
|
||||
virtual void Die (AActor *source, AActor *inflictor, int dmgflags) override;
|
||||
virtual void Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOfDeath) override;
|
||||
virtual bool UpdateWaterLevel (bool splash) override;
|
||||
|
||||
bool ResetAirSupply (bool playgasp = true);
|
||||
|
|
|
@ -701,7 +701,7 @@ void AMorphedMonster::OnDestroy ()
|
|||
Super::OnDestroy();
|
||||
}
|
||||
|
||||
void AMorphedMonster::Die (AActor *source, AActor *inflictor, int dmgflags)
|
||||
void AMorphedMonster::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOfDeath)
|
||||
{
|
||||
// Dead things don't unmorph
|
||||
// flags3 |= MF3_STAYMORPHED;
|
||||
|
@ -709,11 +709,11 @@ void AMorphedMonster::Die (AActor *source, AActor *inflictor, int dmgflags)
|
|||
// But they can now, so that line above has been
|
||||
// moved into P_MorphedDeath() and is now set by
|
||||
// that function if and only if it is needed.
|
||||
Super::Die (source, inflictor, dmgflags);
|
||||
Super::Die (source, inflictor, dmgflags, MeansOfDeath);
|
||||
if (UnmorphedMe != NULL && (UnmorphedMe->flags & MF_UNMORPHED))
|
||||
{
|
||||
UnmorphedMe->health = health;
|
||||
UnmorphedMe->CallDie (source, inflictor, dmgflags);
|
||||
UnmorphedMe->CallDie (source, inflictor, dmgflags, MeansOfDeath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
void Tick ();
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Die (AActor *source, AActor *inflictor, int dmgflags);
|
||||
void Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOfDeath) override;
|
||||
void OnDestroy() override;
|
||||
|
||||
TObjPtr<AActor*> UnmorphedMe;
|
||||
|
|
|
@ -83,8 +83,6 @@ CVAR (Float, sv_damagefactormobj, 1.0, CVAR_SERVERINFO|CVAR_CHEAT)
|
|||
CVAR (Float, sv_damagefactorfriendly, 1.0, CVAR_SERVERINFO|CVAR_CHEAT)
|
||||
CVAR (Float, sv_damagefactorplayer, 1.0, CVAR_SERVERINFO|CVAR_CHEAT)
|
||||
|
||||
FName MeansOfDeath;
|
||||
|
||||
//
|
||||
// GET STUFF
|
||||
//
|
||||
|
@ -187,7 +185,7 @@ void SexMessage (const char *from, char *to, int gender, const char *victim, con
|
|||
// [RH]
|
||||
// ClientObituary: Show a message when a player dies
|
||||
//
|
||||
void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgflags)
|
||||
void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgflags, FName MeansOfDeath)
|
||||
{
|
||||
FName mod;
|
||||
FString ret;
|
||||
|
@ -289,7 +287,7 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf
|
|||
//
|
||||
EXTERN_CVAR (Int, fraglimit)
|
||||
|
||||
void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
|
||||
void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOfDeath)
|
||||
{
|
||||
// Handle possible unmorph on death
|
||||
bool wasgibbed = (health < GetGibHealth());
|
||||
|
@ -308,7 +306,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
|
|||
realthis->health = realgibhealth -1; // if morphed was gibbed, so must original be (where allowed)l
|
||||
}
|
||||
}
|
||||
realthis->CallDie(source, inflictor, dmgflags);
|
||||
realthis->CallDie(source, inflictor, dmgflags, MeansOfDeath);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -560,7 +558,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
|
|||
if (player)
|
||||
{
|
||||
// [RH] Death messages
|
||||
ClientObituary (this, inflictor, source, dmgflags);
|
||||
ClientObituary (this, inflictor, source, dmgflags, MeansOfDeath);
|
||||
|
||||
// [ZZ] fire player death hook
|
||||
E_PlayerDied(int(player - players));
|
||||
|
@ -733,18 +731,19 @@ DEFINE_ACTION_FUNCTION(AActor, Die)
|
|||
PARAM_OBJECT(source, AActor);
|
||||
PARAM_OBJECT(inflictor, AActor);
|
||||
PARAM_INT_DEF(dmgflags);
|
||||
self->Die(source, inflictor, dmgflags);
|
||||
PARAM_NAME_DEF(MeansOfDeath);
|
||||
self->Die(source, inflictor, dmgflags, MeansOfDeath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AActor::CallDie(AActor *source, AActor *inflictor, int dmgflags)
|
||||
void AActor::CallDie(AActor *source, AActor *inflictor, int dmgflags, FName MeansOfDeath)
|
||||
{
|
||||
IFVIRTUAL(AActor, Die)
|
||||
{
|
||||
VMValue params[4] = { (DObject*)this, source, inflictor, dmgflags };
|
||||
VMCall(func, params, 4, nullptr, 0);
|
||||
VMValue params[] = { (DObject*)this, source, inflictor, dmgflags, MeansOfDeath.GetIndex() };
|
||||
VMCall(func, params, 5, nullptr, 0);
|
||||
}
|
||||
else return Die(source, inflictor, dmgflags);
|
||||
else return Die(source, inflictor, dmgflags, MeansOfDeath);
|
||||
}
|
||||
|
||||
|
||||
|
@ -941,6 +940,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
|
|||
{ // Shouldn't happen
|
||||
return 0;
|
||||
}
|
||||
FName MeansOfDeath = mod;
|
||||
|
||||
// Rather than unnecessarily call the function over and over again, let's be a little more efficient.
|
||||
// But first, check and see if it's even needed, which it won't be if pain must not be triggered.
|
||||
|
@ -1020,7 +1020,6 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
|
|||
flags |= DMG_NO_ARMOR;
|
||||
}
|
||||
|
||||
MeansOfDeath = mod;
|
||||
// [RH] Andy Baker's Stealth monsters
|
||||
if (target->flags & MF_STEALTH)
|
||||
{
|
||||
|
@ -1515,7 +1514,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
|
|||
E_WorldThingDamaged(target, inflictor, source, realdamage, mod, flags, angle);
|
||||
needevent = false;
|
||||
|
||||
target->CallDie (source, inflictor, flags);
|
||||
target->CallDie (source, inflictor, flags, MeansOfDeath);
|
||||
return realdamage;
|
||||
}
|
||||
}
|
||||
|
@ -1646,7 +1645,7 @@ DEFINE_ACTION_FUNCTION(AActor, DamageMobj)
|
|||
int realdamage = DamageMobj(self, inflictor, source, damage, mod, flags, angle, needevent);
|
||||
if (realdamage && needevent)
|
||||
{
|
||||
E_WorldThingDamaged(self, inflictor, source, realdamage, mod, flags, angle);
|
||||
E_WorldThingDamaged(self, inflictor, source, realdamage, mod, flags, angle);
|
||||
}
|
||||
ACTION_RETURN_INT(realdamage);
|
||||
}
|
||||
|
@ -1668,8 +1667,8 @@ int P_DamageMobj(AActor *target, AActor *inflictor, AActor *source, int damage,
|
|||
int realdamage = DamageMobj(target, inflictor, source, damage, mod, flags, angle, needevent);
|
||||
if (realdamage && needevent)
|
||||
{
|
||||
// [ZZ] event handlers only need the resultant damage (they can't do anything about it anyway)
|
||||
E_WorldThingDamaged(target, inflictor, source, realdamage, mod, flags, angle);
|
||||
// [ZZ] event handlers only need the resultant damage (they can't do anything about it anyway)
|
||||
E_WorldThingDamaged(target, inflictor, source, realdamage, mod, flags, angle);
|
||||
}
|
||||
return realdamage;
|
||||
}
|
||||
|
|
|
@ -1664,15 +1664,15 @@ void APlayerPawn::ActivateMorphWeapon ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void APlayerPawn::Die (AActor *source, AActor *inflictor, int dmgflags)
|
||||
void APlayerPawn::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOfDeath)
|
||||
{
|
||||
Super::Die (source, inflictor, dmgflags);
|
||||
Super::Die (source, inflictor, dmgflags, MeansOfDeath);
|
||||
|
||||
if (player != NULL && player->mo == this) player->bonuscount = 0;
|
||||
|
||||
if (player != NULL && player->mo != this)
|
||||
{ // Make the real player die, too
|
||||
player->mo->CallDie (source, inflictor, dmgflags);
|
||||
player->mo->CallDie (source, inflictor, dmgflags, MeansOfDeath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -429,7 +429,7 @@ class Actor : Thinker native
|
|||
virtual native void Deactivate(Actor activator);
|
||||
virtual native int DoSpecialDamage (Actor target, int damage, Name damagetype);
|
||||
virtual native int TakeSpecialDamage (Actor inflictor, Actor source, int damage, Name damagetype);
|
||||
virtual native void Die(Actor source, Actor inflictor, int dmgflags = 0);
|
||||
virtual native void Die(Actor source, Actor inflictor, int dmgflags = 0, Name MeansOfDeath = 'none');
|
||||
virtual native bool Slam(Actor victim);
|
||||
virtual native void Touch(Actor toucher);
|
||||
virtual native void MarkPrecacheSounds();
|
||||
|
|
|
@ -112,13 +112,13 @@ class Heresiarch : Actor
|
|||
Stop;
|
||||
}
|
||||
|
||||
override void Die (Actor source, Actor inflictor, int dmgflags)
|
||||
override void Die (Actor source, Actor inflictor, int dmgflags, Name MeansOfDeath)
|
||||
{
|
||||
// The heresiarch just executes a script instead of a special upon death
|
||||
int script = special;
|
||||
special = 0;
|
||||
|
||||
Super.Die (source, inflictor, dmgflags);
|
||||
Super.Die (source, inflictor, dmgflags, MeansOfDeath);
|
||||
|
||||
if (script != 0)
|
||||
{
|
||||
|
|
|
@ -612,9 +612,9 @@ class MinotaurFriend : Minotaur
|
|||
StartTime = -1;
|
||||
}
|
||||
|
||||
override void Die (Actor source, Actor inflictor, int dmgflags)
|
||||
override void Die (Actor source, Actor inflictor, int dmgflags, Name MeansOfDeath)
|
||||
{
|
||||
Super.Die (source, inflictor, dmgflags);
|
||||
Super.Die (source, inflictor, dmgflags, MeansOfDeath);
|
||||
|
||||
if (tracer && tracer.health > 0 && tracer.player)
|
||||
{
|
||||
|
|
|
@ -1842,9 +1842,9 @@ class PowerCoupling : Actor
|
|||
Loop;
|
||||
}
|
||||
|
||||
override void Die (Actor source, Actor inflictor, int dmgflags)
|
||||
override void Die (Actor source, Actor inflictor, int dmgflags, Name MeansOfDeath)
|
||||
{
|
||||
Super.Die (source, inflictor, dmgflags);
|
||||
Super.Die (source, inflictor, dmgflags, MeansOfDeath);
|
||||
|
||||
int i;
|
||||
|
||||
|
|
Loading…
Reference in a new issue