From e680b12eac31fcac1b2d4f126c6aef5219f07d1b Mon Sep 17 00:00:00 2001 From: GenericHeroGuy Date: Tue, 3 Jun 2025 18:57:38 +0200 Subject: [PATCH] Remove character descriptions --- src/d_main.cpp | 4 - src/deh_soc.c | 194 ------------------------------------------------- src/deh_soc.h | 1 - src/dehacked.c | 13 +--- src/m_menu.c | 43 ----------- src/m_menu.h | 26 ------- 6 files changed, 1 insertion(+), 280 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 22089ab2e..4a66805e8 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1443,10 +1443,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(); - D_RegisterServerCommands(); D_RegisterClientCommands(); // be sure that this is called before D_CheckNetGame R_RegisterEngineStuff(); diff --git a/src/deh_soc.c b/src/deh_soc.c index e26c89307..f01eb4806 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -190,200 +190,6 @@ void clear_levels(void) COM_BufAddText("exitgame"); // Command_ExitGame_f() but delayed } -static boolean findFreeSlot(INT32 *num) -{ - // Send the character select entry to a free slot. - while (*num < MAXSKINS && (description[*num].used)) - *num = *num+1; - - // No more free slots. :( - if (*num >= MAXSKINS) - return false; - - // Redesign your logo. (See M_DrawSetupChoosePlayerMenu in m_menu.c...) - description[*num].picname[0] = '\0'; - description[*num].nametag[0] = '\0'; - description[*num].displayname[0] = '\0'; - description[*num].oppositecolor = SKINCOLOR_NONE; - description[*num].tagtextcolor = SKINCOLOR_NONE; - description[*num].tagoutlinecolor = SKINCOLOR_NONE; - - // Found one! ^_^ - return (description[*num].used = true); -} - -// Reads a player. -// For modifying the character select screen -void readPlayer(MYFILE *f, INT32 num) -{ - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word; - char *word2; - char *displayname = ZZ_Alloc(MAXLINELEN+1); - INT32 i; - boolean slotfound = false; - - #define SLOTFOUND \ - if (!slotfound && (slotfound = findFreeSlot(&num)) == false) \ - goto done; - - displayname[MAXLINELEN] = '\0'; - - do - { - if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - for (i = 0; i < MAXLINELEN-3; i++) - { - char *tmp; - if (s[i] == '=') - { - tmp = &s[i+2]; - strncpy(displayname, tmp, SKINNAMESIZE); - break; - } - } - - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - if (fastcmp(word, "PLAYERTEXT")) - { - char *playertext = NULL; - - SLOTFOUND - - for (i = 0; i < MAXLINELEN-3; i++) - { - if (s[i] == '=') - { - playertext = &s[i+2]; - break; - } - } - if (playertext) - { - strcpy(description[num].notes, playertext); - strcat(description[num].notes, myhashfgets(playertext, sizeof (description[num].notes), f)); - } - 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 < sizeof(description[num].notes)-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")) - { - SLOTFOUND - strncpy(description[num].picname, word2, 8); - } - // new character select - else if (fastcmp(word, "DISPLAYNAME")) - { - SLOTFOUND - // replace '#' with line breaks - // (also remove any '\n') - { - char *cur = NULL; - - // remove '\n' - cur = strchr(displayname, '\n'); - if (cur) - *cur = '\0'; - - // turn '#' into '\n' - cur = strchr(displayname, '#'); - while (cur) - { - *cur = '\n'; - cur = strchr(cur, '#'); - } - } - // copy final string - strncpy(description[num].displayname, displayname, SKINNAMESIZE); - } - else if (fastcmp(word, "OPPOSITECOLOR") || fastcmp(word, "OPPOSITECOLOUR")) - { - SLOTFOUND - description[num].oppositecolor = (UINT16)get_number(word2); - } - else if (fastcmp(word, "NAMETAG") || fastcmp(word, "TAGNAME")) - { - SLOTFOUND - strncpy(description[num].nametag, word2, 8); - } - else if (fastcmp(word, "TAGTEXTCOLOR") || fastcmp(word, "TAGTEXTCOLOUR")) - { - SLOTFOUND - description[num].tagtextcolor = (UINT16)get_number(word2); - } - else if (fastcmp(word, "TAGOUTLINECOLOR") || fastcmp(word, "TAGOUTLINECOLOUR")) - { - SLOTFOUND - description[num].tagoutlinecolor = (UINT16)get_number(word2); - } - else if (fastcmp(word, "STATUS")) - { - /* - 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 entries you like, but only if you - signal that you are purposely doing so by disabling and then reenabling the slot. - */ - if (i && !slotfound && (slotfound = findFreeSlot(&num)) == false) - goto done; - - description[num].used = (!!i); - } - else if (fastcmp(word, "SKINNAME")) - { - // Send to free slot. - SLOTFOUND - 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 - #undef SLOTFOUND -done: - Z_Free(displayname); - Z_Free(s); -} - // TODO: Figure out how to do undolines for this.... // TODO: Warnings for running out of freeslots void readfreeslots(MYFILE *f) diff --git a/src/deh_soc.h b/src/deh_soc.h index a1f7f104e..40ab605ac 100644 --- a/src/deh_soc.h +++ b/src/deh_soc.h @@ -84,7 +84,6 @@ void readlight(MYFILE *f, INT32 num); void readskincolor(MYFILE *f, INT32 num, boolean mainfile); void readthing(MYFILE *f, INT32 num); void readfreeslots(MYFILE *f); -void readPlayer(MYFILE *f, INT32 num); void clear_levels(void); void clear_conditionsets(void); diff --git a/src/dehacked.c b/src/dehacked.c index eb1b3fecd..08d9d3f1b 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -427,18 +427,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) else i = 0; - if (fastcmp(word, "CHARACTER")) - { - if (i >= 0 && i < 32) - readPlayer(f, i); - else - { - deh_warning("Character %d out of range (0 - 31)", i); - ignorelines(f); - } - continue; - } - else if (fastcmp(word, "EMBLEM")) + if (fastcmp(word, "EMBLEM")) { if (!mainfile && !gamedataadded) { diff --git a/src/m_menu.c b/src/m_menu.c index 03d0200d8..36b050ad7 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -147,9 +147,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]; - boolean fromlevelselect = false; typedef enum @@ -1895,46 +1892,6 @@ void M_Init(void) CV_RegisterVar(&cv_menucaps); } -void M_InitCharacterTables(void) -{ - UINT8 i; - - // 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 a501a1f30..0d9fa656a 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -111,9 +111,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); @@ -386,27 +383,6 @@ extern I_mutex m_menu_mutex; // Call upon joystick hotplug void M_SetupJoystickMenu(INT32 arg); -// Stuff for customizing the player select screen -typedef struct -{ - boolean used; - char notes[441]; - char picname[8]; - char skinname[SKINNAMESIZE*2+2]; // skin&skin\0 - patch_t *charpic; - UINT8 prev; - UINT8 next; - - // new character select - char displayname[SKINNAMESIZE+1]; - SINT8 skinnum[2]; - UINT16 oppositecolor; - char nametag[8]; - patch_t *namepic; - UINT16 tagtextcolor; - UINT16 tagoutlinecolor; -} description_t; - // level select platter typedef struct { @@ -451,8 +427,6 @@ typedef struct INT32 gamemap; } saveinfo_t; -extern description_t description[MAXSKINS]; - extern consvar_t cv_showfocuslost; extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort; extern consvar_t cv_dummygpdifficulty, cv_dummygpencore, cv_dummygpcup;