mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-02-03 13:11:04 +00:00
- use the standardized typedefs for sized integers
This commit is contained in:
parent
ef8dfe3744
commit
627098b671
16 changed files with 308 additions and 316 deletions
|
@ -72,7 +72,7 @@ int BoxOnSide (int bx1, int by1, int bx2, int by2,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WORD *FBlockmapBuilder::GetBlockmap (int &size)
|
uint16_t *FBlockmapBuilder::GetBlockmap (int &size)
|
||||||
{
|
{
|
||||||
#ifdef BLOCK_TEST
|
#ifdef BLOCK_TEST
|
||||||
FILE *f = fopen ("blockmap.lmp", "rb");
|
FILE *f = fopen ("blockmap.lmp", "rb");
|
||||||
|
@ -86,10 +86,10 @@ WORD *FBlockmapBuilder::GetBlockmap (int &size)
|
||||||
fread (stuff, 2, fsize/2, f);
|
fread (stuff, 2, fsize/2, f);
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
|
||||||
if ((WORD)stuff[0] != BlockMap[0] ||
|
if ((uint16_t)stuff[0] != BlockMap[0] ||
|
||||||
(WORD)stuff[1] != BlockMap[1] ||
|
(uint16_t)stuff[1] != BlockMap[1] ||
|
||||||
(WORD)stuff[2] != BlockMap[2] ||
|
(uint16_t)stuff[2] != BlockMap[2] ||
|
||||||
(WORD)stuff[3] != BlockMap[3])
|
(uint16_t)stuff[3] != BlockMap[3])
|
||||||
{
|
{
|
||||||
printf ("different blockmap sizes\n");
|
printf ("different blockmap sizes\n");
|
||||||
goto notest;
|
goto notest;
|
||||||
|
@ -98,7 +98,7 @@ WORD *FBlockmapBuilder::GetBlockmap (int &size)
|
||||||
|
|
||||||
for (i = 0; i < stuff[2] * stuff[3]; ++i)
|
for (i = 0; i < stuff[2] * stuff[3]; ++i)
|
||||||
{
|
{
|
||||||
WORD i1, i2;
|
uint16_t i1, i2;
|
||||||
i1 = stuff[4+i] + 1;
|
i1 = stuff[4+i] + 1;
|
||||||
while (stuff[i1] != -1)
|
while (stuff[i1] != -1)
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ WORD *FBlockmapBuilder::GetBlockmap (int &size)
|
||||||
i2 = stuff[4+i] + 1;
|
i2 = stuff[4+i] + 1;
|
||||||
while (stuff[i2] != -1)
|
while (stuff[i2] != -1)
|
||||||
{
|
{
|
||||||
if ((WORD)stuff[i2] == BlockMap[i1])
|
if ((uint16_t)stuff[i2] == BlockMap[i1])
|
||||||
break;
|
break;
|
||||||
i2++;
|
i2++;
|
||||||
}
|
}
|
||||||
|
@ -172,11 +172,11 @@ notest:
|
||||||
|
|
||||||
void FBlockmapBuilder::BuildBlockmap ()
|
void FBlockmapBuilder::BuildBlockmap ()
|
||||||
{
|
{
|
||||||
TArray<WORD> *BlockLists, *block, *endblock;
|
TArray<uint16_t> *BlockLists, *block, *endblock;
|
||||||
WORD adder;
|
uint16_t adder;
|
||||||
int bmapwidth, bmapheight;
|
int bmapwidth, bmapheight;
|
||||||
int minx, maxx, miny, maxy;
|
int minx, maxx, miny, maxy;
|
||||||
WORD line;
|
uint16_t line;
|
||||||
|
|
||||||
if (Level.NumVertices <= 0)
|
if (Level.NumVertices <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -203,12 +203,12 @@ void FBlockmapBuilder::BuildBlockmap ()
|
||||||
bmapwidth = ((maxx - minx) >> BLOCKBITS) + 1;
|
bmapwidth = ((maxx - minx) >> BLOCKBITS) + 1;
|
||||||
bmapheight = ((maxy - miny) >> BLOCKBITS) + 1;
|
bmapheight = ((maxy - miny) >> BLOCKBITS) + 1;
|
||||||
|
|
||||||
adder = WORD(minx); BlockMap.Push (adder);
|
adder = uint16_t(minx); BlockMap.Push (adder);
|
||||||
adder = WORD(miny); BlockMap.Push (adder);
|
adder = uint16_t(miny); BlockMap.Push (adder);
|
||||||
adder = WORD(bmapwidth); BlockMap.Push (adder);
|
adder = uint16_t(bmapwidth); BlockMap.Push (adder);
|
||||||
adder = WORD(bmapheight); BlockMap.Push (adder);
|
adder = uint16_t(bmapheight); BlockMap.Push (adder);
|
||||||
|
|
||||||
BlockLists = new TArray<WORD>[bmapwidth * bmapheight];
|
BlockLists = new TArray<uint16_t>[bmapwidth * bmapheight];
|
||||||
|
|
||||||
for (line = 0; line < Level.NumLines(); ++line)
|
for (line = 0; line < Level.NumLines(); ++line)
|
||||||
{
|
{
|
||||||
|
@ -331,15 +331,15 @@ void FBlockmapBuilder::BuildBlockmap ()
|
||||||
delete[] BlockLists;
|
delete[] BlockLists;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FBlockmapBuilder::CreateUnpackedBlockmap (TArray<WORD> *blocks, int bmapwidth, int bmapheight)
|
void FBlockmapBuilder::CreateUnpackedBlockmap (TArray<uint16_t> *blocks, int bmapwidth, int bmapheight)
|
||||||
{
|
{
|
||||||
TArray<WORD> *block;
|
TArray<uint16_t> *block;
|
||||||
WORD zero = 0;
|
uint16_t zero = 0;
|
||||||
WORD terminator = 0xffff;
|
uint16_t terminator = 0xffff;
|
||||||
|
|
||||||
for (int i = 0; i < bmapwidth * bmapheight; ++i)
|
for (int i = 0; i < bmapwidth * bmapheight; ++i)
|
||||||
{
|
{
|
||||||
BlockMap[4+i] = WORD(BlockMap.Size());
|
BlockMap[4+i] = uint16_t(BlockMap.Size());
|
||||||
BlockMap.Push (zero);
|
BlockMap.Push (zero);
|
||||||
block = &blocks[i];
|
block = &blocks[i];
|
||||||
for (unsigned int j = 0; j < block->Size(); ++j)
|
for (unsigned int j = 0; j < block->Size(); ++j)
|
||||||
|
@ -350,10 +350,10 @@ void FBlockmapBuilder::CreateUnpackedBlockmap (TArray<WORD> *blocks, int bmapwid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int BlockHash (TArray<WORD> *block)
|
static unsigned int BlockHash (TArray<uint16_t> *block)
|
||||||
{
|
{
|
||||||
int hash = 0;
|
int hash = 0;
|
||||||
WORD *ar = &(*block)[0];
|
uint16_t *ar = &(*block)[0];
|
||||||
for (size_t i = 0; i < block->Size(); ++i)
|
for (size_t i = 0; i < block->Size(); ++i)
|
||||||
{
|
{
|
||||||
hash = hash * 12235 + ar[i];
|
hash = hash * 12235 + ar[i];
|
||||||
|
@ -361,7 +361,7 @@ static unsigned int BlockHash (TArray<WORD> *block)
|
||||||
return hash & 0x7fffffff;
|
return hash & 0x7fffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool BlockCompare (TArray<WORD> *block1, TArray<WORD> *block2)
|
static bool BlockCompare (TArray<uint16_t> *block1, TArray<uint16_t> *block2)
|
||||||
{
|
{
|
||||||
size_t size = block1->Size();
|
size_t size = block1->Size();
|
||||||
|
|
||||||
|
@ -373,8 +373,8 @@ static bool BlockCompare (TArray<WORD> *block1, TArray<WORD> *block2)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
WORD *ar1 = &(*block1)[0];
|
uint16_t *ar1 = &(*block1)[0];
|
||||||
WORD *ar2 = &(*block2)[0];
|
uint16_t *ar2 = &(*block2)[0];
|
||||||
for (size_t i = 0; i < size; ++i)
|
for (size_t i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
if (ar1[i] != ar2[i])
|
if (ar1[i] != ar2[i])
|
||||||
|
@ -385,20 +385,20 @@ static bool BlockCompare (TArray<WORD> *block1, TArray<WORD> *block2)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FBlockmapBuilder::CreatePackedBlockmap (TArray<WORD> *blocks, int bmapwidth, int bmapheight)
|
void FBlockmapBuilder::CreatePackedBlockmap (TArray<uint16_t> *blocks, int bmapwidth, int bmapheight)
|
||||||
{
|
{
|
||||||
WORD buckets[4096];
|
uint16_t buckets[4096];
|
||||||
WORD *hashes, hashblock;
|
uint16_t *hashes, hashblock;
|
||||||
TArray<WORD> *block;
|
TArray<uint16_t> *block;
|
||||||
WORD zero = 0;
|
uint16_t zero = 0;
|
||||||
WORD terminator = 0xffff;
|
uint16_t terminator = 0xffff;
|
||||||
WORD *array;
|
uint16_t *array;
|
||||||
int i, hash;
|
int i, hash;
|
||||||
int hashed = 0, nothashed = 0;
|
int hashed = 0, nothashed = 0;
|
||||||
|
|
||||||
hashes = new WORD[bmapwidth * bmapheight];
|
hashes = new uint16_t[bmapwidth * bmapheight];
|
||||||
|
|
||||||
memset (hashes, 0xff, sizeof(WORD)*bmapwidth*bmapheight);
|
memset (hashes, 0xff, sizeof(uint16_t)*bmapwidth*bmapheight);
|
||||||
memset (buckets, 0xff, sizeof(buckets));
|
memset (buckets, 0xff, sizeof(buckets));
|
||||||
|
|
||||||
for (i = 0; i < bmapwidth * bmapheight; ++i)
|
for (i = 0; i < bmapwidth * bmapheight; ++i)
|
||||||
|
@ -422,8 +422,8 @@ void FBlockmapBuilder::CreatePackedBlockmap (TArray<WORD> *blocks, int bmapwidth
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hashes[i] = buckets[hash];
|
hashes[i] = buckets[hash];
|
||||||
buckets[hash] = WORD(i);
|
buckets[hash] = uint16_t(i);
|
||||||
BlockMap[4+i] = WORD(BlockMap.Size());
|
BlockMap[4+i] = uint16_t(BlockMap.Size());
|
||||||
BlockMap.Push (zero);
|
BlockMap.Push (zero);
|
||||||
array = &(*block)[0];
|
array = &(*block)[0];
|
||||||
for (size_t j = 0; j < block->Size(); ++j)
|
for (size_t j = 0; j < block->Size(); ++j)
|
||||||
|
|
|
@ -9,13 +9,13 @@ class FBlockmapBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FBlockmapBuilder (FLevel &level);
|
FBlockmapBuilder (FLevel &level);
|
||||||
WORD *GetBlockmap (int &size);
|
uint16_t *GetBlockmap (int &size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FLevel &Level;
|
FLevel &Level;
|
||||||
TArray<WORD> BlockMap;
|
TArray<uint16_t> BlockMap;
|
||||||
|
|
||||||
void BuildBlockmap ();
|
void BuildBlockmap ();
|
||||||
void CreateUnpackedBlockmap (TArray<WORD> *blocks, int bmapwidth, int bmapheight);
|
void CreateUnpackedBlockmap (TArray<uint16_t> *blocks, int bmapwidth, int bmapheight);
|
||||||
void CreatePackedBlockmap (TArray<WORD> *blocks, int bmapwidth, int bmapheight);
|
void CreatePackedBlockmap (TArray<uint16_t> *blocks, int bmapwidth, int bmapheight);
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,22 +45,14 @@ extern int SSELevel;
|
||||||
#define FRACBITS 16
|
#define FRACBITS 16
|
||||||
|
|
||||||
typedef int fixed_t;
|
typedef int fixed_t;
|
||||||
typedef unsigned char BYTE;
|
|
||||||
typedef unsigned short WORD;
|
|
||||||
typedef signed short SWORD;
|
|
||||||
#ifdef _WIN32
|
|
||||||
typedef unsigned long DWORD;
|
|
||||||
#else
|
|
||||||
typedef uint32_t DWORD;
|
|
||||||
#endif
|
|
||||||
typedef uint32_t angle_t;
|
typedef uint32_t angle_t;
|
||||||
|
|
||||||
angle_t PointToAngle (fixed_t x, fixed_t y);
|
angle_t PointToAngle (fixed_t x, fixed_t y);
|
||||||
|
|
||||||
static const WORD NO_MAP_INDEX = 0xffff;
|
static const uint16_t NO_MAP_INDEX = 0xffff;
|
||||||
static const DWORD NO_INDEX = 0xffffffff;
|
static const uint32_t NO_INDEX = 0xffffffff;
|
||||||
static const angle_t ANGLE_MAX = 0xffffffff;
|
static const angle_t ANGLE_MAX = 0xffffffff;
|
||||||
static const DWORD DWORD_MAX = 0xffffffff;
|
static const uint32_t DWORD_MAX = 0xffffffff;
|
||||||
static const angle_t ANGLE_180 = (1u<<31);
|
static const angle_t ANGLE_180 = (1u<<31);
|
||||||
static const angle_t ANGLE_EPSILON = 5000;
|
static const angle_t ANGLE_EPSILON = 5000;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct MapSideDef
|
||||||
char toptexture[8];
|
char toptexture[8];
|
||||||
char bottomtexture[8];
|
char bottomtexture[8];
|
||||||
char midtexture[8];
|
char midtexture[8];
|
||||||
WORD sector;
|
uint16_t sector;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IntLineDef;
|
struct IntLineDef;
|
||||||
|
@ -60,32 +60,32 @@ struct IntSideDef
|
||||||
|
|
||||||
struct MapLineDef
|
struct MapLineDef
|
||||||
{
|
{
|
||||||
WORD v1;
|
uint16_t v1;
|
||||||
WORD v2;
|
uint16_t v2;
|
||||||
short flags;
|
short flags;
|
||||||
short special;
|
short special;
|
||||||
short tag;
|
short tag;
|
||||||
WORD sidenum[2];
|
uint16_t sidenum[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapLineDef2
|
struct MapLineDef2
|
||||||
{
|
{
|
||||||
WORD v1;
|
uint16_t v1;
|
||||||
WORD v2;
|
uint16_t v2;
|
||||||
short flags;
|
short flags;
|
||||||
unsigned char special;
|
unsigned char special;
|
||||||
unsigned char args[5];
|
unsigned char args[5];
|
||||||
WORD sidenum[2];
|
uint16_t sidenum[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IntLineDef
|
struct IntLineDef
|
||||||
{
|
{
|
||||||
DWORD v1;
|
uint32_t v1;
|
||||||
DWORD v2;
|
uint32_t v2;
|
||||||
int flags;
|
int flags;
|
||||||
int special;
|
int special;
|
||||||
int args[5];
|
int args[5];
|
||||||
DWORD sidenum[2];
|
uint32_t sidenum[2];
|
||||||
|
|
||||||
TArray<UDMFKey> props;
|
TArray<UDMFKey> props;
|
||||||
};
|
};
|
||||||
|
@ -120,52 +120,52 @@ struct IntSector
|
||||||
|
|
||||||
struct MapSubsector
|
struct MapSubsector
|
||||||
{
|
{
|
||||||
WORD numlines;
|
uint16_t numlines;
|
||||||
WORD firstline;
|
uint16_t firstline;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapSubsectorEx
|
struct MapSubsectorEx
|
||||||
{
|
{
|
||||||
DWORD numlines;
|
uint32_t numlines;
|
||||||
DWORD firstline;
|
uint32_t firstline;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapSeg
|
struct MapSeg
|
||||||
{
|
{
|
||||||
WORD v1;
|
uint16_t v1;
|
||||||
WORD v2;
|
uint16_t v2;
|
||||||
WORD angle;
|
uint16_t angle;
|
||||||
WORD linedef;
|
uint16_t linedef;
|
||||||
short side;
|
short side;
|
||||||
short offset;
|
short offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapSegEx
|
struct MapSegEx
|
||||||
{
|
{
|
||||||
DWORD v1;
|
uint32_t v1;
|
||||||
DWORD v2;
|
uint32_t v2;
|
||||||
WORD angle;
|
uint16_t angle;
|
||||||
WORD linedef;
|
uint16_t linedef;
|
||||||
short side;
|
short side;
|
||||||
short offset;
|
short offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapSegGL
|
struct MapSegGL
|
||||||
{
|
{
|
||||||
WORD v1;
|
uint16_t v1;
|
||||||
WORD v2;
|
uint16_t v2;
|
||||||
WORD linedef;
|
uint16_t linedef;
|
||||||
WORD side;
|
uint16_t side;
|
||||||
WORD partner;
|
uint16_t partner;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapSegGLEx
|
struct MapSegGLEx
|
||||||
{
|
{
|
||||||
DWORD v1;
|
uint32_t v1;
|
||||||
DWORD v2;
|
uint32_t v2;
|
||||||
DWORD linedef;
|
uint32_t linedef;
|
||||||
WORD side;
|
uint16_t side;
|
||||||
DWORD partner;
|
uint32_t partner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NF_SUBSECTOR 0x8000
|
#define NF_SUBSECTOR 0x8000
|
||||||
|
@ -175,21 +175,21 @@ struct MapNode
|
||||||
{
|
{
|
||||||
short x,y,dx,dy;
|
short x,y,dx,dy;
|
||||||
short bbox[2][4];
|
short bbox[2][4];
|
||||||
WORD children[2];
|
uint16_t children[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapNodeExO
|
struct MapNodeExO
|
||||||
{
|
{
|
||||||
short x,y,dx,dy;
|
short x,y,dx,dy;
|
||||||
short bbox[2][4];
|
short bbox[2][4];
|
||||||
DWORD children[2];
|
uint32_t children[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapNodeEx
|
struct MapNodeEx
|
||||||
{
|
{
|
||||||
int x,y,dx,dy;
|
int x,y,dx,dy;
|
||||||
short bbox[2][4];
|
short bbox[2][4];
|
||||||
DWORD children[2];
|
uint32_t children[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapThing
|
struct MapThing
|
||||||
|
@ -319,18 +319,18 @@ struct FLevel
|
||||||
MapSubsectorEx *Subsectors; int NumSubsectors;
|
MapSubsectorEx *Subsectors; int NumSubsectors;
|
||||||
MapSegEx *Segs; int NumSegs;
|
MapSegEx *Segs; int NumSegs;
|
||||||
MapNodeEx *Nodes; int NumNodes;
|
MapNodeEx *Nodes; int NumNodes;
|
||||||
WORD *Blockmap; int BlockmapSize;
|
uint16_t *Blockmap; int BlockmapSize;
|
||||||
BYTE *Reject; int RejectSize;
|
uint8_t *Reject; int RejectSize;
|
||||||
|
|
||||||
MapSubsectorEx *GLSubsectors; int NumGLSubsectors;
|
MapSubsectorEx *GLSubsectors; int NumGLSubsectors;
|
||||||
MapSegGLEx *GLSegs; int NumGLSegs;
|
MapSegGLEx *GLSegs; int NumGLSegs;
|
||||||
MapNodeEx *GLNodes; int NumGLNodes;
|
MapNodeEx *GLNodes; int NumGLNodes;
|
||||||
WideVertex *GLVertices; int NumGLVertices;
|
WideVertex *GLVertices; int NumGLVertices;
|
||||||
BYTE *GLPVS; int GLPVSSize;
|
uint8_t *GLPVS; int GLPVSSize;
|
||||||
|
|
||||||
int NumOrgVerts;
|
int NumOrgVerts;
|
||||||
|
|
||||||
DWORD *OrgSectorMap; int NumOrgSectors;
|
uint32_t *OrgSectorMap; int NumOrgSectors;
|
||||||
|
|
||||||
fixed_t MinX, MinY, MaxX, MaxY;
|
fixed_t MinX, MinY, MaxX, MaxY;
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,7 @@ void FLevel::RemoveExtraLines ()
|
||||||
|
|
||||||
void FLevel::RemoveExtraSides ()
|
void FLevel::RemoveExtraSides ()
|
||||||
{
|
{
|
||||||
BYTE *used;
|
uint8_t *used;
|
||||||
int *remap;
|
int *remap;
|
||||||
int i, newNumSides;
|
int i, newNumSides;
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ void FLevel::RemoveExtraSides ()
|
||||||
// They just waste space, so get rid of them.
|
// They just waste space, so get rid of them.
|
||||||
int NumSides = this->NumSides();
|
int NumSides = this->NumSides();
|
||||||
|
|
||||||
used = new BYTE[NumSides];
|
used = new uint8_t[NumSides];
|
||||||
memset (used, 0, NumSides*sizeof(*used));
|
memset (used, 0, NumSides*sizeof(*used));
|
||||||
remap = new int[NumSides];
|
remap = new int[NumSides];
|
||||||
|
|
||||||
|
@ -397,22 +397,22 @@ void FLevel::RemoveExtraSides ()
|
||||||
|
|
||||||
void FLevel::RemoveExtraSectors ()
|
void FLevel::RemoveExtraSectors ()
|
||||||
{
|
{
|
||||||
BYTE *used;
|
uint8_t *used;
|
||||||
DWORD *remap;
|
uint32_t *remap;
|
||||||
int i, newNumSectors;
|
int i, newNumSectors;
|
||||||
|
|
||||||
// Extra sectors are those that aren't referenced by any sides.
|
// Extra sectors are those that aren't referenced by any sides.
|
||||||
// They just waste space, so get rid of them.
|
// They just waste space, so get rid of them.
|
||||||
|
|
||||||
NumOrgSectors = NumSectors();
|
NumOrgSectors = NumSectors();
|
||||||
used = new BYTE[NumSectors()];
|
used = new uint8_t[NumSectors()];
|
||||||
memset (used, 0, NumSectors()*sizeof(*used));
|
memset (used, 0, NumSectors()*sizeof(*used));
|
||||||
remap = new DWORD[NumSectors()];
|
remap = new uint32_t[NumSectors()];
|
||||||
|
|
||||||
// Mark all used sectors
|
// Mark all used sectors
|
||||||
for (i = 0; i < NumSides(); ++i)
|
for (i = 0; i < NumSides(); ++i)
|
||||||
{
|
{
|
||||||
if ((DWORD)Sides[i].sector != NO_INDEX)
|
if ((uint32_t)Sides[i].sector != NO_INDEX)
|
||||||
{
|
{
|
||||||
used[Sides[i].sector] = 1;
|
used[Sides[i].sector] = 1;
|
||||||
}
|
}
|
||||||
|
@ -447,13 +447,13 @@ void FLevel::RemoveExtraSectors ()
|
||||||
// Renumber sector references in sides
|
// Renumber sector references in sides
|
||||||
for (i = 0; i < NumSides(); ++i)
|
for (i = 0; i < NumSides(); ++i)
|
||||||
{
|
{
|
||||||
if ((DWORD)Sides[i].sector != NO_INDEX)
|
if ((uint32_t)Sides[i].sector != NO_INDEX)
|
||||||
{
|
{
|
||||||
Sides[i].sector = remap[Sides[i].sector];
|
Sides[i].sector = remap[Sides[i].sector];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make a reverse map for fixing reject lumps
|
// Make a reverse map for fixing reject lumps
|
||||||
OrgSectorMap = new DWORD[newNumSectors];
|
OrgSectorMap = new uint32_t[newNumSectors];
|
||||||
for (i = 0; i < NumSectors(); ++i)
|
for (i = 0; i < NumSectors(); ++i)
|
||||||
{
|
{
|
||||||
if (remap[i] != NO_INDEX)
|
if (remap[i] != NO_INDEX)
|
||||||
|
@ -667,8 +667,8 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
|
|
||||||
#ifdef BLOCK_TEST
|
#ifdef BLOCK_TEST
|
||||||
int size;
|
int size;
|
||||||
BYTE *blockmap;
|
uint8_t *blockmap;
|
||||||
ReadLump<BYTE> (Wad, Wad.FindMapLump ("BLOCKMAP", Lump), blockmap, size);
|
ReadLump<uint8_t> (Wad, Wad.FindMapLump ("BLOCKMAP", Lump), blockmap, size);
|
||||||
if (blockmap)
|
if (blockmap)
|
||||||
{
|
{
|
||||||
FILE *f = fopen ("blockmap.lmp", "wb");
|
FILE *f = fopen ("blockmap.lmp", "wb");
|
||||||
|
@ -684,9 +684,9 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
if (!isUDMF)
|
if (!isUDMF)
|
||||||
{
|
{
|
||||||
FBlockmapBuilder bbuilder (Level);
|
FBlockmapBuilder bbuilder (Level);
|
||||||
WORD *blocks = bbuilder.GetBlockmap (Level.BlockmapSize);
|
uint16_t *blocks = bbuilder.GetBlockmap (Level.BlockmapSize);
|
||||||
Level.Blockmap = new WORD[Level.BlockmapSize];
|
Level.Blockmap = new uint16_t[Level.BlockmapSize];
|
||||||
memcpy (Level.Blockmap, blocks, Level.BlockmapSize*sizeof(WORD));
|
memcpy (Level.Blockmap, blocks, Level.BlockmapSize*sizeof(uint16_t));
|
||||||
|
|
||||||
Level.RejectSize = (Level.NumSectors()*Level.NumSectors() + 7) / 8;
|
Level.RejectSize = (Level.NumSectors()*Level.NumSectors() + 7) / 8;
|
||||||
Level.Reject = NULL;
|
Level.Reject = NULL;
|
||||||
|
@ -705,7 +705,7 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
|
|
||||||
if (lump >= 0)
|
if (lump >= 0)
|
||||||
{
|
{
|
||||||
ReadLump<BYTE> (Wad, lump, Level.Reject, Level.RejectSize);
|
ReadLump<uint8_t> (Wad, lump, Level.Reject, Level.RejectSize);
|
||||||
if (Level.RejectSize != (Level.NumOrgSectors*Level.NumOrgSectors + 7) / 8)
|
if (Level.RejectSize != (Level.NumOrgSectors*Level.NumOrgSectors + 7) / 8)
|
||||||
{
|
{
|
||||||
// If the reject is the wrong size, don't use it.
|
// If the reject is the wrong size, don't use it.
|
||||||
|
@ -720,7 +720,7 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
else if (Level.NumOrgSectors != Level.NumSectors())
|
else if (Level.NumOrgSectors != Level.NumSectors())
|
||||||
{
|
{
|
||||||
// Some sectors have been removed, so fix the reject.
|
// Some sectors have been removed, so fix the reject.
|
||||||
BYTE *newreject = FixReject (Level.Reject);
|
uint8_t *newreject = FixReject (Level.Reject);
|
||||||
delete[] Level.Reject;
|
delete[] Level.Reject;
|
||||||
Level.Reject = newreject;
|
Level.Reject = newreject;
|
||||||
Level.RejectSize = (Level.NumSectors() * Level.NumSectors() + 7) / 8;
|
Level.RejectSize = (Level.NumSectors() * Level.NumSectors() + 7) / 8;
|
||||||
|
@ -733,7 +733,7 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ERM_CreateZeroes:
|
case ERM_CreateZeroes:
|
||||||
Level.Reject = new BYTE[Level.RejectSize];
|
Level.Reject = new uint8_t[Level.RejectSize];
|
||||||
memset (Level.Reject, 0, Level.RejectSize);
|
memset (Level.Reject, 0, Level.RejectSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -848,11 +848,11 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
BYTE *FProcessor::FixReject (const BYTE *oldreject)
|
uint8_t *FProcessor::FixReject (const uint8_t *oldreject)
|
||||||
{
|
{
|
||||||
int x, y, ox, oy, pnum, opnum;
|
int x, y, ox, oy, pnum, opnum;
|
||||||
int rejectSize = (Level.NumSectors()*Level.NumSectors() + 7) / 8;
|
int rejectSize = (Level.NumSectors()*Level.NumSectors() + 7) / 8;
|
||||||
BYTE *newreject = new BYTE[rejectSize];
|
uint8_t *newreject = new uint8_t[rejectSize];
|
||||||
|
|
||||||
memset (newreject, 0, rejectSize);
|
memset (newreject, 0, rejectSize);
|
||||||
|
|
||||||
|
@ -886,12 +886,12 @@ MapNodeEx *FProcessor::NodesToEx (const MapNode *nodes, int count)
|
||||||
|
|
||||||
for (x = 0; x < count; ++x)
|
for (x = 0; x < count; ++x)
|
||||||
{
|
{
|
||||||
WORD child;
|
uint16_t child;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 4+2*4; ++i)
|
for (i = 0; i < 4+2*4; ++i)
|
||||||
{
|
{
|
||||||
*((WORD *)&Nodes[x] + i) = LittleShort(*((WORD *)&nodes[x] + i));
|
*((uint16_t *)&Nodes[x] + i) = LittleShort(*((uint16_t *)&nodes[x] + i));
|
||||||
}
|
}
|
||||||
for (i = 0; i < 2; ++i)
|
for (i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
|
@ -986,11 +986,11 @@ void FProcessor::WriteLines (FWadWriter &out)
|
||||||
Lines[i].args[2] = Level.Lines[i].args[2];
|
Lines[i].args[2] = Level.Lines[i].args[2];
|
||||||
Lines[i].args[3] = Level.Lines[i].args[3];
|
Lines[i].args[3] = Level.Lines[i].args[3];
|
||||||
Lines[i].args[4] = Level.Lines[i].args[4];
|
Lines[i].args[4] = Level.Lines[i].args[4];
|
||||||
Lines[i].v1 = LittleShort(WORD(Level.Lines[i].v1));
|
Lines[i].v1 = LittleShort(uint16_t(Level.Lines[i].v1));
|
||||||
Lines[i].v2 = LittleShort(WORD(Level.Lines[i].v2));
|
Lines[i].v2 = LittleShort(uint16_t(Level.Lines[i].v2));
|
||||||
Lines[i].flags = LittleShort(WORD(Level.Lines[i].flags));
|
Lines[i].flags = LittleShort(uint16_t(Level.Lines[i].flags));
|
||||||
Lines[i].sidenum[0] = LittleShort(WORD(Level.Lines[i].sidenum[0]));
|
Lines[i].sidenum[0] = LittleShort(uint16_t(Level.Lines[i].sidenum[0]));
|
||||||
Lines[i].sidenum[1] = LittleShort(WORD(Level.Lines[i].sidenum[1]));
|
Lines[i].sidenum[1] = LittleShort(uint16_t(Level.Lines[i].sidenum[1]));
|
||||||
}
|
}
|
||||||
out.WriteLump ("LINEDEFS", Lines, Level.NumLines()*sizeof(*Lines));
|
out.WriteLump ("LINEDEFS", Lines, Level.NumLines()*sizeof(*Lines));
|
||||||
delete[] Lines;
|
delete[] Lines;
|
||||||
|
@ -1001,13 +1001,13 @@ void FProcessor::WriteLines (FWadWriter &out)
|
||||||
|
|
||||||
for (i = 0; i < Level.NumLines(); ++i)
|
for (i = 0; i < Level.NumLines(); ++i)
|
||||||
{
|
{
|
||||||
ld[i].v1 = LittleShort(WORD(Level.Lines[i].v1));
|
ld[i].v1 = LittleShort(uint16_t(Level.Lines[i].v1));
|
||||||
ld[i].v2 = LittleShort(WORD(Level.Lines[i].v2));
|
ld[i].v2 = LittleShort(uint16_t(Level.Lines[i].v2));
|
||||||
ld[i].flags = LittleShort(WORD(Level.Lines[i].flags));
|
ld[i].flags = LittleShort(uint16_t(Level.Lines[i].flags));
|
||||||
ld[i].sidenum[0] = LittleShort(WORD(Level.Lines[i].sidenum[0]));
|
ld[i].sidenum[0] = LittleShort(uint16_t(Level.Lines[i].sidenum[0]));
|
||||||
ld[i].sidenum[1] = LittleShort(WORD(Level.Lines[i].sidenum[1]));
|
ld[i].sidenum[1] = LittleShort(uint16_t(Level.Lines[i].sidenum[1]));
|
||||||
ld[i].special = LittleShort(WORD(Level.Lines[i].args[0]));
|
ld[i].special = LittleShort(uint16_t(Level.Lines[i].args[0]));
|
||||||
ld[i].tag = LittleShort(WORD(Level.Lines[i].args[1]));
|
ld[i].tag = LittleShort(uint16_t(Level.Lines[i].args[1]));
|
||||||
}
|
}
|
||||||
out.WriteLump ("LINEDEFS", ld, Level.NumLines()*sizeof(*ld));
|
out.WriteLump ("LINEDEFS", ld, Level.NumLines()*sizeof(*ld));
|
||||||
delete[] ld;
|
delete[] ld;
|
||||||
|
@ -1056,8 +1056,8 @@ void FProcessor::WriteSegs (FWadWriter &out)
|
||||||
|
|
||||||
for (i = 0; i < Level.NumSegs; ++i)
|
for (i = 0; i < Level.NumSegs; ++i)
|
||||||
{
|
{
|
||||||
segdata[i].v1 = LittleShort(WORD(Level.Segs[i].v1));
|
segdata[i].v1 = LittleShort(uint16_t(Level.Segs[i].v1));
|
||||||
segdata[i].v2 = LittleShort(WORD(Level.Segs[i].v2));
|
segdata[i].v2 = LittleShort(uint16_t(Level.Segs[i].v2));
|
||||||
segdata[i].angle = LittleShort(Level.Segs[i].angle);
|
segdata[i].angle = LittleShort(Level.Segs[i].angle);
|
||||||
segdata[i].linedef = LittleShort(Level.Segs[i].linedef);
|
segdata[i].linedef = LittleShort(Level.Segs[i].linedef);
|
||||||
segdata[i].side = LittleShort(Level.Segs[i].side);
|
segdata[i].side = LittleShort(Level.Segs[i].side);
|
||||||
|
@ -1089,8 +1089,8 @@ void FProcessor::WriteSSectors2 (FWadWriter &out, const char *name, const MapSub
|
||||||
|
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
ssec[i].firstline = LittleShort((WORD)subs[i].firstline);
|
ssec[i].firstline = LittleShort((uint16_t)subs[i].firstline);
|
||||||
ssec[i].numlines = LittleShort((WORD)subs[i].numlines);
|
ssec[i].numlines = LittleShort((uint16_t)subs[i].numlines);
|
||||||
}
|
}
|
||||||
out.WriteLump (name, ssec, sizeof(*ssec)*count);
|
out.WriteLump (name, ssec, sizeof(*ssec)*count);
|
||||||
delete[] ssec;
|
delete[] ssec;
|
||||||
|
@ -1144,14 +1144,14 @@ void FProcessor::WriteNodes2 (FWadWriter &out, const char *name, const MapNodeEx
|
||||||
nodes += j;
|
nodes += j;
|
||||||
for (j = 0; j < 2; ++j)
|
for (j = 0; j < 2; ++j)
|
||||||
{
|
{
|
||||||
DWORD child = zaNodes[i].children[j];
|
uint32_t child = zaNodes[i].children[j];
|
||||||
if (child & NFX_SUBSECTOR)
|
if (child & NFX_SUBSECTOR)
|
||||||
{
|
{
|
||||||
*nodes++ = LittleShort(WORD(child - (NFX_SUBSECTOR + NF_SUBSECTOR)));
|
*nodes++ = LittleShort(uint16_t(child - (NFX_SUBSECTOR + NF_SUBSECTOR)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*nodes++ = LittleShort((WORD)child);
|
*nodes++ = LittleShort((uint16_t)child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1199,7 +1199,7 @@ void FProcessor::WriteBlockmap (FWadWriter &out)
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t i, count;
|
size_t i, count;
|
||||||
WORD *blocks;
|
uint16_t *blocks;
|
||||||
|
|
||||||
count = Level.BlockmapSize;
|
count = Level.BlockmapSize;
|
||||||
blocks = Level.Blockmap;
|
blocks = Level.Blockmap;
|
||||||
|
@ -1289,25 +1289,25 @@ void FProcessor::WriteGLSegs (FWadWriter &out, bool v5)
|
||||||
|
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (Level.GLSegs[i].v1 < (DWORD)Level.NumOrgVerts)
|
if (Level.GLSegs[i].v1 < (uint32_t)Level.NumOrgVerts)
|
||||||
{
|
{
|
||||||
segdata[i].v1 = LittleShort((WORD)Level.GLSegs[i].v1);
|
segdata[i].v1 = LittleShort((uint16_t)Level.GLSegs[i].v1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
segdata[i].v1 = LittleShort(0x8000 | (WORD)(Level.GLSegs[i].v1 - Level.NumOrgVerts));
|
segdata[i].v1 = LittleShort(0x8000 | (uint16_t)(Level.GLSegs[i].v1 - Level.NumOrgVerts));
|
||||||
}
|
}
|
||||||
if (Level.GLSegs[i].v2 < (DWORD)Level.NumOrgVerts)
|
if (Level.GLSegs[i].v2 < (uint32_t)Level.NumOrgVerts)
|
||||||
{
|
{
|
||||||
segdata[i].v2 = (WORD)LittleShort(Level.GLSegs[i].v2);
|
segdata[i].v2 = (uint16_t)LittleShort(Level.GLSegs[i].v2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
segdata[i].v2 = LittleShort(0x8000 | (WORD)(Level.GLSegs[i].v2 - Level.NumOrgVerts));
|
segdata[i].v2 = LittleShort(0x8000 | (uint16_t)(Level.GLSegs[i].v2 - Level.NumOrgVerts));
|
||||||
}
|
}
|
||||||
segdata[i].linedef = LittleShort((WORD)Level.GLSegs[i].linedef);
|
segdata[i].linedef = LittleShort((uint16_t)Level.GLSegs[i].linedef);
|
||||||
segdata[i].side = LittleShort(Level.GLSegs[i].side);
|
segdata[i].side = LittleShort(Level.GLSegs[i].side);
|
||||||
segdata[i].partner = LittleShort((WORD)Level.GLSegs[i].partner);
|
segdata[i].partner = LittleShort((uint16_t)Level.GLSegs[i].partner);
|
||||||
}
|
}
|
||||||
out.WriteLump ("GL_SEGS", segdata, sizeof(MapSegGL)*count);
|
out.WriteLump ("GL_SEGS", segdata, sizeof(MapSegGL)*count);
|
||||||
delete[] segdata;
|
delete[] segdata;
|
||||||
|
@ -1332,7 +1332,7 @@ void FProcessor::WriteGLSegs5 (FWadWriter &out)
|
||||||
|
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (Level.GLSegs[i].v1 < (DWORD)Level.NumOrgVerts)
|
if (Level.GLSegs[i].v1 < (uint32_t)Level.NumOrgVerts)
|
||||||
{
|
{
|
||||||
segdata[i].v1 = LittleLong(Level.GLSegs[i].v1);
|
segdata[i].v1 = LittleLong(Level.GLSegs[i].v1);
|
||||||
}
|
}
|
||||||
|
@ -1340,7 +1340,7 @@ void FProcessor::WriteGLSegs5 (FWadWriter &out)
|
||||||
{
|
{
|
||||||
segdata[i].v1 = LittleLong(0x80000000u | ((int)Level.GLSegs[i].v1 - Level.NumOrgVerts));
|
segdata[i].v1 = LittleLong(0x80000000u | ((int)Level.GLSegs[i].v1 - Level.NumOrgVerts));
|
||||||
}
|
}
|
||||||
if (Level.GLSegs[i].v2 < (DWORD)Level.NumOrgVerts)
|
if (Level.GLSegs[i].v2 < (uint32_t)Level.NumOrgVerts)
|
||||||
{
|
{
|
||||||
segdata[i].v2 = LittleLong(Level.GLSegs[i].v2);
|
segdata[i].v2 = LittleLong(Level.GLSegs[i].v2);
|
||||||
}
|
}
|
||||||
|
@ -1432,7 +1432,7 @@ void FProcessor::WriteGLBSPZ (FWadWriter &out, const char *label)
|
||||||
|
|
||||||
void FProcessor::WriteVerticesZ (ZLibOut &out, const WideVertex *verts, int orgverts, int newverts)
|
void FProcessor::WriteVerticesZ (ZLibOut &out, const WideVertex *verts, int orgverts, int newverts)
|
||||||
{
|
{
|
||||||
out << (DWORD)orgverts << (DWORD)newverts;
|
out << (uint32_t)orgverts << (uint32_t)newverts;
|
||||||
|
|
||||||
for (int i = 0; i < newverts; ++i)
|
for (int i = 0; i < newverts; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1442,82 +1442,82 @@ void FProcessor::WriteVerticesZ (ZLibOut &out, const WideVertex *verts, int orgv
|
||||||
|
|
||||||
void FProcessor::WriteSubsectorsZ (ZLibOut &out, const MapSubsectorEx *subs, int numsubs)
|
void FProcessor::WriteSubsectorsZ (ZLibOut &out, const MapSubsectorEx *subs, int numsubs)
|
||||||
{
|
{
|
||||||
out << (DWORD)numsubs;
|
out << (uint32_t)numsubs;
|
||||||
|
|
||||||
for (int i = 0; i < numsubs; ++i)
|
for (int i = 0; i < numsubs; ++i)
|
||||||
{
|
{
|
||||||
out << (DWORD)subs[i].numlines;
|
out << (uint32_t)subs[i].numlines;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FProcessor::WriteSegsZ (ZLibOut &out, const MapSegEx *segs, int numsegs)
|
void FProcessor::WriteSegsZ (ZLibOut &out, const MapSegEx *segs, int numsegs)
|
||||||
{
|
{
|
||||||
out << (DWORD)numsegs;
|
out << (uint32_t)numsegs;
|
||||||
|
|
||||||
for (int i = 0; i < numsegs; ++i)
|
for (int i = 0; i < numsegs; ++i)
|
||||||
{
|
{
|
||||||
out << (DWORD)segs[i].v1
|
out << (uint32_t)segs[i].v1
|
||||||
<< (DWORD)segs[i].v2
|
<< (uint32_t)segs[i].v2
|
||||||
<< (WORD)segs[i].linedef
|
<< (uint16_t)segs[i].linedef
|
||||||
<< (BYTE)segs[i].side;
|
<< (uint8_t)segs[i].side;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FProcessor::WriteGLSegsZ (ZLibOut &out, const MapSegGLEx *segs, int numsegs, int nodever)
|
void FProcessor::WriteGLSegsZ (ZLibOut &out, const MapSegGLEx *segs, int numsegs, int nodever)
|
||||||
{
|
{
|
||||||
out << (DWORD)numsegs;
|
out << (uint32_t)numsegs;
|
||||||
|
|
||||||
if (nodever < 2)
|
if (nodever < 2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numsegs; ++i)
|
for (int i = 0; i < numsegs; ++i)
|
||||||
{
|
{
|
||||||
out << (DWORD)segs[i].v1
|
out << (uint32_t)segs[i].v1
|
||||||
<< (DWORD)segs[i].partner
|
<< (uint32_t)segs[i].partner
|
||||||
<< (WORD)segs[i].linedef
|
<< (uint16_t)segs[i].linedef
|
||||||
<< (BYTE)segs[i].side;
|
<< (uint8_t)segs[i].side;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numsegs; ++i)
|
for (int i = 0; i < numsegs; ++i)
|
||||||
{
|
{
|
||||||
out << (DWORD)segs[i].v1
|
out << (uint32_t)segs[i].v1
|
||||||
<< (DWORD)segs[i].partner
|
<< (uint32_t)segs[i].partner
|
||||||
<< (DWORD)segs[i].linedef
|
<< (uint32_t)segs[i].linedef
|
||||||
<< (BYTE)segs[i].side;
|
<< (uint8_t)segs[i].side;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FProcessor::WriteNodesZ (ZLibOut &out, const MapNodeEx *nodes, int numnodes, int nodever)
|
void FProcessor::WriteNodesZ (ZLibOut &out, const MapNodeEx *nodes, int numnodes, int nodever)
|
||||||
{
|
{
|
||||||
out << (DWORD)numnodes;
|
out << (uint32_t)numnodes;
|
||||||
|
|
||||||
for (int i = 0; i < numnodes; ++i)
|
for (int i = 0; i < numnodes; ++i)
|
||||||
{
|
{
|
||||||
if (nodever < 3)
|
if (nodever < 3)
|
||||||
{
|
{
|
||||||
out << (SWORD)(nodes[i].x >> 16)
|
out << (int16_t)(nodes[i].x >> 16)
|
||||||
<< (SWORD)(nodes[i].y >> 16)
|
<< (int16_t)(nodes[i].y >> 16)
|
||||||
<< (SWORD)(nodes[i].dx >> 16)
|
<< (int16_t)(nodes[i].dx >> 16)
|
||||||
<< (SWORD)(nodes[i].dy >> 16);
|
<< (int16_t)(nodes[i].dy >> 16);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << (DWORD)nodes[i].x
|
out << (uint32_t)nodes[i].x
|
||||||
<< (DWORD)nodes[i].y
|
<< (uint32_t)nodes[i].y
|
||||||
<< (DWORD)nodes[i].dx
|
<< (uint32_t)nodes[i].dx
|
||||||
<< (DWORD)nodes[i].dy;
|
<< (uint32_t)nodes[i].dy;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < 2; ++j)
|
for (int j = 0; j < 2; ++j)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < 4; ++k)
|
for (int k = 0; k < 4; ++k)
|
||||||
{
|
{
|
||||||
out << (SWORD)nodes[i].bbox[j][k];
|
out << (int16_t)nodes[i].bbox[j][k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out << (DWORD)nodes[i].children[0]
|
out << (uint32_t)nodes[i].children[0]
|
||||||
<< (DWORD)nodes[i].children[1];
|
<< (uint32_t)nodes[i].children[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1570,7 +1570,7 @@ void FProcessor::WriteGLBSPX (FWadWriter &out, const char *label)
|
||||||
|
|
||||||
void FProcessor::WriteVerticesX (FWadWriter &out, const WideVertex *verts, int orgverts, int newverts)
|
void FProcessor::WriteVerticesX (FWadWriter &out, const WideVertex *verts, int orgverts, int newverts)
|
||||||
{
|
{
|
||||||
out << (DWORD)orgverts << (DWORD)newverts;
|
out << (uint32_t)orgverts << (uint32_t)newverts;
|
||||||
|
|
||||||
for (int i = 0; i < newverts; ++i)
|
for (int i = 0; i < newverts; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1580,82 +1580,82 @@ void FProcessor::WriteVerticesX (FWadWriter &out, const WideVertex *verts, int o
|
||||||
|
|
||||||
void FProcessor::WriteSubsectorsX (FWadWriter &out, const MapSubsectorEx *subs, int numsubs)
|
void FProcessor::WriteSubsectorsX (FWadWriter &out, const MapSubsectorEx *subs, int numsubs)
|
||||||
{
|
{
|
||||||
out << (DWORD)numsubs;
|
out << (uint32_t)numsubs;
|
||||||
|
|
||||||
for (int i = 0; i < numsubs; ++i)
|
for (int i = 0; i < numsubs; ++i)
|
||||||
{
|
{
|
||||||
out << (DWORD)subs[i].numlines;
|
out << (uint32_t)subs[i].numlines;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FProcessor::WriteSegsX (FWadWriter &out, const MapSegEx *segs, int numsegs)
|
void FProcessor::WriteSegsX (FWadWriter &out, const MapSegEx *segs, int numsegs)
|
||||||
{
|
{
|
||||||
out << (DWORD)numsegs;
|
out << (uint32_t)numsegs;
|
||||||
|
|
||||||
for (int i = 0; i < numsegs; ++i)
|
for (int i = 0; i < numsegs; ++i)
|
||||||
{
|
{
|
||||||
out << (DWORD)segs[i].v1
|
out << (uint32_t)segs[i].v1
|
||||||
<< (DWORD)segs[i].v2
|
<< (uint32_t)segs[i].v2
|
||||||
<< (WORD)segs[i].linedef
|
<< (uint16_t)segs[i].linedef
|
||||||
<< (BYTE)segs[i].side;
|
<< (uint8_t)segs[i].side;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FProcessor::WriteGLSegsX (FWadWriter &out, const MapSegGLEx *segs, int numsegs, int nodever)
|
void FProcessor::WriteGLSegsX (FWadWriter &out, const MapSegGLEx *segs, int numsegs, int nodever)
|
||||||
{
|
{
|
||||||
out << (DWORD)numsegs;
|
out << (uint32_t)numsegs;
|
||||||
|
|
||||||
if (nodever < 2)
|
if (nodever < 2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numsegs; ++i)
|
for (int i = 0; i < numsegs; ++i)
|
||||||
{
|
{
|
||||||
out << (DWORD)segs[i].v1
|
out << (uint32_t)segs[i].v1
|
||||||
<< (DWORD)segs[i].partner
|
<< (uint32_t)segs[i].partner
|
||||||
<< (WORD)segs[i].linedef
|
<< (uint16_t)segs[i].linedef
|
||||||
<< (BYTE)segs[i].side;
|
<< (uint8_t)segs[i].side;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numsegs; ++i)
|
for (int i = 0; i < numsegs; ++i)
|
||||||
{
|
{
|
||||||
out << (DWORD)segs[i].v1
|
out << (uint32_t)segs[i].v1
|
||||||
<< (DWORD)segs[i].partner
|
<< (uint32_t)segs[i].partner
|
||||||
<< (DWORD)segs[i].linedef
|
<< (uint32_t)segs[i].linedef
|
||||||
<< (BYTE)segs[i].side;
|
<< (uint8_t)segs[i].side;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FProcessor::WriteNodesX (FWadWriter &out, const MapNodeEx *nodes, int numnodes, int nodever)
|
void FProcessor::WriteNodesX (FWadWriter &out, const MapNodeEx *nodes, int numnodes, int nodever)
|
||||||
{
|
{
|
||||||
out << (DWORD)numnodes;
|
out << (uint32_t)numnodes;
|
||||||
|
|
||||||
for (int i = 0; i < numnodes; ++i)
|
for (int i = 0; i < numnodes; ++i)
|
||||||
{
|
{
|
||||||
if (nodever < 3)
|
if (nodever < 3)
|
||||||
{
|
{
|
||||||
out << (SWORD)(nodes[i].x >> 16)
|
out << (int16_t)(nodes[i].x >> 16)
|
||||||
<< (SWORD)(nodes[i].y >> 16)
|
<< (int16_t)(nodes[i].y >> 16)
|
||||||
<< (SWORD)(nodes[i].dx >> 16)
|
<< (int16_t)(nodes[i].dx >> 16)
|
||||||
<< (SWORD)(nodes[i].dy >> 16);
|
<< (int16_t)(nodes[i].dy >> 16);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << (DWORD)nodes[i].x
|
out << (uint32_t)nodes[i].x
|
||||||
<< (DWORD)nodes[i].y
|
<< (uint32_t)nodes[i].y
|
||||||
<< (DWORD)nodes[i].dx
|
<< (uint32_t)nodes[i].dx
|
||||||
<< (DWORD)nodes[i].dy;
|
<< (uint32_t)nodes[i].dy;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < 2; ++j)
|
for (int j = 0; j < 2; ++j)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < 4; ++k)
|
for (int k = 0; k < 4; ++k)
|
||||||
{
|
{
|
||||||
out << (SWORD)nodes[i].bbox[j][k];
|
out << (int16_t)nodes[i].bbox[j][k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out << (DWORD)nodes[i].children[0]
|
out << (uint32_t)nodes[i].children[0]
|
||||||
<< (DWORD)nodes[i].children[1];
|
<< (uint32_t)nodes[i].children[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1719,7 +1719,7 @@ ZLibOut::~ZLibOut ()
|
||||||
Out.AddToLump (Buffer, BUFFER_SIZE - Stream.avail_out);
|
Out.AddToLump (Buffer, BUFFER_SIZE - Stream.avail_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLibOut::Write (BYTE *data, int len)
|
void ZLibOut::Write (uint8_t *data, int len)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -1742,36 +1742,36 @@ void ZLibOut::Write (BYTE *data, int len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZLibOut &ZLibOut::operator << (BYTE val)
|
ZLibOut &ZLibOut::operator << (uint8_t val)
|
||||||
{
|
{
|
||||||
Write (&val, 1);
|
Write (&val, 1);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZLibOut &ZLibOut::operator << (WORD val)
|
ZLibOut &ZLibOut::operator << (uint16_t val)
|
||||||
{
|
{
|
||||||
val = LittleShort(val);
|
val = LittleShort(val);
|
||||||
Write ((BYTE *)&val, 2);
|
Write ((uint8_t *)&val, 2);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZLibOut &ZLibOut::operator << (SWORD val)
|
ZLibOut &ZLibOut::operator << (int16_t val)
|
||||||
{
|
{
|
||||||
val = LittleShort(val);
|
val = LittleShort(val);
|
||||||
Write ((BYTE *)&val, 2);
|
Write ((uint8_t *)&val, 2);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZLibOut &ZLibOut::operator << (DWORD val)
|
ZLibOut &ZLibOut::operator << (uint32_t val)
|
||||||
{
|
{
|
||||||
val = LittleLong(val);
|
val = LittleLong(val);
|
||||||
Write ((BYTE *)&val, 4);
|
Write ((uint8_t *)&val, 4);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZLibOut &ZLibOut::operator << (fixed_t val)
|
ZLibOut &ZLibOut::operator << (fixed_t val)
|
||||||
{
|
{
|
||||||
val = LittleLong(val);
|
val = LittleLong(val);
|
||||||
Write ((BYTE *)&val, 4);
|
Write ((uint8_t *)&val, 4);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,18 +16,18 @@ public:
|
||||||
ZLibOut(FWadWriter &out);
|
ZLibOut(FWadWriter &out);
|
||||||
~ZLibOut();
|
~ZLibOut();
|
||||||
|
|
||||||
ZLibOut &operator << (BYTE);
|
ZLibOut &operator << (uint8_t);
|
||||||
ZLibOut &operator << (WORD);
|
ZLibOut &operator << (uint16_t);
|
||||||
ZLibOut &operator << (SWORD);
|
ZLibOut &operator << (int16_t);
|
||||||
ZLibOut &operator << (DWORD);
|
ZLibOut &operator << (uint32_t);
|
||||||
ZLibOut &operator << (fixed_t);
|
ZLibOut &operator << (fixed_t);
|
||||||
void Write(BYTE *data, int len);
|
void Write(uint8_t *data, int len);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { BUFFER_SIZE = 8192 };
|
enum { BUFFER_SIZE = 8192 };
|
||||||
|
|
||||||
z_stream Stream;
|
z_stream Stream;
|
||||||
BYTE Buffer[BUFFER_SIZE];
|
uint8_t Buffer[BUFFER_SIZE];
|
||||||
|
|
||||||
FWadWriter &Out;
|
FWadWriter &Out;
|
||||||
};
|
};
|
||||||
|
@ -54,7 +54,7 @@ private:
|
||||||
MapSubsectorEx *SubsectorsToEx(const MapSubsector *ssec, int count);
|
MapSubsectorEx *SubsectorsToEx(const MapSubsector *ssec, int count);
|
||||||
MapSegGLEx *SegGLsToEx(const MapSegGL *segs, int count);
|
MapSegGLEx *SegGLsToEx(const MapSegGL *segs, int count);
|
||||||
|
|
||||||
BYTE *FixReject(const BYTE *oldreject);
|
uint8_t *FixReject(const uint8_t *oldreject);
|
||||||
bool CheckForFracSplitters(const MapNodeEx *nodes, int count);
|
bool CheckForFracSplitters(const MapNodeEx *nodes, int count);
|
||||||
|
|
||||||
void WriteLines(FWadWriter &out);
|
void WriteLines(FWadWriter &out);
|
||||||
|
|
|
@ -17,6 +17,6 @@ struct node_t
|
||||||
|
|
||||||
struct subsector_t
|
struct subsector_t
|
||||||
{
|
{
|
||||||
DWORD numlines;
|
uint32_t numlines;
|
||||||
DWORD firstline;
|
uint32_t firstline;
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,11 +73,11 @@ void FNodeBuilder::BuildTree ()
|
||||||
fprintf (stderr, " BSP: 100.0%%\n");
|
fprintf (stderr, " BSP: 100.0%%\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD FNodeBuilder::CreateNode (DWORD set, unsigned int count, fixed_t bbox[4])
|
uint32_t FNodeBuilder::CreateNode (uint32_t set, unsigned int count, fixed_t bbox[4])
|
||||||
{
|
{
|
||||||
node_t node;
|
node_t node;
|
||||||
int skip, selstat;
|
int skip, selstat;
|
||||||
DWORD splitseg;
|
uint32_t splitseg;
|
||||||
|
|
||||||
// When building GL nodes, count may not be an exact count of the number of segs
|
// When building GL nodes, count may not be an exact count of the number of segs
|
||||||
// in this set. That's okay, because we just use it to get a skip count, so an
|
// in this set. That's okay, because we just use it to get a skip count, so an
|
||||||
|
@ -91,7 +91,7 @@ DWORD FNodeBuilder::CreateNode (DWORD set, unsigned int count, fixed_t bbox[4])
|
||||||
CheckSubsector (set, node, splitseg))
|
CheckSubsector (set, node, splitseg))
|
||||||
{
|
{
|
||||||
// Create a normal node
|
// Create a normal node
|
||||||
DWORD set1, set2;
|
uint32_t set1, set2;
|
||||||
unsigned int count1, count2;
|
unsigned int count1, count2;
|
||||||
|
|
||||||
SplitSegs (set, node, splitseg, set1, set2, count1, count2);
|
SplitSegs (set, node, splitseg, set1, set2, count1, count2);
|
||||||
|
@ -112,7 +112,7 @@ DWORD FNodeBuilder::CreateNode (DWORD set, unsigned int count, fixed_t bbox[4])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD FNodeBuilder::CreateSubsector (DWORD set, fixed_t bbox[4])
|
uint32_t FNodeBuilder::CreateSubsector (uint32_t set, fixed_t bbox[4])
|
||||||
{
|
{
|
||||||
int ssnum, count;
|
int ssnum, count;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ DWORD FNodeBuilder::CreateSubsector (DWORD set, fixed_t bbox[4])
|
||||||
|
|
||||||
#if defined(_DEBUG)// || 1
|
#if defined(_DEBUG)// || 1
|
||||||
// Check for segs with duplicate start/end vertices
|
// Check for segs with duplicate start/end vertices
|
||||||
DWORD s1, s2;
|
uint32_t s1, s2;
|
||||||
|
|
||||||
for (s1 = set; s1 != DWORD_MAX; s1 = Segs[s1].next)
|
for (s1 = set; s1 != DWORD_MAX; s1 = Segs[s1].next)
|
||||||
{
|
{
|
||||||
|
@ -181,9 +181,9 @@ void FNodeBuilder::CreateSubsectorsForReal ()
|
||||||
for (i = 0; i < SubsectorSets.Size(); ++i)
|
for (i = 0; i < SubsectorSets.Size(); ++i)
|
||||||
{
|
{
|
||||||
subsector_t sub;
|
subsector_t sub;
|
||||||
DWORD set = SubsectorSets[i];
|
uint32_t set = SubsectorSets[i];
|
||||||
|
|
||||||
sub.firstline = (DWORD)SegList.Size();
|
sub.firstline = (uint32_t)SegList.Size();
|
||||||
while (set != DWORD_MAX)
|
while (set != DWORD_MAX)
|
||||||
{
|
{
|
||||||
USegPtr ptr;
|
USegPtr ptr;
|
||||||
|
@ -192,7 +192,7 @@ void FNodeBuilder::CreateSubsectorsForReal ()
|
||||||
SegList.Push (ptr);
|
SegList.Push (ptr);
|
||||||
set = ptr.SegPtr->next;
|
set = ptr.SegPtr->next;
|
||||||
}
|
}
|
||||||
sub.numlines = (DWORD)(SegList.Size() - sub.firstline);
|
sub.numlines = (uint32_t)(SegList.Size() - sub.firstline);
|
||||||
|
|
||||||
// Sort segs by linedef for special effects
|
// Sort segs by linedef for special effects
|
||||||
qsort (&SegList[sub.firstline], sub.numlines, sizeof(USegPtr), SortSegs);
|
qsort (&SegList[sub.firstline], sub.numlines, sizeof(USegPtr), SortSegs);
|
||||||
|
@ -215,7 +215,7 @@ void FNodeBuilder::CreateSubsectorsForReal ()
|
||||||
Vertices[SegList[i].SegPtr->v2].y>>16,
|
Vertices[SegList[i].SegPtr->v2].y>>16,
|
||||||
Vertices[SegList[i].SegPtr->v1].x, Vertices[SegList[i].SegPtr->v1].y,
|
Vertices[SegList[i].SegPtr->v1].x, Vertices[SegList[i].SegPtr->v1].y,
|
||||||
Vertices[SegList[i].SegPtr->v2].x, Vertices[SegList[i].SegPtr->v2].y));
|
Vertices[SegList[i].SegPtr->v2].x, Vertices[SegList[i].SegPtr->v2].y));
|
||||||
SegList[i].SegNum = DWORD(SegList[i].SegPtr - &Segs[0]);
|
SegList[i].SegNum = uint32_t(SegList[i].SegPtr - &Segs[0]);
|
||||||
}
|
}
|
||||||
Subsectors.Push (sub);
|
Subsectors.Push (sub);
|
||||||
}
|
}
|
||||||
|
@ -286,10 +286,10 @@ int STACK_ARGS FNodeBuilder::SortSegs (const void *a, const void *b)
|
||||||
// a splitter is synthesized, and true is returned to continue processing
|
// a splitter is synthesized, and true is returned to continue processing
|
||||||
// down this branch of the tree.
|
// down this branch of the tree.
|
||||||
|
|
||||||
bool FNodeBuilder::CheckSubsector (DWORD set, node_t &node, DWORD &splitseg)
|
bool FNodeBuilder::CheckSubsector (uint32_t set, node_t &node, uint32_t &splitseg)
|
||||||
{
|
{
|
||||||
int sec;
|
int sec;
|
||||||
DWORD seg;
|
uint32_t seg;
|
||||||
|
|
||||||
sec = -1;
|
sec = -1;
|
||||||
seg = set;
|
seg = set;
|
||||||
|
@ -347,10 +347,10 @@ bool FNodeBuilder::CheckSubsector (DWORD set, node_t &node, DWORD &splitseg)
|
||||||
// When creating GL nodes, we need to check for segs with the same start and
|
// When creating GL nodes, we need to check for segs with the same start and
|
||||||
// end vertices and split them into two subsectors.
|
// end vertices and split them into two subsectors.
|
||||||
|
|
||||||
bool FNodeBuilder::CheckSubsectorOverlappingSegs (DWORD set, node_t &node, DWORD &splitseg)
|
bool FNodeBuilder::CheckSubsectorOverlappingSegs (uint32_t set, node_t &node, uint32_t &splitseg)
|
||||||
{
|
{
|
||||||
int v1, v2;
|
int v1, v2;
|
||||||
DWORD seg1, seg2;
|
uint32_t seg1, seg2;
|
||||||
|
|
||||||
for (seg1 = set; seg1 != DWORD_MAX; seg1 = Segs[seg1].next)
|
for (seg1 = set; seg1 != DWORD_MAX; seg1 = Segs[seg1].next)
|
||||||
{
|
{
|
||||||
|
@ -390,7 +390,7 @@ bool FNodeBuilder::CheckSubsectorOverlappingSegs (DWORD set, node_t &node, DWORD
|
||||||
// seg in front of the splitter is partnered with a new miniseg on
|
// seg in front of the splitter is partnered with a new miniseg on
|
||||||
// the back so that the back will have two segs.
|
// the back so that the back will have two segs.
|
||||||
|
|
||||||
bool FNodeBuilder::ShoveSegBehind (DWORD set, node_t &node, DWORD seg, DWORD mate)
|
bool FNodeBuilder::ShoveSegBehind (uint32_t set, node_t &node, uint32_t seg, uint32_t mate)
|
||||||
{
|
{
|
||||||
SetNodeFromSeg (node, &Segs[seg]);
|
SetNodeFromSeg (node, &Segs[seg]);
|
||||||
HackSeg = seg;
|
HackSeg = seg;
|
||||||
|
@ -412,12 +412,12 @@ bool FNodeBuilder::ShoveSegBehind (DWORD set, node_t &node, DWORD seg, DWORD mat
|
||||||
// each unique plane needs to be considered as a splitter. A result of 0 means
|
// each unique plane needs to be considered as a splitter. A result of 0 means
|
||||||
// this set is a convex region. A result of -1 means that there were possible
|
// this set is a convex region. A result of -1 means that there were possible
|
||||||
// splitters, but they all split segs we want to keep intact.
|
// splitters, but they all split segs we want to keep intact.
|
||||||
int FNodeBuilder::SelectSplitter (DWORD set, node_t &node, DWORD &splitseg, int step, bool nosplit)
|
int FNodeBuilder::SelectSplitter (uint32_t set, node_t &node, uint32_t &splitseg, int step, bool nosplit)
|
||||||
{
|
{
|
||||||
int stepleft;
|
int stepleft;
|
||||||
int bestvalue;
|
int bestvalue;
|
||||||
DWORD bestseg;
|
uint32_t bestseg;
|
||||||
DWORD seg;
|
uint32_t seg;
|
||||||
bool nosplitters = false;
|
bool nosplitters = false;
|
||||||
|
|
||||||
bestvalue = 0;
|
bestvalue = 0;
|
||||||
|
@ -494,7 +494,7 @@ int FNodeBuilder::SelectSplitter (DWORD set, node_t &node, DWORD &splitseg, int
|
||||||
// true. A score of 0 means that the splitter does not split any of the segs
|
// true. A score of 0 means that the splitter does not split any of the segs
|
||||||
// in the set.
|
// in the set.
|
||||||
|
|
||||||
int FNodeBuilder::Heuristic (node_t &node, DWORD set, bool honorNoSplit)
|
int FNodeBuilder::Heuristic (node_t &node, uint32_t set, bool honorNoSplit)
|
||||||
{
|
{
|
||||||
// Set the initial score above 0 so that near vertex anti-weighting is less likely to produce a negative score.
|
// Set the initial score above 0 so that near vertex anti-weighting is less likely to produce a negative score.
|
||||||
int score = 1000000;
|
int score = 1000000;
|
||||||
|
@ -502,7 +502,7 @@ int FNodeBuilder::Heuristic (node_t &node, DWORD set, bool honorNoSplit)
|
||||||
int counts[2] = { 0, 0 };
|
int counts[2] = { 0, 0 };
|
||||||
int realSegs[2] = { 0, 0 };
|
int realSegs[2] = { 0, 0 };
|
||||||
int specialSegs[2] = { 0, 0 };
|
int specialSegs[2] = { 0, 0 };
|
||||||
DWORD i = set;
|
uint32_t i = set;
|
||||||
int sidev[2];
|
int sidev[2];
|
||||||
int side;
|
int side;
|
||||||
bool splitter = false;
|
bool splitter = false;
|
||||||
|
@ -733,7 +733,7 @@ int FNodeBuilder::Heuristic (node_t &node, DWORD set, bool honorNoSplit)
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &outset0, DWORD &outset1, unsigned int &count0, unsigned int &count1)
|
void FNodeBuilder::SplitSegs (uint32_t set, node_t &node, uint32_t splitseg, uint32_t &outset0, uint32_t &outset1, unsigned int &count0, unsigned int &count1)
|
||||||
{
|
{
|
||||||
unsigned int _count0 = 0;
|
unsigned int _count0 = 0;
|
||||||
unsigned int _count1 = 0;
|
unsigned int _count1 = 0;
|
||||||
|
@ -865,7 +865,7 @@ void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &ou
|
||||||
}
|
}
|
||||||
if (hack && GLNodes)
|
if (hack && GLNodes)
|
||||||
{
|
{
|
||||||
DWORD newback, newfront;
|
uint32_t newback, newfront;
|
||||||
|
|
||||||
newback = AddMiniseg (seg->v2, seg->v1, DWORD_MAX, set, splitseg);
|
newback = AddMiniseg (seg->v2, seg->v1, DWORD_MAX, set, splitseg);
|
||||||
if (HackMate == DWORD_MAX)
|
if (HackMate == DWORD_MAX)
|
||||||
|
@ -917,7 +917,7 @@ void FNodeBuilder::SetNodeFromSeg (node_t &node, const FPrivSeg *pseg) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD FNodeBuilder::SplitSeg (DWORD segnum, int splitvert, int v1InFront)
|
uint32_t FNodeBuilder::SplitSeg (uint32_t segnum, int splitvert, int v1InFront)
|
||||||
{
|
{
|
||||||
double dx, dy;
|
double dx, dy;
|
||||||
FPrivSeg newseg;
|
FPrivSeg newseg;
|
||||||
|
@ -970,7 +970,7 @@ DWORD FNodeBuilder::SplitSeg (DWORD segnum, int splitvert, int v1InFront)
|
||||||
return newnum;
|
return newnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FNodeBuilder::RemoveSegFromVert1 (DWORD segnum, int vertnum)
|
void FNodeBuilder::RemoveSegFromVert1 (uint32_t segnum, int vertnum)
|
||||||
{
|
{
|
||||||
FPrivVert *v = &Vertices[vertnum];
|
FPrivVert *v = &Vertices[vertnum];
|
||||||
|
|
||||||
|
@ -980,7 +980,7 @@ void FNodeBuilder::RemoveSegFromVert1 (DWORD segnum, int vertnum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD prev, curr;
|
uint32_t prev, curr;
|
||||||
prev = 0;
|
prev = 0;
|
||||||
curr = v->segs;
|
curr = v->segs;
|
||||||
while (curr != DWORD_MAX && curr != segnum)
|
while (curr != DWORD_MAX && curr != segnum)
|
||||||
|
@ -995,7 +995,7 @@ void FNodeBuilder::RemoveSegFromVert1 (DWORD segnum, int vertnum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FNodeBuilder::RemoveSegFromVert2 (DWORD segnum, int vertnum)
|
void FNodeBuilder::RemoveSegFromVert2 (uint32_t segnum, int vertnum)
|
||||||
{
|
{
|
||||||
FPrivVert *v = &Vertices[vertnum];
|
FPrivVert *v = &Vertices[vertnum];
|
||||||
|
|
||||||
|
@ -1005,7 +1005,7 @@ void FNodeBuilder::RemoveSegFromVert2 (DWORD segnum, int vertnum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD prev, curr;
|
uint32_t prev, curr;
|
||||||
prev = 0;
|
prev = 0;
|
||||||
curr = v->segs2;
|
curr = v->segs2;
|
||||||
while (curr != DWORD_MAX && curr != segnum)
|
while (curr != DWORD_MAX && curr != segnum)
|
||||||
|
@ -1041,7 +1041,7 @@ double FNodeBuilder::InterceptVector (const node_t &splitter, const FPrivSeg &se
|
||||||
return num / den;
|
return num / den;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FNodeBuilder::PrintSet (int l, DWORD set)
|
void FNodeBuilder::PrintSet (int l, uint32_t set)
|
||||||
{
|
{
|
||||||
Printf ("set %d:\n", l);
|
Printf ("set %d:\n", l);
|
||||||
for (; set != DWORD_MAX; set = Segs[set].next)
|
for (; set != DWORD_MAX; set = Segs[set].next)
|
||||||
|
@ -1078,7 +1078,7 @@ int ClassifyLineBackpatchC (node_t &node, const FSimpleVert *v1, const FSimpleVe
|
||||||
int *calleroffset;
|
int *calleroffset;
|
||||||
int diff;
|
int diff;
|
||||||
int (*func)(node_t &, const FSimpleVert *, const FSimpleVert *, int[2]);
|
int (*func)(node_t &, const FSimpleVert *, const FSimpleVert *, int[2]);
|
||||||
DWORD oldprotect;
|
uint32_t oldprotect;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
calleroffset = (int *)__builtin_return_address(0);
|
calleroffset = (int *)__builtin_return_address(0);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
struct FEventInfo
|
struct FEventInfo
|
||||||
{
|
{
|
||||||
int Vertex;
|
int Vertex;
|
||||||
DWORD FrontSeg;
|
uint32_t FrontSeg;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FEvent
|
struct FEvent
|
||||||
|
@ -74,16 +74,16 @@ class FNodeBuilder
|
||||||
struct FPrivSeg
|
struct FPrivSeg
|
||||||
{
|
{
|
||||||
int v1, v2;
|
int v1, v2;
|
||||||
DWORD sidedef;
|
uint32_t sidedef;
|
||||||
int linedef;
|
int linedef;
|
||||||
int frontsector;
|
int frontsector;
|
||||||
int backsector;
|
int backsector;
|
||||||
DWORD next;
|
uint32_t next;
|
||||||
DWORD nextforvert;
|
uint32_t nextforvert;
|
||||||
DWORD nextforvert2;
|
uint32_t nextforvert2;
|
||||||
int loopnum; // loop number for split avoidance (0 means splitting is okay)
|
int loopnum; // loop number for split avoidance (0 means splitting is okay)
|
||||||
DWORD partner; // seg on back side
|
uint32_t partner; // seg on back side
|
||||||
DWORD storedseg; // seg # in the GL_SEGS lump
|
uint32_t storedseg; // seg # in the GL_SEGS lump
|
||||||
angle_t angle;
|
angle_t angle;
|
||||||
fixed_t offset;
|
fixed_t offset;
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ class FNodeBuilder
|
||||||
};
|
};
|
||||||
struct FPrivVert : FSimpleVert
|
struct FPrivVert : FSimpleVert
|
||||||
{
|
{
|
||||||
DWORD segs; // segs that use this vertex as v1
|
uint32_t segs; // segs that use this vertex as v1
|
||||||
DWORD segs2; // segs that use this vertex as v2
|
uint32_t segs2; // segs that use this vertex as v2
|
||||||
int index;
|
int index;
|
||||||
int pad; // This structure must be 8-byte aligned.
|
int pad; // This structure must be 8-byte aligned.
|
||||||
|
|
||||||
|
@ -109,13 +109,13 @@ class FNodeBuilder
|
||||||
};
|
};
|
||||||
union USegPtr
|
union USegPtr
|
||||||
{
|
{
|
||||||
DWORD SegNum;
|
uint32_t SegNum;
|
||||||
FPrivSeg *SegPtr;
|
FPrivSeg *SegPtr;
|
||||||
};
|
};
|
||||||
struct FSplitSharer
|
struct FSplitSharer
|
||||||
{
|
{
|
||||||
double Distance;
|
double Distance;
|
||||||
DWORD Seg;
|
uint32_t Seg;
|
||||||
bool Forward;
|
bool Forward;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,11 +185,11 @@ private:
|
||||||
|
|
||||||
TArray<node_t> Nodes;
|
TArray<node_t> Nodes;
|
||||||
TArray<subsector_t> Subsectors;
|
TArray<subsector_t> Subsectors;
|
||||||
TArray<DWORD> SubsectorSets;
|
TArray<uint32_t> SubsectorSets;
|
||||||
TArray<FPrivSeg> Segs;
|
TArray<FPrivSeg> Segs;
|
||||||
TArray<FPrivVert> Vertices;
|
TArray<FPrivVert> Vertices;
|
||||||
TArray<USegPtr> SegList;
|
TArray<USegPtr> SegList;
|
||||||
TArray<BYTE> PlaneChecked;
|
TArray<uint8_t> PlaneChecked;
|
||||||
TArray<FSimpleLine> Planes;
|
TArray<FSimpleLine> Planes;
|
||||||
size_t InitialVertices; // Number of vertices in a map that are connected to linedefs
|
size_t InitialVertices; // Number of vertices in a map that are connected to linedefs
|
||||||
|
|
||||||
|
@ -198,8 +198,8 @@ private:
|
||||||
FEventTree Events; // Vertices intersected by the current splitter
|
FEventTree Events; // Vertices intersected by the current splitter
|
||||||
TArray<FSplitSharer> SplitSharers; // Segs collinear with the current splitter
|
TArray<FSplitSharer> SplitSharers; // Segs collinear with the current splitter
|
||||||
|
|
||||||
DWORD HackSeg; // Seg to force to back of splitter
|
uint32_t HackSeg; // Seg to force to back of splitter
|
||||||
DWORD HackMate; // Seg to use in front of hack seg
|
uint32_t HackMate; // Seg to use in front of hack seg
|
||||||
FLevel &Level;
|
FLevel &Level;
|
||||||
bool GLNodes;
|
bool GLNodes;
|
||||||
|
|
||||||
|
@ -214,18 +214,18 @@ private:
|
||||||
void GroupSegPlanes ();
|
void GroupSegPlanes ();
|
||||||
void FindPolyContainers (TArray<FPolyStart> &spots, TArray<FPolyStart> &anchors);
|
void FindPolyContainers (TArray<FPolyStart> &spots, TArray<FPolyStart> &anchors);
|
||||||
bool GetPolyExtents (int polynum, fixed_t bbox[4]);
|
bool GetPolyExtents (int polynum, fixed_t bbox[4]);
|
||||||
int MarkLoop (DWORD firstseg, int loopnum);
|
int MarkLoop (uint32_t firstseg, int loopnum);
|
||||||
void AddSegToBBox (fixed_t bbox[4], const FPrivSeg *seg);
|
void AddSegToBBox (fixed_t bbox[4], const FPrivSeg *seg);
|
||||||
DWORD CreateNode (DWORD set, unsigned int count, fixed_t bbox[4]);
|
uint32_t CreateNode (uint32_t set, unsigned int count, fixed_t bbox[4]);
|
||||||
DWORD CreateSubsector (DWORD set, fixed_t bbox[4]);
|
uint32_t CreateSubsector (uint32_t set, fixed_t bbox[4]);
|
||||||
void CreateSubsectorsForReal ();
|
void CreateSubsectorsForReal ();
|
||||||
bool CheckSubsector (DWORD set, node_t &node, DWORD &splitseg);
|
bool CheckSubsector (uint32_t set, node_t &node, uint32_t &splitseg);
|
||||||
bool CheckSubsectorOverlappingSegs (DWORD set, node_t &node, DWORD &splitseg);
|
bool CheckSubsectorOverlappingSegs (uint32_t set, node_t &node, uint32_t &splitseg);
|
||||||
bool ShoveSegBehind (DWORD set, node_t &node, DWORD seg, DWORD mate);
|
bool ShoveSegBehind (uint32_t set, node_t &node, uint32_t seg, uint32_t mate);
|
||||||
int SelectSplitter (DWORD set, node_t &node, DWORD &splitseg, int step, bool nosplit);
|
int SelectSplitter (uint32_t set, node_t &node, uint32_t &splitseg, int step, bool nosplit);
|
||||||
void SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &outset0, DWORD &outset1, unsigned int &count0, unsigned int &count1);
|
void SplitSegs (uint32_t set, node_t &node, uint32_t splitseg, uint32_t &outset0, uint32_t &outset1, unsigned int &count0, unsigned int &count1);
|
||||||
DWORD SplitSeg (DWORD segnum, int splitvert, int v1InFront);
|
uint32_t SplitSeg (uint32_t segnum, int splitvert, int v1InFront);
|
||||||
int Heuristic (node_t &node, DWORD set, bool honorNoSplit);
|
int Heuristic (node_t &node, uint32_t set, bool honorNoSplit);
|
||||||
|
|
||||||
// Returns:
|
// Returns:
|
||||||
// 0 = seg is in front
|
// 0 = seg is in front
|
||||||
|
@ -236,19 +236,19 @@ private:
|
||||||
|
|
||||||
void FixSplitSharers ();
|
void FixSplitSharers ();
|
||||||
double AddIntersection (const node_t &node, int vertex);
|
double AddIntersection (const node_t &node, int vertex);
|
||||||
void AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, DWORD &rset);
|
void AddMinisegs (const node_t &node, uint32_t splitseg, uint32_t &fset, uint32_t &rset);
|
||||||
DWORD CheckLoopStart (fixed_t dx, fixed_t dy, int vertex1, int vertex2);
|
uint32_t CheckLoopStart (fixed_t dx, fixed_t dy, int vertex1, int vertex2);
|
||||||
DWORD CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex2);
|
uint32_t CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex2);
|
||||||
void RemoveSegFromVert1 (DWORD segnum, int vertnum);
|
void RemoveSegFromVert1 (uint32_t segnum, int vertnum);
|
||||||
void RemoveSegFromVert2 (DWORD segnum, int vertnum);
|
void RemoveSegFromVert2 (uint32_t segnum, int vertnum);
|
||||||
DWORD AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD splitseg);
|
uint32_t AddMiniseg (int v1, int v2, uint32_t partner, uint32_t seg1, uint32_t splitseg);
|
||||||
void SetNodeFromSeg (node_t &node, const FPrivSeg *pseg) const;
|
void SetNodeFromSeg (node_t &node, const FPrivSeg *pseg) const;
|
||||||
|
|
||||||
int RemoveMinisegs (MapNodeEx *nodes, TArray<MapSegEx> &segs, MapSubsectorEx *subs, int node, short bbox[4]);
|
int RemoveMinisegs (MapNodeEx *nodes, TArray<MapSegEx> &segs, MapSubsectorEx *subs, int node, short bbox[4]);
|
||||||
int StripMinisegs (TArray<MapSegEx> &segs, int subsector, short bbox[4]);
|
int StripMinisegs (TArray<MapSegEx> &segs, int subsector, short bbox[4]);
|
||||||
void AddSegToShortBBox (short bbox[4], const FPrivSeg *seg);
|
void AddSegToShortBBox (short bbox[4], const FPrivSeg *seg);
|
||||||
int CloseSubsector (TArray<MapSegGLEx> &segs, int subsector);
|
int CloseSubsector (TArray<MapSegGLEx> &segs, int subsector);
|
||||||
DWORD PushGLSeg (TArray<MapSegGLEx> &segs, const FPrivSeg *seg);
|
uint32_t PushGLSeg (TArray<MapSegGLEx> &segs, const FPrivSeg *seg);
|
||||||
void PushConnectingGLSeg (int subsector, TArray<MapSegGLEx> &segs, int v1, int v2);
|
void PushConnectingGLSeg (int subsector, TArray<MapSegGLEx> &segs, int v1, int v2);
|
||||||
int OutputDegenerateSubsector (TArray<MapSegGLEx> &segs, int subsector, bool bForward, double lastdot, FPrivSeg *&prev);
|
int OutputDegenerateSubsector (TArray<MapSegGLEx> &segs, int subsector, bool bForward, double lastdot, FPrivSeg *&prev);
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ private:
|
||||||
|
|
||||||
double InterceptVector (const node_t &splitter, const FPrivSeg &seg);
|
double InterceptVector (const node_t &splitter, const FPrivSeg &seg);
|
||||||
|
|
||||||
void PrintSet (int l, DWORD set);
|
void PrintSet (int l, uint32_t set);
|
||||||
void DumpNodes(MapNodeEx *outNodes, int nodeCount);
|
void DumpNodes(MapNodeEx *outNodes, int nodeCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -317,7 +317,7 @@ int FNodeBuilder::OutputDegenerateSubsector (TArray<MapSegGLEx> &segs, int subse
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD FNodeBuilder::PushGLSeg (TArray<MapSegGLEx> &segs, const FPrivSeg *seg)
|
uint32_t FNodeBuilder::PushGLSeg (TArray<MapSegGLEx> &segs, const FPrivSeg *seg)
|
||||||
{
|
{
|
||||||
MapSegGLEx newseg;
|
MapSegGLEx newseg;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ void FNodeBuilder::FixSplitSharers ()
|
||||||
D(Events.PrintTree());
|
D(Events.PrintTree());
|
||||||
for (unsigned int i = 0; i < SplitSharers.Size(); ++i)
|
for (unsigned int i = 0; i < SplitSharers.Size(); ++i)
|
||||||
{
|
{
|
||||||
DWORD seg = SplitSharers[i].Seg;
|
uint32_t seg = SplitSharers[i].Seg;
|
||||||
int v2 = Segs[seg].v2;
|
int v2 = Segs[seg].v2;
|
||||||
FEvent *event = Events.FindEvent (SplitSharers[i].Distance);
|
FEvent *event = Events.FindEvent (SplitSharers[i].Distance);
|
||||||
FEvent *next;
|
FEvent *next;
|
||||||
|
@ -119,12 +119,12 @@ void FNodeBuilder::FixSplitSharers ()
|
||||||
Vertices[event->Info.Vertex].y>>16,
|
Vertices[event->Info.Vertex].y>>16,
|
||||||
event->Distance));
|
event->Distance));
|
||||||
|
|
||||||
DWORD newseg = SplitSeg (seg, event->Info.Vertex, 1);
|
uint32_t newseg = SplitSeg (seg, event->Info.Vertex, 1);
|
||||||
|
|
||||||
Segs[newseg].next = Segs[seg].next;
|
Segs[newseg].next = Segs[seg].next;
|
||||||
Segs[seg].next = newseg;
|
Segs[seg].next = newseg;
|
||||||
|
|
||||||
DWORD partner = Segs[seg].partner;
|
uint32_t partner = Segs[seg].partner;
|
||||||
if (partner != DWORD_MAX)
|
if (partner != DWORD_MAX)
|
||||||
{
|
{
|
||||||
int endpartner = SplitSeg (partner, event->Info.Vertex, 1);
|
int endpartner = SplitSeg (partner, event->Info.Vertex, 1);
|
||||||
|
@ -159,7 +159,7 @@ void FNodeBuilder::FixSplitSharers ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, DWORD &bset)
|
void FNodeBuilder::AddMinisegs (const node_t &node, uint32_t splitseg, uint32_t &fset, uint32_t &bset)
|
||||||
{
|
{
|
||||||
FEvent *event = Events.GetMinimum (), *prev = NULL;
|
FEvent *event = Events.GetMinimum (), *prev = NULL;
|
||||||
|
|
||||||
|
@ -167,8 +167,8 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset,
|
||||||
{
|
{
|
||||||
if (prev != NULL)
|
if (prev != NULL)
|
||||||
{
|
{
|
||||||
DWORD fseg1, bseg1, fseg2, bseg2;
|
uint32_t fseg1, bseg1, fseg2, bseg2;
|
||||||
DWORD fnseg, bnseg;
|
uint32_t fnseg, bnseg;
|
||||||
|
|
||||||
// Minisegs should only be added when they can create valid loops on both the front and
|
// Minisegs should only be added when they can create valid loops on both the front and
|
||||||
// back of the splitter. This means some subsectors could be unclosed if their sectors
|
// back of the splitter. This means some subsectors could be unclosed if their sectors
|
||||||
|
@ -225,9 +225,9 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD FNodeBuilder::AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD splitseg)
|
uint32_t FNodeBuilder::AddMiniseg (int v1, int v2, uint32_t partner, uint32_t seg1, uint32_t splitseg)
|
||||||
{
|
{
|
||||||
DWORD nseg;
|
uint32_t nseg;
|
||||||
FPrivSeg *seg = &Segs[seg1];
|
FPrivSeg *seg = &Segs[seg1];
|
||||||
FPrivSeg newseg;
|
FPrivSeg newseg;
|
||||||
|
|
||||||
|
@ -279,13 +279,13 @@ DWORD FNodeBuilder::AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD
|
||||||
return nseg;
|
return nseg;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int vertex2)
|
uint32_t FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int vertex2)
|
||||||
{
|
{
|
||||||
FPrivVert *v = &Vertices[vertex];
|
FPrivVert *v = &Vertices[vertex];
|
||||||
angle_t splitAngle = PointToAngle (dx, dy);
|
angle_t splitAngle = PointToAngle (dx, dy);
|
||||||
DWORD segnum;
|
uint32_t segnum;
|
||||||
angle_t bestang;
|
angle_t bestang;
|
||||||
DWORD bestseg;
|
uint32_t bestseg;
|
||||||
|
|
||||||
// Find the seg ending at this vertex that forms the smallest angle
|
// Find the seg ending at this vertex that forms the smallest angle
|
||||||
// to the splitter.
|
// to the splitter.
|
||||||
|
@ -338,13 +338,13 @@ DWORD FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int vert
|
||||||
return bestseg;
|
return bestseg;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD FNodeBuilder::CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex)
|
uint32_t FNodeBuilder::CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex)
|
||||||
{
|
{
|
||||||
FPrivVert *v = &Vertices[vertex];
|
FPrivVert *v = &Vertices[vertex];
|
||||||
angle_t splitAngle = PointToAngle (dx, dy) + ANGLE_180;
|
angle_t splitAngle = PointToAngle (dx, dy) + ANGLE_180;
|
||||||
DWORD segnum;
|
uint32_t segnum;
|
||||||
angle_t bestang;
|
angle_t bestang;
|
||||||
DWORD bestseg;
|
uint32_t bestseg;
|
||||||
|
|
||||||
// Find the seg starting at this vertex that forms the smallest angle
|
// Find the seg starting at this vertex that forms the smallest angle
|
||||||
// to the splitter.
|
// to the splitter.
|
||||||
|
|
|
@ -108,7 +108,7 @@ void FNodeBuilder::MakeSegsFromSides ()
|
||||||
int FNodeBuilder::CreateSeg (int linenum, int sidenum)
|
int FNodeBuilder::CreateSeg (int linenum, int sidenum)
|
||||||
{
|
{
|
||||||
FPrivSeg seg;
|
FPrivSeg seg;
|
||||||
DWORD backside;
|
uint32_t backside;
|
||||||
int segnum;
|
int segnum;
|
||||||
|
|
||||||
seg.next = DWORD_MAX;
|
seg.next = DWORD_MAX;
|
||||||
|
@ -287,7 +287,7 @@ void FNodeBuilder::FindPolyContainers (TArray<FPolyStart> &spots, TArray<FPolySt
|
||||||
// Scan right for the seg closest to the polyobject's center after it
|
// Scan right for the seg closest to the polyobject's center after it
|
||||||
// gets moved to its start spot.
|
// gets moved to its start spot.
|
||||||
fixed_t closestdist = FIXED_MAX;
|
fixed_t closestdist = FIXED_MAX;
|
||||||
DWORD closestseg = 0;
|
uint32_t closestseg = 0;
|
||||||
|
|
||||||
P(Printf ("start %d,%d -- center %d, %d\n", spot->x>>16, spot->y>>16, center.x>>16, center.y>>16));
|
P(Printf ("start %d,%d -- center %d, %d\n", spot->x>>16, spot->y>>16, center.x>>16, center.y>>16));
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ void FNodeBuilder::FindPolyContainers (TArray<FPolyStart> &spots, TArray<FPolySt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int FNodeBuilder::MarkLoop (DWORD firstseg, int loopnum)
|
int FNodeBuilder::MarkLoop (uint32_t firstseg, int loopnum)
|
||||||
{
|
{
|
||||||
int seg;
|
int seg;
|
||||||
int sec = Segs[firstseg].frontsector;
|
int sec = Segs[firstseg].frontsector;
|
||||||
|
@ -355,8 +355,8 @@ int FNodeBuilder::MarkLoop (DWORD firstseg, int loopnum)
|
||||||
Vertices[s1->v1].x>>16, Vertices[s1->v1].y>>16,
|
Vertices[s1->v1].x>>16, Vertices[s1->v1].y>>16,
|
||||||
Vertices[s1->v2].x>>16, Vertices[s1->v2].y>>16));
|
Vertices[s1->v2].x>>16, Vertices[s1->v2].y>>16));
|
||||||
|
|
||||||
DWORD bestseg = DWORD_MAX;
|
uint32_t bestseg = DWORD_MAX;
|
||||||
DWORD tryseg = Vertices[s1->v2].segs;
|
uint32_t tryseg = Vertices[s1->v2].segs;
|
||||||
angle_t bestang = ANGLE_MAX;
|
angle_t bestang = ANGLE_MAX;
|
||||||
angle_t ang1 = s1->angle;
|
angle_t ang1 = s1->angle;
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ static TArray<short> DesiredHistory;
|
||||||
|
|
||||||
static void DrawSubsector (HDC dc, int ssec)
|
static void DrawSubsector (HDC dc, int ssec)
|
||||||
{
|
{
|
||||||
for (DWORD i = 0; i < Level->Subsectors[ssec].numlines; ++i)
|
for (uint32_t i = 0; i < Level->Subsectors[ssec].numlines; ++i)
|
||||||
{
|
{
|
||||||
int seg = Level->Subsectors[ssec].firstline + i;
|
int seg = Level->Subsectors[ssec].firstline + i;
|
||||||
if (Level->Segs[seg].side == 0)
|
if (Level->Segs[seg].side == 0)
|
||||||
|
@ -256,7 +256,7 @@ static void DrawSubsectorGL (HDC dc, int ssec, HPEN miniPen, HPEN badPen)
|
||||||
|
|
||||||
seg = Level->GLSubsectors[ssec].firstline;
|
seg = Level->GLSubsectors[ssec].firstline;
|
||||||
MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1), NULL);
|
MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1), NULL);
|
||||||
for (DWORD i = 0; i < Level->GLSubsectors[ssec].numlines; ++i)
|
for (uint32_t i = 0; i < Level->GLSubsectors[ssec].numlines; ++i)
|
||||||
{
|
{
|
||||||
HPEN oldPen = NULL;
|
HPEN oldPen = NULL;
|
||||||
seg = Level->GLSubsectors[ssec].firstline + i;
|
seg = Level->GLSubsectors[ssec].firstline + i;
|
||||||
|
|
|
@ -415,10 +415,10 @@ void FWadWriter::WriteLump (const char *name, const void *data, int len)
|
||||||
|
|
||||||
void FWadWriter::CopyLump (FWadReader &wad, int lump)
|
void FWadWriter::CopyLump (FWadReader &wad, int lump)
|
||||||
{
|
{
|
||||||
BYTE *data;
|
uint8_t *data;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
ReadLump<BYTE> (wad, lump, data, size);
|
ReadLump<uint8_t> (wad, lump, data, size);
|
||||||
if (data != NULL)
|
if (data != NULL)
|
||||||
{
|
{
|
||||||
WriteLump (wad.LumpName (lump), data, size);
|
WriteLump (wad.LumpName (lump), data, size);
|
||||||
|
@ -449,37 +449,37 @@ void FWadWriter::SafeWrite (const void *buffer, size_t size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FWadWriter &FWadWriter::operator << (BYTE val)
|
FWadWriter &FWadWriter::operator << (uint8_t val)
|
||||||
{
|
{
|
||||||
AddToLump (&val, 1);
|
AddToLump (&val, 1);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FWadWriter &FWadWriter::operator << (WORD val)
|
FWadWriter &FWadWriter::operator << (uint16_t val)
|
||||||
{
|
{
|
||||||
val = LittleShort(val);
|
val = LittleShort(val);
|
||||||
AddToLump ((BYTE *)&val, 2);
|
AddToLump ((uint8_t *)&val, 2);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FWadWriter &FWadWriter::operator << (SWORD val)
|
FWadWriter &FWadWriter::operator << (int16_t val)
|
||||||
{
|
{
|
||||||
val = LittleShort(val);
|
val = LittleShort(val);
|
||||||
AddToLump ((BYTE *)&val, 2);
|
AddToLump ((uint8_t *)&val, 2);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FWadWriter &FWadWriter::operator << (DWORD val)
|
FWadWriter &FWadWriter::operator << (uint32_t val)
|
||||||
{
|
{
|
||||||
val = LittleLong(val);
|
val = LittleLong(val);
|
||||||
AddToLump ((BYTE *)&val, 4);
|
AddToLump ((uint8_t *)&val, 4);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FWadWriter &FWadWriter::operator << (fixed_t val)
|
FWadWriter &FWadWriter::operator << (fixed_t val)
|
||||||
{
|
{
|
||||||
val = LittleLong(val);
|
val = LittleLong(val);
|
||||||
AddToLump ((BYTE *)&val, 4);
|
AddToLump ((uint8_t *)&val, 4);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,10 +94,10 @@ public:
|
||||||
void StartWritingLump (const char *name);
|
void StartWritingLump (const char *name);
|
||||||
void AddToLump (const void *data, int len);
|
void AddToLump (const void *data, int len);
|
||||||
|
|
||||||
FWadWriter &operator << (BYTE);
|
FWadWriter &operator << (uint8_t);
|
||||||
FWadWriter &operator << (WORD);
|
FWadWriter &operator << (uint16_t);
|
||||||
FWadWriter &operator << (SWORD);
|
FWadWriter &operator << (int16_t);
|
||||||
FWadWriter &operator << (DWORD);
|
FWadWriter &operator << (uint32_t);
|
||||||
FWadWriter &operator << (fixed_t);
|
FWadWriter &operator << (fixed_t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
/* get errno and strerror definition */
|
/* get errno and strerror definition */
|
||||||
#if defined UNDER_CE
|
#if defined UNDER_CE
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
|
# define zstrerror() gz_strwinerror((uint32_t)GetLastError())
|
||||||
#else
|
#else
|
||||||
# ifndef NO_STRERROR
|
# ifndef NO_STRERROR
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
|
@ -179,7 +179,7 @@ typedef gz_state FAR *gz_statep;
|
||||||
/* shared functions */
|
/* shared functions */
|
||||||
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
|
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
|
||||||
#if defined UNDER_CE
|
#if defined UNDER_CE
|
||||||
char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
|
char ZLIB_INTERNAL *gz_strwinerror OF((uint32_t error));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
||||||
|
|
Loading…
Reference in a new issue