- Added replacement handling to A_BossDeath.

SVN r260 (trunk)
This commit is contained in:
Christoph Oelckers 2006-07-16 15:00:10 +00:00
parent 93cd78ebfb
commit e5a26c75fa
6 changed files with 26 additions and 4 deletions

View file

@ -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.

View file

@ -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];

View file

@ -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;

View file

@ -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

View file

@ -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))
{

View file

@ -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
{