Check V_ThinStringWidth instead of strlen for level platter names.

This commit is contained in:
spherallic 2022-02-02 23:16:12 +01:00
parent ff57a983d7
commit e64775c867
2 changed files with 13 additions and 11 deletions

View file

@ -5408,11 +5408,13 @@ static boolean M_PrepareLevelPlatter(INT32 gt, boolean nextmappick)
if (actnum)
sprintf(mapname, "%s %d", mapheaderinfo[headingIterate]->lvlttl, actnum);
else if (V_ThinStringWidth(mapheaderinfo[headingIterate]->lvlttl, 0) <= 80)
strlcpy(mapname, mapheaderinfo[headingIterate]->lvlttl, 22);
else
strcpy(mapname, mapheaderinfo[headingIterate]->lvlttl);
if (strlen(mapname) >= 17)
strcpy(mapname+17-3, "...");
{
strlcpy(mapname, mapheaderinfo[headingIterate]->lvlttl, 15);
strcat(mapname, "...");
}
strcpy(levelselect.rows[row].mapnames[col], (const char *)mapname);
}
@ -5747,7 +5749,7 @@ static void M_DrawLevelPlatterMap(UINT8 row, UINT8 col, INT32 x, INT32 y, boolea
? 159 : 63));
if (strlen(levelselect.rows[row].mapnames[col]) > 6) // "AERIAL GARDEN" vs "ACT 18" - "THE ACT" intentionally compressed
V_DrawThinString(x, y+50, (highlight ? V_YELLOWMAP : 0), levelselect.rows[row].mapnames[col]);
V_DrawThinString(x, y+50+1, (highlight ? V_YELLOWMAP : 0), levelselect.rows[row].mapnames[col]);
else
V_DrawString(x, y+50, (highlight ? V_YELLOWMAP : 0), levelselect.rows[row].mapnames[col]);
}
@ -8748,12 +8750,12 @@ static void M_ReadSavegameInfo(UINT32 slot)
if(!mapheaderinfo[(fake-1) & 8191])
savegameinfo[slot].levelname[0] = '\0';
else if (V_ThinStringWidth(mapheaderinfo[(fake-1) & 8191]->lvlttl, 0) <= 78)
strlcpy(savegameinfo[slot].levelname, mapheaderinfo[(fake-1) & 8191]->lvlttl, 22);
else
{
strlcpy(savegameinfo[slot].levelname, mapheaderinfo[(fake-1) & 8191]->lvlttl, 17+1);
if (strlen(mapheaderinfo[(fake-1) & 8191]->lvlttl) >= 17)
strcpy(savegameinfo[slot].levelname+17-3, "...");
strlcpy(savegameinfo[slot].levelname, mapheaderinfo[(fake-1) & 8191]->lvlttl, 15);
strcat(savegameinfo[slot].levelname, "...");
}
savegameinfo[slot].gamemap = fake;

View file

@ -389,9 +389,9 @@ typedef struct
// level select platter
typedef struct
{
char header[22+5]; // mapheader_t lvltttl max length + " ZONE"
char header[22+5]; // mapheader_t lvlttl max length + " ZONE"
INT32 maplist[3];
char mapnames[3][17+1];
char mapnames[3][22]; // lvlttl max length
boolean mapavailable[4]; // mapavailable[3] == wide or not
} levelselectrow_t;