From e63d7537e05a9ec06e0c8c8a41b9b5f9c25781e4 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 14 Jan 2019 18:16:07 -0500 Subject: [PATCH 1/3] bump maxskins to 64, fix overflow error --- src/doomdef.h | 2 +- src/r_things.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index c44e70c0..70e521b1 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -244,7 +244,7 @@ extern FILE *logstream; // NOTE: it needs more than this to increase the number of players... #define MAXPLAYERS 16 -#define MAXSKINS 32 +#define MAXSKINS 64 #define PLAYERSMASK (MAXPLAYERS-1) #define MAXPLAYERNAME 21 diff --git a/src/r_things.c b/src/r_things.c index 1825d2d9..d6234d4b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2500,7 +2500,7 @@ void R_DrawMasked(void) // ========================================================================== INT32 numskins = 0; -skin_t skins[MAXSKINS+1]; +skin_t skins[MAXSKINS]; // FIXTHIS: don't work because it must be inistilised before the config load //#define SKINVALUES #ifdef SKINVALUES @@ -2771,7 +2771,7 @@ void R_AddSkins(UINT16 wadnum) // advance by default lastlump = lump + 1; - if (numskins > MAXSKINS) + if (numskins >= MAXSKINS) { CONS_Debug(DBG_RENDER, "ignored skin (%d skins maximum)\n", MAXSKINS); continue; // so we know how many skins couldn't be added From 6ba69e90025f4d601d015491f1772c53ccb52b0a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 14 Jan 2019 18:24:25 -0500 Subject: [PATCH 2/3] Missed this --- src/r_things.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.h b/src/r_things.h index a8635034..53784415 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -192,7 +192,7 @@ typedef struct drawnode_s } drawnode_t; extern INT32 numskins; -extern skin_t skins[MAXSKINS + 1]; +extern skin_t skins[MAXSKINS]; void SetPlayerSkin(INT32 playernum,const char *skinname); void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002 From 105958d29fcd0865eaee6893765cb80de690a204 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 15 Jan 2019 20:09:55 -0500 Subject: [PATCH 3/3] Update the (unused) SP menu stuff to use MAXSKINS --- src/dehacked.c | 4 ++-- src/m_menu.c | 47 ++++++++++++----------------------------------- src/m_menu.h | 2 +- 3 files changed, 15 insertions(+), 38 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index e7e1ae69..49b274d3 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -436,11 +436,11 @@ static void readAnimTex(MYFILE *f, INT32 num) static boolean findFreeSlot(INT32 *num) { // Send the character select entry to a free slot. - while (*num < 32 && PlayerMenu[*num].status != IT_DISABLED) + while (*num < MAXSKINS && PlayerMenu[*num].status != IT_DISABLED) *num = *num+1; // No more free slots. :( - if (*num >= 32) + if (*num >= MAXSKINS) return false; // Found one! ^_^ diff --git a/src/m_menu.c b/src/m_menu.c index 2241e826..4705a521 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -911,41 +911,7 @@ static menuitem_t SP_LevelStatsMenu[] = // External files modify this menu, so we can't call it static. // And I'm too lazy to go through and rename it everywhere. ARRGH! #define M_ChoosePlayer NULL -menuitem_t PlayerMenu[32] = -{ - {IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, - {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0} -}; +menuitem_t PlayerMenu[MAXSKINS]; // ----------------------------------- // Multiplayer and all of its submenus @@ -3188,6 +3154,8 @@ void M_Ticker(void) // void M_Init(void) { + UINT8 i; + COM_AddCommand("manual", Command_Manual_f); CV_RegisterVar(&cv_nextmap); @@ -3235,6 +3203,15 @@ void M_Init(void) quitmsg[QUIT3MSG5] = M_GetText("You'll be back to play soon, though...\n...right?\n\n(Press 'Y' to quit)"); quitmsg[QUIT3MSG6] = M_GetText("Aww, is Eggman's Nightclub too\ndifficult for you?\n\n(Press 'Y' to quit)"); + // Setup PlayerMenu table + for (i = 0; i < MAXSKINS; i++) + { + PlayerMenu[i].status = (i == 0 ? IT_CALL : IT_DISABLED); + PlayerMenu[i].patch = PlayerMenu[i].text = NULL; + PlayerMenu[i].itemaction = M_ChoosePlayer; + PlayerMenu[i].alphaKey = 0; + } + #ifdef HWRENDER // Permanently hide some options based on render mode if (rendermode == render_soft) diff --git a/src/m_menu.h b/src/m_menu.h index 9509004b..864f4cac 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -150,7 +150,7 @@ typedef struct menuitem_s UINT8 alphaKey; } menuitem_t; -extern menuitem_t PlayerMenu[32]; +extern menuitem_t PlayerMenu[MAXSKINS]; typedef struct menu_s {