From 5daaef7e87648d4a537930774867a202b427f2ae Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 22 Aug 2020 18:38:20 -0700 Subject: [PATCH 01/14] Avoid underflow hacks completely with asktime --- src/d_clisrv.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c847f0a6..829c37d2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2270,10 +2270,10 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent) } // Ask the info to the server (askinfo packet) - if ((I_GetTime() - NEWTICRATE) >= *asksent) + if (I_GetTime() >= *asksent) { SendAskInfo(servernode); - *asksent = I_GetTime(); + *asksent = I_GetTime() + NEWTICRATE; } #else (void)viams; @@ -2314,12 +2314,12 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic case CL_ASKFULLFILELIST: if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved cl_mode = CL_CHECKFILES; - else if (fileneedednum != cl_lastcheckedfilecount || (I_GetTime() - NEWTICRATE) >= *asksent) + else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent) { if (CL_AskFileList(fileneedednum)) { cl_lastcheckedfilecount = fileneedednum; - *asksent = I_GetTime(); + *asksent = I_GetTime() + NEWTICRATE; } } break; @@ -2387,7 +2387,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic case CL_LOADFILES: if (CL_LoadServerFiles()) { - *asksent = I_GetTime() - (NEWTICRATE*3); //This ensure the first join ask is right away + *asksent = 0; //This ensure the first join ask is right away firstconnectattempttime = I_GetTime(); cl_mode = CL_ASKJOIN; } @@ -2414,14 +2414,14 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic // but since the network layer doesn't provide ordered packets... CL_PrepareDownloadSaveGame(tmpsave); #endif - if (( I_GetTime() - NEWTICRATE*3 ) >= *asksent && CL_SendJoin()) + if (I_GetTime() >= *asksent && CL_SendJoin()) { - *asksent = I_GetTime(); + *asksent = I_GetTime() + NEWTICRATE*3; cl_mode = CL_WAITJOINRESPONSE; } break; case CL_WAITJOINRESPONSE: - if (( I_GetTime() - NEWTICRATE*3 ) >= *asksent) + if (I_GetTime() >= *asksent) { cl_mode = CL_ASKJOIN; } @@ -2555,9 +2555,9 @@ static void CL_ConnectToServer(void) ClearAdminPlayers(); pnumnodes = 1; - oldtic = I_GetTime() - 1; + oldtic = 0; #ifndef NONET - asksent = I_GetTime() - NEWTICRATE*3; + asksent = 0; firstconnectattempttime = I_GetTime(); i = SL_SearchServer(servernode); From 509c57a8d654d00e6c3b51873a674056dd9e442b Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 24 Aug 2020 00:56:53 -0400 Subject: [PATCH 02/14] Haha NONET... --- src/d_clisrv.c | 7 ++++++- src/d_netfil.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c847f0a6..21b8e86c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2038,6 +2038,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room) #endif // ifndef NONET +#ifndef NONET static void M_ConfirmConnect(event_t *ev) { if (ev->type == ev_keydown) @@ -2072,6 +2073,7 @@ static void M_ConfirmConnect(event_t *ev) } } } +#endif static boolean CL_FinishedFileList(void) { @@ -2157,10 +2159,12 @@ static boolean CL_FinishedFileList(void) if (!curl_failedwebdownload) #endif { +#ifndef NONET downloadcompletednum = 0; downloadcompletedsize = 0; totalfilesrequestednum = 0; totalfilesrequestedsize = 0; +#endif for (i = 0; i < fileneedednum; i++) if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD) @@ -2276,7 +2280,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; @@ -2993,8 +2996,10 @@ void CL_Reset(void) fileneedednum = 0; memset(fileneeded, 0, sizeof(fileneeded)); +#ifndef NONET totalfilesrequestednum = 0; totalfilesrequestedsize = 0; +#endif firstconnectattempttime = 0; serverisfull = false; connectiontimeout = (tic_t)cv_nettimeout.value; //reset this temporary hack diff --git a/src/d_netfil.c b/src/d_netfil.c index 621ce295..c9bfb4ea 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -874,8 +874,10 @@ void Got_Filetxpak(void) file->status = FS_FOUND; CONS_Printf(M_GetText("Downloading %s...(done)\n"), filename); +#ifndef NONET downloadcompletednum++; downloadcompletedsize += file->totalsize; +#endif } } else From d4006d00c3b03e83085c5d063d8a5659b1b8d4cc Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 24 Aug 2020 00:58:14 -0400 Subject: [PATCH 03/14] Screw you C90 --- src/mserv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mserv.c b/src/mserv.c index 4c044fed..e0506719 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -58,7 +58,7 @@ 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}; From 84bab3fc9f88d618220178209d19a6c1ce794302 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 24 Aug 2020 01:00:28 -0400 Subject: [PATCH 04/14] Turns out compiling with the internal version of curl was broken on CMake the entire time :upside_down_face: --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9dd7f500..18c3a34f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -398,7 +398,7 @@ endif() if(${SRB2_CONFIG_HAVE_CURL}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) set(CURL_FOUND ON) - set(CURL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/curl) + set(CURL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/curl/include) if(${SRB2_SYSTEM_BITS} EQUAL 64) set(CURL_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/curl/lib64 -lcurl") else() # 32-bit From 04b7051141103e5d296368ca8544c751dd4c841c Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 24 Aug 2020 01:06:10 -0400 Subject: [PATCH 05/14] This is just stupid --- src/d_clisrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 21b8e86c..581b6d2d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2164,7 +2164,6 @@ static boolean CL_FinishedFileList(void) downloadcompletedsize = 0; totalfilesrequestednum = 0; totalfilesrequestedsize = 0; -#endif for (i = 0; i < fileneedednum; i++) if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD) @@ -2194,9 +2193,11 @@ static boolean CL_FinishedFileList(void) "Press ACCEL to continue or BRAKE to cancel.\n\n" ), downloadsize), M_ConfirmConnect, MM_EVENTHANDLER); + Z_Free(downloadsize); cl_mode = CL_CONFIRMCONNECT; } +#endif #ifdef HAVE_CURL else { From 87d2ad0c236fd0fa4a43e6b2d4ecbdc65eb0701e Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 24 Aug 2020 01:13:59 -0400 Subject: [PATCH 06/14] Remind me why NONET exists? --- src/d_clisrv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 581b6d2d..4364051d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2038,9 +2038,9 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room) #endif // ifndef NONET -#ifndef NONET static void M_ConfirmConnect(event_t *ev) { +#ifndef NONET if (ev->type == ev_keydown) { if (ev->data1 == ' ' || ev->data1 == 'y' || ev->data1 == KEY_ENTER || ev->data1 == gamecontrol[gc_accelerate][0] || ev->data1 == gamecontrol[gc_accelerate][1]) @@ -2072,8 +2072,8 @@ static void M_ConfirmConnect(event_t *ev) M_ClearMenus(true); } } -} #endif +} static boolean CL_FinishedFileList(void) { @@ -2164,12 +2164,15 @@ static boolean CL_FinishedFileList(void) downloadcompletedsize = 0; totalfilesrequestednum = 0; totalfilesrequestedsize = 0; +#endif for (i = 0; i < fileneedednum; i++) if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD) { +#ifndef NONET totalfilesrequestednum++; totalfilesrequestedsize += fileneeded[i].totalsize; +#endif } if (totalfilesrequestedsize>>20 >= 100) @@ -2193,11 +2196,9 @@ static boolean CL_FinishedFileList(void) "Press ACCEL to continue or BRAKE to cancel.\n\n" ), downloadsize), M_ConfirmConnect, MM_EVENTHANDLER); - Z_Free(downloadsize); cl_mode = CL_CONFIRMCONNECT; } -#endif #ifdef HAVE_CURL else { From 41c742a699409d20a2e9683552ad110518d81cfa Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 24 Aug 2020 01:18:38 -0400 Subject: [PATCH 07/14] Hopefully the last time... --- src/d_clisrv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4364051d..0842a65c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2072,6 +2072,8 @@ static void M_ConfirmConnect(event_t *ev) M_ClearMenus(true); } } +#else + (void)ev; #endif } @@ -2175,10 +2177,12 @@ static boolean CL_FinishedFileList(void) #endif } +#ifndef NONET if (totalfilesrequestedsize>>20 >= 100) downloadsize = Z_StrDup(va("%uM",totalfilesrequestedsize>>20)); else downloadsize = Z_StrDup(va("%uK",totalfilesrequestedsize>>10)); +#endif if (serverisfull) M_StartMessage(va(M_GetText( From c6164a1947e2dd9fe69f4d7ca6917b21b68c4f13 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 24 Aug 2020 01:25:34 -0400 Subject: [PATCH 08/14] Initialize this variable --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 0842a65c..fd6fbda3 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2080,7 +2080,7 @@ static void M_ConfirmConnect(event_t *ev) static boolean CL_FinishedFileList(void) { INT32 i; - char *downloadsize; + char *downloadsize = NULL; //CONS_Printf(M_GetText("Checking files...\n")); i = CL_CheckFiles(); if (i == 4) // still checking ... From 0d57ba1d02c5bde2ab22a71d21a95849b21e9539 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 24 Aug 2020 17:51:01 -0700 Subject: [PATCH 09/14] Fix NOGME compiling --- src/sdl/mixer_sound.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 86fc8efb..c5650192 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -110,6 +110,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) @@ -130,6 +131,7 @@ static const char* get_zlib_error(int zErr) return "unknown error"; } } +#endif /// ------------------------ /// Audio System From fbde926497d5c6da5872525214f501dfb450a1cd Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 24 Aug 2020 17:52:55 -0700 Subject: [PATCH 10/14] Fix NOPNG compiling --- src/w_wad.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 77d0d6d2..d4da027b 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -11,6 +11,24 @@ /// \file w_wad.c /// \brief Handles WAD file header, directory, lump I/O +#ifdef HAVE_ZLIB +#ifndef _MSC_VER +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif +#endif + +#ifndef _LFS64_LARGEFILE +#define _LFS64_LARGEFILE +#endif + +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 0 +#endif + +#include "zlib.h" +#endif + #ifdef __GNUC__ #include #endif @@ -66,24 +84,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #define O_BINARY 0 #endif -#ifdef HAVE_ZLIB -#ifndef _MSC_VER -#ifndef _LARGEFILE64_SOURCE -#define _LARGEFILE64_SOURCE -#endif -#endif - -#ifndef _LFS64_LARGEFILE -#define _LFS64_LARGEFILE -#endif - -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 0 -#endif - -#include "zlib.h" -#endif - typedef struct { From 16fc87edcf2be81c4ae0d1bdeb337e3a38a785f8 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 24 Aug 2020 17:55:42 -0700 Subject: [PATCH 11/14] Fix NOMIXER compiling --- src/sdl/sdl_sound.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 4bb1b567..929ac79f 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -1434,6 +1434,8 @@ static void I_ResumeGME(void) boolean I_LoadSong(char *data, size_t len) { + (void)data; + (void)len; return false; } @@ -1495,6 +1497,7 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms (void)target_volume; (void)source_volume; (void)ms; + (void)callback; return false; } @@ -1502,6 +1505,7 @@ boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void)) { (void)target_volume; (void)ms; + (void)callback; return false; } From 3437b0690a3f4278e3ecc657102a126a3e2f3d13 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 24 Aug 2020 17:58:39 -0700 Subject: [PATCH 12/14] Kill NOHS --- src/Makefile | 24 ------------------------ src/doomdef.h | 6 ------ src/sdl/Makefile.cfg | 22 ---------------------- 3 files changed, 52 deletions(-) diff --git a/src/Makefile b/src/Makefile index dd678cb2..b417a38e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -63,7 +63,6 @@ # Compile with extra warnings, add 'WARNINGMODE=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' @@ -136,7 +135,6 @@ NOPNG=1 NOZLIB=1 NONET=1 NOHW=1 -NOHS=1 NOASM=1 NOIPX=1 EXENAME?=srb2dummy @@ -167,7 +165,6 @@ endif ifdef PANDORA NONX86=1 NOHW=1 -NOHS=1 endif ifdef WII @@ -217,7 +214,6 @@ NOPNG=1 NOZLIB=1 NONET=1 #NOHW=1 -NOHS=1 NOASM=1 NOIPX=1 NONX86=1 @@ -287,13 +283,6 @@ endif $(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o endif -ifdef NOHS - OPTS+=-DNOHS -else - OPTS+=-DHW3SOUND - OBJS+=$(OBJDIR)/hw3sound.o -endif - OPTS += -DCOMPVERSION ifndef NONX86 @@ -942,19 +931,6 @@ $(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.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/doomdef.h b/src/doomdef.h index 1965b3d0..be4557b1 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -30,7 +30,6 @@ #ifdef HAVE_MIXER //#if !defined(DC) && !defined(_WIN32_WCE) && !defined(_XBOX) && !defined(GP2X) #define SOUND SOUND_MIXER - #define NOHS // No HW3SOUND #ifdef HW3SOUND #undef HW3SOUND #endif @@ -47,7 +46,6 @@ // Use FMOD? #ifdef HAVE_FMOD #define SOUND SOUND_FMOD - #define NOHS // No HW3SOUND #ifdef HW3SOUND #undef HW3SOUND #endif @@ -64,10 +62,6 @@ #if !defined (HWRENDER) && !defined (NOHW) #define HWRENDER #endif -// judgecutor: 3D sound support -#if !defined(HW3SOUND) && !defined (NOHS) -#define HW3SOUND -#endif #endif #if defined (_WIN32) || defined (_WIN32_WCE) diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg index b0c591ce..1744d691 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 From 04d774c76515a76f548c58929502484d02bfd2fc Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 24 Aug 2020 18:06:00 -0700 Subject: [PATCH 13/14] Fix NOHW compiling --- src/p_setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index f9e23a5e..301ba384 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1401,8 +1401,6 @@ static void P_LoadRawSideDefs2(void *data) { UINT16 i; INT32 num; - size_t j; - RGBA_t color; for (i = 0; i < numsides; i++) { @@ -1469,6 +1467,8 @@ static void P_LoadRawSideDefs2(void *data) || (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6])) { char *col; + RGBA_t color; + size_t j; sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture, msd->bottomtexture); From 27b72ccbf57943fe7fde39277c3056e2a39e281e Mon Sep 17 00:00:00 2001 From: ThatAwesomeGuy173 Date: Tue, 25 Aug 2020 23:12:31 -0600 Subject: [PATCH 14/14] Replace 'ignoring skin' debug print with a proper console warning --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index 25c4edb3..9cb35e19 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2746,7 +2746,7 @@ void R_AddSkins(UINT16 wadnum) if (numskins >= MAXSKINS) { - CONS_Debug(DBG_RENDER, "ignored skin (%d skins maximum)\n", MAXSKINS); + CONS_Alert(CONS_WARNING, M_GetText("Unable to add skin, too many characters are loaded (%d maximum)\n"), MAXSKINS); continue; // so we know how many skins couldn't be added } buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);