// leave this as first line for PCH reasons... // #include "../server/exe_headers.h" #ifndef __Q_SHARED_H #include "../game/q_shared.h" #endif #if !defined(TR_LOCAL_H) #include "../renderer/tr_local.h" #endif #if !defined(G2_H_INC) #include "G2.h" #endif #define G2_MODEL_OK(g) ((g)&&(g)->mValid&&(g)->aHeader&&(g)->currentModel&&(g)->animModel) //===================================================================================================================== // Bolt List handling routines - so entities can attach themselves to any part of the model in question // Given a bone number, see if that bone is already in our bone list int G2_Find_Bolt_Bone_Num(boltInfo_v &bltlist, const int boneNum) { int i; // look through entire list for(i=0; imValid); boltInfo_t tempBolt; int i; assert(surfNum>=0&&surfNum= slist.size()) { return -1; } // look through entire list - see if it's already there first for(i=0; imValid); int i, x, surfNum = -1; mdxaSkel_t *skel; mdxaSkelOffsets_t *offsets; mdxmHierarchyOffsets_t *surfOffsets; boltInfo_t tempBolt; int flags; assert(G2_MODEL_OK(ghlInfo)); surfOffsets = (mdxmHierarchyOffsets_t *)((byte*)ghlInfo->currentModel->mdxm + sizeof(mdxmHeader_t)); // first up, we'll search for that which this bolt names in all the surfaces surfNum = G2_IsSurfaceLegal(ghlInfo->currentModel, boneName, &flags); // did we find it as a surface? if (surfNum != -1) { // look through entire list - see if it's already there first for(i=0; iaHeader + sizeof(mdxaHeader_t)); // walk the entire list of bones in the gla file for this model and see if any match the name of the bone we want to find for (x=0; x< ghlInfo->aHeader->numBones; x++) { skel = (mdxaSkel_t *)((byte *)ghlInfo->aHeader + sizeof(mdxaHeader_t) + offsets->offsets[x]); // if name is the same, we found it if (!Q_stricmp(skel->name, boneName)) { break; } } // check to see we did actually make a match with a bone in the model if (x == ghlInfo->aHeader->numBones) { // didn't find it? Error //assert(0&&x == mod_a->mdxa->numBones); #if _DEBUG G2_Bolt_Not_Found(boneName,ghlInfo->mFileName); #endif return -1; } // look through entire list - see if it's already there first for(i=0; i=0&&index