mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Basic Mac support: Everything compiles but does not yet link.
SVN r1780 (trunk)
This commit is contained in:
parent
3f003e06db
commit
33a397c04b
27 changed files with 215 additions and 71 deletions
|
@ -1,4 +1,5 @@
|
||||||
August 31, 2009
|
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
|
- Replaced the use of autoconf's WORDS_BIGENDIAN with __BIG_ENDIAN__, since
|
||||||
latter comes predefined by GCC.
|
latter comes predefined by GCC.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__)
|
||||||
#if defined(_DEBUG) && defined(_MSC_VER)
|
#if defined(_DEBUG) && defined(_MSC_VER)
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -277,3 +278,4 @@ static void it_filter_sse(DUMB_CLICK_REMOVER *cr, IT_FILTER_STATE *state, sample
|
||||||
state->currsample = currsample;
|
state->currsample = currsample;
|
||||||
state->prevsample = prevsample;
|
state->prevsample = prevsample;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -34,6 +34,10 @@ typedef int SRes;
|
||||||
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
|
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && !__LP64__
|
||||||
|
#define _LZMA_UINT32_IS_ULONG
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ZCONF_H
|
#ifndef ZCONF_H
|
||||||
typedef unsigned char Byte;
|
typedef unsigned char Byte;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -124,21 +124,43 @@ if( WIN32 )
|
||||||
setupapi
|
setupapi
|
||||||
oleaut32 )
|
oleaut32 )
|
||||||
else( WIN32 )
|
else( WIN32 )
|
||||||
option( NO_GTK "Disable GTK+ dialogs (Not applicable to Windows)" )
|
if( APPLE )
|
||||||
option( VALGRIND "Add special Valgrind sequences to self-modifying code" )
|
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
|
set( FMOD_SEARCH_PATHS
|
||||||
/usr/local/include
|
/usr/local/include
|
||||||
/usr/local/include/fmodex
|
/usr/local/include/fmodex
|
||||||
/usr/include
|
/usr/include
|
||||||
/usr/include/fmodex
|
/usr/include/fmodex
|
||||||
/opt/local/include
|
/opt/local/include
|
||||||
/opt/local/include/fmodex
|
/opt/local/include/fmodex
|
||||||
/opt/include
|
/opt/include
|
||||||
/opt/include/fmodex )
|
/opt/include/fmodex )
|
||||||
set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES 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 )
|
set( NASM_NAMES nasm )
|
||||||
|
|
||||||
|
if( NO_GTK )
|
||||||
|
add_definitions( -DNO_GTK=1 )
|
||||||
|
endif( NO_GTK )
|
||||||
|
|
||||||
# Non-Windows version also needs SDL
|
# Non-Windows version also needs SDL
|
||||||
find_package( SDL )
|
find_package( SDL )
|
||||||
if( NOT SDL_FOUND )
|
if( NOT SDL_FOUND )
|
||||||
|
@ -147,21 +169,6 @@ else( WIN32 )
|
||||||
set( ZDOOM_LIBS "${SDL_LIBRARY}" )
|
set( ZDOOM_LIBS "${SDL_LIBRARY}" )
|
||||||
include_directories( "${SDL_INCLUDE_DIR}" )
|
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 )
|
find_path( FPU_CONTROL_DIR fpu_control.h )
|
||||||
if( FPU_CONTROL_DIR )
|
if( FPU_CONTROL_DIR )
|
||||||
include_directories( ${FPU_CONTROL_DIR} )
|
include_directories( ${FPU_CONTROL_DIR} )
|
||||||
|
@ -206,15 +213,15 @@ endif( FMOD_INCLUDE_DIR )
|
||||||
|
|
||||||
# Search for FMOD library
|
# Search for FMOD library
|
||||||
|
|
||||||
if( WIN32 )
|
if( WIN32 OR APPLE )
|
||||||
find_library( FMOD_LIBRARY ${FMOD_LIB_NAME}
|
find_library( FMOD_LIBRARY ${FMOD_LIB_NAME}
|
||||||
PATHS ${FMOD_SEARCH_PATHS}
|
PATHS ${FMOD_SEARCH_PATHS}
|
||||||
${FMOD_LIB_PATH_SUFFIXES} )
|
${FMOD_LIB_PATH_SUFFIXES} )
|
||||||
else( WIN32 )
|
else( WIN32 OR APPLE )
|
||||||
find_library( FMOD_LIBRARY
|
find_library( FMOD_LIBRARY
|
||||||
NAMES ${FMOD_VERSIONS}
|
NAMES ${FMOD_VERSIONS}
|
||||||
PATHS ${FMOD_LOCAL_LIB_DIRS} )
|
PATHS ${FMOD_LOCAL_LIB_DIRS} )
|
||||||
endif( WIN32 )
|
endif( WIN32 OR APPLE )
|
||||||
|
|
||||||
if( FMOD_LIBRARY )
|
if( FMOD_LIBRARY )
|
||||||
message( STATUS "FMOD library found at ${FMOD_LIBRARY}" )
|
message( STATUS "FMOD library found at ${FMOD_LIBRARY}" )
|
||||||
|
@ -225,6 +232,13 @@ endif( FMOD_LIBRARY )
|
||||||
|
|
||||||
# Search for NASM
|
# 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( NOT NO_ASM )
|
||||||
if( UNIX AND X64 )
|
if( UNIX AND X64 )
|
||||||
find_program( GAS_PATH as )
|
find_program( GAS_PATH as )
|
||||||
|
@ -484,10 +498,17 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h
|
||||||
|
|
||||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
|
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
|
add_executable( zdoom WIN32
|
||||||
autostart.cpp
|
autostart.cpp
|
||||||
${ASM_SOURCES}
|
${ASM_SOURCES}
|
||||||
${SYSTEM_SOURCES}
|
${SYSTEM_SOURCES}
|
||||||
|
${SSE_SOURCES}
|
||||||
am_map.cpp
|
am_map.cpp
|
||||||
b_bot.cpp
|
b_bot.cpp
|
||||||
b_func.cpp
|
b_func.cpp
|
||||||
|
@ -550,7 +571,6 @@ add_executable( zdoom WIN32
|
||||||
name.cpp
|
name.cpp
|
||||||
nodebuild.cpp
|
nodebuild.cpp
|
||||||
nodebuild_classify_nosse2.cpp
|
nodebuild_classify_nosse2.cpp
|
||||||
nodebuild_classify_sse2.cpp
|
|
||||||
nodebuild_events.cpp
|
nodebuild_events.cpp
|
||||||
nodebuild_extract.cpp
|
nodebuild_extract.cpp
|
||||||
nodebuild_gl.cpp
|
nodebuild_gl.cpp
|
||||||
|
@ -629,7 +649,6 @@ add_executable( zdoom WIN32
|
||||||
v_video.cpp
|
v_video.cpp
|
||||||
w_wad.cpp
|
w_wad.cpp
|
||||||
wi_stuff.cpp
|
wi_stuff.cpp
|
||||||
x86.cpp
|
|
||||||
zstrformat.cpp
|
zstrformat.cpp
|
||||||
zstring.cpp
|
zstring.cpp
|
||||||
g_doom/a_doommisc.cpp
|
g_doom/a_doommisc.cpp
|
||||||
|
|
|
@ -348,9 +348,9 @@ enum
|
||||||
#define BLINKTHRESHOLD (4*32)
|
#define BLINKTHRESHOLD (4*32)
|
||||||
|
|
||||||
#ifndef __BIG_ENDIAN__
|
#ifndef __BIG_ENDIAN__
|
||||||
#define MAKE_ID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24))
|
#define MAKE_ID(a,b,c,d) ((DWORD)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
|
||||||
#else
|
#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
|
||||||
|
|
||||||
#endif // __DOOMDEF_H__
|
#endif // __DOOMDEF_H__
|
||||||
|
|
|
@ -80,10 +80,10 @@
|
||||||
#define OLD_SPRITE ((BYTE)12) // Reference to an old sprite name follows
|
#define OLD_SPRITE ((BYTE)12) // Reference to an old sprite name follows
|
||||||
|
|
||||||
#ifdef __BIG_ENDIAN__
|
#ifdef __BIG_ENDIAN__
|
||||||
static inline WORD SWAP_WORD(x) { return x; }
|
static inline WORD SWAP_WORD(WORD x) { return x; }
|
||||||
static inline DWORD SWAP_DWORD(x) { return x; }
|
static inline DWORD SWAP_DWORD(DWORD x) { return x; }
|
||||||
static inline QWORD SWAP_QWORD(x) { return x; }
|
static inline QWORD SWAP_QWORD(QWORD x) { return x; }
|
||||||
static inline void SWAP_FLOAT(x) { }
|
static inline void SWAP_FLOAT(float x) { }
|
||||||
static inline void SWAP_DOUBLE(double &dst, double src) { dst = src; }
|
static inline void SWAP_DOUBLE(double &dst, double src) { dst = src; }
|
||||||
#else
|
#else
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -32,12 +32,16 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#if defined(__FreeBSD__)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc_np.h>
|
#include <malloc_np.h>
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <malloc/malloc.h>
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "dobject.h"
|
#include "dobject.h"
|
||||||
|
|
||||||
|
@ -46,7 +50,9 @@
|
||||||
#define _malloc_dbg(s,b,f,l) malloc(s)
|
#define _malloc_dbg(s,b,f,l) malloc(s)
|
||||||
#define _realloc_dbg(p,s,b,f,l) realloc(p,s)
|
#define _realloc_dbg(p,s,b,f,l) realloc(p,s)
|
||||||
#endif
|
#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
|
#define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ enum EJoyAxis
|
||||||
// Generic configuration interface for a controller.
|
// Generic configuration interface for a controller.
|
||||||
struct NOVTABLE IJoystickConfig
|
struct NOVTABLE IJoystickConfig
|
||||||
{
|
{
|
||||||
|
virtual ~IJoystickConfig() = 0;
|
||||||
|
|
||||||
virtual FString GetName() = 0;
|
virtual FString GetName() = 0;
|
||||||
virtual float GetSensitivity() = 0;
|
virtual float GetSensitivity() = 0;
|
||||||
virtual void SetSensitivity(float scale) = 0;
|
virtual void SetSensitivity(float scale) = 0;
|
||||||
|
|
|
@ -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 GetUserFile (const char *file, bool nodir)
|
||||||
{
|
{
|
||||||
FString path;
|
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.bits_per_pixel = 8; // 256 (or more) colors
|
||||||
pcx.xmin = 0;
|
pcx.xmin = 0;
|
||||||
pcx.ymin = 0;
|
pcx.ymin = 0;
|
||||||
pcx.xmax = LittleShort(width-1);
|
pcx.xmax = LittleShort((unsigned short)(width-1));
|
||||||
pcx.ymax = LittleShort(height-1);
|
pcx.ymax = LittleShort((unsigned short)(height-1));
|
||||||
pcx.hdpi = LittleShort(75);
|
pcx.hdpi = LittleShort((unsigned short)75);
|
||||||
pcx.vdpi = LittleShort(75);
|
pcx.vdpi = LittleShort((unsigned short)75);
|
||||||
memset (pcx.palette, 0, sizeof(pcx.palette));
|
memset (pcx.palette, 0, sizeof(pcx.palette));
|
||||||
pcx.reserved = 0;
|
pcx.reserved = 0;
|
||||||
pcx.color_planes = (color_type == SS_PAL) ? 1 : 3; // chunky image
|
pcx.color_planes = (color_type == SS_PAL) ? 1 : 3; // chunky image
|
||||||
|
|
52
src/m_swap.h
52
src/m_swap.h
|
@ -27,6 +27,56 @@
|
||||||
|
|
||||||
// Endianess handling.
|
// Endianess handling.
|
||||||
// WAD files are stored little endian.
|
// WAD files are stored little endian.
|
||||||
|
|
||||||
|
#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__
|
#ifdef __BIG_ENDIAN__
|
||||||
|
|
||||||
// Swap 16bit, that is, MSB and LSB byte.
|
// Swap 16bit, that is, MSB and LSB byte.
|
||||||
|
@ -123,5 +173,5 @@ inline int BigLong (int x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __BIG_ENDIAN__
|
#endif // __BIG_ENDIAN__
|
||||||
|
#endif // __APPLE__
|
||||||
#endif // __M_SWAP_H__
|
#endif // __M_SWAP_H__
|
||||||
|
|
|
@ -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)
|
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.
|
// If compiling with SSE2 support everywhere, just use the SSE2 version.
|
||||||
return ClassifyLineSSE2 (node, seg, sidev1, sidev2);
|
return ClassifyLineSSE2 (node, seg, sidev1, sidev2);
|
||||||
#elif defined(_MSC_VER) && _MSC_VER < 1300
|
#elif defined(_MSC_VER) && _MSC_VER < 1300
|
||||||
|
|
|
@ -214,7 +214,7 @@ void DiskWriterIO::OPLdeinit()
|
||||||
|
|
||||||
fseek(File, 12, SEEK_SET);
|
fseek(File, 12, SEEK_SET);
|
||||||
len[0] = LittleLong(CurIntTime);
|
len[0] = LittleLong(CurIntTime);
|
||||||
len[1] = LittleLong(where_am_i - 24);
|
len[1] = LittleLong(DWORD(where_am_i - 24));
|
||||||
fwrite(len, 4, 2, File);
|
fwrite(len, 4, 2, File);
|
||||||
}
|
}
|
||||||
fclose(File);
|
fclose(File);
|
||||||
|
|
|
@ -1832,8 +1832,8 @@ void DACSThinker::Serialize (FArchive &arc)
|
||||||
if (RunningScripts[i])
|
if (RunningScripts[i])
|
||||||
arc << RunningScripts[i] << i;
|
arc << RunningScripts[i] << i;
|
||||||
}
|
}
|
||||||
DLevelScript *nil = NULL;
|
DLevelScript *nilptr = NULL;
|
||||||
arc << nil;
|
arc << nilptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ static int WriteBLOCKMAP (FILE *file);
|
||||||
static int WriteBEHAVIOR (FILE *file);
|
static int WriteBEHAVIOR (FILE *file);
|
||||||
|
|
||||||
#define APPEND(pos,name) \
|
#define APPEND(pos,name) \
|
||||||
lumps[pos].FilePos = LittleLong(ftell (file)); \
|
lumps[pos].FilePos = LittleLong((int)ftell (file)); \
|
||||||
lumps[pos].Size = LittleLong(Write##name (file)); \
|
lumps[pos].Size = LittleLong(Write##name (file)); \
|
||||||
memcpy (lumps[pos].Name, #name, sizeof(#name)-1);
|
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.x = LittleShort(short(mo->x >> FRACBITS));
|
||||||
mt.y = LittleShort(short(mo->y >> FRACBITS));
|
mt.y = LittleShort(short(mo->y >> FRACBITS));
|
||||||
mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360)));
|
mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360)));
|
||||||
mt.type = LittleShort(1);
|
mt.type = LittleShort((short)1);
|
||||||
mt.flags = LittleShort(7|224|MTF_SINGLE);
|
mt.flags = LittleShort((short)(7|224|MTF_SINGLE));
|
||||||
fwrite (&mt, sizeof(mt), 1, file);
|
fwrite (&mt, sizeof(mt), 1, file);
|
||||||
return sizeof (mt);
|
return sizeof (mt);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ static int WriteSEGS (FILE *file)
|
||||||
ms.v1 = LittleShort(short(segs[i].v1 - vertexes));
|
ms.v1 = LittleShort(short(segs[i].v1 - vertexes));
|
||||||
ms.v2 = LittleShort(short(segs[i].v2 - vertexes));
|
ms.v2 = LittleShort(short(segs[i].v2 - vertexes));
|
||||||
ms.linedef = LittleShort(short(segs[i].linedef - lines));
|
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));
|
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);
|
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));
|
ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::ceiling) >> FRACBITS));
|
||||||
uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor)));
|
uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor)));
|
||||||
uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling)));
|
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.special = LittleShort(sectors[i].special);
|
||||||
ms.tag = LittleShort(sectors[i].tag);
|
ms.tag = LittleShort(sectors[i].tag);
|
||||||
fwrite (&ms, sizeof(ms), 1, file);
|
fwrite (&ms, sizeof(ms), 1, file);
|
||||||
|
|
|
@ -129,7 +129,7 @@ private:
|
||||||
operator int() const { return STYLE_Normal; }
|
operator int() const { return STYLE_Normal; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const FRenderStyle LegacyRenderStyles[STYLE_Count];
|
extern FRenderStyle LegacyRenderStyles[STYLE_Count];
|
||||||
|
|
||||||
inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
|
inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,7 +125,11 @@ FDynamicColormap ShadeFakeColormap[16];
|
||||||
BYTE identitymap[256];
|
BYTE identitymap[256];
|
||||||
|
|
||||||
// Convert legacy render styles to flexible render styles.
|
// 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_None */ {{ STYLEOP_None, STYLEALPHA_Zero, STYLEALPHA_Zero, 0 }},
|
||||||
/* STYLE_Normal */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_Alpha1 }},
|
/* 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_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }},
|
||||||
/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, 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)
|
FArchive &operator<< (FArchive &arc, FRenderStyle &style)
|
||||||
{
|
{
|
||||||
|
|
|
@ -729,8 +729,8 @@ void R_InitTranslationTables ()
|
||||||
// Full alpha
|
// Full alpha
|
||||||
for (i = 0; i < 16; ++i)
|
for (i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
ShadeFakeColormap[i].Color = -1;
|
ShadeFakeColormap[i].Color = ~0u;
|
||||||
ShadeFakeColormap[i].Desaturate = -1;
|
ShadeFakeColormap[i].Desaturate = ~0u;
|
||||||
ShadeFakeColormap[i].Next = NULL;
|
ShadeFakeColormap[i].Next = NULL;
|
||||||
ShadeFakeColormap[i].Maps = table;
|
ShadeFakeColormap[i].Maps = table;
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,7 @@ int cc_install_handlers(int num_signals, int *signals, const char *logfile, int
|
||||||
|
|
||||||
sa.sa_sigaction = crash_catcher;
|
sa.sa_sigaction = crash_catcher;
|
||||||
|
|
||||||
#ifndef __FreeBSD__
|
#if !defined(__FreeBSD__) && !defined(__APPLE__)
|
||||||
sa.sa_flags = SA_ONESHOT | SA_NODEFER | SA_SIGINFO;
|
sa.sa_flags = SA_ONESHOT | SA_NODEFER | SA_SIGINFO;
|
||||||
#else
|
#else
|
||||||
sa.sa_flags = SA_NODEFER | SA_SIGINFO;
|
sa.sa_flags = SA_NODEFER | SA_SIGINFO;
|
||||||
|
|
|
@ -511,7 +511,11 @@ bool I_WriteIniFailed ()
|
||||||
|
|
||||||
static const char *pattern;
|
static const char *pattern;
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
static int matchfile (struct dirent *ent)
|
||||||
|
#else
|
||||||
static int matchfile (const struct dirent *ent)
|
static int matchfile (const struct dirent *ent)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
return fnmatch (pattern, ent->d_name, FNM_NOESCAPE) == 0;
|
return fnmatch (pattern, ent->d_name, FNM_NOESCAPE) == 0;
|
||||||
}
|
}
|
||||||
|
@ -643,3 +647,16 @@ unsigned int I_MakeRNGSeed()
|
||||||
return seed;
|
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
|
||||||
|
|
|
@ -44,7 +44,11 @@ extern HWND Window;
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <stdlib.h>
|
||||||
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "fmodsound.h"
|
#include "fmodsound.h"
|
||||||
|
|
|
@ -73,8 +73,7 @@ protected:
|
||||||
static bool read(SoundStream *stream, void *buff, int len, void *userdata);
|
static bool read(SoundStream *stream, void *buff, int len, void *userdata);
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(push)
|
#pragma pack(push, 1)
|
||||||
#pragma pack(1)
|
|
||||||
|
|
||||||
typedef struct tagITFILEHEADER
|
typedef struct tagITFILEHEADER
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
// HEADER FILES ------------------------------------------------------------
|
// HEADER FILES ------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __FreeBSD__
|
#if !defined(__FreeBSD__) && !defined(__APPLE__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#else
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -663,7 +663,7 @@ TimidityWaveWriterMIDIDevice::TimidityWaveWriterMIDIDevice(const char *filename,
|
||||||
if (3 != fwrite(work, 4, 3, File)) goto fail;
|
if (3 != fwrite(work, 4, 3, File)) goto fail;
|
||||||
|
|
||||||
fmt.ChunkID = MAKE_ID('f','m','t',' ');
|
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.FormatTag = LittleShort(0xFFFE); // WAVE_FORMAT_EXTENSIBLE
|
||||||
fmt.Channels = LittleShort(2);
|
fmt.Channels = LittleShort(2);
|
||||||
fmt.SamplesPerSec = LittleLong((int)Renderer->rate);
|
fmt.SamplesPerSec = LittleLong((int)Renderer->rate);
|
||||||
|
@ -712,12 +712,12 @@ TimidityWaveWriterMIDIDevice::~TimidityWaveWriterMIDIDevice()
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
// data chunk size
|
// data chunk size
|
||||||
size = LittleLong(pos - 8);
|
size = LittleLong(DWORD(pos - 8));
|
||||||
if (0 == fseek(File, 4, SEEK_SET))
|
if (0 == fseek(File, 4, SEEK_SET))
|
||||||
{
|
{
|
||||||
if (1 == fwrite(&size, 4, 1, File))
|
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 (0 == fseek(File, 4 + sizeof(FmtChunk) + 4, SEEK_CUR))
|
||||||
{
|
{
|
||||||
if (1 == fwrite(&size, 4, 1, File))
|
if (1 == fwrite(&size, 4, 1, File))
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#include "zstring.h"
|
#include "zstring.h"
|
||||||
|
|
||||||
#ifdef unix
|
#ifndef _WIN32
|
||||||
|
|
||||||
#ifdef NO_CLOCK_GETTIME
|
#ifdef NO_CLOCK_GETTIME
|
||||||
class cycle_t
|
class cycle_t
|
||||||
|
|
|
@ -435,8 +435,8 @@ static void Parse_wlnk(DLS_Data *data, RIFF_Chunk *chunk, DLS_Region *region)
|
||||||
WAVELINK *wlnk = (WAVELINK *)chunk->data;
|
WAVELINK *wlnk = (WAVELINK *)chunk->data;
|
||||||
wlnk->fusOptions = LittleShort(wlnk->fusOptions);
|
wlnk->fusOptions = LittleShort(wlnk->fusOptions);
|
||||||
wlnk->usPhaseGroup = LittleShort(wlnk->usPhaseGroup);
|
wlnk->usPhaseGroup = LittleShort(wlnk->usPhaseGroup);
|
||||||
wlnk->ulChannel = LittleShort(wlnk->ulChannel);
|
wlnk->ulChannel = LittleLong((unsigned int)wlnk->ulChannel);
|
||||||
wlnk->ulTableIndex = LittleShort(wlnk->ulTableIndex);
|
wlnk->ulTableIndex = LittleLong((unsigned int)wlnk->ulTableIndex);
|
||||||
region->wlnk = wlnk;
|
region->wlnk = wlnk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -578,7 +578,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, int x, int y, DWORD tag, va_l
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTA_RenderStyle:
|
case DTA_RenderStyle:
|
||||||
parms->style = va_arg (tags, FRenderStyle);
|
parms->style.AsDWORD = va_arg (tags, DWORD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tag = va_arg (tags, DWORD);
|
tag = va_arg (tags, DWORD);
|
||||||
|
|
|
@ -488,6 +488,7 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in
|
||||||
to[i] = t;
|
to[i] = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if defined(_M_X64) || defined(_M_IX86) || defined(__i386__) || defined(__amd64__)
|
||||||
else if (CPU.bSSE2)
|
else if (CPU.bSSE2)
|
||||||
{
|
{
|
||||||
if (count >= 4)
|
if (count >= 4)
|
||||||
|
@ -503,6 +504,7 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in
|
||||||
to += not3count;
|
to += not3count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef X86_ASM
|
#ifdef X86_ASM
|
||||||
else if (CPU.bMMX)
|
else if (CPU.bMMX)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue