- Backported the improved hierarchical dumpclasses command from the FP code.

SVN r94 (trunk)
This commit is contained in:
Randy Heit 2006-05-09 22:10:43 +00:00
parent 981f663319
commit 199d4dc57f
2 changed files with 32 additions and 57 deletions

View file

@ -1,4 +1,5 @@
May 9, 2006 May 9, 2006
- Backported the improved hierarchical dumpclasses command from the FP code.
- Updated Jim's Makefile.linux. - Updated Jim's Makefile.linux.
- Added support for wrapping midtextures vertically. - Added support for wrapping midtextures vertically.
- Since zdoom.wad is now zdoom.pk3, the default mapinfos can use full pathnames. - Since zdoom.wad is now zdoom.pk3, the default mapinfos can use full pathnames.

View file

@ -38,6 +38,8 @@
#include "tarray.h" #include "tarray.h"
#include "doomtype.h" #include "doomtype.h"
class TypeInfo;
class FArchive; class FArchive;
class DObject; class DObject;
@ -130,57 +132,21 @@ private:
void CopyMeta (const FMetaTable *other); void CopyMeta (const FMetaTable *other);
}; };
struct TypeInfo #define RUNTIME_TYPE(object) (object->GetClass()) // Passed an object, returns the type of that object
{ #define RUNTIME_CLASS(cls) (&cls::_StaticType) // Passed a class name, returns a TypeInfo representing that class
static void StaticInit ();
static void StaticFreeData (TypeInfo *type);
struct ClassReg
{
TypeInfo *MyClass;
const char *Name; const char *Name;
TypeInfo *ParentType; TypeInfo *ParentType;
unsigned int SizeOf; unsigned int SizeOf;
const size_t *Pointers; // object pointers defined by this class *only* POINTY_TYPE(DObject) *Pointers;
void (*ConstructNative)(void *); void (*ConstructNative)(void *);
FActorInfo *ActorInfo;
unsigned int HashNext;
unsigned short TypeIndex;
bool bRuntimeClass; // class was defined at run-time, not compile-time
FMetaTable Meta;
const size_t *FlatPointers; // object pointers defined by this class and all its superclasses; not initialized by default
void RegisterType (); void RegisterClass();
DObject *CreateNew () const;
TypeInfo *CreateDerivedClass (char *name, unsigned int size);
void BuildFlatPointers ();
// Returns true if this type is an ancestor of (or same as) the passed type.
bool IsAncestorOf (const TypeInfo *ti) const
{
while (ti)
{
if (this == ti)
return true;
ti = ti->ParentType;
}
return false;
}
inline bool IsDescendantOf (const TypeInfo *ti) const
{
return ti->IsAncestorOf (this);
}
static const TypeInfo *FindType (const char *name);
static const TypeInfo *IFindType (const char *name);
static TArray<TypeInfo *> m_Types;
static TArray<TypeInfo *> m_RuntimeActors;
enum { HASH_SIZE = 256 };
static unsigned int TypeHash[HASH_SIZE];
}; };
#define RUNTIME_TYPE(object) (object->GetClass()) // Passed an object, returns the type of that object
#define RUNTIME_CLASS(cls) (&cls::_StaticType) // Passed a class name, returns a TypeInfo representing that class
enum EInPlace { EC_InPlace }; enum EInPlace { EC_InPlace };
#define DECLARE_ABSTRACT_CLASS(cls,parent) \ #define DECLARE_ABSTRACT_CLASS(cls,parent) \
@ -255,23 +221,24 @@ class DObject
public: \ public: \
static TypeInfo _StaticType; \ static TypeInfo _StaticType; \
virtual TypeInfo *StaticType() const { return &_StaticType; } \ virtual TypeInfo *StaticType() const { return &_StaticType; } \
static ClassReg RegistrationInfo;
static void InPlaceConstructor (void *mem);
private: \ private: \
typedef DObject ThisClass; typedef DObject ThisClass;
// Per-instance variables. There are three.
public: public:
DWORD ObjectFlags; // Flags for this object
private:
TypeInfo *Class; // This object's type
size_t Index; // This object's index in the global object table
DObject (); DObject ();
DObject (TypeInfo *inClass); DObject (TypeInfo *inClass);
virtual ~DObject (); virtual ~DObject ();
inline bool IsKindOf (const TypeInfo *base) const inline bool IsKindOf (const TypeInfo *base) const;
{ inline bool IsA (const TypeInfo *type) const;
return base->IsAncestorOf (GetClass ());
}
inline bool IsA (const TypeInfo *type) const
{
return (type == GetClass());
}
virtual void Serialize (FArchive &arc); virtual void Serialize (FArchive &arc);
@ -289,8 +256,6 @@ public:
// use this method. // use this method.
static void PointerSubstitution (DObject *old, DObject *notOld); static void PointerSubstitution (DObject *old, DObject *notOld);
DWORD ObjectFlags;
static void STACK_ARGS StaticShutdown (); static void STACK_ARGS StaticShutdown ();
TypeInfo *GetClass() const TypeInfo *GetClass() const
@ -333,8 +298,6 @@ protected:
} }
private: private:
TypeInfo *Class;
static TArray<DObject *> Objects; static TArray<DObject *> Objects;
static TArray<size_t> FreeIndices; static TArray<size_t> FreeIndices;
static TArray<DObject *> ToDestroy; static TArray<DObject *> ToDestroy;
@ -345,7 +308,18 @@ private:
void RemoveFromArray (); void RemoveFromArray ();
static bool Inactive; static bool Inactive;
size_t Index;
}; };
#include "dobjtype.h"
inline bool DObject::IsKindOf (const TypeInfo *base) const
{
return base->IsAncestorOf (GetClass ());
}
inline bool DObject::IsA (const TypeInfo *type) const
{
return (type == GetClass());
}
#endif //__DOBJECT_H__ #endif //__DOBJECT_H__