From 231ff3b502b890b8c6fd30aee531bf7d5a2d22b2 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 1 May 2025 01:06:00 +0300 Subject: [PATCH 1/8] Attempt to fix game freezing on windows when moving game window --- src/sdl/i_video.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 4754df855..aa291abb6 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1188,6 +1188,11 @@ void I_GetEvent(void) { case SDL_WINDOWEVENT: Impl_HandleWindowEvent(evt.window); +#ifdef _WIN32 + // Hack: on windows, when moving game window, sdl gets stuck handling those events, which may cause timeouts in netgames + if (evt.window == SDL_WINDOWEVENT_MOVED || evt.window == SDL_WINDOWEVENT_RESIZED || evt.window == SDL_WINDOWEVENT_SIZE_CHANGED) + goto exitpoolevent; +#endif break; case SDL_KEYUP: case SDL_KEYDOWN: @@ -1375,6 +1380,10 @@ void I_GetEvent(void) } } +#ifdef _WIN32 +exitpoolevent: +#endif + // Send all relative mouse movement as one single mouse event. if (mousemovex || mousemovey) { -- 2.54.0 From a1a4b7cfbf2dda7f86c72ada6d611738444726bf Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 1 May 2025 00:11:57 +0200 Subject: [PATCH 2/8] force c17 with gcc 15 for now dont feel like porting stuff over to c24 or whatever for v8 so just force c17 so ppl can still compile --- src/Makefile | 5 +++++ src/Makefile.cfg | 14 +++++++++++++- src/dehacked.c | 4 ---- src/info.c | 3 --- src/sdl/i_video.c | 3 ++- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Makefile b/src/Makefile index 46b7993ac..2ebe5d2e7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -296,6 +296,11 @@ ifdef X86_64 endif endif +# we just force c17 for now with gcc15 +ifdef GCC150 + CFLAGS+=-std=gnu17 + CPPFLAGS+=-std=gnu17 +endif ifndef NOPNG OPTS+=-DHAVE_PNG diff --git a/src/Makefile.cfg b/src/Makefile.cfg index cba731b9c..e4ba0c1ab 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -12,6 +12,7 @@ # to avoid a false positive with the version detection... SUPPORTED_GCC_VERSIONS:=\ + 151 150 15\ 142 141 140 14\ 132 131 130 13\ 123 122 121 120 12\ @@ -78,6 +79,18 @@ ifeq (,$(filter GCC%,$(.VARIABLES))) endif endif +ifdef GCC151 +GCC150=1 +endif + +ifdef GCC15 +GCC150=1 +endif + +ifdef GCC150 +GCC142=1 +endif + ifdef GCC142 GCC141=1 endif @@ -469,7 +482,6 @@ ifdef GCC81 WFLAGS+=-Wno-error=multistatement-macros endif - #indicate platform and what interface use with ifndef LINUX ifndef FREEBSD diff --git a/src/dehacked.c b/src/dehacked.c index a453715a7..f0e2583d8 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1414,9 +1414,6 @@ static void readhuditem(MYFILE *f, INT32 num) // IMPORTANT! // DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONNUM ENUM IN INFO.H - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wincompatible-pointer-types" actionpointer_t actionpointers[] = { {{A_Explode}, "A_EXPLODE"}, @@ -1625,7 +1622,6 @@ actionpointer_t actionpointers[] = // This NULL entry must be the last in the list {{NULL}, NULL}, }; -#pragma GCC diagnostic pop static void readframe(MYFILE *f, INT32 num) { diff --git a/src/info.c b/src/info.c index 19183de52..7afc76bf6 100644 --- a/src/info.c +++ b/src/info.c @@ -69,8 +69,6 @@ char sprnames[NUMSPRITES + 1][5] = }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wincompatible-pointer-types" state_t states[NUMSTATES] = { // frame is masked through FF_FRAMEMASK @@ -3412,7 +3410,6 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK #endif }; -#pragma GCC diagnostic pop mobjinfo_t mobjinfo[NUMMOBJTYPES] = { diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index aa291abb6..7504caa67 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -864,6 +864,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { SDLforceUngrabMouse(); } + memset(gamekeydown, 0, NUMKEYS); // TODO this is a scary memset if (MOUSE_MENU) @@ -1903,7 +1904,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) // Some GPU drivers may give us a 16-bit depth buffer since the // default value for SDL_GL_DEPTH_SIZE is 16. SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); - + // request stencil buffer. If there are problems on weaker hw the bit count could be reduced // If only something like 1-bit or 2-bit stencil is available on some gpus then should implement limit for maxportals based on that. // 4 bits would be enough for current limit in maxportals (12) -- 2.54.0 From c0aa3e48cd95ee8a7f1d3c4ac758cdd5a13919ab Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 1 May 2025 08:55:08 +0100 Subject: [PATCH 3/8] fix compile --- src/sdl/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 7504caa67..51ef3bc24 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1191,7 +1191,7 @@ void I_GetEvent(void) Impl_HandleWindowEvent(evt.window); #ifdef _WIN32 // Hack: on windows, when moving game window, sdl gets stuck handling those events, which may cause timeouts in netgames - if (evt.window == SDL_WINDOWEVENT_MOVED || evt.window == SDL_WINDOWEVENT_RESIZED || evt.window == SDL_WINDOWEVENT_SIZE_CHANGED) + if (evt.window.event == SDL_WINDOWEVENT_MOVED || evt.window.event == SDL_WINDOWEVENT_RESIZED || evt.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) goto exitpoolevent; #endif break; -- 2.54.0 From d1bb0b97d26717d910068092a4c36bb58034dee7 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 1 May 2025 08:56:43 +0100 Subject: [PATCH 4/8] seriously screw you windoze --- src/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Makefile b/src/Makefile index 2ebe5d2e7..0bd0c565b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -296,11 +296,10 @@ ifdef X86_64 endif endif -# we just force c17 for now with gcc15 -ifdef GCC150 - CFLAGS+=-std=gnu17 - CPPFLAGS+=-std=gnu17 -endif +# apparently MingW just completely ignores everything so just always force this shit +# FIXME: we should port our code to c24 +CFLAGS+=-std=gnu17 +CPPFLAGS+=-std=gnu17 ifndef NOPNG OPTS+=-DHAVE_PNG -- 2.54.0 From 066b12f075ee2f64c34b4fcf1965511033306031 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 1 May 2025 13:02:22 +0300 Subject: [PATCH 5/8] Revert "fix compile" This reverts commit c0aa3e48cd95ee8a7f1d3c4ac758cdd5a13919ab. --- src/sdl/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 51ef3bc24..7504caa67 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1191,7 +1191,7 @@ void I_GetEvent(void) Impl_HandleWindowEvent(evt.window); #ifdef _WIN32 // Hack: on windows, when moving game window, sdl gets stuck handling those events, which may cause timeouts in netgames - if (evt.window.event == SDL_WINDOWEVENT_MOVED || evt.window.event == SDL_WINDOWEVENT_RESIZED || evt.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) + if (evt.window == SDL_WINDOWEVENT_MOVED || evt.window == SDL_WINDOWEVENT_RESIZED || evt.window == SDL_WINDOWEVENT_SIZE_CHANGED) goto exitpoolevent; #endif break; -- 2.54.0 From d1c7e08496e563d8c2cdabc8d81afc64378496df Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 1 May 2025 13:02:26 +0300 Subject: [PATCH 6/8] Revert "Attempt to fix game freezing on windows when moving game window" This reverts commit 231ff3b502b890b8c6fd30aee531bf7d5a2d22b2. --- src/sdl/i_video.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 7504caa67..faf4c67f7 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1189,11 +1189,6 @@ void I_GetEvent(void) { case SDL_WINDOWEVENT: Impl_HandleWindowEvent(evt.window); -#ifdef _WIN32 - // Hack: on windows, when moving game window, sdl gets stuck handling those events, which may cause timeouts in netgames - if (evt.window == SDL_WINDOWEVENT_MOVED || evt.window == SDL_WINDOWEVENT_RESIZED || evt.window == SDL_WINDOWEVENT_SIZE_CHANGED) - goto exitpoolevent; -#endif break; case SDL_KEYUP: case SDL_KEYDOWN: @@ -1381,10 +1376,6 @@ void I_GetEvent(void) } } -#ifdef _WIN32 -exitpoolevent: -#endif - // Send all relative mouse movement as one single mouse event. if (mousemovex || mousemovey) { -- 2.54.0 From 59deb7c8c1566e79e186705288f317e7ea671588 Mon Sep 17 00:00:00 2001 From: Chearii Date: Tue, 29 Apr 2025 15:58:46 -0400 Subject: [PATCH 7/8] add a minimap headlight --- src/d_main.c | 11 +++++ src/d_main.h | 1 + src/k_kart.c | 114 ++++++++++++++++++++++++++++++++++++--------------- src/k_kart.h | 3 ++ src/m_menu.c | 6 +-- 5 files changed, 100 insertions(+), 35 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index e6568030e..ced90b261 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1222,6 +1222,7 @@ boolean driftgaugegfx = false; // Driftgauge stuffs boolean multiitem_icon = false; // Extra icons for Sneakers, Banana and Jawz boolean joystickicon = false; // Extra icons for the joystick input display boolean minidoticon = false; // Dot graphic for minimap player angle display +boolean minilighticon = false; // mkwii-style minimap headlight // static void IdentifyVersion(void) @@ -1342,10 +1343,12 @@ static void D_CheckSaturnExtraFiles(void) CV_PossibleValue_t speedo_cons_temp[NUMSPEEDOSTUFF] = {{1, "Default"}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}}; CV_PossibleValue_t driftgaugestyle_cons_temp[NUMDGAUGESTUFF] = {{1, "Default"}, {2, "Small"}, {3, "Big Numbers"}, {4, "Numbers Only"}, {0, NULL}, {0, NULL}}; CV_PossibleValue_t inputdisplay_cons_temp[NUMINPUTDISPLAYSTUFF] = {{0, "Off"}, {1, "Wheel"}, {2, "Stick"}, {0, NULL}, {0, NULL}}; + CV_PossibleValue_t minimapdot_cons_temp[NUMMINIMAPDOTSTUFF] = {{0, "Off"}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}}; unsigned last_speedo_i = 0; unsigned last_driftgauge_i = 3; unsigned last_inputdisplay_i = 2; + unsigned last_minimapdot_i = 0; #define PUSHCONS(cons, i, id, name) { ++i; cons[i].value = id; cons[i].strvalue = name; } // found the funny, add it in! @@ -1438,6 +1441,13 @@ static void D_CheckSaturnExtraFiles(void) if (W_LumpExists("MMAPDOT")) { minidoticon = true; + PUSHCONS(minimapdot_cons_temp, last_minimapdot_i, 1, "Dot"); + } + + if (W_LumpExists("MMAPHDLT")) + { + minilighticon = true; + PUSHCONS(minimapdot_cons_temp, last_minimapdot_i, 2, "Headlight"); } } @@ -1513,6 +1523,7 @@ static void D_CheckSaturnExtraFiles(void) memcpy(speedo_cons_t, speedo_cons_temp, sizeof(speedo_cons_t)); memcpy(driftgaugestyle_cons_t, driftgaugestyle_cons_temp, sizeof(driftgaugestyle_cons_t)); memcpy(inputdisplay_cons_t, inputdisplay_cons_temp, sizeof(inputdisplay_cons_t)); + memcpy(minimapdot_cons_t, minimapdot_cons_temp, sizeof(minimapdot_cons_t)); } #include diff --git a/src/d_main.h b/src/d_main.h index f8e5b0b41..cb4049e54 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -53,6 +53,7 @@ extern boolean driftgaugegfx; // Driftgauge stuffs extern boolean multiitem_icon; // Extra icons for Sneakers, Banana and Jawz extern boolean joystickicon; // Extra icons for the joystick input display extern boolean minidoticon; // Dot icon for minimap player angle display +extern boolean minilighticon; // mkwii-style minimap headlight // // autoload stuff diff --git a/src/k_kart.c b/src/k_kart.c index fbe657006..19e4fafe1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -106,7 +106,8 @@ consvar_t cv_fancyroulette = {"animatedroulette", "Off", CV_SAVE, CV_OnOff, NULL consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showminimapnames = {"showminimapnames", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_showminimapangle = {"showminimapangle", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +CV_PossibleValue_t minimapdot_cons_t[NUMMINIMAPDOTSTUFF]; +consvar_t cv_showminimapangle = {"showminimapangle", "Off", CV_SAVE, minimapdot_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_highresportrait = {"highresportrait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // make char potraits use their high-res version instead @@ -10587,7 +10588,7 @@ static void K_drawKartPlayerCheck(void) } } -static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, patch_t *icon, UINT8 *colormap) +static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, INT32 blend, patch_t *icon, UINT8 *colormap, drawinfo_t *dims) { // amnum xpos & ypos are the icon's speed around the HUD. // The number being divided by is for how fast it moves. @@ -10600,6 +10601,7 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 INT32 amxpos, amypos; fixed_t scale = FRACUNIT; patch_t *AutomapPic; + INT16 w, h; AutomapPic = minimapinfo.minimap_pic; @@ -10614,17 +10616,28 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 if (encoremode) amnumxpos = -amnumxpos; - amxpos = amnumxpos + ((hudx + (AutomapPic->width-icon->width)/2)<height-icon->height)/2)<x != 0) && (dims->y != 0)) + { + w = dims->x; + h = dims->y; + } + else + { + w = SHORT(icon->width); + h = SHORT(icon->height); + } - if (cv_minihead.value && !(icon == kp_minimapdot)) + amxpos = amnumxpos + ((hudx + (SHORT(AutomapPic->width)-w)/2)<height)-h)/2)<width / 4)<height / 4)<health <= 0 && players[localplayers[i]].pflags & PF_TIMEOVER) - continue; + boolean playertimedout = (mobj->health <= 0 && players[localplayers[i]].pflags & PF_TIMEOVER); - UINT8 *colormap; - fixed_t interpx, interpy; + if (cv_showminimapangle.value && (minidoticon || minilighticon) && !playertimedout) + { + UINT8 *colormap; + drawinfo_t dims; + fixed_t interpx, interpy; + fixed_t xoff = 0, yoff = 0; + blending = 0; - angle_t ang = R_InterpolateAngle(mobj->old_angle, mobj->angle); + angle_t ang = R_InterpolateAngle(mobj->old_angle, mobj->angle); - if (mobj->colorized) - colormap = R_GetTranslationColormap(TC_RAINBOW, mobj->color, GTC_CACHE); - else - colormap = R_GetLocalTranslationColormap(mobj->skin, mobj->localskin, mobj->color, GTC_CACHE, mobj->skinlocal); + if (mobj->colorized) + colormap = R_GetTranslationColormap(TC_RAINBOW, mobj->color, GTC_CACHE); + else + colormap = R_GetLocalTranslationColormap(mobj->skin, mobj->localskin, mobj->color, GTC_CACHE, mobj->skinlocal); - interpx = lerp(mobj->old_x, mobj->x); - interpy = lerp(mobj->old_y, mobj->y); + interpx = lerp(mobj->old_x, mobj->x); + interpy = lerp(mobj->old_y, mobj->y); - K_drawKartMinimapIcon( - interpx, - interpy, - x + FixedMul(FCOS(ang), icondotradius), - y - FixedMul(FSIN(ang), icondotradius), - splitflags, - kp_minimapdot, - colormap - ); + minipatch = kp_minimapdot; + + dims.x = 0; + dims.y = 0; + + if (cv_showminimapangle.value == MINIANGLE_DOT) + { + xoff = FixedMul(FCOS(ang), icondotradius); + yoff = -FixedMul(FSIN(ang), icondotradius); + } + else if (cv_showminimapangle.value == MINIANGLE_LIGHT) + { + rot = R_GetRollAngle(ang); + minipatch = W_CachePatchNameRotated("MMAPHDLT", rot, PU_PATCH); + + blending = B_ADD; + xoff = yoff = 0; + + dims.x = 48; + dims.y = 24; + } + + K_drawKartMinimapIcon( + interpx, + interpy, + x + xoff, + y + yoff, + splitflags, + blending, + minipatch, + colormap, + &dims + ); + } + + // draw the minimap head after the nonsense above + K_drawKartMinimapHead(mobj, x, y, splitflags); } } diff --git a/src/k_kart.h b/src/k_kart.h index 8a53a2102..411bb0512 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -47,6 +47,9 @@ extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF]; extern CV_PossibleValue_t driftgaugestyle_cons_t[NUMDGAUGESTUFF]; #define NUMINPUTDISPLAYSTUFF 5 extern CV_PossibleValue_t inputdisplay_cons_t[NUMINPUTDISPLAYSTUFF]; +#define NUMMINIMAPDOTSTUFF 5 +extern CV_PossibleValue_t minimapdot_cons_t[NUMMINIMAPDOTSTUFF]; + boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); diff --git a/src/m_menu.c b/src/m_menu.c index b7e45afc3..63ad0c1e2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2453,7 +2453,7 @@ static menuitem_t OP_SaturnHudMenu[] = {IT_STRING | IT_CVAR, NULL, "Show Names on Minimap", &cv_showminimapnames, 135}, {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 140}, {IT_STRING | IT_CVAR, NULL, "Spin Minimap Icons", &cv_spinoutroll, 145}, - {IT_STRING | IT_CVAR, NULL, "Player Angle Dot", &cv_showminimapangle, 150}, + {IT_STRING | IT_CVAR, NULL, "Player Angle Visual", &cv_showminimapangle, 150}, {IT_STRING | IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 160}, @@ -2487,7 +2487,7 @@ static const char* OP_SaturnHudTooltips[] = "Show player names on the minimap.", "Minimize the player icons on the minimap.", "Erratically rotate player icons during spinouts.", - "Show a dot showing the player facing angle.", + "Visualize the player facing angle.", "Make the Intermission screen look like in beta versions of Kart!\nEither with background or just the rest.", "Show the Director Toggle prompt when spectating.", "Nametag Options.", @@ -4969,7 +4969,7 @@ void M_Init(void) if (!nametaggfx) OP_NametagMenu[nt_ntchar].status = IT_GRAYEDOUT; - if (!minidoticon) + if (!minidoticon && !minilighticon) OP_SaturnHudMenu[sh_minidot].status = IT_GRAYEDOUT; #ifndef NONET -- 2.54.0 From 62fa1777dd6b7d1b84f70f87a6266cb114953473 Mon Sep 17 00:00:00 2001 From: Chearii Date: Tue, 29 Apr 2025 16:20:54 -0400 Subject: [PATCH 8/8] ts pmo fr icl istg me when my code has to be robust!! (I also Forgot to remove the SHORT marcros oops!) --- src/k_kart.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 19e4fafe1..0a15189a1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10588,7 +10588,7 @@ static void K_drawKartPlayerCheck(void) } } -static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, INT32 blend, patch_t *icon, UINT8 *colormap, drawinfo_t *dims) +static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, INT32 blend, patch_t *icon, UINT8 *colormap, drawinfo_t *dims, boolean scaleme) { // amnum xpos & ypos are the icon's speed around the HUD. // The number being divided by is for how fast it moves. @@ -10623,19 +10623,19 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 } else { - w = SHORT(icon->width); - h = SHORT(icon->height); + w = icon->width; + h = icon->height; } - amxpos = amnumxpos + ((hudx + (SHORT(AutomapPic->width)-w)/2)<height)-h)/2)<width-w)/2)<height-h)/2)<width / 4)<height / 4)<