1 /*
2 ===========================================================================
3 Copyright (C) 2000 - 2013, Raven Software, Inc.
4 Copyright (C) 2001 - 2013, Activision, Inc.
5 Copyright (C) 2013 - 2015, OpenJK contributors
6 
7 This file is part of the OpenJK source code.
8 
9 OpenJK is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License version 2 as
11 published by the Free Software Foundation.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 ===========================================================================
21 */
22 
23 #pragma once
24 
25 // defines to setup the
26 
27 #include "ghoul2/ghoul2_shared.h"
28 
29 //rww - RAGDOLL_BEGIN
30 class CRagDollUpdateParams;
31 //rww - RAGDOLL_END
32 
33 class IHeapAllocator;
34 
35 #define		GHOUL2_CRAZY_SMOOTH						0x2000		//hack for smoothing during ugly situations. forgive me.
36 
37 class IGhoul2InfoArray
38 {
39 public:
~IGhoul2InfoArray()40 	virtual ~IGhoul2InfoArray() {}
41 
42 	virtual int New()=0;
43 	virtual void Delete(int handle)=0;
44 	virtual bool IsValid(int handle) const=0;
45 	virtual std::vector<CGhoul2Info> &Get(int handle)=0;
46 	virtual const std::vector<CGhoul2Info> &Get(int handle) const=0;
47 };
48 
49 IGhoul2InfoArray &TheGhoul2InfoArray();
50 class CGhoul2Info_v
51 {
InfoArray()52 	IGhoul2InfoArray &InfoArray() const
53 	{
54 		return TheGhoul2InfoArray();
55 	}
56 
Alloc()57 	void Alloc()
58 	{
59 		assert(!mItem); //already alloced
60 		mItem=InfoArray().New();
61 		assert(!Array().size());
62 	}
Free()63 	void Free()
64 	{
65 		if (mItem)
66 		{
67 			assert(InfoArray().IsValid(mItem));
68 			InfoArray().Delete(mItem);
69 			mItem=0;
70 		}
71 	}
Array()72 	std::vector<CGhoul2Info> &Array()
73 	{
74 		assert(InfoArray().IsValid(mItem));
75 		return InfoArray().Get(mItem);
76 	}
Array()77 	const std::vector<CGhoul2Info> &Array() const
78 	{
79 		assert(InfoArray().IsValid(mItem));
80 		return InfoArray().Get(mItem);
81 	}
82 public:
83 	int mItem;	//dont' be bad and muck with this
CGhoul2Info_v()84 	CGhoul2Info_v()
85 	{
86 		mItem=0;
87 	}
CGhoul2Info_v(const int item)88 	CGhoul2Info_v(const int item)
89 	{	//be VERY carefull with what you pass in here
90 		mItem=item;
91 	}
~CGhoul2Info_v()92 	~CGhoul2Info_v()
93 	{
94 		Free(); //this had better be taken care of via the clean ghoul2 models call
95 	}
96 	void operator=(const CGhoul2Info_v &other)
97 	{
98 		mItem=other.mItem;
99 	}
100 	void operator=(const int otherItem)	//assigning one from the VM side item number
101 	{
102 		mItem=otherItem;
103 	}
DeepCopy(const CGhoul2Info_v & other)104 	void DeepCopy(const CGhoul2Info_v &other)
105 	{
106 		Free();
107 		if (other.mItem)
108 		{
109 			Alloc();
110 			Array()=other.Array();
111 			int i;
112 			for (i=0;i<size();i++)
113 			{
114 				Array()[i].mBoneCache=0;
115 				Array()[i].mTransformedVertsArray=0;
116 				Array()[i].mSkelFrameNum=0;
117 				Array()[i].mMeshFrameNum=0;
118 			}
119 		}
120 	}
121 	CGhoul2Info &operator[](int idx)
122 	{
123 		assert (mItem);
124 		assert (idx >= 0 && idx < size());
125 
126 		return Array()[idx];
127 	}
128 	const CGhoul2Info &operator[](int idx) const
129 	{
130 		assert (mItem);
131 		assert (idx >= 0 && idx < size());
132 
133 		return Array()[idx];
134 	}
resize(int num)135 	void resize(int num)
136 	{
137 		assert(num>=0);
138 		if (num)
139 		{
140 			if (!mItem)
141 			{
142 				Alloc();
143 			}
144 		}
145 		if (mItem||num)
146 		{
147 			Array().resize(num);
148 		}
149 	}
clear()150 	void clear()
151 	{
152 		Free();
153 	}
push_back(const CGhoul2Info & model)154 	void push_back(const CGhoul2Info &model)
155 	{
156 		if (!mItem)
157 		{
158 			Alloc();
159 		}
160 		Array().push_back(model);
161 	}
size()162 	int size() const
163 	{
164 		if (!IsValid())
165 		{
166 			return 0;
167 		}
168 		return Array().size();
169 	}
IsValid()170 	bool IsValid() const
171 	{
172 		return InfoArray().IsValid(mItem);
173 	}
kill()174 	void kill()
175 	{
176 		// this scary method zeros the infovector handle without actually freeing it
177 		// it is used for some places where a copy is made, but we don't want to go through the trouble
178 		// of making a deep copy
179 		mItem=0;
180 	}
181 };
182 
183 void Create_Matrix(const float *angle, mdxaBone_t *matrix);
184 
185 extern mdxaBone_t		worldMatrix;
186 extern mdxaBone_t		worldMatrixInv;
187 
188 // internal surface calls  G2_surfaces.cpp
189 qboolean	G2_SetSurfaceOnOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const char *surfaceName, const int offFlags);
190 int			G2_IsSurfaceOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const char *surfaceName);
191 qboolean	G2_SetRootSurface( CGhoul2Info_v &ghoul2, const int modelIndex, const char *surfaceName);
192 int			G2_AddSurface(CGhoul2Info *ghoul2, int surfaceNumber, int polyNumber, float BarycentricI, float BarycentricJ, int lod );
193 qboolean	G2_RemoveSurface(surfaceInfo_v &slist, const int index);
194 surfaceInfo_t *G2_FindOverrideSurface(int surfaceNum, surfaceInfo_v &surfaceList);
195 int			G2_IsSurfaceLegal(void *mod, const char *surfaceName, int *flags);
196 int			G2_GetParentSurface(CGhoul2Info *ghlInfo, const int index);
197 int			G2_GetSurfaceIndex(CGhoul2Info *ghlInfo, const char *surfaceName);
198 int			G2_IsSurfaceRendered(CGhoul2Info *ghlInfo, const char *surfaceName, surfaceInfo_v &slist);
199 
200 // internal bone calls - G2_Bones.cpp
201 qboolean	G2_Set_Bone_Angles(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName, const float *angles, const int flags, const Eorientations up, const Eorientations left, const Eorientations forward, qhandle_t *modelList, const int modelIndex, const int blendTime, const int currentTime);
202 qboolean	G2_Remove_Bone (CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName);
203 qboolean	G2_Set_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame, const int blendTime);
204 qboolean	G2_Get_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName, const int currentTime, float *currentFrame, int *startFrame, int *endFrame, int *flags, float *retAnimSpeed, qhandle_t *modelList, int modelIndex);
205 qboolean	G2_Get_Bone_Anim_Range(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName, int *startFrame, int *endFrame);
206 qboolean	G2_Pause_Bone_Anim(CGhoul2Info *ghlInfo, boneInfo_v &blist, const char *boneName, const int currentTime );
207 qboolean	G2_IsPaused(const char *fileName, boneInfo_v &blist, const char *boneName);
208 qboolean	G2_Stop_Bone_Anim(const char *fileName, boneInfo_v &blist, const char *boneName);
209 qboolean	G2_Stop_Bone_Angles(const char *fileName, boneInfo_v &blist, const char *boneName);
210 //rww - RAGDOLL_BEGIN
211 void		G2_Animate_Bone_List(CGhoul2Info_v &ghoul2, const int currentTime, const int index,CRagDollUpdateParams *params);
212 //rww - RAGDOLL_END
213 void		G2_Init_Bone_List(boneInfo_v &blist, int numBones);
214 int			G2_Find_Bone_In_List(boneInfo_v &blist, const int boneNum);
215 void		G2_RemoveRedundantBoneOverrides(boneInfo_v &blist, int *activeBones);
216 qboolean	G2_Set_Bone_Angles_Matrix(const char *fileName, boneInfo_v &blist, const char *boneName, const mdxaBone_t &matrix, const int flags, qhandle_t *modelList, const int modelIndex, const int blendTime, const int currentTime);
217 int			G2_Get_Bone_Index(CGhoul2Info *ghoul2, const char *boneName);
218 qboolean	G2_Set_Bone_Angles_Index(boneInfo_v &blist, const int index, const float *angles, const int flags, const Eorientations yaw, const Eorientations pitch, const Eorientations roll, qhandle_t *modelList, const int modelIndex, const int blendTime, const int currentTime);
219 qboolean	G2_Set_Bone_Angles_Matrix_Index(boneInfo_v &blist, const int index, const mdxaBone_t &matrix, const int flags, qhandle_t *modelList, const int modelIndex, const int blendTime, const int currentTime);
220 qboolean	G2_Stop_Bone_Anim_Index(boneInfo_v &blist, const int index);
221 qboolean	G2_Stop_Bone_Angles_Index(boneInfo_v &blist, const int index);
222 qboolean	G2_Set_Bone_Anim_Index(boneInfo_v &blist, const int index, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame, const int blendTime, const int numFrames);
223 qboolean	G2_Get_Bone_Anim_Index( boneInfo_v &blist, const int index, const int currentTime, float *currentFrame, int *startFrame, int *endFrame, int *flags, float *retAnimSpeed, qhandle_t *modelList, int modelIndex);
224 
225 // misc functions G2_misc.cpp
226 void		G2_List_Model_Surfaces(const char *fileName);
227 void		G2_List_Model_Bones(const char *fileName, int frame);
228 qboolean	G2_GetAnimFileName(const char *fileName, char **filename);
229 #ifdef _G2_GORE
230 void		G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, CollisionRecord_t *collRecMap, int entNum, int traceFlags, int useLod, float fRadius, float ssize,float tsize,float theta,int shader, SSkinGoreData *gore, qboolean skipIfLODNotMatch);
231 #else
232 void		G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, CollisionRecord_t *collRecMap, int entNum, int traceFlags, int useLod, float fRadius);
233 #endif
234 void		TransformAndTranslatePoint (const vec3_t in, vec3_t out, mdxaBone_t *mat);
235 #ifdef _G2_GORE
236 void		G2_TransformModel(CGhoul2Info_v &ghoul2, const int frameNum, vec3_t scale, IHeapAllocator *G2VertSpace, int useLod, bool ApplyGore);
237 #else
238 void		G2_TransformModel(CGhoul2Info_v &ghoul2, const int frameNum, vec3_t scale, IHeapAllocator *G2VertSpace, int useLod);
239 #endif
240 void		G2_GenerateWorldMatrix(const vec3_t angles, const vec3_t origin);
241 void		TransformPoint (const vec3_t in, vec3_t out, mdxaBone_t *mat);
242 void		Inverse_Matrix(mdxaBone_t *src, mdxaBone_t *dest);
243 void		*G2_FindSurface(void *mod, int index, int lod);
244 qboolean	G2_SaveGhoul2Models(CGhoul2Info_v &ghoul2, char **buffer, int *size);
245 void		G2_LoadGhoul2Model(CGhoul2Info_v &ghoul2, char *buffer);
246 
247 // internal bolt calls. G2_bolts.cpp
248 int			G2_Add_Bolt(CGhoul2Info *ghlInfo, boltInfo_v &bltlist, surfaceInfo_v &slist, const char *boneName);
249 qboolean	G2_Remove_Bolt (boltInfo_v &bltlist, int index);
250 void		G2_Init_Bolt_List(boltInfo_v &bltlist);
251 int			G2_Find_Bolt_Bone_Num(boltInfo_v &bltlist, const int boneNum);
252 int			G2_Find_Bolt_Surface_Num(boltInfo_v &bltlist, const int surfaceNum, const int flags);
253 int			G2_Add_Bolt_Surf_Num(CGhoul2Info *ghlInfo, boltInfo_v &bltlist, surfaceInfo_v &slist, const int surfNum);
254 void		G2_RemoveRedundantBolts(boltInfo_v &bltlist, surfaceInfo_v &slist, int *activeSurfaces, int *activeBones);
255 
256 
257 // API calls - G2_API.cpp
258 void		RestoreGhoul2InfoArray();
259 void		SaveGhoul2InfoArray();
260 
261 void		G2API_SetTime(int currentTime, int clock);
262 int			G2API_GetTime(int argTime);
263 
264 qhandle_t	G2API_PrecacheGhoul2Model(const char *fileName);
265 
266 qboolean	G2API_IsGhoul2InfovValid (CGhoul2Info_v& ghoul2);
267 int			G2API_InitGhoul2Model(CGhoul2Info_v **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin = NULL_HANDLE, qhandle_t customShader = NULL_HANDLE, int modelFlags = 0, int lodBias = 0);
268 qboolean	G2API_SetLodBias(CGhoul2Info *ghlInfo, int lodBias);
269 qboolean	G2API_SetSkin(CGhoul2Info_v& ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin);
270 qboolean	G2API_SetShader(CGhoul2Info *ghlInfo, qhandle_t customShader);
271 qboolean	G2API_HasGhoul2ModelOnIndex(CGhoul2Info_v **ghlRemove, const int modelIndex);
272 qboolean	G2API_RemoveGhoul2Model(CGhoul2Info_v **ghlRemove, const int modelIndex);
273 qboolean	G2API_RemoveGhoul2Models(CGhoul2Info_v **ghlRemove);
274 qboolean	G2API_SetSurfaceOnOff(CGhoul2Info_v &ghoul2, const char *surfaceName, const int flags);
275 int			G2API_GetSurfaceOnOff(CGhoul2Info *ghlInfo, const char *surfaceName);
276 qboolean	G2API_SetRootSurface(CGhoul2Info_v &ghoul2, const int modelIndex, const char *surfaceName);
277 qboolean	G2API_RemoveSurface(CGhoul2Info *ghlInfo, const int index);
278 int			G2API_AddSurface(CGhoul2Info *ghlInfo, int surfaceNumber, int polyNumber, float BarycentricI, float BarycentricJ, int lod );
279 qboolean	G2API_SetBoneAnim(CGhoul2Info_v &ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame = -1, const int blendTime = -1);
280 qboolean	G2API_GetBoneAnim(CGhoul2Info_v& ghoul2, int modelIndex, const char *boneName, const int currentTime, float *currentFrame, int *startFrame, int *endFrame, int *flags, float *animSpeed, qhandle_t *modelList);
281 qboolean	G2API_GetAnimRange(CGhoul2Info *ghlInfo, const char *boneName,	int *startFrame, int *endFrame);
282 qboolean	G2API_PauseBoneAnim(CGhoul2Info *ghlInfo, const char *boneName, const int currentTime);
283 qboolean	G2API_IsPaused(CGhoul2Info *ghlInfo, const char *boneName);
284 qboolean	G2API_StopBoneAnim(CGhoul2Info *ghlInfo, const char *boneName);
285 
286 
287 qboolean G2API_SetBoneAngles(CGhoul2Info_v &ghoul2, const int modelIndex, const char *boneName, const vec3_t angles, const int flags, const Eorientations up, const Eorientations left, const Eorientations forward, qhandle_t *modelList, int blendTime, int currentTime );
288 
289 qboolean	G2API_StopBoneAngles(CGhoul2Info *ghlInfo, const char *boneName);
290 qboolean	G2API_RemoveBone(CGhoul2Info_v& ghoul2, int modelIndex, const char *boneName);
291 void		G2API_AnimateG2Models(CGhoul2Info_v &ghoul2, float speedVar);
292 qboolean	G2API_RemoveBolt(CGhoul2Info *ghlInfo, const int index);
293 int			G2API_AddBolt(CGhoul2Info_v &ghoul2, const int modelIndex, const char *boneName);
294 int			G2API_AddBoltSurfNum(CGhoul2Info *ghlInfo, const int surfIndex);
295 void		G2API_SetBoltInfo(CGhoul2Info_v &ghoul2, int modelIndex, int boltInfo);
296 qboolean	G2API_AttachG2Model(CGhoul2Info_v &ghoul2From, int modelFrom, CGhoul2Info_v &ghoul2To, int toBoltIndex, int toModel);
297 qboolean	G2API_DetachG2Model(CGhoul2Info *ghlInfo);
298 qboolean	G2API_AttachEnt(int *boltInfo, CGhoul2Info_v& ghoul2, int modelIndex, int toBoltIndex, int entNum, int toModelNum);
299 void		G2API_DetachEnt(int *boltInfo);
300 
301 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, vec3_t scale);
302 
303 void		G2API_ListSurfaces(CGhoul2Info *ghlInfo);
304 void		G2API_ListBones(CGhoul2Info *ghlInfo, int frame);
305 qboolean	G2API_HaveWeGhoul2Models(CGhoul2Info_v &ghoul2);
306 void		G2API_SetGhoul2ModelIndexes(CGhoul2Info_v &ghoul2, qhandle_t *modelList, qhandle_t *skinList);
307 qboolean	G2API_SetGhoul2ModelFlags(CGhoul2Info *ghlInfo, const int flags);
308 int			G2API_GetGhoul2ModelFlags(CGhoul2Info *ghlInfo);
309 
310 qboolean	G2API_GetAnimFileName(CGhoul2Info *ghlInfo, char **filename);
311 void		G2API_CollisionDetect(CollisionRecord_t *collRecMap, CGhoul2Info_v &ghoul2, const vec3_t angles, const vec3_t position, int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, IHeapAllocator *G2VertSpace, int traceFlags, int useLod, float fRadius);
312 void		G2API_CollisionDetectCache(CollisionRecord_t *collRecMap, CGhoul2Info_v &ghoul2, const vec3_t angles, const vec3_t position, int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, IHeapAllocator *G2VertSpace, int traceFlags, int useLod, float fRadius);
313 
314 void		G2API_GiveMeVectorFromMatrix(mdxaBone_t *boltMatrix, Eorientations flags, vec3_t vec);
315 int			G2API_CopyGhoul2Instance(CGhoul2Info_v &g2From, CGhoul2Info_v &g2To, int modelIndex);
316 void		G2API_CleanGhoul2Models(CGhoul2Info_v **ghoul2Ptr);
317 int			G2API_GetParentSurface(CGhoul2Info *ghlInfo, const int index);
318 int			G2API_GetSurfaceIndex(CGhoul2Info *ghlInfo, const char *surfaceName);
319 char		*G2API_GetSurfaceName(CGhoul2Info_v& ghoul2, int modelIndex, int surfNumber);
320 char		*G2API_GetGLAName(CGhoul2Info_v &ghoul2, int modelIndex);
321 qboolean	G2API_SetBoneAnglesMatrix(CGhoul2Info *ghlInfo, const char *boneName, const mdxaBone_t &matrix, const int flags, qhandle_t *modelList, int blendTime = 0, int currentTime = 0);
322 qboolean	G2API_SetNewOrigin(CGhoul2Info_v &ghoul2, const int boltIndex);
323 int			G2API_GetBoneIndex(CGhoul2Info *ghlInfo, const char *boneName);
324 qboolean	G2API_StopBoneAnglesIndex(CGhoul2Info *ghlInfo, const int index);
325 qboolean	G2API_StopBoneAnimIndex(CGhoul2Info *ghlInfo, const int index);
326 qboolean	G2API_SetBoneAnglesIndex( CGhoul2Info *ghlInfo, const int index, const vec3_t angles, const int flags, const Eorientations yaw, const Eorientations pitch, const Eorientations roll, qhandle_t *modelList, int blendTime, int currentTime );
327 qboolean	G2API_SetBoneAnglesMatrixIndex(CGhoul2Info *ghlInfo, const int index, const mdxaBone_t &matrix, const int flags, qhandle_t *modelList, int blendTime, int currentTime);
328 qboolean	G2API_DoesBoneExist(CGhoul2Info_v& ghoul2, int modelIndex, const char *boneName);
329 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);
330 qboolean	G2API_SaveGhoul2Models(CGhoul2Info_v &ghoul2, char **buffer, int *size);
331 void		G2API_LoadGhoul2Models(CGhoul2Info_v &ghoul2, char *buffer);
332 void		G2API_LoadSaveCodeDestructGhoul2Info(CGhoul2Info_v &ghoul2);
333 void		G2API_FreeSaveBuffer(char *buffer);
334 char		*G2API_GetAnimFileNameIndex(qhandle_t modelIndex);
335 int			G2API_GetSurfaceRenderStatus(CGhoul2Info_v& ghoul2, int modelIndex, const char *surfaceName);
336 void		G2API_CopySpecificG2Model(CGhoul2Info_v &ghoul2From, int modelFrom, CGhoul2Info_v &ghoul2To, int modelTo);
337 void		G2API_DuplicateGhoul2Instance(CGhoul2Info_v &g2From, CGhoul2Info_v **g2To);
338 void		G2API_SetBoltInfo(CGhoul2Info_v &ghoul2, int modelIndex, int boltInfo);
339 
340 class CRagDollUpdateParams;
341 class CRagDollParams;
342 
343 void		G2API_AbsurdSmoothing(CGhoul2Info_v &ghoul2, qboolean status);
344 
345 void		G2API_SetRagDoll(CGhoul2Info_v &ghoul2,CRagDollParams *parms);
346 void		G2API_ResetRagDoll(CGhoul2Info_v &ghoul2);
347 void		G2API_AnimateG2ModelsRag(CGhoul2Info_v &ghoul2, int AcurrentTime,CRagDollUpdateParams *params);
348 
349 qboolean	G2API_RagPCJConstraint(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t min, vec3_t max);
350 qboolean	G2API_RagPCJGradientSpeed(CGhoul2Info_v &ghoul2, const char *boneName, const float speed);
351 qboolean	G2API_RagEffectorGoal(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t pos);
352 qboolean	G2API_GetRagBonePos(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale);
353 qboolean	G2API_RagEffectorKick(CGhoul2Info_v &ghoul2, const char *boneName, vec3_t velocity);
354 qboolean	G2API_RagForceSolve(CGhoul2Info_v &ghoul2, qboolean force);
355 
356 qboolean	G2API_SetBoneIKState(CGhoul2Info_v &ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params);
357 qboolean	G2API_IKMove(CGhoul2Info_v &ghoul2, int time, sharedIKMoveParams_t *params);
358 
359 void		G2API_AttachInstanceToEntNum(CGhoul2Info_v &ghoul2, int entityNum, qboolean server);
360 void		G2API_ClearAttachedInstance(int entityNum);
361 void		G2API_CleanEntAttachments(void);
362 qboolean	G2API_OverrideServerWithClientData(CGhoul2Info_v& ghoul2, int modelIndex);
363 
364 extern qboolean gG2_GBMNoReconstruct;
365 extern qboolean gG2_GBMUseSPMethod;
366 // From tr_ghoul2.cpp
367 void		G2_ConstructGhoulSkeleton( CGhoul2Info_v &ghoul2,const int frameNum,bool checkForNewOrigin,const vec3_t scale);
368 
369 qboolean	G2API_SkinlessModel(CGhoul2Info_v& ghoul2, int modelIndex);
370 
371 #ifdef _G2_GORE
372 int			G2API_GetNumGoreMarks(CGhoul2Info_v& ghoul2, int modelIndex);
373 void		G2API_AddSkinGore(CGhoul2Info_v &ghoul2,SSkinGoreData &gore);
374 void		G2API_ClearSkinGore ( CGhoul2Info_v &ghoul2 );
375 #endif // _SOF2
376 
377 int			G2API_Ghoul2Size ( CGhoul2Info_v &ghoul2 );
378 void		RemoveBoneCache( CBoneCache *boneCache );
379 
380 const char	*G2API_GetModelName ( CGhoul2Info_v& ghoul2, int modelIndex );
381