From 45842e28bdd493ed96e5c9c6a24f6186f86a9401 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 15 Sep 2009 21:57:51 +0000 Subject: [PATCH] - added PinkSilver's A_Respawn enhancement patch. SVN r1837 (trunk) --- docs/rh-log.txt | 1 + src/thingdef/thingdef_codeptr.cpp | 47 +++++++++++++++++++++++++----- wadsrc/static/actors/actor.txt | 2 +- wadsrc/static/actors/constants.txt | 5 ++++ 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 5142f76d9..9c064977c 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ September 15, 2009 (Changes by Graf Zahl) +- added PinkSilver's A_Respawn enhancement patch. - added RandomSpawner update from Gez's experimental build. - added thing activation types for BUMPSPECIAL and USESPECIAL. Also added a new ClearSpecial flag to the activation type. diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 7c3dd9ee8..39a08cacd 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2122,27 +2122,58 @@ static void CheckStopped(AActor *self) // A_Respawn // //=========================================================================== + +enum RS_Flags +{ + RSF_FOG=1, + RSF_KEEPTARGET=2, + RSF_TELEFRAG=4, +}; + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn) { ACTION_PARAM_START(1); - ACTION_PARAM_BOOL(fog, 0); + ACTION_PARAM_INT(flags, 0); fixed_t x = self->SpawnPoint[0]; fixed_t y = self->SpawnPoint[1]; + bool oktorespawn = false; sector_t *sec; self->flags |= MF_SOLID; sec = P_PointInSector (x, y); - self->SetOrigin (x, y, sec->floorplane.ZatPoint (x, y)); self->height = self->GetDefault()->height; - if (P_TestMobjLocation (self)) + + if (flags & RSF_TELEFRAG) + { + // [KS] DIE DIE DIE DIE erm *ahem* =) + if (P_TeleportMove (self, x, y, sec->floorplane.ZatPoint (x, y), true)) oktorespawn = true; + } + else + { + self->SetOrigin (x, y, sec->floorplane.ZatPoint (x, y)); + if (P_TestMobjLocation (self)) oktorespawn = true; + } + + if (oktorespawn) { AActor *defs = self->GetDefault(); self->health = defs->health; - - // [KS] Don't keep target, because it could be self if the monster committed suicide - self->target = NULL; - self->LastHeard = NULL; + + // [KS] Don't keep target, because it could be self if the monster committed suicide + // ...Actually it's better off an option, so you have better control over monster behavior. + if (!(flags & RSF_KEEPTARGET)) + { + self->target = NULL; + self->LastHeard = NULL; + self->lastenemy = NULL; + } + else + { + // Don't attack yourself (Re: "Marine targets itself after suicide") + if (self->target == self) self->target = NULL; + if (self->lastenemy == self) self->lastenemy = NULL; + } self->flags = (defs->flags & ~MF_FRIENDLY) | (self->flags & MF_FRIENDLY); self->flags2 = defs->flags2; @@ -2152,7 +2183,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn) self->SetState (self->SpawnState); self->renderflags &= ~RF_INVISIBLE; - if (fog) + if (flags & RSF_FOG) { Spawn (x, y, self->z + TELEFOGHEIGHT, ALLOW_REPLACE); } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 7261c59b7..8a0d78b3f 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -230,7 +230,7 @@ ACTOR Actor native //: Thinker action native A_RadiusThrust(int force = 128, int distance = -1, bool affectsource = true); action native A_Explode(int damage = -1, int distance = -1, bool hurtsource = true, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10); action native A_Stop(); - action native A_Respawn(bool fog = true); + action native A_Respawn(int flags = 1); action native A_BarrelDestroy(); action native A_QueueCorpse(); action native A_DeQueueCorpse(); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 4b8fbc387..f69771f25 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -33,6 +33,11 @@ const int LOF_DONTCHASEGOAL = 4; const int LOF_NOSEESOUND = 8; const int LOF_FULLVOLSEESOUND = 16; +// Flags for A_Respawn +const int RSF_FOG = 1; +const int RSF_KEEPTARGET = 2; +const int RSF_TELEFRAG = 4; + // Flags for A_ChangeVelocity const int CVF_RELATIVE = 1; const int CVF_REPLACE = 2;