| 1365 | |
| 1366 | extern int NPC_WeaponsForTeam( team_t team, int spawnflags, const char *NPC_type ); |
| 1367 | void NPC_PrecacheWeapons( team_t playerTeam, int spawnflags, char *NPCtype ) |
| 1368 | { |
| 1369 | int weapons = NPC_WeaponsForTeam( playerTeam, spawnflags, NPCtype ); |
| 1370 | gitem_t *item; |
| 1371 | for ( int curWeap = WP_SABER; curWeap < WP_NUM_WEAPONS; curWeap++ ) |
| 1372 | { |
| 1373 | if ( (weapons & ( 1 << curWeap )) ) |
| 1374 | { |
| 1375 | item = FindItemForWeapon( ((weapon_t)(curWeap)) ); //precache the weapon |
| 1376 | CG_RegisterItemSounds( (item-bg_itemlist) ); |
| 1377 | CG_RegisterItemVisuals( (item-bg_itemlist) ); |
| 1378 | //precache the in-hand/in-world ghoul2 weapon model |
| 1379 | |
| 1380 | char weaponModel[64]; |
| 1381 | |
| 1382 | strcpy (weaponModel, weaponData[curWeap].weaponMdl); |
| 1383 | if (char *spot = strstr(weaponModel, ".md3") ) { |
| 1384 | *spot = 0; |
| 1385 | spot = strstr(weaponModel, "_w");//i'm using the in view weapon array instead of scanning the item list, so put the _w back on |
| 1386 | if (!spot) { |
| 1387 | strcat (weaponModel, "_w"); |
| 1388 | } |
| 1389 | strcat (weaponModel, ".glm"); //and change to ghoul2 |
| 1390 | } |
| 1391 | gi.G2API_PrecacheGhoul2Model( weaponModel ); // correct way is item->world_model |
| 1392 | } |
| 1393 | } |
| 1394 | } |
| 1395 | |
| 1396 | /* |
| 1397 | void NPC_PrecacheByClassName ( char *NPCName ) |
no test coverage detected