// // [Toke - CTF] CTF_SelectTeamPlaySpot // Randomly selects a team spawn point // mapthing2_t *CTF_SelectTeamPlaySpot (player_t &player, int selections) { int i, j; for (j = 0; j < MaxBlueTeamStarts; j++) { i = M_Random () % selections; if (player.userinfo.team == TEAM_BLUE) { if (G_CheckSpot (player, &blueteamstarts[i]) ) { return &blueteamstarts[i]; } } if (player.userinfo.team == TEAM_RED) { if (G_CheckSpot (player, &redteamstarts[i]) ) { return &redteamstarts[i]; } } if (player.userinfo.team == TEAM_GOLD) { if (G_CheckSpot (player, &goldteamstarts[i]) ) { return &goldteamstarts[i]; } } } return &blueteamstarts[0]; }
// // [Toke - CTF] CTF_SelectTeamPlaySpot // Randomly selects a team spawn point // mapthing2_t *CTF_SelectTeamPlaySpot (player_t &player, int selections) { switch (player.userinfo.team) { case TEAM_BLUE: { if (sv_gametype != GM_CTF && sv_teamsinplay < 1) break; for (size_t j = 0; j < MaxBlueTeamStarts; ++j) { size_t i = M_Random () % selections; if (G_CheckSpot (player, &blueteamstarts[i]) ) { return &blueteamstarts[i]; } } } break; case TEAM_RED: { if (sv_gametype != GM_CTF && sv_teamsinplay < 2) break; for (size_t j = 0; j < MaxRedTeamStarts; ++j) { size_t i = M_Random () % selections; if (G_CheckSpot (player, &redteamstarts[i]) ) { return &redteamstarts[i]; } } } break; default: { } break; } if (sv_gametype == GM_CTF) { if (MaxBlueTeamStarts) return &blueteamstarts[0]; else if (MaxRedTeamStarts) return &redteamstarts[0]; } else { if (sv_teamsinplay >= 1 && MaxBlueTeamStarts) return &blueteamstarts[0]; else if (sv_teamsinplay >= 2 && MaxRedTeamStarts) return &redteamstarts[0]; } return NULL; }
void G_DoReborn (int playernum) { int i; if (!netgame) { gameaction = ga_died; /* reload the level from scratch */ return; } /* */ /* respawn this player while the other players keep going */ /* */ players[playernum].mo->player = NULL; /* dissasociate the corpse */ /* spawn at random spot if in death match */ if (netgame == gt_deathmatch) { G_DeathMatchSpawnPlayer (playernum); return; } if (G_CheckSpot (playernum, &playerstarts[playernum]) ) { P_SpawnPlayer (&playerstarts[playernum]); return; } /* try to spawn at one of the other players spots */ for (i=0 ; i<MAXPLAYERS ; i++) if (G_CheckSpot (playernum, &playerstarts[i]) ) { playerstarts[i].type = playernum+1; /* fake as other player */ P_SpawnPlayer (&playerstarts[i]); playerstarts[i].type = i+1; /* restore */ return; } /* he's going to be inside something. Too bad. */ P_SpawnPlayer (&playerstarts[playernum]); }
void G_DoReborn(int playernum) { int i; // quit demo unless -demoextend if (!demoextend && G_CheckDemoStatus()) return; if (!netgame) gameaction = ga_loadlevel; // reload the level from scratch else { // respawn at the start players[playernum].mo->player = NULL; // dissasociate the corpse // spawn at random spot if in death match if (deathmatch) { G_DeathMatchSpawnPlayer(playernum); return; } if (G_CheckSpot(playernum, &playerstarts[playernum])) { P_SpawnPlayer(&playerstarts[playernum]); return; } // try to spawn at one of the other players spots for (i = 0; i < MAXPLAYERS; i++) if (G_CheckSpot(playernum, &playerstarts[i])) { playerstarts[i].type = playernum + 1; // fake as other player P_SpawnPlayer(&playerstarts[i]); playerstarts[i].type = i + 1; // restore return; } // he's going to be inside something. Too bad. P_SpawnPlayer(&playerstarts[playernum]); } }
void G_DoReborn(int playernum) { if(!netgame) { gameaction = ga_loadlevel; // reload the level from scratch } else { // respawn at the start int i; // first dissasociate the corpse if(players[playernum].mo == NULL) { I_Error("G_DoReborn: Player start #%i not found!", playernum+1); } players[playernum].mo->player = NULL; // spawn at random spot if in death match if(deathmatch) { G_DeathMatchSpawnPlayer(playernum); return; } if(G_CheckSpot(playernum, &playerstarts[playernum])) { P_SpawnPlayer(&playerstarts[playernum]); return; } // try to spawn at one of the other players spots for(i = 0; i < MAXPLAYERS; i++) { if(G_CheckSpot(playernum, &playerstarts[i])) { playerstarts[i].type = playernum+1; // fake as other player P_SpawnPlayer(&playerstarts[i]); playerstarts[i].type = i+1; // restore return; } // he's going to be inside something. Too bad. } P_SpawnPlayer(&playerstarts[playernum]); } }
void G_DeathMatchSpawnPlayer(int playernum) { int i, j; int selections; selections = deathmatch_p - deathmatchstarts; if(selections < 4) { I_Error("G_DeathMatchSpawnPlayer: Only %i deathmatch spots, 4 required", selections); } for(j = 0; j < 20; j++) { i = P_Random(pr_dmspawn) % selections; if(G_CheckSpot(playernum, &deathmatchstarts[i])) { deathmatchstarts[i].type = playernum+1; P_SpawnPlayer(&deathmatchstarts[i]); return; } } // no good spot, so the player will probably get stuck P_SpawnPlayer(&playerstarts[playernum]); }
// // [Toke - CTF] CTF_SelectTeamPlaySpot // Randomly selects a team spawn point // mapthing2_t *CTF_SelectTeamPlaySpot (player_t &player, int selections) { switch (player.userinfo.team) { case TEAM_BLUE: { if (!blueteam) break; for (int j = 0; j < MaxBlueTeamStarts; ++j) { size_t i = M_Random () % selections; if (G_CheckSpot (player, &blueteamstarts[i]) ) { return &blueteamstarts[i]; } } } break; case TEAM_RED: { if (!redteam) break; for (size_t j = 0; j < MaxRedTeamStarts; ++j) { size_t i = M_Random () % selections; if (G_CheckSpot (player, &redteamstarts[i]) ) { return &redteamstarts[i]; } } } break; case TEAM_GOLD: { if (!goldteam) break; for (size_t j = 0; j < MaxGoldTeamStarts; ++j) { size_t i = M_Random () % selections; if (G_CheckSpot (player, &goldteamstarts[i]) ) { return &goldteamstarts[i]; } } } break; default: { } break; } if (blueteam && MaxBlueTeamStarts) return &blueteamstarts[0]; else if (redteam && MaxRedTeamStarts) return &redteamstarts[0]; else if (goldteam && MaxGoldTeamStarts) return &goldteamstarts[0]; return NULL; }