From 674c63d66c255ae5fc6f0c795ef19c327dafb2db Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 23 Apr 2010 08:12:47 +0000 Subject: [PATCH] - fixed: A_KeenDie should not drop items. SVN r2300 (trunk) --- src/g_doom/a_keen.cpp | 2 +- src/g_doom/a_painelemental.cpp | 2 +- src/g_shared/a_action.cpp | 15 ++++--- src/g_strife/a_alienspectres.cpp | 2 +- src/p_enemy.cpp | 4 +- src/p_enemy.h | 1 + src/thingdef/thingdef_codeptr.cpp | 68 +++++++++++++++---------------- 7 files changed, 50 insertions(+), 44 deletions(-) diff --git a/src/g_doom/a_keen.cpp b/src/g_doom/a_keen.cpp index 42231a915c..1504bdf389 100644 --- a/src/g_doom/a_keen.cpp +++ b/src/g_doom/a_keen.cpp @@ -15,7 +15,7 @@ // DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KeenDie) { - CALL_ACTION(A_NoBlocking, self); + A_Unblock(self, false); // scan the remaining thinkers to see if all Keens are dead AActor *other; diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index c521379194..0f4ec47416 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -162,7 +162,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainDie) self->flags &= ~MF_FRIENDLY; } const PClass *spawntype = GetSpawnType(PUSH_PARAMINFO); - CALL_ACTION(A_NoBlocking, self); + A_Unblock(self, true); A_PainShootSkull (self, self->angle + ANG90, spawntype); A_PainShootSkull (self, self->angle + ANG180, spawntype); A_PainShootSkull (self, self->angle + ANG270, spawntype); diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index 571b7bf1f8..3697bcba86 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -57,7 +57,7 @@ IMPLEMENT_CLASS (ASwitchingDecoration) // //---------------------------------------------------------------------------- -DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking) +void A_Unblock(AActor *self, bool drop) { // [RH] Andy Baker's stealth monsters if (self->flags & MF_STEALTH) @@ -78,8 +78,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking) self->Conversation = NULL; - // If the self has attached metadata for items to drop, drop those. - if (!self->IsKindOf (RUNTIME_CLASS (APlayerPawn))) // [GRB] + // If the actor has attached metadata for items to drop, drop those. + if (drop && !self->IsKindOf (RUNTIME_CLASS (APlayerPawn))) // [GRB] { FDropItem *di = self->GetDropItems(); @@ -98,9 +98,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking) } } +DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking) +{ + A_Unblock(self, true); +} + DEFINE_ACTION_FUNCTION(AActor, A_Fall) { - CALL_ACTION(A_NoBlocking, self); + A_Unblock(self, true); } //========================================================================== @@ -301,7 +306,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks) { CALL_ACTION(A_BossDeath, self); } - CALL_ACTION(A_NoBlocking, self); + A_Unblock(self, true); self->SetState(self->FindState(NAME_Null)); } diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 6506cdb1cc..169889b2e1 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -85,7 +85,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) int log; int i; - CALL_ACTION(A_NoBlocking, self); // [RH] Need this for Sigil rewarding + A_Unblock(self, true); // [RH] Need this for Sigil rewarding if (!CheckBossDeath (self)) { return; diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 5585337427..3701a7b910 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2784,7 +2784,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_XScream) DEFINE_ACTION_FUNCTION(AActor, A_ScreamAndUnblock) { CALL_ACTION(A_Scream, self); - CALL_ACTION(A_NoBlocking, self); + A_Unblock(self, true); } //=========================================================================== @@ -2810,7 +2810,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ActiveSound) DEFINE_ACTION_FUNCTION(AActor, A_ActiveAndUnblock) { CALL_ACTION(A_ActiveSound, self); - CALL_ACTION(A_NoBlocking, self); + A_Unblock(self, true); } //--------------------------------------------------------------------------- diff --git a/src/p_enemy.h b/src/p_enemy.h index ce5703e73a..86261dd45c 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -55,6 +55,7 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int special, int cha void P_TossItem (AActor *item); bool P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params); void A_Weave(AActor *self, int xyspeed, int zspeed, fixed_t xydist, fixed_t zdist); +void A_Unblock(AActor *self, bool drop); DECLARE_ACTION(A_Look) DECLARE_ACTION(A_Wander) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 6d066684b6..df4861f721 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2119,47 +2119,47 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) ACTION_PARAM_START(1); ACTION_PARAM_CLASS(chunk, 0); - int i, numChunks; - AActor * mo; + int i, numChunks; + AActor * mo; - if (chunk == NULL) return; + if (chunk == NULL) return; - self->velx = self->vely = self->velz = 0; - self->height = self->GetDefault()->height; + self->velx = self->vely = self->velz = 0; + self->height = self->GetDefault()->height; - // [RH] In Hexen, this creates a random number of shards (range [24,56]) - // with no relation to the size of the self shattering. I think it should - // base the number of shards on the size of the dead thing, so bigger - // things break up into more shards than smaller things. - // An self with radius 20 and height 64 creates ~40 chunks. - numChunks = MAX (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32); - i = (pr_burst.Random2()) % (numChunks/4); - for (i = MAX (24, numChunks + i); i >= 0; i--) - { - mo = Spawn(chunk, - self->x + (((pr_burst()-128)*self->radius)>>7), - self->y + (((pr_burst()-128)*self->radius)>>7), - self->z + (pr_burst()*self->height/255), ALLOW_REPLACE); + // [RH] In Hexen, this creates a random number of shards (range [24,56]) + // with no relation to the size of the self shattering. I think it should + // base the number of shards on the size of the dead thing, so bigger + // things break up into more shards than smaller things. + // An self with radius 20 and height 64 creates ~40 chunks. + numChunks = MAX (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32); + i = (pr_burst.Random2()) % (numChunks/4); + for (i = MAX (24, numChunks + i); i >= 0; i--) + { + mo = Spawn(chunk, + self->x + (((pr_burst()-128)*self->radius)>>7), + self->y + (((pr_burst()-128)*self->radius)>>7), + self->z + (pr_burst()*self->height/255), ALLOW_REPLACE); - if (mo) - { - mo->velz = FixedDiv(mo->z - self->z, self->height)<<2; - mo->velx = pr_burst.Random2 () << (FRACBITS-7); - mo->vely = pr_burst.Random2 () << (FRACBITS-7); - mo->RenderStyle = self->RenderStyle; - mo->alpha = self->alpha; - mo->CopyFriendliness(self, true); - } - } + if (mo) + { + mo->velz = FixedDiv(mo->z - self->z, self->height)<<2; + mo->velx = pr_burst.Random2 () << (FRACBITS-7); + mo->vely = pr_burst.Random2 () << (FRACBITS-7); + mo->RenderStyle = self->RenderStyle; + mo->alpha = self->alpha; + mo->CopyFriendliness(self, true); + } + } - // [RH] Do some stuff to make this more useful outside Hexen - if (self->flags4 & MF4_BOSSDEATH) - { + // [RH] Do some stuff to make this more useful outside Hexen + if (self->flags4 & MF4_BOSSDEATH) + { CALL_ACTION(A_BossDeath, self); - } - CALL_ACTION(A_NoBlocking, self); + } + A_Unblock(self, true); - self->Destroy (); + self->Destroy (); } //===========================================================================