diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8ecee2b19..67a3b66b7 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -43,7 +43,7 @@ jobs:
- v1-SRB2-APT
- run:
name: Install SDK
- command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
+ command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libcurl4-openssl-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
- save_cache:
key: v1-SRB2-APT
@@ -71,4 +71,4 @@ jobs:
- save_cache:
key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }}
paths:
- - /root/.ccache
\ No newline at end of file
+ - /root/.ccache
diff --git a/src/Makefile b/src/Makefile
index 0b7a8ea3a..27151cd3e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -56,10 +56,10 @@
# Compile with GCC 4.6x version, add 'GCC46=1'
# Compile a profile version, add 'PROFILEMODE=1'
# Compile a debug version, add 'DEBUGMODE=1'
-# Compile with extra warnings, add 'WARNINGMODE=1'
+# Compile with less warnings, add 'RELAXWARNINGS=1'
+# Generate compiler errors for most compiler warnings, add 'ERRORMODE=1'
# Compile without NASM's tmap.nas, add 'NOASM=1'
# Compile without 3D hardware support, add 'NOHW=1'
-# Compile without 3D sound support, add 'NOHS=1'
# Compile with GDBstubs, add 'RDB=1'
# Compile without PNG, add 'NOPNG=1'
# Compile without zlib, add 'NOZLIB=1'
@@ -80,6 +80,58 @@
#
#############################################################################
+ALL_SYSTEMS=\
+ PANDORA\
+ LINUX64\
+ MINGW64\
+ HAIKU\
+ DUMMY\
+ DJGPPDOS\
+ MINGW\
+ UNIX\
+ LINUX\
+ SOLARIS\
+ FREEBSD\
+ MACOSX\
+ SDL\
+
+# check for user specified system
+ifeq (,$(filter $(ALL_SYSTEMS),$(.VARIABLES)))
+ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
+
+ $(info Detected a Windows system, compiling for 32-bit MinGW SDL2...)
+
+ # go for a 32-bit sdl mingw exe by default
+ MINGW=1
+ SDL=1
+ WINDOWSHELL=1
+
+else # if you on the *nix
+
+ system:=$(shell uname -s)
+
+ ifeq ($(system),Linux)
+ new_system=LINUX
+ else
+
+ $(error \
+ Could not automatically detect your system,\
+ try specifying a system manually)
+
+ endif
+
+ ifeq ($(shell getconf LONG_BIT),64)
+ system+=64-bit
+ new_system:=$(new_system)64
+ endif
+
+ $(info Detected $(system) ($(new_system))...)
+ $(new_system)=1
+
+endif
+endif
+
+
# SRB2 data files
D_DIR?=../bin/Resources
D_FILES=$(D_DIR)/srb2.pk3 \
@@ -119,7 +171,6 @@ NOPNG=1
NOZLIB=1
NONET=1
NOHW=1
-NOHS=1
NOASM=1
NOIPX=1
EXENAME?=srb2dummy
@@ -141,7 +192,6 @@ endif
ifdef PANDORA
NONX86=1
NOHW=1
-NOHS=1
endif
ifndef NOOPENMPT
@@ -223,13 +273,6 @@ else
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o
endif
-ifdef NOHS
- OPTS+=-DNOHS
-else
- OPTS+=-DHW3SOUND
- OBJS+=$(OBJDIR)/hw3sound.o
-endif
-
OPTS += -DCOMPVERSION
ifndef NONX86
@@ -750,19 +793,6 @@ $(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
endif
-ifndef NOHS
-$(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \
- hardware/hw_dll.h
- $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_ds3d.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_ds3d/s_ds3d.c
-
-$(OBJDIR)/s_fmod.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
- hardware/hw_dll.h
- $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_fmod/s_fmod.c
-
-$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
- hardware/hw_dll.h
- $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_openal/s_openal.c
-endif
endif
endif
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index 019b8c8d4..db7230bb4 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -48,7 +48,9 @@ endif
# Automatically set version flag, but not if one was manually set
ifeq (,$(filter GCC%,$(.VARIABLES)))
- ifneq (,$(findstring gcc,$(shell $(CC) --version))) # if it's GCC
+ version:=$(shell $(CC) --version)
+ # check if this is in fact GCC
+ ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
version:=$(shell $(CC) -dumpversion)
# Turn version into words of major, minor
@@ -208,10 +210,7 @@ WFLAGS=-Wall
ifndef GCC295
#WFLAGS+=-Wno-packed
endif
-ifdef ERRORMODE
-WARNINGMODE=1
-endif
-ifdef WARNINGMODE
+ifndef RELAXWARNINGS
WFLAGS+=-W
#WFLAGS+=-Wno-sign-compare
ifndef GCC295
diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index 8c8dad4cc..9a636dd45 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -2306,7 +2306,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
M_SortServerList();
}
-#ifdef HAVE_THREADS
+#if defined (MASTERSERVER) && defined (HAVE_THREADS)
struct Fetch_servers_ctx
{
int room;
@@ -2351,7 +2351,7 @@ Fetch_servers_thread (struct Fetch_servers_ctx *ctx)
free(ctx);
}
-#endif/*HAVE_THREADS*/
+#endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/
void CL_QueryServerList (msg_server_t *server_list)
{
@@ -2388,9 +2388,8 @@ void CL_QueryServerList (msg_server_t *server_list)
void CL_UpdateServerList(boolean internetsearch, INT32 room)
{
-#ifdef HAVE_THREADS
- struct Fetch_servers_ctx *ctx;
-#endif
+ (void)internetsearch;
+ (void)room;
SL_ClearServerList(0);
@@ -2407,9 +2406,12 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
if (netgame)
SendAskInfo(BROADCASTADDR);
+#ifdef MASTERSERVER
if (internetsearch)
{
#ifdef HAVE_THREADS
+ struct Fetch_servers_ctx *ctx;
+
ctx = malloc(sizeof *ctx);
/* This called from M_Refresh so I don't use a mutex */
@@ -2436,6 +2438,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
}
#endif
}
+#endif/*MASTERSERVER*/
}
#endif // ifndef NONET
@@ -2563,7 +2566,6 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
*asksent = I_GetTime();
}
#else
- (void)viams;
(void)asksent;
// No netgames, so we skip this state.
cl_mode = CL_ASKJOIN;
@@ -3840,8 +3842,10 @@ void D_QuitNetGame(void)
for (i = 0; i < MAXNETNODES; i++)
if (nodeingame[i])
HSendPacket(i, true, 0, 0);
+#ifdef MASTERSERVER
if (serverrunning && ms_RoomId > 0)
UnregisterServer();
+#endif
}
else if (servernode > 0 && servernode < MAXNETNODES && nodeingame[(UINT8)servernode])
{
@@ -4105,8 +4109,10 @@ boolean SV_SpawnServer(void)
if (netgame && I_NetOpenSocket)
{
I_NetOpenSocket();
+#ifdef MASTERSERVER
if (ms_RoomId > 0)
RegisterServer();
+#endif
}
// non dedicated server just connect to itself
@@ -5568,7 +5574,9 @@ void NetUpdate(void)
// client send the command after a receive of the server
// the server send before because in single player is beter
+#ifdef MASTERSERVER
MasterClient_Ticker(); // Acking the Master Server
+#endif
if (client)
{
diff --git a/src/d_main.c b/src/d_main.c
index 77c33e7ba..4a93c852d 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -648,6 +648,7 @@ static void D_Display(void)
V_DrawThinString(80, 40, V_MONOSPACE | V_BLUEMAP, s);
if (rendermode == render_opengl) // OpenGL specific stats
{
+#ifdef HWRENDER
snprintf(s, sizeof s - 1, "nsrt %d", rs_hw_nodesorttime / divisor);
V_DrawThinString(30, 40, V_MONOSPACE | V_YELLOWMAP, s);
snprintf(s, sizeof s - 1, "ndrw %d", rs_hw_nodedrawtime / divisor);
@@ -680,6 +681,7 @@ static void D_Display(void)
snprintf(s, sizeof s - 1, "ncol %d", rs_hw_numcolors);
V_DrawThinString(185, 30, V_MONOSPACE | V_PURPLEMAP, s);
}
+#endif
}
else // software specific stats
{
diff --git a/src/doomdef.h b/src/doomdef.h
index 31dd2bcda..24898bdf6 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -29,7 +29,6 @@
// Use Mixer interface?
#ifdef HAVE_MIXER
#define SOUND SOUND_MIXER
- #define NOHS // No HW3SOUND
#ifdef HW3SOUND
#undef HW3SOUND
#endif
@@ -45,7 +44,6 @@
// Use FMOD?
#ifdef HAVE_FMOD
#define SOUND SOUND_FMOD
- #define NOHS // No HW3SOUND
#ifdef HW3SOUND
#undef HW3SOUND
#endif
@@ -62,10 +60,6 @@
#if !defined (HWRENDER) && !defined (NOHW)
#define HWRENDER
#endif
-// judgecutor: 3D sound support
-#if !defined(HW3SOUND) && !defined (NOHS)
-#define HW3SOUND
-#endif
#endif
#ifdef _WIN32
@@ -644,4 +638,10 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Maintain compatibility with older 2.2 demos
#define OLD22DEMOCOMPAT
+#if defined (HAVE_CURL) && ! defined (NONET)
+#define MASTERSERVER
+#else
+#undef UPDATE_ALERT
+#endif
+
#endif // __DOOMDEF__
diff --git a/src/http-mserv.c b/src/http-mserv.c
index 47c2b5b0f..1e8d35648 100644
--- a/src/http-mserv.c
+++ b/src/http-mserv.c
@@ -14,7 +14,9 @@ Documentation available here.
*/
+#ifdef HAVE_CURL
#include
+#endif
#include "doomdef.h"
#include "d_clisrv.h"
@@ -49,6 +51,8 @@ consvar_t cv_masterserver_token = {
NULL, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
};
+#ifdef MASTERSERVER
+
static int hms_started;
static char *hms_api;
@@ -664,10 +668,14 @@ HMS_set_api (char *api)
#endif
}
+#endif/*MASTERSERVER*/
+
static void
MasterServer_Debug_OnChange (void)
{
+#ifdef MASTERSERVER
/* TODO: change to 'latest-log.txt' for log files revision. */
if (cv_masterserver_debug.value)
CONS_Printf("Master server debug messages will appear in log.txt\n");
+#endif
}
diff --git a/src/m_menu.c b/src/m_menu.c
index b80ace3cb..d09ce6087 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -3842,7 +3842,7 @@ void M_SetupNextMenu(menu_t *menudef)
{
INT16 i;
-#ifdef HAVE_THREADS
+#if defined (MASTERSERVER) && defined (HAVE_THREADS)
if (currentMenu == &MP_RoomDef || currentMenu == &MP_ConnectDef)
{
I_lock_mutex(&ms_QueryId_mutex);
@@ -3930,7 +3930,7 @@ void M_Ticker(void)
if (currentMenu == &OP_ScreenshotOptionsDef)
M_SetupScreenshotMenu();
-#ifdef HAVE_THREADS
+#if defined (MASTERSERVER) && defined (HAVE_THREADS)
I_lock_mutex(&ms_ServerList_mutex);
{
if (ms_ServerList)
@@ -11194,8 +11194,9 @@ static boolean M_CheckMODVersion(int id)
} else
return true;
}
+#endif/*UPDATE_ALERT*/
-#ifdef HAVE_THREADS
+#if defined (MASTERSERVER) && defined (HAVE_THREADS)
static void
Check_new_version_thread (int *id)
{
@@ -11204,7 +11205,9 @@ Check_new_version_thread (int *id)
okay = 0;
+#ifdef UPDATE_ALERT
if (M_CheckMODVersion(*id))
+#endif
{
I_lock_mutex(&ms_QueryId_mutex);
{
@@ -11248,8 +11251,7 @@ Check_new_version_thread (int *id)
free(id);
}
-#endif/*HAVE_THREADS*/
-#endif/*UPDATE_ALERT*/
+#endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/
static void M_ConnectMenu(INT32 choice)
{
@@ -11290,7 +11292,7 @@ UINT32 roomIds[NUM_LIST_ROOMS];
static void M_RoomMenu(INT32 choice)
{
INT32 i;
-#ifdef HAVE_THREADS
+#if defined (MASTERSERVER) && defined (HAVE_THREADS)
int *id;
#endif
@@ -11312,9 +11314,14 @@ static void M_RoomMenu(INT32 choice)
MP_RoomDef.prevMenu = currentMenu;
M_SetupNextMenu(&MP_RoomDef);
-#ifdef UPDATE_ALERT
+#ifdef MASTERSERVER
#ifdef HAVE_THREADS
+#ifdef UPDATE_ALERT
m_waiting_mode = M_WAITING_VERSION;
+#else/*UPDATE_ALERT*/
+ m_waiting_mode = M_WAITING_ROOMS;
+#endif/*UPDATE_ALERT*/
+
MP_RoomMenu[0].text = "";
id = malloc(sizeof *id);
@@ -11328,17 +11335,19 @@ static void M_RoomMenu(INT32 choice)
I_spawn_thread("check-new-version",
(I_thread_fn)Check_new_version_thread, id);
#else/*HAVE_THREADS*/
+#ifdef UPDATE_ALERT
if (M_CheckMODVersion(0))
+#endif/*UPDATE_ALERT*/
{
GetRoomsList(currentMenu->prevMenu == &MP_ServerDef, 0);
}
#endif/*HAVE_THREADS*/
-#endif/*UPDATE_ALERT*/
+#endif/*MASTERSERVER*/
}
static void M_ChooseRoom(INT32 choice)
{
-#ifdef HAVE_THREADS
+#if defined (MASTERSERVER) && defined (HAVE_THREADS)
I_lock_mutex(&ms_QueryId_mutex);
{
ms_QueryId++;
diff --git a/src/mserv.c b/src/mserv.c
index fcce1ab4d..27d479797 100644
--- a/src/mserv.c
+++ b/src/mserv.c
@@ -23,6 +23,8 @@
#include "m_menu.h"
#include "z_zone.h"
+#ifdef MASTERSERVER
+
static int MSId;
static int MSRegisteredId = -1;
@@ -43,17 +45,20 @@ static I_cond MSCond;
# define Unlock_state()
#endif/*HAVE_THREADS*/
-static void Update_parameters (void);
-
#ifndef NONET
static void Command_Listserv_f(void);
#endif
+
+#endif/*MASTERSERVER*/
+
+static void Update_parameters (void);
+
static void MasterServer_OnChange(void);
static CV_PossibleValue_t masterserver_update_rate_cons_t[] = {
{2, "MIN"},
{60, "MAX"},
- {0}
+ {0,NULL}
};
consvar_t cv_masterserver = {"masterserver", "https://mb.srb2.org/MS/0", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL};
@@ -63,7 +68,7 @@ consvar_t cv_masterserver_update_rate = {"masterserver_update_rate", "15", CV_SA
INT16 ms_RoomId = -1;
-#ifdef HAVE_THREADS
+#if defined (MASTERSERVER) && defined (HAVE_THREADS)
int ms_QueryId;
I_mutex ms_QueryId_mutex;
@@ -91,10 +96,14 @@ void AddMServCommands(void)
CV_RegisterVar(&cv_masterserver_debug);
CV_RegisterVar(&cv_masterserver_token);
CV_RegisterVar(&cv_servername);
+#ifdef MASTERSERVER
COM_AddCommand("listserv", Command_Listserv_f);
#endif
+#endif
}
+#ifdef MASTERSERVER
+
static void WarnGUI (void)
{
#ifdef HAVE_THREADS
@@ -395,6 +404,7 @@ Change_masterserver_thread (char *api)
void RegisterServer(void)
{
+#ifdef MASTERSERVER
#ifdef HAVE_THREADS
I_spawn_thread(
"register-server",
@@ -404,6 +414,7 @@ void RegisterServer(void)
#else
Finish_registration();
#endif
+#endif/*MASTERSERVER*/
}
static void UpdateServer(void)
@@ -421,6 +432,7 @@ static void UpdateServer(void)
void UnregisterServer(void)
{
+#ifdef MASTERSERVER
#ifdef HAVE_THREADS
I_spawn_thread(
"unlist-server",
@@ -430,6 +442,7 @@ void UnregisterServer(void)
#else
Finish_unlist();
#endif
+#endif/*MASTERSERVER*/
}
static boolean
@@ -465,9 +478,33 @@ static inline void SendPingToMasterServer(void)
}
}
+void MasterClient_Ticker(void)
+{
+#ifdef MASTERSERVER
+ SendPingToMasterServer();
+#endif
+}
+
+static void
+Set_api (const char *api)
+{
+#ifdef HAVE_THREADS
+ I_spawn_thread(
+ "change-masterserver",
+ (I_thread_fn)Change_masterserver_thread,
+ strdup(api)
+ );
+#else
+ HMS_set_api(strdup(api));
+#endif
+}
+
+#endif/*MASTERSERVER*/
+
static void
Update_parameters (void)
{
+#ifdef MASTERSERVER
int registered;
int delayed;
@@ -487,29 +524,12 @@ Update_parameters (void)
if (! delayed && registered)
UpdateServer();
}
-}
-
-void MasterClient_Ticker(void)
-{
- SendPingToMasterServer();
-}
-
-static void
-Set_api (const char *api)
-{
-#ifdef HAVE_THREADS
- I_spawn_thread(
- "change-masterserver",
- (I_thread_fn)Change_masterserver_thread,
- strdup(api)
- );
-#else
- HMS_set_api(strdup(api));
-#endif
+#endif/*MASTERSERVER*/
}
static void MasterServer_OnChange(void)
{
+#ifdef MASTERSERVER
UnregisterServer();
/*
@@ -527,4 +547,5 @@ static void MasterServer_OnChange(void)
if (Online())
RegisterServer();
+#endif/*MASTERSERVER*/
}
diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg
index 68e616f01..45d0d6ba7 100644
--- a/src/sdl/Makefile.cfg
+++ b/src/sdl/Makefile.cfg
@@ -53,28 +53,6 @@ ifndef NOHW
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
endif
-ifndef NOHS
-ifdef OPENAL
- OBJS+=$(OBJDIR)/s_openal.o
- OPTS+=-DSTATIC3DS
- STATICHS=1
-else
-ifdef FMOD
- OBJS+=$(OBJDIR)/s_fmod.o
- OPTS+=-DSTATIC3DS
- STATICHS=1
-else
-ifdef MINGW
-ifdef DS3D
- OBJS+=$(OBJDIR)/s_ds3d.o
- OPTS+=-DSTATIC3DS
- STATICHS=1
-endif
-endif
-endif
-endif
-endif
-
ifdef NOMIXER
i_sound_o=$(OBJDIR)/sdl_sound.o
else
diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index 01194a02f..5c5b6119c 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -1478,6 +1478,7 @@ static SDL_bool Impl_CreateContext(void)
void VID_CheckGLLoaded(rendermode_t oldrender)
{
+ (void)oldrender;
#ifdef HWRENDER
if (vid_opengl_state == -1) // Well, it didn't work the first time anyway.
{
diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index ef34b266d..25e7fde89 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -220,6 +220,7 @@ static void var_cleanup(void)
internal_volume = 100;
}
+#if defined (HAVE_LIBGME) && defined (HAVE_ZLIB)
static const char* get_zlib_error(int zErr)
{
switch (zErr)
@@ -240,6 +241,7 @@ static const char* get_zlib_error(int zErr)
return "unknown error";
}
}
+#endif
/// ------------------------
/// Audio System