M_StartMessage: ACTUALLY use automatic newline generation

This commit is contained in:
toaster 2023-08-28 20:13:17 +01:00
parent 9d689c5e0c
commit 47055bcda7

View file

@ -31,19 +31,20 @@ static inline size_t M_StringHeight(const char *string)
void M_StartMessage(const char *header, const char *string, void (*routine)(INT32), menumessagetype_t itemtype, const char *confirmstr, const char *defaultstr) void M_StartMessage(const char *header, const char *string, void (*routine)(INT32), menumessagetype_t itemtype, const char *confirmstr, const char *defaultstr)
{ {
const UINT8 pid = 0; const UINT8 pid = 0;
static char *message = NULL;
Z_Free(message);
DEBFILE(string); DEBFILE(string);
message = V_ScaledWordWrap( char *message = V_ScaledWordWrap(
BASEVIDWIDTH << FRACBITS, (BASEVIDWIDTH - 8) << FRACBITS,
FRACUNIT, FRACUNIT, FRACUNIT, FRACUNIT, FRACUNIT, FRACUNIT,
0, 0,
HU_FONT, HU_FONT,
string string
); );
strncpy(menumessage.message, string, MAXMENUMESSAGE); strncpy(menumessage.message, message, MAXMENUMESSAGE);
Z_Free(message);
menumessage.header = header; menumessage.header = header;
menumessage.flags = itemtype; menumessage.flags = itemtype;
menumessage.routine = routine; menumessage.routine = routine;
@ -84,7 +85,7 @@ void M_StartMessage(const char *header, const char *string, void (*routine)(INT3
// oogh my god this was replaced in 2023 // oogh my god this was replaced in 2023
menumessage.x = (8 * MAXSTRINGLENGTH) - 1; menumessage.x = (8 * MAXSTRINGLENGTH) - 1;
menumessage.y = M_StringHeight(message); menumessage.y = M_StringHeight(menumessage.message);
M_SetMenuDelay(pid); // Set menu delay to avoid setting off any of the handlers. M_SetMenuDelay(pid); // Set menu delay to avoid setting off any of the handlers.
} }