ClassStructs.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. #pragma once
  2. #define CLASS_STRUCTS_VERSION 4
  3. #include "other.hpp"
  4. struct SimGroup;
  5. //0 + 52 bytes
  6. #define ClassStruct_SimObject \
  7. void* vftable; \
  8. const char* objectName; \
  9. SimObject* nextNameObject; \
  10. SimObject* nextManagerNameObject; \
  11. SimObject* nextIdObject; \
  12. SimGroup* mGroup; \
  13. U32 mFlags; \
  14. Notify* mNotifyList; \
  15. U32 id; /* +32 */ \
  16. Namespace* mNamespace; /* +36 */ \
  17. unsigned int mTypeMask; \
  18. void* SimObject_0[1]; \
  19. void* mFieldDictionary; \
  20. struct SimObject
  21. {
  22. ClassStruct_SimObject
  23. };
  24. //52 + 12 bytes
  25. #define ClassStruct_SimSet \
  26. U32 mElementCount; /* +52 */ \
  27. U32 mArraySize; /* +56 */ \
  28. SimObject* (*mArray)[]; /* +60 */ \
  29. struct SimSet
  30. {
  31. ClassStruct_SimObject
  32. ClassStruct_SimSet
  33. };
  34. //Not known to have any member fields
  35. //64 + ? bytes
  36. #define ClassStruct_SimGroup \
  37. struct SimGroup
  38. {
  39. ClassStruct_SimObject
  40. ClassStruct_SimSet
  41. ClassStruct_SimGroup
  42. };
  43. /* More complicated multi-inherit NetConnection class */
  44. #include "ClassStructsConnProtocol.hpp"
  45. //52 + 28 bytes
  46. #define ClassStruct_NetObject \
  47. void* NetObject_0[4]; \
  48. int netFlags; /* +68 */ \
  49. int ghostID; /* +72 */ \
  50. void* NetObject_1[1]; \
  51. struct NetObject
  52. {
  53. ClassStruct_SimObject
  54. ClassStruct_NetObject
  55. };
  56. //80 + n bytes
  57. #define ClassStruct_Sun \
  58. void* Sun_0[7]; \
  59. float DirectLightR; /* +108 */ \
  60. float DirectLightG; \
  61. float DirectLightB; \
  62. float DirectLightA; /* unused */ \
  63. float AmbientLightR; /* +124 */ \
  64. float AmbientLightG; \
  65. float AmbientLightB; \
  66. float AmbientLightA; /* unused */ \
  67. void* Sun_1[2]; \
  68. float Azimuth_Readonly1; /* +148 */ \
  69. float Elevation_Readonly1; /* + 152 */ \
  70. float Azimuth_Readonly2; /* +156 */ \
  71. float Elevation_Readonly2; /* +160 */ \
  72. void* Sun_2[8]; \
  73. float ShadowColorR; /* +196 */ \
  74. float ShadowColorG; \
  75. float ShadowColorB; \
  76. float ShadowColorA; /* unused */ \
  77. struct Sun
  78. {
  79. ClassStruct_SimObject
  80. ClassStruct_NetObject
  81. ClassStruct_Sun
  82. };
  83. //80 + 408 bytes
  84. #define ClassStruct_SceneObject \
  85. void* SceneObject_0[3]; \
  86. MatrixF mObjToWorld; /* +92 */ \
  87. MatrixF mWorldToObj; /* +156 */ \
  88. Point3F mObjScale; /* +220 ; not always authoritative */ \
  89. void* SceneObject_1[64]; \
  90. struct SceneObject
  91. {
  92. ClassStruct_SimObject
  93. ClassStruct_NetObject
  94. ClassStruct_SceneObject
  95. };
  96. //488 + 28 bytes
  97. #define ClassStruct_GameBase \
  98. void* GameBase_0[7]; \
  99. struct GameBase
  100. {
  101. ClassStruct_SimObject
  102. ClassStruct_NetObject
  103. ClassStruct_SceneObject
  104. ClassStruct_GameBase
  105. };
  106. //516 + 1300 bytes
  107. #define ClassStruct_ShapeBase \
  108. void* ShapeBase_0[237]; \
  109. U32 shapeName_netStringID; /* +1468 ; can be used with NetStringTable::lookupString (0x59adc0) */ \
  110. void* ShapeBase_1[87]; \
  111. struct ShapeBase
  112. {
  113. ClassStruct_SimObject
  114. ClassStruct_NetObject
  115. ClassStruct_SceneObject
  116. ClassStruct_GameBase
  117. ClassStruct_ShapeBase
  118. };
  119. //1816 + 780 bytes
  120. #define ClassStruct_Player \
  121. void* Player_0[195]; \
  122. struct Player
  123. {
  124. ClassStruct_SimObject
  125. ClassStruct_NetObject
  126. ClassStruct_SceneObject
  127. ClassStruct_GameBase
  128. ClassStruct_ShapeBase
  129. ClassStruct_Player
  130. };
  131. //2596 + 140 bytes
  132. #define ClassStruct_AIPlayer \
  133. void* AIPlayer_0[35]; \
  134. struct AIPlayer
  135. {
  136. ClassStruct_SimObject
  137. ClassStruct_NetObject
  138. ClassStruct_SceneObject
  139. ClassStruct_GameBase
  140. ClassStruct_ShapeBase
  141. ClassStruct_Player
  142. ClassStruct_AIPlayer
  143. };
  144. //52 + 28(?) bytes
  145. #define ClassStruct_TCPObject \
  146. void* TCPObject_00; \
  147. void* TCPObject_01; \
  148. void* TCPObject_02; \
  149. void* TCPObject_03; \
  150. void* TCPObject_04; \
  151. void* TCPObject_05; \
  152. void* TCPObject_06; \
  153. struct TCPobject
  154. {
  155. ClassStruct_SimObject
  156. ClassStruct_TCPObject
  157. };
  158. //80 + ??
  159. #define ClassStruct_SOCKobject \
  160. struct SOCKobject
  161. {
  162. ClassStruct_SimObject
  163. ClassStruct_TCPObject
  164. ClassStruct_SOCKobject
  165. };
  166. //80 + ??
  167. #define ClassStruct_HTTPObject \
  168. struct HTTPobject
  169. {
  170. ClassStruct_SimObject
  171. ClassStruct_TCPObject
  172. ClassStruct_HTTPObject
  173. };
  174. int NamespaceClasses_instanceOf(SimObject* obj, const char* className)
  175. {
  176. if(obj == NULL)
  177. return -1;
  178. Namespace* ns = obj->mNamespace;
  179. for(int i = 0; ns != NULL; i++)
  180. {
  181. //Look for names of real classes
  182. if(ns->mClassRep != NULL)
  183. if(strcmp(className, ns->mName) == 0)
  184. return 1;
  185. ns = ns->mParent;
  186. }
  187. return 0;
  188. }
  189. const char* NamespaceClasses_getClassName(SimObject* obj)
  190. {
  191. if(obj == NULL)
  192. return "";
  193. Namespace* ns = obj->mNamespace;
  194. for(int i = 0; ns != NULL; i++)
  195. {
  196. //Look for names of real classes
  197. if(ns->mClassRep != NULL)
  198. return ns->mName;
  199. ns = ns->mParent;
  200. }
  201. return "";
  202. }