g_public.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. #ifndef __G_PUBLIC_H__
  2. #define __G_PUBLIC_H__
  3. // g_public.h -- game module information visible to server
  4. #define GAME_API_VERSION 8
  5. // entity->svFlags
  6. // the server does not know how to interpret most of the values
  7. // in entityStates (level eType), so the game must explicitly flag
  8. // special server behaviors
  9. #define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects
  10. #define SVF_INACTIVE 0x00000002 // Can't be used when this flag is on
  11. #define SVF_NPC 0x00000004
  12. #define SVF_BOT 0x00000008
  13. #define SVF_PLAYER_USABLE 0x00000010 // player can use this with the use button
  14. #define SVF_BROADCAST 0x00000020 // send to all connected clients
  15. #define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots
  16. #define SVF_USE_CURRENT_ORIGIN 0x00000080 // entity->currentOrigin instead of entity->s.origin
  17. // for link position (missiles and movers)
  18. #define SVF_TRIMODEL 0x00000100 // Use a three piece model make up like a player does
  19. #define SVF_OBJECTIVE 0x00000200 // Draw it's name if crosshair comes across it
  20. #define SVF_ANIMATING 0x00000400 // Currently animating from startFrame to endFrame
  21. #define SVF_NPC_PRECACHE 0x00000800 // Tell cgame to precache this spawner's NPC stuff
  22. #define SVF_KILLED_SELF 0x00001000 // ent killed itself in a script, so don't do ICARUS_FreeEnt on it... or else!
  23. #define SVF_NAVGOAL 0x00002000 // Navgoal
  24. #define SVF_NOPUSH 0x00004000 // Can't be pushed around
  25. #define SVF_ICARUS_FREEZE 0x00008000 // NPCs are frozen, ents don't execute ICARUS commands
  26. #define SVF_PLAT 0x00010000 // A func_plat or door acting like one
  27. #define SVF_BBRUSH 0x00020000 // breakable brush
  28. #define SVF_LOCKEDENEMY 0x00040000 // keep current enemy until dead
  29. #define SVF_IGNORE_ENEMIES 0x00080000 // Ignore all enemies
  30. #define SVF_BEAMING 0x00100000 // Being transported
  31. #define SVF_PLAYING_SOUND 0x00200000 // In the middle of playing a sound
  32. #define SVF_CUSTOM_GRAVITY 0x00400000 // Use personal gravity
  33. #define SVF_BROKEN 0x00800000 // A broken misc_model_breakable
  34. #define SVF_NO_TELEPORT 0x01000000 // Will not be teleported
  35. #define SVF_NONNPC_ENEMY 0x02000000 // Not a client/NPC, but can still be considered a hostile lifeform
  36. #define SVF_SELF_ANIMATING 0x04000000 // Ent will control it's animation itself in it's think func
  37. #define SVF_GLASS_BRUSH 0x08000000 // Ent is a glass brush
  38. #define SVF_NO_BASIC_SOUNDS 0x10000000 // Don't load basic custom sound set
  39. #define SVF_NO_COMBAT_SOUNDS 0x20000000 // Don't load combat custom sound set
  40. #define SVF_NO_EXTRA_SOUNDS 0x40000000 // Don't load extra custom sound set
  41. #define SVF_MOVER_ADJ_AREA_PORTALS 0x80000000 // For scripted movers only- must *explicitly instruct* them to affect area portals
  42. //===============================================================
  43. //rww - RAGDOLL_BEGIN
  44. class CRagDollUpdateParams;
  45. class CRagDollParams;
  46. //rww - RAGDOLL_END
  47. typedef struct gentity_s gentity_t;
  48. typedef struct gclient_s gclient_t;
  49. typedef enum
  50. {
  51. eNO = 0,
  52. eFULL,
  53. eAUTO,
  54. } SavedGameJustLoaded_e;
  55. #ifndef GAME_INCLUDE
  56. // the server needs to know enough information to handle collision and snapshot generation
  57. struct gentity_s {
  58. entityState_t s; // communicated by server to clients
  59. struct playerState_s *client;
  60. qboolean inuse;
  61. qboolean linked; // qfalse if not in any good cluster
  62. int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc
  63. qboolean bmodel; // if false, assume an explicit mins / maxs bounding box
  64. // only set by gi.SetBrushModel
  65. vec3_t mins, maxs;
  66. int contents; // CONTENTS_TRIGGER, CONTENTS_SOLID, CONTENTS_BODY, etc
  67. // a non-solid entity should set to 0
  68. vec3_t absmin, absmax; // derived from mins/maxs and origin + rotation
  69. // currentOrigin will be used for all collision detection and world linking.
  70. // it will not necessarily be the same as the trajectory evaluation for the current
  71. // time, because each entity must be moved one at a time after time is advanced
  72. // to avoid simultanious collision issues
  73. vec3_t currentOrigin;
  74. vec3_t currentAngles;
  75. gentity_t *owner; // objects never interact with their owners, to
  76. // prevent player missiles from immediately
  77. // colliding with their owner
  78. /*
  79. Ghoul2 Insert Start
  80. */
  81. // this marker thing of Jake's is used for memcpy() length calcs, so don't put any ordinary fields (like above)
  82. // below this point or they won't work, and will mess up all sorts of stuff.
  83. //
  84. CGhoul2Info_v ghoul2;
  85. /*
  86. Ghoul2 Insert End
  87. */
  88. // the game dll can add anything it wants after
  89. // this point in the structure
  90. };
  91. #endif // GAME_INCLUDE
  92. //===============================================================
  93. #if defined(_XBOX) && !defined(_TRACE_FUNCTOR_T_DEFINED_)
  94. // Function objects to replace the function pointers used for trace
  95. // We can't have default arguments on function pointers, but this allows us to
  96. // do the same thing with minimal impact elsewhere.
  97. struct Trace_Functor_t
  98. {
  99. typedef void (*trace_func_t)(trace_t *, const vec3_t, const vec3_t, const vec3_t, const vec3_t,
  100. const int, const int, const EG2_Collision, const int);
  101. trace_func_t trace_func;
  102. void operator()( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
  103. const int passEntityNum, const int contentMask, const EG2_Collision eG2TraceType = (EG2_Collision)0, const int useLod = 0 )
  104. { trace_func(results, start, mins, maxs, end, passEntityNum, contentMask, eG2TraceType, useLod); }
  105. const Trace_Functor_t &operator=(trace_func_t traceRHS)
  106. {
  107. trace_func = traceRHS;
  108. return *this;
  109. }
  110. };
  111. // Always create this class exactly once
  112. #define _TRACE_FUNCTOR_T_DEFINED_
  113. #endif
  114. #ifdef _XBOX
  115. // Declare all the functions that we use in the inlined member functions
  116. /*
  117. extern int G2API_InitGhoul2Model(CGhoul2Info_v &ghoul2, const char *fileName, int modelIndex, qhandle_t customSkin = NULL,
  118. qhandle_t customShader = NULL, int modelFlags = 0, int lodBias = 0);
  119. extern qboolean G2API_SetSkin(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0);
  120. extern qboolean G2API_SetBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
  121. const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1);
  122. extern qboolean G2API_SetBoneAngles(CGhoul2Info *ghlInfo, const char *boneName, const vec3_t angles, const int flags,
  123. const Eorientations up, const Eorientations right, const Eorientations forward, qhandle_t *modelList,
  124. int blendTime = 0, int currentTime = 0);
  125. extern qboolean G2API_SetBoneAnglesMatrix(CGhoul2Info *ghlInfo, const char *boneName, const mdxaBone_t &matrix, const int flags,
  126. qhandle_t *modelList, int blendTime = 0, int currentTime = 0);
  127. extern void G2API_CopyGhoul2Instance(CGhoul2Info_v &Ghoul2From, CGhoul2Info_v &Ghoul2To, int modelIndex = -1);
  128. extern qboolean G2API_SetBoneAnglesIndex(CGhoul2Info *ghlInfo, const int index, const vec3_t angles, const int flags,
  129. const Eorientations yaw, const Eorientations pitch, const Eorientations roll,
  130. qhandle_t *modelList, int blendTime, int currentTime);
  131. extern qboolean G2API_SetBoneAnimIndex(CGhoul2Info *ghlInfo, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame, const int blendTime);
  132. */
  133. #include "../ghoul2/g2.h"
  134. extern int SG_Read (unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr);
  135. extern int SG_ReadOptional (unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr);
  136. #endif
  137. //
  138. // functions provided by the main engine
  139. //
  140. /*
  141. Ghoul2 Insert Start
  142. */
  143. class CMiniHeap;
  144. /*
  145. Ghoul2 Insert End
  146. */
  147. typedef struct {
  148. //============== general Quake services ==================
  149. // print message on the local console
  150. void (*Printf)( const char *fmt, ... );
  151. // Write a camera ref_tag to cameras.map
  152. void (*WriteCam)( const char *text );
  153. void (*FlushCamFile)();
  154. // abort the game
  155. void (*Error)( int, const char *fmt, ... );
  156. // get current time for profiling reasons
  157. // this should NOT be used for any game related tasks,
  158. // because it is not journaled
  159. int (*Milliseconds)( void );
  160. // console variable interaction
  161. cvar_t *(*cvar)( const char *var_name, const char *value, int flags );
  162. void (*cvar_set)( const char *var_name, const char *value );
  163. int (*Cvar_VariableIntegerValue)( const char *var_name );
  164. void (*Cvar_VariableStringBuffer)( const char *var_name, char *buffer, int bufsize );
  165. // ClientCommand and ServerCommand parameter access
  166. int (*argc)( void );
  167. char *(*argv)( int n );
  168. int (*FS_FOpenFile)( const char *qpath, fileHandle_t *file, fsMode_t mode );
  169. int (*FS_Read)( void *buffer, int len, fileHandle_t f );
  170. int (*FS_Write)( const void *buffer, int len, fileHandle_t f );
  171. void (*FS_FCloseFile)( fileHandle_t f );
  172. int (*FS_ReadFile)( const char *name, void **buf );
  173. void (*FS_FreeFile)( void *buf );
  174. int (*FS_GetFileList)( const char *path, const char *extension, char *listbuf, int bufsize );
  175. // Savegame handling
  176. //
  177. qboolean (*AppendToSaveGame)(unsigned long chid, const void *data, int length);
  178. #ifdef _XBOX // No default arguments through function pointers
  179. int ReadFromSaveGame(unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL)
  180. {
  181. return SG_Read(chid, pvAddress, iLength, ppvAddressPtr);
  182. }
  183. int ReadFromSaveGameOptional(unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL)
  184. {
  185. return SG_ReadOptional(chid, pvAddress, iLength, ppvAddressPtr);
  186. }
  187. #else
  188. int (*ReadFromSaveGame)(unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL);
  189. int (*ReadFromSaveGameOptional)(unsigned long chid, void *pvAddress, int iLength, void **ppvAddressPtr = NULL);
  190. #endif
  191. // add commands to the console as if they were typed in
  192. // for map changing, etc
  193. void (*SendConsoleCommand)( const char *text );
  194. //=========== server specific functionality =============
  195. // kick a client off the server with a message
  196. void (*DropClient)( int clientNum, const char *reason );
  197. // reliably sends a command string to be interpreted by the given
  198. // client. If clientNum is -1, it will be sent to all clients
  199. void (*SendServerCommand)( int clientNum, const char *fmt, ... );
  200. // config strings hold all the index strings, and various other information
  201. // that is reliably communicated to all clients
  202. // All of the current configstrings are sent to clients when
  203. // they connect, and changes are sent to all connected clients.
  204. // All confgstrings are cleared at each level start.
  205. void (*SetConfigstring)( int num, const char *string );
  206. void (*GetConfigstring)( int num, char *buffer, int bufferSize );
  207. // userinfo strings are maintained by the server system, so they
  208. // are persistant across level loads, while all other game visible
  209. // data is completely reset
  210. void (*GetUserinfo)( int num, char *buffer, int bufferSize );
  211. void (*SetUserinfo)( int num, const char *buffer );
  212. // the serverinfo info string has all the cvars visible to server browsers
  213. void (*GetServerinfo)( char *buffer, int bufferSize );
  214. // sets mins and maxs based on the brushmodel name
  215. void (*SetBrushModel)( gentity_t *ent, const char *name );
  216. // collision detection against all linked entities
  217. #ifdef _XBOX
  218. Trace_Functor_t trace;
  219. #else
  220. void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
  221. const int passEntityNum, const int contentmask , const EG2_Collision eG2TraceType = (EG2_Collision)0, const int useLod = 0);
  222. #endif
  223. // point contents against all linked entities
  224. int (*pointcontents)( const vec3_t point, int passEntityNum );
  225. // what contents are on the map?
  226. int (*totalMapContents)();
  227. qboolean (*inPVS)( const vec3_t p1, const vec3_t p2 );
  228. qboolean (*inPVSIgnorePortals)( const vec3_t p1, const vec3_t p2 );
  229. void (*AdjustAreaPortalState)( gentity_t *ent, qboolean open );
  230. qboolean (*AreasConnected)( int area1, int area2 );
  231. // an entity will never be sent to a client or used for collision
  232. // if it is not passed to linkentity. If the size, position, or
  233. // solidity changes, it must be relinked.
  234. void (*linkentity)( gentity_t *ent );
  235. void (*unlinkentity)( gentity_t *ent ); // call before removing an interactive entity
  236. // EntitiesInBox will return brush models based on their bounding box,
  237. // so exact determination must still be done with EntityContact
  238. int (*EntitiesInBox)( const vec3_t mins, const vec3_t maxs, gentity_t **list, int maxcount );
  239. // perform an exact check against inline brush models of non-square shape
  240. qboolean (*EntityContact)( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
  241. // sound volume values
  242. int *VoiceVolume;
  243. // dynamic memory allocator for things that need to be freed
  244. void *(*Malloc)( int iSize, memtag_t eTag, qboolean bZeroIt); // see qcommon/tags.h for choices
  245. int (*Free)( void *buf );
  246. qboolean (*bIsFromZone)( void *buf, memtag_t eTag); // see qcommon/tags.h for choices
  247. /*
  248. Ghoul2 Insert Start
  249. */
  250. qhandle_t (*G2API_PrecacheGhoul2Model)(const char *fileName);
  251. #ifdef _XBOX // No default arguments through function pointers
  252. int G2API_InitGhoul2Model(CGhoul2Info_v &ghoul2, const char *fileName, int modelIndex, qhandle_t customSkin = NULL,
  253. qhandle_t customShader = NULL, int modelFlags = 0, int lodBias = 0)
  254. {
  255. return ::G2API_InitGhoul2Model(ghoul2, fileName, modelIndex, customSkin, customShader, modelFlags, lodBias);
  256. }
  257. qboolean G2API_SetSkin(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0 )
  258. {
  259. return ::G2API_SetSkin(ghlInfo, customSkin, renderSkin);
  260. }
  261. qboolean G2API_SetBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
  262. const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1)
  263. {
  264. return ::G2API_SetBoneAnim(ghlInfo, boneName, startFrame, endFrame, flags, animSpeed, currentTime, setFrame, blendTime);
  265. }
  266. qboolean G2API_SetBoneAngles(CGhoul2Info *ghlInfo, const char *boneName, const vec3_t angles,
  267. const int flags, const Eorientations up, const Eorientations right, const Eorientations forward,
  268. qhandle_t *modelList, int blendTime = 0, int blendStart = 0)
  269. {
  270. return ::G2API_SetBoneAngles(ghlInfo, boneName, angles, flags, up, right, forward, modelList, blendTime, blendStart);
  271. }
  272. qboolean G2API_SetBoneAnglesMatrix(CGhoul2Info *ghlInfo, const char *boneName, const mdxaBone_t &matrix, const int flags,
  273. qhandle_t *modelList, int blendTime = 0, int currentTime = 0)
  274. {
  275. return ::G2API_SetBoneAnglesMatrix(ghlInfo, boneName, matrix, flags, modelList, blendTime, currentTime);
  276. }
  277. void G2API_CopyGhoul2Instance(CGhoul2Info_v &ghoul2From, CGhoul2Info_v &ghoul2To, int modelIndex = -1)
  278. {
  279. ::G2API_CopyGhoul2Instance(ghoul2From, ghoul2To, modelIndex);
  280. }
  281. qboolean G2API_SetBoneAnglesIndex(CGhoul2Info *ghlInfo, const int index, const vec3_t angles, const int flags,
  282. const Eorientations yaw, const Eorientations pitch, const Eorientations roll,
  283. qhandle_t *modelList, int blendTime = 0, int currentTime = 0)
  284. {
  285. return ::G2API_SetBoneAnglesIndex(ghlInfo, index, angles, flags, yaw, pitch, roll, modelList, blendTime, currentTime);
  286. }
  287. qboolean G2API_SetBoneAnimIndex(CGhoul2Info *ghlInfo, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1)
  288. {
  289. return ::G2API_SetBoneAnimIndex(ghlInfo, index, startFrame, endFrame, flags, animSpeed, currentTime, setFrame, blendTime);
  290. }
  291. #else
  292. int (*G2API_InitGhoul2Model)(CGhoul2Info_v &ghoul2, const char *fileName, int modelIndex, qhandle_t customSkin = NULL,
  293. qhandle_t customShader = NULL, int modelFlags = 0, int lodBias = 0);
  294. qboolean (*G2API_SetSkin)(CGhoul2Info *ghlInfo, qhandle_t customSkin, qhandle_t renderSkin = 0 );
  295. qboolean (*G2API_SetBoneAnim)(CGhoul2Info *ghlInfo, const char *boneName, const int startFrame, const int endFrame,
  296. const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1);
  297. qboolean (*G2API_SetBoneAngles)(CGhoul2Info *ghlInfo, const char *boneName, const vec3_t angles,
  298. const int flags, const Eorientations up, const Eorientations right, const Eorientations forward,
  299. qhandle_t *modelList, int blendTime = 0, int blendStart = 0);
  300. qboolean (*G2API_SetBoneAnglesIndex)(CGhoul2Info *ghlInfo, const int index, const vec3_t angles, const int flags,
  301. const Eorientations yaw, const Eorientations pitch, const Eorientations roll,
  302. qhandle_t *modelList, int blendTime = 0, int currentTime = 0);
  303. qboolean (*G2API_SetBoneAnglesMatrix)(CGhoul2Info *ghlInfo, const char *boneName, const mdxaBone_t &matrix, const int flags,
  304. qhandle_t *modelList, int blendTime = 0, int currentTime = 0);
  305. void (*G2API_CopyGhoul2Instance)(CGhoul2Info_v &ghoul2From, CGhoul2Info_v &ghoul2To, int modelIndex = -1);
  306. qboolean (*G2API_SetBoneAnimIndex)(CGhoul2Info *ghlInfo, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1);
  307. #endif
  308. qboolean (*G2API_SetLodBias)(CGhoul2Info *ghlInfo, int lodBias);
  309. qboolean (*G2API_SetShader)(CGhoul2Info *ghlInfo, qhandle_t customShader);
  310. qboolean (*G2API_RemoveGhoul2Model)(CGhoul2Info_v &ghlInfo, const int modelIndex);
  311. qboolean (*G2API_SetSurfaceOnOff)(CGhoul2Info *ghlInfo, const char *surfaceName, const int flags);
  312. qboolean (*G2API_SetRootSurface)(CGhoul2Info_v &ghlInfo, const int modelIndex, const char *surfaceName);
  313. qboolean (*G2API_RemoveSurface)(CGhoul2Info *ghlInfo, const int index);
  314. int (*G2API_AddSurface)(CGhoul2Info *ghlInfo, int surfaceNumber, int polyNumber, float BarycentricI, float BarycentricJ, int lod );
  315. qboolean (*G2API_GetBoneAnim)(CGhoul2Info *ghlInfo, const char *boneName, const int currentTime, float *currentFrame,
  316. int *startFrame, int *endFrame, int *flags, float *animSpeed, int *modelList);
  317. qboolean (*G2API_GetBoneAnimIndex)(CGhoul2Info *ghlInfo, const int iBoneIndex, const int currentTime, float *currentFrame,
  318. int *startFrame, int *endFrame, int *flags, float *animSpeed, int *modelList);
  319. qboolean (*G2API_GetAnimRange)(CGhoul2Info *ghlInfo, const char *boneName, int *startFrame, int *endFrame);
  320. qboolean (*G2API_GetAnimRangeIndex)(CGhoul2Info *ghlInfo, const int boneIndex, int *startFrame, int *endFrame);
  321. qboolean (*G2API_PauseBoneAnim)(CGhoul2Info *ghlInfo, const char *boneName, const int currentTime);
  322. qboolean (*G2API_PauseBoneAnimIndex)(CGhoul2Info *ghlInfo, const int boneIndex, const int currentTime);
  323. qboolean (*G2API_IsPaused)(CGhoul2Info *ghlInfo, const char *boneName);
  324. qboolean (*G2API_StopBoneAnim)(CGhoul2Info *ghlInfo, const char *boneName);
  325. qboolean (*G2API_StopBoneAngles)(CGhoul2Info *ghlInfo, const char *boneName);
  326. qboolean (*G2API_RemoveBone)(CGhoul2Info *ghlInfo, const char *boneName);
  327. qboolean (*G2API_RemoveBolt)(CGhoul2Info *ghlInfo, const int index);
  328. int (*G2API_AddBolt)(CGhoul2Info *ghlInfo, const char *boneName);
  329. int (*G2API_AddBoltSurfNum)(CGhoul2Info *ghlInfo, const int surfIndex);
  330. qboolean (*G2API_AttachG2Model)(CGhoul2Info *ghlInfo, CGhoul2Info *ghlInfoTo, int toBoltIndex, int toModel);
  331. qboolean (*G2API_DetachG2Model)(CGhoul2Info *ghlInfo);
  332. qboolean (*G2API_AttachEnt)(int *boltInfo, CGhoul2Info *ghlInfoTo, int toBoltIndex, int entNum, int toModelNum);
  333. void (*G2API_DetachEnt)(int *boltInfo);
  334. qboolean (*G2API_GetBoltMatrix)(CGhoul2Info_v &ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, const vec3_t scale);
  335. void (*G2API_ListSurfaces)(CGhoul2Info *ghlInfo);
  336. void (*G2API_ListBones)(CGhoul2Info *ghlInfo, int frame);
  337. qboolean (*G2API_HaveWeGhoul2Models)(CGhoul2Info_v &ghoul2);
  338. qboolean (*G2API_SetGhoul2ModelFlags)(CGhoul2Info *ghlInfo, const int flags);
  339. int (*G2API_GetGhoul2ModelFlags)(CGhoul2Info *ghlInfo);
  340. qboolean (*G2API_GetAnimFileName)(CGhoul2Info *ghlInfo, char **filename);
  341. void (*G2API_CollisionDetect)(CCollisionRecord *collRecMap, CGhoul2Info_v &ghoul2, const vec3_t angles, const vec3_t position,
  342. int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, CMiniHeap *G2VertSpace,
  343. EG2_Collision eG2TraceType, int useLod, float fRadius);
  344. void (*G2API_GiveMeVectorFromMatrix)(mdxaBone_t &boltMatrix, Eorientations flags, vec3_t &vec);
  345. void (*G2API_CleanGhoul2Models)(CGhoul2Info_v &ghoul2);
  346. IGhoul2InfoArray & (*TheGhoul2InfoArray)();
  347. int (*G2API_GetParentSurface)(CGhoul2Info *ghlInfo, const int index);
  348. int (*G2API_GetSurfaceIndex)(CGhoul2Info *ghlInfo, const char *surfaceName);
  349. char *(*G2API_GetSurfaceName)(CGhoul2Info *ghlInfo, int surfNumber);
  350. char *(*G2API_GetGLAName)(CGhoul2Info *ghlInfo);
  351. qboolean (*G2API_SetNewOrigin)(CGhoul2Info *ghlInfo, const int boltIndex);
  352. int (*G2API_GetBoneIndex)(CGhoul2Info *ghlInfo, const char *boneName, qboolean bAddIfNotFound);
  353. qboolean (*G2API_StopBoneAnglesIndex)(CGhoul2Info *ghlInfo, const int index);
  354. qboolean (*G2API_StopBoneAnimIndex)(CGhoul2Info *ghlInfo, const int index);
  355. qboolean (*G2API_SetBoneAnglesMatrixIndex)(CGhoul2Info *ghlInfo, const int index, const mdxaBone_t &matrix,
  356. const int flags, qhandle_t *modelList, int blendTime, int currentTime);
  357. qboolean (*G2API_SetAnimIndex)(CGhoul2Info *ghlInfo, const int index);
  358. int (*G2API_GetAnimIndex)(CGhoul2Info *ghlInfo);
  359. void (*G2API_SaveGhoul2Models)(CGhoul2Info_v &ghoul2);
  360. void (*G2API_LoadGhoul2Models)(CGhoul2Info_v &ghoul2, char *buffer);
  361. void (*G2API_LoadSaveCodeDestructGhoul2Info)(CGhoul2Info_v &ghoul2);
  362. char *(*G2API_GetAnimFileNameIndex)(qhandle_t modelIndex);
  363. char *(*G2API_GetAnimFileInternalNameIndex)(qhandle_t modelIndex);
  364. int (*G2API_GetSurfaceRenderStatus)(CGhoul2Info *ghlInfo, const char *surfaceName);
  365. //rww - RAGDOLL_BEGIN
  366. void (*G2API_SetRagDoll)(CGhoul2Info_v &ghoul2,CRagDollParams *parms);
  367. void (*G2API_AnimateG2Models)(CGhoul2Info_v &ghoul2, int AcurrentTime,CRagDollUpdateParams *params);
  368. qboolean (*G2API_RagPCJConstraint)(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t min, vec3_t max);
  369. qboolean (*G2API_RagPCJGradientSpeed)(CGhoul2Info_v &ghoul2, const char *boneName, const float speed);
  370. qboolean (*G2API_RagEffectorGoal)(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t pos);
  371. qboolean (*G2API_GetRagBonePos)(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale);
  372. qboolean (*G2API_RagEffectorKick)(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t velocity);
  373. qboolean (*G2API_RagForceSolve)(CGhoul2Info_v &ghoul2, qboolean force);
  374. qboolean (*G2API_SetBoneIKState)(CGhoul2Info_v &ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params);
  375. qboolean (*G2API_IKMove) (CGhoul2Info_v &ghoul2, int time, sharedIKMoveParams_t *params);
  376. //rww - RAGDOLL_END
  377. void (*G2API_AddSkinGore)(CGhoul2Info_v &ghoul2,SSkinGoreData &gore);
  378. void (*G2API_ClearSkinGore)( CGhoul2Info_v &ghoul2 );
  379. void (*RMG_Init)(int terrainID);
  380. #ifndef _XBOX
  381. int (*CM_RegisterTerrain)(const char *info);
  382. #endif
  383. const char *(*SetActiveSubBSP)(int index);
  384. int (*RE_RegisterSkin)(const char *name);
  385. int (*RE_GetAnimationCFG)(const char *psCFGFilename, char *psDest, int iDestSize);
  386. bool (*WE_GetWindVector)(vec3_t windVector, vec3_t atpoint);
  387. bool (*WE_GetWindGusting)(vec3_t atpoint);
  388. bool (*WE_IsOutside)(vec3_t pos);
  389. float (*WE_IsOutsideCausingPain)(vec3_t pos);
  390. float (*WE_GetChanceOfSaberFizz)(void);
  391. bool (*WE_IsShaking)(vec3_t pos);
  392. void (*WE_AddWeatherZone)(vec3_t mins, vec3_t maxs);
  393. bool (*WE_SetTempGlobalFogColor)(vec3_t color);
  394. /*
  395. Ghoul2 Insert End
  396. */
  397. } game_import_t;
  398. //
  399. // functions exported by the game subsystem
  400. //
  401. typedef struct {
  402. int apiversion;
  403. // init and shutdown will be called every single level
  404. // levelTime will be near zero, while globalTime will be a large number
  405. // that can be used to track spectator entry times across restarts
  406. void (*Init)( const char *mapname, const char *spawntarget, int checkSum, const char *entstring, int levelTime, int randomSeed, int globalTime, SavedGameJustLoaded_e eSavedGameJustLoaded, qboolean qbLoadTransition );
  407. void (*Shutdown) (void);
  408. // ReadLevel is called after the default map information has been
  409. // loaded with SpawnEntities
  410. void (*WriteLevel) (qboolean qbAutosave);
  411. void (*ReadLevel) (qboolean qbAutosave, qboolean qbLoadTransition);
  412. qboolean (*GameAllowedToSaveHere)(void);
  413. // return NULL if the client is allowed to connect, otherwise return
  414. // a text string with the reason for denial
  415. char *(*ClientConnect)( int clientNum, qboolean firstTime, SavedGameJustLoaded_e eSavedGameJustLoaded );
  416. void (*ClientBegin)( int clientNum, usercmd_t *cmd, SavedGameJustLoaded_e eSavedGameJustLoaded);
  417. void (*ClientUserinfoChanged)( int clientNum );
  418. void (*ClientDisconnect)( int clientNum );
  419. void (*ClientCommand)( int clientNum );
  420. void (*ClientThink)( int clientNum, usercmd_t *cmd );
  421. void (*RunFrame)( int levelTime );
  422. void (*ConnectNavs)( const char *mapname, int checkSum );
  423. // ConsoleCommand will be called when a command has been issued
  424. // that is not recognized as a builtin function.
  425. // The game can issue gi.argc() / gi.argv() commands to get the command
  426. // and parameters. Return qfalse if the game doesn't recognize it as a command.
  427. qboolean (*ConsoleCommand)( void );
  428. //void (*PrintEntClassname)( int clientNum );
  429. //int (*ValidateAnimRange)( int startFrame, int endFrame, float animSpeed );
  430. void (*GameSpawnRMGEntity)(char *s);
  431. //
  432. // global variables shared between game and server
  433. //
  434. // The gentities array is allocated in the game dll so it
  435. // can vary in size from one game to another.
  436. //
  437. // The size will be fixed when ge->Init() is called
  438. // the server can't just use pointer arithmetic on gentities, because the
  439. // server's sizeof(struct gentity_s) doesn't equal gentitySize
  440. struct gentity_s *gentities;
  441. int gentitySize;
  442. int num_entities; // current number, <= MAX_GENTITIES
  443. } game_export_t;
  444. game_export_t *GetGameApi (game_import_t *import);
  445. #endif//#ifndef __G_PUBLIC_H__