From 7b82d0e695bb9be7c1825c52df3799835e8b2a81 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 7 Jul 2018 00:34:03 +0100 Subject: [PATCH 01/11] Fix warning relating to max 0 with an unsigned variable I've looked at the code above and can't see anything that would try to lower the value below 0 as it's mostly just addition and dividing --- src/hardware/hw_md2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 8bb4c959..963b6fdb 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1228,13 +1228,13 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, colorbright = (blendcolor.s.red+blendcolor.s.green+blendcolor.s.blue)/3; tempcolor = (finalbright*blendcolor.s.red)/colorbright; - tempcolor = min(255, max(0, tempcolor)); + tempcolor = min(255, tempcolor); cur->s.red = (UINT8)tempcolor; tempcolor = (finalbright*blendcolor.s.green)/colorbright; - tempcolor = min(255, max(0, tempcolor)); + tempcolor = min(255, tempcolor); cur->s.green = (UINT8)tempcolor; tempcolor = (finalbright*blendcolor.s.blue)/colorbright; - tempcolor = min(255, max(0, tempcolor)); + tempcolor = min(255, tempcolor); cur->s.blue = (UINT8)tempcolor; cur->s.alpha = image->s.alpha; } From 7e7f4dc5bc50c0bdc10c616436db29f2f72c76bf Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 6 Jul 2018 19:44:21 -0400 Subject: [PATCH 02/11] F_WaitingPlayersTicker() -> F_WaitingPlayersTicker(void) --- src/f_finale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 3117f6c2..d8e869b2 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1041,7 +1041,7 @@ void F_StartWaitingPlayers(void) } } -void F_WaitingPlayersTicker() +void F_WaitingPlayersTicker(void) { finalecount++; From ba43ed5d48501be6ccb97118a0866d67e266c08c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 6 Jul 2018 21:53:37 -0400 Subject: [PATCH 03/11] Squash a few more errors Updated my compile setup to GCC 6.3, makes it as far as m_misc.c now with ERRORMODE and DEBUGMODE, stops at some gettext related stuff I don't know how to fix now --- src/g_game.c | 7 ++++--- src/k_kart.c | 27 +++++++++++++++------------ src/m_menu.c | 7 ++++--- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 50a90c05..9386681a 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2973,10 +2973,11 @@ void G_ExitLevel(void) boolean G_IsSpecialStage(INT32 mapnum) { #if 0 - if (gametype == GT_COOP && modeattacking != ATTACKING_RECORD && mapnum >= sstage_start && mapnum <= sstage_end) - return true; -#endif + return (gametype == GT_COOP && modeattacking != ATTACKING_RECORD && mapnum >= sstage_start && mapnum <= sstage_end); +#else + (void)mapnum; return false; +#endif } // diff --git a/src/k_kart.c b/src/k_kart.c index 27080423..9348118b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1591,9 +1591,9 @@ void K_SpawnBobombExplosion(mobj_t *source, UINT8 color) mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING); mobj_t *dust; mobj_t *truc; - smoldering->tics = TICRATE*3; INT32 speed, speed2; + smoldering->tics = TICRATE*3; radius = source->radius>>FRACBITS; height = source->height>>FRACBITS; @@ -4892,13 +4892,16 @@ static void K_drawKartMinimapHead(player_t *player, INT32 x, INT32 y, INT32 flag // am xpos & ypos are the icon's starting position. Withouht // it, they wouldn't 'spawn' on the top-right side of the HUD. - fixed_t amnumxpos; - fixed_t amnumypos; - INT32 amxpos; - INT32 amypos; + fixed_t amnumxpos, amnumypos; + INT32 amxpos, amypos; node_t *bsp = &nodes[numnodes-1]; fixed_t maxx, minx, maxy, miny; + + fixed_t mapwidth, mapheight; + fixed_t xoffset, yoffset; + fixed_t xscale, yscale, zoom; + maxx = maxy = INT32_MAX; minx = miny = INT32_MIN; minx = bsp->bbox[0][BOXLEFT]; @@ -4924,16 +4927,16 @@ static void K_drawKartMinimapHead(player_t *player, INT32 x, INT32 y, INT32 flag miny >>= FRACBITS; maxy >>= FRACBITS; - fixed_t mapwidth = maxx - minx; - fixed_t mapheight = maxy - miny; + mapwidth = maxx - minx; + mapheight = maxy - miny; // These should always be small enough to be bitshift back right now - fixed_t xoffset = (minx + mapwidth/2)<width, mapwidth); - fixed_t yscale = FixedDiv(AutomapPic->height, mapheight); - fixed_t zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20); + xscale = FixedDiv(AutomapPic->width, mapwidth); + yscale = FixedDiv(AutomapPic->height, mapheight); + zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20); amnumxpos = (FixedMul(player->mo->x, zoom) - FixedMul(xoffset, zoom)); amnumypos = -(FixedMul(player->mo->y, zoom) - FixedMul(yoffset, zoom)); diff --git a/src/m_menu.c b/src/m_menu.c index 87982310..302910a4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4307,14 +4307,15 @@ static char *M_GetConditionString(condition_t cond) case UC_EXTRAEMBLEM: return va("Get \"%s\" emblem", extraemblems[cond.requirement-1].name); default: - return ""; + return NULL; } } #define NUMCHECKLIST 23 static void M_DrawChecklist(void) { - INT32 i, line = 0, c, lastid; + UINT32 i, line = 0, c; + INT32 lastid; for (i = 0; i < MAXUNLOCKABLES; i++) { @@ -4341,7 +4342,7 @@ static void M_DrawChecklist(void) ++line; - if (cond.id != lastid) + if (lastid == -1 || cond.id != (UINT32)lastid) { V_DrawString(16, (line*8), V_MONOSPACE|V_ALLOWLOWERCASE|(achieved ? V_YELLOWMAP : 0), "*"); V_DrawString(32, (line*8), V_MONOSPACE|V_ALLOWLOWERCASE|(achieved ? V_YELLOWMAP : 0), str); From 97348beb668cc2ffdce1e540e19d898d866a7422 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 7 Jul 2018 16:52:01 +0100 Subject: [PATCH 04/11] Fix all compilation errors (tested using DEBUGMODE=1 and ERRORMODE=1) that remain outstanding. Notably: * Remove FUNCMATH from all void-returning functions, given GCC80 specifically complains about this case. * Extend the length of all extant buffers to the safety threshold recommended by the compiler. * Add void casts to WS_getaddrinfo's setting to prevent complaints about incompatible typecasts. * Extend the charsel, face, and superface buffer sizes and writes to include the null terminator. (I didn't really want to do this because it's not even particularily NEEDED, but there was literally zero way to get around the request that I could find with multiple online searches. I tried.) --- src/d_clisrv.c | 6 +++--- src/d_main.h | 2 +- src/d_netcmd.c | 2 +- src/dehacked.c | 7 ++++--- src/f_finale.h | 2 +- src/hu_stuff.h | 2 +- src/i_addrinfo.c | 4 ++-- src/m_menu.c | 2 +- src/p_mobj.h | 2 +- src/r_plane.h | 2 +- src/r_splats.h | 2 +- src/r_things.c | 16 ++++++++-------- src/r_things.h | 2 +- src/screen.c | 2 +- src/sdl/i_cdmus.c | 14 +++++++------- src/sdl/i_system.c | 16 ++++++++-------- src/sdl/mixer_sound.c | 6 +++--- src/st_stuff.h | 2 +- 18 files changed, 46 insertions(+), 45 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 81ffc76c..646512e5 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1559,7 +1559,7 @@ static void SV_SavedGame(void) { size_t length; UINT8 *savebuffer; - XBOXSTATIC char tmpsave[256]; + XBOXSTATIC char tmpsave[264]; if (!cv_dumpconsistency.value) return; @@ -1601,7 +1601,7 @@ static void CL_LoadReceivedSavegame(void) { UINT8 *savebuffer = NULL; size_t length, decompressedlen; - XBOXSTATIC char tmpsave[256]; + XBOXSTATIC char tmpsave[264]; sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home); @@ -2062,7 +2062,7 @@ static void CL_ConnectToServer(boolean viams) tic_t asksent; #endif #ifdef JOININGAME - XBOXSTATIC char tmpsave[256]; + XBOXSTATIC char tmpsave[264]; sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home); #endif diff --git a/src/d_main.h b/src/d_main.h index 6dc273b1..88387a57 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -41,7 +41,7 @@ void D_SRB2Main(void); // Called by IO functions when input is detected. void D_PostEvent(const event_t *ev); #ifndef DOXYGEN -FUNCMATH void D_PostEvent_end(void); // delimiter for locking memory +void D_PostEvent_end(void); // delimiter for locking memory #endif void D_ProcessEvents(void); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 2f2657d7..432ddea5 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3879,7 +3879,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) if (ncs != FS_FOUND || toomany) { - char message[256]; + char message[275]; if (toomany) sprintf(message, M_GetText("Too many files loaded to add %s\n"), filename); diff --git a/src/dehacked.c b/src/dehacked.c index 878dbb49..ffd572a4 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3081,10 +3081,11 @@ static void readmaincfg(MYFILE *f) // Also save a time attack folder filenamelen = strlen(gamedatafilename)-4; // Strip off the extension - strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder))); + filenamelen = min(filenamelen, sizeof (timeattackfolder)); + strncpy(timeattackfolder, gamedatafilename, filenamelen); timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0'; - strncpy(savegamename, timeattackfolder, sizeof (timeattackfolder)); + strncpy(savegamename, timeattackfolder, filenamelen); strlcat(savegamename, "%u.ssg", sizeof(savegamename)); // can't use sprintf since there is %u in savegamename strcatbf(savegamename, srb2home, PATHSEP); @@ -8494,7 +8495,7 @@ fixed_t get_number(const char *word) #endif } -void FUNCMATH DEH_Check(void) +void DEH_Check(void) { #if defined(_DEBUG) || defined(PARANOIA) const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*); diff --git a/src/f_finale.h b/src/f_finale.h index 4e16e0ed..933ef379 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -35,7 +35,7 @@ void F_CutsceneTicker(void); void F_TitleDemoTicker(void); // Called by main loop. -FUNCMATH void F_GameEndDrawer(void); +void F_GameEndDrawer(void); void F_IntroDrawer(void); void F_TitleScreenDrawer(void); diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 451cc8d8..08d69b8d 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -95,7 +95,7 @@ void HU_Init(void); void HU_LoadGraphics(void); // reset heads up when consoleplayer respawns. -FUNCMATH void HU_Start(void); +void HU_Start(void); boolean HU_Responder(event_t *ev); diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c index eb29e360..4dafd8f8 100644 --- a/src/i_addrinfo.c +++ b/src/i_addrinfo.c @@ -86,10 +86,10 @@ static HMODULE WS_getfunctions(HMODULE tmp) { if (tmp != NULL) { - WS_getaddrinfo = (p_getaddrinfo)GetProcAddress(tmp, "getaddrinfo"); + WS_getaddrinfo = (p_getaddrinfo)((void *)GetProcAddress(tmp, "getaddrinfo")); if (WS_getaddrinfo == NULL) return NULL; - WS_freeaddrinfo = (p_freeaddrinfo)GetProcAddress(tmp, "freeaddrinfo"); + WS_freeaddrinfo = (p_freeaddrinfo)((void *)GetProcAddress(tmp, "freeaddrinfo")); if (WS_freeaddrinfo == NULL) { WS_getaddrinfo = NULL; diff --git a/src/m_menu.c b/src/m_menu.c index 302910a4..f068c6a0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1920,7 +1920,7 @@ static INT32 M_GetFirstLevelInList(void); static void Nextmap_OnChange(void) { char *leveltitle; - char tabase[256]; + char tabase[329]; short i; UINT8 active; lumpnum_t l; diff --git a/src/p_mobj.h b/src/p_mobj.h index 919a3d58..0efda5cc 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -450,7 +450,7 @@ boolean P_SupermanLook4Players(mobj_t *actor); void P_DestroyRobots(void); void P_SnowThinker(precipmobj_t *mobj); void P_RainThinker(precipmobj_t *mobj); -FUNCMATH void P_NullPrecipThinker(precipmobj_t *mobj); +void P_NullPrecipThinker(precipmobj_t *mobj); void P_RemovePrecipMobj(precipmobj_t *mobj); void P_SetScale(mobj_t *mobj, fixed_t newscale); void P_XYMovement(mobj_t *mo); diff --git a/src/r_plane.h b/src/r_plane.h index 16c8c12a..dff58669 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -87,7 +87,7 @@ extern lighttable_t **planezlight; extern fixed_t *yslope; extern fixed_t distscale[MAXVIDWIDTH]; -FUNCMATH void R_InitPlanes(void); +void R_InitPlanes(void); void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale); void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale); void R_ClearPlanes(void); diff --git a/src/r_splats.h b/src/r_splats.h index c0ba6881..24cfcd13 100644 --- a/src/r_splats.h +++ b/src/r_splats.h @@ -64,7 +64,7 @@ fixed_t P_SegLength(seg_t *seg); // call at P_SetupLevel() #if !(defined (WALLSPLATS) || defined (FLOORSPLATS)) -FUNCMATH void R_ClearLevelSplats(void); +void R_ClearLevelSplats(void); #else void R_ClearLevelSplats(void); #endif diff --git a/src/r_things.c b/src/r_things.c index 7309f452..1efe6495 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2502,9 +2502,9 @@ static void Sk_SetDefaultValue(skin_t *skin) strcpy(skin->realname, "Someone"); strcpy(skin->hudname, "???"); - strncpy(skin->charsel, "CHRSONIC", 8); - strncpy(skin->face, "MISSING", 8); - strncpy(skin->superface, "MISSING", 8); + strncpy(skin->charsel, "CHRSONIC", 9); + strncpy(skin->face, "MISSING", 9); + strncpy(skin->superface, "MISSING", 9); skin->starttranscolor = 160; skin->prefcolor = SKINCOLOR_GREEN; @@ -2536,7 +2536,7 @@ static void Sk_SetDefaultValue(skin_t *skin) for (i = 0; i < sfx_skinsoundslot0; i++) if (S_sfx[i].skinsound != -1) skin->soundsid[S_sfx[i].skinsound] = i; - strncpy(skin->iconprefix, "SONICICN", 8); + strncpy(skin->iconprefix, "SONICICN", 9); } // @@ -2569,9 +2569,9 @@ void R_InitSkins(void) strcpy(skin->realname, "Sonic"); strcpy(skin->hudname, "SONIC"); - strncpy(skin->charsel, "CHRSONIC", 8); - strncpy(skin->face, "LIVSONIC", 8); - strncpy(skin->superface, "LIVSUPER", 8); + strncpy(skin->charsel, "CHRSONIC", 9); + strncpy(skin->face, "LIVSONIC", 9); + strncpy(skin->superface, "LIVSUPER", 9); skin->prefcolor = SKINCOLOR_BLUE; skin->ability = CA_THOK; @@ -2591,7 +2591,7 @@ void R_InitSkins(void) skin->spritedef.numframes = sprites[SPR_PLAY].numframes; skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes; ST_LoadFaceGraphics(skin->face, skin->superface, 0); - strncpy(skin->iconprefix, "SONICICN", 8); + strncpy(skin->iconprefix, "SONICICN", 9); K_LoadIconGraphics(skin->iconprefix, 0); //MD2 for sonic doesn't want to load in Linux. diff --git a/src/r_things.h b/src/r_things.h index c7d4989c..b39c5374 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -81,7 +81,7 @@ typedef struct char realname[SKINNAMESIZE+1]; // Display name for level completion. char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long) - char charsel[8], face[8], superface[8]; // Arbitrarily named patch lumps + char charsel[9], face[9], superface[9]; // Arbitrarily named patch lumps UINT8 ability; // ability definition UINT8 ability2; // secondary ability definition diff --git a/src/screen.c b/src/screen.c index 2780edb6..61ac821f 100644 --- a/src/screen.c +++ b/src/screen.c @@ -71,7 +71,7 @@ consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NUL consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #ifdef DIRECTFULLSCREEN -static FUNCMATH void SCR_ChangeFullscreen (void); +static void SCR_ChangeFullscreen (void); #else static void SCR_ChangeFullscreen (void); #endif diff --git a/src/sdl/i_cdmus.c b/src/sdl/i_cdmus.c index 3105f512..5d086e73 100644 --- a/src/sdl/i_cdmus.c +++ b/src/sdl/i_cdmus.c @@ -12,19 +12,19 @@ consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NUL consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; -FUNCMATH void I_InitCD(void){} +void I_InitCD(void){} -FUNCMATH void I_StopCD(void){} +void I_StopCD(void){} -FUNCMATH void I_PauseCD(void){} +void I_PauseCD(void){} -FUNCMATH void I_ResumeCD(void){} +void I_ResumeCD(void){} -FUNCMATH void I_ShutdownCD(void){} +void I_ShutdownCD(void){} -FUNCMATH void I_UpdateCD(void){} +void I_UpdateCD(void){} -FUNCMATH void I_PlayCD(UINT8 track, UINT8 looping) +void I_PlayCD(UINT8 track, UINT8 looping) { (void)track; (void)looping; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 3575afa8..05371282 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2552,28 +2552,28 @@ void I_StartupMouse2(void) // // I_Tactile // -FUNCMATH void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect) +void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect) { // UNUSED. (void)pFFType; (void)FFEffect; } -FUNCMATH void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect) +void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect) { // UNUSED. (void)pFFType; (void)FFEffect; } -FUNCMATH void I_Tactile3(FFType pFFType, const JoyFF_t *FFEffect) +void I_Tactile3(FFType pFFType, const JoyFF_t *FFEffect) { // UNUSED. (void)pFFType; (void)FFEffect; } -FUNCMATH void I_Tactile4(FFType pFFType, const JoyFF_t *FFEffect) +void I_Tactile4(FFType pFFType, const JoyFF_t *FFEffect) { // UNUSED. (void)pFFType; @@ -2705,7 +2705,7 @@ tic_t I_GetTime (void) // //I_StartupTimer // -FUNCMATH void I_StartupTimer(void) +void I_StartupTimer(void) { #ifdef _WIN32 // for win2k time bug @@ -2805,11 +2805,11 @@ void I_WaitVBL(INT32 count) SDL_Delay(count); } -FUNCMATH void I_BeginRead(void) +void I_BeginRead(void) { } -FUNCMATH void I_EndRead(void) +void I_EndRead(void) { } @@ -3557,5 +3557,5 @@ const CPUInfoFlags *I_CPUInfo(void) } // note CPUAFFINITY code used to reside here -FUNCMATH void I_RegisterSysCommands(void) {} +void I_RegisterSysCommands(void) {} #endif diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 71832459..3126643c 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -124,7 +124,7 @@ void I_ShutdownSound(void) #endif } -FUNCMATH void I_UpdateSound(void) +void I_UpdateSound(void) { } @@ -462,7 +462,7 @@ static void mix_gme(void *udata, Uint8 *stream, int len) } #endif -FUNCMATH void I_InitMusic(void) +void I_InitMusic(void) { } @@ -767,7 +767,7 @@ boolean I_SetSongTrack(int track) // MIDI Music // -FUNCMATH void I_InitMIDIMusic(void) +void I_InitMIDIMusic(void) { } diff --git a/src/st_stuff.h b/src/st_stuff.h index 63bb89a1..d0528e0a 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -24,7 +24,7 @@ // // Called by main loop. -FUNCMATH void ST_Ticker(void); +void ST_Ticker(void); // Called by main loop. void ST_Drawer(void); From 2e3afaa7f5f4411f884b7851137beda4bab9d24c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 7 Jul 2018 16:38:14 -0400 Subject: [PATCH 05/11] Fix incorrect PRIdS Thanks, Alam! --- src/m_misc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/m_misc.c b/src/m_misc.c index 5727067c..46f5071d 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -56,7 +56,9 @@ typedef off_t off64_t; #endif #endif -#if defined (_WIN32) +#if defined(__MINGW32__) &&(__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3) +#define PRIdS "u" +#elif defined (_WIN32) #define PRIdS "Iu" #elif defined (_PSP) || defined (_arch_dreamcast) || defined (DJGPP) || defined (_WII) || defined (_NDS) || defined (_PS3) #define PRIdS "u" From 85ab4015eb4ae2380603f4b36073ea736d11d79f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 7 Jul 2018 16:38:54 -0400 Subject: [PATCH 06/11] The remaining errors on a GCC 6.3 setup --- src/hardware/hw_main.c | 2 +- src/r_main.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index cd87b722..7996cf32 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -582,7 +582,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is if (nrPlaneVerts < 3) //not even a triangle ? return; - if (nrPlaneVerts > UINT16_MAX) // FIXME: exceeds plVerts size + if ((UINT32)nrPlaneVerts > UINT16_MAX) // FIXME: exceeds plVerts size { CONS_Debug(DBG_RENDER, "polygon size of %d exceeds max value of %d vertices\n", nrPlaneVerts, UINT16_MAX); return; diff --git a/src/r_main.c b/src/r_main.c index c516b87a..49f69af0 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -213,7 +213,6 @@ void SplitScreen_OnChange(void) } else { - INT32 i; secondarydisplayplayer = consoleplayer; thirddisplayplayer = consoleplayer; fourthdisplayplayer = consoleplayer; From 8d056d3ca598421de360764fe3c983ecbc6695f0 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 7 Jul 2018 16:46:32 -0400 Subject: [PATCH 07/11] better parentheses --- src/m_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_misc.c b/src/m_misc.c index 46f5071d..766db72d 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -56,7 +56,7 @@ typedef off_t off64_t; #endif #endif -#if defined(__MINGW32__) &&(__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3) +#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) #define PRIdS "u" #elif defined (_WIN32) #define PRIdS "Iu" From 50f6053ecf00b47f1a29d68be69666d853b188c8 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 7 Jul 2018 22:10:26 +0100 Subject: [PATCH 08/11] 22 needs to be added to these char arrays to account for zone title being a settable string --- src/y_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index cd56b346..3efce983 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -117,7 +117,7 @@ typedef union patch_t *blueflag; patch_t *redflag; // int_ctf uses this struct too. INT32 numplayers; // Number of players being displayed - char levelstring[40]; // holds levelnames up to 32 characters + char levelstring[62]; // holds levelnames up to 32 characters // SRB2kart int increase[MAXPLAYERS]; //how much did the score increase by? int time[MAXPLAYERS]; //Tournament Time @@ -172,7 +172,7 @@ static void Y_UnloadData(void); // Level images typedef struct { - char str[40]; + char str[62]; patch_t *pic; } y_votelvlinfo; From 278fd8745243fa2257a72db859d3b768ea928547 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 7 Jul 2018 17:33:26 -0400 Subject: [PATCH 09/11] Fix Sryder's bool error I don't seem to get this error for some reason, even after upgrading to w64 & GCC 7.2.0, but hopefully this fixes it --- src/d_netcmd.c | 8 ++++---- src/p_setup.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 432ddea5..f3aa3d8a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5209,24 +5209,24 @@ static void Command_ShowTime_f(void) // SRB2Kart: On change messages static void KartFrantic_OnChange(void) { - if (cv_kartfrantic.value != franticitems && gamestate == GS_LEVEL) + if ((boolean)cv_kartfrantic.value != franticitems && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Frantic items will be turned %s next round.\n"), cv_kartfrantic.value ? M_GetText("on") : M_GetText("off")); } static void KartSpeed_OnChange(void) { - if (cv_kartspeed.value != gamespeed && G_RaceGametype() && gamestate == GS_LEVEL) + if ((UINT8)cv_kartspeed.value != gamespeed && G_RaceGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Game speed will be changed to \"%s\" next round.\n"), cv_kartspeed.string); } static void KartMirror_OnChange(void) { - if (cv_kartmirror.value != mirrormode && G_RaceGametype() && gamestate == GS_LEVEL) + if ((boolean)cv_kartmirror.value != mirrormode && G_RaceGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Mirror Mode will be turned %s next round.\n"), cv_kartmirror.value ? M_GetText("on") : M_GetText("off")); } static void KartComeback_OnChange(void) { - if (cv_kartcomeback.value != comeback && G_BattleGametype() && gamestate == GS_LEVEL) + if ((boolean)cv_kartcomeback.value != comeback && G_BattleGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Karma Comeback will be turned %s next round.\n"), cv_kartcomeback.value ? M_GetText("on") : M_GetText("off")); } \ No newline at end of file diff --git a/src/p_setup.c b/src/p_setup.c index bc29cc6c..7e051bb2 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2992,15 +2992,15 @@ boolean P_SetupLevel(boolean skipprecip) if (G_BattleGametype()) gamespeed = 0; else - gamespeed = cv_kartspeed.value; + gamespeed = (UINT8)cv_kartspeed.value; if (G_BattleGametype()) mirrormode = false; else - mirrormode = cv_kartmirror.value; + mirrormode = (boolean)cv_kartmirror.value; - franticitems = cv_kartfrantic.value; - comeback = cv_kartcomeback.value; + franticitems = (boolean)cv_kartfrantic.value; + comeback = (boolean)cv_kartcomeback.value; } lightningcooldown = 0; From cd898707d78fd8b8800edea37ee16dd2efee5a58 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 7 Jul 2018 23:49:34 +0100 Subject: [PATCH 10/11] Silly fixes to absurd compiler warnings Thanks toaster --- src/k_kart.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 9348118b..e80772f2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3815,12 +3815,15 @@ void K_LoadKartHUDGraphics(void) kp_lakitulaps[16] = W_CachePatchName("K_LAKIF8", PU_HUDGFX); // Position numbers + sprintf(buffer, "K_POSNxx"); for (i = 0; i < NUMPOSNUMS; i++) { + buffer[6] = '0'+i; for (j = 0; j < NUMPOSFRAMES; j++) { - //if (i > 4 && j < 4 && j != 0) continue; // We don't need blue numbers for ranks past 4th - sprintf(buffer, "K_POSN%d%d", i, j); + //if (i > 4 && j < 4 && j != 0) continue; // We don't need blue numbers for ranks past 4th + //sprintf(buffer, "K_POSN%d%d", i, j); + buffer[7] = '0'+j; kp_positionnum[i][j] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } } From 2c7082a475bd94055b6c87818f177b4f167aa0da Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 8 Jul 2018 15:44:01 -0400 Subject: [PATCH 11/11] Internal sky improvement ports Horizon lines, barrel sky distortion --- src/r_plane.c | 1 + src/r_segs.c | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index 3ec97efb..92e0cacb 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -714,6 +714,7 @@ void R_DrawPlanes(void) if (dc_yl <= dc_yh) { angle = (pl->viewangle + xtoviewangle[x])>>ANGLETOSKYSHIFT; + dc_iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT)); dc_x = x; dc_source = R_GetColumn(skytexture, diff --git a/src/r_segs.c b/src/r_segs.c index b997c2a8..025c920c 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2674,22 +2674,28 @@ void R_StoreWallRange(INT32 start, INT32 stop) worldbottomslope >>= 4; #endif - topstep = -FixedMul (rw_scalestep, worldtop); - topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale); + if (linedef->special == 41) { // HORIZON LINES + topstep = bottomstep = 0; + topfrac = bottomfrac = (centeryfrac>>4); + topfrac++; // Prevent 1px HOM + } else { + topstep = -FixedMul (rw_scalestep, worldtop); + topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale); - bottomstep = -FixedMul (rw_scalestep,worldbottom); - bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale); + bottomstep = -FixedMul (rw_scalestep,worldbottom); + bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale); #ifdef ESLOPE - if (frontsector->c_slope) { - fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2); - topstep = (topfracend-topfrac)/(range); - } - if (frontsector->f_slope) { - fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2); - bottomstep = (bottomfracend-bottomfrac)/(range); - } + if (frontsector->c_slope) { + fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2); + topstep = (topfracend-topfrac)/(range); + } + if (frontsector->f_slope) { + fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2); + bottomstep = (bottomfracend-bottomfrac)/(range); + } #endif + } dc_numlights = 0;