mirror of
https://git.do.srb2.org/STJr/ZenNode.git
synced 2024-11-26 22:21:16 +00:00
Get it to compile on win32/mingw
No idea if it actually works properly though, didn't test.
This commit is contained in:
parent
2e174e655d
commit
1d5d4ee39c
3 changed files with 39 additions and 26 deletions
36
DOOM/wad.cpp
36
DOOM/wad.cpp
|
@ -28,6 +28,8 @@
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -153,7 +155,7 @@ WAD::~WAD ()
|
|||
|
||||
free ( m_Name );
|
||||
}
|
||||
|
||||
|
||||
bool WAD::EnlargeDirectory ( int holePos, int entries )
|
||||
{
|
||||
int newSize = m_Header.dirSize + entries;
|
||||
|
@ -235,7 +237,7 @@ void WAD::FindMarkers ()
|
|||
m_FlatStart = FindDir ( "F_START" );
|
||||
m_FlatEnd = FindDir ( "F_END", m_FlatStart );
|
||||
}
|
||||
|
||||
|
||||
bool WAD::ReadHeader ( wadHeader *header )
|
||||
{
|
||||
ReadBytes ( header, sizeof ( wadHeader ));
|
||||
|
@ -333,7 +335,7 @@ UINT32 WAD::IndexOf ( const wadDirEntry *entry ) const
|
|||
{
|
||||
return (( entry < m_Directory ) || ( entry > m_Directory + m_Header.dirSize )) ? -1 : entry - m_Directory;
|
||||
}
|
||||
|
||||
|
||||
void WAD::SetList ( wadList *_list )
|
||||
{
|
||||
m_List = _list;
|
||||
|
@ -407,7 +409,7 @@ void WAD::Seek ( UINT32 offset )
|
|||
m_Status = ws_SEEK_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WAD::ReadBytes ( void *ptr , UINT32 size, UINT32 count )
|
||||
{
|
||||
m_Status = ws_OK;
|
||||
|
@ -417,7 +419,7 @@ void WAD::ReadBytes ( void *ptr , UINT32 size, UINT32 count )
|
|||
m_Status = ws_READ_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *WAD::ReadEntry ( const char *name, UINT32 *size, const wadDirEntry *start, const wadDirEntry *end, bool cache )
|
||||
{
|
||||
return ReadEntry ( FindDir ( name, start, end ), size, cache );
|
||||
|
@ -486,7 +488,7 @@ bool WAD::WriteEntry ( const wadDirEntry *entry, UINT32 newSize, void *newStuff,
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void WAD::OpenFile ()
|
||||
{
|
||||
if ( m_File != NULL ) fclose ( m_File );
|
||||
|
@ -538,7 +540,7 @@ void WAD::OpenFile ()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WAD::CloseFile ()
|
||||
{
|
||||
m_bValid = false;
|
||||
|
@ -567,7 +569,7 @@ void WAD::CloseFile ()
|
|||
|
||||
memset ( &m_Header, 0, sizeof ( m_Header ));
|
||||
}
|
||||
|
||||
|
||||
const wadDirEntry *WAD::GetDir ( UINT32 index ) const
|
||||
{
|
||||
return ( index >= m_Header.dirSize ) ? ( const wadDirEntry * ) NULL : &m_Directory [index];
|
||||
|
@ -604,7 +606,7 @@ bool WAD::HasChanged () const
|
|||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
bool WAD::InsertBefore ( const wLumpName *name, UINT32 newSize, void *newStuff, bool owner, const wadDirEntry *entry )
|
||||
{
|
||||
UINT32 index = IndexOf ( entry );
|
||||
|
@ -642,7 +644,7 @@ bool WAD::InsertAfter ( const wLumpName *name, UINT32 newSize, void *newStuff, b
|
|||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
bool WAD::Remove ( const wLumpName *lump, const wadDirEntry *start, const wadDirEntry *end )
|
||||
{
|
||||
const wadDirEntry *entry = FindDir ( *lump, start, end );
|
||||
|
@ -652,14 +654,14 @@ bool WAD::Remove ( const wLumpName *lump, const wadDirEntry *start, const wadDir
|
|||
|
||||
return ReduceDirectory ( index, 1 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// TBD
|
||||
int InsertBefore ( const wLumpName *, UINT32, void *, bool, const wadDirEntry * = NULL );
|
||||
int InsertAfter ( const wLumpName *, UINT32, void *, bool, const wadDirEntry * = NULL );
|
||||
// TBD
|
||||
*/
|
||||
|
||||
|
||||
bool WAD::SaveFile ( const char *newName )
|
||||
{
|
||||
if ( newName == NULL ) newName = m_Name;
|
||||
|
@ -770,7 +772,7 @@ bool WAD::SaveFile ( const char *newName )
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
wadList::wadList () :
|
||||
m_DirSize ( 0 ),
|
||||
m_MaxSize ( 0 ),
|
||||
|
@ -853,7 +855,7 @@ void wadList::UpdateDirectory ()
|
|||
ptr = ptr->Next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool wadList::Add ( WAD *wad )
|
||||
{
|
||||
if (( m_Type == wt_UNKNOWN ) && ( m_Style == wst_UNKNOWN )) {
|
||||
|
@ -942,7 +944,7 @@ bool wadList::Remove ( WAD *wad )
|
|||
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
UINT32 wadList::IndexOf ( const wadListDirEntry *entry ) const
|
||||
{
|
||||
return (( entry < m_Directory ) || ( entry > m_Directory + m_DirSize )) ? -1 : entry - m_Directory;
|
||||
|
@ -1024,7 +1026,7 @@ void wadList::AddDirectory ( WAD *wad, bool check )
|
|||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const wadListDirEntry *wadList::GetDir ( UINT32 index ) const
|
||||
{
|
||||
return ( index >= m_DirSize ) ? ( const wadListDirEntry * ) NULL : &m_Directory [index];
|
||||
|
@ -1066,7 +1068,7 @@ bool wadList::Contains ( WAD *wad ) const
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool wadList::Save ( const char *newName )
|
||||
{
|
||||
if ( IsEmpty ()) return false;
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
#define UNSUPPORTED_FEATURE -1
|
||||
#define UNRECOGNIZED_PARAMETER -2
|
||||
|
||||
|
||||
#if defined ( __GNUC__ )
|
||||
|
||||
#define stricmp strcasecmp
|
||||
|
@ -66,10 +66,8 @@
|
|||
|
||||
extern char *strupr ( char *ptr );
|
||||
extern int getch ();
|
||||
extern bool kbhit ();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int GCD ( int A, int B )
|
||||
{
|
||||
if ( A < 0 ) A = -A; else if ( A == 0 ) return 1;
|
||||
|
@ -111,7 +109,7 @@ void printHelp ()
|
|||
fprintf ( stderr, " level - ExMy for DOOM / Heretic\n" );
|
||||
fprintf ( stderr, " MAPxx for DOOM II / HEXEN\n" );
|
||||
}
|
||||
|
||||
|
||||
int parseArgs ( int index, const char *argv[] )
|
||||
{
|
||||
bool errors = false;
|
||||
|
@ -124,7 +122,7 @@ int parseArgs ( int index, const char *argv[] )
|
|||
if ( errors ) fprintf ( stderr, "\n" );
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
int getLevels ( int argIndex, const char *argv[], char names [][MAX_LUMP_NAME], wadList *list )
|
||||
{
|
||||
int index = 0, errors = 0;
|
||||
|
@ -168,7 +166,7 @@ int getLevels ( int argIndex, const char *argv[], char names [][MAX_LUMP_NAME],
|
|||
if ( errors ) fprintf ( stderr, "\n" );
|
||||
return argIndex;
|
||||
}
|
||||
|
||||
|
||||
void EnsureExtension ( char *fileName, const char *ext )
|
||||
{
|
||||
size_t length = strlen ( fileName );
|
||||
|
@ -245,7 +243,7 @@ wadList *getInputFiles ( const char *cmdLine, char *wadFileName )
|
|||
|
||||
return myList;
|
||||
}
|
||||
|
||||
|
||||
template <class T> inline T sgn ( T val ) { return ( val > 0 ) ? 1 : ( val < 0 ) ? -1 : 0; }
|
||||
|
||||
void NormalizeNODES ( wNode *node, int noNodes )
|
||||
|
@ -401,7 +399,7 @@ done:
|
|||
|
||||
return mismatches;
|
||||
}
|
||||
|
||||
|
||||
int main ( int argc, const char *argv[] )
|
||||
{
|
||||
fprintf ( stderr, "Compare Version %s (c) 2003-2004 Marc Rousseau\n\n", VERSION );
|
||||
|
|
|
@ -11,12 +11,25 @@ WARNINGS = -Wall -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Winline
|
|||
INCLUDES = -I../DOOM -I../common
|
||||
TARGETS = ZenNode bspdiff bspinfo compare
|
||||
|
||||
ifdef LINUX
|
||||
CFLAGS += -D__LINUX__
|
||||
endif
|
||||
|
||||
ifdef WIN32
|
||||
CFLAGS += -D__WIN32__
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
|
||||
WIN32=1
|
||||
else # if you on the *nix
|
||||
|
||||
system:=$(shell uname -s)
|
||||
|
||||
ifeq ($(system),Linux)
|
||||
LINUX=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef DEBUG
|
||||
CFLAGS += -DDEBUG
|
||||
LOGGER = ../common/logger/logger.o ../common/logger/string.o
|
||||
|
|
Loading…
Reference in a new issue