diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 489e1365fa..f82982462f 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ July 16, 2006 (Changes by Graf Zahl) +- Added replacement handling to A_BossDeath. - Fixed: The check for no skill menu was incorrect when a custom player class menu was present so instead of starting the game specific skill menu it always started Hexen's. diff --git a/src/info.cpp b/src/info.cpp index ef186db518..17244db49e 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -320,6 +320,21 @@ FActorInfo *FActorInfo::GetReplacement () return rep; } +FActorInfo *FActorInfo::GetReplacee () +{ + if (Replacee == NULL) + { + return this; + } + // The Replacee field is temporarily NULLed to prevent + // potential infinite recursion. + FActorInfo *savedrep = Replacee; + Replacee = NULL; + FActorInfo *rep = savedrep->GetReplacee (); + Replacee = savedrep; + return rep; +} + FDoomEdMap DoomEdMap; FDoomEdMap::FDoomEdEntry *FDoomEdMap::DoomEdHash[DOOMED_HASHSIZE]; diff --git a/src/info.h b/src/info.h index 996ccd72fd..6ec947e5f1 100644 --- a/src/info.h +++ b/src/info.h @@ -385,10 +385,12 @@ struct FActorInfo void ApplyDefaults (BYTE *defaults); void RegisterIDs (); FActorInfo *GetReplacement (); + FActorInfo *GetReplacee (); PClass *Class; FState *OwnedStates; FActorInfo *Replacement; + FActorInfo *Replacee; int NumOwnedStates; BYTE GameFilter; BYTE SpawnID; diff --git a/src/infomacros.h b/src/infomacros.h index 31ea79dd13..51a171c3c9 100644 --- a/src/infomacros.h +++ b/src/infomacros.h @@ -173,12 +173,12 @@ public: #define BEGIN_DEFAULTS(actor,game,ednum,spawnid) \ BEGIN_DEFAULTS_PRE(actor) \ - RUNTIME_CLASS(actor), &actor::States[0], NULL, countof(actor::States), \ + RUNTIME_CLASS(actor), &actor::States[0], NULL, NULL, countof(actor::States), \ BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid) #define BEGIN_STATELESS_DEFAULTS(actor,game,ednum,spawnid) \ BEGIN_DEFAULTS_PRE(actor) \ - RUNTIME_CLASS(actor), NULL, NULL, 0, \ + RUNTIME_CLASS(actor), NULL, NULL, NULL, 0, \ BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid) // IMPLEMENT_ACTOR combines IMPLEMENT_CLASS and BEGIN_DEFAULTS diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 3d050a6a59..20ead2a295 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2377,14 +2377,17 @@ bool CheckBossDeath (AActor *actor) // void A_BossDeath (AActor *actor) { - FName type = actor->GetClass()->TypeName; + FName mytype = actor->GetClass()->TypeName; + + // Ugh... + FName type = actor->GetClass()->ActorInfo->GetReplacee()->Class->TypeName; // Do generic special death actions first bool checked = false; FSpecialAction *sa = level.info->specialactions; while (sa) { - if (type == sa->Type) + if (type == sa->Type || mytype == sa->Type) { if (!checked && !CheckBossDeath(actor)) { diff --git a/src/thingdef.cpp b/src/thingdef.cpp index 1e68f02780..5aac7935dd 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -1263,6 +1263,7 @@ static FActorInfo * CreateNewActor(FActorInfo ** parentc, Baggage *bag) SC_ScriptError ("Replaced type '%s' is not an actor", sc_String); } replacee->ActorInfo->Replacement = ti->ActorInfo; + ti->ActorInfo->Replacee = replacee->ActorInfo; } else {