the G_Spawn*() functions are valid (only turned on during one function)
| 1560 | //void NPC_PrecacheModels ( char *NPCName ); |
| 1561 | extern qboolean spawning; // the G_Spawn*() functions are valid (only turned on during one function) |
| 1562 | void SP_NPC_spawner( gentity_t *self) |
| 1563 | { |
| 1564 | extern void NPC_PrecacheAnimationCFG( const char *NPC_type ); |
| 1565 | |
| 1566 | if ( !self->fullName || !self->fullName[0] ) |
| 1567 | { |
| 1568 | //FIXME: make an index into an external string table for localization |
| 1569 | self->fullName = "Humanoid Lifeform"; |
| 1570 | } |
| 1571 | |
| 1572 | //register/precache the models needed for this NPC, not anymore |
| 1573 | //self->classname = "NPC_spawner"; |
| 1574 | |
| 1575 | if(!self->count) |
| 1576 | { |
| 1577 | self->count = 1; |
| 1578 | } |
| 1579 | |
| 1580 | {//Stop loading of certain extra sounds |
| 1581 | static int garbage; |
| 1582 | |
| 1583 | if ( G_SpawnInt( "noBasicSounds", "0", &garbage ) ) |
| 1584 | { |
| 1585 | self->svFlags |= SVF_NO_BASIC_SOUNDS; |
| 1586 | } |
| 1587 | if ( G_SpawnInt( "noCombatSounds", "0", &garbage ) ) |
| 1588 | { |
| 1589 | self->svFlags |= SVF_NO_COMBAT_SOUNDS; |
| 1590 | } |
| 1591 | if ( G_SpawnInt( "noExtraSounds", "0", &garbage ) ) |
| 1592 | { |
| 1593 | self->svFlags |= SVF_NO_EXTRA_SOUNDS; |
| 1594 | } |
| 1595 | } |
| 1596 | |
| 1597 | if ( !self->wait ) |
| 1598 | { |
| 1599 | self->wait = 500; |
| 1600 | } |
| 1601 | else |
| 1602 | { |
| 1603 | self->wait *= 1000;//1 = 1 msec, 1000 = 1 sec |
| 1604 | } |
| 1605 | |
| 1606 | self->delay *= 1000;//1 = 1 msec, 1000 = 1 sec |
| 1607 | |
| 1608 | if ( self->delay > 0 ) |
| 1609 | { |
| 1610 | self->svFlags |= SVF_NPC_PRECACHE; |
| 1611 | } |
| 1612 | |
| 1613 | //We have to load the animation.cfg now because spawnscripts are going to want to set anims and we need to know their length and if they're valid |
| 1614 | NPC_PrecacheAnimationCFG( self->NPC_type ); |
| 1615 | |
| 1616 | if ( self->targetname ) |
| 1617 | {//Wait for triggering |
| 1618 | self->e_UseFunc = useF_NPC_Spawn; |
| 1619 | self->svFlags |= SVF_NPC_PRECACHE;//FIXME: precache my weapons somehow? |
no test coverage detected