Copies the text from the `modinfo.txt` into the name field for the mod
list entry. If there is no text the mod directory name is used as
before.
![image](https://github.com/DarkPlacesEngine/darkplaces/assets/424218/
b6b5da57-7590-407e-920c-
21bca23ef2bb)
Fixes Alkaline 1.2 failing to appear in the mod list (its dir is
`alk1.2`).
See https://github.com/DarkPlacesEngine/darkplaces/pull/168
---------
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Co-authored-by: bones_was_here <bones_was_here@xonotic.au>
qbool loaded; // used to determine whether this entry is loaded and running
int enabled; // index to array of modlist_enabled
qbool loaded; // used to determine whether this entry is loaded and running
int enabled; // index to array of modlist_enabled
- // name of the modification, this is (will...be) displayed on the menu entry
+ // name of the modification, this is displayed on the menu entry
char name[128];
// directory where we will find it
char dir[MAX_QPATH];
char name[128];
// directory where we will find it
char dir[MAX_QPATH];
modlist_numenabled = fs_numgamedirs;
for (i = 0;i < list.numstrings && modlist_count < MODLIST_TOTALSIZE;i++)
{
modlist_numenabled = fs_numgamedirs;
for (i = 0;i < list.numstrings && modlist_count < MODLIST_TOTALSIZE;i++)
{
- // quickly skip names with dot characters - generally these are files, not directories
- if (strchr(list.strings[i], '.')) continue;
// reject any dirs that are part of the base game
if (gamedirname1 && !strcasecmp(gamedirname1, list.strings[i])) continue;
// reject any dirs that are part of the base game
if (gamedirname1 && !strcasecmp(gamedirname1, list.strings[i])) continue;
description = FS_CheckGameDir(list.strings[i]);
if (description == NULL || description == fs_checkgamedir_missing) continue;
description = FS_CheckGameDir(list.strings[i]);
if (description == NULL || description == fs_checkgamedir_missing) continue;
+ desc_len = min(strlen(description), sizeof(modlist[modlist_count].name));
+ for (j = 0; j < desc_len; ++j)
+ if (!ISWHITESPACE(description[j]))
+ {
+ dp_strlcpy(modlist[modlist_count].name, description, sizeof(modlist[modlist_count].name));
+ break;
+ }
+
dp_strlcpy (modlist[modlist_count].dir, list.strings[i], sizeof(modlist[modlist_count].dir));
//check currently loaded mods
modlist[modlist_count].loaded = false;
dp_strlcpy (modlist[modlist_count].dir, list.strings[i], sizeof(modlist[modlist_count].dir));
//check currently loaded mods
modlist[modlist_count].loaded = false;
{
for (n = start;n < end;n++)
{
{
for (n = start;n < end;n++)
{
+ const char *item_label = (modlist[n].name[0] != '\0') ? modlist[n].name : modlist[n].dir;
+
DrawQ_Pic(menu_x + 40, menu_y + y, NULL, 360, 8, n == modlist_cursor ? (0.5 + 0.2 * sin(host.realtime * M_PI)) : 0, 0, 0, 0.5, 0);
DrawQ_Pic(menu_x + 40, menu_y + y, NULL, 360, 8, n == modlist_cursor ? (0.5 + 0.2 * sin(host.realtime * M_PI)) : 0, 0, 0, 0.5, 0);
- M_ItemPrint(80, y, modlist[n].dir, true);
+ M_ItemPrint(80, y, item_label, true);
M_DrawCheckbox(48, y, modlist[n].loaded);
y +=8;
}
M_DrawCheckbox(48, y, modlist[n].loaded);
y +=8;
}