| 1198 | |
| 1199 | extern cvar_t *g_char_model; |
| 1200 | void G_LoadAnimFileSet( gentity_t *ent, const char *pModelName ) |
| 1201 | { |
| 1202 | //load its animation config |
| 1203 | char animName[MAX_QPATH]; |
| 1204 | char *GLAName, *modelName; |
| 1205 | char *slash = NULL; |
| 1206 | char *strippedName; |
| 1207 | |
| 1208 | if ( ent->playerModel == -1 ) |
| 1209 | { |
| 1210 | return; |
| 1211 | } |
| 1212 | if ( Q_stricmp( "player", pModelName ) == 0 ) |
| 1213 | {//model is actually stored on console |
| 1214 | modelName = g_char_model->string; |
| 1215 | } |
| 1216 | else |
| 1217 | { |
| 1218 | modelName = (char *)pModelName; |
| 1219 | } |
| 1220 | //get the location of the animation.cfg |
| 1221 | GLAName = gi.G2API_GetGLAName( &ent->ghoul2[ent->playerModel] ); |
| 1222 | //now load and parse the animation.cfg, animevents.cfg and set the animFileIndex |
| 1223 | if ( !GLAName) |
| 1224 | { |
| 1225 | Com_Printf( S_COLOR_RED"Failed find animation file name models/players/%s\n", modelName ); |
| 1226 | strippedName="_humanoid"; //take a guess, maybe it's right? |
| 1227 | } |
| 1228 | else |
| 1229 | { |
| 1230 | Q_strncpyz( animName, GLAName, sizeof( animName ) ); |
| 1231 | slash = strrchr( animName, '/' ); |
| 1232 | if ( slash ) |
| 1233 | { |
| 1234 | *slash = 0; |
| 1235 | } |
| 1236 | strippedName = COM_SkipPath( animName ); |
| 1237 | } |
| 1238 | |
| 1239 | //now load and parse the animation.cfg, animevents.cfg and set the animFileIndex |
| 1240 | ent->client->clientInfo.animFileIndex = G_ParseAnimFileSet(strippedName, modelName); |
| 1241 | |
| 1242 | if (ent->client->clientInfo.animFileIndex<0) |
| 1243 | { |
| 1244 | Com_Printf( S_COLOR_RED"Failed to load animation file set models/players/%s/animation.cfg\n", modelName ); |
| 1245 | #ifndef FINAL_BUILD |
| 1246 | Com_Error(ERR_FATAL, "Failed to load animation file set models/players/%s/animation.cfg\n", modelName); |
| 1247 | #endif |
| 1248 | } |
| 1249 | } |
| 1250 | |
| 1251 | |
| 1252 | void NPC_PrecacheAnimationCFG( const char *NPC_type ) |
no test coverage detected