/* =========== G_SelectTremulousSpawnPoint Chooses a player start, deathmatch start, etc ============ */ gentity_t *G_SelectTremulousSpawnPoint( team_t team, vec3_t preference, vec3_t origin, vec3_t angles ) { gentity_t *spot = NULL; if( team == TEAM_ALIENS ) { if( level.numAlienSpawns <= 0 ) return NULL; spot = G_SelectSpawnBuildable( preference, BA_A_SPAWN ); } else if( team == TEAM_HUMANS ) { if( level.numHumanSpawns <= 0 ) return NULL; spot = G_SelectSpawnBuildable( preference, BA_H_SPAWN ); } //no available spots if( !spot ) return NULL; if( team == TEAM_ALIENS ) G_CheckSpawnPoint( spot->s.number, spot->s.origin, spot->s.origin2, BA_A_SPAWN, origin ); else if( team == TEAM_HUMANS ) G_CheckSpawnPoint( spot->s.number, spot->s.origin, spot->s.origin2, BA_H_SPAWN, origin ); VectorCopy( spot->s.angles, angles ); angles[ ROLL ] = 0; return spot; }
/* =========== G_SelectUnvanquishedSpawnPoint Chooses a player start, deathmatch start, etc ============ */ gentity_t *G_SelectUnvanquishedSpawnPoint( team_t team, vec3_t preference, vec3_t origin, vec3_t angles ) { gentity_t *spot = nullptr; /* team must exist, or there will be a sigsegv */ ASSERT(team == TEAM_HUMANS || team == TEAM_ALIENS); if( level.team[ team ].numSpawns <= 0 ) { return nullptr; } if ( team == TEAM_ALIENS ) { spot = G_SelectSpawnBuildable( preference, BA_A_SPAWN ); } else if ( team == TEAM_HUMANS ) { spot = G_SelectSpawnBuildable( preference, BA_H_SPAWN ); } if ( !spot ) { return nullptr; } // Get spawn point for selected spawner. Entity* blocker = nullptr; Vec3 spawnPoint; spot->entity->CheckSpawnPoint(blocker, spawnPoint); spawnPoint.Store(origin); VectorCopy( spot->s.angles, angles ); angles[ ROLL ] = 0; return spot; }