- Changed all thing coordinates that were stored as shorts into fixed_t.

- Separated mapthing2_t into mapthinghexen_t and the internal FMapThing so
  that it is easier to add new features in the UDMF map format.
- Added some initial code to read UDMF maps.


SVN r956 (trunk)
This commit is contained in:
Christoph Oelckers 2008-05-08 08:06:26 +00:00
commit d5563fe478
19 changed files with 340 additions and 170 deletions

View file

@ -1236,20 +1236,20 @@ void G_PlayerReborn (int player)
//
// G_CheckSpot
// Returns false if the player cannot be respawned
// at the given mapthing2_t spot
// at the given mapthing spot
// because something is occupying it
//
bool G_CheckSpot (int playernum, mapthing2_t *mthing)
bool G_CheckSpot (int playernum, FMapThing *mthing)
{
fixed_t x;
fixed_t y;
fixed_t z, oldz;
int i;
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
z = mthing->z << FRACBITS;
x = mthing->x;
y = mthing->y;
z = mthing->z;
z += P_PointInSector (x, y)->floorplane.ZatPoint (x, y);
@ -1288,8 +1288,8 @@ bool G_CheckSpot (int playernum, mapthing2_t *mthing)
// called at level load and each death
//
// [RH] Returns the distance of the closest player to the given mapthing2_t.
static fixed_t PlayersRangeFromSpot (mapthing2_t *spot)
// [RH] Returns the distance of the closest player to the given mapthing
static fixed_t PlayersRangeFromSpot (FMapThing *spot)
{
fixed_t closest = INT_MAX;
fixed_t distance;
@ -1300,8 +1300,8 @@ static fixed_t PlayersRangeFromSpot (mapthing2_t *spot)
if (!playeringame[i] || !players[i].mo || players[i].health <= 0)
continue;
distance = P_AproxDistance (players[i].mo->x - spot->x * FRACUNIT,
players[i].mo->y - spot->y * FRACUNIT);
distance = P_AproxDistance (players[i].mo->x - spot->x,
players[i].mo->y - spot->y);
if (distance < closest)
closest = distance;
@ -1311,10 +1311,10 @@ static fixed_t PlayersRangeFromSpot (mapthing2_t *spot)
}
// [RH] Select the deathmatch spawn spot farthest from everyone.
static mapthing2_t *SelectFarthestDeathmatchSpot (size_t selections)
static FMapThing *SelectFarthestDeathmatchSpot (size_t selections)
{
fixed_t bestdistance = 0;
mapthing2_t *bestspot = NULL;
FMapThing *bestspot = NULL;
unsigned int i;
for (i = 0; i < selections; i++)
@ -1332,7 +1332,7 @@ static mapthing2_t *SelectFarthestDeathmatchSpot (size_t selections)
}
// [RH] Select a deathmatch spawn spot at random (original mechanism)
static mapthing2_t *SelectRandomDeathmatchSpot (int playernum, unsigned int selections)
static FMapThing *SelectRandomDeathmatchSpot (int playernum, unsigned int selections)
{
unsigned int i, j;
@ -1352,7 +1352,7 @@ static mapthing2_t *SelectRandomDeathmatchSpot (int playernum, unsigned int sele
void G_DeathMatchSpawnPlayer (int playernum)
{
unsigned int selections;
mapthing2_t *spot;
FMapThing *spot;
selections = deathmatchstarts.Size ();
// [RH] We can get by with just 1 deathmatch start