mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-03-13 03:33:30 +00:00
- Switch from NULL to nullptr
This commit is contained in:
parent
627098b671
commit
8fac445226
16 changed files with 108 additions and 108 deletions
|
@ -67,14 +67,14 @@ public:
|
||||||
{
|
{
|
||||||
Most = 0;
|
Most = 0;
|
||||||
Count = 0;
|
Count = 0;
|
||||||
Array = NULL;
|
Array = nullptr;
|
||||||
}
|
}
|
||||||
TArray (int max)
|
TArray (int max)
|
||||||
{
|
{
|
||||||
Most = max;
|
Most = max;
|
||||||
Count = 0;
|
Count = 0;
|
||||||
Array = (T *)malloc (sizeof(T)*max);
|
Array = (T *)malloc (sizeof(T)*max);
|
||||||
if (Array == NULL)
|
if (Array == nullptr)
|
||||||
{
|
{
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ public:
|
||||||
{
|
{
|
||||||
if (&other != this)
|
if (&other != this)
|
||||||
{
|
{
|
||||||
if (Array != NULL)
|
if (Array != nullptr)
|
||||||
{
|
{
|
||||||
if (Count > 0)
|
if (Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ public:
|
||||||
DoDelete (0, Count-1);
|
DoDelete (0, Count-1);
|
||||||
}
|
}
|
||||||
free (Array);
|
free (Array);
|
||||||
Array = NULL;
|
Array = nullptr;
|
||||||
Count = 0;
|
Count = 0;
|
||||||
Most = 0;
|
Most = 0;
|
||||||
}
|
}
|
||||||
|
@ -198,10 +198,10 @@ public:
|
||||||
Most = Count;
|
Most = Count;
|
||||||
if (Most == 0)
|
if (Most == 0)
|
||||||
{
|
{
|
||||||
if (Array != NULL)
|
if (Array != nullptr)
|
||||||
{
|
{
|
||||||
free (Array);
|
free (Array);
|
||||||
Array = NULL;
|
Array = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -281,7 +281,7 @@ private:
|
||||||
if (Count != 0)
|
if (Count != 0)
|
||||||
{
|
{
|
||||||
Array = (T *)malloc (sizeof(T)*Most);
|
Array = (T *)malloc (sizeof(T)*Most);
|
||||||
if (Array == NULL)
|
if (Array == nullptr)
|
||||||
{
|
{
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ private:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Array = NULL;
|
Array = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ private:
|
||||||
{
|
{
|
||||||
size_t allocsize = sizeof(T)*Most;
|
size_t allocsize = sizeof(T)*Most;
|
||||||
Array = (T *)realloc (Array, allocsize);
|
Array = (T *)realloc (Array, allocsize);
|
||||||
if (Array == NULL)
|
if (Array == nullptr)
|
||||||
{
|
{
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ public:
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < TArray<T,TT>::Size(); ++i)
|
for (unsigned int i = 0; i < TArray<T,TT>::Size(); ++i)
|
||||||
{
|
{
|
||||||
if ((*this)[i] != NULL)
|
if ((*this)[i] != nullptr)
|
||||||
delete (*this)[i];
|
delete (*this)[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
// key - The key value to look for
|
// key - The key value to look for
|
||||||
//
|
//
|
||||||
// Returns:
|
// Returns:
|
||||||
// A pointer to the element with a matching key or NULL if none found.
|
// A pointer to the element with a matching key or nullptr if none found.
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
template<class ClassType, class KeyType>
|
template<class ClassType, class KeyType>
|
||||||
|
@ -83,7 +83,7 @@ const ClassType *BinarySearch (const ClassType *first, int max,
|
||||||
max = mid - 1;
|
max = mid - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -526,7 +526,7 @@ void FProcessor::BuildNodes()
|
||||||
{
|
{
|
||||||
NodesBuilt = true;
|
NodesBuilt = true;
|
||||||
|
|
||||||
FNodeBuilder *builder = NULL;
|
FNodeBuilder *builder = nullptr;
|
||||||
|
|
||||||
// ZDoom's UDMF spec requires compressed GL nodes.
|
// ZDoom's UDMF spec requires compressed GL nodes.
|
||||||
// No other UDMF spec has defined anything regarding nodes yet.
|
// No other UDMF spec has defined anything regarding nodes yet.
|
||||||
|
@ -553,7 +553,7 @@ void FProcessor::BuildNodes()
|
||||||
SSELevel = 0;
|
SSELevel = 0;
|
||||||
}
|
}
|
||||||
builder = new FNodeBuilder(Level, PolyStarts, PolyAnchors, Wad.LumpName(Lump), BuildGLNodes);
|
builder = new FNodeBuilder(Level, PolyStarts, PolyAnchors, Wad.LumpName(Lump), BuildGLNodes);
|
||||||
if (builder == NULL)
|
if (builder == nullptr)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(" Not enough memory to build nodes!");
|
throw std::runtime_error(" Not enough memory to build nodes!");
|
||||||
}
|
}
|
||||||
|
@ -583,7 +583,7 @@ void FProcessor::BuildNodes()
|
||||||
// Now repeat the process to obtain regular nodes
|
// Now repeat the process to obtain regular nodes
|
||||||
delete builder;
|
delete builder;
|
||||||
builder = new FNodeBuilder(Level, PolyStarts, PolyAnchors, Wad.LumpName(Lump), false);
|
builder = new FNodeBuilder(Level, PolyStarts, PolyAnchors, Wad.LumpName(Lump), false);
|
||||||
if (builder == NULL)
|
if (builder == nullptr)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(" Not enough memory to build regular nodes!");
|
throw std::runtime_error(" Not enough memory to build regular nodes!");
|
||||||
}
|
}
|
||||||
|
@ -597,11 +597,11 @@ void FProcessor::BuildNodes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete builder;
|
delete builder;
|
||||||
builder = NULL;
|
builder = nullptr;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
if (builder != NULL)
|
if (builder != nullptr)
|
||||||
{
|
{
|
||||||
delete builder;
|
delete builder;
|
||||||
}
|
}
|
||||||
|
@ -689,7 +689,7 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
memcpy (Level.Blockmap, blocks, Level.BlockmapSize*sizeof(uint16_t));
|
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 = nullptr;
|
||||||
|
|
||||||
switch (RejectMode)
|
switch (RejectMode)
|
||||||
{
|
{
|
||||||
|
@ -710,7 +710,7 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
{
|
{
|
||||||
// If the reject is the wrong size, don't use it.
|
// If the reject is the wrong size, don't use it.
|
||||||
delete[] Level.Reject;
|
delete[] Level.Reject;
|
||||||
Level.Reject = NULL;
|
Level.Reject = nullptr;
|
||||||
if (Level.RejectSize != 0)
|
if (Level.RejectSize != 0)
|
||||||
{ // Do not warn about 0-length rejects
|
{ // Do not warn about 0-length rejects
|
||||||
printf (" REJECT is the wrong size, so it will be removed.\n");
|
printf (" REJECT is the wrong size, so it will be removed.\n");
|
||||||
|
@ -742,7 +742,7 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
if (!isUDMF)
|
if (!isUDMF)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Level.GLNodes != NULL )
|
if (Level.GLNodes != nullptr )
|
||||||
{
|
{
|
||||||
gl5 = V5GLNodes ||
|
gl5 = V5GLNodes ||
|
||||||
(Level.NumGLVertices > 32767) ||
|
(Level.NumGLVertices > 32767) ||
|
||||||
|
@ -826,7 +826,7 @@ void FProcessor::Write (FWadWriter &out)
|
||||||
{
|
{
|
||||||
LMBuilder.AddLightmapLump(out);
|
LMBuilder.AddLightmapLump(out);
|
||||||
}*/
|
}*/
|
||||||
if (Level.GLNodes != NULL && !compressGL)
|
if (Level.GLNodes != nullptr && !compressGL)
|
||||||
{
|
{
|
||||||
char glname[9];
|
char glname[9];
|
||||||
glname[0] = 'G';
|
glname[0] = 'G';
|
||||||
|
@ -878,7 +878,7 @@ MapNodeEx *FProcessor::NodesToEx (const MapNode *nodes, int count)
|
||||||
{
|
{
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapNodeEx *Nodes = new MapNodeEx[Level.NumNodes];
|
MapNodeEx *Nodes = new MapNodeEx[Level.NumNodes];
|
||||||
|
@ -913,7 +913,7 @@ MapSubsectorEx *FProcessor::SubsectorsToEx (const MapSubsector *ssec, int count)
|
||||||
{
|
{
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapSubsectorEx *out = new MapSubsectorEx[Level.NumSubsectors];
|
MapSubsectorEx *out = new MapSubsectorEx[Level.NumSubsectors];
|
||||||
|
@ -932,7 +932,7 @@ MapSegGLEx *FProcessor::SegGLsToEx (const MapSegGL *segs, int count)
|
||||||
{
|
{
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapSegGLEx *out = new MapSegGLEx[count];
|
MapSegGLEx *out = new MapSegGLEx[count];
|
||||||
|
@ -1238,7 +1238,7 @@ void FProcessor::WriteBlockmap (FWadWriter &out)
|
||||||
|
|
||||||
void FProcessor::WriteReject (FWadWriter &out)
|
void FProcessor::WriteReject (FWadWriter &out)
|
||||||
{
|
{
|
||||||
if (RejectMode == ERM_Create0 || Level.Reject == NULL)
|
if (RejectMode == ERM_Create0 || Level.Reject == nullptr)
|
||||||
{
|
{
|
||||||
out.CreateLabel ("REJECT");
|
out.CreateLabel ("REJECT");
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
|
|
||||||
char * Copy(const char * p)
|
char * Copy(const char * p)
|
||||||
{
|
{
|
||||||
return p != NULL? strcpy(Alloc(strlen(p)+1) , p) : NULL;
|
return p != nullptr? strcpy(Alloc(strlen(p)+1) , p) : nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ kexVec3 kexAngle::ToForwardAxis()
|
||||||
{
|
{
|
||||||
kexVec3 vec;
|
kexVec3 vec;
|
||||||
|
|
||||||
ToAxis(&vec, NULL, NULL);
|
ToAxis(&vec, nullptr, nullptr);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ kexVec3 kexAngle::ToUpAxis()
|
||||||
{
|
{
|
||||||
kexVec3 vec;
|
kexVec3 vec;
|
||||||
|
|
||||||
ToAxis(NULL, &vec, NULL);
|
ToAxis(nullptr, &vec, nullptr);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ kexVec3 kexAngle::ToRightAxis()
|
||||||
{
|
{
|
||||||
kexVec3 vec;
|
kexVec3 vec;
|
||||||
|
|
||||||
ToAxis(NULL, NULL, &vec);
|
ToAxis(nullptr, nullptr, &vec);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ static void CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
|
||||||
}
|
}
|
||||||
|
|
||||||
// middle seg
|
// middle seg
|
||||||
if (back == NULL)
|
if (back == nullptr)
|
||||||
{
|
{
|
||||||
surf = new surface_t();
|
surf = new surface_t();
|
||||||
surf->numVerts = 4;
|
surf->numVerts = 4;
|
||||||
|
@ -175,7 +175,7 @@ static void CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
|
||||||
static void CreateSubsectorSurfaces(FLevel &doomMap)
|
static void CreateSubsectorSurfaces(FLevel &doomMap)
|
||||||
{
|
{
|
||||||
surface_t *surf;
|
surface_t *surf;
|
||||||
IntSector *sector = NULL;
|
IntSector *sector = nullptr;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -90,7 +90,7 @@ extern "C" char *optarg;
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||||
|
|
||||||
const char *Map = NULL;
|
const char *Map = nullptr;
|
||||||
const char *InName;
|
const char *InName;
|
||||||
const char *OutName = "tmp.wad";
|
const char *OutName = "tmp.wad";
|
||||||
bool BuildNodes = true;
|
bool BuildNodes = true;
|
||||||
|
@ -176,7 +176,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
ParseArgs(argc, argv);
|
ParseArgs(argc, argv);
|
||||||
|
|
||||||
if (InName == NULL)
|
if (InName == nullptr)
|
||||||
{
|
{
|
||||||
if (optind >= argc || optind < argc - 1)
|
if (optind >= argc || optind < argc - 1)
|
||||||
{ // Source file is unspecified or followed by junk
|
{ // Source file is unspecified or followed by junk
|
||||||
|
@ -203,7 +203,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
char *out = new char[strlen(OutName) + 3], *dot;
|
char *out = new char[strlen(OutName) + 3], *dot;
|
||||||
|
|
||||||
if (out == NULL)
|
if (out == nullptr)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Could not create temporary file name.");
|
throw std::runtime_error("Could not create temporary file name.");
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ int main(int argc, char **argv)
|
||||||
else if (inwad.IsGLNodes(lump))
|
else if (inwad.IsGLNodes(lump))
|
||||||
{
|
{
|
||||||
// Ignore GL nodes from the input for any maps we process.
|
// Ignore GL nodes from the input for any maps we process.
|
||||||
if (BuildNodes && (Map == NULL || stricmp(inwad.LumpName(lump) + 3, Map) == 0))
|
if (BuildNodes && (Map == nullptr || stricmp(inwad.LumpName(lump) + 3, Map) == 0))
|
||||||
{
|
{
|
||||||
lump = inwad.SkipGLNodes(lump);
|
lump = inwad.SkipGLNodes(lump);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ static void ParseArgs(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
while ((ch = getopt_long(argc, argv, short_opts, long_opts, NULL)) != EOF)
|
while ((ch = getopt_long(argc, argv, short_opts, long_opts, nullptr)) != EOF)
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
|
@ -591,13 +591,13 @@ static bool CheckInOutNames()
|
||||||
HANDLE inFile, outFile;
|
HANDLE inFile, outFile;
|
||||||
|
|
||||||
outFile = CreateFile(OutName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
outFile = CreateFile(OutName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
NULL, OPEN_EXISTING, 0, NULL);
|
nullptr, OPEN_EXISTING, 0, nullptr);
|
||||||
if (outFile == INVALID_HANDLE_VALUE)
|
if (outFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inFile = CreateFile(InName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
inFile = CreateFile(InName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
NULL, OPEN_EXISTING, 0, NULL);
|
nullptr, OPEN_EXISTING, 0, nullptr);
|
||||||
if (inFile == INVALID_HANDLE_VALUE)
|
if (inFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
CloseHandle(outFile);
|
CloseHandle(outFile);
|
||||||
|
|
|
@ -26,8 +26,8 @@ public:
|
||||||
~FEventTree ();
|
~FEventTree ();
|
||||||
|
|
||||||
FEvent *GetMinimum ();
|
FEvent *GetMinimum ();
|
||||||
FEvent *GetSuccessor (FEvent *event) const { FEvent *node = Successor(event); return node == &Nil ? NULL : node; }
|
FEvent *GetSuccessor (FEvent *event) const { FEvent *node = Successor(event); return node == &Nil ? nullptr : node; }
|
||||||
FEvent *GetPredecessor (FEvent *event) const { FEvent *node = Predecessor(event); return node == &Nil ? NULL : node; }
|
FEvent *GetPredecessor (FEvent *event) const { FEvent *node = Predecessor(event); return node == &Nil ? nullptr : node; }
|
||||||
|
|
||||||
FEvent *GetNewNode ();
|
FEvent *GetNewNode ();
|
||||||
void Insert (FEvent *event);
|
void Insert (FEvent *event);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "nodebuilder/nodebuild.h"
|
#include "nodebuilder/nodebuild.h"
|
||||||
|
|
||||||
FEventTree::FEventTree ()
|
FEventTree::FEventTree ()
|
||||||
: Root (&Nil), Spare (NULL)
|
: Root (&Nil), Spare (nullptr)
|
||||||
{
|
{
|
||||||
memset (&Nil, 0, sizeof(Nil));
|
memset (&Nil, 0, sizeof(Nil));
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ FEventTree::~FEventTree ()
|
||||||
|
|
||||||
DeleteAll ();
|
DeleteAll ();
|
||||||
probe = Spare;
|
probe = Spare;
|
||||||
while (probe != NULL)
|
while (probe != nullptr)
|
||||||
{
|
{
|
||||||
FEvent *next = probe->Left;
|
FEvent *next = probe->Left;
|
||||||
delete probe;
|
delete probe;
|
||||||
|
@ -50,7 +50,7 @@ void FEventTree::DeleteAll ()
|
||||||
|
|
||||||
void FEventTree::DeletionTraverser (FEvent *node)
|
void FEventTree::DeletionTraverser (FEvent *node)
|
||||||
{
|
{
|
||||||
if (node != &Nil && node != NULL)
|
if (node != &Nil && node != nullptr)
|
||||||
{
|
{
|
||||||
DeletionTraverser (node->Left);
|
DeletionTraverser (node->Left);
|
||||||
DeletionTraverser (node->Right);
|
DeletionTraverser (node->Right);
|
||||||
|
@ -63,7 +63,7 @@ FEvent *FEventTree::GetNewNode ()
|
||||||
{
|
{
|
||||||
FEvent *node;
|
FEvent *node;
|
||||||
|
|
||||||
if (Spare != NULL)
|
if (Spare != nullptr)
|
||||||
{
|
{
|
||||||
node = Spare;
|
node = Spare;
|
||||||
Spare = node->Left;
|
Spare = node->Left;
|
||||||
|
@ -174,7 +174,7 @@ FEvent *FEventTree::FindEvent (double key) const
|
||||||
node = node->Right;
|
node = node->Right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FEvent *FEventTree::GetMinimum ()
|
FEvent *FEventTree::GetMinimum ()
|
||||||
|
@ -183,7 +183,7 @@ FEvent *FEventTree::GetMinimum ()
|
||||||
|
|
||||||
if (node == &Nil)
|
if (node == &Nil)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
while (node->Left != &Nil)
|
while (node->Left != &Nil)
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,7 +155,7 @@ int FNodeBuilder::CloseSubsector (TArray<MapSegGLEx> &segs, int subsector)
|
||||||
for (i = first + 1; i < max; ++i)
|
for (i = first + 1; i < max; ++i)
|
||||||
{
|
{
|
||||||
angle_t bestdiff = ANGLE_MAX;
|
angle_t bestdiff = ANGLE_MAX;
|
||||||
FPrivSeg *bestseg = NULL;
|
FPrivSeg *bestseg = nullptr;
|
||||||
int bestj = -1;
|
int bestj = -1;
|
||||||
for (j = first; j < max; ++j)
|
for (j = first; j < max; ++j)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ int FNodeBuilder::CloseSubsector (TArray<MapSegGLEx> &segs, int subsector)
|
||||||
bestj = j;
|
bestj = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bestseg != NULL)
|
if (bestseg != nullptr)
|
||||||
{
|
{
|
||||||
seg = bestseg;
|
seg = bestseg;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ int FNodeBuilder::OutputDegenerateSubsector (TArray<MapSegGLEx> &segs, int subse
|
||||||
for (i = first + 1; i < max; ++i)
|
for (i = first + 1; i < max; ++i)
|
||||||
{
|
{
|
||||||
double bestdot = bestinit[bForward];
|
double bestdot = bestinit[bForward];
|
||||||
FPrivSeg *bestseg = NULL;
|
FPrivSeg *bestseg = nullptr;
|
||||||
for (j = first + 1; j < max; ++j)
|
for (j = first + 1; j < max; ++j)
|
||||||
{
|
{
|
||||||
seg = &Segs[SegList[j].SegNum];
|
seg = &Segs[SegList[j].SegNum];
|
||||||
|
@ -301,7 +301,7 @@ int FNodeBuilder::OutputDegenerateSubsector (TArray<MapSegGLEx> &segs, int subse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bestseg != NULL)
|
if (bestseg != nullptr)
|
||||||
{
|
{
|
||||||
if (prev->v2 != bestseg->v1)
|
if (prev->v2 != bestseg->v1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ double FNodeBuilder::AddIntersection (const node_t &node, int vertex)
|
||||||
|
|
||||||
FEvent *event = Events.FindEvent (dist);
|
FEvent *event = Events.FindEvent (dist);
|
||||||
|
|
||||||
if (event == NULL)
|
if (event == nullptr)
|
||||||
{
|
{
|
||||||
event = Events.GetNewNode ();
|
event = Events.GetNewNode ();
|
||||||
event->Distance = dist;
|
event->Distance = dist;
|
||||||
|
@ -72,7 +72,7 @@ void FNodeBuilder::FixSplitSharers ()
|
||||||
FEvent *event = Events.FindEvent (SplitSharers[i].Distance);
|
FEvent *event = Events.FindEvent (SplitSharers[i].Distance);
|
||||||
FEvent *next;
|
FEvent *next;
|
||||||
|
|
||||||
if (event == NULL)
|
if (event == nullptr)
|
||||||
{ // Should not happen
|
{ // Should not happen
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ void FNodeBuilder::FixSplitSharers ()
|
||||||
if (SplitSharers[i].Forward)
|
if (SplitSharers[i].Forward)
|
||||||
{
|
{
|
||||||
event = Events.GetSuccessor (event);
|
event = Events.GetSuccessor (event);
|
||||||
if (event == NULL)
|
if (event == nullptr)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -98,14 +98,14 @@ void FNodeBuilder::FixSplitSharers ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event = Events.GetPredecessor (event);
|
event = Events.GetPredecessor (event);
|
||||||
if (event == NULL)
|
if (event == nullptr)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
next = Events.GetPredecessor (event);
|
next = Events.GetPredecessor (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (event != NULL && next != NULL && event->Info.Vertex != v2)
|
while (event != nullptr && next != nullptr && event->Info.Vertex != v2)
|
||||||
{
|
{
|
||||||
D(printf("Forced split of seg %d(%d[%d,%d]->%d[%d,%d]) at %d(%d,%d):%g\n", seg,
|
D(printf("Forced split of seg %d(%d[%d,%d]->%d[%d,%d]) at %d(%d,%d):%g\n", seg,
|
||||||
Segs[seg].v1,
|
Segs[seg].v1,
|
||||||
|
@ -161,11 +161,11 @@ void FNodeBuilder::FixSplitSharers ()
|
||||||
|
|
||||||
void FNodeBuilder::AddMinisegs (const node_t &node, uint32_t splitseg, uint32_t &fset, uint32_t &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 = nullptr;
|
||||||
|
|
||||||
while (event != NULL)
|
while (event != nullptr)
|
||||||
{
|
{
|
||||||
if (prev != NULL)
|
if (prev != nullptr)
|
||||||
{
|
{
|
||||||
uint32_t fseg1, bseg1, fseg2, bseg2;
|
uint32_t fseg1, bseg1, fseg2, bseg2;
|
||||||
uint32_t fnseg, bnseg;
|
uint32_t fnseg, bnseg;
|
||||||
|
@ -236,7 +236,7 @@ uint32_t FNodeBuilder::AddMiniseg (int v1, int v2, uint32_t partner, uint32_t se
|
||||||
newseg.loopnum = 0;
|
newseg.loopnum = 0;
|
||||||
newseg.next = DWORD_MAX;
|
newseg.next = DWORD_MAX;
|
||||||
newseg.planefront = true;
|
newseg.planefront = true;
|
||||||
newseg.hashnext = NULL;
|
newseg.hashnext = nullptr;
|
||||||
newseg.storedseg = DWORD_MAX;
|
newseg.storedseg = DWORD_MAX;
|
||||||
newseg.frontsector = -1;
|
newseg.frontsector = -1;
|
||||||
newseg.backsector = -1;
|
newseg.backsector = -1;
|
||||||
|
|
|
@ -115,7 +115,7 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum)
|
||||||
seg.loopnum = 0;
|
seg.loopnum = 0;
|
||||||
seg.offset = 0;
|
seg.offset = 0;
|
||||||
seg.partner = DWORD_MAX;
|
seg.partner = DWORD_MAX;
|
||||||
seg.hashnext = NULL;
|
seg.hashnext = nullptr;
|
||||||
seg.planefront = false;
|
seg.planefront = false;
|
||||||
seg.planenum = DWORD_MAX;
|
seg.planenum = DWORD_MAX;
|
||||||
seg.storedseg = DWORD_MAX;
|
seg.storedseg = DWORD_MAX;
|
||||||
|
@ -163,7 +163,7 @@ void FNodeBuilder::GroupSegPlanes ()
|
||||||
{
|
{
|
||||||
FPrivSeg *seg = &Segs[i];
|
FPrivSeg *seg = &Segs[i];
|
||||||
seg->next = i+1;
|
seg->next = i+1;
|
||||||
seg->hashnext = NULL;
|
seg->hashnext = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Segs[Segs.Size()-1].next = DWORD_MAX;
|
Segs[Segs.Size()-1].next = DWORD_MAX;
|
||||||
|
@ -182,7 +182,7 @@ void FNodeBuilder::GroupSegPlanes ()
|
||||||
|
|
||||||
FPrivSeg *check = buckets[ang >>= 31-bucketbits];
|
FPrivSeg *check = buckets[ang >>= 31-bucketbits];
|
||||||
|
|
||||||
while (check != NULL)
|
while (check != nullptr)
|
||||||
{
|
{
|
||||||
fixed_t cx1 = Vertices[check->v1].x;
|
fixed_t cx1 = Vertices[check->v1].x;
|
||||||
fixed_t cy1 = Vertices[check->v1].y;
|
fixed_t cy1 = Vertices[check->v1].y;
|
||||||
|
@ -195,7 +195,7 @@ void FNodeBuilder::GroupSegPlanes ()
|
||||||
}
|
}
|
||||||
check = check->hashnext;
|
check = check->hashnext;
|
||||||
}
|
}
|
||||||
if (check != NULL)
|
if (check != nullptr)
|
||||||
{
|
{
|
||||||
seg->planenum = check->planenum;
|
seg->planenum = check->planenum;
|
||||||
const FSimpleLine *line = &Planes[seg->planenum];
|
const FSimpleLine *line = &Planes[seg->planenum];
|
||||||
|
|
|
@ -116,7 +116,7 @@ static void SC_PrepareScript ()
|
||||||
ScriptOpen = true;
|
ScriptOpen = true;
|
||||||
sc_String = StringBuffer;
|
sc_String = StringBuffer;
|
||||||
AlreadyGot = false;
|
AlreadyGot = false;
|
||||||
SavedScriptPtr = NULL;
|
SavedScriptPtr = nullptr;
|
||||||
CMode = false;
|
CMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ void SC_Close ()
|
||||||
{
|
{
|
||||||
if (ScriptOpen)
|
if (ScriptOpen)
|
||||||
{
|
{
|
||||||
ScriptBuffer = NULL;
|
ScriptBuffer = nullptr;
|
||||||
ScriptOpen = false;
|
ScriptOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ void SC_SavePos ()
|
||||||
CheckOpen ();
|
CheckOpen ();
|
||||||
if (sc_End)
|
if (sc_End)
|
||||||
{
|
{
|
||||||
SavedScriptPtr = NULL;
|
SavedScriptPtr = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -341,7 +341,7 @@ bool SC_GetString ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grabtoken:
|
grabtoken:
|
||||||
while ((*ScriptPtr > ' ') && (strchr (stopchars, *ScriptPtr) == NULL)
|
while ((*ScriptPtr > ' ') && (strchr (stopchars, *ScriptPtr) == nullptr)
|
||||||
&& (CMode || *ScriptPtr != ASCII_COMMENT)
|
&& (CMode || *ScriptPtr != ASCII_COMMENT)
|
||||||
&& !(ScriptPtr[0] == CPP_COMMENT && (ScriptPtr < ScriptEndPtr - 1) &&
|
&& !(ScriptPtr[0] == CPP_COMMENT && (ScriptPtr < ScriptEndPtr - 1) &&
|
||||||
(ScriptPtr[1] == CPP_COMMENT || ScriptPtr[1] == C_COMMENT)))
|
(ScriptPtr[1] == CPP_COMMENT || ScriptPtr[1] == C_COMMENT)))
|
||||||
|
@ -632,7 +632,7 @@ int SC_MatchString (const char **strings)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; *strings != NULL; i++)
|
for (i = 0; *strings != nullptr; i++)
|
||||||
{
|
{
|
||||||
if (SC_Compare (*strings++))
|
if (SC_Compare (*strings++))
|
||||||
{
|
{
|
||||||
|
@ -655,7 +655,7 @@ int SC_MustMatchString (const char **strings)
|
||||||
i = SC_MatchString (strings);
|
i = SC_MatchString (strings);
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
SC_ScriptError (NULL);
|
SC_ScriptError (nullptr);
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,7 @@ bool SC_Compare (const char *text)
|
||||||
void SC_ScriptError (const char *message, ...)
|
void SC_ScriptError (const char *message, ...)
|
||||||
{
|
{
|
||||||
char composed[2048];
|
char composed[2048];
|
||||||
if (message == NULL)
|
if (message == nullptr)
|
||||||
{
|
{
|
||||||
message = "Bad syntax.";
|
message = "Bad syntax.";
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ INT_PTR CALLBACK ViewDialogFunc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
{
|
{
|
||||||
Viewing = newmode;
|
Viewing = newmode;
|
||||||
ResetViews ();
|
ResetViews ();
|
||||||
InvalidateRect (GetDlgItem (hDlg, IDC_MAPVIEW), NULL, TRUE);
|
InvalidateRect (GetDlgItem (hDlg, IDC_MAPVIEW), nullptr, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -239,12 +239,12 @@ static void DrawSubsector (HDC dc, int ssec)
|
||||||
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)
|
||||||
{
|
{
|
||||||
MoveToEx (dc, VERTX(Level->Segs[seg].v1), VERTY(Level->Segs[seg].v1), NULL);
|
MoveToEx (dc, VERTX(Level->Segs[seg].v1), VERTY(Level->Segs[seg].v1), nullptr);
|
||||||
LineTo (dc, VERTX(Level->Segs[seg].v2), VERTY(Level->Segs[seg].v2));
|
LineTo (dc, VERTX(Level->Segs[seg].v2), VERTY(Level->Segs[seg].v2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MoveToEx (dc, VERTX(Level->Segs[seg].v2), VERTY(Level->Segs[seg].v2), NULL);
|
MoveToEx (dc, VERTX(Level->Segs[seg].v2), VERTY(Level->Segs[seg].v2), nullptr);
|
||||||
LineTo (dc, VERTX(Level->Segs[seg].v1), VERTY(Level->Segs[seg].v1));
|
LineTo (dc, VERTX(Level->Segs[seg].v1), VERTY(Level->Segs[seg].v1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,10 +255,10 @@ static void DrawSubsectorGL (HDC dc, int ssec, HPEN miniPen, HPEN badPen)
|
||||||
int seg;
|
int seg;
|
||||||
|
|
||||||
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), nullptr);
|
||||||
for (uint32_t i = 0; i < Level->GLSubsectors[ssec].numlines; ++i)
|
for (uint32_t i = 0; i < Level->GLSubsectors[ssec].numlines; ++i)
|
||||||
{
|
{
|
||||||
HPEN oldPen = NULL;
|
HPEN oldPen = nullptr;
|
||||||
seg = Level->GLSubsectors[ssec].firstline + i;
|
seg = Level->GLSubsectors[ssec].firstline + i;
|
||||||
if (Level->GLSegs[seg].linedef == NO_INDEX)
|
if (Level->GLSegs[seg].linedef == NO_INDEX)
|
||||||
{
|
{
|
||||||
|
@ -273,15 +273,15 @@ static void DrawSubsectorGL (HDC dc, int ssec, HPEN miniPen, HPEN badPen)
|
||||||
}
|
}
|
||||||
if (Level->GLSegs[seg].side == 0 || 1)
|
if (Level->GLSegs[seg].side == 0 || 1)
|
||||||
{
|
{
|
||||||
//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), nullptr);
|
||||||
LineTo (dc, GLVERTX(Level->GLSegs[seg].v2), GLVERTY(Level->GLSegs[seg].v2));
|
LineTo (dc, GLVERTX(Level->GLSegs[seg].v2), GLVERTY(Level->GLSegs[seg].v2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v2), GLVERTY(Level->GLSegs[seg].v2), NULL);
|
//MoveToEx (dc, GLVERTX(Level->GLSegs[seg].v2), GLVERTY(Level->GLSegs[seg].v2), nullptr);
|
||||||
LineTo (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1));
|
LineTo (dc, GLVERTX(Level->GLSegs[seg].v1), GLVERTY(Level->GLSegs[seg].v1));
|
||||||
}
|
}
|
||||||
if (oldPen != NULL)
|
if (oldPen != nullptr)
|
||||||
{
|
{
|
||||||
SelectObject (dc, oldPen);
|
SelectObject (dc, oldPen);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ static void DrawSplitter (HDC dc, MapNodeEx *node)
|
||||||
dy <<= 1;
|
dy <<= 1;
|
||||||
}
|
}
|
||||||
SelectObject (dc, Splitter);
|
SelectObject (dc, Splitter);
|
||||||
MoveToEx (dc, (node->x - dx) >> 16, (node->y - dy) >> 16, NULL);
|
MoveToEx (dc, (node->x - dx) >> 16, (node->y - dy) >> 16, nullptr);
|
||||||
LineTo (dc, (node->x + 2*dx) >> 16, (node->y + 2*dy) >> 16);
|
LineTo (dc, (node->x + 2*dx) >> 16, (node->y + 2*dy) >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ static void DrawLevelReject (HDC dc)
|
||||||
{
|
{
|
||||||
choice = SEE_FROM;
|
choice = SEE_FROM;
|
||||||
}
|
}
|
||||||
else if (Level->Reject != NULL)
|
else if (Level->Reject != nullptr)
|
||||||
{
|
{
|
||||||
int pnum = seeFromRow + Level->Sides[Level->Lines[i].sidenum[0]].sector;
|
int pnum = seeFromRow + Level->Sides[Level->Lines[i].sidenum[0]].sector;
|
||||||
if (Level->Reject[pnum>>3] & (1<<(pnum&7)))
|
if (Level->Reject[pnum>>3] & (1<<(pnum&7)))
|
||||||
|
@ -632,7 +632,7 @@ static void DrawLevelReject (HDC dc)
|
||||||
{
|
{
|
||||||
choice = SEE_FROM;
|
choice = SEE_FROM;
|
||||||
}
|
}
|
||||||
else if (Level->Reject != NULL && choice < CAN_SEE)
|
else if (Level->Reject != nullptr && choice < CAN_SEE)
|
||||||
{
|
{
|
||||||
int pnum = seeFromRow + Level->Sides[Level->Lines[i].sidenum[1]].sector;
|
int pnum = seeFromRow + Level->Sides[Level->Lines[i].sidenum[1]].sector;
|
||||||
if (Level->Reject[pnum>>3] & (1<<(pnum&7)))
|
if (Level->Reject[pnum>>3] & (1<<(pnum&7)))
|
||||||
|
@ -662,7 +662,7 @@ static void DrawLevelReject (HDC dc)
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MoveToEx (dc, VERTX(Level->Lines[i].v1), VERTY(Level->Lines[i].v1), NULL);
|
MoveToEx (dc, VERTX(Level->Lines[i].v1), VERTY(Level->Lines[i].v1), nullptr);
|
||||||
LineTo (dc, VERTX(Level->Lines[i].v2), VERTY(Level->Lines[i].v2));
|
LineTo (dc, VERTX(Level->Lines[i].v2), VERTY(Level->Lines[i].v2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -768,7 +768,7 @@ static void DrawLevel (HDC dc)
|
||||||
|
|
||||||
for (i = 0; i < Level->NumSegs; ++i)
|
for (i = 0; i < Level->NumSegs; ++i)
|
||||||
{
|
{
|
||||||
MoveToEx (dc, VERTX(Level->Segs[i].v1), VERTY(Level->Segs[i].v1), NULL);
|
MoveToEx (dc, VERTX(Level->Segs[i].v1), VERTY(Level->Segs[i].v1), nullptr);
|
||||||
LineTo (dc, VERTX(Level->Segs[i].v2), VERTY(Level->Segs[i].v2));
|
LineTo (dc, VERTX(Level->Segs[i].v2), VERTY(Level->Segs[i].v2));
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -793,7 +793,7 @@ void SizeView (HWND wnd, bool firstTime)
|
||||||
else if (sinfo.nPos > sinfo.nMax - (int)sinfo.nPage)
|
else if (sinfo.nPos > sinfo.nMax - (int)sinfo.nPage)
|
||||||
{
|
{
|
||||||
int delta = sinfo.nPos - sinfo.nMax + (int)sinfo.nPage;
|
int delta = sinfo.nPos - sinfo.nMax + (int)sinfo.nPage;
|
||||||
ScrollWindowEx (wnd, 0, (delta + Divisor-1) / Divisor, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE);
|
ScrollWindowEx (wnd, 0, (delta + Divisor-1) / Divisor, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE);
|
||||||
sinfo.nPos = sinfo.nMax - sinfo.nPage;
|
sinfo.nPos = sinfo.nMax - sinfo.nPage;
|
||||||
}
|
}
|
||||||
SetScrollInfo (wnd, SB_VERT, &sinfo, TRUE);
|
SetScrollInfo (wnd, SB_VERT, &sinfo, TRUE);
|
||||||
|
@ -809,7 +809,7 @@ void SizeView (HWND wnd, bool firstTime)
|
||||||
else if (sinfo.nPos > sinfo.nMax - (int)sinfo.nPage)
|
else if (sinfo.nPos > sinfo.nMax - (int)sinfo.nPage)
|
||||||
{
|
{
|
||||||
int delta = sinfo.nPos - sinfo.nMax + (int)sinfo.nPage;
|
int delta = sinfo.nPos - sinfo.nMax + (int)sinfo.nPage;
|
||||||
ScrollWindowEx (wnd, (delta + Divisor-1) / Divisor, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE);
|
ScrollWindowEx (wnd, (delta + Divisor-1) / Divisor, 0, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE);
|
||||||
sinfo.nPos = sinfo.nMax - sinfo.nPage;
|
sinfo.nPos = sinfo.nMax - sinfo.nPage;
|
||||||
}
|
}
|
||||||
SetScrollInfo (wnd, SB_HORZ, &sinfo, TRUE);
|
SetScrollInfo (wnd, SB_HORZ, &sinfo, TRUE);
|
||||||
|
@ -831,24 +831,24 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
SizeView (hWnd, false);
|
SizeView (hWnd, false);
|
||||||
//InvalidateRect (hWnd, NULL, TRUE);
|
//InvalidateRect (hWnd, nullptr, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
if (GetUpdateRect (hWnd, NULL, FALSE))
|
if (GetUpdateRect (hWnd, nullptr, FALSE))
|
||||||
{
|
{
|
||||||
PAINTSTRUCT paint;
|
PAINTSTRUCT paint;
|
||||||
HDC dc = BeginPaint (hWnd, &paint);
|
HDC dc = BeginPaint (hWnd, &paint);
|
||||||
|
|
||||||
if (dc != NULL)
|
if (dc != nullptr)
|
||||||
{
|
{
|
||||||
sinfo.fMask = SIF_POS;
|
sinfo.fMask = SIF_POS;
|
||||||
GetScrollInfo (hWnd, SB_HORZ, &sinfo);
|
GetScrollInfo (hWnd, SB_HORZ, &sinfo);
|
||||||
pos = sinfo.nPos;
|
pos = sinfo.nPos;
|
||||||
GetScrollInfo (hWnd, SB_VERT, &sinfo);
|
GetScrollInfo (hWnd, SB_VERT, &sinfo);
|
||||||
SetMapMode (dc, MM_ANISOTROPIC);
|
SetMapMode (dc, MM_ANISOTROPIC);
|
||||||
ScaleWindowExtEx (dc, Divisor, 1, Divisor, -1, NULL);
|
ScaleWindowExtEx (dc, Divisor, 1, Divisor, -1, nullptr);
|
||||||
SetWindowOrgEx (dc, pos + MapBounds.left, MapBounds.bottom - sinfo.nPos, NULL);
|
SetWindowOrgEx (dc, pos + MapBounds.left, MapBounds.bottom - sinfo.nPos, nullptr);
|
||||||
DrawLevel (dc);
|
DrawLevel (dc);
|
||||||
EndPaint (hWnd, &paint);
|
EndPaint (hWnd, &paint);
|
||||||
}
|
}
|
||||||
|
@ -880,7 +880,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
PostMessage (GetParent (hWnd), WM_APP, DesiredSector, 0);
|
PostMessage (GetParent (hWnd), WM_APP, DesiredSector, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
InvalidateRect (hWnd, NULL, TRUE);
|
InvalidateRect (hWnd, nullptr, TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_HSCROLL:
|
case WM_HSCROLL:
|
||||||
|
@ -902,7 +902,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
SetScrollPos (hWnd, SB_HORZ, pos, TRUE);
|
SetScrollPos (hWnd, SB_HORZ, pos, TRUE);
|
||||||
int oldx = sinfo.nPos / Divisor;
|
int oldx = sinfo.nPos / Divisor;
|
||||||
int newx = pos / Divisor;
|
int newx = pos / Divisor;
|
||||||
ScrollWindowEx (hWnd, oldx - newx, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE);
|
ScrollWindowEx (hWnd, oldx - newx, 0, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE);
|
||||||
UpdateWindow (hWnd);
|
UpdateWindow (hWnd);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -924,7 +924,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
if (pos != sinfo.nPos)
|
if (pos != sinfo.nPos)
|
||||||
{
|
{
|
||||||
SetScrollPos (hWnd, SB_VERT, pos, TRUE);
|
SetScrollPos (hWnd, SB_VERT, pos, TRUE);
|
||||||
ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE);
|
ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE);
|
||||||
UpdateWindow (hWnd);
|
UpdateWindow (hWnd);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -938,7 +938,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
if (pos != sinfo.nPos)
|
if (pos != sinfo.nPos)
|
||||||
{
|
{
|
||||||
SetScrollPos (hWnd, SB_VERT, pos, TRUE);
|
SetScrollPos (hWnd, SB_VERT, pos, TRUE);
|
||||||
ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE);
|
ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE);
|
||||||
UpdateWindow (hWnd);
|
UpdateWindow (hWnd);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -975,7 +975,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
if (pos != sinfo.nPos)
|
if (pos != sinfo.nPos)
|
||||||
{
|
{
|
||||||
SetScrollPos (hWnd, SB_HORZ, pos, TRUE);
|
SetScrollPos (hWnd, SB_HORZ, pos, TRUE);
|
||||||
ScrollWindowEx (hWnd, (sinfo.nPos - pos) / Divisor, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE);
|
ScrollWindowEx (hWnd, (sinfo.nPos - pos) / Divisor, 0, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE);
|
||||||
UpdateWindow (hWnd);
|
UpdateWindow (hWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -990,7 +990,7 @@ LRESULT CALLBACK MapViewFunc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
if (pos != sinfo.nPos)
|
if (pos != sinfo.nPos)
|
||||||
{
|
{
|
||||||
SetScrollPos (hWnd, SB_VERT, pos, TRUE);
|
SetScrollPos (hWnd, SB_VERT, pos, TRUE);
|
||||||
ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, NULL, NULL, NULL, NULL, SW_INVALIDATE|SW_ERASE);
|
ScrollWindowEx (hWnd, 0, (sinfo.nPos - pos) / Divisor, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE|SW_ERASE);
|
||||||
UpdateWindow (hWnd);
|
UpdateWindow (hWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1022,7 +1022,7 @@ void ShowView (FLevel *level)
|
||||||
{
|
{
|
||||||
Level = level;
|
Level = level;
|
||||||
|
|
||||||
if (level->Blockmap != NULL)
|
if (level->Blockmap != nullptr)
|
||||||
{
|
{
|
||||||
MapBounds.left = short(level->Blockmap[0]) - 8;
|
MapBounds.left = short(level->Blockmap[0]) - 8;
|
||||||
MapBounds.right = short(level->Blockmap[0]) + (level->Blockmap[2] << BLOCKBITS) + 8;
|
MapBounds.right = short(level->Blockmap[0]) + (level->Blockmap[2] << BLOCKBITS) + 8;
|
||||||
|
@ -1040,7 +1040,7 @@ void ShowView (FLevel *level)
|
||||||
MapSize.y = MapBounds.bottom - MapBounds.top;
|
MapSize.y = MapBounds.bottom - MapBounds.top;
|
||||||
Divisor = 1;
|
Divisor = 1;
|
||||||
|
|
||||||
if (Level->Subsectors == NULL)
|
if (Level->Subsectors == nullptr)
|
||||||
{
|
{
|
||||||
Viewing = ViewGLSubsectors;
|
Viewing = ViewGLSubsectors;
|
||||||
}
|
}
|
||||||
|
@ -1050,7 +1050,7 @@ void ShowView (FLevel *level)
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetViews ();
|
ResetViews ();
|
||||||
DialogBox (GetModuleHandle(0), MAKEINTRESOURCE(IDD_MAPVIEW), NULL, ViewDialogFunc);
|
DialogBox (GetModuleHandle(0), MAKEINTRESOURCE(IDD_MAPVIEW), nullptr, ViewDialogFunc);
|
||||||
UnregisterClass ("MapViewer", GetModuleHandle(0));
|
UnregisterClass ("MapViewer", GetModuleHandle(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,10 @@ static const char GLLumpNames[5][9] =
|
||||||
};
|
};
|
||||||
|
|
||||||
FWadReader::FWadReader (const char *filename)
|
FWadReader::FWadReader (const char *filename)
|
||||||
: Lumps (NULL), File (NULL)
|
: Lumps (nullptr), File (nullptr)
|
||||||
{
|
{
|
||||||
File = fopen (filename, "rb");
|
File = fopen (filename, "rb");
|
||||||
if (File == NULL)
|
if (File == nullptr)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Could not open input file");
|
throw std::runtime_error("Could not open input file");
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ FWadReader::FWadReader (const char *filename)
|
||||||
Header.Magic[3] != 'D')
|
Header.Magic[3] != 'D')
|
||||||
{
|
{
|
||||||
fclose (File);
|
fclose (File);
|
||||||
File = NULL;
|
File = nullptr;
|
||||||
throw std::runtime_error("Input file is not a wad");
|
throw std::runtime_error("Input file is not a wad");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,10 +341,10 @@ const char *FWadReader::LumpName (int lump)
|
||||||
}
|
}
|
||||||
|
|
||||||
FWadWriter::FWadWriter (const char *filename, bool iwad)
|
FWadWriter::FWadWriter (const char *filename, bool iwad)
|
||||||
: File (NULL)
|
: File (nullptr)
|
||||||
{
|
{
|
||||||
File = fopen (filename, "wb");
|
File = fopen (filename, "wb");
|
||||||
if (File == NULL)
|
if (File == nullptr)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Could not open output file");
|
throw std::runtime_error("Could not open output file");
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ void FWadWriter::Close ()
|
||||||
fseek (File, 4, SEEK_SET);
|
fseek (File, 4, SEEK_SET);
|
||||||
SafeWrite (head, 8);
|
SafeWrite (head, 8);
|
||||||
fclose (File);
|
fclose (File);
|
||||||
File = NULL;
|
File = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ void FWadWriter::CopyLump (FWadReader &wad, int lump)
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
ReadLump<uint8_t> (wad, lump, data, size);
|
ReadLump<uint8_t> (wad, lump, data, size);
|
||||||
if (data != NULL)
|
if (data != nullptr)
|
||||||
{
|
{
|
||||||
WriteLump (wad.LumpName (lump), data, size);
|
WriteLump (wad.LumpName (lump), data, size);
|
||||||
delete[] data;
|
delete[] data;
|
||||||
|
@ -442,7 +442,7 @@ void FWadWriter::SafeWrite (const void *buffer, size_t size)
|
||||||
if (fwrite (buffer, 1, size, File) != size)
|
if (fwrite (buffer, 1, size, File) != size)
|
||||||
{
|
{
|
||||||
fclose (File);
|
fclose (File);
|
||||||
File = NULL;
|
File = nullptr;
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
"Failed to write. Check that this directory is writable and\n"
|
"Failed to write. Check that this directory is writable and\n"
|
||||||
"that you have enough free disk space.");
|
"that you have enough free disk space.");
|
||||||
|
|
|
@ -59,7 +59,7 @@ void ReadLump (FWadReader &wad, int index, T *&data, int &size)
|
||||||
{
|
{
|
||||||
if ((unsigned)index >= (unsigned)wad.Header.NumLumps)
|
if ((unsigned)index >= (unsigned)wad.Header.NumLumps)
|
||||||
{
|
{
|
||||||
data = NULL;
|
data = nullptr;
|
||||||
size = 0;
|
size = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue