- 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
- Backported the improved hierarchical dumpclasses command from the FP code.
- Updated Jim's Makefile.linux.
- Added support for wrapping midtextures vertically.
- Since zdoom.wad is now zdoom.pk3, the default mapinfos can use full pathnames.

View File

@ -38,6 +38,8 @@
#include "tarray.h"
#include "doomtype.h"
class TypeInfo;
class FArchive;
class DObject;
@ -130,57 +132,21 @@ private:
void CopyMeta (const FMetaTable *other);
};
struct TypeInfo
{
static void StaticInit ();
static void StaticFreeData (TypeInfo *type);
#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
struct ClassReg
{
TypeInfo *MyClass;
const char *Name;
TypeInfo *ParentType;
unsigned int SizeOf;
const size_t *Pointers; // object pointers defined by this class *only*
POINTY_TYPE(DObject) *Pointers;
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 ();
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];
void RegisterClass();
};
#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 };
#define DECLARE_ABSTRACT_CLASS(cls,parent) \
@ -255,23 +221,24 @@ class DObject
public: \
static TypeInfo _StaticType; \
virtual TypeInfo *StaticType() const { return &_StaticType; } \
static ClassReg RegistrationInfo;
static void InPlaceConstructor (void *mem);
private: \
typedef DObject ThisClass;
// Per-instance variables. There are three.
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 (TypeInfo *inClass);
virtual ~DObject ();
inline bool IsKindOf (const TypeInfo *base) const
{
return base->IsAncestorOf (GetClass ());
}
inline bool IsA (const TypeInfo *type) const
{
return (type == GetClass());
}
inline bool IsKindOf (const TypeInfo *base) const;
inline bool IsA (const TypeInfo *type) const;
virtual void Serialize (FArchive &arc);
@ -289,8 +256,6 @@ public:
// use this method.
static void PointerSubstitution (DObject *old, DObject *notOld);
DWORD ObjectFlags;
static void STACK_ARGS StaticShutdown ();
TypeInfo *GetClass() const
@ -333,8 +298,6 @@ protected:
}
private:
TypeInfo *Class;
static TArray<DObject *> Objects;
static TArray<size_t> FreeIndices;
static TArray<DObject *> ToDestroy;
@ -345,7 +308,18 @@ private:
void RemoveFromArray ();
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__