Update to ZDoom r1784:

- Added directory detection to the -file parameter. This obsoletes -dir, so
  that parameter is now gone.
- Removed automatic ".wad" appending from FWadCollection::InitMultipleFiles()
  since it isn't needed and prevented files without extensions from being
  loaded. D_AddFile() already takes care of adding the extension if the
  name as-given does not exist.
- Fixed: Loading single files did not print a newline in the startup text.
- Fixed: A_JumpIf(InTarget)Inventory jumped if the check amount was greater
  than the item's max amount and the item was maxed.
- Fixed: Some dmadds wads used zero-length sprites as placeholders. When you
  ran dmadds to combine it with the IWAD's sprites, they would be replaced by
  the IWAD's sprites, so when loading such wads, we should ignore those as
  valid sprites. (Thanks to entryway for finding this.) See 22ventry's
  22sprite.wad for an example.
- Replaced the use of autoconf's WORDS_BIGENDIAN with __BIG_ENDIAN__, since
  latter comes predefined by GCC.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@433 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2009-09-02 06:19:49 +00:00
parent 061394c3d9
commit b8a584f65f
45 changed files with 461 additions and 158 deletions

View file

@ -1,4 +1,26 @@
August 29, 2009 (Changes by Graf Zahl)
September 1, 2009
- Added directory detection to the -file parameter. This obsoletes -dir, so
that parameter is now gone.
- Removed automatic ".wad" appending from FWadCollection::InitMultipleFiles()
since it isn't needed and prevented files without extensions from being
loaded. D_AddFile() already takes care of adding the extension if the
name as-given does not exist.
- Fixed: Loading single files did not print a newline in the startup text.
- Fixed: A_JumpIf(InTarget)Inventory jumped if the check amount was greater
than the item's max amount and the item was maxed.
- Fixed: Some dmadds wads used zero-length sprites as placeholders. When you
ran dmadds to combine it with the IWAD's sprites, they would be replaced by
the IWAD's sprites, so when loading such wads, we should ignore those as
valid sprites. (Thanks to entryway for finding this.) See 22ventry's
22sprite.wad for an example.
August 31, 2009
- Basic Mac support: Everything compiles but does not yet link.
- Replaced the use of autoconf's WORDS_BIGENDIAN with __BIG_ENDIAN__, since
latter comes predefined by GCC.
August 29, 2009 (Changes by Graf Zahl)
- fixed: R_InitColormaps was broken since the resource file code rewrite.
- fixed: WIF_STAFF2_KICKBACK did not work anymore because it depended on conditions
that were changed some time ago.
- fixed: The damage inflictor for a rail attack was the shooter, not the puff.

View file

@ -124,21 +124,43 @@ if( WIN32 )
setupapi
oleaut32 )
else( WIN32 )
option( NO_GTK "Disable GTK+ dialogs (Not applicable to Windows)" )
option( VALGRIND "Add special Valgrind sequences to self-modifying code" )
if( APPLE )
set( FMOD_SEARCH_PATHS "/Developer/FMOD Programmers API Mac/api" )
set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES inc )
set( FMOD_LIB_PATH_SUFFIXES PATH_SUFFIXES lib )
set( NO_GTK ON )
else( APPLE )
option( NO_GTK "Disable GTK+ dialogs (Not applicable to Windows)" )
option( VALGRIND "Add special Valgrind sequences to self-modifying code" )
set( FMOD_SEARCH_PATHS
/usr/local/include
/usr/local/include/fmodex
/usr/include
/usr/include/fmodex
/opt/local/include
/opt/local/include/fmodex
/opt/include
/opt/include/fmodex )
set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES fmodex )
set( FMOD_SEARCH_PATHS
/usr/local/include
/usr/local/include/fmodex
/usr/include
/usr/include/fmodex
/opt/local/include
/opt/local/include/fmodex
/opt/include
/opt/include/fmodex )
set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES fmodex )
# Use GTK+ for the IWAD picker, if available.
if( NOT NO_GTK )
pkg_check_modules( GTK2 gtk+-2.0 )
if( GTK2_FOUND )
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK2_LIBRARIES} )
include_directories( ${GTK2_INCLUDE_DIRS} )
else( GTK2_FOUND )
set( NO_GTK ON )
endif( GTK2_FOUND )
endif( NOT NO_GTK )
endif( APPLE )
set( NASM_NAMES nasm )
if( NO_GTK )
add_definitions( -DNO_GTK=1 )
endif( NO_GTK )
# Non-Windows version also needs SDL
find_package( SDL )
if( NOT SDL_FOUND )
@ -147,21 +169,6 @@ else( WIN32 )
set( ZDOOM_LIBS "${SDL_LIBRARY}" )
include_directories( "${SDL_INCLUDE_DIR}" )
# Use GTK+ for the IWAD picker, if available.
if( NOT NO_GTK )
pkg_check_modules( GTK2 gtk+-2.0 )
if( GTK2_FOUND )
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK2_LIBRARIES} )
include_directories( ${GTK2_INCLUDE_DIRS} )
else( GTK2_FOUND )
set( NO_GTK ON )
endif( GTK2_FOUND )
endif( NOT NO_GTK )
if( NO_GTK )
add_definitions( -DNO_GTK=1 )
endif( NO_GTK )
find_path( FPU_CONTROL_DIR fpu_control.h )
if( FPU_CONTROL_DIR )
include_directories( ${FPU_CONTROL_DIR} )
@ -222,15 +229,15 @@ endif( FMOD_INCLUDE_DIR )
# Search for FMOD library
if( WIN32 )
if( WIN32 OR APPLE )
find_library( FMOD_LIBRARY ${FMOD_LIB_NAME}
PATHS ${FMOD_SEARCH_PATHS}
${FMOD_LIB_PATH_SUFFIXES} )
else( WIN32 )
else( WIN32 OR APPLE )
find_library( FMOD_LIBRARY
NAMES ${FMOD_VERSIONS}
PATHS ${FMOD_LOCAL_LIB_DIRS} )
endif( WIN32 )
endif( WIN32 OR APPLE )
if( FMOD_LIBRARY )
message( STATUS "FMOD library found at ${FMOD_LIBRARY}" )
@ -241,6 +248,13 @@ endif( FMOD_LIBRARY )
# Search for NASM
if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
if( NOT NO_ASM )
message( STATUS "Disabling assembly code for PowerPC." )
set( NO_ASM ON )
endif( NOT NO_ASM )
endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
if( NOT NO_ASM )
if( UNIX AND X64 )
find_program( GAS_PATH as )
@ -502,10 +516,17 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
set( X86_SOURCES )
else( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
set( X86_SOURCES nodebuild_classify_sse2.cpp x86.cpp )
endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
add_executable( zdoom WIN32
autostart.cpp
${ASM_SOURCES}
${SYSTEM_SOURCES}
${SSE_SOURCES}
am_map.cpp
b_bot.cpp
b_func.cpp
@ -568,7 +589,6 @@ add_executable( zdoom WIN32
name.cpp
nodebuild.cpp
nodebuild_classify_nosse2.cpp
nodebuild_classify_sse2.cpp
nodebuild_events.cpp
nodebuild_extract.cpp
nodebuild_gl.cpp
@ -647,7 +667,6 @@ add_executable( zdoom WIN32
v_video.cpp
w_wad.cpp
wi_stuff.cpp
x86.cpp
zstrformat.cpp
zstring.cpp
g_doom/a_doommisc.cpp

View file

@ -32,9 +32,6 @@ typedef uint64_t QWORD;
#ifndef USE_WINDOWS_DWORD
typedef uint32 DWORD;
#endif
#ifdef __GNUC__
typedef uint32 DWORD;
#endif
typedef uint32 BITFIELD;
typedef int INTBOOL;
@ -63,7 +60,7 @@ union QWORD_UNION
QWORD AsOne;
struct
{
#ifdef WORDS_BIG_ENDIAN
#ifdef __BIG_ENDIAN__
unsigned int Hi, Lo;
#else
unsigned int Lo, Hi;

View file

@ -28,6 +28,14 @@ gamedir will hold progdir + the game directory (id1, id2, etc)
FString progdir;
//==========================================================================
//
// IsSeperator
//
// Returns true if the character is a path seperator.
//
//==========================================================================
static inline bool IsSeperator (int c)
{
if (c == '/')
@ -39,6 +47,14 @@ static inline bool IsSeperator (int c)
return false;
}
//==========================================================================
//
// FixPathSeperator
//
// Convert backslashes to forward slashes.
//
//==========================================================================
void FixPathSeperator (char *path)
{
while (*path)
@ -49,6 +65,14 @@ void FixPathSeperator (char *path)
}
}
//==========================================================================
//
// copystring
//
// Replacement for strdup that uses new instead of malloc.
//
//==========================================================================
char *copystring (const char *s)
{
char *b;
@ -66,6 +90,13 @@ char *copystring (const char *s)
return b;
}
//==========================================================================
//
// ReplaceString
//
// Do not use in new code.
//
//==========================================================================
void ReplaceString (char **ptr, const char *str)
{
@ -87,11 +118,12 @@ void ReplaceString (char **ptr, const char *str)
*/
/*
================
Q_filelength
================
*/
//==========================================================================
//
// Q_filelength
//
//==========================================================================
int Q_filelength (FILE *f)
{
int pos;
@ -106,17 +138,20 @@ int Q_filelength (FILE *f)
}
/*
==============
FileExists
==============
*/
//==========================================================================
//
// FileExists
//
// Returns true if the given path exists and is a readable file.
//
//==========================================================================
bool FileExists (const char *filename)
{
FILE *f;
// [RH] Empty filenames are never there
if (*filename == 0)
if (filename == NULL || *filename == 0)
return false;
f = fopen (filename, "r");
@ -126,6 +161,31 @@ bool FileExists (const char *filename)
return true;
}
//==========================================================================
//
// DirEntryExists
//
// Returns true if the given path exists, be it a directory or a file.
//
//==========================================================================
bool DirEntryExists(const char *pathname)
{
if (pathname == NULL || *pathname == 0)
return false;
struct stat info;
return stat(pathname, &info) == 0;
}
//==========================================================================
//
// DefaultExtension -- char array version
//
// Appends the extension to a pathname if it does not already have one.
//
//==========================================================================
void DefaultExtension (char *path, const char *extension)
{
char *src;
@ -145,6 +205,14 @@ void DefaultExtension (char *path, const char *extension)
strcat (path, extension);
}
//==========================================================================
//
// DefaultExtension -- FString version
//
// Appends the extension to a pathname if it does not already have one.
//
//==========================================================================
void DefaultExtension (FString &path, const char *extension)
{
const char *src = &path[int(path.Len())-1];
@ -160,13 +228,17 @@ void DefaultExtension (FString &path, const char *extension)
}
/*
====================
Extract file parts
====================
*/
//==========================================================================
//
// ExtractFilePath
//
// Returns the directory part of a pathname.
//
// FIXME: should include the slash, otherwise
// backing to an empty path will be wrong when appending a slash
//
//==========================================================================
FString ExtractFilePath (const char *path)
{
const char *src;
@ -182,6 +254,14 @@ FString ExtractFilePath (const char *path)
return FString(path, src - path);
}
//==========================================================================
//
// ExtractFileBase
//
// Returns the file part of a pathname, optionally including the extension.
//
//==========================================================================
FString ExtractFileBase (const char *path, bool include_extension)
{
const char *src, *dot;
@ -221,11 +301,12 @@ FString ExtractFileBase (const char *path, bool include_extension)
}
/*
==============
ParseNum / ParseHex
==============
*/
//==========================================================================
//
// ParseHex
//
//==========================================================================
int ParseHex (const char *hex)
{
const char *str;
@ -253,6 +334,11 @@ int ParseHex (const char *hex)
return num;
}
//==========================================================================
//
// ParseNum
//
//==========================================================================
int ParseNum (const char *str)
{
@ -263,8 +349,13 @@ int ParseNum (const char *str)
return atol (str);
}
//==========================================================================
//
// IsNum
//
// [RH] Returns true if the specified string is a valid decimal number
//
//==========================================================================
bool IsNum (const char *str)
{
@ -279,7 +370,13 @@ bool IsNum (const char *str)
return true;
}
//==========================================================================
//
// CheckWildcards
//
// [RH] Checks if text matches the wildcard pattern using ? or *
//
//==========================================================================
bool CheckWildcards (const char *pattern, const char *text)
{
@ -317,7 +414,13 @@ bool CheckWildcards (const char *pattern, const char *text)
return (*pattern | *text) == 0;
}
//==========================================================================
//
// FormatGUID
//
// [RH] Print a GUID to a text buffer using the standard format.
//
//==========================================================================
void FormatGUID (char *buffer, size_t buffsize, const GUID &guid)
{
@ -329,7 +432,14 @@ void FormatGUID (char *buffer, size_t buffsize, const GUID &guid)
guid.Data4[6], guid.Data4[7]);
}
//==========================================================================
//
// myasctime
//
// [RH] Returns the current local time as ASCII, even if it's too early
//
//==========================================================================
const char *myasctime ()
{
time_t clock;
@ -347,10 +457,13 @@ const char *myasctime ()
}
}
/************************************************************************/
/* CreatePath: creates a directory including all levels necessary */
/* */
/************************************************************************/
//==========================================================================
//
// CreatePath
//
// Creates a directory including all levels necessary
//
//==========================================================================
#ifdef _WIN32
void DoCreatePath(const char *fn)
{
@ -413,8 +526,14 @@ void CreatePath(const char *fn)
}
#endif
//==========================================================================
//
// strbin1 -- In-place version
//
// [RH] Replaces the escape sequences in a string with actual escaped characters.
// This operation is done in-place. The result is the new length of the string.
//
//==========================================================================
int strbin (char *str)
{
@ -504,8 +623,14 @@ int strbin (char *str)
return int(str - start);
}
//==========================================================================
//
// strbin1 -- String-creating version
//
// [RH] Replaces the escape sequences in a string with actual escaped characters.
// This operation is done in-place. The result is the new length of the string.
// This operation is done in-place.
//
//==========================================================================
FString strbin1 (const char *start)
{

View file

@ -18,6 +18,7 @@
int Q_filelength (FILE *f);
bool FileExists (const char *filename);
bool DirEntryExists (const char *pathname);
extern FString progdir;

View file

@ -1235,7 +1235,7 @@ void D_AddFile (const char *file, bool check)
return;
}
if (check && !FileExists (file))
if (check && !DirEntryExists (file))
{
const char *f = BaseFileSearch (file, ".wad");
if (f == NULL)
@ -1405,13 +1405,13 @@ static const char *BaseFileSearch (const char *file, const char *ext, bool lookf
if (lookfirstinprogdir)
{
mysnprintf (wad, countof(wad), "%s%s%s", progdir.GetChars(), progdir[progdir.Len() - 1] != '/' ? "/" : "", file);
if (FileExists (wad))
if (DirEntryExists (wad))
{
return wad;
}
}
if (FileExists (file))
if (DirEntryExists (file))
{
mysnprintf (wad, countof(wad), "%s", file);
return wad;
@ -1454,7 +1454,7 @@ static const char *BaseFileSearch (const char *file, const char *ext, bool lookf
if (dir != NULL)
{
mysnprintf (wad, countof(wad), "%s%s%s", dir, dir[strlen (dir) - 1] != '/' ? "/" : "", file);
if (FileExists (wad))
if (DirEntryExists (wad))
{
return wad;
}
@ -1748,11 +1748,8 @@ void D_DoomMain (void)
files2->Destroy();
files3->Destroy();
const char *loaddir = Args->CheckValue("-dir");
// FIXME: consider the search path list for directory, too.
Printf ("W_Init: Init WADfiles.\n");
Wads.InitMultipleFiles (&wadfiles, loaddir);
Wads.InitMultipleFiles (&wadfiles);
// [RH] Initialize localizable strings.
GStrings.LoadStrings (false);

View file

@ -347,10 +347,10 @@ enum
#define BLINKTHRESHOLD (4*32)
#ifndef WORDS_BIGENDIAN
#define MAKE_ID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24))
#ifndef __BIG_ENDIAN__
#define MAKE_ID(a,b,c,d) ((DWORD)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
#else
#define MAKE_ID(a,b,c,d) ((d)|((c)<<8)|((b)<<16)|((a)<<24))
#define MAKE_ID(a,b,c,d) ((DWORD)((d)|((c)<<8)|((b)<<16)|((a)<<24)))
#endif
#endif // __DOOMDEF_H__

View file

@ -159,7 +159,7 @@ struct PalEntry
operator uint32 () const { return d; }
PalEntry &operator= (uint32 other) { d = other; return *this; }
PalEntry InverseColor() const { PalEntry nc; nc.a = a; nc.r = 255 - r; nc.g = 255 - g; nc.b = 255 - b; return nc; }
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
PalEntry (BYTE ir, BYTE ig, BYTE ib) : a(0), r(ir), g(ig), b(ib) {}
PalEntry (BYTE ia, BYTE ir, BYTE ig, BYTE ib) : a(ia), r(ir), g(ig), b(ib) {}
union

View file

@ -79,11 +79,11 @@
#define NEW_SPRITE ((BYTE)11) // A new sprite name follows
#define OLD_SPRITE ((BYTE)12) // Reference to an old sprite name follows
#ifdef WORDS_BIGENDIAN
static inline WORD SWAP_WORD(x) { return x; }
static inline DWORD SWAP_DWORD(x) { return x; }
static inline QWORD SWAP_QWORD(x) { return x; }
static inline void SWAP_FLOAT(x) { }
#ifdef __BIG_ENDIAN__
static inline WORD SWAP_WORD(WORD x) { return x; }
static inline DWORD SWAP_DWORD(DWORD x) { return x; }
static inline QWORD SWAP_QWORD(QWORD x) { return x; }
static inline void SWAP_FLOAT(float x) { }
static inline void SWAP_DOUBLE(double &dst, double src) { dst = src; }
#else
#ifdef _MSC_VER

View file

@ -172,7 +172,7 @@ void FHealthBar::MakeTexture ()
void FHealthBar::FillBar (int min, int max, BYTE light, BYTE dark)
{
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
SDWORD fill = (light << 24) | (dark << 16) | (light << 8) | dark;
#else
SDWORD fill = light | (dark << 8) | (light << 16) | (dark << 24);

View file

@ -32,12 +32,16 @@
**
*/
#ifdef __FreeBSD__
#if defined(__FreeBSD__)
#include <stdlib.h>
#include <malloc_np.h>
#elif defined(__APPLE__)
#include <stdlib.h>
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "i_system.h"
#include "dobject.h"
@ -46,7 +50,9 @@
#define _malloc_dbg(s,b,f,l) malloc(s)
#define _realloc_dbg(p,s,b,f,l) realloc(p,s)
#endif
#ifndef _WIN32
#if defined(__APPLE__)
#define _msize(p) malloc_size(p)
#elif !defined(_WIN32)
#define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD
#endif

View file

@ -38,6 +38,16 @@ static BYTE JoyAngleButtons[8] = { 1, 1+4, 4, 2+4, 2, 2+8, 8, 1+8 };
// CODE --------------------------------------------------------------------
//==========================================================================
//
// IJoystickConfig - Virtual Destructor
//
//==========================================================================
IJoystickConfig::~IJoystickConfig()
{
}
//==========================================================================
//
// M_SetJoystickConfigSection

View file

@ -20,6 +20,8 @@ enum EJoyAxis
// Generic configuration interface for a controller.
struct NOVTABLE IJoystickConfig
{
virtual ~IJoystickConfig() = 0;
virtual FString GetName() = 0;
virtual float GetSensitivity() = 0;
virtual void SetSensitivity(float scale) = 0;

View file

@ -298,7 +298,7 @@ static long ParseCommandLine (const char *args, int *argc, char **argv)
}
#ifdef unix
#if defined(unix) || defined(__APPLE__)
FString GetUserFile (const char *file, bool nodir)
{
FString path;
@ -447,10 +447,10 @@ void WritePCXfile (FILE *file, const BYTE *buffer, const PalEntry *palette,
pcx.bits_per_pixel = 8; // 256 (or more) colors
pcx.xmin = 0;
pcx.ymin = 0;
pcx.xmax = LittleShort(width-1);
pcx.ymax = LittleShort(height-1);
pcx.hdpi = LittleShort(75);
pcx.vdpi = LittleShort(75);
pcx.xmax = LittleShort((unsigned short)(width-1));
pcx.ymax = LittleShort((unsigned short)(height-1));
pcx.hdpi = LittleShort((unsigned short)75);
pcx.vdpi = LittleShort((unsigned short)75);
memset (pcx.palette, 0, sizeof(pcx.palette));
pcx.reserved = 0;
pcx.color_planes = (color_type == SS_PAL) ? 1 : 3; // chunky image

View file

@ -27,7 +27,57 @@
// Endianess handling.
// WAD files are stored little endian.
#ifdef WORDS_BIGENDIAN
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
inline short LittleShort(short x)
{
return (short)CFSwapInt16LittleToHost((uint16_t)x);
}
inline unsigned short LittleShort(unsigned short x)
{
return CFSwapInt16LittleToHost(x);
}
inline short LittleShort(int x)
{
return CFSwapInt16LittleToHost((uint16_t)x);
}
inline int LittleLong(int x)
{
return CFSwapInt32LittleToHost((uint32_t)x);
}
inline unsigned int LittleLong(unsigned int x)
{
return CFSwapInt32LittleToHost(x);
}
inline short BigShort(short x)
{
return (short)CFSwapInt16BigToHost((uint16_t)x);
}
inline unsigned short BigShort(unsigned short x)
{
return CFSwapInt16BigToHost(x);
}
inline int BigLong(int x)
{
return CFSwapInt32BigToHost((uint32_t)x);
}
inline unsigned int BigLong(unsigned int x)
{
return CFSwapInt32BigToHost(x);
}
#else
#ifdef __BIG_ENDIAN__
// Swap 16bit, that is, MSB and LSB byte.
// No masking with 0xFF should be necessary.
@ -122,6 +172,6 @@ inline int BigLong (int x)
}
#endif
#endif // WORDS_BIGENDIAN
#endif // __BIG_ENDIAN__
#endif // __APPLE__
#endif // __M_SWAP_H__

View file

@ -21,7 +21,7 @@
#include "md5.h"
#include "templates.h"
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
void byteSwap(DWORD *buf, unsigned words)
{
BYTE *p = (BYTE *)buf;

View file

@ -272,7 +272,9 @@ inline int FNodeBuilder::PointOnSide (int x, int y, int x1, int y1, int dx, int
inline int FNodeBuilder::ClassifyLine (node_t &node, const FPrivSeg *seg, int &sidev1, int &sidev2)
{
#ifdef __SSE2__
#if !defined(_M_IX86) && !defined(_M_X64) && !defined(__i386__) && !defined(__amd64__)
return ClassifyLine2 (node, seg, sidev1, sidev2);
#elif defined(__SSE2__)
// If compiling with SSE2 support everywhere, just use the SSE2 version.
return ClassifyLineSSE2 (node, seg, sidev1, sidev2);
#elif defined(_MSC_VER) && _MSC_VER < 1300

View file

@ -214,7 +214,7 @@ void DiskWriterIO::OPLdeinit()
fseek(File, 12, SEEK_SET);
len[0] = LittleLong(CurIntTime);
len[1] = LittleLong(where_am_i - 24);
len[1] = LittleLong(DWORD(where_am_i - 24));
fwrite(len, 4, 2, File);
}
fclose(File);

View file

@ -1832,8 +1832,8 @@ void DACSThinker::Serialize (FArchive &arc)
if (RunningScripts[i])
arc << RunningScripts[i] << i;
}
DLevelScript *nil = NULL;
arc << nil;
DLevelScript *nilptr = NULL;
arc << nilptr;
}
else
{

View file

@ -19,7 +19,7 @@ static int WriteBLOCKMAP (FILE *file);
static int WriteBEHAVIOR (FILE *file);
#define APPEND(pos,name) \
lumps[pos].FilePos = LittleLong(ftell (file)); \
lumps[pos].FilePos = LittleLong((int)ftell (file)); \
lumps[pos].Size = LittleLong(Write##name (file)); \
memcpy (lumps[pos].Name, #name, sizeof(#name)-1);
@ -101,8 +101,8 @@ static int WriteTHINGS (FILE *file)
mt.x = LittleShort(short(mo->x >> FRACBITS));
mt.y = LittleShort(short(mo->y >> FRACBITS));
mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360)));
mt.type = LittleShort(1);
mt.flags = LittleShort(7|224|MTF_SINGLE);
mt.type = LittleShort((short)1);
mt.flags = LittleShort((short)(7|224|MTF_SINGLE));
fwrite (&mt, sizeof(mt), 1, file);
return sizeof (mt);
}
@ -184,7 +184,7 @@ static int WriteSEGS (FILE *file)
ms.v1 = LittleShort(short(segs[i].v1 - vertexes));
ms.v2 = LittleShort(short(segs[i].v2 - vertexes));
ms.linedef = LittleShort(short(segs[i].linedef - lines));
ms.side = LittleShort(DWORD(segs[i].sidedef - sides) == segs[i].linedef->sidenum[0] ? 0 : 1);
ms.side = DWORD(segs[i].sidedef - sides) == segs[i].linedef->sidenum[0] ? 0 : LittleShort((short)1);
ms.angle = LittleShort(short(R_PointToAngle2 (segs[i].v1->x, segs[i].v1->y, segs[i].v2->x, segs[i].v2->y)>>16));
fwrite (&ms, sizeof(ms), 1, file);
}
@ -247,7 +247,7 @@ static int WriteSECTORS (FILE *file)
ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::ceiling) >> FRACBITS));
uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor)));
uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling)));
ms.lightlevel = LittleShort(sectors[i].lightlevel);
ms.lightlevel = LittleShort((short)sectors[i].lightlevel);
ms.special = LittleShort(sectors[i].special);
ms.tag = LittleShort(sectors[i].tag);
fwrite (&ms, sizeof(ms), 1, file);

View file

@ -129,7 +129,7 @@ private:
operator int() const { return STYLE_Normal; }
};
extern const FRenderStyle LegacyRenderStyles[STYLE_Count];
extern FRenderStyle LegacyRenderStyles[STYLE_Count];
inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
{

View file

@ -125,7 +125,11 @@ FDynamicColormap ShadeFakeColormap[16];
BYTE identitymap[256];
// Convert legacy render styles to flexible render styles.
const FRenderStyle LegacyRenderStyles[STYLE_Count] =
// Apple's GCC 4.0.1 apparently wants to initialize the AsDWORD member of FRenderStyle
// rather than the struct before it, which goes against the standard.
#ifndef __APPLE__
FRenderStyle LegacyRenderStyles[STYLE_Count] =
{
/* STYLE_None */ {{ STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 }},
/* STYLE_Normal */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 }},
@ -138,6 +142,38 @@ const FRenderStyle LegacyRenderStyles[STYLE_Count] =
/* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }},
/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }},
};
#else
FRenderStyle LegacyRenderStyles[STYLE_Count];
static const BYTE Styles[STYLE_Count * 4] =
{
STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1,
STYLEOP_Fuzz, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_TransSoulsAlpha,
STYLEOP_FuzzOrAdd, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 | STYLEF_ColorIsFixed,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed,
};
static struct LegacyInit
{
LegacyInit()
{
for (int i = 0; i < STYLE_Count; ++i)
{
LegacyRenderStyles[i].BlendOp = Styles[i*4];
LegacyRenderStyles[i].SrcAlpha = Styles[i*4+1];
LegacyRenderStyles[i].DestAlpha = Styles[i*4+2];
LegacyRenderStyles[i].Flags = Styles[i*4+3];
}
}
} DoLegacyInit;
#endif
FArchive &operator<< (FArchive &arc, FRenderStyle &style)
{

View file

@ -729,8 +729,8 @@ void R_InitTranslationTables ()
// Full alpha
for (i = 0; i < 16; ++i)
{
ShadeFakeColormap[i].Color = -1;
ShadeFakeColormap[i].Desaturate = -1;
ShadeFakeColormap[i].Color = ~0u;
ShadeFakeColormap[i].Desaturate = ~0u;
ShadeFakeColormap[i].Next = NULL;
ShadeFakeColormap[i].Maps = table;

View file

@ -67,7 +67,7 @@ FLumpFile::FLumpFile(const char *filename, FileReader *file) : FUncompressedFile
//
//==========================================================================
bool FLumpFile::Open(bool)
bool FLumpFile::Open(bool quiet)
{
FString name(ExtractFileBase (Filename));
@ -81,6 +81,10 @@ bool FLumpFile::Open(bool)
Lumps->Flags = 0;
Lumps->FullName = NULL;
NumLumps = 1;
if (!quiet)
{
Printf("\n");
}
return true;
}

View file

@ -250,10 +250,18 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
{
if (!warned)
{
Printf(TEXTCOLOR_YELLOW"WARNING: Overlapping namespaces found (lump %d.)\n", j);
Printf(TEXTCOLOR_YELLOW"WARNING: Overlapping namespaces found (lump %d)\n", j);
}
warned = true;
}
else if (space == ns_sprites && Lumps[j].LumpSize < 8)
{
// sf 26/10/99:
// ignore sprite lumps smaller than 8 bytes (the smallest possible)
// in size -- this was used by some dmadds wads
// as an 'empty' graphics resource
DPrintf(" Skipped empty sprite %s (lump %d)\n", Lumps[j].Name, j);
}
else
{
Lumps[j].Namespace = space;

View file

@ -383,7 +383,7 @@ int cc_install_handlers(int num_signals, int *signals, const char *logfile, int
sa.sa_sigaction = crash_catcher;
#ifndef __FreeBSD__
#if !defined(__FreeBSD__) && !defined(__APPLE__)
sa.sa_flags = SA_ONESHOT | SA_NODEFER | SA_SIGINFO;
#else
sa.sa_flags = SA_NODEFER | SA_SIGINFO;

View file

@ -511,7 +511,11 @@ bool I_WriteIniFailed ()
static const char *pattern;
#ifdef __APPLE__
static int matchfile (struct dirent *ent)
#else
static int matchfile (const struct dirent *ent)
#endif
{
return fnmatch (pattern, ent->d_name, FNM_NOESCAPE) == 0;
}
@ -643,3 +647,16 @@ unsigned int I_MakeRNGSeed()
return seed;
}
#if !defined(__amd64__) && !defined(__i386__)
extern "C" CPUInfo CPU;
void CheckCPUID(CPUInfo *cpu)
{
memset(cpu, 0, sizeof(*cpu));
cpu->DataL1LineSize = 32; // Assume a 32-byte cache line
}
void DumpCPUInfo(const CPUInfo *cpu)
{
}
#endif

View file

@ -44,7 +44,11 @@ extern HWND Window;
#define FALSE 0
#define TRUE 1
#endif
#ifdef __APPLE__
#include <stdlib.h>
#else
#include <malloc.h>
#endif
#include "templates.h"
#include "fmodsound.h"

View file

@ -73,8 +73,7 @@ protected:
static bool read(SoundStream *stream, void *buff, int len, void *userdata);
};
#pragma pack(push)
#pragma pack(1)
#pragma pack(push, 1)
typedef struct tagITFILEHEADER
{

View file

@ -33,7 +33,7 @@
// HEADER FILES ------------------------------------------------------------
#ifndef __FreeBSD__
#if !defined(__FreeBSD__) && !defined(__APPLE__)
#include <malloc.h>
#else
#include <stdlib.h>

View file

@ -663,7 +663,7 @@ TimidityWaveWriterMIDIDevice::TimidityWaveWriterMIDIDevice(const char *filename,
if (3 != fwrite(work, 4, 3, File)) goto fail;
fmt.ChunkID = MAKE_ID('f','m','t',' ');
fmt.ChunkLen = LittleLong(sizeof(fmt) - 8);
fmt.ChunkLen = LittleLong(DWORD(sizeof(fmt) - 8));
fmt.FormatTag = LittleShort(0xFFFE); // WAVE_FORMAT_EXTENSIBLE
fmt.Channels = LittleShort(2);
fmt.SamplesPerSec = LittleLong((int)Renderer->rate);
@ -712,12 +712,12 @@ TimidityWaveWriterMIDIDevice::~TimidityWaveWriterMIDIDevice()
DWORD size;
// data chunk size
size = LittleLong(pos - 8);
size = LittleLong(DWORD(pos - 8));
if (0 == fseek(File, 4, SEEK_SET))
{
if (1 == fwrite(&size, 4, 1, File))
{
size = LittleLong(pos - 12 - sizeof(FmtChunk) - 8);
size = LittleLong(DWORD(pos - 12 - sizeof(FmtChunk) - 8));
if (0 == fseek(File, 4 + sizeof(FmtChunk) + 4, SEEK_CUR))
{
if (1 == fwrite(&size, 4, 1, File))

View file

@ -36,7 +36,7 @@
#include "zstring.h"
#ifdef unix
#ifndef _WIN32
#ifdef NO_CLOCK_GETTIME
class cycle_t

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "1777"
#define ZD_SVN_REVISION_NUMBER 1777
#define ZD_SVN_REVISION_STRING "1784"
#define ZD_SVN_REVISION_NUMBER 1784

View file

@ -231,7 +231,7 @@ FTexture *DDSTexture_TryCreate (FileReader &data, int lumpnum)
data.Seek (4, SEEK_SET);
data.Read (&surfdesc, sizeof(surfdesc));
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
// Every single element of the header is a DWORD
for (unsigned int i = 0; i < sizeof(DDSURFACEDESC2) / 4; ++i)
{

View file

@ -125,11 +125,9 @@ FTexture * PCXTexture_TryCreate(FileReader & file, int lumpnum)
return NULL;
}
#ifdef WORDS_BIGENDIAN
hdr.xmin = LittleShort(hdr.xmin);
hdr.xmax = LittleShort(hdr.xmax);
hdr.bytesPerScanLine = LittleShort(hdr.bytesPerScanLine);
#endif
if (hdr.manufacturer != 10 || hdr.encoding != 1) return NULL;
if (hdr.version != 0 && hdr.version != 2 && hdr.version != 3 && hdr.version != 4 && hdr.version != 5) return NULL;

View file

@ -114,10 +114,8 @@ FTexture *TGATexture_TryCreate(FileReader & file, int lumpnum)
file.Seek(0, SEEK_SET);
file.Read(&hdr, sizeof(hdr));
#ifdef WORDS_BIGENDIAN
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
#endif
// Not much that can be done here because TGA does not have a proper
// header to be identified with.
@ -130,10 +128,8 @@ FTexture *TGATexture_TryCreate(FileReader & file, int lumpnum)
file.Seek(0, SEEK_SET);
file.Read(&hdr, sizeof(hdr));
#ifdef WORDS_BIGENDIAN
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
#endif
return new FTGATexture(lumpnum, &hdr);
}
@ -303,12 +299,10 @@ void FTGATexture::MakeTexture ()
lump.Read(&hdr, sizeof(hdr));
lump.Seek(hdr.id_len, SEEK_CUR);
#ifdef WORDS_BIGENDIAN
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
hdr.cm_first = LittleShort(hdr.cm_first);
hdr.cm_length = LittleShort(hdr.cm_length);
#endif
if (hdr.has_cm)
{
@ -507,12 +501,10 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, i
if (w < 0 || w > Width) w = Width;
if (h < 0 || h > Height) h = Height;
#ifdef WORDS_BIGENDIAN
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
hdr.cm_first = LittleShort(hdr.cm_first);
hdr.cm_length = LittleShort(hdr.cm_length);
#endif
if (hdr.has_cm)
{

View file

@ -506,12 +506,19 @@ void DoJumpIfInventory(AActor * owner, DECLARE_PARAMINFO)
if (!Type || owner == NULL) return;
AInventory * Item=owner->FindInventory(Type);
AInventory *Item = owner->FindInventory(Type);
if (Item)
{
if (ItemAmount>0 && Item->Amount>=ItemAmount) ACTION_JUMP(JumpOffset);
else if (Item->Amount>=Item->MaxAmount) ACTION_JUMP(JumpOffset);
if (ItemAmount > 0)
{
if (Item->Amount >= ItemAmount)
ACTION_JUMP(JumpOffset);
}
else if (Item->Amount >= Item->MaxAmount)
{
ACTION_JUMP(JumpOffset);
}
}
}

View file

@ -435,8 +435,8 @@ static void Parse_wlnk(DLS_Data *data, RIFF_Chunk *chunk, DLS_Region *region)
WAVELINK *wlnk = (WAVELINK *)chunk->data;
wlnk->fusOptions = LittleShort(wlnk->fusOptions);
wlnk->usPhaseGroup = LittleShort(wlnk->usPhaseGroup);
wlnk->ulChannel = LittleShort(wlnk->ulChannel);
wlnk->ulTableIndex = LittleShort(wlnk->ulTableIndex);
wlnk->ulChannel = LittleLong((unsigned int)wlnk->ulChannel);
wlnk->ulTableIndex = LittleLong((unsigned int)wlnk->ulTableIndex);
region->wlnk = wlnk;
}

View file

@ -587,7 +587,7 @@ static void ParseGen(SFFile *sf2, FileReader *f, DWORD chunkid, DWORD chunklen)
{
gen->Oper = read_uword(f);
gen->uAmount = read_uword(f);
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
if (gen->Oper == GEN_keyRange || gen->Oper == GEN_velRange)
{
// Reswap range generators

View file

@ -578,7 +578,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l
break;
case DTA_RenderStyle:
parms->style = va_arg (tags, FRenderStyle);
parms->style.AsDWORD = va_arg (tags, DWORD);
break;
}
tag = va_arg (tags, DWORD);

View file

@ -488,6 +488,7 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in
to[i] = t;
}
}
#if defined(_M_X64) || defined(_M_IX86) || defined(__i386__) || defined(__amd64__)
else if (CPU.bSSE2)
{
if (count >= 4)
@ -503,6 +504,7 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in
to += not3count;
}
}
#endif
#ifdef X86_ASM
else if (CPU.bMMX)
{

View file

@ -360,7 +360,7 @@ static void Scale8 (BYTE *src, int srcpitch,
{
DWORD work;
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
work = src[xf >> FRACBITS] << 24; xf += xstep;
work |= src[xf >> FRACBITS] << 16; xf += xstep;
work |= src[xf >> FRACBITS] << 8; xf += xstep;
@ -416,7 +416,7 @@ static void Convert8 (BYTE *src, int srcpitch,
for (savedx = x, x >>= 2; x != 0; x--)
{
*(DWORD *)dest =
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
(GPfxPal.Pal8[src[0]] << 24) |
(GPfxPal.Pal8[src[1]] << 16) |
(GPfxPal.Pal8[src[2]] << 8) |
@ -454,7 +454,7 @@ static void Convert8 (BYTE *src, int srcpitch,
{
DWORD work;
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
work = GPfxPal.Pal8[src[xf >> FRACBITS]] << 24; xf += xstep;
work |= GPfxPal.Pal8[src[xf >> FRACBITS]] << 16; xf += xstep;
work |= GPfxPal.Pal8[src[xf >> FRACBITS]] << 8; xf += xstep;
@ -510,7 +510,7 @@ static void Convert16 (BYTE *src, int srcpitch,
for (savedx = x, x >>= 1; x != 0; x--)
{
*(DWORD *)dest =
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
(GPfxPal.Pal16[src[0]] << 16) |
(GPfxPal.Pal16[src[1]]);
#else
@ -544,7 +544,7 @@ static void Convert16 (BYTE *src, int srcpitch,
{
DWORD work;
#ifdef WORDS_BIGENDIAN
#ifdef __BIG_ENDIAN__
work = GPfxPal.Pal16[src[xf >> FRACBITS]] << 16; xf += xstep;
work |= GPfxPal.Pal16[src[xf >> FRACBITS]]; xf += xstep;
#else

View file

@ -160,7 +160,7 @@ void FWadCollection::DeleteAll ()
//
//==========================================================================
void FWadCollection::InitMultipleFiles (wadlist_t **filenames, const char *loaddir)
void FWadCollection::InitMultipleFiles (wadlist_t **filenames)
{
int numfiles;
@ -172,18 +172,10 @@ void FWadCollection::InitMultipleFiles (wadlist_t **filenames, const char *loadd
{
wadlist_t *next = (*filenames)->next;
int baselump = NumLumps;
char name[PATH_MAX];
// [RH] Automatically append .wad extension if none is specified.
strcpy (name, (*filenames)->name);
FixPathSeperator (name);
DefaultExtension (name, ".wad");
AddFile (name);
AddFile ((*filenames)->name);
M_Free (*filenames);
*filenames = next;
}
if (loaddir != NULL) AddFile(loaddir, NULL, true);
NumLumps = LumpInfo.Size();
if (NumLumps == 0)
@ -230,9 +222,20 @@ int FWadCollection::AddExternalFile(const char *filename)
// [RH] Removed reload hack
//==========================================================================
void FWadCollection::AddFile (const char *filename, FileReader *wadinfo, bool isdir)
void FWadCollection::AddFile (const char *filename, FileReader *wadinfo)
{
int startlump;
int startlump;
bool isdir;
// Does this exist? If so, is it a directory?
struct stat info;
if (stat(filename, &info) != 0)
{
Printf(TEXTCOLOR_RED "Could not stat %s\n", filename);
PrintLastError();
return;
}
isdir = (info.st_mode & S_IFDIR) != 0;
if (wadinfo == NULL && !isdir)
{
@ -253,8 +256,10 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo, bool is
FResourceFile *resfile;
if (!isdir) resfile = FResourceFile::OpenResourceFile(filename, wadinfo);
else resfile = FResourceFile::OpenDirectory(filename);
if (!isdir)
resfile = FResourceFile::OpenResourceFile(filename, wadinfo);
else
resfile = FResourceFile::OpenDirectory(filename);
if (resfile != NULL)
{

View file

@ -153,8 +153,8 @@ public:
// The wadnum for the IWAD
enum { IWAD_FILENUM = 1 };
void InitMultipleFiles (wadlist_t **filenames, const char *loaddir);
void AddFile (const char *filename, FileReader *wadinfo = NULL, bool isdir = false);
void InitMultipleFiles (wadlist_t **filenames);
void AddFile (const char *filename, FileReader *wadinfo = NULL);
int CheckIfWadLoaded (const char *name);
const char *GetWadName (int wadnum) const;

View file

@ -88,7 +88,7 @@
// Maximum number of files that might appear in a crash report.
#define MAX_FILES 5
#ifndef WORDS_BIGENDIAN
#ifndef __BIG_ENDIAN__
#define MAKE_ID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24))
#else
#define MAKE_ID(a,b,c,d) ((d)|((c)<<8)|((b)<<16)|((a)<<24))