From 30f11e4e463208e8e0b3d482050dd78321d11c34 Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 25 Jan 2025 01:09:43 +0300 Subject: [PATCH 1/6] Fix 'total podium' stat display using totalwins --- 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 0c1882fef..e1b00d4ac 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8829,7 +8829,7 @@ static void M_DrawStatsExtra(void) DRAWTIMESTAT(52, "Time spent in spinout:", spinouttime); DRAWAMOUNTSTAT(72, "Total wins:", totalwins); - DRAWAMOUNTSTAT(82, "Total podium (2nd/3rd place):", totalwins); + DRAWAMOUNTSTAT(82, "Total podium (2nd/3rd place):", totalpodium); DRAWAMOUNTSTAT(102, "Hits landed:", hits); DRAWAMOUNTSTAT(112, "Self-hits landed:", selfhits); From 341d592001501da67c704dde0460b433fcd380c4 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 7 Mar 2025 14:45:28 +0100 Subject: [PATCH 2/6] show smol notice in stat and ra menu when game is modded --- src/m_menu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index e1b00d4ac..be0b3131f 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -475,6 +475,12 @@ static void Dummystaff_OnChange(void); // crap to force hud to show when in saturns hud options boolean forceshowhud = false; +// smol text indicating if game is modified +// so ppl dont wonder where their ra times went and stuff +#define SHOWMODDEDGAME \ + if (savemoddata) \ + V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Modified Game")); + // ========================================================================== // CONSOLE VARIABLES AND THEIR POSSIBLE VALUES GO HERE. // ========================================================================== @@ -8673,6 +8679,8 @@ static void M_DrawStatsMaps(void) extraemblem_t *exemblem; boolean dotopname = true, dobottomarrow = (location < statsMax); + SHOWMODDEDGAME + for (j = 0; j < NUMMAPS; j++) { if (!mapheaderinfo[j] || !(mapheaderinfo[j]->menuflags & LF2_RECORDATTACK)) @@ -8816,6 +8824,8 @@ static void M_DrawStatsPlaytime(void) if (kartstats.vanilla) return; + SHOWMODDEDGAME + DRAWTIMESTAT(82, "RA Play Time:", raplaytime); DRAWTIMESTAT(92, "Online Play Time:", onlineplaytime); DRAWTIMESTAT(102, "Race Play Time:", raceplaytime); @@ -8825,6 +8835,8 @@ static void M_DrawStatsPlaytime(void) // Note: only available with non-vanilla stats loaded, so it doesn't check for that static void M_DrawStatsExtra(void) { + SHOWMODDEDGAME + DRAWTIMESTAT(42, "Time being SPB target:", spbtargettime); DRAWTIMESTAT(52, "Time spent in spinout:", spinouttime); @@ -8946,6 +8958,8 @@ void M_DrawTimeAttackMenu(void) x = currentMenu->x; y = currentMenu->y; + SHOWMODDEDGAME + // Character face! if (W_CheckNumForName(skins[cv_chooseskin.value-1].facewant) != LUMPERROR) { From 2b299039e68a98ef21691a8026743f590c35ffb3 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 18 Apr 2025 12:35:09 +0200 Subject: [PATCH 3/6] reword this lel --- src/g_game.c | 2 +- src/m_menu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index b644e2796..231e94ffe 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -647,7 +647,7 @@ void G_SetGameModified(boolean silent, boolean major) G_SetSaveGameModified(); if (!silent) - CONS_Alert(CONS_NOTICE, M_GetText("Record Attack data will be saved to seperate save.\n")); + CONS_Alert(CONS_NOTICE, M_GetText("Record Attack data will be saved to a seperate save file.\n")); // If in record attack recording, cancel it. if (modeattacking) diff --git a/src/m_menu.c b/src/m_menu.c index be0b3131f..09ed017c5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6189,7 +6189,7 @@ static boolean M_AddonsRefresh(void) else if (majormods && !prevmajormods) { S_StartSound(NULL, sfx_s221); - message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack data will be saved to seperate save.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); + message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack data will be saved to a seperate save file.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); prevmajormods = majormods; } From c79f986a8f9c2db010f05df33c39b4af30f1ebb7 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 18 Apr 2025 12:52:24 +0200 Subject: [PATCH 4/6] make a backup of save data before writing to it --- src/g_game.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index 231e94ffe..73ca41898 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3643,6 +3643,7 @@ void G_SaveGameData(boolean force) UINT8 btemp; savebuffer_t save; (void)force; + char backupfile[MAX_WADPATH+4]; if (!gamedataloaded) return; // If never loaded (-nodata), don't save @@ -3654,6 +3655,23 @@ void G_SaveGameData(boolean force) return; } + // Create backup of the save data + snprintf(backupfile, sizeof(backupfile), "%s.bak", gamedatafilename); + backupfile[sizeof(backupfile) - 1] = '\0'; + + FILE *gamedata = fopen(gamedatafilename, "r"); + + if (gamedata != NULL) + { + fclose(gamedata); + + if (!FIL_CopyFile(gamedatafilename, backupfile)) + { + CONS_Alert(CONS_WARNING,"Failed to create a backup of save data. Will not attempt to write to save data\n"); + return; + } + } + // Version test WRITEUINT32(save.p, 0xFCAFE211); From 126d26cc988372fffa94e9797073de948b2e5ca1 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 19 Apr 2025 01:06:39 +0200 Subject: [PATCH 5/6] smol software stuffs --- src/r_segs.c | 53 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 8a9f0dc29..2b0700e4d 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1181,6 +1181,18 @@ static boolean R_FFloorCanClip(visffloor_t *pfloor) return (cv_ffloorclip.value && !R_IsFFloorTranslucent(pfloor) && !pfloor->polyobj); } +// R_ExpandPlaneY +// +// A simple function to modify a vsplane's top and bottom for a particular column +// Sort of like R_ExpandPlane in r_plane.c, except this is vertical expansion +static inline void R_ExpandPlaneY(visplane_t *pl, INT32 x, INT16 top, INT16 bottom) +{ + // Expand the plane, don't shrink it! + // note: top and bottom default to 0xFFFF and 0x0000 respectively, which is totally compatible with this + if (pl->top[x] > top) pl->top[x] = top; + if (pl->bottom[x] < bottom) pl->bottom[x] = bottom; +} + // // R_RenderSegLoop // Draws zero, one, or two textures (and possibly a masked @@ -1220,15 +1232,11 @@ static void R_RenderSegLoop (void) if (markceiling) { - bottom = yl-1; + bottom = yl > floorclip[rw_x] ? floorclip[rw_x] : yl; - if (bottom >= floorclip[rw_x]) - bottom = floorclip[rw_x]-1; - - if (top <= bottom && ceilingplane) + if (top <= --bottom && ceilingplane) { - ceilingplane->top[rw_x] = (INT16)top; - ceilingplane->bottom[rw_x] = (INT16)bottom; + R_ExpandPlaneY(ceilingplane, rw_x, top, bottom); } } @@ -1245,8 +1253,7 @@ static void R_RenderSegLoop (void) if (++top <= bottom && floorplane) { - floorplane->top[rw_x] = (INT16)top; - floorplane->bottom[rw_x] = (INT16)bottom; + R_ExpandPlaneY(floorplane, rw_x, top, bottom); } } @@ -1266,14 +1273,6 @@ static void R_RenderSegLoop (void) if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg)) continue; - // FIXME hack to fix planes disappearing when a seg goes behind the camera. This NEEDS to be changed to be done properly. -Red - if (curline->polyseg) { - if (ffloor[i].plane->minx > rw_x) - ffloor[i].plane->minx = rw_x; - else if (ffloor[i].plane->maxx < rw_x) - ffloor[i].plane->maxx = rw_x; - } - if (ffloor[i].height < viewz) { INT32 top_w = (ffloor[i].f_frac >> HEIGHTBITS) + 1; @@ -1286,7 +1285,7 @@ static void R_RenderSegLoop (void) bottom_w = bottom; // Polyobject-specific hack to fix plane leaking -Red - if (curline->polyseg && ffloor[i].polyobj && ffloor[i].polyobj == curline->polyseg && top_w >= bottom_w) { + if (ffloor[i].polyobj && top_w >= bottom_w) { ffloor[i].plane->top[rw_x] = ffloor[i].plane->bottom[rw_x] = 0xFFFF; } else @@ -1330,7 +1329,7 @@ static void R_RenderSegLoop (void) bottom_w = bottom; // Polyobject-specific hack to fix plane leaking -Red - if (curline->polyseg && ffloor[i].polyobj && ffloor[i].polyobj == curline->polyseg && top_w >= bottom_w) { + if (ffloor[i].polyobj && top_w >= bottom_w) { ffloor[i].plane->top[rw_x] = ffloor[i].plane->bottom[rw_x] = 0xFFFF; } else @@ -2816,6 +2815,22 @@ void R_StoreWallRange(INT32 start, INT32 stop) for (i = 0; i < numffloors; i++) R_ExpandPlane(ffloor[i].plane, rw_x, rw_stopx - 1); } + + // FIXME hack to fix planes disappearing when a seg goes behind the camera. This NEEDS to be changed to be done properly. -Red + if (curline->polyseg) + { + for (i = 0; i < numffloors; i++) + { + if (!ffloor[i].polyobj || ffloor[i].polyobj != curline->polyseg) + continue; + if (ffloor[i].plane->minx > rw_x) + ffloor[i].plane->minx = rw_x; + + if (ffloor[i].plane->maxx < rw_stopx - 1) + ffloor[i].plane->maxx = rw_stopx - 1; + } + } + } rw_silhouette = &(ds_p->silhouette); From c9faccae64671a5658cb64b6aa501abe20239bb9 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 19 Apr 2025 01:19:23 +0200 Subject: [PATCH 6/6] fix software sprite clipping --- src/r_things.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index c3a83880c..bf9b4e965 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1241,7 +1241,7 @@ static void R_ProjectSprite(mobj_t *thing) tx = FixedMul(tr_x, viewsin) - FixedMul(tr_y, viewcos); // sideways distance // too far off the side? - if (!papersprite && abs(tx) > FixedMul(tz, fovtan)<<2) // papersprite clipping is handled later + if (!papersprite && abs(tx) > tz<<2) // papersprite clipping is handled later return; // aspect ratio stuff @@ -1518,10 +1518,7 @@ static void R_ProjectSprite(mobj_t *thing) } // Compatibility with MSVC - SSNTails - scalestep = ((yscale2 - yscale) / range); - if (!scalestep) - scalestep = 1; - + scalestep = ((yscale2 - yscale)/range) ?: 1; xscale = FixedDiv(range< FixedMul(tz, fovtan)<<2) + if (abs(tx) > tz<<2) return; // aspect ratio stuff :