About
@@ -140,6 +140,17 @@ QuakeSpasm 0.94.0 has initial support for playing the 2021 re-release content: C
Changes
+ Changes in 0.94.5
+
+- Compatibility with new SDL2 versioning scheme.
+
- Revised min/max/clamp macros' usage.
+
- Fixed a potential undefined behavior in R_DrawAliasModel.
+
- Fixed parsing of the time argument of svc_fog server message. (it has been broken for more than 20 years and has never seem to have been used.)
+
- Other small improvements elsewhere in the code.
+
- Backported a few fixes to the bundled SDL2-2.0.22 version.
+
+
+
Changes in 0.94.4
- Fixed getting stuck with loading plaque upon attempting to load a bad save from the menu
diff --git a/MacOSX/English.lproj/InfoPlist.strings b/MacOSX/English.lproj/InfoPlist.strings
index 281ec294..f82959d2 100644
Binary files a/MacOSX/English.lproj/InfoPlist.strings and b/MacOSX/English.lproj/InfoPlist.strings differ
diff --git a/MacOSX/Info.plist b/MacOSX/Info.plist
index af707a73..9e3925c4 100644
--- a/MacOSX/Info.plist
+++ b/MacOSX/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.94.4
+ 0.94.5
CFBundleSignature
????
LSApplicationCategoryType
diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_assert.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_assert.h
index defadf13..427c4c63 100644
--- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_assert.h
+++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_assert.h
@@ -22,7 +22,7 @@
#ifndef SDL_assert_h_
#define SDL_assert_h_
-#include "SDL_config.h"
+#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
@@ -51,6 +51,8 @@ assert can have unique static variables associated with it.
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
+#elif _SDL_HAS_BUILTIN(__builtin_debugtrap)
+ #define SDL_TriggerBreakpoint() __builtin_debugtrap()
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_macosx.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_macosx.h
index ff42e3d5..ca020988 100644
--- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_macosx.h
+++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_config_macosx.h
@@ -272,7 +272,6 @@
#define SDL_FILESYSTEM_COCOA 1
/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
#ifdef __ppc__
#define SDL_ALTIVEC_BLITTERS 1
#endif
diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_endian.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_endian.h
index 2866f4be..e1c6b5ef 100644
--- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_endian.h
+++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_endian.h
@@ -87,6 +87,28 @@ _m_prefetch(void *__P)
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */
+#ifndef SDL_FLOATWORDORDER /* Not defined in SDL_config.h? */
+/* predefs from newer gcc versions: */
+#if defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__)
+#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
+#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
+#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
+#else
+#error Unsupported endianness
+#endif /**/
+#elif defined(__MAVERICK__)
+/* For Maverick, float words are always little-endian. */
+#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
+#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__)
+/* For FPA, float words are always big-endian. */
+#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
+#else
+/* By default, assume that floats words follow the memory system mode. */
+#define SDL_FLOATWORDORDER SDL_BYTEORDER
+#endif /* __FLOAT_WORD_ORDER__ */
+#endif /* !SDL_FLOATWORDORDER */
+
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_rect.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_rect.h
index b678c7a3..6c641c58 100644
--- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_rect.h
+++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_rect.h
@@ -252,10 +252,10 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r)
SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon)
{
return (a && b && ((a == b) ||
- ((SDL_fabs(a->x - b->x) <= epsilon) &&
- (SDL_fabs(a->y - b->y) <= epsilon) &&
- (SDL_fabs(a->w - b->w) <= epsilon) &&
- (SDL_fabs(a->h - b->h) <= epsilon))))
+ ((SDL_fabsf(a->x - b->x) <= epsilon) &&
+ (SDL_fabsf(a->y - b->y) <= epsilon) &&
+ (SDL_fabsf(a->w - b->w) <= epsilon) &&
+ (SDL_fabsf(a->h - b->h) <= epsilon))))
? SDL_TRUE : SDL_FALSE;
}
diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_revision.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_revision.h
index db133803..b981c094 100644
--- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_revision.h
+++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_revision.h
@@ -1,2 +1,2 @@
-#define SDL_REVISION "https://github.com/libsdl-org/SDL.git@981e1e3c4489add5bf6d4df5415af3cf1ef2773d"
+#define SDL_REVISION "@1594e60f8c154d3c8cea175fe88694e5aaf5e7bc"
#define SDL_REVISION_NUMBER 0
diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h
index 449e6445..741094c8 100644
--- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h
+++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h
@@ -462,7 +462,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
-extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
+extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
extern DECLSPEC int SDLCALL SDL_abs(int x);
diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_system.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_system.h
index 41563add..c540e474 100644
--- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_system.h
+++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_system.h
@@ -195,7 +195,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
*
* \sa SDL_iPhoneSetEventPump
*/
-extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
+extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_thread.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_thread.h
index 35e680dd..1e04a4f8 100644
--- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_thread.h
+++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_thread.h
@@ -129,7 +129,7 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
pfnSDL_CurrentEndThread pfnEndThread);
extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn,
const char *name, const size_t stacksize, void *data,
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread);
diff --git a/MacOSX/SDL2.framework/Versions/A/SDL2 b/MacOSX/SDL2.framework/Versions/A/SDL2
index 1e741a8f..0710c7a3 100755
Binary files a/MacOSX/SDL2.framework/Versions/A/SDL2 and b/MacOSX/SDL2.framework/Versions/A/SDL2 differ
diff --git a/Quake/Makefile b/Quake/Makefile
index 73213bc1..231e077d 100644
--- a/Quake/Makefile
+++ b/Quake/Makefile
@@ -56,6 +56,7 @@ CPUFLAGS=
LDFLAGS =
DFLAGS ?=
CFLAGS ?= -Wall -Wno-trigraphs
+CFLAGS += $(call check_gcc,-std=gnu11,)
CFLAGS += $(CPUFLAGS)
ifneq ($(DEBUG),0)
DFLAGS += -DDEBUG
@@ -64,6 +65,7 @@ do_strip=
else
DFLAGS += -DNDEBUG
CFLAGS += -O2
+# -fno-asynchronous-unwind-tables
CFLAGS += $(call check_gcc,-fweb,)
CFLAGS += $(call check_gcc,-frename-registers,)
cmd_strip=$(STRIP) $(1)
diff --git a/Quake/Makefile.darwin b/Quake/Makefile.darwin
index 272b6d45..5db18a2c 100644
--- a/Quake/Makefile.darwin
+++ b/Quake/Makefile.darwin
@@ -85,11 +85,11 @@ CFLAGS +=-mmacosx-version-min=11.0
LDFLAGS +=-mmacosx-version-min=11.0
USE_RPATH=1
endif
+CFLAGS += $(call check_gcc,-std=gnu11,)
CFLAGS += $(CPUFLAGS)
ifeq ($(USE_RPATH),1)
LDFLAGS+=-Wl,-rpath,@executable_path/../Frameworks
endif
-
ifneq ($(DEBUG),0)
DFLAGS += -DDEBUG
CFLAGS += -g
@@ -97,6 +97,7 @@ do_strip=
else
DFLAGS += -DNDEBUG
CFLAGS += -O2
+# -fno-asynchronous-unwind-tables
CFLAGS += $(call check_gcc,-fweb,)
CFLAGS += $(call check_gcc,-frename-registers,)
cmd_strip=$(STRIP) $(1)
@@ -348,4 +349,3 @@ debug:
clean:
rm -f $(shell find . \( -name '*~' -o -name '#*#' -o -name '*.o' -o -name '*.res' -o -name $(DEFAULT_TARGET) \) -print)
-
diff --git a/Quake/Makefile.w32 b/Quake/Makefile.w32
index 41c9fe34..481bb00c 100644
--- a/Quake/Makefile.w32
+++ b/Quake/Makefile.w32
@@ -54,9 +54,9 @@ LDFLAGS += $(QSS_LDFLAGS)
LDFLAGS += -Wl,--no-insert-timestamp #prevent non-determinism in the exe header. mustn't be used for dlls.
DFLAGS ?=
CFLAGS ?= -m32 -Wall -Wno-trigraphs
+CFLAGS += $(call check_gcc,-std=gnu11,)
CFLAGS += $(CPUFLAGS)
CFLAGS += $(QSS_CFLAGS)
-
ifneq ($(DEBUG),0)
DFLAGS += -DDEBUG
CFLAGS += -g
@@ -64,6 +64,7 @@ do_strip=
else
DFLAGS += -DNDEBUG
CFLAGS += -O2
+# -fno-asynchronous-unwind-tables
CFLAGS += $(call check_gcc,-fweb,)
CFLAGS += $(call check_gcc,-frename-registers,)
cmd_strip=$(STRIP) $(1)
@@ -308,4 +309,3 @@ debug:
clean:
rm -f $(shell find . \( -name '*~' -o -name '#*#' -o -name '*.o' -o -name '*.res' -o -name $(DEFAULT_TARGET) \) -print)
-
diff --git a/Quake/Makefile.w64 b/Quake/Makefile.w64
index c3ead8af..cef03bbf 100644
--- a/Quake/Makefile.w64
+++ b/Quake/Makefile.w64
@@ -51,9 +51,9 @@ LDFLAGS += $(QSS_LDFLAGS)
LDFLAGS += -Wl,--no-insert-timestamp #prevent non-determinism in the exe header. mustn't be used for dlls.
DFLAGS ?=
CFLAGS ?= -m64 -Wall -Wno-trigraphs
+CFLAGS += $(call check_gcc,-std=gnu11,)
CFLAGS += $(CPUFLAGS)
CFLAGS += $(QSS_CFLAGS)
-
ifneq ($(DEBUG),0)
DFLAGS += -DDEBUG
CFLAGS += -g
@@ -61,6 +61,7 @@ do_strip=
else
DFLAGS += -DNDEBUG
CFLAGS += -O2
+# -fno-asynchronous-unwind-tables
CFLAGS += $(call check_gcc,-fweb,)
CFLAGS += $(call check_gcc,-frename-registers,)
cmd_strip=$(STRIP) $(1)
@@ -300,4 +301,3 @@ debug:
clean:
rm -f $(shell find . \( -name '*~' -o -name '#*#' -o -name '*.o' -o -name '*.res' -o -name $(DEFAULT_TARGET) \) -print)
-
diff --git a/Quake/common.h b/Quake/common.h
index ac1a4d78..3b5c61eb 100644
--- a/Quake/common.h
+++ b/Quake/common.h
@@ -41,11 +41,76 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef min
#undef max
+
+#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
+ (defined(__cplusplus) && (__cplusplus >= 201103L))
+#define GENERIC_TYPES(x, separator) \
+ x(int, i) separator \
+ x(unsigned int, u) separator \
+ x(long, l) separator \
+ x(unsigned long, ul) separator \
+ x(long long, ll) separator \
+ x(unsigned long long, ull) separator \
+ x(float, f) separator \
+ x(double, d)
+
+#define COMMA ,
+#define NO_COMMA
+
+#define IMPL_GENERIC_FUNCS(type, suffix) \
+static inline type q_min_##suffix (type a, type b) { \
+ return (a < b) ? a : b; \
+} \
+static inline type q_max_##suffix (type a, type b) { \
+ return (a > b) ? a : b; \
+} \
+static inline type clamp_##suffix (type minval, type val, type maxval) { \
+ return (val < minval) ? minval : ((val > maxval) ? maxval : val); \
+}
+
+GENERIC_TYPES (IMPL_GENERIC_FUNCS, NO_COMMA)
+
+#define SELECT_Q_MIN(type, suffix) type: q_min_##suffix
+#define q_min(a, b) _Generic((a) + (b), GENERIC_TYPES (SELECT_Q_MIN, COMMA))(a, b)
+
+#define SELECT_Q_MAX(type, suffix) type: q_max_##suffix
+#define q_max(a, b) _Generic((a) + (b), GENERIC_TYPES (SELECT_Q_MAX, COMMA))(a, b)
+
+#define SELECT_CLAMP(type, suffix) type: clamp_##suffix
+#define CLAMP(minval, val, maxval) _Generic((minval) + (val) + (maxval), \
+ GENERIC_TYPES (SELECT_CLAMP, COMMA))(minval, val, maxval)
+
+#elif defined(__GNUC__)
+/* min and max macros with type checking -- based on tyrquake. */
+#define q_max(a,b) ({ \
+ const __typeof(a) a_ = (a); \
+ const __typeof(b) b_ = (b); \
+ (void)(&a_ == &b_); \
+ (a_ > b_) ? a_ : b_; \
+})
+#define q_min(a,b) ({ \
+ const __typeof(a) a_ = (a); \
+ const __typeof(b) b_ = (b); \
+ (void)(&a_ == &b_); \
+ (a_ < b_) ? a_ : b_; \
+})
+#define CLAMP(_minval, x, _maxval) ({ \
+ const __typeof(x) x_ = (x); \
+ const __typeof(_minval) valmin_ = (_minval);\
+ const __typeof(_maxval) valmax_ = (_maxval);\
+ (void)(&x_ == &valmin_); \
+ (void)(&x_ == &valmax_); \
+ (x_ < valmin_) ? valmin_ : \
+ (x_ > valmax_) ? valmax_ : x_; \
+})
+
+#else
#define q_min(a, b) (((a) < (b)) ? (a) : (b))
#define q_max(a, b) (((a) > (b)) ? (a) : (b))
#define CLAMP(_minval, x, _maxval) \
((x) < (_minval) ? (_minval) : \
(x) > (_maxval) ? (_maxval) : (x))
+#endif
#define countof(x) (sizeof(x)/sizeof((x)[0]))
diff --git a/Quake/console.c b/Quake/console.c
index 459dcb89..c9b52bdb 100644
--- a/Quake/console.c
+++ b/Quake/console.c
@@ -309,8 +309,11 @@ void Con_Init (void)
//johnfitz -- user settable console buffer size
i = COM_CheckParm("-consize");
- if (i && i < com_argc-1)
- con_buffersize = q_max(CON_MINSIZE,Q_atoi(com_argv[i+1])*1024);
+ if (i && i < com_argc-1) {
+ con_buffersize = Q_atoi(com_argv[i+1])*1024;
+ if (con_buffersize < CON_MINSIZE)
+ con_buffersize = CON_MINSIZE;
+ }
else
con_buffersize = CON_TEXTSIZE;
//johnfitz
diff --git a/Quake/gl_draw.c b/Quake/gl_draw.c
index e1b8e43c..d38105f1 100644
--- a/Quake/gl_draw.c
+++ b/Quake/gl_draw.c
@@ -736,13 +736,13 @@ void Draw_ConsoleBackground (void)
pic->width = vid.conwidth;
pic->height = vid.conheight;
- alpha = (con_forcedup) ? 1.0 : scr_conalpha.value;
+ alpha = (con_forcedup) ? 1.0f : scr_conalpha.value;
GL_SetCanvas (CANVAS_CONSOLE); //in case this is called from weird places
- if (alpha > 0.0)
+ if (alpha > 0.0f)
{
- if (alpha < 1.0)
+ if (alpha < 1.0f)
{
if (premul_hud)
glColor4f (alpha,alpha,alpha,alpha);
@@ -758,7 +758,7 @@ void Draw_ConsoleBackground (void)
Draw_Pic (0, 0, pic);
- if (alpha < 1.0)
+ if (alpha < 1.0f)
{
if (!premul_hud)
{
@@ -914,8 +914,8 @@ void GL_SetCanvas (canvastype newcanvas)
glViewport (glx, gly, glwidth, glheight);
break;
case CANVAS_MENU:
- s = q_min((float)glwidth / 320.0, (float)glheight / 200.0);
- s = CLAMP (1.0, scr_menuscale.value, s);
+ s = q_min((float)glwidth / 320.0f, (float)glheight / 200.0f);
+ s = CLAMP (1.0f, scr_menuscale.value, s);
// ericw -- doubled width to 640 to accommodate long keybindings
glOrtho (0, 640, 200, 0, -99999, 99999);
glViewport (glx + (glwidth - 320*s) / 2, gly + (glheight - 200*s) / 2, 640*s, 200*s);
@@ -932,7 +932,7 @@ void GL_SetCanvas (canvastype newcanvas)
glViewport (glx, gly, glwidth, glheight);
break;
case CANVAS_SBAR:
- s = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0);
+ s = CLAMP (1.0f, scr_sbarscale.value, (float)glwidth / 320.0f);
if (cl.gametype == GAME_DEATHMATCH)
{
glOrtho (0, glwidth / s, 48, 0, -99999, 99999);
@@ -945,7 +945,7 @@ void GL_SetCanvas (canvastype newcanvas)
}
break;
case CANVAS_CROSSHAIR: //0,0 is center of viewport
- s = CLAMP (1.0, scr_crosshairscale.value, 10.0);
+ s = CLAMP (1.0f, scr_crosshairscale.value, 10.0f);
glOrtho (scr_vrect.width/-2/s, scr_vrect.width/2/s, scr_vrect.height/2/s, scr_vrect.height/-2/s, -99999, 99999);
glViewport (scr_vrect.x, glheight - scr_vrect.y - scr_vrect.height, scr_vrect.width & ~1, scr_vrect.height & ~1);
break;
diff --git a/Quake/gl_fog.c b/Quake/gl_fog.c
index ddde3604..612e697c 100644
--- a/Quake/gl_fog.c
+++ b/Quake/gl_fog.c
@@ -100,7 +100,8 @@ void Fog_ParseServerMessage (void)
red = MSG_ReadByte() / 255.0;
green = MSG_ReadByte() / 255.0;
blue = MSG_ReadByte() / 255.0;
- time = q_max(0.0, MSG_ReadShort() / 100.0);
+ time = MSG_ReadShort() / 100.0;
+ if (time < 0.0f) time = 0.0f;
Fog_Update (density, red, green, blue, time);
}
@@ -114,6 +115,8 @@ handle the 'fog' console command
*/
void Fog_FogCommand_f (void)
{
+ float d, r, g, b, t;
+
switch (Cmd_Argc())
{
default:
@@ -127,43 +130,52 @@ void Fog_FogCommand_f (void)
Con_Printf(" \"red\" is \"%f\"\n", fog_red);
Con_Printf(" \"green\" is \"%f\"\n", fog_green);
Con_Printf(" \"blue\" is \"%f\"\n", fog_blue);
- break;
+ return;
case 2:
- Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
- fog_red,
- fog_green,
- fog_blue,
- 0.0);
+ d = Q_atof(Cmd_Argv(1));
+ t = 0.0f;
+ r = fog_red;
+ g = fog_green;
+ b = fog_blue;
break;
case 3: //TEST
- Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
- fog_red,
- fog_green,
- fog_blue,
- atof(Cmd_Argv(2)));
+ d = Q_atof(Cmd_Argv(1));
+ t = Q_atof(Cmd_Argv(2));
+ r = fog_red;
+ g = fog_green;
+ b = fog_blue;
break;
case 4:
- Fog_Update(fog_density,
- CLAMP(0.0, atof(Cmd_Argv(1)), 1.0),
- CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
- CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
- 0.0);
+ d = fog_density;
+ t = 0.0f;
+ r = Q_atof(Cmd_Argv(1));
+ g = Q_atof(Cmd_Argv(2));
+ b = Q_atof(Cmd_Argv(3));
break;
case 5:
- Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
- CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
- CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
- CLAMP(0.0, atof(Cmd_Argv(4)), 1.0),
- 0.0);
+ d = Q_atof(Cmd_Argv(1));
+ r = Q_atof(Cmd_Argv(2));
+ g = Q_atof(Cmd_Argv(3));
+ b = Q_atof(Cmd_Argv(4));
+ t = 0.0f;
break;
case 6: //TEST
- Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
- CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
- CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
- CLAMP(0.0, atof(Cmd_Argv(4)), 1.0),
- atof(Cmd_Argv(5)));
+ d = Q_atof(Cmd_Argv(1));
+ r = Q_atof(Cmd_Argv(2));
+ g = Q_atof(Cmd_Argv(3));
+ b = Q_atof(Cmd_Argv(4));
+ t = Q_atof(Cmd_Argv(5));
break;
}
+
+ if (d < 0.0f) d = 0.0f;
+ if (r < 0.0f) r = 0.0f;
+ else if (r > 1.0f) r = 1.0f;
+ if (g < 0.0f) g = 0.0f;
+ else if (g > 1.0f) g = 1.0f;
+ if (b < 0.0f) b = 0.0f;
+ else if (b > 1.0f) b = 1.0f;
+ Fog_Update(d, r, g, b, t);
}
/*
@@ -251,9 +263,14 @@ float *Fog_GetColor (void)
c[3] = 1.0;
}
+ for (i = 0; i < 3; i++) {
+ c[i] = CLAMP (0.f, c[i], 1.f);
+ }
+
//find closest 24-bit RGB value, so solid-colored sky can match the fog perfectly
- for (i=0;i<3;i++)
+ for (i = 0; i < 3; i++) {
c[i] = (float)(Q_rint(c[i] * 255)) / 255.0f;
+ }
return c;
}
diff --git a/Quake/gl_model.c b/Quake/gl_model.c
index aa6c262f..07da8722 100644
--- a/Quake/gl_model.c
+++ b/Quake/gl_model.c
@@ -678,7 +678,7 @@ static texture_t *Mod_LoadMipTex(miptex_t *mt, byte *lumpend, enum srcformat *fm
if ((srcdata + *pixelbytes) > lumpend)
{
Con_DPrintf("Texture %s extends past end of lump\n", mt->name);
- *pixelbytes = q_max(0, lumpend - srcdata);
+ *pixelbytes = q_max((ptrdiff_t)0, lumpend - srcdata);
}
memcpy ( tx+1, srcdata, *pixelbytes);
diff --git a/Quake/gl_rmain.c b/Quake/gl_rmain.c
index 4d9e430f..4facfa94 100644
--- a/Quake/gl_rmain.c
+++ b/Quake/gl_rmain.c
@@ -240,7 +240,7 @@ void GLSLGamma_GammaCorrect (void)
// draw the texture back to the framebuffer with a fragment shader
GL_UseProgramFunc (r_gamma_program);
GL_Uniform1fFunc (gammaLoc, vid_gamma.value);
- GL_Uniform1fFunc (contrastLoc, q_min(2.0, q_max(1.0, vid_contrast.value)));
+ GL_Uniform1fFunc (contrastLoc, q_min(2.0f, q_max(1.0f, vid_contrast.value)));
GL_Uniform1iFunc (textureLoc, 0); // use texture unit 0
glDisable (GL_ALPHA_TEST);
@@ -731,7 +731,7 @@ R_EmitWirePoint -- johnfitz -- draws a wireframe cross shape for point entities
*/
void R_EmitWirePoint (vec3_t origin)
{
- int size=8;
+ const int size = 8;
glBegin (GL_LINES);
glVertex3f (origin[0]-size, origin[1], origin[2]);
diff --git a/Quake/gl_screen.c b/Quake/gl_screen.c
index be405863..d38c306f 100644
--- a/Quake/gl_screen.c
+++ b/Quake/gl_screen.c
@@ -392,7 +392,7 @@ static void SCR_CalcRefdef (void)
//johnfitz -- rewrote this section
size = scr_viewsize.value;
- scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0);
+ scale = CLAMP (1.0f, scr_sbarscale.value, (float)glwidth / 320.0f);
if (size >= 120 || cl.intermission || (scr_sbaralpha.value < 1 || cl.qcvm.extfuncs.CSQC_DrawHud || cl.qcvm.extfuncs.CSQC_UpdateView)) //johnfitz -- scr_sbaralpha.value. Spike -- simple csqc assumes fullscreen video the same way.
sb_lines = 0;
@@ -401,12 +401,12 @@ static void SCR_CalcRefdef (void)
else
sb_lines = 48 * scale;
- size = q_min(scr_viewsize.value, 100) / 100;
+ size = q_min(scr_viewsize.value, 100.f) / 100;
//johnfitz
//johnfitz -- rewrote this section
- r_refdef.vrect.width = q_max(glwidth * size, 96); //no smaller than 96, for icons
- r_refdef.vrect.height = q_min(glheight * size, glheight - sb_lines); //make room for sbar
+ r_refdef.vrect.width = q_max(glwidth * size, 96.0f); //no smaller than 96, for icons
+ r_refdef.vrect.height = q_min((int)(glheight * size), glheight - sb_lines); //make room for sbar
r_refdef.vrect.x = (glwidth - r_refdef.vrect.width)/2;
r_refdef.vrect.y = (glheight - sb_lines - r_refdef.vrect.height)/2;
//johnfitz
diff --git a/Quake/gl_sky.c b/Quake/gl_sky.c
index d583be45..f594b324 100644
--- a/Quake/gl_sky.c
+++ b/Quake/gl_sky.c
@@ -881,7 +881,7 @@ void Sky_DrawSkyBox (void)
c = Fog_GetColor();
glEnable (GL_BLEND);
glDisable (GL_TEXTURE_2D);
- glColor4f (c[0],c[1],c[2], CLAMP(0.0,skyfog,1.0));
+ glColor4f (c[0],c[1],c[2], CLAMP(0.0f,skyfog,1.0f));
glBegin (GL_QUADS);
Sky_EmitSkyBoxVertex (skymins[0][i], skymins[1][i], i);
@@ -1032,7 +1032,7 @@ void Sky_DrawFaceQuad (glpoly_t *p)
c = Fog_GetColor();
glEnable (GL_BLEND);
glDisable (GL_TEXTURE_2D);
- glColor4f (c[0],c[1],c[2], CLAMP(0.0,skyfog,1.0));
+ glColor4f (c[0],c[1],c[2], CLAMP(0.0f,skyfog,1.0f));
glBegin (GL_QUADS);
for (i=0, v=p->verts[0] ; i<4 ; i++, v+=VERTEXSIZE)
diff --git a/Quake/gl_texmgr.c b/Quake/gl_texmgr.c
index cf465d4a..be593e80 100644
--- a/Quake/gl_texmgr.c
+++ b/Quake/gl_texmgr.c
@@ -734,11 +734,15 @@ TexMgr_SafeTextureSize -- return a size with hardware and user prefs in mind
*/
int TexMgr_SafeTextureSize (int s)
{
+ int p = (int)gl_max_size.value;
if (!gl_texture_NPOT)
s = TexMgr_Pad(s);
- if ((int)gl_max_size.value > 0)
- s = q_min(TexMgr_Pad((int)gl_max_size.value), s);
- s = q_min(gl_hardware_maxsize, s);
+ if (p > 0) {
+ p = TexMgr_Pad(p);
+ if (p < s) s = p;
+ }
+ if (s > gl_hardware_maxsize)
+ s = gl_hardware_maxsize;
return s;
}
diff --git a/Quake/host.c b/Quake/host.c
index 87bb6fa0..cc8b63e0 100644
--- a/Quake/host.c
+++ b/Quake/host.c
@@ -646,7 +646,7 @@ qboolean Host_FilterTime (float time)
realtime += time;
//johnfitz -- max fps cvar
- maxfps = CLAMP (10.0, host_maxfps.value, 1000.0);
+ maxfps = CLAMP (10.f, host_maxfps.value, 1000.0);
if (host_maxfps.value && !cls.timedemo && realtime - oldrealtime < 1.0/maxfps)
return false; // framerate is too high
//johnfitz
diff --git a/Quake/host_cmd.c b/Quake/host_cmd.c
index 1d29a417..c27ff67b 100644
--- a/Quake/host_cmd.c
+++ b/Quake/host_cmd.c
@@ -1081,7 +1081,9 @@ static void Host_SavegameComment (char *text)
if (p1 != NULL) *p1 = 0;
if (p2 != NULL) *p2 = 0;
- memcpy (text, cl.levelname, q_min(strlen(cl.levelname),22)); //johnfitz -- only copy 22 chars.
+ i = (int) strlen(cl.levelname);
+ if (i > 22) i = 22;
+ memcpy (text, cl.levelname, (size_t)i);
sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
memcpy (text+22, kills, strlen(kills));
// convert space to _ to make stdio happy
diff --git a/Quake/main_sdl.c b/Quake/main_sdl.c
index 9284af3a..5c0167a4 100644
--- a/Quake/main_sdl.c
+++ b/Quake/main_sdl.c
@@ -33,27 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#include
-#if defined(USE_SDL2)
-
-/* need at least SDL_2.0.0 */
-#define SDL_MIN_X 2
-#define SDL_MIN_Y 0
-#define SDL_MIN_Z 0
-#define SDL_REQUIREDVERSION (SDL_VERSIONNUM(SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z))
-#define SDL_NEW_VERSION_REJECT (SDL_VERSIONNUM(3,0,0))
-
-#else
-
-/* need at least SDL_1.2.10 */
-#define SDL_MIN_X 1
-#define SDL_MIN_Y 2
-#define SDL_MIN_Z 10
-#define SDL_REQUIREDVERSION (SDL_VERSIONNUM(SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z))
-/* reject 1.3.0 and newer at runtime. */
-#define SDL_NEW_VERSION_REJECT (SDL_VERSIONNUM(1,3,0))
-
-#endif
-
static void Sys_AtExit (void)
{
SDL_Quit();
@@ -70,18 +49,8 @@ static void Sys_InitSDL (void)
#endif
Sys_Printf("Found SDL version %i.%i.%i\n",sdl_version->major,sdl_version->minor,sdl_version->patch);
- if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) < SDL_REQUIREDVERSION)
- { /*reject running under older SDL versions */
- Sys_Error("You need at least v%d.%d.%d of SDL to run this game.", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
- }
- if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) >= SDL_NEW_VERSION_REJECT)
- { /*reject running under newer (1.3.x) SDL */
- Sys_Error("Your version of SDL library is incompatible with me.\n"
- "You need a library version in the line of %d.%d.%d\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
- }
- if (SDL_Init(0) < 0)
- {
+ if (SDL_Init(0) < 0) {
Sys_Error("Couldn't init SDL: %s", SDL_GetError());
}
atexit(Sys_AtExit);
@@ -197,4 +166,3 @@ int main(int argc, char *argv[])
return 0;
}
-
diff --git a/Quake/menu.c b/Quake/menu.c
index 4e07de94..e19bb59f 100644
--- a/Quake/menu.c
+++ b/Quake/menu.c
@@ -2065,8 +2065,8 @@ qboolean M_Quit_TextEntry (void)
void M_Quit_Draw (void) //johnfitz -- modified for new quit message
{
- char msg1[40];
- char msg2[] = "by Ozkan Sezer, Eric Wasylishen, others";/* msg2/msg3 are mostly [40] */
+ char msg1[] = ENGINE_NAME_AND_VER;
+ char msg2[] = "by Ozkan Sezer,Eric Wasylishen,others"; /* msg2/msg3 are [38] at most */
char msg3[] = "Press y to quit";
int boxlen;
@@ -2078,17 +2078,14 @@ void M_Quit_Draw (void) //johnfitz -- modified for new quit message
m_state = m_quit;
}
- sprintf(msg1, ENGINE_NAME_AND_VER);
-
//okay, this is kind of fucked up. M_DrawTextBox will always act as if
//width is even. Also, the width and lines values are for the interior of the box,
//but the x and y values include the border.
- boxlen = q_max(strlen(msg1), q_max((sizeof(msg2)-1),(sizeof(msg3)-1))) + 1;
- if (boxlen & 1) boxlen++;
+ boxlen = (q_max(sizeof(msg1), q_max(sizeof(msg2),sizeof(msg3))) + 1) & ~1;
M_DrawTextBox (160-4*(boxlen+2), 76, boxlen, 4);
//now do the text
- M_Print (160-4*strlen(msg1), 88, msg1);
+ M_Print (160-4*(sizeof(msg1)-1), 88, msg1);
M_Print (160-4*(sizeof(msg2)-1), 96, msg2);
M_PrintWhite (160-4*(sizeof(msg3)-1), 104, msg3);
}
diff --git a/Quake/pl_linux.c b/Quake/pl_linux.c
index 9e62ceb8..25fe6b4b 100644
--- a/Quake/pl_linux.c
+++ b/Quake/pl_linux.c
@@ -80,8 +80,8 @@ char *PL_GetClipboardData (void)
* such as an ip address, etc: do chop the size
* here, otherwise we may experience Z_Malloc()
* failures and all other not-oh-so-fun stuff. */
- size = q_min(MAX_CLIPBOARDTXT, size);
- data = (char *) Z_Malloc(size);
+ size = q_min((size_t)(MAX_CLIPBOARDTXT), size);
+ data = (char *) Z_Malloc((int)size);
q_strlcpy (data, cliptext, size);
}
#endif
diff --git a/Quake/pl_osx.m b/Quake/pl_osx.m
index e9b1e4fe..e3a5b98b 100644
--- a/Quake/pl_osx.m
+++ b/Quake/pl_osx.m
@@ -56,8 +56,8 @@ char *PL_GetClipboardData (void)
NSString* clipboardString = [pasteboard stringForType: NSPasteboardTypeString];
if (clipboardString != NULL && [clipboardString length] > 0) {
size_t sz = [clipboardString length] + 1;
- sz = q_min(MAX_CLIPBOARDTXT, sz);
- data = (char *) Z_Malloc(sz);
+ sz = q_min((size_t)(MAX_CLIPBOARDTXT), sz);
+ data = (char *) Z_Malloc((int)sz);
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1040) /* for ppc builds targeting 10.3 and older */
q_strlcpy (data, [clipboardString cString], sz);
#else
diff --git a/Quake/pl_win.c b/Quake/pl_win.c
index d6a5045e..486e3fcb 100644
--- a/Quake/pl_win.c
+++ b/Quake/pl_win.c
@@ -95,8 +95,8 @@ char *PL_GetClipboardData (void)
* such as an ip address, etc: do chop the size
* here, otherwise we may experience Z_Malloc()
* failures and all other not-oh-so-fun stuff. */
- size = q_min(MAX_CLIPBOARDTXT, size);
- data = (char *) Z_Malloc(size);
+ size = q_min((size_t)(MAX_CLIPBOARDTXT), size);
+ data = (char *) Z_Malloc((int)size);
q_strlcpy (data, cliptext, size);
GlobalUnlock (hClipboardData);
}
diff --git a/Quake/pr_edict.c b/Quake/pr_edict.c
index 1764f350..19b8aeee 100644
--- a/Quake/pr_edict.c
+++ b/Quake/pr_edict.c
@@ -948,7 +948,7 @@ const char *ED_ParseEdict (const char *data, edict_t *ent)
//johnfitz -- hack to support .alpha even when progs.dat doesn't know about it
if (!strcmp(keyname, "alpha"))
- ent->alpha = ENTALPHA_ENCODE(atof(com_token));
+ ent->alpha = ENTALPHA_ENCODE(Q_atof(com_token));
//johnfitz
//spike -- hacks to support func_illusionary/info_notnull with all sorts of mdls, and various particle effects
diff --git a/Quake/protocol.h b/Quake/protocol.h
index 9b68dfe9..ff81f827 100644
--- a/Quake/protocol.h
+++ b/Quake/protocol.h
@@ -247,7 +247,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ENTALPHA_DEFAULT 0 //entity's alpha is "default" (i.e. water obeys r_wateralpha) -- must be zero so zeroed out memory works
#define ENTALPHA_ZERO 1 //entity is invisible (lowest possible alpha)
#define ENTALPHA_ONE 255 //entity is fully opaque (highest possible alpha)
-#define ENTALPHA_ENCODE(a) (((a)==0)?ENTALPHA_DEFAULT:Q_rint(CLAMP(1,(a)*254.0f+1,255))) //server convert to byte to send to client
+#define ENTALPHA_ENCODE(a) (((a)==0)?ENTALPHA_DEFAULT:Q_rint(CLAMP(1.0f,(a)*254.0f+1,255.0f))) //server convert to byte to send to client
#define ENTALPHA_DECODE(a) (((a)==ENTALPHA_DEFAULT)?1.0f:((float)(a)-1)/(254)) //client convert to float for rendering
#define ENTALPHA_TOSAVE(a) (((a)==ENTALPHA_DEFAULT)?0.0f:(((a)==ENTALPHA_ZERO)?-1.0f:((float)(a)-1)/(254))) //server convert to float for savegame
//johnfitz
diff --git a/Quake/quakedef.h b/Quake/quakedef.h
index 9ba4a9f9..22053367 100644
--- a/Quake/quakedef.h
+++ b/Quake/quakedef.h
@@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FITZQUAKE_VERSION 0.85 //johnfitz
#define QUAKESPASM_VERSION 0.94
-#define QUAKESPASM_VER_PATCH 4 // helper to print a string like 0.94.4
+#define QUAKESPASM_VER_PATCH 5 // helper to print a string like 0.94.4
#ifndef QUAKESPASM_VER_SUFFIX
#define QUAKESPASM_VER_SUFFIX // optional version suffix string literal like "-beta1"
#endif
diff --git a/Quake/r_alias.c b/Quake/r_alias.c
index 616125f0..87165454 100644
--- a/Quake/r_alias.c
+++ b/Quake/r_alias.c
@@ -828,9 +828,9 @@ void R_SetupAliasFrame (aliashdr_t *paliashdr, entity_t *e, lerpdata_t *lerpdata
if (r_lerpmodels.value && !(e->model->flags & MOD_NOLERP && r_lerpmodels.value != 2))
{
if (e->lerpflags & LERP_FINISH && numposes == 1)
- lerpdata->blend = CLAMP (0, (cl.time - e->lerp.state.lerpstart) / (e->lerpfinish - e->lerp.state.lerpstart), 1);
+ lerpdata->blend = CLAMP (0.0f, (float)(cl.time - e->lerp.state.lerpstart) / (e->lerpfinish - e->lerp.state.lerpstart), 1.0f);
else
- lerpdata->blend = CLAMP (0, (cl.time - e->lerp.state.lerpstart) / e->lerp.state.lerptime, 1);
+ lerpdata->blend = CLAMP (0.0f, (float)(cl.time - e->lerp.state.lerpstart) / e->lerp.state.lerptime, 1.0f);
lerpdata->pose1 = e->lerp.state.previouspose;
lerpdata->pose2 = e->lerp.state.currentpose;
}
@@ -905,9 +905,9 @@ void R_SetupEntityTransform (entity_t *e, lerpdata_t *lerpdata)
if (r_lerpmove.value && e != &cl.viewent && e->lerpflags & LERP_MOVESTEP)
{
if (e->lerpflags & LERP_FINISH)
- blend = CLAMP (0, (cl.time - e->movelerpstart) / (e->lerpfinish - e->movelerpstart), 1);
+ blend = CLAMP (0.0f, (float)(cl.time - e->movelerpstart) / (e->lerpfinish - e->movelerpstart), 1.0f);
else
- blend = CLAMP (0, (cl.time - e->movelerpstart) / 0.1, 1);
+ blend = CLAMP (0.0f, (float)(cl.time - e->movelerpstart) / 0.1f, 1.0f);
//translation
VectorSubtract (e->currentorigin, e->previousorigin, d);
@@ -1051,7 +1051,7 @@ void R_DrawAliasModel (entity_t *e)
{
aliasglsl_t *glsl;
aliashdr_t *paliashdr;
- int i, anim, skinnum;
+ int anim, skinnum;
gltexture_t *tx, *fb;
lerpdata_t lerpdata;
qboolean alphatest = !!(e->model->flags & MF_HOLEY);
@@ -1160,9 +1160,8 @@ void R_DrawAliasModel (entity_t *e)
}
if (e->netstate.colormap && !gl_nocolors.value)
{
- i = e - cl.entities;
- if (i >= 1 && i<=cl.maxclients /* && !strcmp (currententity->model->name, "progs/player.mdl") */)
- tx = playertextures[i - 1];
+ if ((uintptr_t)e >= (uintptr_t)&cl.entities[1] && (uintptr_t)e <= (uintptr_t)&cl.entities[cl.maxclients]) /* && !strcmp (currententity->model->name, "progs/player.mdl") */
+ tx = playertextures[e - cl.entities - 1];
}
if (!gl_fullbrights.value)
fb = NULL;
diff --git a/Quake/r_brush.c b/Quake/r_brush.c
index d7946a40..ce987457 100644
--- a/Quake/r_brush.c
+++ b/Quake/r_brush.c
@@ -235,8 +235,11 @@ void R_DrawSequentialPoly (msurface_t *s)
if (s->flags & SURF_DRAWTURB)
{
if (currententity->alpha == ENTALPHA_DEFAULT)
- entalpha = CLAMP(0.0, GL_WaterAlphaForSurface(s), 1.0);
-
+ {
+ entalpha = GL_WaterAlphaForSurface(s);
+ if (entalpha > 1.0f) entalpha = 1.0f;
+ else if (entalpha < 0.0f) entalpha = 0.0f;
+ }
if (entalpha < 1)
{
glDepthMask(GL_FALSE);
diff --git a/Quake/sbar.c b/Quake/sbar.c
index d01ac03e..32831824 100644
--- a/Quake/sbar.c
+++ b/Quake/sbar.c
@@ -373,7 +373,7 @@ void Sbar_DrawScrollString (int x, int y, int width, const char *str)
float scale;
int len, ofs, left;
- scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0);
+ scale = CLAMP (1.0f, scr_sbarscale.value, (float)glwidth / 320.0f);
left = x * scale;
if (cl.gametype != GAME_DEATHMATCH)
left += (((float)glwidth - 320.0 * scale) / 2);
@@ -1287,7 +1287,7 @@ void Sbar_MiniDeathmatchOverlay (void)
float scale; //johnfitz
scoreboard_t *s;
- scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0); //johnfitz
+ scale = CLAMP (1.0f, scr_sbarscale.value, (float)glwidth / 320.0f); //johnfitz
//MAX_SCOREBOARDNAME = 32, so total width for this overlay plus sbar is 632, but we can cut off some i guess
if (glwidth/scale < 512 || scr_viewsize.value >= 120) //johnfitz -- test should consider scr_sbarscale
diff --git a/Quakespasm.html b/Quakespasm.html
index 624be5fa..eb942857 100644
--- a/Quakespasm.html
+++ b/Quakespasm.html
@@ -8,7 +8,7 @@
QuakeSpasm
-Page last edited: April 2022.
+Page last edited: June 2022.
@@ -36,28 +36,29 @@
@@ -71,8 +72,6 @@
-
-
QuakeSpasm
is a modern, cross-platform Quake engine based on
@@ -83,8 +82,6 @@ sound driver, some graphical niceities, and numerous bug-fixes and other improve
SDL is probably less buggy, but SDL2 has nicer features and smoother mouse input - though no CD support.
-
-
-
@@ -94,10 +91,7 @@ SDL is probably less buggy, but SDL2 has nicer features and smoother mouse input
-
-
-
Visit the
FitzQuake homepage for a full run-down of the engine's commands and variables.
@@ -119,7 +113,6 @@ where DRIVER may be alsa, dsp, pulse, esd ...
-
Quakespasm can play various external music formats, including MP3, OGG and FLAC.
- Tracks should be named like "track02.ogg", "track03.ogg" ... (there is no track01) and placed into "Quake/id1/music".
@@ -133,14 +126,12 @@ where DRIVER may be alsa, dsp, pulse, esd ...
-
The SDL2 variant of Quakespasm supports Xbox 360 style game controllers.
The default configuration uses the left analog stick for movement and the right for looking.
If your controller doesn't work you can try placing
this file in your Quake directory, it is a community-maintained database that adds support for more controllers to SDL2.
Cvars
-
- joy_deadzone - Fraction of the stick travel to be deadzone, between 0 and 1. Default 0.175.
@@ -152,9 +143,7 @@ where DRIVER may be alsa, dsp, pulse, esd ...
- joy_enable - Set to 0 to disable controller support. Default 1.
-
Buttons
-
Some of the controller buttons are hardcoded to allow navigating the menu:
@@ -186,7 +175,6 @@ where DRIVER may be alsa, dsp, pulse, esd ...
-
See the Downloads section to get the sourcecode, then below for platform specific instructions.
Quakespasm can also be built with the cross-platform Codeblocks.
Quakespasm's (optional) custom data is now stored in the file quakespasm.pak. This file should be placed alongside your quakespasm binary and id1 directory.
@@ -221,13 +209,25 @@ Compile time options include
QuakeSpasm 0.94.0 has initial support for playing the 2021 re-release content: Copy the quakespasm binary to your rerelease installation and run quakespasm as you normally do.
+
+
-
-
-
+
+- Compatibility with new SDL2 versioning scheme.
+- Revised min/max/clamp macros' usage.
+- Fixed a potential undefined behavior in R_DrawAliasModel.
+- Fixed parsing of the time argument of svc_fog server message. (it has been broken for more than 20 years and has never seem to have been used.)
+- Other small improvements elsewhere in the code.
+- Backported a few fixes to the bundled SDL2-2.0.22 version.
+
+
+5.2 Changes in 0.94.4
+
- Fixed getting stuck with loading plaque upon attempting to load a bad save from the menu
@@ -247,9 +247,9 @@ Compile time options include
- Thanks to Andrei Drexler, 'atsb' and 'temx' for their several patches.
-5.2 Changes in 0.94.3
-
+5.3 Changes in 0.94.3
+
- Handle sky textures with non-standard sizes and warn about them (e.g. ad_tears)
@@ -257,9 +257,9 @@ Compile time options include
- Updated included SDL2 to latest version 2.0.18.
-5.3 Changes in 0.94.2
-
+5.4 Changes in 0.94.2
+
- 2021 rerelease: Support for playing the latest update.
@@ -268,17 +268,17 @@ Compile time options include
- 2021 rerelease: Look for QuakeEX.kpf under userdir, too.
-5.4 Changes in 0.94.1
-
+5.5 Changes in 0.94.1
+
- Fix lightmap issues after vkQuake surface mark/cull optimizations merge (sf.net bug/50)
-5.5 Changes in 0.94.0
-
+5.6 Changes in 0.94.0
+
- Initial support for playing the 'Quake 2021 re-release' content (thanks to Andrei Drexler for bulk of the work, Guillaume Plourde for Q64 bsp format support.)
@@ -301,9 +301,9 @@ Compile time options include
- Source repository moved to git.
-5.6 Changes in 0.93.2
-
+5.7 Changes in 0.93.2
+
- Lightmaps are now dynamically allocated (from QSS), and BLOCK_WIDTH/HEIGHT raised from 128 to 256.
@@ -314,9 +314,9 @@ Compile time options include
- Update the third-party libraries. Other fixes/cleanups.
-5.7 Changes in 0.93.1
-
+5.8 Changes in 0.93.1
+
- Fixed a fog regression which was introduced in 0.93.0.
@@ -328,9 +328,9 @@ Compile time options include
- Update the third-party libraries. Other fixes/cleanups.
-5.8 Changes in 0.93.0
-
+5.9 Changes in 0.93.0
+
- Raise default "joy_deadzone_trigger" cvar to 0.2.
@@ -371,9 +371,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Update the third-party libraries.
-5.9 Changes in 0.92.1
-
+5.10 Changes in 0.92.1
+
- Fixed large menu scale factors (was broken in 0.92.0).
@@ -381,9 +381,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Updated some of the third-party libraries.
-5.10 Changes in 0.92.0
-
+5.11 Changes in 0.92.0
+
- SDL2 Game Controller support.
@@ -401,12 +401,10 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Updated some of the third-party libraries. Other fixes/clean-ups.
-5.11 Changes in 0.91.0
+
+5.12 Changes in 0.91.0
-
-
Bugfixes
-
- Fix unwanted fog mode change upon video restart.
@@ -424,35 +422,27 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Prevent a possible vulnerability in MSG_ReadString (old Q1/Q2 bug).
-
Visual improvements
-
- New cvars r_lavaalpha, r_slimealpha, r_telealpha for fine-tuning specific liquid opacities (from DirectQ/RMQEngine, non-archived, default to 0), and new worldspawn keys _wateralpha, _lavaalpha, _slimealpha, _telealpha, _skyfog (unique to Quakespasm, similar to the behaviour of the "fog" worldspawn key).
- GLSL gamma is now supported on older hardware without NPOT extension.
-
Interface improvements
-
- New r_pos command to show player position.
- NaN detection in traceline with "developer 1" set now warns instead of errors.
-
Code cleanup / Other
-
- Update third-party libraries.
-
Raised limits
-
- Default max_edicts 8192 (was 2048) and no longer saved to config.cfg.
@@ -461,12 +451,10 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Raised MAX_SFX to 1024 (was 512).
-5.12 Changes in 0.90.1
+
+5.13 Changes in 0.90.1
-
-
Bugfixes
-
- Fix dynamic light artifact where changing lightmap are rendered one frame late (bug introduced in 0.90.0).
@@ -480,18 +468,14 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Fix crash on out-of-bounds skin number.
-
Performance
-
- Use multithreaded OpenGL on OS X for better performance.
- New, faster mdl renderer using GLSL. Disable with "-noglslalias".
-
Visual improvements
-
- New gamma correction implementation using GLSL. Fixes all known gamma issues (affecting the full display, persisting after quitting, or darkening the screen on OS X). Disable with "-noglslgamma".
@@ -500,9 +484,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- r_noshadow_list cvar added (from MarkV.)
-
Interface improvements
-
- Support pausing demo playback with the "pause" command.
@@ -512,18 +494,16 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Some spam moved from developer 1 to 2: "can't find tga/lit/ent", "trying to load ent", "bad chunk length", "meshing", "PR_AlocStringSlots: realloc'ing"
-
Code cleanup
-
- Clean up IDE project files to build on fresh systems.
- Update 3rd-party libraries.
-5.13 Changes in 0.90.0
-
+5.14 Changes in 0.90.0
+
- Fix issues on Windows systems with DPI scaling.
@@ -567,9 +547,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Other fixes and clean-ups.
-5.14 Changes in 0.85.9
-
+5.15 Changes in 0.85.9
+
- Fixes for several undefined behaviors in C code (gcc-4.8 support.)
@@ -591,9 +571,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Several other minor fixes/cleanups.
-5.15 Changes in 0.85.8
-
+5.16 Changes in 0.85.8
+
- Made Quake shareware 1.00 and 1.01 versions to be recognized properly.
@@ -616,9 +596,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Miscellaneous source code cleanups.
-5.16 Changes in 0.85.7
-
+5.17 Changes in 0.85.7
+
- Added support for cross-level demo playback
@@ -634,9 +614,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Several other small changes mostly invisible to the end-user
-5.17 Changes in 0.85.6
-
+5.18 Changes in 0.85.6
+
- More work for string buffer safety
@@ -645,9 +625,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Minor SDL video fixes.
-5.18 Changes in 0.85.5
-
+5.19 Changes in 0.85.5
+
- SDL input driver updated adding native keymap and dead key support to the console
@@ -664,9 +644,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Several code updates from uHexen2 project, several code cleanups.
-5.19 Changes in 0.85.4
-
+5.20 Changes in 0.85.4
+
- Implement music (OGG, MP3, WAV) playback
@@ -682,9 +662,9 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
- Other minor sound and cdaudio updates
-5.20 Changes in 0.85.3
-
+5.21 Changes in 0.85.3
+
- Fix the "-dedicated" option (thanks Oz) and add platform specific networking code (default) rather than SDL_net
@@ -705,9 +685,8 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
-5.21 Changes in 0.85.2
+5.22 Changes in 0.85.2
-
- Replace the old "Screen size" slider with a "Scale" slider
@@ -724,9 +703,8 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
-5.22 Changes in 0.85.1
+5.23 Changes in 0.85.1
-
- 64 bit CPU support
@@ -750,7 +728,6 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
6. Copyright
-
- Quake and Quakespasm are released under the
@@ -761,7 +738,6 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
7. Contact
-
-
@@ -776,7 +752,6 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
8. Links
-
-
diff --git a/Quakespasm.txt b/Quakespasm.txt
index ae48aa08..0bf922b0 100644
--- a/Quakespasm.txt
+++ b/Quakespasm.txt
@@ -19,38 +19,39 @@
4.4 Quake '2021 re-release'
5. Changes
- 5.1 Changes in 0.94.4
- 5.2 Changes in 0.94.3
- 5.3 Changes in 0.94.2
- 5.4 Changes in 0.94.1
- 5.5 Changes in 0.94.0
- 5.6 Changes in 0.93.2
- 5.7 Changes in 0.93.1
- 5.8 Changes in 0.93.0
- 5.9 Changes in 0.92.1
- 5.10 Changes in 0.92.0
- 5.11 Changes in 0.91.0
- 5.11.1 Bugfixes
- 5.11.2 Visual improvements
- 5.11.3 Interface improvements
- 5.11.4 Code cleanup / Other
- 5.11.5 Raised limits
- 5.12 Changes in 0.90.1
+ 5.1 Changes in 0.94.5
+ 5.2 Changes in 0.94.4
+ 5.3 Changes in 0.94.3
+ 5.4 Changes in 0.94.2
+ 5.5 Changes in 0.94.1
+ 5.6 Changes in 0.94.0
+ 5.7 Changes in 0.93.2
+ 5.8 Changes in 0.93.1
+ 5.9 Changes in 0.93.0
+ 5.10 Changes in 0.92.1
+ 5.11 Changes in 0.92.0
+ 5.12 Changes in 0.91.0
5.12.1 Bugfixes
- 5.12.2 Performance
- 5.12.3 Visual improvements
- 5.12.4 Interface improvements
- 5.12.5 Code cleanup
- 5.13 Changes in 0.90.0
- 5.14 Changes in 0.85.9
- 5.15 Changes in 0.85.8
- 5.16 Changes in 0.85.7
- 5.17 Changes in 0.85.6
- 5.18 Changes in 0.85.5
- 5.19 Changes in 0.85.4
- 5.20 Changes in 0.85.3
- 5.21 Changes in 0.85.2
- 5.22 Changes in 0.85.1
+ 5.12.2 Visual improvements
+ 5.12.3 Interface improvements
+ 5.12.4 Code cleanup / Other
+ 5.12.5 Raised limits
+ 5.13 Changes in 0.90.1
+ 5.13.1 Bugfixes
+ 5.13.2 Performance
+ 5.13.3 Visual improvements
+ 5.13.4 Interface improvements
+ 5.13.5 Code cleanup
+ 5.14 Changes in 0.90.0
+ 5.15 Changes in 0.85.9
+ 5.16 Changes in 0.85.8
+ 5.17 Changes in 0.85.7
+ 5.18 Changes in 0.85.6
+ 5.19 Changes in 0.85.5
+ 5.20 Changes in 0.85.4
+ 5.21 Changes in 0.85.3
+ 5.22 Changes in 0.85.2
+ 5.23 Changes in 0.85.1
6. Copyright
7. Contact
@@ -59,7 +60,8 @@
______________________________________________________________________
- Page last edited: April 2022.
+
+ Page last edited: June 2022.
1. About
@@ -264,7 +266,24 @@
5. Changes
- 5.1. Changes in 0.94.4
+ 5.1. Changes in 0.94.5
+
+ o Compatibility with new SDL2 versioning scheme.
+
+ o Revised min/max/clamp macros' usage.
+
+ o Fixed a potential undefined behavior in R_DrawAliasModel.
+
+ o Fixed parsing of the time argument of svc_fog server message. (it
+ has been broken for more than 20 years and has never seem to have
+ been used.)
+
+ o Other small improvements elsewhere in the code.
+
+ o Backported a few fixes to the bundled SDL2-2.0.22 version.
+
+
+ 5.2. Changes in 0.94.4
o Fixed getting stuck with loading plaque upon attempting to load a
bad save from the menu
@@ -300,7 +319,7 @@
patches.
- 5.2. Changes in 0.94.3
+ 5.3. Changes in 0.94.3
o Handle sky textures with non-standard sizes and warn about them
(e.g. ad_tears)
@@ -312,7 +331,7 @@
o Updated included SDL2 to latest version 2.0.18.
- 5.3. Changes in 0.94.2
+ 5.4. Changes in 0.94.2
o 2021 rerelease: Support for playing the latest update.
@@ -323,13 +342,13 @@
o 2021 rerelease: Look for QuakeEX.kpf under userdir, too.
- 5.4. Changes in 0.94.1
+ 5.5. Changes in 0.94.1
o Fix lightmap issues after vkQuake surface mark/cull optimizations
merge (sf.net bug/50)
- 5.5. Changes in 0.94.0
+ 5.6. Changes in 0.94.0
o Initial support for playing the 'Quake 2021 re-release' content
(thanks to Andrei Drexler for bulk of the work, Guillaume Plourde
@@ -378,7 +397,7 @@
o Source repository moved to git.
- 5.6. Changes in 0.93.2
+ 5.7. Changes in 0.93.2
o Lightmaps are now dynamically allocated (from QSS), and
BLOCK_WIDTH/HEIGHT raised from 128 to 256.
@@ -398,7 +417,7 @@
o Update the third-party libraries. Other fixes/cleanups.
- 5.7. Changes in 0.93.1
+ 5.8. Changes in 0.93.1
o Fixed a fog regression which was introduced in 0.93.0.
@@ -416,7 +435,7 @@
o Update the third-party libraries. Other fixes/cleanups.
- 5.8. Changes in 0.93.0
+ 5.9. Changes in 0.93.0
o Raise default "joy_deadzone_trigger" cvar to 0.2.
@@ -501,7 +520,7 @@
o Update the third-party libraries.
- 5.9. Changes in 0.92.1
+ 5.10. Changes in 0.92.1
o Fixed large menu scale factors (was broken in 0.92.0).
@@ -510,7 +529,7 @@
o Updated some of the third-party libraries.
- 5.10. Changes in 0.92.0
+ 5.11. Changes in 0.92.0
o SDL2 Game Controller support.
@@ -547,9 +566,9 @@
o Updated some of the third-party libraries. Other fixes/clean-ups.
- 5.11. Changes in 0.91.0
+ 5.12. Changes in 0.91.0
- 5.11.1. Bugfixes
+ 5.12.1. Bugfixes
o Fix unwanted fog mode change upon video restart.
@@ -585,7 +604,7 @@
o Prevent a possible vulnerability in MSG_ReadString (old Q1/Q2 bug).
- 5.11.2. Visual improvements
+ 5.12.2. Visual improvements
o New cvars r_lavaalpha, r_slimealpha, r_telealpha for fine-tuning
specific liquid opacities (from DirectQ/RMQEngine, non-archived,
@@ -596,18 +615,18 @@
o GLSL gamma is now supported on older hardware without NPOT
extension.
- 5.11.3. Interface improvements
+ 5.12.3. Interface improvements
o New r_pos command to show player position.
o NaN detection in traceline with "developer 1" set now warns instead
of errors.
- 5.11.4. Code cleanup / Other
+ 5.12.4. Code cleanup / Other
o Update third-party libraries.
- 5.11.5. Raised limits
+ 5.12.5. Raised limits
o Default max_edicts 8192 (was 2048) and no longer saved to
config.cfg.
@@ -619,9 +638,9 @@
o Raised MAX_SFX to 1024 (was 512).
- 5.12. Changes in 0.90.1
+ 5.13. Changes in 0.90.1
- 5.12.1. Bugfixes
+ 5.13.1. Bugfixes
o Fix dynamic light artifact where changing lightmap are rendered one
frame late (bug introduced in 0.90.0).
@@ -644,13 +663,13 @@
o Fix crash on out-of-bounds skin number.
- 5.12.2. Performance
+ 5.13.2. Performance
o Use multithreaded OpenGL on OS X for better performance.
o New, faster mdl renderer using GLSL. Disable with "-noglslalias".
- 5.12.3. Visual improvements
+ 5.13.3. Visual improvements
o New gamma correction implementation using GLSL. Fixes all known
gamma issues (affecting the full display, persisting after
@@ -664,7 +683,7 @@
o r_noshadow_list cvar added (from MarkV.)
- 5.12.4. Interface improvements
+ 5.13.4. Interface improvements
o Support pausing demo playback with the "pause" command.
@@ -681,14 +700,14 @@
"trying to load ent", "bad chunk length", "meshing",
"PR_AlocStringSlots: realloc'ing"
- 5.12.5. Code cleanup
+ 5.13.5. Code cleanup
o Clean up IDE project files to build on fresh systems.
o Update 3rd-party libraries.
- 5.13. Changes in 0.90.0
+ 5.14. Changes in 0.90.0
o Fix issues on Windows systems with DPI scaling.
@@ -796,7 +815,7 @@
o Other fixes and clean-ups.
- 5.14. Changes in 0.85.9
+ 5.15. Changes in 0.85.9
o Fixes for several undefined behaviors in C code (gcc-4.8 support.)
@@ -843,7 +862,7 @@
o Several other minor fixes/cleanups.
- 5.15. Changes in 0.85.8
+ 5.16. Changes in 0.85.8
o Made Quake shareware 1.00 and 1.01 versions to be recognized
properly.
@@ -890,7 +909,7 @@
o Miscellaneous source code cleanups.
- 5.16. Changes in 0.85.7
+ 5.17. Changes in 0.85.7
o Added support for cross-level demo playback
@@ -916,7 +935,7 @@
o Several other small changes mostly invisible to the end-user
- 5.17. Changes in 0.85.6
+ 5.18. Changes in 0.85.6
o More work for string buffer safety
@@ -929,7 +948,7 @@
o Minor SDL video fixes.
- 5.18. Changes in 0.85.5
+ 5.19. Changes in 0.85.5
o SDL input driver updated adding native keymap and dead key support
to the console
@@ -960,7 +979,7 @@
o Several code updates from uHexen2 project, several code cleanups.
- 5.19. Changes in 0.85.4
+ 5.20. Changes in 0.85.4
o Implement music (OGG, MP3, WAV) playback
@@ -988,7 +1007,7 @@
o Other minor sound and cdaudio updates
- 5.20. Changes in 0.85.3
+ 5.21. Changes in 0.85.3
o Fix the "-dedicated" option (thanks Oz) and add platform specific
networking code (default) rather than SDL_net
@@ -1025,7 +1044,7 @@
some other CD tweaks.
- 5.21. Changes in 0.85.2
+ 5.22. Changes in 0.85.2
o Replace the old "Screen size" slider with a "Scale" slider
@@ -1053,7 +1072,7 @@
o Add OSX Makefile (tested?)
- 5.22. Changes in 0.85.1
+ 5.23. Changes in 0.85.1
o 64 bit CPU support
@@ -1126,3 +1145,4 @@
http://www.celephais.net/board/view_thread.php?id=60452
o Inside3D forums: http://forums.insideqc.com
+
diff --git a/Windows/SDL2/include/SDL_assert.h b/Windows/SDL2/include/SDL_assert.h
index defadf13..427c4c63 100644
--- a/Windows/SDL2/include/SDL_assert.h
+++ b/Windows/SDL2/include/SDL_assert.h
@@ -22,7 +22,7 @@
#ifndef SDL_assert_h_
#define SDL_assert_h_
-#include "SDL_config.h"
+#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
@@ -51,6 +51,8 @@ assert can have unique static variables associated with it.
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
+#elif _SDL_HAS_BUILTIN(__builtin_debugtrap)
+ #define SDL_TriggerBreakpoint() __builtin_debugtrap()
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
diff --git a/Windows/SDL2/include/SDL_config_windows.h b/Windows/SDL2/include/SDL_config_windows.h
index 770b1903..3fe954e4 100644
--- a/Windows/SDL2/include/SDL_config_windows.h
+++ b/Windows/SDL2/include/SDL_config_windows.h
@@ -38,6 +38,18 @@
#include
#endif
+/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the
+ * Windows 10 SDK have broken declarations for the C API for DirectX 12. */
+#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include)
+#if __has_include()
+#define HAVE_SDKDDKVER_H 1
+#endif
+#endif
+
+#ifdef HAVE_SDKDDKVER_H
+#include
+#endif
+
/* This is a set of defines to configure the SDL features */
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
@@ -227,7 +239,9 @@ typedef unsigned int uintptr_t;
#endif
/* Enable various audio drivers */
+#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H)
#define SDL_AUDIO_DRIVER_WASAPI 1
+#endif
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1
@@ -248,7 +262,11 @@ typedef unsigned int uintptr_t;
#define SDL_HAPTIC_XINPUT 1
/* Enable the sensor driver */
+#ifdef HAVE_SENSORSAPI_H
#define SDL_SENSOR_WINDOWS 1
+#else
+#define SDL_SENSOR_DUMMY 1
+#endif
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
@@ -300,11 +318,6 @@ typedef unsigned int uintptr_t;
/* Enable filesystem support */
#define SDL_FILESYSTEM_WINDOWS 1
-/* Enable assembly routines (Win64 doesn't have inline asm) */
-#ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES 1
-#endif
-
#endif /* SDL_config_windows_h_ */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/Windows/SDL2/include/SDL_endian.h b/Windows/SDL2/include/SDL_endian.h
index 2866f4be..e1c6b5ef 100644
--- a/Windows/SDL2/include/SDL_endian.h
+++ b/Windows/SDL2/include/SDL_endian.h
@@ -87,6 +87,28 @@ _m_prefetch(void *__P)
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */
+#ifndef SDL_FLOATWORDORDER /* Not defined in SDL_config.h? */
+/* predefs from newer gcc versions: */
+#if defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__)
+#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
+#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
+#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
+#else
+#error Unsupported endianness
+#endif /**/
+#elif defined(__MAVERICK__)
+/* For Maverick, float words are always little-endian. */
+#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
+#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__)
+/* For FPA, float words are always big-endian. */
+#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
+#else
+/* By default, assume that floats words follow the memory system mode. */
+#define SDL_FLOATWORDORDER SDL_BYTEORDER
+#endif /* __FLOAT_WORD_ORDER__ */
+#endif /* !SDL_FLOATWORDORDER */
+
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
diff --git a/Windows/SDL2/include/SDL_rect.h b/Windows/SDL2/include/SDL_rect.h
index b678c7a3..6c641c58 100644
--- a/Windows/SDL2/include/SDL_rect.h
+++ b/Windows/SDL2/include/SDL_rect.h
@@ -252,10 +252,10 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r)
SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon)
{
return (a && b && ((a == b) ||
- ((SDL_fabs(a->x - b->x) <= epsilon) &&
- (SDL_fabs(a->y - b->y) <= epsilon) &&
- (SDL_fabs(a->w - b->w) <= epsilon) &&
- (SDL_fabs(a->h - b->h) <= epsilon))))
+ ((SDL_fabsf(a->x - b->x) <= epsilon) &&
+ (SDL_fabsf(a->y - b->y) <= epsilon) &&
+ (SDL_fabsf(a->w - b->w) <= epsilon) &&
+ (SDL_fabsf(a->h - b->h) <= epsilon))))
? SDL_TRUE : SDL_FALSE;
}
diff --git a/Windows/SDL2/include/SDL_revision.h b/Windows/SDL2/include/SDL_revision.h
index db133803..b981c094 100644
--- a/Windows/SDL2/include/SDL_revision.h
+++ b/Windows/SDL2/include/SDL_revision.h
@@ -1,2 +1,2 @@
-#define SDL_REVISION "https://github.com/libsdl-org/SDL.git@981e1e3c4489add5bf6d4df5415af3cf1ef2773d"
+#define SDL_REVISION "@1594e60f8c154d3c8cea175fe88694e5aaf5e7bc"
#define SDL_REVISION_NUMBER 0
diff --git a/Windows/SDL2/include/SDL_stdinc.h b/Windows/SDL2/include/SDL_stdinc.h
index 449e6445..741094c8 100644
--- a/Windows/SDL2/include/SDL_stdinc.h
+++ b/Windows/SDL2/include/SDL_stdinc.h
@@ -462,7 +462,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
-extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
+extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
extern DECLSPEC int SDLCALL SDL_abs(int x);
diff --git a/Windows/SDL2/include/SDL_system.h b/Windows/SDL2/include/SDL_system.h
index 41563add..c540e474 100644
--- a/Windows/SDL2/include/SDL_system.h
+++ b/Windows/SDL2/include/SDL_system.h
@@ -195,7 +195,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
*
* \sa SDL_iPhoneSetEventPump
*/
-extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
+extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
diff --git a/Windows/SDL2/include/SDL_thread.h b/Windows/SDL2/include/SDL_thread.h
index 35e680dd..1e04a4f8 100644
--- a/Windows/SDL2/include/SDL_thread.h
+++ b/Windows/SDL2/include/SDL_thread.h
@@ -129,7 +129,7 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
pfnSDL_CurrentEndThread pfnEndThread);
extern DECLSPEC SDL_Thread *SDLCALL
-SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
+SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn,
const char *name, const size_t stacksize, void *data,
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread);
diff --git a/Windows/SDL2/lib/SDL2.dll b/Windows/SDL2/lib/SDL2.dll
index 4962fd51..984bf724 100644
Binary files a/Windows/SDL2/lib/SDL2.dll and b/Windows/SDL2/lib/SDL2.dll differ
diff --git a/Windows/SDL2/lib/SDL2main.lib b/Windows/SDL2/lib/SDL2main.lib
index ec61b596..53d85a27 100644
Binary files a/Windows/SDL2/lib/SDL2main.lib and b/Windows/SDL2/lib/SDL2main.lib differ
diff --git a/Windows/SDL2/lib/libSDL2main.a b/Windows/SDL2/lib/libSDL2main.a
index a3e07249..8e67e9ed 100644
Binary files a/Windows/SDL2/lib/libSDL2main.a and b/Windows/SDL2/lib/libSDL2main.a differ
diff --git a/Windows/SDL2/lib64/SDL2.dll b/Windows/SDL2/lib64/SDL2.dll
index 51d1c8c0..8a740a96 100644
Binary files a/Windows/SDL2/lib64/SDL2.dll and b/Windows/SDL2/lib64/SDL2.dll differ
diff --git a/Windows/SDL2/lib64/SDL2main.lib b/Windows/SDL2/lib64/SDL2main.lib
index b286cba9..82b4ba15 100644
Binary files a/Windows/SDL2/lib64/SDL2main.lib and b/Windows/SDL2/lib64/SDL2main.lib differ
diff --git a/Windows/SDL2/lib64/libSDL2main.a b/Windows/SDL2/lib64/libSDL2main.a
index ba70ada9..4a1069e4 100644
Binary files a/Windows/SDL2/lib64/libSDL2main.a and b/Windows/SDL2/lib64/libSDL2main.a differ
diff --git a/Windows/SDL2/main/SDL_windows_main.c b/Windows/SDL2/main/SDL_windows_main.c
index 4d71d8f5..d00989c3 100644
--- a/Windows/SDL2/main/SDL_windows_main.c
+++ b/Windows/SDL2/main/SDL_windows_main.c
@@ -70,7 +70,7 @@ main_getcmdline(void)
if (!argv[i]) {
return OutOfMemory();
}
- CopyMemory(argv[i], arg, len);
+ SDL_memcpy(argv[i], arg, len);
SDL_free(arg);
}
argv[i] = NULL;