// // G_DoReborn // private void G_DoReborn(int playernum) { if (!options.NetGame) { // reload the level from scratch gameAction = GameAction.LoadLevel; } else { // respawn at the start // first dissasociate the corpse players[playernum].Mobj.Player = null; // spawn at random spot if in death match if (options.Deathmatch != 0) { world.G_DeathMatchSpawnPlayer(playernum); return; } if (world.G_CheckSpot(playernum, world.PlayerStarts[playernum])) { world.ThingAllocation.SpawnPlayer(world.PlayerStarts[playernum]); return; } // try to spawn at one of the other players spots for (var i = 0; i < Player.MaxPlayerCount; i++) { if (world.G_CheckSpot(playernum, world.PlayerStarts[i])) { // fake as other player world.PlayerStarts[i].Type = playernum + 1; world.ThingAllocation.SpawnPlayer(world.PlayerStarts[i]); // restore world.PlayerStarts[i].Type = i + 1; return; } // he's going to be inside something. Too bad. } world.ThingAllocation.SpawnPlayer(world.PlayerStarts[playernum]); } }