From 38b862ff16111b4649b449dff7a91af395c9db4f Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 10 May 2025 18:56:24 +0200 Subject: [PATCH 01/17] Revert "skinlocal deez nuts" This reverts commit 12ec3d11a2d9acd62193d5fafa169527fa6e7f01. i hate localskins so much its unreal --- src/k_kart.c | 5 +++-- src/p_enemy.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 3f3048278..f58a33395 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10658,6 +10658,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags) const skin_t *skin; player_t *player = mo->player; + const boolean skinlocal = mo->skinlocal; fixed_t amnumxpos, amnumypos; INT32 amxpos, amypos, wntdamxpos, wntdamypos; @@ -10670,7 +10671,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags) #endif skin = K_GetMobjSkin(mo); - minimaphead = R_GetSkinFaceMini(player); + minimaphead = (skinlocal ? localfacemmapprefix : facemmapprefix)[K_GetMobjSkinNum(skin, skinlocal)]; amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), minimapinfo.zoom) - minimapinfo.offs_x); amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), minimapinfo.zoom) - minimapinfo.offs_y); @@ -10720,7 +10721,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags) if (mo->colorized) colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE); else - colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, mo->skinlocal); + colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal); V_DrawFixedPatch(amxpos, amypos, scale, flags, minimaphead, colormap); diff --git a/src/p_enemy.c b/src/p_enemy.c index 195df59b0..d500a0cb2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3996,7 +3996,10 @@ void A_SignPlayer(mobj_t *actor) if (LUA_CallAction(A_SIGNPLAYER, actor)) return; - if (!actor->target || !actor->target->player) + if (!actor->target) + return; + + if (!actor->target->player) return; // Set the sign to be an appropriate background color for this player's skincolor. @@ -4011,9 +4014,11 @@ void A_SignPlayer(mobj_t *actor) // needs - 1 or else it pukes an error out // same thing happens on p_mobj.c + if (actor->target->skinlocal) + ov->localskin = &localskins[actor->target->player->localskin - 1]; + else if (actor->target->player->localskin) + ov->localskin = &skins[actor->target->player->localskin - 1]; ov->skinlocal = actor->target->skinlocal; - if (ov->skinlocal || actor->target->player->localskin) - ov->localskin = &K_GetSkinArray(ov->skinlocal)[actor->target->player->localskin - 1]; P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN } From 23a9afb72758684c05015346cdd9d3d19dac9729 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 10 May 2025 18:59:27 +0200 Subject: [PATCH 02/17] fix typo in rumble reset --- src/g_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_input.c b/src/g_input.c index 41c11c204..85de4c6ec 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -969,7 +969,7 @@ void G_ResetAllDeviceRumbles(void) for (i = 0; i < devices; i++) { - I_GamepadRumble(devices, 0, 0, 0); + I_GamepadRumble(i, 0, 0, 0); } } From 8b5fd5f6467ad3c4495b96c7d61125ec4277bd78 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 10 May 2025 19:16:32 +0200 Subject: [PATCH 03/17] fix saturn menu --- src/m_menu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 3e8832853..c1abd2903 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2303,25 +2303,25 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35}, {IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 45}, - {IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 40}, + {IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 50}, - {IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 50}, + {IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 60}, - {IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 60}, + {IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 70}, - {IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 70}, + {IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 80}, - {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 80}, + {IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 90}, - {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 90}, + {IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 100}, - {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 100}, + {IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 110}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 110}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 120}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 120}, - {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 125}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 130}, // uwu + {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 }; static const char* OP_SaturnTooltips[] = From 121540f428b2a93e4879e8b8e61b4af480dc82df Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 10 May 2025 21:37:16 +0200 Subject: [PATCH 04/17] dont check for how many controllers just attempt to reset "all" JoyInfo->dev will be null The crash before was most likely due to an oob read --- src/g_input.c | 5 +---- src/sdl/i_system.c | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 85de4c6ec..963663504 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -963,11 +963,8 @@ static void G_ResetPlayerDeviceRumble(INT32 playernum) void G_ResetAllDeviceRumbles(void) { int i; - int devices; - devices = I_NumJoys(); - - for (i = 0; i < devices; i++) + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { I_GamepadRumble(i, 0, 0, 0); } diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index b622c4c45..549fdf7bd 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1485,6 +1485,7 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, (void)duration; #else SDL_GameController *controller = JoyInfo[playernum].dev; + if (controller == NULL) { return; @@ -1503,6 +1504,7 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b (void)blue; #else SDL_GameController *controller = JoyInfo[playernum].dev; + if (controller == NULL) { return; From ec0ca0d1abd63e8cb70012630422fe624706fbb5 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 10 May 2025 23:42:30 +0200 Subject: [PATCH 05/17] unlock everything when using modkartdata save doesent make too much sense having to unlock everything again when playing mods --- src/g_game.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index bf1ce0206..44b9cf370 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -626,6 +626,17 @@ static void G_SetSaveGameModified(void) strcatbf(savegamename, srb2home, PATHSEP); G_LoadGameData(); + + // unlock EVERYTHING. + for (UINT8 i = 0; i < MAXUNLOCKABLES; i++) + { + if (!unlockables[i].conditionset) + continue; + if (!unlockables[i].unlocked) + { + unlockables[i].unlocked = true; + } + } } // for consistency among messages: this modifies the game and removes savemoddata. From f263585a72b70ab23add047774c8786faa688736 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 00:33:39 +0200 Subject: [PATCH 06/17] make this check like vanilla did --- src/hardware/hw_md2.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index de78808e6..418e7340a 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1060,7 +1060,6 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk { // mostly copied from HWR_GetMappedPatch, hence the similarities and comment GLPatch_t *glPatch = patch->hardware; - GLPatch_t *glBlendPatch = NULL; GLMipmap_t *glMipmap, *newMipmap; @@ -1071,14 +1070,6 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk return; } - if ((blendgpatch && (glBlendPatch = blendgpatch->hardware) && glBlendPatch->mipmap->format) - && (patch->width != blendgpatch->width || patch->height != blendgpatch->height)) - { - // Blend image exists, but it's bad. - GL_SetTexture(glPatch->mipmap); - return; - } - // search for the Mipmap // skip the first (no colormap translated) for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; ) @@ -1330,7 +1321,9 @@ void HWR_DrawMD2(gl_vissprite_t *spr) if (gpatch && hwrPatch && hwrPatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture { - if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE) + if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE && + blendgpatch && hwrBlendPatch->mipmap->format + && gpatch->width == blendgpatch->width && gpatch->height == blendgpatch->height) { INT32 tcskinnum = TC_DEFAULT; if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash" From 463778cd88ea4a9e290e38aab5f0e13c509ae1ff Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 01:22:38 +0200 Subject: [PATCH 07/17] fix 3d models tanking performance to hell --- src/hardware/hw_data.h | 1 - src/hardware/hw_md2.c | 26 ++++++++++---------------- src/hardware/hw_md2.h | 2 ++ 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index f253eccb8..45d072c28 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -75,7 +75,6 @@ struct GLPatch_s { GLMipmap_t *mipmap; float max_s,max_t; - boolean notfound; // if the texture file was not found, mark it here (used in model texture loading) }; typedef struct GLPatch_s GLPatch_t; diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 418e7340a..0de904716 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -397,7 +397,7 @@ static void md2_loadTexture(md2_t *model) glPatch->mipmap->format = PCX_Load(filename, &w, &h, glPatch); if (glPatch->mipmap->format == 0) { - glPatch->notfound = true;// mark it so its not searched for again repeatedly + model->notexturefile = true; // mark it so its not searched for again repeatedly return; } @@ -468,7 +468,7 @@ static void md2_loadBlendTexture(md2_t *model) glPatch->mipmap->format = PCX_Load(filename, &w, &h, glPatch); if (glPatch->mipmap->format == 0) { - glPatch->notfound = true;// mark it so its not searched for again repeatedly + model->noblendfile = true; // mark it so its not searched for again repeatedly Z_Free(filename); return; } @@ -505,6 +505,8 @@ void HWR_InitMD2(void) md2_playermodels[s].model = NULL; md2_playermodels[s].glpatch = NULL; md2_playermodels[s].skin = -1; + md2_playermodels[s].notexturefile = false; + md2_playermodels[s].noblendfile = false; md2_playermodels[s].notfound = true; md2_playermodels[s].error = false; } @@ -514,6 +516,8 @@ void HWR_InitMD2(void) md2_localplayermodels[s].model = NULL; md2_localplayermodels[s].glpatch = NULL; md2_localplayermodels[s].skin = -1; + md2_localplayermodels[s].notexturefile = false; + md2_localplayermodels[s].noblendfile = false; md2_localplayermodels[s].notfound = true; md2_localplayermodels[s].error = false; } @@ -523,6 +527,8 @@ void HWR_InitMD2(void) md2_models[i].model = NULL; md2_models[i].glpatch = NULL; md2_models[i].skin = -1; + md2_models[s].notexturefile = false; + md2_models[s].noblendfile = false; md2_models[i].notfound = true; md2_models[i].error = false; } @@ -543,21 +549,10 @@ void HWR_InitMD2(void) } while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4) { - /*if (stricmp(name, "PLAY") == 0) - { - CONS_Printf("MD2 for sprite PLAY detected in mdls.dat, use a player skin instead!\n"); - continue; - }*/ - // 8/1/19: Allow PLAY to load for default MD2. - for (i = 0; i < NUMSPRITES; i++) { if (stricmp(name, sprnames[i]) == 0) { - //if (stricmp(name, "PLAY") == 0) - //continue; - - //CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset); md2_models[i].scale = scale; md2_models[i].offset = offset; md2_models[i].notfound = false; @@ -570,7 +565,6 @@ void HWR_InitMD2(void) { if (stricmp(name, skins[s].name) == 0) { - //CONS_Printf(" Found: %s %s %f %f\n", name, filename, scale, offset); md2_playermodels[s].skin = s; md2_playermodels[s].scale = scale; md2_playermodels[s].offset = offset; @@ -1296,7 +1290,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr) hwrPatch = ((GLPatch_t *)gpatch->hardware); if (!gpatch || !hwrPatch - || ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !hwrPatch->notfound)) + || ((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile)) md2_loadTexture(md2); // Load it again, because it isn't being loaded into gpatch after md2_loadtexture... @@ -1311,7 +1305,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr) if ((gpatch && hwrPatch && hwrPatch->mipmap->format) // don't load the blend texture if the base texture isn't available && (!blendgpatch || !hwrBlendPatch - || ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !hwrPatch->notfound))) + || ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile))) md2_loadBlendTexture(md2); // Load it again, because it isn't being loaded into blendgpatch after md2_loadblendtexture... diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index e9eafd387..2e3e005b7 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -29,7 +29,9 @@ typedef struct float offset; model_t *model; void *glpatch; + boolean notexturefile; // true if texture file was not found void *blendglpatch; + boolean noblendfile; // true if blend texture file was not found boolean notfound; INT32 skin; boolean error; From 001a38bbd20749ffe40bc4e89bd8ea28ea81de5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 10 May 2025 23:09:08 +0200 Subject: [PATCH 08/17] Fix off-by-one buffer overflow when getting LUT 255 --- src/v_video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v_video.h b/src/v_video.h index c8f614afc..00d0f6cb2 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -45,7 +45,7 @@ typedef struct { boolean init; RGBA_t palette[256]; - UINT16 table[0xFFFF]; + UINT16 table[0x10000]; } colorlookup_t; void InitColorLUT(colorlookup_t *lut, RGBA_t *palette, boolean makecolors); From 7bb3e4445e524db32dc2fc9fbd0f8a588af93864 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 15:14:54 +0200 Subject: [PATCH 09/17] change colourized speeline behaviour slightly "driftonly" will tone the lines completely instead of alternating between blue and driftcharge "normal" will completely colourize speedlines in the player colour --- src/k_kart.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index f58a33395..b3e94be6c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5617,9 +5617,12 @@ static boolean K_SpeedLinesShouldBlend(player_t *player) static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed) { UINT8 speedcolor = SKINCOLOR_NONE; + const UINT8 playercolor = player->mo->color; if (colorSpeed) { + speedcolor = playercolor; + if (cv_coloredspeedlines.value >= 2 && player->kartstuff[k_driftboost]) { if (player->kartstuff[k_driftboost] <= 20) @@ -5628,9 +5631,10 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed) speedcolor = SKINCOLOR_RASPBERRY; else if (player->kartstuff[k_driftboost] <= 125) speedcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); - } - speedcolor = (leveltime & 1) ? ((cv_coloredspeedlines.value == 3) ? SKINCOLOR_NONE : player->mo->color) : speedcolor; + if (cv_coloredspeedlines.value == 2) + speedcolor = (leveltime & 1) ? playercolor : speedcolor; + } } if (cv_coloredspeedlines.value != 3) @@ -5642,7 +5646,7 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed) } else if (player->kartstuff[k_invincibilitytimer]) { - speedcolor = player->mo->color; + speedcolor = playercolor; } } From d5583ba0401fc10a98bb2bec6b122f6f379ee1b6 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 15:24:22 +0200 Subject: [PATCH 10/17] add "nofork" parameter to disable process forking might be useful for gdb and perf --- src/sdl/i_system.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 549fdf7bd..e23f155e0 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1923,7 +1923,10 @@ INT32 I_StartupSystem(void) SDL_GetVersion(&SDLlinked); I_StartupConsole(); #ifdef NEWSIGNALHANDLER - I_Fork(); + // This is useful when debugging. It lets GDB attach to + // the correct process easily. + if (!M_CheckParm("-nofork")) + I_Fork(); #endif #ifdef HAVE_THREADS I_start_threads(); @@ -2215,9 +2218,10 @@ void I_ShutdownSystem(void) { INT32 c; -#ifndef NEWSIGNALHANDLER - I_ShutdownConsole(); +#ifdef NEWSIGNALHANDLER + if (M_CheckParm("-nofork")) #endif + I_ShutdownConsole(); for (c = MAX_QUIT_FUNCS-1; c >= 0; c--) if (quit_funcs[c]) From 93d87e1132f8d3199d4ebfe4f18703daaaf3439e Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 17:13:04 +0200 Subject: [PATCH 11/17] fix oob write when map has playerstarts for 32 players playerstarts is MAXPLAYERS big, which is 16 for us --- src/p_mobj.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 3780ef949..bb894538e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11034,9 +11034,17 @@ void P_SpawnMapThing(mapthing_t *mthing) // check for players specially if (mthing->type > 0 && mthing->type <= 32) { - // save spots for respawning in network games - if (!metalrecording) - playerstarts[mthing->type-1] = mthing; + if (mthing->type > MAXPLAYERS) // be wary of playerstarts size! playerstarts[MAXPLAYERS] + { + CONS_Alert(CONS_ERROR, "Excess player start detected %d This will crash vanilla clients!\n", mthing->type); + } + else + { + // save spots for respawning in network games + if (!metalrecording) + playerstarts[mthing->type-1] = mthing; + } + return; } From cb8930fef6695c362b104facc52c242c9af9ffa9 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 17:13:22 +0200 Subject: [PATCH 12/17] v8.1 --- src/doomdef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 4c4a2a3aa..ab6385659 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -113,8 +113,8 @@ extern char logfilename[1024]; #else #define VERSION 1 // Game version #define SUBVERSION 6 // more precise version number -#define VERSIONSTRING "Saturn v8" -#define VERSIONSTRINGW L"Saturn v8" +#define VERSIONSTRING "Saturn v8.1" +#define VERSIONSTRINGW L"Saturn v8.1" // Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates! // And change CMakeLists.txt (not src/, but in root), for CMake users! // AND appveyor.yml, for the build bots! From 6f7947dd5feff15c7e0c3a5e98a1022143b4ac85 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 17:40:17 +0200 Subject: [PATCH 13/17] fix smol oopsie for colourized speedlines --- src/k_kart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index b3e94be6c..466c5cc9f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5621,7 +5621,8 @@ static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed) if (colorSpeed) { - speedcolor = playercolor; + if (cv_coloredspeedlines.value != 3) + speedcolor = playercolor; if (cv_coloredspeedlines.value >= 2 && player->kartstuff[k_driftboost]) { From 9d54baf5440b52809e73cfc696bf8fa380022a39 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 18:47:19 +0200 Subject: [PATCH 14/17] fix minimap angle display in encoremode --- src/k_kart.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 466c5cc9f..c63433fb4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10884,6 +10884,9 @@ static void K_drawKartMinimap(void) angle_t ang = R_InterpolateAngle(mobj->old_angle, mobj->angle); + if (encoremode) + ang = ANGLE_180 - ang; + if (mobj->colorized) colormap = R_GetTranslationColormap(TC_RAINBOW, mobj->color, GTC_CACHE); else From 740de2babec6033c747c6debd78220734d1bcd8c Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 12 May 2025 06:12:11 +0200 Subject: [PATCH 15/17] fix replay saving during intermission with manual save --- src/g_game.c | 1 - src/p_tick.c | 2 +- src/y_inter.c | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 44b9cf370..17feba6e3 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3281,7 +3281,6 @@ demointermission: void G_AfterIntermission(void) { HU_ClearCEcho(); - //G_NextLevel(); if (demo.playback) { diff --git a/src/p_tick.c b/src/p_tick.c index 212c2f1e6..3c4583322 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -845,7 +845,7 @@ void P_Ticker(boolean run) // if there are no players left at all, stop demo recording // Demos that that dont have any players crash during playback, which can happen with dedicated servers if (demo.savemode == DSM_WILLAUTOSAVE && !D_NumPlayers()) - G_ResetDemoRecording(); + G_SaveDemo(); } } else if (demo.playback) // Use Ghost data for consistency checks. diff --git a/src/y_inter.c b/src/y_inter.c index 65871cc78..980ed0294 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -608,8 +608,6 @@ void Y_Ticker(void) if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE) G_SaveDemo(); - else if (demo.savemode != DSM_TITLEENTRY) - G_ResetDemoRecording(); } // Check for pause or menu up in single player From 8abab58a5ca8b472a4e5f3cd9dc214b48fccd2a3 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 12 May 2025 18:02:20 +0300 Subject: [PATCH 16/17] Fix game crashing when attempting to print '%s has no field named %s' for few lua userdata objects --- src/lua_consolelib.c | 2 +- src/lua_infolib.c | 4 ++-- src/lua_mobjlib.c | 4 ++-- src/lua_playerlib.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 7ddf1a1d7..e1e246d28 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -629,7 +629,7 @@ static int cvar_get(lua_State *L) break; default: if (devparm) - return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, field); + return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, lua_tostring(L, 2)); else return 0; } diff --git a/src/lua_infolib.c b/src/lua_infolib.c index a82fc947d..3ff2d97ae 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -385,7 +385,7 @@ static int state_get(lua_State *L) default: { if (devparm) - return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field); + return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, lua_tostring(L, 2)); return 0; } } @@ -462,7 +462,7 @@ static int state_set(lua_State *L) break; default: - return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field); + return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, lua_tostring(L, 2)); } return 0; diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 44c43297f..504a1e130 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -877,7 +877,7 @@ static int mapthing_get(lua_State *L) break; default: if (devparm) - return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field); + return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, lua_tostring(L, 2)); else return 0; } @@ -931,7 +931,7 @@ static int mapthing_set(lua_State *L) mt->mobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); break; default: - return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field); + return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, lua_tostring(L, 2)); } return 0; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 0b3f9cc1d..9562c5679 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -707,8 +707,8 @@ static int kartstuff_len(lua_State *L) return 1; } -#define NOFIELD luaL_error(L, LUA_QL("ticcmd_t") " has no field named " LUA_QS, field) -#define NOSET luaL_error(L, LUA_QL("ticcmd_t") " field " LUA_QS " should not be set directly.", field) +#define NOFIELD luaL_error(L, LUA_QL("ticcmd_t") " has no field named " LUA_QS, lua_tostring(L, 2)) +#define NOSET luaL_error(L, LUA_QL("ticcmd_t") " field " LUA_QS " should not be set directly.", lua_tostring(L, 2)) enum ticcmd_e { From bc130ce1f9451bdd27dae6a72c016517b197c0e8 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 13 May 2025 04:07:48 +0200 Subject: [PATCH 17/17] clamp screentexture size to maximum supported texture resolution also moves everything into GL_SetModelView again also means screen texture sizes wont be recalculated every frame anymore --- src/hardware/r_opengl/r_opengl.c | 113 ++++++++++++++----------------- src/hardware/r_opengl/r_opengl.h | 2 - src/sdl/ogl_sdl.c | 13 ---- 3 files changed, 52 insertions(+), 76 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 0533d3676..ce8d11f2a 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -102,6 +102,8 @@ RGBA_t myPaletteData[256]; // the palette for converting textures to RGBA static GLint gltexformat = GL_RGB5_A1; GLint screen_width = 0; // used by Draw2DLine() GLint screen_height = 0; +GLint screen_texsizew = 512; // Power-of-two screen texture render resolution +GLint screen_texsizeh = 512; // Power-of-two screen texture render resolution GLbyte screen_depth = 0; GLint maximumAnisotropy = 0; static GLboolean MipMap = GL_FALSE; @@ -129,6 +131,8 @@ GLuint FramebufferObject, FramebufferTexture, RenderbufferObject; boolean supportFBO = false; static boolean fboinit = false; + +static void GL_Framebuffer_DeleteAttachments(void); #endif // Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing @@ -991,8 +995,43 @@ static void GL_Perspective(GLfloat fovy, GLfloat aspect) // -----------------+ void GL_SetModelView(GLint w, GLint h) { + GLint maxtexsize = 0; //GL_DBG_Printf("SetModelView(): %dx%d\n", (int)w, (int)h); + // The screen textures need to be flushed if the width or height change so that they be remade for the correct size + if (screen_width != w || screen_height != h) + { + GL_FlushScreenTextures(); + +#ifdef USE_FBO_OGL + GL_Framebuffer_DeleteAttachments(); +#endif + } + + screen_width = (GLint)w; + screen_height = (GLint)h; + + screen_texsizew = screen_texsizeh = 512; + + // look for power of two that is large enough for the screen + while (screen_texsizew < w) + screen_texsizew <<= 1; + + while (screen_texsizeh < h) + screen_texsizeh <<= 1; + + pglGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexsize); // Get the maximum supported texture size + if ((screen_texsizew > maxtexsize || screen_texsizeh > maxtexsize) && maxtexsize > 0) + { + // The desired screen texture resolution is too big for the player's GPU! + CONS_Alert(CONS_WARNING, "Tried to make a screen texture for a %dx%d game resolution, but your GPU only supports up to %dx%d! Please switch to the software renderer or lower your game resolution.\n", w, h, maxtexsize, maxtexsize); + + // For now, let's just pray that clamping it to the maximum supported size "works" + // There'll be a stretchy "border" artefact, but it's better than failing to make the screen textures + screen_texsizew = min(screen_texsizew, maxtexsize); + screen_texsizeh = min(screen_texsizeh, maxtexsize); + } + pglViewport(0, 0, w, h); pglMatrixMode(GL_PROJECTION); @@ -1122,7 +1161,7 @@ static void GL_Framebuffer_GenerateAttachments(void) fboinit = true; } -void GL_Framebuffer_DeleteAttachments(void) +static void GL_Framebuffer_DeleteAttachments(void) { if (!supportFBO || fboinit == false) return; @@ -2918,7 +2957,6 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]) INT32 x, y; float float_x, float_y, float_nextx, float_nexty; float xfix, yfix; - INT32 texsizew = 512, texsizey = 512; const float blackBack[16] = { @@ -2931,16 +2969,9 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]) if (gl_enable_screen_textures != 2) return; - // look for power of two that is large enough for the screen - while (texsizew < screen_width) - texsizew <<= 1; - - while (texsizey < screen_height) - texsizey <<= 1; - // X/Y stretch fix for all resolutions(!) - xfix = (float)(texsizew)/((float)((screen_width)/(float)(SCREENVERTS-1))); - yfix = (float)(texsizey)/((float)((screen_height)/(float)(SCREENVERTS-1))); + xfix = (float)(screen_texsizew)/((float)((screen_width)/(float)(SCREENVERTS-1))); + yfix = (float)(screen_texsizeh)/((float)((screen_height)/(float)(SCREENVERTS-1))); pglDisable(GL_DEPTH_TEST); pglDisable(GL_BLEND); @@ -3014,7 +3045,6 @@ void GL_FlushScreenTextures(void) void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags) { float xfix, yfix; - INT32 texsizew = 512, texsizey = 512; const float screenVerts[12] = { @@ -3029,15 +3059,8 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags) if (gl_enable_screen_textures != 2) return; - // look for power of two that is large enough for the screen - while (texsizew < screen_width) - texsizew <<= 1; - - while (texsizey < screen_height) - texsizey <<= 1; - - xfix = 1/((float)(texsizew)/((float)((screen_width)))); - yfix = 1/((float)(texsizey)/((float)((screen_height)))); + xfix = 1/((float)(screen_texsizew)/((float)((screen_width)))); + yfix = 1/((float)(screen_texsizeh)/((float)((screen_height)))); // const float screenVerts[12] @@ -3070,7 +3093,6 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags) // Do screen fades! void GL_DoScreenWipe(int wipeStart, int wipeEnd) { - INT32 texsizew = 512, texsizey = 512; float xfix, yfix; INT32 fademaskdownloaded = tex_downloaded; // the fade mask that has been set @@ -3096,15 +3118,8 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd) if (!gl_enable_screen_textures) return; - // look for power of two that is large enough for the screen - while (texsizew < screen_width) - texsizew <<= 1; - - while (texsizey < screen_height) - texsizey <<= 1; - - xfix = 1/((float)(texsizew)/((float)((screen_width)))); - yfix = 1/((float)(texsizey)/((float)((screen_height)))); + xfix = 1/((float)(screen_texsizew)/((float)((screen_width)))); + yfix = 1/((float)(screen_texsizeh)/((float)((screen_height)))); // const float screenVerts[12] @@ -3162,7 +3177,6 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd) void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) { - INT32 texsizew = 512, texsizey = 512; int tex = HWD_SCREENTEXTURE_VHS; float xfix, yfix; float fix[8]; @@ -3180,15 +3194,8 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 if (gl_enable_screen_textures != 2) return; - // look for power of two that is large enough for the screen - while (texsizew < screen_width) - texsizew <<= 1; - - while (texsizey < screen_height) - texsizey <<= 1; - - xfix = 1/((float)(texsizew)/((float)((screen_width)))); - yfix = 1/((float)(texsizey)/((float)((screen_height)))); + xfix = 1/((float)(screen_texsizew)/((float)((screen_width)))); + yfix = 1/((float)(screen_texsizeh)/((float)((screen_height)))); // Slight fuzziness GL_MakeScreenTexture(tex); @@ -3272,19 +3279,11 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 // Create a texture from the screen. void GL_MakeScreenTexture(int tex) { - INT32 texsizew = 512, texsizey = 512; boolean firstTime = (screenTextures[tex] == 0); if (!gl_enable_screen_textures) return; - // look for power of two that is large enough for the screen - while (texsizew < screen_width) - texsizew <<= 1; - - while (texsizey < screen_height) - texsizey <<= 1; - // Create screen texture if (firstTime) pglGenTextures(1, &screenTextures[tex]); @@ -3296,10 +3295,10 @@ void GL_MakeScreenTexture(int tex) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); - pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsizew, texsizey, 0); + pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, screen_texsizew, screen_texsizeh, 0); } else - pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsizew, texsizey); + pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, screen_texsizew, screen_texsizeh); tex_downloaded = screenTextures[tex]; } @@ -3310,7 +3309,6 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh float origaspect, newaspect; float xoff = 1, yoff = 1; // xoffset and yoffset for the polygon to have black bars around the screen FRGBAFloat clearColour; - INT32 texsizew = 512, texsizey = 512; float off[12]; float fix[8]; @@ -3318,15 +3316,8 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh if (gl_enable_screen_textures != 2) return; - // look for power of two that is large enough for the screen - while (texsizew < screen_width) - texsizew <<= 1; - - while (texsizey < screen_height) - texsizey <<= 1; - - xfix = 1/((float)(texsizew)/((float)((screen_width)))); - yfix = 1/((float)(texsizey)/((float)((screen_height)))); + xfix = 1/((float)(screen_texsizew)/((float)((screen_width)))); + yfix = 1/((float)(screen_texsizeh)/((float)((screen_height)))); origaspect = (float)screen_width / screen_height; newaspect = (float)width / height; diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h index 2f2b9ba98..b70febad4 100644 --- a/src/hardware/r_opengl/r_opengl.h +++ b/src/hardware/r_opengl/r_opengl.h @@ -103,8 +103,6 @@ extern PFNglGetString pglGetString; #endif #ifdef USE_FBO_OGL -void GL_Framebuffer_DeleteAttachments(void); - void GL_Framebuffer_Unbind(void); void GL_Framebuffer_Enable(void); void GL_Framebuffer_Disable(void); diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index d6805cf21..d4dec6124 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -221,19 +221,6 @@ boolean OglSdlSurface(INT32 w, INT32 h) SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0); - // The screen textures need to be flushed if the width or height change so that they be remade for the correct size - if (screen_width != w || screen_height != h) - { - GL_FlushScreenTextures(); - -#ifdef USE_FBO_OGL - GL_Framebuffer_DeleteAttachments(); -#endif - } - - screen_width = (GLint)w; - screen_height = (GLint)h; - GL_SetModelView(w, h); GL_SetStates(); pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);