From ba50685c6e2744b516090ea6961c516fd2620e6d Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 7 Mar 2024 09:36:49 -0800 Subject: [PATCH] Menus/Map Select: split map names so only 1 word goes on the bottom This is the minimum requirement for release, just to stop Mega Collision Chaos from going off the screen. - 2 words - 1 word on top - 1 word below - 3 words - 2 words on top - 1 word below --- src/k_menudraw.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 666add657..825cce437 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -3338,38 +3338,25 @@ static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map) } else { - boolean donewithone = false; - char *ttlsource = mapheaderinfo[map]->menuttl[0] ? mapheaderinfo[map]->menuttl : mapheaderinfo[map]->lvlttl; - for (i = 0; i < 22; i++) + // If there are 2 or more words: + // - Last word goes on word2 + // - Everything else on word1 + char *p = strrchr(ttlsource, ' '); + if (p) { - if (!ttlsource[i]) - break; - - if (ttlsource[i] == ' ') - { - if (!donewithone) - { - donewithone = true; - continue; - } - } - - if (donewithone) - { - word2[word2len] = ttlsource[i]; - word2len++; - } - else - { - word1[word1len] = ttlsource[i]; - word1len++; - } + word2len = strlen(p + 1); + memcpy(word2, p + 1, word2len); } + else + p = ttlsource + strlen(ttlsource); + + word1len = p - ttlsource; + memcpy(word1, ttlsource, word1len); } if (!mapheaderinfo[map]->menuttl[0] && mapheaderinfo[map]->actnum)