mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- The complete FMapThing is overkill for storing player starts, so use a new minimal structure for them.
SVN r3750 (trunk)
This commit is contained in:
parent
71601f91d1
commit
0c8e4c37d9
8 changed files with 40 additions and 27 deletions
|
@ -400,12 +400,25 @@ enum EMapThingFlags
|
||||||
STF_ALTSHADOW = 0x0200,
|
STF_ALTSHADOW = 0x0200,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A simplified mapthing for player starts
|
||||||
|
struct FPlayerStart
|
||||||
|
{
|
||||||
|
fixed_t x, y, z;
|
||||||
|
short angle, type;
|
||||||
|
|
||||||
|
FPlayerStart() { }
|
||||||
|
FPlayerStart(const FMapThing *mthing)
|
||||||
|
: x(mthing->x), y(mthing->y), z(mthing->z),
|
||||||
|
angle(mthing->angle),
|
||||||
|
type(mthing->type)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
// Player spawn spots for deathmatch.
|
// Player spawn spots for deathmatch.
|
||||||
extern TArray<FMapThing> deathmatchstarts;
|
extern TArray<FPlayerStart> deathmatchstarts;
|
||||||
|
|
||||||
// Player spawn spots.
|
// Player spawn spots.
|
||||||
extern FMapThing playerstarts[MAXPLAYERS];
|
extern FPlayerStart playerstarts[MAXPLAYERS];
|
||||||
extern TArray<FMapThing> AllPlayerStarts;
|
extern TArray<FPlayerStart> AllPlayerStarts;
|
||||||
|
|
||||||
|
|
||||||
#endif // __DOOMDATA__
|
#endif // __DOOMDATA__
|
||||||
|
|
|
@ -1375,7 +1375,7 @@ void G_PlayerReborn (int player)
|
||||||
// because something is occupying it
|
// because something is occupying it
|
||||||
//
|
//
|
||||||
|
|
||||||
bool G_CheckSpot (int playernum, FMapThing *mthing)
|
bool G_CheckSpot (int playernum, FPlayerStart *mthing)
|
||||||
{
|
{
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
fixed_t y;
|
fixed_t y;
|
||||||
|
@ -1424,7 +1424,7 @@ bool G_CheckSpot (int playernum, FMapThing *mthing)
|
||||||
//
|
//
|
||||||
|
|
||||||
// [RH] Returns the distance of the closest player to the given mapthing
|
// [RH] Returns the distance of the closest player to the given mapthing
|
||||||
static fixed_t PlayersRangeFromSpot (FMapThing *spot)
|
static fixed_t PlayersRangeFromSpot (FPlayerStart *spot)
|
||||||
{
|
{
|
||||||
fixed_t closest = INT_MAX;
|
fixed_t closest = INT_MAX;
|
||||||
fixed_t distance;
|
fixed_t distance;
|
||||||
|
@ -1446,10 +1446,10 @@ static fixed_t PlayersRangeFromSpot (FMapThing *spot)
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] Select the deathmatch spawn spot farthest from everyone.
|
// [RH] Select the deathmatch spawn spot farthest from everyone.
|
||||||
static FMapThing *SelectFarthestDeathmatchSpot (size_t selections)
|
static FPlayerStart *SelectFarthestDeathmatchSpot (size_t selections)
|
||||||
{
|
{
|
||||||
fixed_t bestdistance = 0;
|
fixed_t bestdistance = 0;
|
||||||
FMapThing *bestspot = NULL;
|
FPlayerStart *bestspot = NULL;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < selections; i++)
|
for (i = 0; i < selections; i++)
|
||||||
|
@ -1467,7 +1467,7 @@ static FMapThing *SelectFarthestDeathmatchSpot (size_t selections)
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] Select a deathmatch spawn spot at random (original mechanism)
|
// [RH] Select a deathmatch spawn spot at random (original mechanism)
|
||||||
static FMapThing *SelectRandomDeathmatchSpot (int playernum, unsigned int selections)
|
static FPlayerStart *SelectRandomDeathmatchSpot (int playernum, unsigned int selections)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
|
@ -1487,7 +1487,7 @@ static FMapThing *SelectRandomDeathmatchSpot (int playernum, unsigned int select
|
||||||
void G_DeathMatchSpawnPlayer (int playernum)
|
void G_DeathMatchSpawnPlayer (int playernum)
|
||||||
{
|
{
|
||||||
unsigned int selections;
|
unsigned int selections;
|
||||||
FMapThing *spot;
|
FPlayerStart *spot;
|
||||||
|
|
||||||
selections = deathmatchstarts.Size ();
|
selections = deathmatchstarts.Size ();
|
||||||
// [RH] We can get by with just 1 deathmatch start
|
// [RH] We can get by with just 1 deathmatch start
|
||||||
|
@ -1528,13 +1528,13 @@ void G_DeathMatchSpawnPlayer (int playernum)
|
||||||
//
|
//
|
||||||
// G_PickPlayerStart
|
// G_PickPlayerStart
|
||||||
//
|
//
|
||||||
FMapThing *G_PickPlayerStart(int playernum, int flags)
|
FPlayerStart *G_PickPlayerStart(int playernum, int flags)
|
||||||
{
|
{
|
||||||
if ((level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) || (flags & PPS_FORCERANDOM))
|
if ((level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) || (flags & PPS_FORCERANDOM))
|
||||||
{
|
{
|
||||||
if (!(flags & PPS_NOBLOCKINGCHECK))
|
if (!(flags & PPS_NOBLOCKINGCHECK))
|
||||||
{
|
{
|
||||||
TArray<FMapThing *> good_starts;
|
TArray<FPlayerStart *> good_starts;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
// Find all unblocked player starts.
|
// Find all unblocked player starts.
|
||||||
|
@ -1629,7 +1629,7 @@ void G_DoReborn (int playernum, bool freshbot)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // try to spawn at any random player's spot
|
{ // try to spawn at any random player's spot
|
||||||
FMapThing *start = G_PickPlayerStart(playernum, PPS_FORCERANDOM);
|
FPlayerStart *start = G_PickPlayerStart(playernum, PPS_FORCERANDOM);
|
||||||
AActor *mo = P_SpawnPlayer(start, playernum);
|
AActor *mo = P_SpawnPlayer(start, playernum);
|
||||||
if (mo != NULL) P_PlayerStartStomp(mo);
|
if (mo != NULL) P_PlayerStartStomp(mo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct PNGHandle;
|
||||||
//
|
//
|
||||||
void G_DeathMatchSpawnPlayer (int playernum);
|
void G_DeathMatchSpawnPlayer (int playernum);
|
||||||
|
|
||||||
struct FMapThing *G_PickPlayerStart (int playernum, int flags = 0);
|
struct FPlayerStart *G_PickPlayerStart (int playernum, int flags = 0);
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PPS_FORCERANDOM = 1,
|
PPS_FORCERANDOM = 1,
|
||||||
|
|
|
@ -158,7 +158,7 @@ void P_TeleportToPlayerStarts (AActor *victim)
|
||||||
fixed_t destX,destY;
|
fixed_t destX,destY;
|
||||||
angle_t destAngle;
|
angle_t destAngle;
|
||||||
|
|
||||||
FMapThing *start = G_PickPlayerStart(0, PPS_FORCERANDOM | PPS_NOBLOCKINGCHECK);
|
FPlayerStart *start = G_PickPlayerStart(0, PPS_FORCERANDOM | PPS_NOBLOCKINGCHECK);
|
||||||
destX = start->x;
|
destX = start->x;
|
||||||
destY = start->y;
|
destY = start->y;
|
||||||
destAngle = ANG45 * (start->angle/45);
|
destAngle = ANG45 * (start->angle/45);
|
||||||
|
|
|
@ -38,7 +38,7 @@ bool AArtiTeleport::Use (bool pickup)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FMapThing *start = G_PickPlayerStart(int(Owner->player - players));
|
FPlayerStart *start = G_PickPlayerStart(int(Owner->player - players));
|
||||||
destX = start->x;
|
destX = start->x;
|
||||||
destY = start->y;
|
destY = start->y;
|
||||||
destAngle = ANG45 * (start->angle/45);
|
destAngle = ANG45 * (start->angle/45);
|
||||||
|
|
|
@ -116,9 +116,7 @@ void P_UnPredictPlayer ();
|
||||||
|
|
||||||
extern fixed_t FloatBobOffsets[64];
|
extern fixed_t FloatBobOffsets[64];
|
||||||
|
|
||||||
struct FMapThing;
|
APlayerPawn *P_SpawnPlayer (struct FPlayerStart *mthing, int playernum, 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,7 +4074,7 @@ EXTERN_CVAR (Bool, chasedemo)
|
||||||
|
|
||||||
extern bool demonew;
|
extern bool demonew;
|
||||||
|
|
||||||
APlayerPawn *P_SpawnPlayer (FMapThing *mthing, int playernum, bool tempplayer)
|
APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, bool tempplayer)
|
||||||
{
|
{
|
||||||
player_t *p;
|
player_t *p;
|
||||||
APlayerPawn *mobj, *oldactor;
|
APlayerPawn *mobj, *oldactor;
|
||||||
|
@ -4356,7 +4356,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
// count deathmatch start positions
|
// count deathmatch start positions
|
||||||
if (mthing->type == 11)
|
if (mthing->type == 11)
|
||||||
{
|
{
|
||||||
deathmatchstarts.Push (*mthing);
|
FPlayerStart start(mthing);
|
||||||
|
deathmatchstarts.Push(start);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4480,11 +4481,12 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// save spots for respawning in network games
|
// save spots for respawning in network games
|
||||||
playerstarts[pnum] = *mthing;
|
FPlayerStart start(mthing);
|
||||||
AllPlayerStarts.Push(*mthing);
|
playerstarts[pnum] = start;
|
||||||
|
AllPlayerStarts.Push(start);
|
||||||
if (!deathmatch && !(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS))
|
if (!deathmatch && !(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS))
|
||||||
{
|
{
|
||||||
return P_SpawnPlayer(&playerstarts[pnum], pnum);
|
return P_SpawnPlayer(&start, pnum);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,9 +182,9 @@ BYTE* rejectmatrix;
|
||||||
bool ForceNodeBuild;
|
bool ForceNodeBuild;
|
||||||
|
|
||||||
// Maintain single and multi player starting spots.
|
// Maintain single and multi player starting spots.
|
||||||
TArray<FMapThing> deathmatchstarts (16);
|
TArray<FPlayerStart> deathmatchstarts (16);
|
||||||
FMapThing playerstarts[MAXPLAYERS];
|
FPlayerStart playerstarts[MAXPLAYERS];
|
||||||
TArray<FMapThing> AllPlayerStarts;
|
TArray<FPlayerStart> AllPlayerStarts;
|
||||||
|
|
||||||
static void P_AllocateSideDefs (int count);
|
static void P_AllocateSideDefs (int count);
|
||||||
|
|
||||||
|
@ -3988,7 +3988,7 @@ void P_SetupLevel (char *lumpname, int position)
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
{
|
{
|
||||||
players[i].mo = NULL;
|
players[i].mo = NULL;
|
||||||
FMapThing *mthing = G_PickPlayerStart(i);
|
FPlayerStart *mthing = G_PickPlayerStart(i);
|
||||||
P_SpawnPlayer(mthing, i);
|
P_SpawnPlayer(mthing, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue