mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- Pass playernum as a parameter to P_SpawnPlayer(). Now P_SpawnMapThing() is the only thing
that uses the MapThing's type to determine the which player is spawning. SVN r3748 (trunk)
This commit is contained in:
parent
fd784b05c2
commit
390fd5dd6c
5 changed files with 10 additions and 42 deletions
|
@ -1521,12 +1521,7 @@ void G_DeathMatchSpawnPlayer (int playernum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playernum < 4)
|
AActor *mo = P_SpawnPlayer(spot, playernum);
|
||||||
spot->type = playernum+1;
|
|
||||||
else
|
|
||||||
spot->type = playernum + gameinfo.player5start - 4;
|
|
||||||
|
|
||||||
AActor *mo = P_SpawnPlayer (spot);
|
|
||||||
if (mo != NULL) P_PlayerStartStomp(mo);
|
if (mo != NULL) P_PlayerStartStomp(mo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1599,7 +1594,7 @@ void G_DoReborn (int playernum, bool freshbot)
|
||||||
|
|
||||||
if (G_CheckSpot (playernum, &playerstarts[playernum]) )
|
if (G_CheckSpot (playernum, &playerstarts[playernum]) )
|
||||||
{
|
{
|
||||||
AActor *mo = P_SpawnPlayer (&playerstarts[playernum]);
|
AActor *mo = P_SpawnPlayer(&playerstarts[playernum], playernum);
|
||||||
if (mo != NULL) P_PlayerStartStomp(mo);
|
if (mo != NULL) P_PlayerStartStomp(mo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1609,27 +1604,13 @@ void G_DoReborn (int playernum, bool freshbot)
|
||||||
{
|
{
|
||||||
if (G_CheckSpot (playernum, &playerstarts[i]) )
|
if (G_CheckSpot (playernum, &playerstarts[i]) )
|
||||||
{
|
{
|
||||||
int oldtype = playerstarts[i].type;
|
AActor *mo = P_SpawnPlayer(&playerstarts[i], playernum);
|
||||||
|
|
||||||
// fake as other player
|
|
||||||
// [RH] These numbers should be common across all games. Or better yet, not
|
|
||||||
// used at all outside P_SpawnMapThing().
|
|
||||||
if (playernum < 4)
|
|
||||||
{
|
|
||||||
playerstarts[i].type = playernum + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
playerstarts[i].type = playernum + gameinfo.player5start - 4;
|
|
||||||
}
|
|
||||||
AActor *mo = P_SpawnPlayer (&playerstarts[i]);
|
|
||||||
if (mo != NULL) P_PlayerStartStomp(mo);
|
if (mo != NULL) P_PlayerStartStomp(mo);
|
||||||
playerstarts[i].type = oldtype; // restore
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// he's going to be inside something. Too bad.
|
// he's going to be inside something. Too bad.
|
||||||
}
|
}
|
||||||
AActor *mo = P_SpawnPlayer (&playerstarts[playernum]);
|
AActor *mo = P_SpawnPlayer(&playerstarts[playernum], playernum);
|
||||||
if (mo != NULL) P_PlayerStartStomp(mo);
|
if (mo != NULL) P_PlayerStartStomp(mo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1121,7 +1121,7 @@ void G_FinishTravel ()
|
||||||
|
|
||||||
// The player being spawned here is a short lived dummy and
|
// The player being spawned here is a short lived dummy and
|
||||||
// must not start any ENTER script or big problems will happen.
|
// must not start any ENTER script or big problems will happen.
|
||||||
pawndup = P_SpawnPlayer (&playerstarts[pawn->player - players], true);
|
pawndup = P_SpawnPlayer (&playerstarts[pawn->player - players], pawn->player - players, true);
|
||||||
if (!(changeflags & CHANGELEVEL_KEEPFACING))
|
if (!(changeflags & CHANGELEVEL_KEEPFACING))
|
||||||
{
|
{
|
||||||
pawn->angle = pawndup->angle;
|
pawn->angle = pawndup->angle;
|
||||||
|
|
|
@ -118,7 +118,7 @@ extern fixed_t FloatBobOffsets[64];
|
||||||
|
|
||||||
struct FMapThing;
|
struct FMapThing;
|
||||||
|
|
||||||
APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer=false);
|
APlayerPawn *P_SpawnPlayer (FMapThing *mthing, int playernum, bool tempplayer=false);
|
||||||
|
|
||||||
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
|
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
|
||||||
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta);
|
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta);
|
||||||
|
|
|
@ -4074,29 +4074,16 @@ EXTERN_CVAR (Bool, chasedemo)
|
||||||
|
|
||||||
extern bool demonew;
|
extern bool demonew;
|
||||||
|
|
||||||
APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer)
|
APlayerPawn *P_SpawnPlayer (FMapThing *mthing, int playernum, bool tempplayer)
|
||||||
{
|
{
|
||||||
int playernum;
|
|
||||||
player_t *p;
|
player_t *p;
|
||||||
APlayerPawn *mobj, *oldactor;
|
APlayerPawn *mobj, *oldactor;
|
||||||
BYTE state;
|
BYTE state;
|
||||||
fixed_t spawn_x, spawn_y, spawn_z;
|
fixed_t spawn_x, spawn_y, spawn_z;
|
||||||
angle_t spawn_angle;
|
angle_t spawn_angle;
|
||||||
|
|
||||||
// [RH] Things 4001-? are also multiplayer starts. Just like 1-4.
|
|
||||||
// To make things simpler, figure out which player is being
|
|
||||||
// spawned here.
|
|
||||||
if (mthing->type <= 4)
|
|
||||||
{
|
|
||||||
playernum = mthing->type - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
playernum = mthing->type - gameinfo.player5start + 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// not playing?
|
// not playing?
|
||||||
if (playernum >= MAXPLAYERS || !playeringame[playernum])
|
if ((unsigned)playernum >= (unsigned)MAXPLAYERS || !playeringame[playernum])
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p = &players[playernum];
|
p = &players[playernum];
|
||||||
|
@ -4495,7 +4482,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
// save spots for respawning in network games
|
// save spots for respawning in network games
|
||||||
playerstarts[pnum] = *mthing;
|
playerstarts[pnum] = *mthing;
|
||||||
if (!deathmatch)
|
if (!deathmatch)
|
||||||
return P_SpawnPlayer (mthing);
|
return P_SpawnPlayer(&playerstarts[pnum], pnum);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,7 +310,7 @@ static void SpawnExtraPlayers ()
|
||||||
if (playeringame[i] && players[i].mo == NULL)
|
if (playeringame[i] && players[i].mo == NULL)
|
||||||
{
|
{
|
||||||
players[i].playerstate = PST_ENTER;
|
players[i].playerstate = PST_ENTER;
|
||||||
P_SpawnPlayer (&playerstarts[i]);
|
P_SpawnPlayer(&playerstarts[i], i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue