From badbb4324eb3f0b29ba0462753de45f5a9743dd3 Mon Sep 17 00:00:00 2001 From: Sryder Date: Wed, 16 May 2018 21:04:57 +0100 Subject: [PATCH 1/7] Fix FF_FULLBRIGHT not working in sectors with multiple light levels in OpenGL --- src/hardware/hw_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 81021ef7f..b758c828e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4228,6 +4228,9 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) i = 0; temp = FLOAT_TO_FIXED(realtop); + if (spr->mobj->frame & FF_FULLBRIGHT) + lightlevel = 255; + #ifdef ESLOPE for (i = 1; i < sector->numlights; i++) { @@ -4235,14 +4238,16 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) : sector->lightlist[i].height; if (h <= temp) { - lightlevel = *list[i-1].lightlevel; + if (!(spr->mobj->frame & FF_FULLBRIGHT)) + lightlevel = *list[i-1].lightlevel; colormap = list[i-1].extra_colormap; break; } } #else i = R_GetPlaneLight(sector, temp, false); - lightlevel = *list[i].lightlevel; + if (!(spr->mobj->frame & FF_FULLBRIGHT)) + lightlevel = *list[i].lightlevel; colormap = list[i].extra_colormap; #endif @@ -4257,7 +4262,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) // even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) { - lightlevel = *list[i].lightlevel; + if (!(spr->mobj->frame & FF_FULLBRIGHT)) + lightlevel = *list[i].lightlevel; colormap = list[i].extra_colormap; } From 0bef99f5666ca80bdbcf867814a9e0c75d89fca4 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 17 May 2018 13:57:19 -0400 Subject: [PATCH 2/7] Fix console typo --- src/p_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index 52cd6ddbb..362e0966d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3003,7 +3003,7 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname) if ((numlumps = W_LoadWadFile(wadfilename)) == INT16_MAX) { - CONS_Printf(M_GetText("Errors occured while loading %s; not added.\n"), wadfilename); + CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename); return false; } else wadnum = (UINT16)(numwadfiles-1); From 092e70923573cf365a4035fc1c10148f5d9becb1 Mon Sep 17 00:00:00 2001 From: Sryder Date: Thu, 17 May 2018 22:17:20 +0100 Subject: [PATCH 3/7] OpenGL Map Specific palettes working This makes OpenGL stop using a specific function that doesn't really do anything for it anymore. It looks like it was used for a hack that would change the colour of polygons for the flashpal equivalent in DOOM. I made it so ST_DoPaletteStuff doesn't set the flashpal in OpenGL as it already does its own hacky overlay and doing that would cause all the textures to be flushed more mid-level, it could be enabled for more correct flashpals, but they still wouldn't effect fog or lighting. This means the palette will be set when going to the title screen, and twice when starting a map, (causing the OpenGL cached textures to also be flushed at those times) --- src/d_main.c | 7 +------ src/p_setup.c | 5 ----- src/st_stuff.c | 10 +++++----- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 4cdfb13d9..fbec5f7d8 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -730,11 +730,6 @@ void D_StartTitle(void) CON_ToggleOff(); // Reset the palette -#ifdef HWRENDER - if (rendermode == render_opengl) - HWR_SetPaletteColor(0); - else -#endif if (rendermode != render_none) V_SetPaletteLump("PLAYPAL"); } @@ -1223,7 +1218,7 @@ void D_SRB2Main(void) CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n"); R_Init(); - // setting up sound + // setting up sound if (dedicated) { nosound = true; diff --git a/src/p_setup.c b/src/p_setup.c index 52cd6ddbb..c3aa9884d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2503,11 +2503,6 @@ boolean P_SetupLevel(boolean skipprecip) // Reset the palette -#ifdef HWRENDER - if (rendermode == render_opengl) - HWR_SetPaletteColor(0); - else -#endif if (rendermode != render_none) V_SetPaletteLump("PLAYPAL"); diff --git a/src/st_stuff.c b/src/st_stuff.c index 3562a9b71..72e0b6b94 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -210,17 +210,17 @@ void ST_doPaletteStuff(void) else palette = 0; +#ifdef HWRENDER + if (rendermode == render_opengl) + palette = 0; // No flashpals here in OpenGL +#endif + palette = min(max(palette, 0), 13); if (palette != st_palette) { st_palette = palette; -#ifdef HWRENDER - if (rendermode == render_opengl) - HWR_SetPaletteColor(0); - else -#endif if (rendermode != render_none) { V_SetPaletteLump(GetPalette()); // Reset the palette From 001e4e11ca1dfd0ded1bbc29e26f71be50c86aac Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Thu, 17 May 2018 17:55:38 +0300 Subject: [PATCH 4/7] Correct C FixedMul() off-by-one errors The FixedMul() C implementation would produce off by one results, causing constant desyncs on 64 bit builds and builds without an ASM implementation of the function. This is fixed by shifting instead of dividing, possibly avoiding rounding errors. --- src/m_fixed.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/m_fixed.c b/src/m_fixed.c index ce7471a28..014457386 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -33,7 +33,9 @@ */ fixed_t FixedMul(fixed_t a, fixed_t b) { - return (fixed_t)((((INT64)a * b) ) / FRACUNIT); + // Need to cast to unsigned before shifting to avoid undefined behaviour + // for negative integers + return (fixed_t)(((UINT64)((INT64)a * b)) >> FRACBITS); } #endif //__USE_C_FIXEDMUL__ From f4181f7eb6203af8d8363cd03a351d8b780061da Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 26 May 2018 13:13:37 +0100 Subject: [PATCH 5/7] Very large map rendering issue fixed Move old fix for too large maps having rendering issues from R_CheckBBox to OpenGL's HWR_CheckBBox From what I know, this effects at least Aerial Garden and Seraphic Skylands --- src/hardware/hw_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 81021ef7f..059a09b15 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2901,8 +2901,8 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord) py2 = bspcoord[checkcoord[boxpos][3]]; // check clip list for an open space - angle1 = R_PointToAngle(px1, py1) - dup_viewangle; - angle2 = R_PointToAngle(px2, py2) - dup_viewangle; + angle1 = R_PointToAngle2(dup_viewx>>1, dup_viewy>>1, px1>>1, py1>>1) - dup_viewangle; + angle2 = R_PointToAngle2(dup_viewx>>1, dup_viewy>>1, px2>>1, py2>>1) - dup_viewangle; span = angle1 - angle2; From 41e9c20c04bde872c794e2a8287baba627bedc25 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 28 May 2018 21:29:46 +0100 Subject: [PATCH 6/7] Ignore mouse button events if the mouse's focus is not actually on the window at the moment. This should hopefully kill the F12 getting stuck issue once and for all. --- src/sdl/i_video.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 87ce84158..4eab0ae3c 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -658,6 +658,14 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type) SDL_memset(&event, 0, sizeof(event_t)); + // Ignore the event if the mouse is not actually focused on the window. + // This can happen if you used the mouse to restore keyboard focus; + // this apparently makes a mouse button down event but not a mouse button up event, + // resulting in whatever key was pressed down getting "stuck" if we don't ignore it. + // -- Monster Iestyn (28/05/18) + if (SDL_GetMouseFocus() != window) + return; + /// \todo inputEvent.button.which if (USE_MOUSEINPUT) { From 415c0952740f8dd0587f07e0688286ebf60a6e27 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 26 Jun 2018 17:46:04 +0100 Subject: [PATCH 7/7] fix the multiplayer menu not allowing the full max length for player names unlike the "name" console command --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 0ab771579..79ac6800b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6543,7 +6543,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) if (choice < 32 || choice > 127 || itemOn != 0) break; l = strlen(setupm_name); - if (l < MAXPLAYERNAME-1) + if (l < MAXPLAYERNAME) { S_StartSound(NULL,sfx_menu1); // Tails setupm_name[l] =(char)choice;