//========================================================================== // P_SpawnPlayers // Spawns all players, using the method appropriate for current game mode. // Called during level setup. //========================================================================== void P_SpawnPlayers(void) { int i; // If deathmatch, randomly spawn the active players. if(deathmatch) { for(i = 0; i < MAXPLAYERS; i++) if(players[i].plr->ingame) { players[i].plr->mo = NULL; G_DeathMatchSpawnPlayer(i); } } else { #ifdef __JDOOM__ if(!IS_NETGAME) { mapthing_t *it; // Spawn all unused player starts. This will create 'zombies'. // FIXME: Also in netgames? for(it = playerstarts; it != playerstart_p; it++) if(players[0].startspot != it - playerstarts && it->type == 1) { P_SpawnPlayer(it, 0); } } #endif // Spawn everybody at their assigned places. // Might get messy if there aren't enough starts. for(i = 0; i < MAXPLAYERS; i++) if(players[i].plr->ingame) { ddplayer_t *ddpl = players[i].plr; if(!P_FuzzySpawn (&playerstarts[players[i].startspot], i, false)) { // Gib anything at the spot. P_Telefrag(ddpl->mo); } } } }
int EV_Teleport( line_t *line,mobj_t *thing ) { int i; int tag; boolean flag; mobj_t *m,*fog; unsigned int an; sector_t *sector; fixed_t oldx, oldy, oldz; int side; side = !P_PointOnLineSide (thing->x, thing->y, line); if(thing->flags & MF_MISSILE) return 0; /* don't teleport missiles */ if(side == 1) /* don't teleport if hit back of line, */ return 0; /* so you can get out of teleporter */ tag = line->tag; for(i = 0; i < numsectors; i++) { if (sectors[ i ].tag == tag ) { for(m = mobjhead.next; m != &mobjhead; m = m->next) { // CALICO: skip removed mobjs if(m->latecall == P_RemoveMobjDeferred) continue; if(m->type != MT_TELEPORTMAN) continue; // not a teleportman sector = m->subsector->sector; if(sector-sectors != i ) continue; // wrong sector oldx = thing->x; oldy = thing->y; oldz = thing->z; thing->flags |= MF_TELEPORT; P_Telefrag(thing, m->x, m->y); flag = P_TryMove (thing, m->x, m->y); thing->flags &= ~MF_TELEPORT; if(!flag) return 0; /* move is blocked */ thing->z = thing->floorz; /* spawn teleport fog at source and destination */ fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG); S_StartSound(fog, sfx_telept); an = m->angle >> ANGLETOFINESHIFT; fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an], thing->z, MT_TFOG); S_StartSound(fog, sfx_telept); if(thing->player) thing->reactiontime = 18; /* don't move for a bit */ thing->angle = m->angle; thing->momx = thing->momy = thing->momz = 0; return 1; } } } return 0; }