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

Function CG_NPC_Precache

code/game/NPC_stats.cpp:1578–1924  ·  view source on GitHub ↗

void NPC_Precache ( char *NPCName ) Precaches NPC skins, tgas and md3s. */

Source from the content-addressed store, hash-verified

1576
1577*/
1578void CG_NPC_Precache ( gentity_t *spawner )
1579{
1580 clientInfo_t ci={};
1581 renderInfo_t ri={};
1582 team_t playerTeam = TEAM_FREE;
1583 const char *token;
1584 const char *value;
1585 const char *p;
1586 char *patch;
1587 char sound[MAX_QPATH];
1588 qboolean md3Model = qfalse;
1589 char playerModel[MAX_QPATH] = { 0 };
1590 char customSkin[MAX_QPATH];
1591
1592 if ( !Q_stricmp( "random", spawner->NPC_type ) )
1593 {//sorry, can't precache a random just yet
1594 return;
1595 }
1596
1597 strcpy(customSkin,"default");
1598
1599 p = NPCParms;
1600 COM_BeginParseSession();
1601
1602 // look for the right NPC
1603 while ( p )
1604 {
1605 token = COM_ParseExt( &p, qtrue );
1606 if ( token[0] == 0 )
1607 {
1608 COM_EndParseSession( );
1609 return;
1610 }
1611
1612 if ( !Q_stricmp( token, spawner->NPC_type ) )
1613 {
1614 break;
1615 }
1616
1617 SkipBracedSection( &p );
1618 }
1619
1620 if ( !p )
1621 {
1622 COM_EndParseSession( );
1623 return;
1624 }
1625
1626 if ( G_ParseLiteral( &p, "{" ) )
1627 {
1628 COM_EndParseSession( );
1629 return;
1630 }
1631
1632 // parse the NPC info block
1633 while ( 1 )
1634 {
1635 COM_EndParseSession(); // if still in session (or using continue;)

Callers 1

CG_RegisterGraphicsFunction · 0.85

Calls 15

Q_stricmpFunction · 0.85
COM_EndParseSessionFunction · 0.85
Q_strncpyzFunction · 0.85
NPC_PrecacheByClassNameFunction · 0.85
G_ParseLiteralFunction · 0.70
G_NewStringFunction · 0.70
RegisterItemFunction · 0.70
FindItemForWeaponFunction · 0.70
WP_SaberParseParmsFunction · 0.70
G_ModelIndexFunction · 0.70
G_SkinIndexFunction · 0.70
NPC_PrecacheWeaponsFunction · 0.70

Tested by

no test coverage detected