- Added Species property for actors and separated Hexen's Demon1 and Demon2

into different species.


SVN r1573 (trunk)
This commit is contained in:
Randy Heit 2009-05-11 15:15:06 +00:00
parent 41a416f068
commit 1c61ef89eb
6 changed files with 40 additions and 8 deletions

View file

@ -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 transference of a select few flags from PowerProtection to its owner.
- Added actor type parameters to A_PodPain() and A_MakePod(). - Added actor type parameters to A_PodPain() and A_MakePod().
- The savegame path is now passed through NicePath(), since it's user- - The savegame path is now passed through NicePath(), since it's user-

View file

@ -608,7 +608,7 @@ public:
bool IsHostile (AActor *other); bool IsHostile (AActor *other);
// What species am I? // What species am I?
virtual const PClass *GetSpecies(); virtual FName GetSpecies();
// Enter the crash state // Enter the crash state
void Crash(); void Crash();
@ -639,7 +639,6 @@ public:
FRenderStyle RenderStyle; // Style to draw this actor with FRenderStyle RenderStyle; // Style to draw this actor with
DWORD renderflags; // Different rendering flags DWORD renderflags; // Different rendering flags
FTextureID picnum; // Draw this instead of sprite if valid 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 DWORD effects; // [RH] see p_effect.h
fixed_t alpha; fixed_t alpha;
DWORD fillcolor; // Color to draw when STYLE_Shaded DWORD fillcolor; // Color to draw when STYLE_Shaded
@ -685,6 +684,8 @@ public:
fixed_t SpawnPoint[3]; // For nightmare respawn fixed_t SpawnPoint[3]; // For nightmare respawn
WORD SpawnAngle; WORD SpawnAngle;
int skillrespawncount; int skillrespawncount;
int TIDtoHate; // TID of things to hate (0 if none)
FNameNoInit Species;
TObjPtr<AActor> tracer; // Thing being chased/attacked for tracers TObjPtr<AActor> tracer; // Thing being chased/attacked for tracers
TObjPtr<AActor> master; // Thing which spawned this one (prevents mutual attacks) TObjPtr<AActor> master; // Thing which spawned this one (prevents mutual attacks)
fixed_t floorclip; // value to use for floor clipping fixed_t floorclip; // value to use for floor clipping

View file

@ -233,7 +233,7 @@ DObject *PClass::CreateNew () const
assert (mem != NULL); assert (mem != NULL);
// Set this object's defaults before constructing it. // Set this object's defaults before constructing it.
if (Defaults!=NULL) if (Defaults != NULL)
memcpy (mem, Defaults, Size); memcpy (mem, Defaults, Size);
else else
memset (mem, 0, Size); memset (mem, 0, Size);
@ -274,14 +274,20 @@ PClass *PClass::CreateDerivedClass (FName name, unsigned int size)
type->Size = size; type->Size = size;
type->Pointers = NULL; type->Pointers = NULL;
type->ConstructNative = ConstructNative; type->ConstructNative = ConstructNative;
if (!notnew) type->ClassIndex = m_Types.Push (type); if (!notnew)
{
type->ClassIndex = m_Types.Push (type);
}
type->Meta = Meta; type->Meta = Meta;
// Set up default instance of the new class.
type->Defaults = new BYTE[size]; type->Defaults = new BYTE[size];
memcpy (type->Defaults, Defaults, Size); memcpy (type->Defaults, Defaults, Size);
if (size > Size) if (size > Size)
{ {
memset (type->Defaults + Size, 0, size - Size); memset (type->Defaults + Size, 0, size - Size);
} }
type->FlatPointers = NULL; type->FlatPointers = NULL;
type->bRuntimeClass = true; type->bRuntimeClass = true;
type->ActorInfo = NULL; type->ActorInfo = NULL;

View file

@ -291,6 +291,11 @@ void AActor::Serialize (FArchive &arc)
<< BlockingMobj << BlockingMobj
<< BlockingLine; << BlockingLine;
if (SaveVersion >= 1573)
{
arc << Species;
}
if (arc.IsStoring ()) if (arc.IsStoring ())
{ {
int convnum = 0; int convnum = 0;
@ -4939,13 +4944,19 @@ bool AActor::IsTeammate (AActor *other)
// AActor :: GetSpecies // AActor :: GetSpecies
// //
// Species is defined as the lowest base class that is a monster // 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. // 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(); const PClass *thistype = GetClass();
if (GetDefaultByType(thistype)->flags3 & MF3_ISMONSTER) if (GetDefaultByType(thistype)->flags3 & MF3_ISMONSTER)
@ -4958,7 +4969,7 @@ const PClass *AActor::GetSpecies()
break; break;
} }
} }
return thistype; return thistype->TypeName;
} }
//========================================================================== //==========================================================================

View file

@ -950,6 +950,15 @@ DEFINE_PROPERTY(gravity, F, Actor)
if (i == 0) defaults->flags |= MF_NOGRAVITY; if (i == 0) defaults->flags |= MF_NOGRAVITY;
} }
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(species, S, Actor)
{
PROP_STRING_PARM(n, 0);
defaults->Species = n;
}
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================

View file

@ -216,6 +216,7 @@ ACTOR Demon2 : Demon1 8080
{ {
Game Hexen Game Hexen
Obituary "$OB_DEMON2" Obituary "$OB_DEMON2"
Species "Demon2"
States States
{ {
Spawn: Spawn: