From 71a0b25e32dfcd40031bc81c3579e14676c001e8 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 8 Apr 2026 22:33:09 +0200 Subject: [PATCH] remove old and unused menu player description stuff hope ignorelines is the correct thing to well ignore lines lol --- src/d_main.c | 4 - src/dehacked.c | 186 +++++++++-------------------------------------- src/doomdata.h | 2 +- src/m_menu.c | 63 ---------------- src/m_menu.h | 22 ------ src/m_menudefs.c | 6 -- 6 files changed, 34 insertions(+), 249 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 5655d0532..84abb528d 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1786,10 +1786,6 @@ void D_SRB2Main(void) // Setup default unlockable conditions M_SetupDefaultConditionSets(); - // Setup character tables - // Have to be done here before files are loaded - M_InitCharacterTables(); - // load wad, including the main wad file CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n"); diff --git a/src/dehacked.c b/src/dehacked.c index 9f7889945..c35092a91 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -280,149 +280,6 @@ static void clear_levels(void) P_AllocMapHeader(gamemap-1); } -static boolean findFreeSlot(INT32 *num) -{ - // Send the character select entry to a free slot. - while (*num < MAXSKINS && PlayerMenu[*num].status != IT_DISABLED) - *num = *num+1; - - // No more free slots. :( - if (*num >= MAXSKINS) - return false; - - // Found one! ^_^ - return true; -} - -// Reads a player. -// For modifying the character select screen -static void readPlayer(MYFILE *f, INT32 num) -{ - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word; - char *word2; - INT32 i; - boolean slotfound = false; - - do - { - if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - if (fastcmp(word, "PLAYERTEXT")) - { - char *playertext = NULL; - - if (!slotfound && (slotfound = findFreeSlot(&num)) == false) - goto done; - PlayerMenu[num].status = IT_CALL; - - // A friendly neighborhood alias for brevity's sake - const size_t note_size = sizeof(description[num].notes); - - for (i = 0; i < (INT32)(MAXLINELEN-note_size-3); i++) - { - if (s[i] == '=') - { - playertext = &s[i+2]; - break; - } - } - - if (playertext) - { - strlcpy(description[num].notes, playertext, note_size); - strlcat(description[num].notes, - myhashfgets(playertext, note_size, f), note_size); - } - else - strcpy(description[num].notes, ""); - - // For some reason, cutting the string did not work above. Most likely due to strcpy or strcat... - // It works down here, though. - { - INT32 numline = 0; - for (i = 0; (size_t)i < note_size-1; i++) - { - if (numline < 20 && description[num].notes[i] == '\n') - numline++; - - if (numline >= 20 || description[num].notes[i] == '\0' || description[num].notes[i] == '#') - break; - } - } - - description[num].notes[strlen(description[num].notes)-1] = '\0'; - description[num].notes[i] = '\0'; - continue; - } - - word2 = strtok(NULL, " = "); - if (word2) - strupr(word2); - else - break; - - if (word2[strlen(word2)-1] == '\n') - word2[strlen(word2)-1] = '\0'; - i = atoi(word2); - - if (fastcmp(word, "PICNAME")) - { - if (!slotfound && (slotfound = findFreeSlot(&num)) == false) - goto done; - PlayerMenu[num].status = IT_CALL; - strncpy(description[num].picname, word2, 8); - } - else if (fastcmp(word, "STATUS")) - { - // Limit the status to only IT_DISABLED and IT_CALL - if (i) - i = IT_CALL; - else - i = IT_DISABLED; - - /* - You MAY disable previous entries if you so desire... - But try to enable something that's already enabled and you will be sent to a free slot. - - Because of this, you are allowed to edit any previous entrys you like, but only if you - signal that you are purposely doing so by disabling and then reenabling the slot. - - ... Or use MENUPOSITION first, that works too. Hell, you could edit multiple character - slots in a single section that way, due to how SOC editing works. - */ - if (i != IT_DISABLED && !slotfound && (slotfound = findFreeSlot(&num)) == false) - goto done; - PlayerMenu[num].status = (INT16)i; - } - else if (fastcmp(word, "SKINNAME")) - { - // Send to free slot. - if (!slotfound && (slotfound = findFreeSlot(&num)) == false) - goto done; - PlayerMenu[num].status = IT_CALL; - - strlcpy(description[num].skinname, word2, sizeof description[num].skinname); - strlwr(description[num].skinname); - } - else - deh_warning("readPlayer %d: unknown word '%s'", num, word); - } - } while (!myfeof(f)); // finish when the line is empty - -done: - Z_Free(s); -} - static int freeslotusage[2][2] = {{0, 0}, {0, 0}}; // [S_, MT_][max, previous .wad's max] void DEH_UpdateMaxFreeslots(void) @@ -2820,6 +2677,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) // it doesn't test the version of SRB2 and version of dehacked file dbg_line = -1; // start at -1 so the first line is 0. + while (!myfeof(f)) { char origpos[256]; @@ -2847,11 +2705,15 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) strncpy(origpos, s, size); origpos[size] = '\0'; - if (NULL != (word = strtok(s, " "))) { + if (NULL != (word = strtok(s, " "))) + { strupr(word); - if (word[strlen(word)-1] == '\n') - word[strlen(word)-1] = '\0'; + const size_t wordlen = strlen(word); + + if (word[wordlen-1] == '\n') + word[wordlen-1] = '\0'; } + if (word) { if (fastcmp(word, "FREESLOT")) @@ -2872,32 +2734,46 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) // This is not a major mod. continue; } + word2 = strtok(NULL, " "); + if (fastcmp(word, "CHARACTER")) { - if (word2) { + if (word2) + { strupr(word2); - if (word2[strlen(word2)-1] == '\n') - word2[strlen(word2)-1] = '\0'; + const size_t wordlen = strlen(word2); + + if (word2[wordlen-1] == '\n') + word2[wordlen-1] = '\0'; + i = atoi(word2); - } else + } + else i = 0; + if (i >= 0 && i < 32) - readPlayer(f, i); + ignorelines(f); // unused else { deh_warning("Character %d out of range (0 - 31)", i); ignorelines(f); } + // This is not a major mod. continue; } + if (word2) { strupr(word2); - if (word2[strlen(word2)-1] == '\n') - word2[strlen(word2)-1] = '\0'; + const size_t wordlen = strlen(word2); + + if (word2[wordlen-1] == '\n') + word2[wordlen-1] = '\0'; + i = atoi(word2); + if (fastcmp(word, "PATCH")) { // Read patch from spec file. @@ -2908,6 +2784,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) { if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_mobjtype(word2); // find a thing by name + if (i < NUMMOBJTYPES && i >= 0) { if (i < (MT_FIRSTFREESLOT+freeslotusage[1][1])) @@ -2955,6 +2832,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) { if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_state(word2); // find a state by name + if (i < NUMSTATES && i >= 0) { if (i < (S_FIRSTFREESLOT+freeslotusage[0][1])) @@ -2971,6 +2849,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) { if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_sfx(word2); // find a sound by name + if (i < NUMSFX && i >= 0) readsound(f, i, savesfxnames); else @@ -2984,6 +2863,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) { if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_huditem(word2); // find a huditem by name + if (i >= 0 && i < NUMHUDITEMS) readhuditem(f, i); else diff --git a/src/doomdata.h b/src/doomdata.h index a646686f1..2f5e014c7 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -61,7 +61,7 @@ enum typedef struct { INT16 x, y; -}ATTRPACK mapvertex_t; +} ATTRPACK mapvertex_t; // A SideDef, defining the visual appearance of a wall, // by setting textures and offsets. diff --git a/src/m_menu.c b/src/m_menu.c index 2dc7119e4..7b20b8f41 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -149,9 +149,6 @@ M_waiting_mode_t m_waiting_mode = M_NOT_WAITING; const char *quitmsg[NUM_QUITMESSAGES] = {}; -// Stuff for customizing the player select screen Tails 09-22-2003 -description_t description[MAXSKINS] = {}; - INT32 mapwads[NUMMAPS] = {}; boolean browselocalskins = false; @@ -1996,8 +1993,6 @@ void M_Ticker(void) // void M_Init(void) { - UINT8 i; - COM_AddCommand("manual", Command_Manual_f); CV_RegisterVar(&cv_nextmap); @@ -2043,15 +2038,6 @@ 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) @@ -2106,55 +2092,6 @@ void M_Init(void) M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf); } -void M_InitCharacterTables(void) -{ - UINT8 i; - - // Setup PlayerMenu table - for (i = 0; i < MAXSKINS; i++) - { - PlayerMenu[i].status = (i < 4 ? IT_CALL : IT_DISABLED); - PlayerMenu[i].patch = PlayerMenu[i].text = NULL; - PlayerMenu[i].itemaction = M_ChoosePlayer; - PlayerMenu[i].alphaKey = 0; - } - - // Setup description table - for (i = 0; i < MAXSKINS; i++) - { - if (i == 0) - { - strcpy(description[i].notes, "\x82Sonic\x80 is the fastest of the three, but also the hardest to control. Beginners beware, but experts will find Sonic very powerful.\n\n\x82""Ability:\x80 Speed Thok\nDouble jump to zoom forward with a huge burst of speed.\n\n\x82Tip:\x80 Simply letting go of forward does not slow down in SRB2. To slow down, hold the opposite direction."); - strcpy(description[i].picname, ""); - strcpy(description[i].skinname, "sonic"); - } - else if (i == 1) - { - strcpy(description[i].notes, "\x82Tails\x80 is the most mobile of the three, but has the slowest speed. Because of his mobility, he's well-\nsuited to beginners.\n\n\x82""Ability:\x80 Fly\nDouble jump to start flying for a limited time. Repetitively hit the jump button to ascend.\n\n\x82Tip:\x80 To quickly descend while flying, hit the spin button."); - strcpy(description[i].picname, ""); - strcpy(description[i].skinname, "tails"); - } - else if (i == 2) - { - strcpy(description[i].notes, "\x82Knuckles\x80 is well-\nrounded and can destroy breakable walls simply by touching them, but he can't jump as high as the other two.\n\n\x82""Ability:\x80 Glide & Climb\nDouble jump to glide in the air as long as jump is held. Glide into a wall to climb it.\n\n\x82Tip:\x80 Press spin while climbing to jump off the wall; press jump instead to jump off\nand face away from\nthe wall."); - strcpy(description[i].picname, ""); - strcpy(description[i].skinname, "knuckles"); - } - else if (i == 3) - { - strcpy(description[i].notes, "\x82Sonic & Tails\x80 team up to take on Dr. Eggman!\nControl Sonic while Tails desperately struggles to keep up.\n\nPlayer 2 can control Tails directly by setting the controls in the options menu.\nTails's directional controls are relative to Player 1's camera.\n\nTails can pick up Sonic while flying and carry him around."); - strcpy(description[i].picname, "CHRS&T"); - strcpy(description[i].skinname, "sonic&tails"); - } - else - { - strcpy(description[i].notes, "???"); - strcpy(description[i].picname, ""); - strcpy(description[i].skinname, ""); - } - } -} - // ========================================================================== // SPECIAL MENU OPTION DRAW ROUTINES GO HERE // ========================================================================== diff --git a/src/m_menu.h b/src/m_menu.h index 2b048fe90..b1070bdc5 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -50,9 +50,6 @@ void M_Drawer(void); // Called by D_SRB2Main, loads the config file. void M_Init(void); -// Called by D_SRB2Main also, sets up the playermenu and description tables. -void M_InitCharacterTables(void); - // Called by intro code to force menu up upon a keypress, // does nothing if menu is already up. void M_StartControlPanel(void); @@ -84,11 +81,6 @@ typedef enum } menumessagetype_t; void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtype); -extern boolean DPADUPSCROLL; -extern boolean DPADDOWNSCROLL; -extern boolean DPADLEFTSCROLL; -extern boolean DPADRIGHTSCROLL; - typedef enum { M_NOT_WAITING, @@ -168,8 +160,6 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt); #define MAXMENUCCVARS 999 -#define MAXTOOLTIPS 255 - typedef union { struct menu_s *submenu; // IT_SUBMENU @@ -195,8 +185,6 @@ typedef struct menuitem_s UINT16 alphaKey; } menuitem_t; -extern menuitem_t PlayerMenu[MAXSKINS]; - typedef struct menu_s { const char *menutitlepic; @@ -227,14 +215,6 @@ extern menu_t SP_LoadDef; void M_SetupJoystickMenu(INT32 choice); extern menu_t OP_JoystickSetDef; -// Stuff for customizing the player select screen -typedef struct -{ - char notes[441]; - char picname[8]; - char skinname[SKINNAMESIZE*2+2]; // skin&skin\0 -} description_t; - // mode descriptions for video mode menu typedef struct { @@ -262,8 +242,6 @@ typedef struct extern INT32 mapwads[NUMMAPS]; -extern description_t description[MAXSKINS]; - extern consvar_t cv_replaysearchrate; extern consvar_t cv_showfocuslost; extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort; diff --git a/src/m_menudefs.c b/src/m_menudefs.c index 9eb89515f..af6deacb8 100644 --- a/src/m_menudefs.c +++ b/src/m_menudefs.c @@ -495,12 +495,6 @@ static menuitem_t SP_LevelStatsMenu[] = {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelStats, '\0'}, // dummy menuitem for the control func }; -// A rare case. -// 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[MAXSKINS]; - // ----------------------------------- // Multiplayer and all of its submenus // -----------------------------------