NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_rtti.h
1#ifndef NW4R_G3D_RTTI_H
2#define NW4R_G3D_RTTI_H
3
4/**
5 * (Internal) Declare TypeObj for an object class.
6 */
7#define __NW4R_G3D_TYPEOBJ_DECL(T) \
8 static const nw4r::g3d::G3dObj::ResNameDataT<sizeof(#T)> TYPE_NAME;
9
10/**
11 * (Internal) Declare data and methods common between base and derived types.
12 */
13#define __NW4R_G3D_RTTI_DECL(T) \
14public: \
15 virtual const TypeObj GetTypeObj() const { \
16 return nw4r::g3d::G3dObj::TypeObj(TYPE_NAME); \
17 } /* at 0x14 */ \
18 \
19 static const G3dObj::TypeObj GetTypeObjStatic() { \
20 return nw4r::g3d::G3dObj::TypeObj(TYPE_NAME); \
21 } \
22 \
23 virtual const char* GetTypeName() const { \
24 return GetTypeObj().GetTypeName(); \
25 } /* at 0x18 */ \
26 \
27private: \
28 __NW4R_G3D_TYPEOBJ_DECL(T);
29
30/**
31 * Declare data and methods common between base and derived types.
32 */
33#define NW4R_G3D_RTTI_DEF(T) \
34 const nw4r::g3d::G3dObj::ResNameDataT<sizeof(#T)> T::TYPE_NAME = { \
35 sizeof(#T), #T}
36
37/**
38 * Define type RTTI (base type).
39 */
40#define NW4R_G3D_RTTI_DECL_BASE(T) \
41 __NW4R_G3D_RTTI_DECL(T); \
42 \
43public: \
44 virtual bool IsDerivedFrom(nw4r::g3d::G3dObj::TypeObj other) const { \
45 return other == GetTypeObjStatic(); \
46 } /* at 0x8 */
47
48/**
49 * Define type RTTI (derived type).
50 */
51#define NW4R_G3D_RTTI_DECL_DERIVED(T, BASE) \
52 __NW4R_G3D_RTTI_DECL(T); \
53 \
54public: \
55 virtual bool IsDerivedFrom(nw4r::g3d::G3dObj::TypeObj other) const { \
56 return other == GetTypeObjStatic() ? true \
57 : BASE::IsDerivedFrom(other); \
58 } /* at 0x8 */
59
60#endif