- made the event manager an object so it can be instantiated multiple times.

This commit is contained in:
Christoph Oelckers 2019-02-02 10:46:34 +01:00
commit 484485f3cf
21 changed files with 257 additions and 246 deletions

View file

@ -347,7 +347,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
}
// [ZZ] Fire WorldThingDied script hook.
E_WorldThingDied(this, inflictor);
eventManager.WorldThingDied(this, inflictor);
// [JM] Fire KILL type scripts for actor. Not needed for players, since they have the "DEATH" script type.
if (!player && !(flags7 & MF7_NOKILLSCRIPTS) && ((flags7 & MF7_USEKILLSCRIPTS) || gameinfo.forcekillscripts))
@ -560,7 +560,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
ClientObituary (this, inflictor, source, dmgflags, MeansOfDeath);
// [ZZ] fire player death hook
E_PlayerDied(Level->PlayerNum(player));
eventManager.PlayerDied(Level->PlayerNum(player));
// Death script execution, care of Skull Tag
Level->Behaviors.StartTypedScripts (SCRIPT_Death, this, true);
@ -1460,7 +1460,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
}
const int realdamage = MAX(0, damage);
E_WorldThingDamaged(target, inflictor, source, realdamage, mod, flags, angle);
eventManager.WorldThingDamaged(target, inflictor, source, realdamage, mod, flags, angle);
needevent = false;
target->CallDie (source, inflictor, flags, MeansOfDeath);
@ -1481,7 +1481,7 @@ static int DoDamageMobj(AActor *target, AActor *inflictor, AActor *source, int d
if (realdamage > 0 && 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);
eventManager.WorldThingDamaged(target, inflictor, source, realdamage, mod, flags, angle);
}
return MAX(0, realdamage);