| 1250 | |
| 1251 | |
| 1252 | void NPC_PrecacheAnimationCFG( const char *NPC_type ) |
| 1253 | { |
| 1254 | char filename[MAX_QPATH]; |
| 1255 | const char *token; |
| 1256 | const char *value; |
| 1257 | const char *p; |
| 1258 | |
| 1259 | if ( !Q_stricmp( "random", NPC_type ) ) |
| 1260 | {//sorry, can't precache a random just yet |
| 1261 | return; |
| 1262 | } |
| 1263 | |
| 1264 | p = NPCParms; |
| 1265 | COM_BeginParseSession(); |
| 1266 | |
| 1267 | // look for the right NPC |
| 1268 | while ( p ) |
| 1269 | { |
| 1270 | token = COM_ParseExt( &p, qtrue ); |
| 1271 | if ( token[0] == 0 ) |
| 1272 | { |
| 1273 | COM_EndParseSession( ); |
| 1274 | return; |
| 1275 | } |
| 1276 | |
| 1277 | if ( !Q_stricmp( token, NPC_type ) ) |
| 1278 | { |
| 1279 | break; |
| 1280 | } |
| 1281 | |
| 1282 | SkipBracedSection( &p ); |
| 1283 | } |
| 1284 | |
| 1285 | if ( !p ) |
| 1286 | { |
| 1287 | COM_EndParseSession( ); |
| 1288 | return; |
| 1289 | } |
| 1290 | |
| 1291 | if ( G_ParseLiteral( &p, "{" ) ) |
| 1292 | { |
| 1293 | COM_EndParseSession( ); |
| 1294 | return; |
| 1295 | } |
| 1296 | |
| 1297 | // parse the NPC info block |
| 1298 | while ( 1 ) |
| 1299 | { |
| 1300 | token = COM_ParseExt( &p, qtrue ); |
| 1301 | if ( !token[0] ) |
| 1302 | { |
| 1303 | gi.Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", NPC_type ); |
| 1304 | COM_EndParseSession( ); |
| 1305 | return; |
| 1306 | } |
| 1307 | |
| 1308 | if ( !Q_stricmp( token, "}" ) ) |
| 1309 | { |
no test coverage detected