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

Function SP_NPC_spawner

codeJK2/game/NPC_spawn.cpp:1562–1639  ·  view source on GitHub ↗

the G_Spawn*() functions are valid (only turned on during one function)

Source from the content-addressed store, hash-verified

1560//void NPC_PrecacheModels ( char *NPCName );
1561extern qboolean spawning; // the G_Spawn*() functions are valid (only turned on during one function)
1562void 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?

Callers 15

SP_NPC_KyleFunction · 0.70
SP_NPC_LandoFunction · 0.70
SP_NPC_JanFunction · 0.70
SP_NPC_LukeFunction · 0.70
SP_NPC_MonMothmaFunction · 0.70
SP_NPC_TavionFunction · 0.70
SP_NPC_ReeloFunction · 0.70
SP_NPC_GalakFunction · 0.70
SP_NPC_DesannFunction · 0.70
SP_NPC_BartenderFunction · 0.70
SP_NPC_MorganKatarnFunction · 0.70
SP_NPC_JediFunction · 0.70

Calls 3

G_SpawnIntFunction · 0.70
NPC_PrecacheAnimationCFGFunction · 0.70
NPC_SpawnFunction · 0.70

Tested by

no test coverage detected