/* =============== G_CallSpawn Finds the spawn function for the entity and calls it, returning qfalse if not found =============== */ qboolean G_CallSpawn( gentity_t *ent ) { spawn_t *s; buildable_t buildable; if ( !ent->classname ) { G_Printf( "G_CallSpawn: NULL classname\n" ); return qfalse; } //check buildable spawn functions if ( ( buildable = BG_FindBuildNumForEntityName( ent->classname ) ) != BA_NONE ) { if ( buildable == BA_A_SPAWN || buildable == BA_H_SPAWN ) { ent->s.angles[ YAW ] += 180.0f; AngleNormalize360( ent->s.angles[ YAW ] ); } G_SpawnBuildable( ent, buildable ); return qtrue; } // check normal spawn functions for ( s = spawns; s->name; s++ ) { if ( !strcmp( s->name, ent->classname ) ) { // found it s->spawn( ent ); return qtrue; } } G_Printf( "%s doesn't have a spawn function\n", ent->classname ); return qfalse; }
/* =============== G_CallSpawn Finds the spawn function for the entity and calls it, returning qfalse if not found =============== */ qboolean G_CallSpawn(gentity_t *ent) { spawn_t *s; buildable_t buildable; if (!ent->classname) { G_Printf("G_CallSpawn: NULL classname\n"); return qfalse; } //check buildable spawn functions if ((buildable = BG_FindBuildNumForEntityName(ent->classname)) != BA_NONE) { // don't spawn built-in buildings if we are using a custom layout if (level.layout[ 0 ] && Q_stricmp(level.layout, "*BUILTIN*")) return qtrue; if (buildable == BA_A_SPAWN || buildable == BA_H_SPAWN) { ent->s.angles[ YAW ] += 180.0f; AngleNormalize360(ent->s.angles[ YAW ]); } G_SpawnBuildable(ent, buildable, ent->biteam, level.survivalStage); return qtrue; } // check normal spawn functions for (s = spawns; s->name; s++) { if (!strcmp(s->name, ent->classname)) { // found it s->spawn(ent); return qtrue; } } G_Printf("%s doesn't have a spawn function\n", ent->classname); return qfalse; }