From 4fd717046e77215b90ea676771ca79850689829b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 13 Aug 2008 09:11:19 +0000 Subject: [PATCH] - fixed: Dehacked replaced pickups multiple times for changing its states. - fixed: Dehacked must copy AInventory's state to any item it hacks to be a pickup. - fixed a few more DECORATE bugs. SVN r1166 (trunk) --- docs/rh-log.txt | 6 ++++++ src/d_dehacked.cpp | 21 ++++++++++++++++--- src/g_shared/a_pickups.cpp | 7 ++----- src/thingdef/thingdef.h | 1 + src/thingdef/thingdef_states.cpp | 18 ++++++++++++++++ .../static/actors/hexen/hexenspecialdecs.txt | 1 + wadsrc/static/actors/shared/inventory.txt | 2 +- wadsrc/static/actors/strife/strifestuff.txt | 2 +- 8 files changed, 48 insertions(+), 10 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 8c340565e..ad18654a6 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +August 12, 2008 (Changes by Graf Zahl) +- fixed: Dehacked replaced pickups multiple times for changing its states. +- fixed: Dehacked must copy AInventory's state to any item it hacks to be a + pickup. +- fixed a few more DECORATE bugs. + August 12, 2008 (Changes by Graf Zahl) - Fixed: The chat sound for Strife was misnamed in the gameinfo structure. - fixed a few DECORATE bugs. diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 2b26e8f1f..67f5cce54 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -346,6 +346,15 @@ static bool ReadChars (char **stuff, int size); static char *igets (void); static int GetLine (void); +static void PushTouchedActor(PClass *cls) +{ + for(unsigned i = 0; i < TouchedActors.Size(); i++) + { + if (TouchedActors[i] == cls) return; + } + TouchedActors.Push(cls); +} + inline const char *GetName (int name) { return NameBase + NameOffs[name]; @@ -438,7 +447,8 @@ static FState *FindState (int statenum) { if (StateMap[i].OwnerIsPickup) { - TouchedActors.Push (const_cast(StateMap[i].Owner)); + + PushTouchedActor(const_cast(StateMap[i].Owner)); } return StateMap[i].State + statenum - stateacc; } @@ -1026,7 +1036,7 @@ static int PatchThing (int thingy) if (info->flags & MF_SPECIAL) { - TouchedActors.Push (const_cast(type)); + PushTouchedActor(const_cast(type)); } // Make MF3_ISMONSTER match MF_COUNTKILL @@ -2577,6 +2587,11 @@ void FinishDehPatch () // Make a copy the state labels MakeStateDefines(type->ActorInfo->StateList); + if (!type->IsDescendantOf(RUNTIME_CLASS(AInventory))) + { + // If this is a hacked non-inventory item we must also copy AInventory's special states + AddStateDefines(RUNTIME_CLASS(AInventory)->ActorInfo->StateList); + } InstallStates(subclass->ActorInfo, defaults2); // Use the DECORATE replacement feature to redirect all spawns @@ -2584,7 +2599,7 @@ void FinishDehPatch () type->ActorInfo->Replacement = subclass->ActorInfo; subclass->ActorInfo->Replacee = type->ActorInfo; - DPrintf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars()); + Printf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars()); } // Now that all Dehacked patches have been processed, it's okay to free StateMap. diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 14c7933c1..3724be6ef 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -837,6 +837,8 @@ void AInventory::Hide () } } + assert(HideDoomishState != NULL || HideSpecialState != NULL); + if (HideSpecialState != NULL) { SetState (HideSpecialState); @@ -848,11 +850,6 @@ void AInventory::Hide () SetState (HideDoomishState); tics = 1050; } - else - { - GoAwayAndDie(); - return; - } if (RespawnTics != 0) { tics = RespawnTics; diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index 2425d74f4..75151067c 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -99,6 +99,7 @@ void AddState (const char * statename, FState * state); FState * FindState(AActor * actor, const PClass * type, const char * name); void InstallStates(FActorInfo *info, AActor *defaults); void MakeStateDefines(const FStateLabels *list); +void AddStateDefines(const FStateLabels *list); FState *P_GetState(AActor *self, FState *CallingState, int offset); int FinishStates (FScanner &sc, FActorInfo *actor, AActor *defaults, Baggage &bag); int ParseStates(FScanner &sc, FActorInfo *actor, AActor *defaults, Baggage &bag); diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index ba3babc9e..bb78791b7 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -369,6 +369,24 @@ void MakeStateDefines(const FStateLabels *list) MakeStateList(list, StateLabels); } +void AddStateDefines(const FStateLabels *list) +{ + if (list != NULL) for(int i=0;iNumLabels;i++) + { + if (list->Labels[i].Children == NULL) + { + if (!FindStateLabelInList(StateLabels, list->Labels[i].Label, false)) + { + FStateDefine def; + + def.Label = list->Labels[i].Label; + def.State = list->Labels[i].State; + StateLabels.Push(def); + } + } + } +} + //========================================================================== // // PrepareStateParameters diff --git a/wadsrc/static/actors/hexen/hexenspecialdecs.txt b/wadsrc/static/actors/hexen/hexenspecialdecs.txt index 0758f94d1..7d4a13a94 100644 --- a/wadsrc/static/actors/hexen/hexenspecialdecs.txt +++ b/wadsrc/static/actors/hexen/hexenspecialdecs.txt @@ -191,6 +191,7 @@ ACTOR BloodPool 111 ACTOR ZCorpseLynchedNoHeart 109 native { + Game Hexen Radius 10 Height 100 +SOLID +SPAWNCEILING +NOGRAVITY diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 9de4d294b..fcbafbaca 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -37,7 +37,7 @@ ACTOR Inventory native action native A_ClearReFire(); action native A_CheckReload(); action native A_GunFlash(); - action native A_Saw(sound fullsound = "misc/sawfull", sound hitsound = "misc/sawhit", int damage = 2, class pufftype = "BulletPuff"); + action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class pufftype = "BulletPuff"); action native A_CheckForReload(int counter, state label); action native A_ResetReloadCounter(); action native A_RestoreSpecialPosition(); diff --git a/wadsrc/static/actors/strife/strifestuff.txt b/wadsrc/static/actors/strife/strifestuff.txt index 4516d91d1..3f2aa9522 100644 --- a/wadsrc/static/actors/strife/strifestuff.txt +++ b/wadsrc/static/actors/strife/strifestuff.txt @@ -467,7 +467,7 @@ ACTOR SStalagmiteSmall 163 States { Spawn: - STLG E -1 + STLG F -1 Stop } }