MCPcopy Create free account
hub / github.com/JACoders/OpenJK / NPC_PrecacheAnimationCFG

Function NPC_PrecacheAnimationCFG

code/game/NPC_stats.cpp:1252–1364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1250
1251
1252void 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 {

Callers 2

SP_misc_atst_drivableFunction · 0.70
SP_NPC_spawnerFunction · 0.70

Calls 11

Q_stricmpFunction · 0.85
COM_EndParseSessionFunction · 0.85
Q_strncpyzFunction · 0.85
G_ParseLiteralFunction · 0.70
G_ParseAnimFileSetFunction · 0.70
COM_BeginParseSessionFunction · 0.50
COM_ParseExtFunction · 0.50
SkipBracedSectionFunction · 0.50
COM_ParseStringFunction · 0.50
vaFunction · 0.50
COM_SkipPathFunction · 0.50

Tested by

no test coverage detected