From 27c053cd4832e5dbe8e94110fb19da251d12ee5b Mon Sep 17 00:00:00 2001 From: chromaticpipe <127907268+chromaticpipe@users.noreply.github.com> Date: Fri, 30 May 2025 13:23:36 -0500 Subject: [PATCH 01/13] Add Server info screen, ported from SRB2Classic --- src/d_clisrv.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++--- src/d_clisrv.h | 3 ++ 2 files changed, 108 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4e5a1cd9a..a97c47987 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -87,6 +87,9 @@ boolean serverrunning = false; INT32 serverplayer = 0; char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support) +plrinfo playerinfo[MAXPLAYERS]; +SINT8 joinnode = 0; // used for CL_VIEWSERVER + // Server specific vars UINT8 playernode[MAXPLAYERS]; @@ -1185,6 +1188,7 @@ typedef enum #endif CL_CONNECTED, CL_ABORTED, + CL_VIEWSERVER, CL_ASKFULLFILELIST, CL_CONFIRMCONNECT, #ifdef HAVE_CURL @@ -1248,7 +1252,7 @@ static inline void CL_DrawConnectionStatus(void) if (!menuactive) // menu already draws its own fade V_DrawFadeScreen(0xFF00, 16); // force default - if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES + if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES && cl_mode != CL_VIEWSERVER #ifdef HAVE_CURL && cl_mode != CL_DOWNLOADHTTPFILES #endif @@ -1368,6 +1372,78 @@ static inline void CL_DrawConnectionStatus(void) V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS, va(" %2u/%2u Files",loadcompletednum,fileneedednum)); } + else if (cl_mode == CL_VIEWSERVER) + { + V_DrawFill(8, 16, BASEVIDWIDTH - 16, 54, 239); + + V_DrawThinString(12 + 80, 18, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.servername)); + + const char *map = va("%sP", serverlist[joinnode].info.mapname); + patch_t *current_map = W_LumpExists(map) ? W_CachePatchName(map, PU_CACHE) : W_CachePatchName("BLANKLVL", PU_CACHE); + V_DrawSmallScaledPatch(10, 18, 0, current_map); + + V_DrawThinString(12 + 80, 38, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.maptitle)); + V_DrawThinString(12 + 80, 48, V_ALLOWLOWERCASE, va("%s", Gametype_Names[serverlist[joinnode].info.gametype])); + + if (fileneedednum > 0) + { + V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_ORANGEMAP, va("%i Addons", fileneedednum)); + } + else + { + V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_YELLOWMAP, "Vanilla"); + } + + if (serverlist[joinnode].info.cheatsenabled) + { + V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, 58, V_ALLOWLOWERCASE|V_GREENMAP, "Cheats"); + } + + V_DrawFill(8, 72, BASEVIDWIDTH - 16, 112, 239); + + V_DrawString(12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, "Players"); + V_DrawRightAlignedString(BASEVIDWIDTH - 12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, va("%i / %i", serverlist[joinnode].info.numberofplayer, serverlist[joinnode].info.maxplayer)); + + INT32 i; + INT32 count = 0; + INT32 x = 14; + INT32 y = 84; + INT32 statuscolor = 1; + char player_name[MAXPLAYERNAME+1]; + if (serverlist[joinnode].info.numberofplayer > 0) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (playerinfo[i].node < 255) + { + strncpy(player_name, playerinfo[i].name, MAXPLAYERNAME); + V_DrawThinString(x + 10, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, player_name); + + if (playerinfo[i].team == 0) { statuscolor = 184; } // playing + if (playerinfo[i].data & 0x20) { statuscolor = 86; } // tag IT + if (playerinfo[i].team == 1) { statuscolor = 128; } // ctf red team + if (playerinfo[i].team == 2) { statuscolor = 232; } // ctf blue team + if (playerinfo[i].team == 255) { statuscolor = 16; } // spectator or non-team + + V_DrawFill(x, y, 7, 7, 31); + V_DrawFill(x, y, 6, 6, statuscolor); + + y += 9; + count++; + if ((count == 11) || (count == 22)) + { + x += 104; + y = 84; + } + } + } + } + + // Buttons + V_DrawFill(8, BASEVIDHEIGHT - 14, BASEVIDWIDTH - 16, 12, 239); + V_DrawThinString(16, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sESC%s] = Abort", "\x82", "\x80")); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sENTER%s] = Join", "\x82", "\x80")); + } else if (filedownload.current != -1) { INT32 dldlength; @@ -2495,7 +2571,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent) return true; } - cl_mode = CL_CHECKFILES; + cl_mode = CL_VIEWSERVER; } else { @@ -2549,7 +2625,7 @@ 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; + cl_mode = CL_VIEWSERVER; else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent) { if (CL_AskFileList(fileneedednum)) @@ -2715,6 +2791,15 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic D_ProcessEvents(); //needed for menu system to receive inputs key = I_GetKey(); + + if (cl_mode == CL_VIEWSERVER) + { + if (gamekeydown[KEY_ENTER]) + cl_mode = CL_CHECKFILES; + else if (gamekeydown[KEY_ESCAPE]) + cl_mode = CL_ABORTED; + } + // Only ESC and non-keyboard keys abort connection if (!modeattacking && (key == KEY_ESCAPE || key == KEY_JOY1+1 || cl_mode == CL_ABORTED)) { @@ -4909,6 +4994,16 @@ static void HandleServerInfo(SINT8 node) if (client && cl_mode > CL_SEARCHING && node == servernode) memcpy(connectedservername, netbuffer->u.serverinfo.servername, MAXSERVERNAME); } + + +static void HandlePlayerInfo(SINT8 node) +{ + (void)node; + + INT32 i; + for (i = 0; i < MAXPLAYERS; i++) + playerinfo[i] = netbuffer->u.playerinfo[i]; +} #endif #ifdef SATURNPAK @@ -5197,6 +5292,10 @@ static void HandlePacketFromAwayNode(SINT8 node) case PT_CLIENTCMD: break; // This is not an "unknown packet" + + case PT_PLAYERINFO: + HandlePlayerInfo(node); + break; case PT_SERVERTICS: // Do not remove my own server (we have just get a out of order packet) @@ -5789,8 +5888,9 @@ static void GetPackets(void) } #endif - if (netbuffer->packettype == PT_PLAYERINFO) - continue; // We do nothing with PLAYERINFO, that's for the MS browser. + /*if (netbuffer->packettype == PT_PLAYERINFO) + continue; // We do nothing with PLAYERINFO, that's for the MS browser. Not quite true anymore :p*/ + // We also count unknown packets, hence "<=" if (netbuffer->packettype <= NUMPACKETTYPE) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 6202c8c52..221375c35 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -577,6 +577,9 @@ extern boolean acceptnewnode; extern SINT8 servernode; extern char connectedservername[MAXSERVERNAME+1]; +extern plrinfo playerinfo[MAXPLAYERS]; +extern SINT8 joinnode; + void Command_Ping_f(void); extern tic_t connectiontimeout; extern tic_t jointimeout; From c04ba992a7aeb108ae3ce40259eb8f5ff8089a12 Mon Sep 17 00:00:00 2001 From: chromaticpipe <127907268+chromaticpipe@users.noreply.github.com> Date: Fri, 30 May 2025 13:26:27 -0500 Subject: [PATCH 02/13] Forgort something --- src/d_clisrv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a97c47987..e27d454d3 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2545,6 +2545,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent) if (i < 0) return true; } + joinnode = i; // Quit here rather than downloading files and being refused later. if (serverlist[i].info.numberofplayer >= serverlist[i].info.maxplayer) From dd499a410f2dacf222a1c98fcab498c56dd36e23 Mon Sep 17 00:00:00 2001 From: chromaticpipe <127907268+chromaticpipe@users.noreply.github.com> Date: Fri, 30 May 2025 13:30:47 -0500 Subject: [PATCH 03/13] Very bad gamepad support --- src/d_clisrv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e27d454d3..30a450ee0 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2795,9 +2795,9 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic if (cl_mode == CL_VIEWSERVER) { - if (gamekeydown[KEY_ENTER]) + if (key == KEY_ENTER || key == KEY_JOY1) cl_mode = CL_CHECKFILES; - else if (gamekeydown[KEY_ESCAPE]) + else if (key == KEY_ESCAPE || key == KEY_JOY1+1) cl_mode = CL_ABORTED; } From a0f903f162669521d2548e10952d90ac5b4c64fd Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 31 May 2025 20:55:10 +0200 Subject: [PATCH 04/13] i like switches mhhhm --- src/hardware/hw_draw.c | 51 +++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 9fd90fb09..7e996e083 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -241,16 +241,16 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p if (option & V_SNAPTORIGHT) cx += (fvw - (FLOATBASEVIDWIDTH * dupx)); else if (!(option & V_SNAPTOLEFT)) - cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2; + cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f; } if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f) { if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP)) - cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy)); + cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy)); else if (option & V_SNAPTOBOTTOM) cy += (fvh - (FLOATBASEVIDHEIGHT * dupy)); else if (!(option & V_SNAPTOTOP)) - cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2; + cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f; } } } @@ -305,10 +305,13 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p FSurfaceInfo Surf; Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; - else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; + switch (alphalevel) + { + case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; break; + case 14: Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; break; + case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; break; + default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break; + } flags |= PF_Modulated; GL_DrawPolygon(&Surf, v, 4, flags); @@ -392,16 +395,16 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, if (option & V_SNAPTORIGHT) cx += (fvw - (FLOATBASEVIDWIDTH * dupx)); else if (!(option & V_SNAPTOLEFT)) - cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2; + cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f; } if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f) { if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP)) - cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy)); + cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy)); else if (option & V_SNAPTOBOTTOM) cy += (fvh - (FLOATBASEVIDHEIGHT * dupy)); else if (!(option & V_SNAPTOTOP)) - cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2; + cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f; } } } @@ -467,10 +470,13 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, FSurfaceInfo Surf; Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; - else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; + switch (alphalevel) + { + case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; break; + case 14: Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; break; + case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; break; + default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break; + } flags |= PF_Modulated; GL_DrawPolygon(&Surf, v, 4, flags); @@ -487,7 +493,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, // -------------------------------------------------------------------------- // Fills a box of pixels using a flat texture as a pattern // -------------------------------------------------------------------------- -void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum) +void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum) { FOutVector v[4]; double dflatsize; @@ -840,7 +846,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color) if (color & V_SNAPTORIGHT) fx += (fvw - (FLOATBASEVIDWIDTH * dupx)); else if (!(color & V_SNAPTOLEFT)) - fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2; + fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2.0f; } if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f) { @@ -848,7 +854,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color) if (color & V_SNAPTOBOTTOM) fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)); else if (!(color & V_SNAPTOTOP)) - fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2; + fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2.0f; } } @@ -1122,10 +1128,13 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) if (alphalevel) { - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; - else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; + switch (alphalevel) + { + case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; break; + case 14: Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; break; + case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; break; + default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break; + } } GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); From 37eb8cfa579722548d8243b4e530c9f4d80e297e Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 31 May 2025 19:55:33 +0200 Subject: [PATCH 05/13] shut up curl im already long --- src/http-mserv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/http-mserv.c b/src/http-mserv.c index 30a6f977d..2831e34e6 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -220,9 +220,9 @@ HMS_connect (const char *format, ...) curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V4); - curl_easy_setopt(curl, CURLOPT_TIMEOUT, cv_masterserver_timeout.value); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read); curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer); @@ -339,8 +339,8 @@ HMS_unlist (void) if (! hms) return 0; - curl_easy_setopt(hms->curl, CURLOPT_POST, 1); - curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0); + curl_easy_setopt(hms->curl, CURLOPT_POST, (long)1); + curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, (long)0); okay = HMS_do(hms); HMS_end(hms); From 45ffe87ba674c01d608dfce84be194cd9b0b4342 Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 31 May 2025 22:27:05 +0300 Subject: [PATCH 06/13] Add new music credit draw style, 'songcredits Box' --- src/g_game.c | 3 ++- src/hu_stuff.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index a872fc571..bc693d97c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -385,7 +385,8 @@ consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, N consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; // Display song credits -consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}}; +consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // Show "FREE PLAY" when you're alone. :( consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 2821c4021..0da2d9930 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2133,7 +2133,7 @@ void HU_TickSongCredits(void) } } -void HU_DrawSongCredits(void) +static void HU_DrawSongCreditsVanilla(void) { char *str; INT32 len; @@ -2141,9 +2141,6 @@ void HU_DrawSongCredits(void) INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32); INT32 bgt; - if (!cursongcredit.def) // No def - return; - str = va("\x1F"" %s", cursongcredit.def->source); len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE); destx = (len + 7) * FRACUNIT; @@ -2173,6 +2170,70 @@ void HU_DrawSongCredits(void) V_DrawRightAlignedThinString(cursongcredit.x / FRACUNIT, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<source; + INT32 strwidth = V_SmallStringWidth(str, V_ALLOWLOWERCASE) + 4; + + // dup dup dup dup + INT32 dup = min(vid.dupx, vid.dupy); + + // Center it + INT32 x = (BASEVIDWIDTH/2 - strwidth/2)*dup + ((vid.width - (BASEVIDWIDTH * vid.dupx)) / 2); + INT32 y = 0; + + INT32 flags = V_SNAPTOTOP|V_NOSCALESTART; + INT32 t = cursongcredit.anim; + INT32 bgt; + + fixed_t interpoffset = FixedMul(BOXCREDITHEIGHT*dup*FRACUNIT/(TICRATE/2), R_GetHudUncap()); + + if (t > BOXCREDITSLIDEIN) + { + // Sliding in + t = TICRATE/2 - (t - BOXCREDITSLIDEIN); + y = -BOXCREDITHEIGHT*dup + (FixedMul(BOXCREDITHEIGHT*FRACUNIT, FixedDiv(t*FRACUNIT, TICRATE*FRACUNIT/2))*dup + interpoffset)/FRACUNIT; + } + else if (t < TICRATE/2) + { + // Sliding out + y = -BOXCREDITHEIGHT*dup + (FixedMul(BOXCREDITHEIGHT*FRACUNIT, FixedDiv(t*FRACUNIT, TICRATE*FRACUNIT/2))*dup - interpoffset)/FRACUNIT; + } + + bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans/2); + + if (bgt < NUMTRANSMAPS) + { + V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt< Date: Sat, 31 May 2025 16:27:34 -0500 Subject: [PATCH 07/13] Options. --- src/d_clisrv.c | 6 ++++-- src/d_clisrv.h | 2 ++ src/d_netcmd.c | 1 + src/m_menu.c | 28 +++++++++++++++------------- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 30a450ee0..4b279c58a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2572,7 +2572,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent) return true; } - cl_mode = CL_VIEWSERVER; + cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES; } else { @@ -2626,7 +2626,7 @@ 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_VIEWSERVER; + cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES; else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent) { if (CL_AskFileList(fileneedednum)) @@ -4228,6 +4228,8 @@ consvar_t cv_downloadspeed = {"downloadspeed", "300", CV_SAVE, downloadspeed_con static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}}; consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_serverinfoscreen = {"serverinfoscreen", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + static void Got_AddPlayer(UINT8 **p, INT32 playernum); static void Got_RemovePlayer(UINT8 **p, INT32 playernum); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 221375c35..35c77ce12 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -611,6 +611,8 @@ extern consvar_t cv_connectawaittime; extern consvar_t cv_discordinvites; +extern consvar_t cv_serverinfoscreen; + // Used in d_net, the only dependence //tic_t ExpandTics(INT32 low, tic_t basetic); void D_ClientServerInit(void); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1970b5323..d73d6829a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -902,6 +902,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_netticbuffer); CV_RegisterVar(&cv_mindelay); CV_RegisterVar(&cv_gentlemens); + CV_RegisterVar(&cv_serverinfoscreen); #ifdef NETGAME_DEVMODE CV_RegisterVar(&cv_fishcake); diff --git a/src/m_menu.c b/src/m_menu.c index 65dab3e6a..b856c3a8a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2188,29 +2188,30 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Minimum Input Delay", &cv_mindelay, 20}, {IT_STRING | IT_CVAR, NULL, "Gentlemens Ping", &cv_gentlemens, 25}, + {IT_STRING | IT_CVAR, NULL, "Server Info Screen", &cv_serverinfoscreen, 30}, - {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35}, + {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 40}, - {IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 45}, - {IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 50}, + {IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 50}, + {IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 55}, - {IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 60}, + {IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 65}, - {IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 70}, + {IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 75}, - {IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 80}, + {IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 85}, - {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 90}, + {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 95}, - {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 100}, + {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 105}, - {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 110}, + {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 115}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 120}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 125}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 130}, - {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 135}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 140}, // uwu + {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 135}, + {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 140}, + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 145}, // uwu }; static const char* OP_SaturnTooltips[] = @@ -2219,6 +2220,7 @@ static const char* OP_SaturnTooltips[] = "How long can the game wait before it kicks you out from the server\nconnecting screen.", "Practice for online play! 0 = instant response.", "Simulate online input delay when hosting a server.\nValue choosen by Player with the lowest ping", + "Show a screen before joining a server displaying important information about it", "How much speen do you want?", "Colourize the speedlines in your skincolor if you go fast enough!", "Colourize the sneaker flame trails in your skincolor!", From d50c1ab6d78162d130c4f242ae53eb134cd35953 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 2 Jun 2025 14:21:23 +0300 Subject: [PATCH 08/13] dedi's do run got_mapcmd :p --- src/p_setup.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 0459a03f5..a69390961 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2747,8 +2747,6 @@ static void P_SetupPlayer(void) I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); I_mkdir(va("%s"PATHSEP"replay"PATHSEP"online", srb2home), 0755); G_RecordDemo(buf); - if (dedicated) - G_BeginRecording(); //this has to move here, since dedicated servers dont run got_mapcmd } wantedcalcdelay = wantedfrequency*2; From fc51c1ba886653be0d783dbd726d9f323de8c041 Mon Sep 17 00:00:00 2001 From: chromaticpipe <127907268+chromaticpipe@users.noreply.github.com> Date: Tue, 3 Jun 2025 11:38:46 -0500 Subject: [PATCH 09/13] Fix help command for CV_FLOAT CVars --- src/command.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/command.c b/src/command.c index 4e43e2cb5..b29f15b7b 100644 --- a/src/command.c +++ b/src/command.c @@ -816,12 +816,17 @@ static void COM_Help_f(void) cvar = CV_FindVar(help); if (cvar) { + boolean floatmode = false; + const char *cvalue = NULL; CONS_Printf("\x82""Variable %s:\n", cvar->name); CONS_Printf(M_GetText(" flags: ")); if (cvar->flags & CV_SAVE) CONS_Printf("AUTOSAVE "); if (cvar->flags & CV_FLOAT) + { CONS_Printf("FLOAT "); + floatmode = true; + } if (cvar->flags & CV_NETVAR) CONS_Printf("NETVAR "); if (cvar->flags & CV_CALL) @@ -831,30 +836,38 @@ static void COM_Help_f(void) CONS_Printf("\n"); if (cvar->PossibleValue) { - if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX")) { - CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value, - cvar->PossibleValue[1].value); - i = 2; - } + if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX")) + { + if (floatmode) + CONS_Printf(" range from %f to %f\n", FIXED_TO_FLOAT(cvar->PossibleValue[0].value), + FIXED_TO_FLOAT(cvar->PossibleValue[1].value)); + else + CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value, + cvar->PossibleValue[1].value); + i = 2; + } - { - const char *cvalue = NULL; //CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name); while (cvar->PossibleValue[i].strvalue) { - CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value, - cvar->PossibleValue[i].strvalue); + if (floatmode) + CONS_Printf(" %-2f : %s\n", FIXED_TO_FLOAT(cvar->PossibleValue[i].value), + cvar->PossibleValue[i].strvalue); + else + CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value, + cvar->PossibleValue[i].strvalue); if (cvar->PossibleValue[i].value == cvar->value) cvalue = cvar->PossibleValue[i].strvalue; i++; } - if (cvalue) - CONS_Printf(" Current value: %s\n", cvalue); - else - CONS_Printf(" Current value: %d\n", cvar->value); } } + + if (cvalue) + CONS_Printf(" Current value: %s\n", cvalue); + else if (cvar->string) + CONS_Printf(" Current value: %s\n", cvar->string); else CONS_Printf(" Current value: %d\n", cvar->value); } From 03f81bed16cd7e946f5c5e79f0c816a2534f18c5 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 3 Jun 2025 19:46:22 +0200 Subject: [PATCH 10/13] dont initialise those twice lol --- src/r_draw8.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index f9e3e12e7..6edc9d6a6 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -782,10 +782,6 @@ void R_DrawSpan_8 (void) xposition <<= nflatshiftup; yposition <<= nflatshiftup; xstep <<= nflatshiftup; ystep <<= nflatshiftup; - source = ds_source; - colormap = ds_colormap; - dest = ylookup[ds_y] + columnofs[ds_x1]; - if (dest+8 > deststop) { return; From dcccf672c958e86960ce573268d8518451d9694b Mon Sep 17 00:00:00 2001 From: chromaticpipe <127907268+chromaticpipe@users.noreply.github.com> Date: Tue, 3 Jun 2025 13:18:02 -0500 Subject: [PATCH 11/13] Truncate trailing zeroes in float CVars --- src/command.c | 16 ++++++++++++---- src/m_menu.c | 4 ++-- src/m_misc.c | 19 +++++++++++++++++++ src/m_misc.h | 6 ++++++ 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/command.c b/src/command.c index b29f15b7b..3881246c1 100644 --- a/src/command.c +++ b/src/command.c @@ -838,10 +838,15 @@ static void COM_Help_f(void) { { if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX")) - { + { if (floatmode) - CONS_Printf(" range from %f to %f\n", FIXED_TO_FLOAT(cvar->PossibleValue[0].value), - FIXED_TO_FLOAT(cvar->PossibleValue[1].value)); + { + float fu = FIXED_TO_FLOAT(cvar->PossibleValue[0].value); + float ck = FIXED_TO_FLOAT(cvar->PossibleValue[1].value); + CONS_Printf(" range from %ld%s to %ld%s\n", + (long)fu, M_Ftrim(fu), + (long)ck, M_Ftrim(ck)); + } else CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value, cvar->PossibleValue[1].value); @@ -1038,7 +1043,10 @@ static void COM_Add_f(void) } if (( cvar->flags & CV_FLOAT )) - CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2)))); + { + float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2)); + CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n))); + } else CV_AddValue(cvar, atoi(COM_Argv(2))); } diff --git a/src/m_menu.c b/src/m_menu.c index b856c3a8a..18dd43687 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3602,8 +3602,8 @@ static void M_ChangeCvar(INT32 choice) char s[20]; float increment; - increment = (currentMenu->menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5f : (1.0f/16.0f); - sprintf(s, "%f",FIXED_TO_FLOAT(cv->value)+(choice)*increment); + increment = FIXED_TO_FLOAT(cv->value)+(choice)*((currentMenu->menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5f : (1.0f/16.0f)); + sprintf(s,"%ld%s",(long)increment,M_Ftrim(increment)); CV_Set(cv, s); } else diff --git a/src/m_misc.c b/src/m_misc.c index c44086f4c..944fbb73c 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1965,6 +1965,25 @@ char *M_GetToken(const char *inputString) return texturesToken; } + +const char * M_Ftrim (double f) +{ + static char dig[9];/* "0." + 6 digits (6 is printf's default) */ + int i; + /* I know I said it's the default, but just in case... */ + sprintf(dig, "%.6f", fabs(modf(f, &f))); + /* trim trailing zeroes */ + for (i = strlen(dig)-1; dig[i] == '0'; --i) + ; + if (dig[i] == '.')/* :NOTHING: */ + return ""; + else + { + dig[i + 1] = '\0'; + return &dig[1];/* skip the 0 */ + } +} + /** Count bits in a number. */ UINT8 M_CountBits(UINT32 num, UINT8 size) diff --git a/src/m_misc.h b/src/m_misc.h index 013da2235..98fbdaee7 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -104,6 +104,12 @@ boolean M_IsPathAbsolute (const char *path); void M_MkdirEach (const char *path, int start, int mode); void M_MkdirEachUntil (const char *path, int start, int end, int mode); +/* +Return dot and then the fractional part of a float, without +trailing zeros, or "" if the fractional part is zero. +*/ +const char * M_Ftrim (double); + // counting bits, for weapon ammo code, usually FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size); From 236e7b8d45b07eeec9dc94b54eb0a7bf2bf95fd8 Mon Sep 17 00:00:00 2001 From: Indev Date: Wed, 4 Jun 2025 03:57:47 +0300 Subject: [PATCH 12/13] Fix game rendering only first splitscreen player in opengl --- src/d_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index d10ba05ab..a47c8b756 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -345,7 +345,7 @@ static void D_Renderview(void) { HWR_RenderPlayerView(); R_RestoreLevelInterpolators(); - return; + continue; } #endif if (issplitscreen) // Splitscreen-specific From 0a31e0a65e2ec99f9a2689755ea54ef32dd319a0 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 7 Jun 2025 02:35:49 +0200 Subject: [PATCH 13/13] use realloc for batching stuff seems to strangely speed things up even didnt think those happen often? --- src/hardware/hw_batching.c | 40 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index b8490f4ed..801442b6f 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -89,32 +89,23 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt { if (!pSurf) { - I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to + I_Error("Got a null FSurfaceInfo in batching"); // nulls should not come in the stuff that batching currently applies to } if (polygonArraySize == polygonArrayAllocSize) { - PolygonArrayEntry* new_array; - // ran out of space, make new array double the size + // ran out of space, double the array size polygonArrayAllocSize *= 2; - new_array = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry)); - memcpy(new_array, polygonArray, polygonArraySize * sizeof(PolygonArrayEntry)); - free(polygonArray); - polygonArray = new_array; + polygonArray = realloc(polygonArray, polygonArrayAllocSize * sizeof(PolygonArrayEntry)); // also need to redo the index array, dont need to copy it though - free(polygonArraySorted); - polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *)); + polygonArraySorted = realloc(polygonArraySorted, polygonArrayAllocSize * sizeof(PolygonArrayEntry*)); } while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize) { - FOutVector* new_array; // need more space for vertices in unsortedVertexArray unsortedVertexArrayAllocSize *= 2; - new_array = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector)); - memcpy(new_array, unsortedVertexArray, unsortedVertexArraySize * sizeof(FOutVector)); - free(unsortedVertexArray); - unsortedVertexArray = new_array; + unsortedVertexArray = realloc(unsortedVertexArray, unsortedVertexArrayAllocSize * sizeof(FOutVector)); } // add the polygon data to the arrays @@ -138,10 +129,11 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt } } + static int comparePolygons(const void *p1, const void *p2) { - PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1; - PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2; + const PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1; + const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2; int diff; INT64 diff64; @@ -177,9 +169,7 @@ static int comparePolygons(const void *p1, const void *p2) diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end; if (diff != 0) return diff; - diff = poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional; - - return diff; + return poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional; } static int comparePolygonsNoShaders(const void *p1, const void *p2) @@ -328,19 +318,11 @@ void HWR_RenderBatches(void) // probably never will this loop run more than once though while (finalVertexWritePos + numVerts > finalVertexArrayAllocSize) { - FOutVector* new_array; - unsigned int* new_index_array; finalVertexArrayAllocSize *= 2; - new_array = malloc(finalVertexArrayAllocSize * sizeof(FOutVector)); - memcpy(new_array, finalVertexArray, finalVertexWritePos * sizeof(FOutVector)); - free(finalVertexArray); - finalVertexArray = new_array; + finalVertexArray = realloc(finalVertexArray, finalVertexArrayAllocSize * sizeof(FOutVector)); // also increase size of index array, 3x of vertex array since // going from fans to triangles increases vertex count to 3x - new_index_array = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32)); - memcpy(new_index_array, finalVertexIndexArray, finalIndexWritePos * sizeof(UINT32)); - free(finalVertexIndexArray); - finalVertexIndexArray = new_index_array; + finalVertexIndexArray = realloc(finalVertexIndexArray, finalVertexArrayAllocSize * 3 * sizeof(UINT32)); } // write the vertices of the polygon memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[entry->vertsIndex],