ltserverobj.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. // ltserverobj defines all the necessary things for writing an object.
  2. #ifndef __LTSERVEROBJ_H__
  3. #define __LTSERVEROBJ_H__
  4. #include "ltbasedefs.h"
  5. #include "iservershell.h"
  6. // Maximum lines that will be drawn for one PF_OBJECTLINK property.
  7. #define MAX_OBJECTLINK_OBJECTS 64
  8. // Used for containers to apply physics to an object.
  9. // You can change velocity, acceleration, and flags without changing the object's
  10. // actual values.
  11. struct ContainerPhysics
  12. {
  13. LTVector m_Acceleration;
  14. LTVector m_Velocity;
  15. uint32 m_Flags;
  16. HOBJECT m_hObject;
  17. };
  18. // Different property types.
  19. #define PT_STRING 0
  20. #define PT_VECTOR 1
  21. #define PT_COLOR 2
  22. #define PT_REAL 3
  23. #define PT_FLAGS 4
  24. #define PT_BOOL 5
  25. #define PT_LONGINT 6
  26. #define PT_ROTATION 7
  27. #define NUM_PROPERTYTYPES 8
  28. // Property flags.
  29. #define PF_HIDDEN (1<<0) // Property doesn't show up in DEdit.
  30. #define PF_RADIUS (1<<1) // Property is a number to use as radius for drawing circle. There can be more than one.
  31. #define PF_DIMS (1<<2) // Property is a vector to use as dimensions for drawing box. There can be only one.
  32. #define PF_FIELDOFVIEW (1<<3) // Property is a field of view.
  33. #define PF_LOCALDIMS (1<<4) // Used with PF_DIMS. Causes DEdit to show dimensions rotated with the object.
  34. #define PF_GROUPOWNER (1<<5) // This property owns the group it's in.
  35. #define PF_GROUP1 (1<<6) // This property is in group 1.
  36. #define PF_GROUP2 (1<<7) // This property is in group 2.
  37. #define PF_GROUP3 (1<<8) // This property is in group 3.
  38. #define PF_GROUP4 (1<<9) // This property is in group 4.
  39. #define PF_GROUP5 (1<<10) // This property is in group 5.
  40. #define PF_GROUP6 (1<<11) // This property is in group 6.
  41. #define PF_FOVRADIUS (1<<12) // If PF_FIELDOFVIEW is set, this defines the radius for it.
  42. #define PF_OBJECTLINK (1<<13) // If the object is selected, DEdit draws a line to any objects
  43. // referenced (by name) in PF_OBJECTLINK properties. It won't
  44. // draw any more than MAX_OBJECTLINK_OBJECTS.
  45. #define PF_FILENAME (1<<14) // This indicates to DEdit that a string property is a filename in the resource
  46. // If this property is a vector and its object is on a path,
  47. // the path is drawn as a bezier curve. The curve segment from
  48. // this object to the next is defined as
  49. // (THIS.Pos, THIS.Pos + THIS.NextTangent, NEXT.Pos + NEXT.PrevTangent, NEXT.Pos).
  50. #define PF_BEZIERPREVTANGENT (1<<15)
  51. #define PF_BEZIERNEXTTANGENT (1<<16)
  52. #define PF_STATICLIST (1<<17) // This string property has a populatable combobox with dropdown-list style (ie listbox, no edit control)
  53. #define PF_DYNAMICLIST (1<<18) // This string property has a populatable combobox with dropdown style (ie listbox+edit control)
  54. // Used internally..
  55. #define PF_GROUPMASK (PF_GROUP1|PF_GROUP2|PF_GROUP3|PF_GROUP4|PF_GROUP5|PF_GROUP6)
  56. // Class flags.
  57. #define CF_HIDDEN (1<<0) // Instances of the class can't be created in DEdit.
  58. #define CF_NORUNTIME (1<<1) // This class doesn't get used at runtime (the engine
  59. // won't instantiate these objects out of the world file).
  60. #define CF_STATIC (1<<2) // This is a special class that the server creates an
  61. // instance of at the same time that it creates the
  62. // server shell. The object is always around. This
  63. // should be used as much as possible instead of adding
  64. // code to the server shell.
  65. #define CF_ALWAYSLOAD (1<<3) // Objects of this class and sub-classes are always loaded from the level
  66. // file and can't be saved to a save game.
  67. #define PRECREATE_NORMAL 0.0f // Object is being created at runtime.
  68. #define PRECREATE_WORLDFILE 1.0f // Object is being loaded from a world file. Read props in.
  69. #define PRECREATE_STRINGPROP 2.0f // Object is created from CreateObjectProps. Use GetPropGeneric to read props.
  70. #define PRECREATE_SAVEGAME 3.0f // Object comes from a savegame.
  71. #define INITIALUPDATE_NORMAL 0.0f // Normal creation.
  72. #define INITIALUPDATE_WORLDFILE 1.0f // Being created from a world file.
  73. #define INITIALUPDATE_STRINGPROP 2.0f // Object is created from CreateObjectProps. Use GetPropGeneric to read props.
  74. #define INITIALUPDATE_SAVEGAME 3.0f // Created from a savegame.
  75. // Here are all the message IDs and structures that LithTech uses.
  76. // This is called right before the server uses the ObjectCreateStruct
  77. // to create its internal structure for the object.
  78. // pData = ObjectCreateStruct*
  79. // fData = a PRECREATE_ define above.
  80. #define MID_PRECREATE 0
  81. // This is called right after your object is created (kind of like the opposite
  82. // of MID_POSTPROPREAD).
  83. // fData is an INITIALUPDATE_ define above.
  84. #define MID_INITIALUPDATE 1
  85. // This is called when NextUpdate goes to zero.
  86. #define MID_UPDATE 2
  87. // This is called when you touch another object.
  88. // pData is an HOBJECT for the other object.
  89. // fData is the collision (stopping) force (based on masses and velocities).
  90. #define MID_TOUCHNOTIFY 3
  91. // This is notification when a link to an object is about to be broken.
  92. // pData is an HOBJECT to the link's object.
  93. #define MID_LINKBROKEN 4
  94. // This is notification when a model string key is crossed.
  95. // (You only get it if your FLAG_MODELKEYS flag is set).
  96. // pData is an ArgList*.
  97. #define MID_MODELSTRINGKEY 5
  98. // Called when an object pushes you into a wall. It won't
  99. // move any further unless you make yourself nonsolid (ie: a player would
  100. // take damage from each crush notification, then die).
  101. // pData is the HOBJECT of the object crushing you.
  102. #define MID_CRUSH 6
  103. // Load and save yourself for a serialization.
  104. // pData is an HMESSAGEREAD or HMESSAGEWRITE.
  105. // fData is the dwParam passed to ServerDE::SaveObjects or ServerDE::RestoreObjects.
  106. #define MID_LOADOBJECT 7
  107. #define MID_SAVEOBJECT 8
  108. // Called for a container for objects inside it each frame. This gives you a chance
  109. // to modify the physics applied to an object WITHOUT actually modifying its
  110. // velocity or acceleration (great way to dampen velocity..)
  111. // pData is a ContainerPhysics*.
  112. #define MID_AFFECTPHYSICS 9
  113. // The parent of an attachment between you and it is being removed.
  114. #define MID_PARENTATTACHMENTREMOVED 10
  115. // Called every frame on client objects. This gives you a chance to force
  116. // updates on certain objects so they never get removed for the client.
  117. // pData is a ForceUpdate*.
  118. // (LT automatically adds the client object and the sky objects to this list to start with).
  119. #define MID_GETFORCEUPDATEOBJECTS 11
  120. // Sent when an object is becoming active
  121. #define MID_ACTIVATING 12
  122. // Sent when an object is becoming inactive
  123. #define MID_DEACTIVATING 13
  124. // These are your (optional) construct/destruct functions.
  125. // In C++, you should ALWAYS use the default ones, because they
  126. // will call your constructor/destructor. In C, you can use
  127. // them to init and term your object. In most cases, you should
  128. // add any aggregates you have in your construct function, since
  129. // ReadProp/PostPropRead get called right after and your aggregates
  130. // might want to look at them.
  131. typedef void (*ConstructObjectFn)(void *pObject);
  132. typedef void (*DestructObjectFn)(void *pObject);
  133. // Callbacks used for creating plugins.
  134. class IObjectPlugin;
  135. typedef IObjectPlugin* (*CreateObjectPluginFn)();
  136. // Forward declaration of class DEdit internally augments PropDef data with
  137. class DEditInternal;
  138. struct PropDef
  139. {
  140. PropDef(char *pName, short type, LTVector valVec,
  141. float valFloat, char *valString, unsigned long propFlags)
  142. {
  143. m_PropName = pName;
  144. m_PropType = type;
  145. m_DefaultValueVector = valVec;
  146. m_DefaultValueFloat = valFloat;
  147. m_DefaultValueString = valString;
  148. m_PropFlags = propFlags;
  149. m_pInternal = 0;
  150. m_pDEditInternal = 0;
  151. }
  152. char *m_PropName;
  153. // One of the PT_ defines above.
  154. short m_PropType;
  155. // Default vector/color value.
  156. LTVector m_DefaultValueVector;
  157. float m_DefaultValueFloat;
  158. char *m_DefaultValueString;
  159. unsigned long m_PropFlags;
  160. // Don't touch!
  161. DEditInternal* m_pDEditInternal;
  162. // Don't touch!
  163. void *m_pInternal;
  164. };
  165. class CProjectClass;
  166. struct ClassDef
  167. {
  168. public:
  169. CProjectClass* DEditGetClassHook() {return (CProjectClass*)m_pInternal[0];}
  170. void DEditSetClassHook(CProjectClass *pClass) {m_pInternal[0] = pClass;}
  171. public:
  172. char *m_ClassName;
  173. ClassDef *m_ParentClass;
  174. // A combination of the CF_ flags above.
  175. uint32 m_ClassFlags;
  176. ConstructObjectFn m_ConstructFn;
  177. DestructObjectFn m_DestructFn;
  178. CreateObjectPluginFn m_PluginFn;
  179. short m_nProps;
  180. PropDef *m_Props;
  181. // How big an object of this class is (set automatically).
  182. long m_ClassObjectSize;
  183. // Don't touch!
  184. void *m_pInternal[2];
  185. };
  186. #include "iltserver.h"
  187. #include "iaggregate.h"
  188. // This is always available, once you create your server shell.
  189. extern ILTServer *g_pLTServer;
  190. // Used to avoid crashes from version mismatches.
  191. #define SERVEROBJ_VERSION 1
  192. // You MUST have one source file that lists out all the classes you have defined
  193. // using these macros.
  194. #ifdef COMPILE_WITH_C
  195. #define BEGIN_CLASSDEFS1()
  196. #else
  197. #define BEGIN_CLASSDEFS1() __ClassDefiner *__g_ClassDefinerHead=0;
  198. #endif
  199. #define DEFINECLASS1(name) extern ClassDef _##name##_Class__;
  200. #define END_CLASSDEFS1()
  201. #define BEGIN_CLASSDEFS2() \
  202. static ClassDef *__GlobalClassDefList__[] = { \
  203. #define DEFINECLASS2(name) \
  204. &_##name##_Class__,
  205. #define END_CLASSDEFS2() \
  206. }; \
  207. static int __GlobalClassDefListSize__ = sizeof(__GlobalClassDefList__) / sizeof(__GlobalClassDefList__[0]); \
  208. ServerDE *g_pLTServer=(ILTServer*)0;\
  209. BEGIN_EXTERNC() \
  210. __declspec(dllexport) ClassDef** ObjectDLLSetup(int *nDefs, ILTServer *pServer, int *version); \
  211. END_EXTERNC() \
  212. ClassDef** ObjectDLLSetup(int *nDefs, ILTServer *pServer, int *version) \
  213. {\
  214. *version = SERVEROBJ_VERSION;\
  215. g_pLTServer = pServer;\
  216. *nDefs = __GlobalClassDefListSize__; \
  217. return __GlobalClassDefList__; \
  218. }
  219. // In C++, you can use this macro instead of the BEGIN_CLASSDEFS macros
  220. // so you don't have to add each object to the list.
  221. #ifndef COMPILE_WITH_C
  222. class __ClassDefiner;
  223. extern __ClassDefiner *__g_ClassDefinerHead;
  224. class __ClassDefiner
  225. {
  226. public:
  227. __ClassDefiner(ClassDef *pDef)
  228. {
  229. m_pClass = pDef;
  230. m_pNext = __g_ClassDefinerHead;
  231. __g_ClassDefinerHead = this;
  232. }
  233. ClassDef *m_pClass;
  234. __ClassDefiner *m_pNext;
  235. };
  236. extern ClassDef **__g_cpp_classlist;
  237. class __cpp_classlist_auto_free {
  238. public:
  239. ~__cpp_classlist_auto_free() {
  240. if(__g_cpp_classlist) {
  241. free(__g_cpp_classlist);
  242. __g_cpp_classlist = 0;
  243. }
  244. }
  245. };
  246. #define DEFINE_CLASSES() \
  247. ClassDef **__g_cpp_classlist=0;\
  248. __cpp_classlist_auto_free __free_the_g_cpp_classlist;\
  249. ILTServer *g_pLTServer=(ILTServer*)0;\
  250. BEGIN_EXTERNC() \
  251. __declspec(dllexport) ClassDef** ObjectDLLSetup(int *nDefs, ILTServer *pServer, int *version); \
  252. END_EXTERNC() \
  253. __ClassDefiner *__g_ClassDefinerHead=0;\
  254. ClassDef** ObjectDLLSetup(int *nDefs, ILTServer *pServer, int *version) \
  255. {\
  256. int nClasses;\
  257. __ClassDefiner *pCurDefiner;\
  258. *version = SERVEROBJ_VERSION;\
  259. g_pLTServer = pServer;\
  260. nClasses=0;\
  261. pCurDefiner = __g_ClassDefinerHead;\
  262. while(pCurDefiner)\
  263. {\
  264. pCurDefiner = pCurDefiner->m_pNext;\
  265. ++nClasses;\
  266. }\
  267. __g_cpp_classlist = (ClassDef**)malloc(sizeof(ClassDef*) * nClasses);\
  268. nClasses=0;\
  269. pCurDefiner = __g_ClassDefinerHead;\
  270. while(pCurDefiner)\
  271. {\
  272. __g_cpp_classlist[nClasses] = pCurDefiner->m_pClass;\
  273. pCurDefiner = pCurDefiner->m_pNext;\
  274. ++nClasses;\
  275. }\
  276. *nDefs = nClasses; \
  277. return __g_cpp_classlist; \
  278. }
  279. #endif // !COMPILE_WITH_C
  280. // -------------------------------------------------------- //
  281. // These are the macros that you use to define classes.
  282. // -------------------------------------------------------- //
  283. #ifdef __cplusplus
  284. #define ALLOCATEONE(type) (void*)(new type)
  285. #define DELETEONE(type, ptr) delete ((type*)ptr)
  286. #else
  287. #define ALLOCATEONE(type) malloc(sizeof(type))
  288. #define DELETEONE(type, ptr) free(ptr)
  289. #endif
  290. #ifndef COMPILE_WITH_C
  291. inline void* operator new(size_t size, void *ptr, int asdf, char a)
  292. {
  293. return ptr;
  294. }
  295. #if _MSC_VER != 1100
  296. inline void operator delete(void *pDataPtr, void *ptr, int asdf, char a)
  297. {
  298. }
  299. #endif
  300. #endif // !COMPILE_WITH_C
  301. // It adds a dummy property here so C syntax doesn't break when you have no properties..
  302. #define NOCOLOR LTVector(0.0f, 0.0f, 0.0f)
  303. // If you want level designers to be able to set object flags, you should
  304. // use these macros so the property names are standardized.
  305. // Use the ADD_X_FLAG macros in your property list.
  306. #define ADD_VISIBLE_FLAG(defVal, flags) \
  307. ADD_PROP_FLAG(Visible, PT_BOOL, defVal, 0, flags)
  308. #define ADD_SHADOW_FLAG(defVal, flags) \
  309. ADD_PROP_FLAG(Shadow, PT_BOOL, defVal, 0, flags)
  310. #define ADD_ROTATEABLESPRITE_FLAG(defVal, flags) \
  311. ADD_PROP_FLAG(RotateableSprite, PT_BOOL, defVal, 0, flags)
  312. #define ADD_CHROMAKEY_FLAG(defVal, flags) \
  313. ADD_PROP_FLAG(Chromakey, PT_BOOL, defVal, 0, flags)
  314. #define ADD_SOLID_FLAG(defVal, flags) \
  315. ADD_PROP_FLAG(Solid, PT_BOOL, defVal, 0, flags)
  316. #define ADD_GRAVITY_FLAG(defVal, flags) \
  317. ADD_PROP_FLAG(Gravity, PT_BOOL, defVal, 0, flags)
  318. #define ADD_TOUCHNOTIFY_FLAG(defVal, flags) \
  319. ADD_PROP_FLAG(Touch Notify, PT_BOOL, defVal, 0, flags)
  320. #define ADD_RAYHIT_FLAG(defVal, flags) \
  321. ADD_PROP_FLAG(Rayhit, PT_BOOL, defVal, 0, flags)
  322. // Full property definitions.
  323. #define ADD_PROP_FLAG(name, type, valFloat, valString, flags) \
  324. PropDef(#name, type, NOCOLOR, valFloat, valString, flags),
  325. #define ADD_REALPROP_FLAG(name, val, flags) \
  326. PropDef(#name, PT_REAL, NOCOLOR, val, "", flags),
  327. #define ADD_STRINGPROP_FLAG(name, val, flags) \
  328. PropDef(#name, PT_STRING, NOCOLOR, 0.0f, val, flags),
  329. #define ADD_VECTORPROP_FLAG(name, flags) \
  330. PropDef(#name, PT_VECTOR, NOCOLOR, 0.0f, (char*)0, flags),
  331. #define ADD_VECTORPROP_VAL_FLAG(name, defX, defY, defZ, flags) \
  332. PropDef(#name, PT_VECTOR, LTVector(defX, defY, defZ), 0.0f, (char*)0, flags),
  333. #define ADD_LONGINTPROP_FLAG(name, val, flags) \
  334. PropDef(#name, PT_LONGINT, NOCOLOR, (float)val, (char*)0, flags),
  335. #define ADD_ROTATIONPROP_FLAG(name, flags) \
  336. PropDef(#name, PT_ROTATION, NOCOLOR, 0.0f, (char*)0, flags),
  337. #define ADD_BOOLPROP_FLAG(name, val, flags) \
  338. PropDef(#name, PT_BOOL, NOCOLOR, (float)val, (char*)0, flags),
  339. #define ADD_COLORPROP_FLAG(name, valR, valG, valB, flags) \
  340. PropDef(#name, PT_COLOR, LTVector(valR, valG, valB), 0.0f, (char*)0, flags),
  341. #define ADD_OBJECTPROP_FLAG(name, val, flags) \
  342. PropDef(#name, PT_STRING, NOCOLOR, 0.0f, val, flags | PF_OBJECTLINK),
  343. // Add properties without flags (only here for backward compatibility).
  344. #define ADD_PROP(name, type, valFloat, valString) \
  345. ADD_PROP_FLAG(name, type, valFloat, valString, 0)
  346. #define ADD_REALPROP(name, val) \
  347. ADD_REALPROP_FLAG(name, val, 0)
  348. #define ADD_STRINGPROP(name, val) \
  349. ADD_STRINGPROP_FLAG(name, val, 0)
  350. #define ADD_VECTORPROP(name) \
  351. ADD_VECTORPROP_FLAG(name, 0)
  352. #define ADD_VECTORPROP_VAL(name, defX, defY, defZ) \
  353. ADD_VECTORPROP_VAL_FLAG(name, defX, defY, defZ, 0)
  354. #define ADD_LONGINTPROP(name, val) \
  355. ADD_LONGINTPROP_FLAG(name, val, 0)
  356. #define ADD_ROTATIONPROP(name) \
  357. ADD_ROTATIONPROP_FLAG(name, 0)
  358. #define ADD_BOOLPROP(name, val) \
  359. ADD_BOOLPROP_FLAG(name, val, 0)
  360. #define ADD_COLORPROP(name, valR, valG, valB) \
  361. ADD_COLORPROP_FLAG(name, valR, valG, valB, 0)
  362. #define ADD_OBJECTPROP(name, val) \
  363. ADD_OBJECTPROP_FLAG(name, val, 0)
  364. // Define a group with this.
  365. #define PROP_DEFINEGROUP(groupName, groupFlag) \
  366. PropDef(#groupName, PT_LONGINT, NOCOLOR, (float)0.0f, (char*)0, groupFlag|PF_GROUPOWNER),
  367. #define BEGIN_CLASS(name) \
  368. static PropDef _##name##_Props__[] = { \
  369. ADD_STRINGPROP("__NOPROP__!!", "")
  370. // Define the default constructor/destructor functions.
  371. #ifdef COMPILE_WITH_C
  372. #define DO_AUTO_CLASSLIST(name)
  373. #define DO_DEFAULT_FUNCTIONS(_className) \
  374. void Default##_className##Constructor(void *ptr) {}\
  375. void Default##_className##Destructor(void *ptr) {}
  376. #else
  377. #define DO_AUTO_CLASSLIST(name) \
  378. static __ClassDefiner __##name##_definer(&_##name##_Class__);
  379. #define DO_DEFAULT_FUNCTIONS(_className)\
  380. void Default##_className##Constructor(void *ptr)\
  381. {\
  382. ::new(ptr, (int)0, (char)0) _className;\
  383. }\
  384. void Default##_className##Destructor(void *ptr)\
  385. {\
  386. _className *thePtr = (_className*)ptr;\
  387. thePtr->~_className();\
  388. }
  389. #endif
  390. #define END_CLASS_SYMBOL(name, parentSymbol, flags, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn, classFlags, lightFn) \
  391. ClassDef _##name##_Class__ = { \
  392. #name, parentSymbol, \
  393. flags,\
  394. construct_fn, destruct_fn, \
  395. lightFn,\
  396. (sizeof(_##name##_Props__) / sizeof(PropDef)) - 1,\
  397. &_##name##_Props__[1], \
  398. sizeof(name),\
  399. (void*)0, (void*)0 }; \
  400. DO_AUTO_CLASSLIST(name)
  401. // End class macros with a plugin interface.
  402. // Just specify the plugin class name. The class must derive from IObjectPlugin.
  403. #define END_CLASS_FLAGS_PLUGIN(name, parent, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn, flags, pluginClassName) \
  404. }; \
  405. extern ClassDef _##parent##_Class__; \
  406. IObjectPlugin* __Create##name##__Plugin() {return new pluginClassName;}\
  407. END_CLASS_SYMBOL(name, &_##parent##_Class__, flags, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn, 0, __Create##name##__Plugin)
  408. #define END_CLASS_DEFAULT_FLAGS_PLUGIN(name, parent, enginemessage_fn, objectmessage_fn, flags, pluginClassName)\
  409. }; \
  410. extern ClassDef _##parent##_Class__; \
  411. IObjectPlugin* __Create##name##__Plugin() {return new pluginClassName;}\
  412. DO_DEFAULT_FUNCTIONS(name)\
  413. END_CLASS_SYMBOL(name, &_##parent##_Class__, flags, Default##name##Constructor, Default##name##Destructor, enginemessage_fn, objectmessage_fn, 0, __Create##name##__Plugin)
  414. // End class macros with flags.
  415. #define END_CLASS_FLAGS(name, parent, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn, flags) \
  416. }; \
  417. extern ClassDef _##parent##_Class__; \
  418. END_CLASS_SYMBOL(name, &_##parent##_Class__, flags, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn, 0, NULL)
  419. #define END_CLASS_DEFAULT_FLAGS(name, parent, enginemessage_fn, objectmessage_fn, flags)\
  420. }; \
  421. extern ClassDef _##parent##_Class__; \
  422. DO_DEFAULT_FUNCTIONS(name)\
  423. END_CLASS_SYMBOL(name, &_##parent##_Class__, flags, Default##name##Constructor, Default##name##Destructor, enginemessage_fn, objectmessage_fn, 0, NULL)
  424. // Normal end class macros.
  425. #define END_CLASS(name, parent, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn) \
  426. END_CLASS_FLAGS(name, parent, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn, 0)
  427. #define END_CLASS_DEFAULT(name, parent, enginemessage_fn, objectmessage_fn)\
  428. END_CLASS_DEFAULT_FLAGS(name, parent, enginemessage_fn, objectmessage_fn, 0)
  429. // Only used internally.
  430. #define END_CLASS_NOPARENT(name, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn) \
  431. }; \
  432. END_CLASS_SYMBOL(name, (ClassDef*)0, 0, construct_fn, destruct_fn, enginemessage_fn, objectmessage_fn, 0, NULL)
  433. #define END_CLASS_DEFAULT_NOPARENT(name, enginemessage_fn, objectmessage_fn) \
  434. }; \
  435. DO_DEFAULT_FUNCTIONS(name)\
  436. END_CLASS_SYMBOL(name, (ClassDef*)0, 0, Default##name##Constructor, Default##name##Destructor, enginemessage_fn, objectmessage_fn, 0, NULL)
  437. #endif // __LTSERVEROBJ_H__