From 09ae350603e24d5fc06d2836383ee848e0f02c67 Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Sat, 20 Aug 2022 14:05:32 +0200 Subject: [PATCH 1/4] Increase maximum WAD count to 250 Can be increased up to 255 safely, just not 256. 5 slots left for shenanigans like Moe Mansion's WAD_MUSIC. --- src/w_wad.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/w_wad.h b/src/w_wad.h index ffe63e79..4b6ecb30 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -77,9 +77,10 @@ typedef struct // ========================================================================= #define MAX_WADPATH 512 -#define MAX_WADFILES 127 // maximum of wad files used at the same time -// Replay code relies on it being an UINT8 and, just to be safe, in case some wad counter somewhere is a SINT8, you should NOT go above 127 here if you're lazy like me. -// Besides, are there truly 127 wads worth your interrest? +#define MAX_WADFILES 250 // maximum of wad files used at the same time +// Replay code relies on it being an UINT8. There are no SINT8s handling WAD indices, though. +// Can be set all the way up to 255 but not 256 (as the latter breaks for loops with UINT8 indices). +// 5 slots are left open for tricks that hardmods might engage in, like Moe Mansion's WAD_MUSIC. #define lumpcache_t void * From d820b8e0c796eed0ce18f2832742ec75c97e9d32 Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Sat, 20 Aug 2022 14:08:14 +0200 Subject: [PATCH 2/4] Increase maximum skin count to 255 This time without spare slots, because I don't see shenanigans like WAD_MUSIC happening with skin indices. Verified to work by saving a replay with 139 skins as the 133th skin and playing it back a few times. Shouldn't cause issues with netcode either because there are no SINT8s handling skin indices. --- src/doomdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doomdef.h b/src/doomdef.h index 0de781c6..070130cb 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -227,7 +227,7 @@ extern char logfilename[1024]; // NOTE: it needs more than this to increase the number of players... #define MAXPLAYERS 16 -#define MAXSKINS 128 +#define MAXSKINS 255 #define PLAYERSMASK (MAXPLAYERS-1) #define MAXPLAYERNAME 21 From 477c848615d83cd1acd482d084f6f939d59112ba Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Sat, 20 Aug 2022 21:45:22 +0200 Subject: [PATCH 3/4] Bring the maximum WAD file count up to 255 Per @TehRealSalt's recommendation. --- src/w_wad.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/w_wad.h b/src/w_wad.h index 4b6ecb30..3ec33a30 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -77,10 +77,10 @@ typedef struct // ========================================================================= #define MAX_WADPATH 512 -#define MAX_WADFILES 250 // maximum of wad files used at the same time +#define MAX_WADFILES 255 // maximum of wad files used at the same time // Replay code relies on it being an UINT8. There are no SINT8s handling WAD indices, though. -// Can be set all the way up to 255 but not 256 (as the latter breaks for loops with UINT8 indices). -// 5 slots are left open for tricks that hardmods might engage in, like Moe Mansion's WAD_MUSIC. +// Can be set all the way up to 255 but not 256, +// because an UINT8 will never be >= 256, probably breaking some conditionals. #define lumpcache_t void * From b4ebbbad89c038fdb99389cc7e8c7fca22194d75 Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Sun, 21 Aug 2022 11:50:02 +0200 Subject: [PATCH 4/4] Remove the last SINT8 handling skin indices Thanks to Callmore's insistence on me sweeping through functions that return -1 on error. --- 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 3243e0fc..f98f917e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2381,7 +2381,7 @@ static void M_ChangeCvar(INT32 choice) { if (cv == &cv_playercolor) { - SINT8 skinno = R_SkinAvailable(cv_chooseskin.string); + INT32 skinno = R_SkinAvailable(cv_chooseskin.string); if (skinno != -1) CV_SetValue(cv,skins[skinno].prefcolor); return;