diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 05f92990a..806c357de 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -43,7 +43,7 @@ CFLAGS= /MT /J /nologo $(flags_cl) \ /I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" \ /D "_CRT_SECURE_NO_DEPRECATE" /W2 $(ENGINEOPTS) \ /I$(DXROOT)\include" /DRENDERTYPEWIN=1 -LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \ +LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib ws2_32.lib comctl32.lib \ /NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib LIBS=vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib advapi32.lib $(LIBS) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 730d37904..68f265e31 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -6589,6 +6589,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) } globalpicnum = spr->picnum; + globalpal = spr->pal; // GL needs this, software doesn't if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; setgotpic(globalpicnum); if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue; diff --git a/polymer/eduke32/build/src/nedmalloc.c b/polymer/eduke32/build/src/nedmalloc.c index 9f7f77a3a..4034e24ad 100644 --- a/polymer/eduke32/build/src/nedmalloc.c +++ b/polymer/eduke32/build/src/nedmalloc.c @@ -50,8 +50,8 @@ DEALINGS IN THE SOFTWARE. /*#define FULLSANITYCHECKS*/ /* If link time code generation is on, don't force or prevent inlining */ #if defined(_MSC_VER) && defined(NEDMALLOC_DLL_EXPORTS) -#define FORCEINLINE -#define NOINLINE +// #define FORCEINLINE +// #define NOINLINE #endif #include "nedmalloc.h" @@ -68,7 +68,19 @@ DEALINGS IN THE SOFTWARE. #define USE_LOCKS 1 #endif #define FOOTERS 1 /* Need to enable footers so frees lock the right mspace */ -#ifndef NEDMALLOC_DEBUG #if defined(DEBUG) || defined(_DEBUG) #define NEDMALLOC_DEBUG 1 #else #define NEDMALLOC_DEBUG 0 #endif #endif /* We need to consistently define DEBUG=0|1, _DEBUG and NDEBUG for dlmalloc */ #undef DEBUG #undef _DEBUG #if NEDMALLOC_DEBUG #define _DEBUG #else +#ifndef NEDMALLOC_DEBUG + #if defined(DEBUG) || defined(_DEBUG) + #define NEDMALLOC_DEBUG 1 + #else + #define NEDMALLOC_DEBUG 0 + #endif +#endif +/* We need to consistently define DEBUG=0|1, _DEBUG and NDEBUG for dlmalloc */ +#undef DEBUG +#undef _DEBUG +#if NEDMALLOC_DEBUG +#define _DEBUG +#else #define DEBUG 0 #endif #ifdef NDEBUG /* Disable assert checking on release builds */ @@ -84,8 +96,19 @@ DEALINGS IN THE SOFTWARE. #endif /*#define USE_SPIN_LOCKS 0*/ -#include "malloc.c.h" #ifdef NDEBUG /* Disable assert checking on release builds */ #undef DEBUG #elif !NEDMALLOC_DEBUG #ifdef __GNUC__ #warning DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed. #elif defined(_MSC_VER) #pragma message(__FILE__ ": WARNING: DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.") #endif #endif -/* The maximum concurrent threads in a pool possible */#ifndef MAXTHREADSINPOOL +#include "malloc.c.h" + #ifdef NDEBUG /* Disable assert checking on release builds */ + #undef DEBUG +#elif !NEDMALLOC_DEBUG + #ifdef __GNUC__ + #warning DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed. + #elif defined(_MSC_VER) + #pragma message(__FILE__ ": WARNING: DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.") + #endif +#endif + +/* The maximum concurrent threads in a pool possible */ +#ifndef MAXTHREADSINPOOL #define MAXTHREADSINPOOL 16 #endif /* The maximum number of threadcaches which can be allocated */ @@ -155,7 +178,32 @@ static void *RESTRICT leastusedaddress; static size_t largestusedblock; #endif -static FORCEINLINE void *CallMalloc(void *RESTRICT mspace, size_t size, size_t alignment) THROWSPEC { void *RESTRICT ret=0; size_t _alignment=alignment; #if USE_MAGIC_HEADERS size_t *_ret=0; size+=alignment+3*sizeof(size_t); _alignment=0; #endif #if USE_ALLOCATOR==0 ret=_alignment ? #ifdef _MSC_VER /* This is the MSVCRT equivalent */ _aligned_malloc(size, _alignment) #elif defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) /* This is the glibc/ptmalloc2/dlmalloc/BSD libc equivalent. */ memalign(_alignment, size) #else #error Cannot aligned allocate with the memory allocator of an unknown system! #endif : malloc(size); #elif USE_ALLOCATOR==1 ret=_alignment ? mspace_memalign((mstate) mspace, _alignment, size) : mspace_malloc((mstate) mspace, size); #ifndef ENABLE_FAST_HEAP_DETECTION if(ret) { +static FORCEINLINE void *CallMalloc(void *RESTRICT mspace, size_t size, size_t alignment) THROWSPEC +{ + void *RESTRICT ret=0; + size_t _alignment=alignment; +#if USE_MAGIC_HEADERS + size_t *_ret=0; + size+=alignment+3*sizeof(size_t); + _alignment=0; +#endif +#if USE_ALLOCATOR==0 + ret=_alignment ? +#ifdef WIN32 + /* This is the MSVCRT equivalent */ + _aligned_malloc(size, _alignment) +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) + /* This is the glibc/ptmalloc2/dlmalloc/BSD libc equivalent. */ + memalign(_alignment, size) +#else +#error Cannot aligned allocate with the memory allocator of an unknown system! +#endif + : malloc(size); +#elif USE_ALLOCATOR==1 + ret=_alignment ? mspace_memalign((mstate) mspace, _alignment, size) : mspace_malloc((mstate) mspace, size); +#ifndef ENABLE_FAST_HEAP_DETECTION + if(ret) + { size_t truesize=chunksize(mem2chunk(ret)); if(!leastusedaddress || (void *)((mstate) mspace)->least_addrleast_addr; if(!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1);