diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9e762e1ae3..8974d892bb 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ -May 8, 2009 +May 11, 2009 +- Added Species property for actors and separated Hexen's Demon1 and Demon2 + into different species. + +May 8, 2009 - Added transference of a select few flags from PowerProtection to its owner. - Added actor type parameters to A_PodPain() and A_MakePod(). - The savegame path is now passed through NicePath(), since it's user- diff --git a/src/actor.h b/src/actor.h index 82d4290e0a..8bd5edc13f 100644 --- a/src/actor.h +++ b/src/actor.h @@ -608,7 +608,7 @@ public: bool IsHostile (AActor *other); // What species am I? - virtual const PClass *GetSpecies(); + virtual FName GetSpecies(); // Enter the crash state void Crash(); @@ -639,7 +639,6 @@ public: FRenderStyle RenderStyle; // Style to draw this actor with DWORD renderflags; // Different rendering flags FTextureID picnum; // Draw this instead of sprite if valid - int TIDtoHate; // TID of things to hate (0 if none) DWORD effects; // [RH] see p_effect.h fixed_t alpha; DWORD fillcolor; // Color to draw when STYLE_Shaded @@ -685,6 +684,8 @@ public: fixed_t SpawnPoint[3]; // For nightmare respawn WORD SpawnAngle; int skillrespawncount; + int TIDtoHate; // TID of things to hate (0 if none) + FNameNoInit Species; TObjPtr tracer; // Thing being chased/attacked for tracers TObjPtr master; // Thing which spawned this one (prevents mutual attacks) fixed_t floorclip; // value to use for floor clipping diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 481df51379..5030cc70d4 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -233,7 +233,7 @@ DObject *PClass::CreateNew () const assert (mem != NULL); // Set this object's defaults before constructing it. - if (Defaults!=NULL) + if (Defaults != NULL) memcpy (mem, Defaults, Size); else memset (mem, 0, Size); @@ -274,14 +274,20 @@ PClass *PClass::CreateDerivedClass (FName name, unsigned int size) type->Size = size; type->Pointers = NULL; type->ConstructNative = ConstructNative; - if (!notnew) type->ClassIndex = m_Types.Push (type); + if (!notnew) + { + type->ClassIndex = m_Types.Push (type); + } type->Meta = Meta; + + // Set up default instance of the new class. type->Defaults = new BYTE[size]; memcpy (type->Defaults, Defaults, Size); if (size > Size) { memset (type->Defaults + Size, 0, size - Size); } + type->FlatPointers = NULL; type->bRuntimeClass = true; type->ActorInfo = NULL; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index bccfab597b..2a9d9c802e 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -291,6 +291,11 @@ void AActor::Serialize (FArchive &arc) << BlockingMobj << BlockingLine; + if (SaveVersion >= 1573) + { + arc << Species; + } + if (arc.IsStoring ()) { int convnum = 0; @@ -4939,13 +4944,19 @@ bool AActor::IsTeammate (AActor *other) // AActor :: GetSpecies // // Species is defined as the lowest base class that is a monster -// with no non-monster class in between. This is virtualized, so special +// with no non-monster class in between. If the actor specifies an explicit +// species (i.e. not 'None'), that is used. This is virtualized, so special // monsters can change this behavior if they like. // //========================================================================== -const PClass *AActor::GetSpecies() +FName AActor::GetSpecies() { + if (Species != NAME_None) + { + return Species; + } + const PClass *thistype = GetClass(); if (GetDefaultByType(thistype)->flags3 & MF3_ISMONSTER) @@ -4958,7 +4969,7 @@ const PClass *AActor::GetSpecies() break; } } - return thistype; + return thistype->TypeName; } //========================================================================== diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 65b527100f..f71b0afdf4 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -950,6 +950,15 @@ DEFINE_PROPERTY(gravity, F, Actor) if (i == 0) defaults->flags |= MF_NOGRAVITY; } +//========================================================================== +// +//========================================================================== +DEFINE_PROPERTY(species, S, Actor) +{ + PROP_STRING_PARM(n, 0); + defaults->Species = n; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/hexen/demons.txt b/wadsrc/static/actors/hexen/demons.txt index 46daae3fa2..6be47bf27d 100644 --- a/wadsrc/static/actors/hexen/demons.txt +++ b/wadsrc/static/actors/hexen/demons.txt @@ -216,6 +216,7 @@ ACTOR Demon2 : Demon1 8080 { Game Hexen Obituary "$OB_DEMON2" + Species "Demon2" States { Spawn: