Menuitem names, GO!

This commit is contained in:
GenericHeroGuy 2025-03-20 01:35:30 +01:00
parent bb3688a8c3
commit 65a86671fe
5 changed files with 467 additions and 322 deletions

View file

@ -2170,10 +2170,16 @@ static void readmenuitem(MYFILE *f, menu_t *menudef, char *itemname)
char *tmp;
menuitem_t *menuitem = menudef->menuitems + menudef->numitems;
(void)itemname; // menuitem->itemname = Z_StrDup(itemname);
boolean actionset = false;
boolean textset = false;
if (strlen(itemname) > 6)
{
deh_warning("MenuItem %s: name too long (max 6 characters)", itemname);
goto toolong;
}
strncpy(menuitem->itemname, itemname, 6);
// taking quite possibly the only opportunity i'll ever get
// to avoid three tabs of indentation...
do if (myfgets(s, MAXLINELEN, f))
@ -2335,6 +2341,8 @@ static void readmenuitem(MYFILE *f, menu_t *menudef, char *itemname)
}
while (!myfeof(f)); // finish when the line is empty
toolong:
// text pointer cannot be null
if (!textset)
menuitem->text = "";

View file

@ -314,7 +314,7 @@ static CV_PossibleValue_t addons_cons_t[] = {{0, "Default"},
#endif
{3, "CUSTOM"}, {0, NULL}};
consvar_t cv_addons_option = CVAR_INIT ("addons_option", "Default", CV_SAVE|CV_CALL, addons_cons_t, Addons_option_Onchange);
consvar_t cv_addons_option = CVAR_INIT ("addons_option", "Default", CV_SAVE|CV_CALL|CV_NOINIT, addons_cons_t, Addons_option_Onchange);
consvar_t cv_addons_folder = CVAR_INIT ("addons_folder", "", CV_SAVE, NULL, NULL);
static CV_PossibleValue_t addons_md5_cons_t[] = {{0, "Name"}, {1, "Contents"}, {0, NULL}};

File diff suppressed because it is too large Load diff

View file

@ -362,8 +362,14 @@ struct menuitem_t
// hotkey in menu or y of the item
UINT16 alphaKey;
// an identifier to replace hardcoded indices
char itemname[6];
};
// so i don't have to put magic numbers everywhere
#define ITNAMECMP(s1, s2) !strncmp(s1, s2, 6)
struct menu_t
{
UINT32 menuid; // ID to encode menu type and hierarchy

View file

@ -109,13 +109,13 @@ typedef off_t off64_t;
#endif
static CV_PossibleValue_t screenshot_cons_t[] = {{0, "Default"}, {1, "HOME"}, {2, "SRB2"}, {3, "CUSTOM"}, {0, NULL}};
consvar_t cv_screenshot_option = CVAR_INIT ("screenshot_option", "Default", CV_SAVE|CV_CALL, screenshot_cons_t, Screenshot_option_Onchange);
consvar_t cv_screenshot_option = CVAR_INIT ("screenshot_option", "Default", CV_SAVE|CV_CALL|CV_NOINIT, screenshot_cons_t, Screenshot_option_Onchange);
consvar_t cv_screenshot_folder = CVAR_INIT ("screenshot_folder", "", CV_SAVE, NULL, NULL);
consvar_t cv_screenshot_colorprofile = CVAR_INIT ("screenshot_colorprofile", "Yes", CV_SAVE, CV_YesNo, NULL);
static CV_PossibleValue_t moviemode_cons_t[] = {{MM_GIF, "GIF"}, {MM_APNG, "aPNG"}, {MM_SCREENSHOT, "Screenshots"}, {0, NULL}};
consvar_t cv_moviemode = CVAR_INIT ("moviemode_mode", "GIF", CV_SAVE|CV_CALL, moviemode_cons_t, Moviemode_mode_Onchange);
consvar_t cv_moviemode = CVAR_INIT ("moviemode_mode", "GIF", CV_SAVE|CV_CALL|CV_NOINIT, moviemode_cons_t, Moviemode_mode_Onchange);
consvar_t cv_movie_option = CVAR_INIT ("movie_option", "Default", CV_SAVE|CV_CALL, screenshot_cons_t, Moviemode_option_Onchange);
consvar_t cv_movie_folder = CVAR_INIT ("movie_folder", "", CV_SAVE, NULL, NULL);