diff --git a/src/console.c b/src/console.c index 42b2e85b4..3c5e0f9f2 100644 --- a/src/console.c +++ b/src/console.c @@ -1949,10 +1949,11 @@ void CON_DrawLoadBar(void) barwidth = (BASEVIDWIDTH * con_startup_loadprogress) / LOADED_ALLDONE; V_DrawFill(0, BASEVIDHEIGHT - barheight, barwidth, barheight, 0); -#ifdef DEVELOP + if (con_startup_loadprogress <= LOADED_ALLDONE) - V_DrawString(4, BASEVIDHEIGHT - (barheight + 8 + 4), 0, CON_LoadingStrings[con_startup_loadprogress]); -#endif + { + V_DrawString(4, BASEVIDHEIGHT - (barheight + 8 + 4), V_FORCEUPPERCASE, CON_LoadingStrings[con_startup_loadprogress]); + } Unlock_state(); } diff --git a/src/deh_soc.c b/src/deh_soc.c index 84b49aa76..fed01aa6d 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1025,6 +1025,7 @@ void readlevelheader(MYFILE *f, char * name) word2 = tmp += 2; i = atoi(word2); // used for numerical settings + // The following support mixed/lower case. if (fastcmp(word, "LEVELNAME")) { @@ -1032,7 +1033,14 @@ void readlevelheader(MYFILE *f, char * name) sizeof(mapheaderinfo[num]->lvlttl), va("Level header %d: levelname", num)); continue; } - // CHEAP HACK: move this over here for lowercase subtitles + + if (fastcmp(word, "ZONETITLE")) + { + deh_strlcpy(mapheaderinfo[num]->zonttl, word2, + sizeof(mapheaderinfo[num]->zonttl), va("Level header %d: zonetitle", num)); + continue; + } + if (fastcmp(word, "SUBTITLE")) { deh_strlcpy(mapheaderinfo[num]->subttl, word2, @@ -1127,11 +1135,6 @@ void readlevelheader(MYFILE *f, char * name) } // Strings that can be truncated - else if (fastcmp(word, "ZONETITLE")) - { - deh_strlcpy(mapheaderinfo[num]->zonttl, word2, - sizeof(mapheaderinfo[num]->zonttl), va("Level header %d: zonetitle", num)); - } else if (fastcmp(word, "RELEVANTSKIN")) { deh_strlcpy(mapheaderinfo[num]->relevantskin, word2, diff --git a/src/deh_tables.c b/src/deh_tables.c index 3db11e57e..b36e02027 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3303,6 +3303,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_INSTAWHIP_RECHARGE2", "S_INSTAWHIP_RECHARGE3", "S_INSTAWHIP_RECHARGE4", + "S_INSTAWHIP_REJECT", "S_BLOCKRING", "S_BLOCKBODY", @@ -4605,6 +4606,8 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_HITLAG_6", "S_HITLAG_8", "S_HITLAG_9", + "S_HITLAG_10", + // Broly Ki Orb "S_BROLY1", @@ -5407,6 +5410,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_INSTAWHIP", "MT_INSTAWHIP_RECHARGE", + "MT_INSTAWHIP_REJECT", "MT_BLOCKRING", "MT_BLOCKBODY", @@ -6862,7 +6866,7 @@ struct int_const_s const INT_CONST[] = { {"V_REVERSESUBTRACT",V_REVERSESUBTRACT}, {"V_MODULATE",V_MODULATE}, {"V_OVERLAY",V_OVERLAY}, - {"V_ALLOWLOWERCASE",V_ALLOWLOWERCASE}, + {"V_FORCEUPPERCASE",V_FORCEUPPERCASE}, {"V_FLIP",V_FLIP}, {"V_VFLIP",V_VFLIP}, {"V_SNAPTOTOP",V_SNAPTOTOP}, diff --git a/src/f_finale.c b/src/f_finale.c index 98d0c15eb..ccb8fbb30 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -755,12 +755,12 @@ void F_CreditDrawer(void) break; case 2: if (y>>FRACBITS > -10) - V_DrawStringAtFixed((BASEVIDWIDTH-V_StringWidth(&credits[i][1], V_ALLOWLOWERCASE|V_YELLOWMAP))<>1, y, V_ALLOWLOWERCASE|V_YELLOWMAP, &credits[i][1]); + V_DrawStringAtFixed((BASEVIDWIDTH-V_StringWidth(&credits[i][1], V_YELLOWMAP))<>1, y, V_YELLOWMAP, &credits[i][1]); y += 12<>FRACBITS > -10) - V_DrawStringAtFixed(32<scene[scenenum].fadeoutid, true, NULL, false, false); } - V_DrawString(textxpos, textypos, V_ALLOWLOWERCASE, cutscene_disptext); + V_DrawString(textxpos, textypos, 0, cutscene_disptext); } void F_CutsceneTicker(void) @@ -2281,7 +2281,23 @@ static void F_PreparePageText(char *pagetext) if (promptpagetext) Z_Free(promptpagetext); - promptpagetext = (pagetext && pagetext[0]) ? V_WordWrap(textx, textr, 0, pagetext) : Z_StrDup(""); + if (pagetext && pagetext[0]) + { + promptpagetext = V_ScaledWordWrap( + (textx - textr)<page[scenenum].textspeed ? textprompts[cutnum]->page[scenenum].textspeed : TICRATE/5; @@ -2628,12 +2644,12 @@ void F_TextPromptDrawer(void) } // Draw text - V_DrawString(textx, texty, (V_SNAPTOBOTTOM|V_ALLOWLOWERCASE), cutscene_disptext); + V_DrawString(textx, texty, V_SNAPTOBOTTOM, cutscene_disptext); // Draw name // Don't use V_YELLOWMAP here so that the name color can be changed with control codes if (textprompts[cutnum]->page[scenenum].name[0]) - V_DrawString(textx, namey, (V_SNAPTOBOTTOM|V_ALLOWLOWERCASE), textprompts[cutnum]->page[scenenum].name); + V_DrawString(textx, namey, V_SNAPTOBOTTOM, textprompts[cutnum]->page[scenenum].name); // Draw chevron if (promptblockcontrols && !timetonext) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 48725247e..e97d41183 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -255,6 +255,10 @@ void HU_Init(void) PR ("STCFN"); REG; + + PR ("MNUFN"); + REG; + PR ("TNYFN"); REG; @@ -868,7 +872,7 @@ void HU_TickSongCredits(void) if (cursongcredit.anim > 0) { - INT32 len = V_ThinStringWidth(cursongcredit.text, V_ALLOWLOWERCASE|V_6WIDTHSPACE); + INT32 len = V_ThinStringWidth(cursongcredit.text, 0); fixed_t destx = (len+7) * FRACUNIT; if (cursongcredit.trans > 0) @@ -1266,57 +1270,16 @@ boolean HU_Responder(event_t *ev) //====================================================================== // Precompile a wordwrapped string to any given width. -// This is a muuuch better method than V_WORDWRAP. -// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day. -// this one is simplified for the chat drawer. -static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) +// Now a wrapper for the chat drawer. +static char *CHAT_WordWrap(INT32 w, fixed_t scale, INT32 option, const char *string) { - INT32 c; - size_t chw, i, lastusablespace = 0; - size_t slen; - char *newstring = Z_StrDup(string); - INT32 spacewidth = (vid.width < 640) ? 8 : 4, charwidth = (vid.width < 640) ? 8 : 4; - - slen = strlen(string); - x = 0; - - for (i = 0; i < slen; ++i) - { - c = newstring[i]; - if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09 - continue; - - if (c == '\n') - { - x = 0; - lastusablespace = 0; - continue; - } - - if (!(option & V_ALLOWLOWERCASE)) - c = toupper(c); - c -= HU_FONTSTART; - - if (c < 0 || c >= HU_FONTSIZE || !fontv[HU_FONT].font[c]) - { - chw = spacewidth; - lastusablespace = i; - } - else - chw = charwidth; - - x += chw; - - if (lastusablespace != 0 && x > w) - { - //CONS_Printf("Wrap at index %d\n", i); - newstring[lastusablespace] = '\n'; - i = lastusablespace+1; - lastusablespace = 0; - x = 0; - } - } - return newstring; + return V_ScaledWordWrap( + w << FRACBITS, + scale, FRACUNIT, FRACUNIT, + option, + HU_FONT, + string + ); } @@ -1331,11 +1294,9 @@ INT16 chatx = 13, chaty = 169; // let's use this as our coordinates static void HU_drawMiniChat(void) { INT32 x = chatx+2; - INT32 charwidth = 4, charheight = 6; + const INT32 charheight = (vid.width < 640) ? 12 : 6; INT32 boxw = cv_chatwidth.value; - INT32 dx = 0, dy = 0; size_t i = chat_nummsg_min; - boolean prev_linereturn = false; // a hack to prevent double \n while I have no idea why they happen in the first place. INT32 msglines = 0; // process all messages once without rendering anything or doing anything fancy so that we know how many lines each message has... @@ -1347,50 +1308,23 @@ static void HU_drawMiniChat(void) if (r_splitscreen > 1) boxw = max(64, boxw/2); - for (; i>0; i--) + const fixed_t scale = (vid.width < 640) ? FRACUNIT : FRACUNIT/2; + + for (; i > 0; i--) { - char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]); + char *msg = CHAT_WordWrap(boxw-4, scale, V_SNAPTOBOTTOM|V_SNAPTOLEFT, chat_mini[i-1]); size_t j = 0; - INT32 linescount = 0; + INT32 linescount = 1; - while(msg[j]) // iterate through msg + for (; msg[j]; j++) // iterate through msg { - if (msg[j] < HU_FONTSTART) // don't draw - { - if (msg[j] == '\n') // get back down. - { - ++j; - if (!prev_linereturn) - { - linescount += 1; - dx = 0; - } - prev_linereturn = true; - continue; - } - else if (msg[j] & 0x80) // stolen from video.c, nice. - { - ++j; - continue; - } + if (msg[j] != '\n') // get back down. + continue; - ++j; - } - else - { - j++; - } - prev_linereturn = false; - dx += charwidth; - if (dx >= boxw) - { - dx = 0; - linescount += 1; - } + linescount++; } - dy = 0; - dx = 0; - msglines += linescount+1; + + msglines += linescount; if (msg) Z_Free(msg); @@ -1411,63 +1345,50 @@ static void HU_drawMiniChat(void) y -= (cv_kartspeedometer.value ? 16 : 0); } - dx = 0; - dy = 0; i = 0; - prev_linereturn = false; for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages { - INT32 clrflag = 0; INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below... INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one. size_t j = 0; - char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. - UINT8 *colormap = NULL; + char *msg = CHAT_WordWrap(boxw-4, scale, V_SNAPTOBOTTOM|V_SNAPTOLEFT, chat_mini[i]); // get the current message, and word wrap it. - while(msg[j]) // iterate through msg + INT32 linescount = 1; + + for (; msg[j]; j++) // iterate through msg { - if (msg[j] < HU_FONTSTART) // don't draw - { - if (msg[j] == '\n') // get back down. - { - ++j; - if (!prev_linereturn) - { - dy += charheight; - dx = 0; - } - prev_linereturn = true; - continue; - } - else if (msg[j] & 0x80) // stolen from video.c, nice. - { - clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK; - colormap = V_GetStringColormap(clrflag); - ++j; - continue; - } + if (msg[j] != '\n') // get back down. + continue; - ++j; - } - else - { - if (cv_chatbacktint.value) // on request of wolfy - V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 159|V_SNAPTOBOTTOM|V_SNAPTOLEFT); - - V_DrawChatCharacter(x + dx + 2, y+dy, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, true, colormap); - } - - dx += charwidth; - prev_linereturn = false; - if (dx >= boxw) - { - dx = 0; - dy += charheight; - } + linescount++; } - dy += charheight; - dx = 0; + + if (cv_chatbacktint.value) // on request of wolfy + { + INT32 width = V_StringWidth(msg, 0); + if (vid.width >= 640) + width /= 2; + + V_DrawFillConsoleMap( + x-2, y, + width+4, + charheight * linescount, + 159|V_SNAPTOBOTTOM|V_SNAPTOLEFT + ); + } + + V_DrawStringScaled( + x << FRACBITS, + y << FRACBITS, + scale, FRACUNIT, FRACUNIT, + V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, + NULL, + HU_FONT, + msg + ); + + y += charheight * linescount; if (msg) Z_Free(msg); @@ -1482,9 +1403,9 @@ static void HU_drawMiniChat(void) static void HU_drawChatLog(INT32 offset) { - INT32 charwidth = 4, charheight = 6; + const INT32 charheight = (vid.width < 640) ? 12 : 6; INT32 boxw = cv_chatwidth.value, boxh = cv_chatheight.value; - INT32 x = chatx+2, y, dx = 0, dy = 0; + INT32 x = chatx+2, y; UINT32 i = 0; INT32 chat_topy, chat_bottomy; INT32 highlight = V_YELLOWMAP; @@ -1520,59 +1441,71 @@ static void HU_drawChatLog(INT32 offset) } chat_topy = y + chat_scroll*charheight; - chat_bottomy = chat_topy + boxh*charheight; + chat_bottomy = boxh*charheight + 2; - V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 159|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box + V_DrawFillConsoleMap(chatx, chat_topy, boxw, chat_bottomy, 159|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box + + const fixed_t scale = (vid.width < 640) ? FRACUNIT : FRACUNIT/2; + + V_SetClipRect( + (chatx) << FRACBITS, (chat_topy) << FRACBITS, + (boxw) << FRACBITS, (chat_bottomy) <= chat_bottomy) + ; + else if (y + dy + 2 + charheight < chat_topy) { - if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy))) - V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, true, colormap); - else - j++; // don't forget to increment this or we'll get stuck in the limbo. - } - - dx += charwidth; - if (dx >= boxw-charwidth-2 && i= HU_FONTSTART) // end of message shouldn't count, nor should invisible characters!!!! - { - dx = 0; dy += charheight; + + if (y + dy + 2 + charheight >= chat_topy) + { + startj = j; + } + + continue; } + + linescount++; } - dy += charheight; - dx = 0; + + if (y + dy < chat_bottomy) + { + V_DrawStringScaled( + (x + 2) << FRACBITS, + (y + dy + 2) << FRACBITS, + scale, FRACUNIT, FRACUNIT, + V_SNAPTOBOTTOM|V_SNAPTOLEFT, + NULL, + HU_FONT, + msg+startj + ); + } + + dy += charheight * linescount; if (msg) Z_Free(msg); } + V_ClearClipRect(); if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling. { @@ -1607,14 +1540,14 @@ static void HU_drawChatLog(INT32 offset) static void HU_DrawChat(void) { - INT32 charwidth = 4, charheight = 6; + const INT32 charheight = (vid.width < 640) ? 12 : 6; INT32 boxw = cv_chatwidth.value; - INT32 t = 0, c = 0, y = chaty - (typelines*charheight); - UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday! - INT32 cflag = 0; + INT32 y = chaty; + UINT32 i = 0; + char cflag = '\x80', tflag = '\x80'; const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; - const char *mute = "Chat has been muted."; + const char *mute = "\x86""Chat has been muted."; #ifdef NETSPLITSCREEN if (r_splitscreen) @@ -1637,85 +1570,70 @@ static void HU_DrawChat(void) talk = ttalk; #if 0 if (players[consoleplayer].ctfteam == 1) - t = 0x500; // Red + t = '\0x85'; // Red else if (players[consoleplayer].ctfteam == 2) - t = 0x400; // Blue + t = '\0x84'; // Blue #endif } + typelines = 1; + + const fixed_t scale = (vid.width < 640) ? FRACUNIT : FRACUNIT/2; + + char *msg = NULL; + if (CHAT_MUTE) { talk = mute; - typelines = 1; - cflag = V_GRAYMAP; // set text in gray if chat is muted. + //cflag = '\x86'; // set text in gray if chat is muted. } + else + { + msg = CHAT_WordWrap( + boxw-4, + scale, + V_SNAPTOBOTTOM|V_SNAPTOLEFT, + va("%c%s %c%s%c%c", cflag, talk, tflag, w_chat, '\x80', '_') + ); + + for (; msg[i]; i++) // iterate through msg + { + if (msg[i] != '\n') // get back down. + continue; + + typelines++; + } + + // This is removed after the fact to not have the newline handling flicker. + if (i != 0 && hu_tick >= 4) + { + msg[i-1] = '\0'; + } + } + + y -= typelines * charheight; V_DrawFillConsoleMap(chatx, y-1, boxw, (typelines*charheight), 159 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); - while (talk[i]) - { - if (talk[i] < HU_FONTSTART) - ++i; - else - { - V_DrawChatCharacter(chatx + c + 2, y, talk[i] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|cflag, true, V_GetStringColormap(talk[i]|cflag)); - i++; - } + V_DrawStringScaled( + (chatx + 2) << FRACBITS, + y << FRACBITS, + scale, FRACUNIT, FRACUNIT, + V_SNAPTOBOTTOM|V_SNAPTOLEFT, + NULL, + HU_FONT, + msg ? msg : talk + ); - c += charwidth; - } - - // if chat is muted, just draw the log and get it over with, no need to draw anything else. - if (CHAT_MUTE) - { - HU_drawChatLog(0); - return; - } - - i = 0; - typelines = 1; - - if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4) - V_DrawChatCharacter(chatx + 2 + c, y+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, true, NULL); - - while (w_chat[i]) - { - boolean skippedline = false; - if (c_input == (i+1)) - { - INT32 cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down. - INT32 cursory = (cursorx != chatx+1) ? (y) : (y+charheight); - if (hu_tick < 4) - V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, true, NULL); - - if (cursorx == chatx+1 && saylen == i) // a weirdo hack - { - typelines += 1; - skippedline = true; - } - } - - //Hurdler: isn't it better like that? - if (w_chat[i] < HU_FONTSTART) - ++i; - else - V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, true, NULL); - - c += charwidth; - if (c > boxw-(charwidth*2) && !skippedline) - { - c = 0; - y += charheight; - typelines += 1; - } - } + if (msg) + Z_Free(msg); // handle /pm list. It's messy, horrible and I don't care. - if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai + if (!CHAT_MUTE && !teamtalk && vid.width >= 640 && strnicmp(w_chat, "/pm", 3) == 0) // 320x200 unsupported kthxbai { INT32 count = 0; INT32 p_dispy = chaty - charheight -1; -#ifdef NETSPLITSCREEN + if (r_splitscreen) { p_dispy -= BASEVIDHEIGHT/2; @@ -1723,7 +1641,6 @@ static void HU_DrawChat(void) p_dispy += 16; } else -#endif { p_dispy -= (cv_kartspeedometer.value ? 16 : 0); } @@ -1776,14 +1693,14 @@ static void HU_DrawChat(void) char name[MAXPLAYERNAME+1]; strlcpy(name, player_names[i], 7); // shorten name to 7 characters. V_DrawFillConsoleMap(chatx+ boxw + 2, p_dispy- (6*count), 48, 6, 159 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud. - V_DrawSmallString(chatx+ boxw + 4, p_dispy- (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va("\x82%d\x80 - %s", i, name)); + V_DrawSmallString(chatx+ boxw + 4, p_dispy- (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT, va("\x82%d\x80 - %s", i, name)); count++; } } if (count == 0) // no results. { V_DrawFillConsoleMap(chatx+boxw+2, p_dispy- (6*count), 48, 6, 159 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud. - V_DrawSmallString(chatx+boxw+4, p_dispy- (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, "NO RESULT."); + V_DrawSmallString(chatx+boxw+4, p_dispy- (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT, "NO RESULT."); } } @@ -1983,11 +1900,11 @@ static void HU_DrawDemoInfo(void) if (!multiplayer)/* netreplay */ { V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, 0, M_GetText("Replay:")); - V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[0]); + V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, 0, player_names[0]); } else { - V_DrawRightAlignedThinString(BASEVIDWIDTH-2, BASEVIDHEIGHT-10, V_ALLOWLOWERCASE, demo.titlename); + V_DrawRightAlignedThinString(BASEVIDWIDTH-2, BASEVIDHEIGHT-10, 0, demo.titlename); } if (modeattacking & ATTACKING_TIME) @@ -2048,7 +1965,7 @@ void HU_DrawSongCredits(void) } V_DrawRightAlignedThinStringAtFixed(x, y, - V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<= dupadjust+8) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 86024d979..92ecdbc41 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -67,6 +67,7 @@ extern "C" { enum { X (HU), + X (MENU), X (TINY), X (FILE), diff --git a/src/hwr2/pass.hpp b/src/hwr2/pass.hpp index a745bd12b..3cf73c841 100644 --- a/src/hwr2/pass.hpp +++ b/src/hwr2/pass.hpp @@ -26,10 +26,10 @@ public: /// @param rhi virtual void prepass(rhi::Rhi& rhi) = 0; - /// @brief Upload contents for needed GPU resources. + /// @brief Upload contents for needed GPU resources. Passes must implement but this will be removed soon. /// @param rhi /// @param ctx - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) = 0; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) = 0; /// @brief Issue draw calls. /// @param rhi diff --git a/src/hwr2/pass_blit_postimg_screens.cpp b/src/hwr2/pass_blit_postimg_screens.cpp index 7fe485faf..da3b317eb 100644 --- a/src/hwr2/pass_blit_postimg_screens.cpp +++ b/src/hwr2/pass_blit_postimg_screens.cpp @@ -141,7 +141,7 @@ static Rect get_screen_viewport(uint32_t screen, uint32_t screens, uint32_t w, u return {0, 0, w, h}; } -void BlitPostimgScreens::transfer(Rhi& rhi, Handle ctx) +void BlitPostimgScreens::transfer(Rhi& rhi, Handle ctx) { // Upload needed buffers if (upload_quad_buffer_) diff --git a/src/hwr2/pass_blit_postimg_screens.hpp b/src/hwr2/pass_blit_postimg_screens.hpp index 47893476a..382995d58 100644 --- a/src/hwr2/pass_blit_postimg_screens.hpp +++ b/src/hwr2/pass_blit_postimg_screens.hpp @@ -72,7 +72,7 @@ public: virtual ~BlitPostimgScreens(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_blit_rect.cpp b/src/hwr2/pass_blit_rect.cpp index 38f0cf5cf..89971b456 100644 --- a/src/hwr2/pass_blit_rect.cpp +++ b/src/hwr2/pass_blit_rect.cpp @@ -124,7 +124,7 @@ void BlitRectPass::prepass(Rhi& rhi) } } -void BlitRectPass::transfer(Rhi& rhi, Handle ctx) +void BlitRectPass::transfer(Rhi& rhi, Handle ctx) { if (quad_vbo_needs_upload_ && quad_vbo_) { diff --git a/src/hwr2/pass_blit_rect.hpp b/src/hwr2/pass_blit_rect.hpp index 010583c3e..f0719b70e 100644 --- a/src/hwr2/pass_blit_rect.hpp +++ b/src/hwr2/pass_blit_rect.hpp @@ -51,7 +51,7 @@ public: virtual ~BlitRectPass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_imgui.cpp b/src/hwr2/pass_imgui.cpp index 3707a4a3d..9cbb87ad7 100644 --- a/src/hwr2/pass_imgui.cpp +++ b/src/hwr2/pass_imgui.cpp @@ -127,7 +127,7 @@ void ImguiPass::prepass(Rhi& rhi) } } -void ImguiPass::transfer(Rhi& rhi, Handle ctx) +void ImguiPass::transfer(Rhi& rhi, Handle ctx) { ImGuiIO& io = ImGui::GetIO(); diff --git a/src/hwr2/pass_imgui.hpp b/src/hwr2/pass_imgui.hpp index 91d2afe20..b2a7cc99c 100644 --- a/src/hwr2/pass_imgui.hpp +++ b/src/hwr2/pass_imgui.hpp @@ -50,7 +50,7 @@ public: virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; diff --git a/src/hwr2/pass_manager.cpp b/src/hwr2/pass_manager.cpp index a6bc386a7..ab0e60b21 100644 --- a/src/hwr2/pass_manager.cpp +++ b/src/hwr2/pass_manager.cpp @@ -32,7 +32,7 @@ public: virtual ~LambdaPass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; }; @@ -63,7 +63,7 @@ void LambdaPass::prepass(Rhi& rhi) } } -void LambdaPass::transfer(Rhi&, Handle) +void LambdaPass::transfer(Rhi&, Handle) { } @@ -137,7 +137,7 @@ void PassManager::prepass(Rhi& rhi) } } -void PassManager::transfer(Rhi& rhi, Handle ctx) +void PassManager::transfer(Rhi& rhi, Handle ctx) { for (auto& pass : passes_) { @@ -179,11 +179,8 @@ void PassManager::render(Rhi& rhi) prepass(rhi); - Handle tc = rhi.begin_transfer(); - transfer(rhi, tc); - rhi.end_transfer(tc); - Handle gc = rhi.begin_graphics(); + transfer(rhi, gc); graphics(rhi, gc); rhi.end_graphics(gc); diff --git a/src/hwr2/pass_manager.hpp b/src/hwr2/pass_manager.hpp index c462dd395..7734e0a43 100644 --- a/src/hwr2/pass_manager.hpp +++ b/src/hwr2/pass_manager.hpp @@ -43,7 +43,7 @@ public: PassManager& operator=(PassManager&&) = delete; virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_postprocess.cpp b/src/hwr2/pass_postprocess.cpp index a35dea645..0f2eefdc2 100644 --- a/src/hwr2/pass_postprocess.cpp +++ b/src/hwr2/pass_postprocess.cpp @@ -175,7 +175,7 @@ void PostprocessWipePass::prepass(Rhi& rhi) }); } -void PostprocessWipePass::transfer(Rhi& rhi, Handle ctx) +void PostprocessWipePass::transfer(Rhi& rhi, Handle ctx) { if (wipe_tex_ == kNullHandle) { diff --git a/src/hwr2/pass_postprocess.hpp b/src/hwr2/pass_postprocess.hpp index ced81975c..f0deb7ff9 100644 --- a/src/hwr2/pass_postprocess.hpp +++ b/src/hwr2/pass_postprocess.hpp @@ -49,7 +49,7 @@ public: virtual ~PostprocessWipePass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_resource_managers.cpp b/src/hwr2/pass_resource_managers.cpp index 550f5a015..99a05ca26 100644 --- a/src/hwr2/pass_resource_managers.cpp +++ b/src/hwr2/pass_resource_managers.cpp @@ -128,7 +128,7 @@ void FramebufferManager::prepass(Rhi& rhi) } } -void FramebufferManager::transfer(Rhi& rhi, Handle ctx) +void FramebufferManager::transfer(Rhi& rhi, Handle ctx) { } @@ -169,7 +169,7 @@ void MainPaletteManager::prepass(Rhi& rhi) } } -void MainPaletteManager::upload_palette(Rhi& rhi, Handle ctx) +void MainPaletteManager::upload_palette(Rhi& rhi, Handle ctx) { std::array palette_32; for (std::size_t i = 0; i < kPaletteSize; i++) @@ -179,7 +179,7 @@ void MainPaletteManager::upload_palette(Rhi& rhi, Handle ctx) rhi.update_texture(ctx, palette_, {0, 0, kPaletteSize, 1}, PixelFormat::kRGBA8, tcb::as_bytes(tcb::span(palette_32))); } -void MainPaletteManager::upload_lighttables(Rhi& rhi, Handle ctx) +void MainPaletteManager::upload_lighttables(Rhi& rhi, Handle ctx) { if (colormaps != nullptr) { @@ -206,7 +206,7 @@ void MainPaletteManager::upload_lighttables(Rhi& rhi, Handle ct } } -void MainPaletteManager::upload_default_colormap(Rhi& rhi, Handle ctx) +void MainPaletteManager::upload_default_colormap(Rhi& rhi, Handle ctx) { std::array data; for (std::size_t i = 0; i < kPaletteSize; i++) @@ -216,7 +216,7 @@ void MainPaletteManager::upload_default_colormap(Rhi& rhi, Handle ctx) +void MainPaletteManager::upload_colormaps(Rhi& rhi, Handle ctx) { for (auto to_upload : colormaps_to_upload_) { @@ -279,7 +279,7 @@ rhi::Handle MainPaletteManager::find_extra_lighttable(srb2::NotNul return lighttables_.at(lighttable); } -void MainPaletteManager::transfer(Rhi& rhi, Handle ctx) +void MainPaletteManager::transfer(Rhi& rhi, Handle ctx) { upload_palette(rhi, ctx); upload_lighttables(rhi, ctx); @@ -327,7 +327,7 @@ void CommonResourcesManager::prepass(Rhi& rhi) } } -void CommonResourcesManager::transfer(Rhi& rhi, Handle ctx) +void CommonResourcesManager::transfer(Rhi& rhi, Handle ctx) { if (!init_) { @@ -382,7 +382,7 @@ void FlatTextureManager::prepass(Rhi& rhi) { } -void FlatTextureManager::transfer(Rhi& rhi, Handle ctx) +void FlatTextureManager::transfer(Rhi& rhi, Handle ctx) { std::vector> flat_data; for (auto flat_lump : to_upload_) diff --git a/src/hwr2/pass_resource_managers.hpp b/src/hwr2/pass_resource_managers.hpp index 11e7fad95..ff7cce2d2 100644 --- a/src/hwr2/pass_resource_managers.hpp +++ b/src/hwr2/pass_resource_managers.hpp @@ -37,7 +37,7 @@ public: virtual ~FramebufferManager(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; @@ -83,17 +83,17 @@ class MainPaletteManager final : public Pass std::vector colormaps_to_upload_; std::vector lighttables_to_upload_; - void upload_palette(rhi::Rhi& rhi, rhi::Handle ctx); - void upload_lighttables(rhi::Rhi& rhi, rhi::Handle ctx); - void upload_default_colormap(rhi::Rhi& rhi, rhi::Handle ctx); - void upload_colormaps(rhi::Rhi& rhi, rhi::Handle ctx); + void upload_palette(rhi::Rhi& rhi, rhi::Handle ctx); + void upload_lighttables(rhi::Rhi& rhi, rhi::Handle ctx); + void upload_default_colormap(rhi::Rhi& rhi, rhi::Handle ctx); + void upload_colormaps(rhi::Rhi& rhi, rhi::Handle ctx); public: MainPaletteManager(); virtual ~MainPaletteManager(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; @@ -120,7 +120,7 @@ public: virtual ~CommonResourcesManager(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; @@ -153,7 +153,7 @@ public: virtual ~FlatTextureManager(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_screenshot.cpp b/src/hwr2/pass_screenshot.cpp index 059b07c85..cff5cc99a 100644 --- a/src/hwr2/pass_screenshot.cpp +++ b/src/hwr2/pass_screenshot.cpp @@ -40,7 +40,7 @@ void ScreenshotPass::prepass(Rhi& rhi) doing_screenshot_ = takescreenshot || moviemode != MM_OFF; } -void ScreenshotPass::transfer(Rhi& rhi, Handle ctx) +void ScreenshotPass::transfer(Rhi& rhi, Handle ctx) { } diff --git a/src/hwr2/pass_screenshot.hpp b/src/hwr2/pass_screenshot.hpp index 79de8b654..36c386a29 100644 --- a/src/hwr2/pass_screenshot.hpp +++ b/src/hwr2/pass_screenshot.hpp @@ -32,7 +32,7 @@ public: virtual ~ScreenshotPass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_software.cpp b/src/hwr2/pass_software.cpp index 0a514cd9b..1b9cde048 100644 --- a/src/hwr2/pass_software.cpp +++ b/src/hwr2/pass_software.cpp @@ -77,7 +77,7 @@ void SoftwarePass::prepass(Rhi& rhi) } } -void SoftwarePass::transfer(Rhi& rhi, Handle ctx) +void SoftwarePass::transfer(Rhi& rhi, Handle ctx) { // Upload screen tcb::span screen_span; diff --git a/src/hwr2/pass_software.hpp b/src/hwr2/pass_software.hpp index 4e7b02405..ae733a816 100644 --- a/src/hwr2/pass_software.hpp +++ b/src/hwr2/pass_software.hpp @@ -34,7 +34,7 @@ public: virtual ~SoftwarePass(); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; diff --git a/src/hwr2/pass_twodee.cpp b/src/hwr2/pass_twodee.cpp index ed30706df..0281737fa 100644 --- a/src/hwr2/pass_twodee.cpp +++ b/src/hwr2/pass_twodee.cpp @@ -498,7 +498,7 @@ void TwodeePass::prepass(Rhi& rhi) } } -void TwodeePass::transfer(Rhi& rhi, Handle ctx) +void TwodeePass::transfer(Rhi& rhi, Handle ctx) { if (!ctx_ || !data_) { diff --git a/src/hwr2/pass_twodee.hpp b/src/hwr2/pass_twodee.hpp index 8c72fc92e..da5c2f66f 100644 --- a/src/hwr2/pass_twodee.hpp +++ b/src/hwr2/pass_twodee.hpp @@ -97,7 +97,7 @@ struct TwodeePass final : public Pass virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; diff --git a/src/hwr2/patch_atlas.cpp b/src/hwr2/patch_atlas.cpp index fe5f6229c..26e35ca4b 100644 --- a/src/hwr2/patch_atlas.cpp +++ b/src/hwr2/patch_atlas.cpp @@ -348,7 +348,7 @@ void PatchAtlasCache::prepass(Rhi& rhi) } } -void PatchAtlasCache::transfer(Rhi& rhi, Handle ctx) +void PatchAtlasCache::transfer(Rhi& rhi, Handle ctx) { SRB2_ASSERT(ready_for_lookup()); diff --git a/src/hwr2/patch_atlas.hpp b/src/hwr2/patch_atlas.hpp index 9707074b2..85b3b1162 100644 --- a/src/hwr2/patch_atlas.hpp +++ b/src/hwr2/patch_atlas.hpp @@ -125,7 +125,7 @@ public: PatchAtlas* find_patch(srb2::NotNull patch); virtual void prepass(rhi::Rhi& rhi) override; - virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; + virtual void transfer(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void graphics(rhi::Rhi& rhi, rhi::Handle ctx) override; virtual void postpass(rhi::Rhi& rhi) override; }; diff --git a/src/info.c b/src/info.c index 94974dde9..749b2a6af 100644 --- a/src/info.c +++ b/src/info.c @@ -558,6 +558,7 @@ char sprnames[NUMSPRITES + 1][5] = "IWHP", // Instawhip "WPRE", // Instawhip Recharge + "WPRJ", // Instawhip Reject "GRNG", // Guard ring "GBDY", // Guard body @@ -581,6 +582,7 @@ char sprnames[NUMSPRITES + 1][5] = "HFX6", // Hitlag stage 6 "HFX8", // Hitlag stage 8 "HFX9", // Hitlag stage 9 + "HFXX", // Hitlag stage 10 // Kart Items "RSHE", // Rocket sneaker @@ -4022,6 +4024,7 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 0, {A_PlaySound}, sfx_s3ka0, 2, S_INSTAWHIP_RECHARGE3}, // S_INSTAWHIP_RECHARGE2 {SPR_WPRE, FF_FULLBRIGHT|FF_FLOORSPRITE|FF_ANIMATE|0, 36, {NULL}, 17, 2, S_INSTAWHIP_RECHARGE4}, // S_INSTAWHIP_RECHARGE3 {SPR_NULL, 0, 0, {A_PlaySound}, sfx_s3k7c, 2, S_NULL}, // S_INSTAWHIP_RECHARGE4 + {SPR_WPRJ, FF_ANIMATE, 9, {NULL}, 8, 1, S_NULL}, // S_INSTAWHIP_REJECT {SPR_GRNG, FF_FULLBRIGHT|FF_PAPERSPRITE|0, -1, {NULL}, 0, 0, S_NULL}, // S_BLOCKRING {SPR_GBDY, FF_FULLBRIGHT|FF_ANIMATE|0, -1, {NULL}, 4, 2, S_NULL}, // S_BLOCKBODY @@ -5320,6 +5323,7 @@ state_t states[NUMSTATES] = {SPR_HFX6, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 6, {NULL}, 5, 1, S_NULL}, // S_HITLAG_6 {SPR_HFX8, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 8, {NULL}, 7, 1, S_NULL}, // S_HITLAG_8 {SPR_HFX9, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 9, {NULL}, 8, 1, S_NULL}, // S_HITLAG_9 + {SPR_HFXX, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, 10, {NULL}, 9, 1, S_NULL}, // S_HITLAG_10 // Broly Ki Orb {SPR_LSSJ, FF_REVERSESUBTRACT|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_BROLY2}, // S_BROLY1 @@ -22861,6 +22865,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_INSTAWHIP_RECHARGE3 // raisestate }, + { // MT_INSTAWHIP_REJECT + -1, // doomednum + S_INSTAWHIP_REJECT, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 90*FRACUNIT, // radius + 90*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_BLOCKRING -1, // doomednum S_BLOCKRING, // spawnstate diff --git a/src/info.h b/src/info.h index 7cd3cc354..f8258fadd 100644 --- a/src/info.h +++ b/src/info.h @@ -1109,6 +1109,7 @@ typedef enum sprite SPR_IWHP, // Instawhip SPR_WPRE, // Instawhip Recharge + SPR_WPRJ, // Instawhip Reject SPR_GRNG, // Guard ring SPR_GBDY, // Guard body @@ -1132,6 +1133,7 @@ typedef enum sprite SPR_HFX6, // Hitlag stage 6 SPR_HFX8, // Hitlag stage 8 SPR_HFX9, // Hitlag stage 9 + SPR_HFXX, // Hitlag stage 10 // Kart Items SPR_RSHE, // Rocket sneaker @@ -4432,6 +4434,7 @@ typedef enum state S_INSTAWHIP_RECHARGE2, S_INSTAWHIP_RECHARGE3, S_INSTAWHIP_RECHARGE4, + S_INSTAWHIP_REJECT, S_BLOCKRING, S_BLOCKBODY, @@ -5750,6 +5753,7 @@ typedef enum state S_HITLAG_6, S_HITLAG_8, S_HITLAG_9, + S_HITLAG_10, // Broly Ki Orb S_BROLY1, @@ -6571,6 +6575,7 @@ typedef enum mobj_type MT_INSTAWHIP, MT_INSTAWHIP_RECHARGE, + MT_INSTAWHIP_REJECT, MT_BLOCKRING, MT_BLOCKBODY, diff --git a/src/k_hitlag.h b/src/k_hitlag.h index 02dedfc2a..cace7a964 100644 --- a/src/k_hitlag.h +++ b/src/k_hitlag.h @@ -22,7 +22,7 @@ extern "C" { #define MAXHITLAGTICS (30) #define HITLAGJITTERS (FRACUNIT / 20) -#define NUM_HITLAG_STATES (8) +#define NUM_HITLAG_STATES (9) /*-------------------------------------------------- void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage); diff --git a/src/k_hud.c b/src/k_hud.c index 660974a05..f60aff730 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1487,9 +1487,9 @@ static void K_drawKartItem(void) if (offset) { if (flipamount) // reminder that this is for 3/4p's right end of the screen. - V_DrawString(fx+2, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|V_SLIDEIN|fflags, va("x%d", stplyr->itemamount)); + V_DrawString(fx+2, fy+31, V_HUDTRANS|V_SLIDEIN|fflags, va("x%d", stplyr->itemamount)); else - V_DrawString(fx+24, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|V_SLIDEIN|fflags, va("x%d", stplyr->itemamount)); + V_DrawString(fx+24, fy+31, V_HUDTRANS|V_SLIDEIN|fflags, va("x%d", stplyr->itemamount)); } else { @@ -1811,8 +1811,8 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, U } } - workx -= V_ThinStringWidth(stickermedalinfo.targettext, splitflags|V_6WIDTHSPACE); - V_DrawThinString(workx, worky, splitflags|V_6WIDTHSPACE, stickermedalinfo.targettext); + workx -= V_ThinStringWidth(stickermedalinfo.targettext, splitflags); + V_DrawThinString(workx, worky, splitflags, stickermedalinfo.targettext); } workx -= (6 + (i*5)); @@ -2302,7 +2302,7 @@ static void K_drawBossHealthBar(void) { rolrand = 10; } - V_DrawRightAlignedThinString(startx, starty-rolrand, V_HUDTRANS|V_SLIDEIN|V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_6WIDTHSPACE, bossinfo.enemyname); + V_DrawRightAlignedThinString(startx, starty-rolrand, V_HUDTRANS|V_SLIDEIN|V_SNAPTOBOTTOM|V_SNAPTORIGHT, bossinfo.enemyname); rolrand = 0; } @@ -3288,7 +3288,7 @@ static void K_DrawTypingNotifier(fixed_t x, fixed_t y, player_t *p) static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p) { const INT32 clr = skincolors[p->skincolor].chatcolor; - const INT32 namelen = V_ThinStringWidth(player_names[p - players], V_6WIDTHSPACE|V_ALLOWLOWERCASE); + const INT32 namelen = V_ThinStringWidth(player_names[p - players], 0); UINT8 *colormap = V_GetStringColormap(clr); INT32 barx = 0, bary = 0, barw = 0; @@ -3336,7 +3336,7 @@ static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p) V_DrawFixedPatch(x, y, FRACUNIT, 0, kp_nametagstem, colormap); // Draw the name itself - V_DrawThinStringAtFixed(x + (5*FRACUNIT), y - (26*FRACUNIT), V_6WIDTHSPACE|V_ALLOWLOWERCASE|clr, player_names[p - players]); + V_DrawThinStringAtFixed(x + (5*FRACUNIT), y - (26*FRACUNIT), clr, player_names[p - players]); } typedef struct weakspotdraw_t @@ -5116,7 +5116,7 @@ static void K_DrawDirectorButton(INT32 idx, const char *label, patch_t *kp[2], I } } - textflags |= (flags | V_6WIDTHSPACE | V_ALLOWLOWERCASE); + textflags |= flags; K_drawButtonAnim(x, y - 4, flags, kp, leveltime); V_DrawRightAlignedThinString(x - 2, y, textflags, label); @@ -5209,7 +5209,7 @@ static void K_drawDistributionDebugger(void) x + (18 * scale), y + (23 * scale), scale, FRACUNIT, FRACUNIT, - V_ALLOWLOWERCASE|V_SNAPTOTOP, + V_SNAPTOTOP, NULL, HU_FONT, va("x%d", amount) ); @@ -5218,15 +5218,15 @@ static void K_drawDistributionDebugger(void) y += space; } - V_DrawString((x >> FRACBITS) + 20, 2, V_ALLOWLOWERCASE|V_SNAPTOTOP, va("useOdds[%u]", rouletteData.useOdds)); - V_DrawString((x >> FRACBITS) + 20, 10, V_ALLOWLOWERCASE|V_SNAPTOTOP, va("speed = %u", rouletteData.speed)); + V_DrawString((x >> FRACBITS) + 20, 2, V_SNAPTOTOP, va("useOdds[%u]", rouletteData.useOdds)); + V_DrawString((x >> FRACBITS) + 20, 10, V_SNAPTOTOP, va("speed = %u", rouletteData.speed)); - V_DrawString((x >> FRACBITS) + 20, 22, V_ALLOWLOWERCASE|V_SNAPTOTOP, va("baseDist = %u", rouletteData.baseDist)); - V_DrawString((x >> FRACBITS) + 20, 30, V_ALLOWLOWERCASE|V_SNAPTOTOP, va("dist = %u", rouletteData.dist)); + V_DrawString((x >> FRACBITS) + 20, 22, V_SNAPTOTOP, va("baseDist = %u", rouletteData.baseDist)); + V_DrawString((x >> FRACBITS) + 20, 30, V_SNAPTOTOP, va("dist = %u", rouletteData.dist)); - V_DrawString((x >> FRACBITS) + 20, 42, V_ALLOWLOWERCASE|V_SNAPTOTOP, va("firstDist = %u", rouletteData.firstDist)); - V_DrawString((x >> FRACBITS) + 20, 50, V_ALLOWLOWERCASE|V_SNAPTOTOP, va("secondDist = %u", rouletteData.secondDist)); - V_DrawString((x >> FRACBITS) + 20, 58, V_ALLOWLOWERCASE|V_SNAPTOTOP, va("secondToFirst = %u", rouletteData.secondToFirst)); + V_DrawString((x >> FRACBITS) + 20, 42, V_SNAPTOTOP, va("firstDist = %u", rouletteData.firstDist)); + V_DrawString((x >> FRACBITS) + 20, 50, V_SNAPTOTOP, va("secondDist = %u", rouletteData.secondDist)); + V_DrawString((x >> FRACBITS) + 20, 58, V_SNAPTOTOP, va("secondToFirst = %u", rouletteData.secondToFirst)); #ifndef ITEM_LIST_SIZE Z_Free(rouletteData.itemList); @@ -5350,19 +5350,19 @@ static void K_DrawGPRankDebugger(void) grade = K_CalculateGPGrade(&grandprixinfo.rank); - V_DrawThinString(0, 0, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_DrawThinString(0, 0, V_SNAPTOTOP|V_SNAPTOLEFT, va("POS: %d / %d", grandprixinfo.rank.position, RANK_NEUTRAL_POSITION)); - V_DrawThinString(0, 10, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_DrawThinString(0, 10, V_SNAPTOTOP|V_SNAPTOLEFT, va("PTS: %d / %d", grandprixinfo.rank.winPoints, grandprixinfo.rank.totalPoints)); - V_DrawThinString(0, 20, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_DrawThinString(0, 20, V_SNAPTOTOP|V_SNAPTOLEFT, va("LAPS: %d / %d", grandprixinfo.rank.laps, grandprixinfo.rank.totalLaps)); - V_DrawThinString(0, 30, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_DrawThinString(0, 30, V_SNAPTOTOP|V_SNAPTOLEFT, va("CONTINUES: %d", grandprixinfo.rank.continuesUsed)); - V_DrawThinString(0, 40, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_DrawThinString(0, 40, V_SNAPTOTOP|V_SNAPTOLEFT, va("PRISONS: %d / %d", grandprixinfo.rank.prisons, grandprixinfo.rank.totalPrisons)); - V_DrawThinString(0, 50, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_DrawThinString(0, 50, V_SNAPTOTOP|V_SNAPTOLEFT, va("RINGS: %d / %d", grandprixinfo.rank.rings, grandprixinfo.rank.totalRings)); - V_DrawThinString(0, 60, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_DrawThinString(0, 60, V_SNAPTOTOP|V_SNAPTOLEFT, va("EMERALD: %s", (grandprixinfo.rank.specialWon == true) ? "YES" : "NO")); switch (grade) @@ -5376,7 +5376,7 @@ static void K_DrawGPRankDebugger(void) default: { break; } } - V_DrawThinString(0, 90, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE|V_YELLOWMAP, + V_DrawThinString(0, 90, V_SNAPTOTOP|V_SNAPTOLEFT|V_YELLOWMAP, va(" ** FINAL GRADE: %c", gradeChar)); } diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 152629e7f..8324cbada 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -369,7 +369,7 @@ static void M_DrawMenuTooltips(void) if (currentMenu->menuitems[itemOn].tooltip != NULL) { V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName("MENUHINT", PU_CACHE), NULL); - V_DrawCenteredThinString(BASEVIDWIDTH/2, 12, V_ALLOWLOWERCASE|V_6WIDTHSPACE, currentMenu->menuitems[itemOn].tooltip); + V_DrawCenteredThinString(BASEVIDWIDTH/2, 12, 0, currentMenu->menuitems[itemOn].tooltip); } } @@ -400,7 +400,7 @@ static void M_DrawMenuTyping(void) if (currentMenu->menuitems[itemOn].text) { - V_DrawThinString(x + 5, y - 2, highlightflags|V_6WIDTHSPACE|V_ALLOWLOWERCASE, currentMenu->menuitems[itemOn].text); + V_DrawThinString(x + 5, y - 2, highlightflags, currentMenu->menuitems[itemOn].text); } M_DrawMenuTooltips(); @@ -414,12 +414,12 @@ static void M_DrawMenuTyping(void) V_DrawFill(x + 4, y + 4 + 5, 1, 8+6, 121); V_DrawFill(x + 5 + boxwidth - 8, y + 4 + 5, 1, 8+6, 121); - V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, cv->string); + V_DrawString(x + 8, y + 12, 0, cv->string); if (skullAnimCounter < 4 && menutyping.menutypingclose == false && menutyping.menutypingfade == (menutyping.keyboardtyping ? 9 : 18)) { - V_DrawCharacter(x + 8 + V_StringWidth(cv->string, 0), y + 12 + 1, '_' | 0x80, false); + V_DrawCharacter(x + 8 + V_StringWidth(cv->string, 0), y + 12 + 1, '_', false); } const INT32 buttonwidth = ((boxwidth + 1)/NUMVIRTUALKEYSINROW); @@ -449,7 +449,7 @@ static void M_DrawMenuTyping(void) j = 0; while (j < NUMVIRTUALKEYSINROW) { - INT32 mflag = V_ALLOWLOWERCASE|V_6WIDTHSPACE; + INT32 mflag = 0; INT16 c = virtualKeyboard[i][j]; INT32 buttonspacing = 1; @@ -595,11 +595,11 @@ static void M_DrawMenuTyping(void) // Some contextual stuff if (menutyping.keyboardtyping) { - V_DrawThinString(returnx, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_GRAYMAP, "Type using your keyboard. Press Enter to confirm & exit.\nUse your controller or any directional input to use the Virtual Keyboard.\n"); + V_DrawThinString(returnx, y, V_GRAYMAP, "Type using your keyboard. Press Enter to confirm & exit.\nUse your controller or any directional input to use the Virtual Keyboard.\n"); } else { - V_DrawThinString(returnx, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_GRAYMAP, "Type using the Virtual Keyboard. Use the \'OK\' button to confirm & exit.\nPress any keyboard key not bound to a control to use it."); + V_DrawThinString(returnx, y, V_GRAYMAP, "Type using the Virtual Keyboard. Use the \'OK\' button to confirm & exit.\nPress any keyboard key not bound to a control to use it."); } } @@ -622,7 +622,7 @@ void M_DrawMenuMessage(void) if (menumessage.header != NULL) { - V_DrawThinString(x, y - 10, highlightflags|V_6WIDTHSPACE|V_ALLOWLOWERCASE, menumessage.header); + V_DrawThinString(x, y - 10, highlightflags, menumessage.header); } if (menumessage.defaultstr) @@ -640,11 +640,11 @@ void M_DrawMenuMessage(void) push = ((menumessage.timer % (anim_duration * 2)) < anim_duration); } - workx -= V_ThinStringWidth(menumessage.defaultstr, V_6WIDTHSPACE|V_ALLOWLOWERCASE); + workx -= V_ThinStringWidth(menumessage.defaultstr, 0); V_DrawThinString( workx, worky + 1, - V_6WIDTHSPACE|V_ALLOWLOWERCASE - | ((push && (menumessage.closing & MENUMESSAGECLOSE)) ? highlightflags : 0), + ((push && (menumessage.closing & MENUMESSAGECLOSE)) + ? highlightflags : 0), menumessage.defaultstr ); @@ -671,11 +671,11 @@ void M_DrawMenuMessage(void) if (menumessage.closing) push = !push; - workx -= V_ThinStringWidth(menumessage.confirmstr, V_6WIDTHSPACE|V_ALLOWLOWERCASE); + workx -= V_ThinStringWidth(menumessage.confirmstr, 0); V_DrawThinString( workx, worky + 1, - V_6WIDTHSPACE|V_ALLOWLOWERCASE - | ((push && (menumessage.closing & MENUMESSAGECLOSE)) ? highlightflags : 0), + ((push && (menumessage.closing & MENUMESSAGECLOSE)) + ? highlightflags : 0), menumessage.confirmstr ); @@ -733,7 +733,7 @@ void M_DrawMenuMessage(void) } } - V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2, y, V_ALLOWLOWERCASE, string); + V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2, y, 0, string); y += 8; } } @@ -782,7 +782,7 @@ void M_Drawer(void) if (customversionstring[0] != '\0') { V_DrawThinString(vid.dupx, vid.height - 20*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT, "Mod version:"); - V_DrawThinString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring); + V_DrawThinString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT, customversionstring); } else { @@ -817,7 +817,7 @@ void M_Drawer(void) if (window_notinfocus && cv_showfocuslost.value) { M_DrawTextBox((BASEVIDWIDTH/2) - (60), (BASEVIDHEIGHT/2) - (16), 13, 2); - V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), highlightflags, "Focus Lost"); + V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), highlightflags|V_FORCEUPPERCASE, "Focus Lost"); } } @@ -930,7 +930,7 @@ void M_DrawGenericMenu(void) V_DrawString(x + (skullAnimCounter/5) + 6, y + 12, highlightflags, "\x1D"); } - V_DrawString(x + xoffs + 8, y + 12, V_ALLOWLOWERCASE, cv->string); + V_DrawString(x + xoffs + 8, y + 12, 0, cv->string); y += 16; } @@ -1086,7 +1086,7 @@ void M_DrawKartGamemodeMenu(void) (type == IT_TRANSTEXT2 ? V_TRANSLUCENT : 0 - )|V_ALLOWLOWERCASE, + ), colormap, currentMenu->menuitems[i].text); } @@ -1170,7 +1170,7 @@ void M_DrawMessageMenu(void) } } - V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2,y,V_ALLOWLOWERCASE,string); + V_DrawString((BASEVIDWIDTH - V_StringWidth(string, 0))/2,y,0,string); y += 8; //SHORT(hu_font[0]->height); } } @@ -1726,7 +1726,7 @@ static void M_DrawCharSelectPreview(UINT8 num) else if (p->mdepth == CSSTEP_ASKCHANGES) { UINT8 i; - char choices[2][9] = {"All good", "Change"}; + char choices[2][9] = {"ALL GOOD", "CHANGE"}; INT32 xpos = x+8; INT32 ypos = y+38; @@ -1739,7 +1739,7 @@ static void M_DrawCharSelectPreview(UINT8 num) if (p->changeselect == i) V_DrawScaledPatch(xpos, cy, 0, W_CachePatchName("M_CURSOR", PU_CACHE)); - V_DrawThinString(xpos+16, cy, (p->changeselect == i ? highlightflags : 0)|V_6WIDTHSPACE, choices[i]); + V_DrawThinString(xpos+16, cy, (p->changeselect == i ? highlightflags : 0), choices[i]); } } @@ -1753,17 +1753,17 @@ static void M_DrawCharSelectPreview(UINT8 num) if (p->clonenum < setup_chargrid[p->gridx][p->gridy].numskins && setup_chargrid[p->gridx][p->gridy].skinlist[p->clonenum] < numskins) { - V_DrawThinString(x-3, y+12, V_6WIDTHSPACE, + V_DrawThinString(x-3, y+12, 0, skins[setup_chargrid[p->gridx][p->gridy].skinlist[p->clonenum]].name); randomskin = (skins[setup_chargrid[p->gridx][p->gridy].skinlist[p->clonenum]].flags & SF_IRONMAN); } else { - V_DrawThinString(x-3, y+12, V_6WIDTHSPACE, va("BAD CLONENUM %u", p->clonenum)); + V_DrawThinString(x-3, y+12, 0, va("BAD CLONENUM %u", p->clonenum)); } /* FALLTHRU */ case CSSTEP_CHARS: // Character Select grid - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, va("Class %c (s %c - w %c)", + V_DrawThinString(x-3, y+2, 0, va("Class %c (s %c - w %c)", ('A' + R_GetEngineClass(p->gridx+1, p->gridy+1, randomskin)), (randomskin ? '?' : ('1'+p->gridx)), @@ -1774,55 +1774,55 @@ static void M_DrawCharSelectPreview(UINT8 num) case CSSTEP_COLORS: // Select color if (p->color < numskincolors) { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, skincolors[p->color].name); + V_DrawThinString(x-3, y+2, 0, skincolors[p->color].name); } else { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, va("BAD COLOR %u", p->color)); + V_DrawThinString(x-3, y+2, 0, va("BAD COLOR %u", p->color)); } break; case CSSTEP_FOLLOWERCATEGORY: if (p->followercategory == -1) { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, "None"); + V_DrawThinString(x-3, y+2, 0, "None"); } else { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, + V_DrawThinString(x-3, y+2, 0, followercategories[setup_followercategories[p->followercategory][1]].name); } break; case CSSTEP_FOLLOWER: if (p->followern == -1) { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, "None"); + V_DrawThinString(x-3, y+2, 0, "None"); } else { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, + V_DrawThinString(x-3, y+2, 0, followers[p->followern].name); } break; case CSSTEP_FOLLOWERCOLORS: if (p->followercolor == FOLLOWERCOLOR_MATCH) { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, "Match"); + V_DrawThinString(x-3, y+2, 0, "Match"); } else if (p->followercolor == FOLLOWERCOLOR_OPPOSITE) { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, "Opposite"); + V_DrawThinString(x-3, y+2, 0, "Opposite"); } else if (p->followercolor < numskincolors) { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, skincolors[p->followercolor].name); + V_DrawThinString(x-3, y+2, 0, skincolors[p->followercolor].name); } else { - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, va("BAD FOLLOWERCOLOR %u", p->followercolor)); + V_DrawThinString(x-3, y+2, 0, va("BAD FOLLOWERCOLOR %u", p->followercolor)); } break; default: - V_DrawThinString(x-3, y+2, V_6WIDTHSPACE, "[extrainfo mode]"); + V_DrawThinString(x-3, y+2, 0, "[extrainfo mode]"); break; } } @@ -2064,8 +2064,8 @@ static void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p) if (p != NULL) { V_DrawProfileNum(x + 37 + 10, y + 131, 0, PR_GetProfileNum(p)); - V_DrawCenteredThinString(x, y + 141, V_GRAYMAP|V_6WIDTHSPACE, p->playername); - V_DrawCenteredThinString(x, y + 151, V_GRAYMAP|V_6WIDTHSPACE, GetPrettyRRID(p->public_key, true)); + V_DrawCenteredThinString(x, y + 141, V_GRAYMAP, p->playername); + V_DrawCenteredThinString(x, y + 151, V_GRAYMAP, GetPrettyRRID(p->public_key, true)); } } @@ -2293,7 +2293,7 @@ void M_DrawRaceDifficulty(void) consvar_t *cv = currentMenu->menuitems[i].itemaction.cvar; V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, W_CachePatchName("MENUSHRT", PU_CACHE), colormap); - V_DrawCenteredGamemodeString(centx, y - 3, V_ALLOWLOWERCASE, colormap, cv->string); + V_DrawCenteredGamemodeString(centx, y - 3, 0, colormap, cv->string); if (i == itemOn) { @@ -2308,7 +2308,7 @@ void M_DrawRaceDifficulty(void) else // not a cvar { V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, W_CachePatchName("MENUPLTR", PU_CACHE), colormap); - V_DrawGamemodeString(x + 16, y - 3, V_ALLOWLOWERCASE, colormap, currentMenu->menuitems[i].text); + V_DrawGamemodeString(x + 16, y - 3, 0, colormap, currentMenu->menuitems[i].text); } x += GM_XOFFSET; y += GM_YOFFSET; @@ -2917,7 +2917,6 @@ void M_DrawTimeAttack(void) if (mapheaderinfo[levellist.choosemap]->ghostCount <= 1) drawarrows = false; - optflags |= V_ALLOWLOWERCASE; if (mapheaderinfo[levellist.choosemap] == NULL) str = "Invalid map"; else if (cv_dummystaff.value > mapheaderinfo[levellist.choosemap]->ghostCount) @@ -3009,7 +3008,7 @@ static void M_MPOptDrawer(menu_t *m, INT16 extend[3][3]) } } V_DrawFixedPatch((x + (extend[i][2]/2)) *FRACUNIT, (y + extend[i][2])*FRACUNIT, FRACUNIT, 0, buttback, colormap); - V_DrawCenteredGamemodeString(x, y - 3, V_ALLOWLOWERCASE, colormap, m->menuitems[i].text); + V_DrawCenteredGamemodeString(x, y - 3, 0, colormap, m->menuitems[i].text); } break; } @@ -3061,7 +3060,7 @@ void M_DrawMPHost(void) // Ideally we'd calculate this but it's not worth it for a 1-off menu probably..... V_DrawFixedPatch(xp<width/2), yp -3, V_ALLOWLOWERCASE, colormap, currentMenu->menuitems[i].text); + V_DrawCenteredGamemodeString(xp + (gobutt->width/2), yp -3, 0, colormap, currentMenu->menuitems[i].text); } else { @@ -3069,14 +3068,14 @@ void M_DrawMPHost(void) { case IT_TRANSTEXT2: { - V_DrawThinString(xp, yp, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_TRANSLUCENT, currentMenu->menuitems[i].text); + V_DrawThinString(xp, yp, V_TRANSLUCENT, currentMenu->menuitems[i].text); xp += 5; yp += 11; break; } case IT_STRING: { - V_DrawThinString(xp, yp, V_ALLOWLOWERCASE|V_6WIDTHSPACE | (i == itemOn ? highlightflags : 0), currentMenu->menuitems[i].text); + V_DrawThinString(xp, yp, (i == itemOn ? highlightflags : 0), currentMenu->menuitems[i].text); // Cvar specific handling switch (currentMenu->menuitems[i].status & IT_TYPE) @@ -3095,14 +3094,14 @@ void M_DrawMPHost(void) V_DrawString(xp + (skullAnimCounter/5) + 94, yp+1, highlightflags, "\x1D"); } - V_DrawThinString(xp + xoffs + 96, yp, V_ALLOWLOWERCASE|V_6WIDTHSPACE, cv->string); + V_DrawThinString(xp + xoffs + 96, yp, 0, cv->string); } break; default: - w = V_ThinStringWidth(cv->string, V_6WIDTHSPACE); - V_DrawThinString(xp + 138 - w, yp, ((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|V_6WIDTHSPACE, cv->string); + w = V_ThinStringWidth(cv->string, 0); + V_DrawThinString(xp + 138 - w, yp, ((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags), cv->string); if (i == itemOn) { V_DrawCharacter(xp + 138 - 10 - w - (skullAnimCounter/5), yp, '\x1C' | highlightflags, false); // left arrow @@ -3117,8 +3116,8 @@ void M_DrawMPHost(void) if (currentMenu->menuitems[i].itemaction.routine != M_HandleHostMenuGametype) break; - w = V_ThinStringWidth(gametypes[menugametype]->name, V_6WIDTHSPACE); - V_DrawThinString(xp + 138 - w, yp, highlightflags|V_6WIDTHSPACE, gametypes[menugametype]->name); + w = V_ThinStringWidth(gametypes[menugametype]->name, 0); + V_DrawThinString(xp + 138 - w, yp, highlightflags, gametypes[menugametype]->name); if (i == itemOn) { V_DrawCharacter(xp + 138 - 10 - w - (skullAnimCounter/5), yp, '\x1C' | highlightflags, false); // left arrow @@ -3188,7 +3187,7 @@ void M_DrawMPJoinIP(void) strcpy(str, "---"); // If that fails too then there's nothing! } - V_DrawThinString(xp, yp, V_ALLOWLOWERCASE | ((i == itemOn || currentMenu->menuitems[i].status & IT_SPACE) ? highlightflags : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, str); + V_DrawThinString(xp, yp, ((i == itemOn || currentMenu->menuitems[i].status & IT_SPACE) ? highlightflags : 0), str); // Cvar specific handling switch (currentMenu->menuitems[i].status & IT_TYPE) @@ -3213,7 +3212,7 @@ void M_DrawMPJoinIP(void) V_DrawString(xp + (skullAnimCounter/5) + 17, yp+1, highlightflags, "\x1D"); } - V_DrawThinString(xp + xoffs + 18, yp, V_ALLOWLOWERCASE|V_6WIDTHSPACE, cv->string); + V_DrawThinString(xp + xoffs + 18, yp, 0, cv->string); } /*// On this specific menu the only time we'll ever see this is for the connect by IP typefield. @@ -3361,16 +3360,16 @@ void M_DrawMPServerBrowser(void) V_DrawFixedPatch(startx*FRACUNIT, (starty + ypos)*FRACUNIT, FRACUNIT, transflag, racegt ? raceh : batlh, NULL); // Server name: - V_DrawString(startx+11, starty + ypos + 6, V_ALLOWLOWERCASE|transflag, serverlist[i].info.servername); + V_DrawString(startx+11, starty + ypos + 6, transflag, serverlist[i].info.servername); // Ping: - V_DrawThinString(startx + 191, starty + ypos + 7, V_6WIDTHSPACE|transflag, va("%03d", serverlist[i].info.time)); + V_DrawThinString(startx + 191, starty + ypos + 7, transflag, va("%03d", serverlist[i].info.time)); // Playercount - V_DrawThinString(startx + 214, starty + ypos + 7, V_6WIDTHSPACE|transflag, va("%02d/%02d", serverlist[i].info.numberofplayer, serverlist[i].info.maxplayer)); + V_DrawThinString(startx + 214, starty + ypos + 7, transflag, va("%02d/%02d", serverlist[i].info.numberofplayer, serverlist[i].info.maxplayer)); // Power Level - V_DrawThinString(startx + 248, starty + ypos, V_6WIDTHSPACE|transflag, va("%04d PLv", serverlist[i].info.avgpwrlv)); + V_DrawThinString(startx + 248, starty + ypos, transflag, va("%04d PLv", serverlist[i].info.avgpwrlv)); // game speed if applicable: if (racegt) @@ -3389,7 +3388,7 @@ void M_DrawMPServerBrowser(void) V_DrawFill(0, 53, 320, 1, 31); V_DrawFill(0, 55, 320, 1, 31); - V_DrawCenteredGamemodeString(160, 2, V_ALLOWLOWERCASE, 0, "Server Browser"); + V_DrawCenteredGamemodeString(160, 2, 0, 0, "Server Browser"); // normal menu options M_DrawGenericMenu(); @@ -3434,7 +3433,7 @@ void M_DrawOptionsMovingButton(void) UINT8 *c = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PLAGUE, GTC_CACHE); V_DrawFixedPatch((optionsmenu.optx)*FRACUNIT, (optionsmenu.opty)*FRACUNIT, FRACUNIT, 0, butt, c); - V_DrawCenteredGamemodeString((optionsmenu.optx)-3, (optionsmenu.opty) - 16, V_ALLOWLOWERCASE, c, OPTIONS_MainDef.menuitems[OPTIONS_MainDef.lastOn].text); + V_DrawCenteredGamemodeString((optionsmenu.optx)-3, (optionsmenu.opty) - 16, 0, c, OPTIONS_MainDef.menuitems[OPTIONS_MainDef.lastOn].text); } void M_DrawOptions(void) @@ -3465,7 +3464,7 @@ void M_DrawOptions(void) if (!(menutransition.tics && i == itemOn)) { V_DrawFixedPatch(px*FRACUNIT, py*FRACUNIT, FRACUNIT, 0, buttback, c); - V_DrawCenteredGamemodeString(px-3, py - 16, V_ALLOWLOWERCASE|tflag, (i == itemOn ? c : NULL), currentMenu->menuitems[i].text); + V_DrawCenteredGamemodeString(px-3, py - 16, tflag, (i == itemOn ? c : NULL), currentMenu->menuitems[i].text); } y += 48; @@ -3552,7 +3551,7 @@ void M_DrawGenericOptions(void) V_DrawString(x + (skullAnimCounter/5) + 6, y + 12, highlightflags, "\x1D"); } - V_DrawString(x + xoffs + 8, y + 12, V_ALLOWLOWERCASE, cv->string); + V_DrawString(x + xoffs + 8, y + 12, 0, cv->string); y += 16; } @@ -3649,7 +3648,7 @@ void M_DrawProfileErase(void) } V_DrawString(x, y, - (i == optionsmenu.eraseprofilen ? highlightflags : 0)|V_ALLOWLOWERCASE, + (i == optionsmenu.eraseprofilen ? highlightflags : 0), va("%sPRF%03d - %s (%s)", (cv_currprofile.value == i) ? "[In use] " : "", i, pr->profilename, pr->playername)); @@ -3705,7 +3704,7 @@ void M_DrawEditProfile(void) V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName("MENUHINT", PU_CACHE), NULL); if (currentMenu->menuitems[itemOn].tooltip != NULL) { - V_DrawCenteredThinString(224, 12, V_ALLOWLOWERCASE|V_6WIDTHSPACE, currentMenu->menuitems[itemOn].tooltip); + V_DrawCenteredThinString(224, 12, 0, currentMenu->menuitems[itemOn].tooltip); } // Draw the menu options... @@ -3721,7 +3720,7 @@ void M_DrawEditProfile(void) // Background V_DrawFill(0, y, 400 - (menutransition.tics*64), 24, itemOn == i ? 169 : 30); // 169 is the plague colourization // Text - V_DrawGamemodeString(x + (menutransition.tics*32), y - 6, V_ALLOWLOWERCASE|tflag, colormap, currentMenu->menuitems[i].text); + V_DrawGamemodeString(x + (menutransition.tics*32), y - 6, tflag, colormap, currentMenu->menuitems[i].text); // Cvar specific handling /*switch (currentMenu->menuitems[i].status & IT_TYPE) @@ -3733,9 +3732,9 @@ void M_DrawEditProfile(void) { case IT_CV_STRING: V_DrawFill(0, y+24, 400 - (menutransition.tics*64), 16, itemOn == i ? 169 : 30); // 169 is the plague colourization - V_DrawString(x + 8, y + 29, V_ALLOWLOWERCASE, cv->string); + V_DrawString(x + 8, y + 29, 0, cv->string); if (skullAnimCounter < 4 && i == itemOn) - V_DrawCharacter(x + 8 + V_StringWidth(cv->string, 0), y + 29, '_' | 0x80, false); + V_DrawCharacter(x + 8 + V_StringWidth(cv->string, 0), y + 29, '_', false); y += 16; } } @@ -3833,7 +3832,7 @@ void M_DrawProfileControls(void) V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName("MENUHINT", PU_CACHE), NULL); if (currentMenu->menuitems[itemOn].tooltip != NULL) { - V_DrawCenteredThinString(229, 12, V_ALLOWLOWERCASE|V_6WIDTHSPACE, currentMenu->menuitems[itemOn].tooltip); + V_DrawCenteredThinString(229, 12, 0, currentMenu->menuitems[itemOn].tooltip); } V_DrawFill(0, 0, 138, 200, 31); // Black border @@ -3891,7 +3890,7 @@ void M_DrawProfileControls(void) } else if (currentMenu->menuitems[i].status & IT_CONTROL) { - UINT32 vflags = V_6WIDTHSPACE; + UINT32 vflags = V_FORCEUPPERCASE; INT32 gc = currentMenu->menuitems[i].mvar1; UINT8 available = 0, set = 0; @@ -3948,7 +3947,7 @@ void M_DrawProfileControls(void) if (!set) { if (!G_KeyBindIsNecessary(gc)) - vflags = V_REDMAP|V_6WIDTHSPACE; + vflags = V_REDMAP; } else #endif @@ -4180,7 +4179,7 @@ void M_DrawItemToggles(void) { V_DrawScaledPatch(x, y, 0, W_CachePatchName("K_ISMUL", PU_CACHE)); V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].mvar1, true), PU_CACHE)); - V_DrawString(x+24, y+31, V_ALLOWLOWERCASE|translucent, va("x%d", drawnum)); + V_DrawString(x+24, y+31, translucent, va("x%d", drawnum)); } else V_DrawScaledPatch(x, y, translucent, W_CachePatchName(K_GetItemPatch(currentMenu->menuitems[thisitem].mvar1, true), PU_CACHE)); @@ -4245,7 +4244,7 @@ void M_DrawExtrasMovingButton(void) UINT8 *c = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PLAGUE, GTC_CACHE); V_DrawFixedPatch((extrasmenu.extx)*FRACUNIT, (extrasmenu.exty)*FRACUNIT, FRACUNIT, 0, butt, c); - V_DrawCenteredGamemodeString((extrasmenu.extx)-3, (extrasmenu.exty) - 16, V_ALLOWLOWERCASE, c, EXTRAS_MainDef.menuitems[EXTRAS_MainDef.lastOn].text); + V_DrawCenteredGamemodeString((extrasmenu.extx)-3, (extrasmenu.exty) - 16, 0, c, EXTRAS_MainDef.menuitems[EXTRAS_MainDef.lastOn].text); } void M_DrawExtras(void) @@ -4277,7 +4276,7 @@ void M_DrawExtras(void) if (!(menutransition.tics && i == itemOn)) { V_DrawFixedPatch(px*FRACUNIT, py*FRACUNIT, FRACUNIT, 0, buttback, c); - V_DrawCenteredGamemodeString(px-3, py - 16, V_ALLOWLOWERCASE|tflag, (i == itemOn ? c : NULL), currentMenu->menuitems[i].text); + V_DrawCenteredGamemodeString(px-3, py - 16, tflag, (i == itemOn ? c : NULL), currentMenu->menuitems[i].text); } y += 48; @@ -4644,13 +4643,13 @@ void M_DrawKickHandler(void) P_IsMachineLocalPlayer(&players[i]) ? highlightflags : 0 - )|V_ALLOWLOWERCASE|V_6WIDTHSPACE, + ), player_names[i] ); V_DrawRightAlignedThinString( x+118, y-2, - V_ALLOWLOWERCASE|V_6WIDTHSPACE, + 0, (players[i].spectator) ? "SPECTATOR" : "PLAYING" ); } @@ -4681,7 +4680,7 @@ void M_DrawKickHandler(void) V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName("MENUHINT", PU_CACHE), NULL); V_DrawCenteredThinString( BASEVIDWIDTH/2, 12, - V_ALLOWLOWERCASE|V_6WIDTHSPACE, + 0, (playerkickmenu.adminpowered) ? "You are using ""\x85""Admin Tools""\x80"", ""\x83""(A)""\x80"" to kick and ""\x84""(C)""\x80"" to ban" : K_GetMidVoteLabel(menucallvote) @@ -4734,7 +4733,7 @@ void M_DrawPlaybackMenu(void) V_DrawCharacter(currentMenu->x + currentMenu->menuitems[i].mvar1 + 4, currentMenu->y + 14, '\x1A' | V_SNAPTOTOP|highlightflags, false); - V_DrawCenteredString(BASEVIDWIDTH/2, currentMenu->y + 18, V_SNAPTOTOP|V_ALLOWLOWERCASE, currentMenu->menuitems[i].text); + V_DrawCenteredString(BASEVIDWIDTH/2, currentMenu->y + 18, V_SNAPTOTOP, currentMenu->menuitems[i].text); if ((currentMenu->menuitems[i].status & IT_TYPE) == IT_ARROWS) { @@ -4765,7 +4764,7 @@ void M_DrawPlaybackMenu(void) continue; } - V_DrawCenteredString(BASEVIDWIDTH/2, currentMenu->y + 38, V_SNAPTOTOP|V_ALLOWLOWERCASE|highlightflags, str); + V_DrawCenteredString(BASEVIDWIDTH/2, currentMenu->y + 38, V_SNAPTOTOP|highlightflags, str); } } } @@ -4833,7 +4832,7 @@ void M_DrawAddons(void) y -= 16; - V_DrawString(x-21, y + (lsheadingheight - 12), highlightflags|V_ALLOWLOWERCASE, M_AddonsHeaderPath()); + V_DrawString(x-21, y + (lsheadingheight - 12), highlightflags, M_AddonsHeaderPath()); V_DrawFill(x-21, y + (lsheadingheight - 3), MAXSTRINGLENGTH*8+6, 1, hilicol); //V_DrawFill(x-21, y + (lsheadingheight - 2), MAXSTRINGLENGTH*8+6, 1, 30); @@ -4849,7 +4848,7 @@ void M_DrawAddons(void) xoffs += 8; V_DrawString(x + (skullAnimCounter/5) - 20, y+8, highlightflags, "\x1D"); } - V_DrawString(x + xoffs - 18, y+8, V_ALLOWLOWERCASE|tflag, str); + V_DrawString(x + xoffs - 18, y+8, tflag, str); } V_DrawSmallScaledPatch(x - (21 + 5 + 16), y+4, (menusearch[0] ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+3]); @@ -4900,7 +4899,7 @@ void M_DrawAddons(void) for (; i < m; i++) { - UINT32 flags = V_ALLOWLOWERCASE; + UINT32 flags = 0; if (y > BASEVIDHEIGHT) break; if (dirmenu[i]) #define type (UINT8)(dirmenu[i][DIR_TYPE]) @@ -4917,7 +4916,7 @@ void M_DrawAddons(void) if (itemOn == 1 && (size_t)i == dir_on[menudepthleft]) { V_DrawFixedPatch((x-(16+4))<width); - V_DrawThinString(x, y + 1, V_6WIDTHSPACE|V_ALLOWLOWERCASE|highlightflags, "Toggle"); + V_DrawThinString(x, y + 1, highlightflags, "Toggle"); break; @@ -5924,7 +5923,7 @@ challengedesc: ) ) { - V_DrawCenteredString(BASEVIDWIDTH/2, 120 + 32, V_ALLOWLOWERCASE, challengesmenu.unlockcondition); + V_DrawCenteredString(BASEVIDWIDTH/2, 120 + 32, 0, challengesmenu.unlockcondition); } } @@ -6027,12 +6026,12 @@ static void M_DrawStatsMaps(void) else str = "LOST AND FOUND"; - V_DrawThinString(20, y, V_6WIDTHSPACE|highlightflags, str); + V_DrawThinString(20, y, highlightflags, str); } if (dotopname) { - V_DrawRightAlignedThinString(BASEVIDWIDTH-20, y, V_6WIDTHSPACE|highlightflags, "MEDALS"); + V_DrawRightAlignedThinString(BASEVIDWIDTH-20, y, highlightflags, "MEDALS"); dotopname = false; } @@ -6047,7 +6046,7 @@ static void M_DrawStatsMaps(void) { char *title = G_BuildMapTitle(mnum+1); - V_DrawThinString(24, y, V_6WIDTHSPACE, title); + V_DrawThinString(24, y, V_FORCEUPPERCASE, title); Z_Free(title); } @@ -6067,7 +6066,7 @@ static void M_DrawStatsMaps(void) { if (i == 1) { - V_DrawThinString(20, y, V_6WIDTHSPACE|highlightflags, "EXTRA MEDALS"); + V_DrawThinString(20, y, highlightflags, "EXTRA MEDALS"); if (location) { y += STATSSTEP; @@ -6106,15 +6105,15 @@ static void M_DrawStatsMaps(void) UINT16 color = min(unlockables[i].color, numskincolors-1); if (!color) color = SKINCOLOR_GOLD; - V_DrawSmallMappedPatch(291, y+1, V_6WIDTHSPACE, W_CachePatchName("GOTITA", PU_CACHE), + V_DrawSmallMappedPatch(291, y+1, 0, W_CachePatchName("GOTITA", PU_CACHE), R_GetTranslationColormap(TC_DEFAULT, color, GTC_MENUCACHE)); } else { - V_DrawSmallScaledPatch(291, y+1, V_6WIDTHSPACE, W_CachePatchName("NEEDIT", PU_CACHE)); + V_DrawSmallScaledPatch(291, y+1, 0, W_CachePatchName("NEEDIT", PU_CACHE)); } - V_DrawThinString(24, y, V_6WIDTHSPACE, va("%s", unlockables[i].name)); + V_DrawThinString(24, y, 0, va("%s", unlockables[i].name)); } y += STATSSTEP; @@ -6143,7 +6142,7 @@ void M_DrawStatistics(void) } beststr[0] = 0; - V_DrawThinString(20, 22, V_6WIDTHSPACE|V_ALLOWLOWERCASE|highlightflags, "Total Play Time:"); + V_DrawThinString(20, 22, highlightflags, "Total Play Time:"); besttime = G_TicsToHours(gamedata->totalplaytime); if (besttime) { @@ -6162,10 +6161,10 @@ void M_DrawStatistics(void) } besttime = G_TicsToSeconds(gamedata->totalplaytime); strcat(beststr, va("%i second%s", besttime, (besttime == 1 ? "" : "s"))); - V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 22, V_6WIDTHSPACE, beststr); + V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 22, 0, beststr); beststr[0] = 0; - V_DrawThinString(20, 32, V_6WIDTHSPACE|V_ALLOWLOWERCASE|highlightflags, "Total Rings:"); + V_DrawThinString(20, 32, highlightflags, "Total Rings:"); if (gamedata->totalrings > GDMAX_RINGS) { sprintf(beststr, "%c999,999,999+", '\x82'); @@ -6182,10 +6181,10 @@ void M_DrawStatistics(void) { sprintf(beststr, "%u", gamedata->totalrings); } - V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 32, V_6WIDTHSPACE, va("%s collected", beststr)); + V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 32, 0, va("%s collected", beststr)); beststr[0] = 0; - V_DrawThinString(20, 42, V_6WIDTHSPACE|V_ALLOWLOWERCASE|highlightflags, "Total Rounds:"); + V_DrawThinString(20, 42, highlightflags, "Total Rounds:"); strcat(beststr, va("%u Race", gamedata->roundsplayed[GDGT_RACE])); @@ -6206,11 +6205,11 @@ void M_DrawStatistics(void) strcat(beststr, va(", %u Custom", gamedata->roundsplayed[GDGT_CUSTOM])); } - V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 42, V_6WIDTHSPACE, beststr); + V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 42, 0, beststr); if (!statisticsmenu.maplist) { - V_DrawCenteredThinString(BASEVIDWIDTH/2, 62, V_6WIDTHSPACE|V_ALLOWLOWERCASE, "No maps!?"); + V_DrawCenteredThinString(BASEVIDWIDTH/2, 62, 0, "No maps!?"); return; } @@ -6230,17 +6229,17 @@ void M_DrawStatistics(void) besttime += mapheaderinfo[i]->records.time; } - V_DrawThinString(20, 60, V_6WIDTHSPACE|V_ALLOWLOWERCASE, "Combined time records:"); + V_DrawThinString(20, 60, 0, "Combined time records:"); sprintf(beststr, "%i:%02i:%02i.%02i", G_TicsToHours(besttime), G_TicsToMinutes(besttime, false), G_TicsToSeconds(besttime), G_TicsToCentiseconds(besttime)); - V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 60, V_6WIDTHSPACE|V_ALLOWLOWERCASE|(mapsunfinished ? V_REDMAP : 0), beststr); + V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 60, (mapsunfinished ? V_REDMAP : 0), beststr); if (mapsunfinished) - V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 70, V_6WIDTHSPACE|V_ALLOWLOWERCASE|V_REDMAP, va("(%d unfinished)", mapsunfinished)); + V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 70, V_REDMAP, va("(%d unfinished)", mapsunfinished)); else - V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 70, V_6WIDTHSPACE|V_ALLOWLOWERCASE, "(complete)"); + V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 70, 0, "(complete)"); - V_DrawThinString(32, 70, V_6WIDTHSPACE, va("x %d/%d", M_CountMedals(false, false), M_CountMedals(true, false))); + V_DrawThinString(32, 70, 0, va("x %d/%d", M_CountMedals(false, false), M_CountMedals(true, false))); V_DrawSmallMappedPatch(20, 70, 0, W_CachePatchName("GOTITA", PU_CACHE), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GOLD, GTC_MENUCACHE)); @@ -6443,15 +6442,15 @@ void M_DrawSoundTest(void) if (!titletext) titletext = "Untitled"; // Har har. - V_DrawThinString(x+1, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, titletext); + V_DrawThinString(x+1, y, 0, titletext); if (soundtest.current->numtracks > 1) - V_DrawThinString(x+1, (y += 10), V_ALLOWLOWERCASE|V_6WIDTHSPACE, va("Track %c", 'A'+soundtest.currenttrack)); + V_DrawThinString(x+1, (y += 10), 0, va("Track %c", 'A'+soundtest.currenttrack)); if (soundtest.current->author) - V_DrawThinString(x+1, (y += 10), V_ALLOWLOWERCASE|V_6WIDTHSPACE, soundtest.current->author); + V_DrawThinString(x+1, (y += 10), 0, soundtest.current->author); if (soundtest.current->source) - V_DrawThinString(x+1, (y += 10), V_ALLOWLOWERCASE|V_6WIDTHSPACE, soundtest.current->source); + V_DrawThinString(x+1, (y += 10), 0, soundtest.current->source); if (soundtest.current->composers) - V_DrawThinString(x+1, (y += 10), V_ALLOWLOWERCASE|V_6WIDTHSPACE, soundtest.current->composers); + V_DrawThinString(x+1, (y += 10), 0, soundtest.current->composers); } else { @@ -6459,11 +6458,11 @@ void M_DrawSoundTest(void) titletext = "Sound Test"; - V_DrawThinString(x+1, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, "Track "); + V_DrawThinString(x+1, y, 0, "Track "); V_DrawThinString( - x+1 + V_ThinStringWidth("Track ", V_ALLOWLOWERCASE|V_6WIDTHSPACE), + x+1 + V_ThinStringWidth("Track ", 0), y, - V_6WIDTHSPACE, + 0, va("%04X - %s", cv_soundtest.value, sfxstr) ); } @@ -6578,7 +6577,7 @@ void M_DrawSoundTest(void) ); // Text - V_DrawCenteredThinString(x + 13, y + 1, V_6WIDTHSPACE, currentMenu->menuitems[i].text); + V_DrawCenteredThinString(x + 13, y + 1, 0, currentMenu->menuitems[i].text); V_ClearClipRect(); @@ -6667,7 +6666,7 @@ void M_DrawSoundTest(void) } else { - V_DrawCenteredThinString(x + 13, y + 1, V_6WIDTHSPACE, currentMenu->menuitems[i].text); + V_DrawCenteredThinString(x + 13, y + 1, 0, currentMenu->menuitems[i].text); } x += 27; @@ -6722,17 +6721,17 @@ void M_DrawDiscordRequests(void) V_DrawFixedPatch(56*FRACUNIT, 150*FRACUNIT + handoffset, FRACUNIT, 0, hand, NULL); } - K_DrawSticker(x + (slide * 32), y - 2, V_ThinStringWidth(M_GetDiscordName(curRequest), V_ALLOWLOWERCASE|V_6WIDTHSPACE), 0, false); - V_DrawThinString(x + (slide * 32), y - 1, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_YELLOWMAP, M_GetDiscordName(curRequest)); + K_DrawSticker(x + (slide * 32), y - 2, V_ThinStringWidth(M_GetDiscordName(curRequest), 0), 0, false); + V_DrawThinString(x + (slide * 32), y - 1, V_YELLOWMAP, M_GetDiscordName(curRequest)); - K_DrawSticker(x, y + 12, V_ThinStringWidth(wantText, V_ALLOWLOWERCASE|V_6WIDTHSPACE), 0, true); - V_DrawThinString(x, y + 10, V_ALLOWLOWERCASE|V_6WIDTHSPACE, wantText); + K_DrawSticker(x, y + 12, V_ThinStringWidth(wantText, 0), 0, true); + V_DrawThinString(x, y + 10, 0, wantText); INT32 confirmButtonWidth = SHORT(kp_button_a[1][0]->width); INT32 declineButtonWidth = SHORT(kp_button_b[1][0]->width); INT32 altDeclineButtonWidth = SHORT(kp_button_x[1][0]->width); - INT32 acceptTextWidth = V_ThinStringWidth(acceptText, V_ALLOWLOWERCASE|V_6WIDTHSPACE); - INT32 declineTextWidth = V_ThinStringWidth(declineText, V_ALLOWLOWERCASE|V_6WIDTHSPACE); + INT32 acceptTextWidth = V_ThinStringWidth(acceptText, 0); + INT32 declineTextWidth = V_ThinStringWidth(declineText, 0); INT32 stickerWidth = (confirmButtonWidth + declineButtonWidth + altDeclineButtonWidth + acceptTextWidth + declineTextWidth); K_DrawSticker(x, y + 26, stickerWidth, 0, true); @@ -6740,7 +6739,7 @@ void M_DrawDiscordRequests(void) INT32 xoffs = confirmButtonWidth; - V_DrawThinString((x + xoffs), y + 24, V_ALLOWLOWERCASE|V_6WIDTHSPACE, acceptText); + V_DrawThinString((x + xoffs), y + 24, 0, acceptText); xoffs += acceptTextWidth; K_drawButtonAnim((x + xoffs), y + 22, V_SNAPTORIGHT, kp_button_b[1], discordrequestmenu.ticker); @@ -6749,7 +6748,7 @@ void M_DrawDiscordRequests(void) K_drawButtonAnim((x + xoffs), y + 22, V_SNAPTORIGHT, kp_button_x[1], discordrequestmenu.ticker); xoffs += altDeclineButtonWidth; - V_DrawThinString((x + xoffs), y + 24, V_ALLOWLOWERCASE|V_6WIDTHSPACE, declineText); + V_DrawThinString((x + xoffs), y + 24, 0, declineText); y -= 18; @@ -6759,8 +6758,10 @@ void M_DrawDiscordRequests(void) curRequest = curRequest->next; - K_DrawSticker(x, y - 1 + ySlide, V_ThinStringWidth(M_GetDiscordName(curRequest), V_ALLOWLOWERCASE|V_6WIDTHSPACE), 0, false); - V_DrawThinString(x, y + ySlide, V_ALLOWLOWERCASE|V_6WIDTHSPACE, M_GetDiscordName(curRequest)); + const char *discordname = M_GetDiscordName(curRequest); + + K_DrawSticker(x, y - 1 + ySlide, V_ThinStringWidth(discordname, 0), 0, false); + V_DrawThinString(x, y + ySlide, 0, discordname); y -= 12; maxYSlide = 12; diff --git a/src/k_podium.c b/src/k_podium.c index c5c70bdb9..2f1694f52 100644 --- a/src/k_podium.c +++ b/src/k_podium.c @@ -542,42 +542,42 @@ void K_CeremonyDrawer(void) { case 1: { - V_DrawString(x, y, V_ALLOWLOWERCASE, + V_DrawString(x, y, 0, va("POS: %d / %d", podiumData.rank.position, RANK_NEUTRAL_POSITION) ); break; } case 2: { - V_DrawString(x, y, V_ALLOWLOWERCASE, + V_DrawString(x, y, 0, va("PTS: %d / %d", podiumData.rank.winPoints, podiumData.rank.totalPoints) ); break; } case 3: { - V_DrawString(x, y, V_ALLOWLOWERCASE, + V_DrawString(x, y, 0, va("LAPS: %d / %d", podiumData.rank.laps, podiumData.rank.totalLaps) ); break; } case 4: { - V_DrawString(x, y, V_ALLOWLOWERCASE, + V_DrawString(x, y, 0, va("CONTINUES: %d", podiumData.rank.continuesUsed) ); break; } case 5: { - V_DrawString(x, y, V_ALLOWLOWERCASE, + V_DrawString(x, y, 0, va("PRISONS: %d / %d", podiumData.rank.prisons, podiumData.rank.totalPrisons) ); break; } case 6: { - V_DrawString(x, y, V_ALLOWLOWERCASE, + V_DrawString(x, y, 0, va("RINGS: %d / %d", podiumData.rank.rings, podiumData.rank.totalRings) ); break; @@ -595,7 +595,7 @@ void K_CeremonyDrawer(void) : "PRIZE"; } - V_DrawString(x, y, V_ALLOWLOWERCASE, + V_DrawString(x, y, 0, va("%s: %s", emeraldstr, (podiumData.rank.specialWon == true) ? "YES" : "NO") @@ -604,14 +604,14 @@ void K_CeremonyDrawer(void) } case 8: { - V_DrawString(x, y + 10, V_YELLOWMAP|V_ALLOWLOWERCASE, + V_DrawString(x, y + 10, V_YELLOWMAP, va(" ** FINAL GRADE: %c", gradeChar) ); break; } case 9: { - V_DrawThinString(2, BASEVIDHEIGHT - 10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_DrawThinString(2, BASEVIDHEIGHT - 10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_6WIDTHSPACE, "Press some button type deal to continue" ); break; diff --git a/src/k_zvote.c b/src/k_zvote.c index 784887512..dd5cf32b9 100644 --- a/src/k_zvote.c +++ b/src/k_zvote.c @@ -1172,7 +1172,7 @@ void K_DrawMidVote(void) { strWidth = V__OneScaleStringWidth( FRACUNIT, - V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_SPLITSCREEN|V_6WIDTHSPACE|V_ALLOWLOWERCASE, + V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_SPLITSCREEN, TINY_FONT, player_names[g_midVote.victim - players] ); @@ -1180,7 +1180,7 @@ void K_DrawMidVote(void) x - (strWidth >> 1), y + (18 * FRACUNIT), FRACUNIT, - V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_SPLITSCREEN|V_6WIDTHSPACE|V_ALLOWLOWERCASE, NULL, + V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_SPLITSCREEN, NULL, TINY_FONT, player_names[g_midVote.victim - players] ); } diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f99f33f6b..5a5583f1a 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -887,7 +887,7 @@ static int libd_drawString(lua_State *L) fixed_t x = luaL_checkinteger(L, 1); fixed_t y = luaL_checkinteger(L, 2); const char *str = luaL_checkstring(L, 3); - INT32 flags = luaL_optinteger(L, 4, V_ALLOWLOWERCASE); + INT32 flags = luaL_optinteger(L, 4, 0); enum align align = luaL_checkoption(L, 5, "left", align_opt); flags &= ~V_PARAMMASK; // Don't let crashes happen. @@ -944,7 +944,7 @@ static int libd_drawTitleCardString(lua_State *L) fixed_t x = luaL_checkinteger(L, 1); fixed_t y = luaL_checkinteger(L, 2); const char *str = luaL_checkstring(L, 3); - INT32 flags = luaL_optinteger(L, 4, V_ALLOWLOWERCASE); + INT32 flags = luaL_optinteger(L, 4, 0); boolean rightalign = lua_optboolean(L, 5); INT32 timer = luaL_optinteger(L, 6, 0); INT32 threshold = luaL_optinteger(L, 7, 0); @@ -969,7 +969,7 @@ static int libd_drawKartString(lua_State *L) fixed_t x = luaL_checkinteger(L, 1); fixed_t y = luaL_checkinteger(L, 2); const char *str = luaL_checkstring(L, 3); - INT32 flags = luaL_optinteger(L, 4, V_ALLOWLOWERCASE); + INT32 flags = luaL_optinteger(L, 4, 0); huddrawlist_h list; flags &= ~V_PARAMMASK; // Don't let crashes happen. @@ -998,7 +998,7 @@ static int libd_titleCardStringWidth(lua_State *L) static int libd_stringWidth(lua_State *L) { const char *str = luaL_checkstring(L, 1); - INT32 flags = luaL_optinteger(L, 2, V_ALLOWLOWERCASE); + INT32 flags = luaL_optinteger(L, 2, 0); enum widtht widtht = luaL_checkoption(L, 3, "normal", widtht_opt); HUDONLY diff --git a/src/m_cond.c b/src/m_cond.c index 417b554a9..828845823 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1515,7 +1515,7 @@ char *M_BuildConditionSetString(UINT16 unlockid) size_t len = 1024, worklen; static char message[1024] = ""; const char *work = NULL; - size_t max = 0, maxatstart = 0, start = 0, i; + size_t i; boolean stopasap = false; message[0] = '\0'; @@ -1577,35 +1577,9 @@ char *M_BuildConditionSetString(UINT16 unlockid) } } - // Rudementary word wrapping. - // Simple and effective. Does not handle nonuniform letter sizes, etc. but who cares. - for (i = 0; message[i]; i++) + if (message[0] == '\0') { - if (message[i] == ' ') - { - start = i; - max += 4; - maxatstart = max; - } - else if (message[i] == '\n') - { - start = 0; - max = 0; - maxatstart = 0; - continue; - } - else if (message[i] & 0x80) - continue; - else - max += 8; - - // Start trying to wrap if presumed length exceeds the space we have on-screen. - if (max >= DESCRIPTIONWIDTH && start > 0) - { - message[start] = '\n'; - max -= maxatstart; - start = 0; - } + return NULL; } // Valid sentence capitalisation handling. @@ -1634,7 +1608,14 @@ char *M_BuildConditionSetString(UINT16 unlockid) } } - return message; + // Finally, do a clean wordwrap! + return V_ScaledWordWrap( + DESCRIPTIONWIDTH << FRACBITS, + FRACUNIT, FRACUNIT, FRACUNIT, + 0, + HU_FONT, + message + ); } static boolean M_CheckUnlockConditions(player_t *player) diff --git a/src/m_perfstats.c b/src/m_perfstats.c index 75d43fc50..37697052c 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -123,7 +123,7 @@ static void M_DrawPerfString(perfstatcol_t *col, int type) int value; if (hires) - draw_flags |= V_ALLOWLOWERCASE; + draw_flags |= 0; for (row = col->rows; row->lores_label; ++row) { @@ -476,7 +476,7 @@ static void M_DrawTickStats(void) if (M_HighResolution()) { - V_DrawSmallString(212, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, "Calls:"); + V_DrawSmallString(212, 10, V_MONOSPACE | V_PURPLEMAP, "Calls:"); draw_row = 15; } @@ -507,7 +507,7 @@ void M_DrawPerfStats(void) if (vid.width < 640 || vid.height < 400) // low resolution { // it's not gonna fit very well.. - V_DrawThinString(30, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "Not available for resolutions below 640x400"); + V_DrawThinString(30, 30, V_MONOSPACE | V_YELLOWMAP, "Not available for resolutions below 640x400"); } else // high resolution { @@ -526,10 +526,10 @@ void M_DrawPerfStats(void) } snprintf(s, sizeof s - 1, "Bot %d (%s):", i + 1, player_names[i]); - V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s); + V_DrawSmallString(x, y, V_MONOSPACE | V_GRAYMAP, s); snprintf(s, sizeof s - 1, "%ld", (long)((ps_bots[i].total) / (I_GetPrecisePrecision() / 1000000))); - V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s); + V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE | V_GRAYMAP, s); y += 4; // repeated code! if (y > 192) @@ -541,10 +541,10 @@ void M_DrawPerfStats(void) } snprintf(s, sizeof s - 1, "Prediction:"); - V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); + V_DrawSmallString(x, y, V_MONOSPACE | V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "%ld", (long)((ps_bots[i].prediction) / (I_GetPrecisePrecision() / 1000000))); - V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE | V_ALLOWLOWERCASE, s); + V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE, s); y += 4; // repeated code! if (y > 192) @@ -556,10 +556,10 @@ void M_DrawPerfStats(void) } snprintf(s, sizeof s - 1, "Nudge:"); - V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); + V_DrawSmallString(x, y, V_MONOSPACE | V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "%ld", (long)((ps_bots[i].nudge) / (I_GetPrecisePrecision() / 1000000))); - V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE | V_ALLOWLOWERCASE, s); + V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE, s); y += 4; // repeated code! if (y > 192) @@ -571,10 +571,10 @@ void M_DrawPerfStats(void) } snprintf(s, sizeof s - 1, "Item:"); - V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); + V_DrawSmallString(x, y, V_MONOSPACE | V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "%ld", (long)((ps_bots[i].item) / (I_GetPrecisePrecision() / 1000000))); - V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE | V_ALLOWLOWERCASE, s); + V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE, s); y += 4; // repeated code! if (y > 192) @@ -586,11 +586,11 @@ void M_DrawPerfStats(void) } snprintf(s, sizeof s - 1, "Other:"); - V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); + V_DrawSmallString(x, y, V_MONOSPACE | V_YELLOWMAP, s); otherTime = ps_bots[i].total - ps_bots[i].prediction - ps_bots[i].nudge - ps_bots[i].item; snprintf(s, sizeof s - 1, "%ld", (long)(otherTime / (I_GetPrecisePrecision() / 1000000))); - V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE | V_ALLOWLOWERCASE, s); + V_DrawRightAlignedSmallString(x + 98, y, V_MONOSPACE, s); y += 4; // repeated code! if (y > 192) @@ -621,7 +621,7 @@ void M_DrawPerfStats(void) if (vid.width < 640 || vid.height < 400) // low resolution { // it's not gonna fit very well.. - V_DrawThinString(30, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "Not available for resolutions below 640x400"); + V_DrawThinString(30, 30, V_MONOSPACE | V_YELLOWMAP, "Not available for resolutions below 640x400"); } else // high resolution { @@ -664,7 +664,7 @@ void M_DrawPerfStats(void) if (len > 25) tempstr += len - 25; snprintf(s, sizeof s - 1, "%s", tempstr); - V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s); + V_DrawSmallString(x, y, V_MONOSPACE | V_GRAYMAP, s); y += 4; // repeated code! if (y > 192) { @@ -689,7 +689,7 @@ void M_DrawPerfStats(void) if (len > 20) str += len - 20; snprintf(s, sizeof s - 1, "%20s: %ld", str, (long)((thinkframe_hooks[i].time_taken) / (I_GetPrecisePrecision() / 1000000))); - V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | text_color, s); + V_DrawSmallString(x, y, V_MONOSPACE | text_color, s); y += 4; // repeated code! if (y > 192) { diff --git a/src/media/avrecorder_feedback.cpp b/src/media/avrecorder_feedback.cpp index 4dac2eaf6..12aa5b972 100644 --- a/src/media/avrecorder_feedback.cpp +++ b/src/media/avrecorder_feedback.cpp @@ -104,7 +104,7 @@ void AVRecorder::draw_statistics() const V_DrawThinString( x, 190, - (V_6WIDTHSPACE | V_ALLOWLOWERCASE | V_SNAPTOBOTTOM | V_SNAPTORIGHT) | flags, + (V_SNAPTOBOTTOM | V_SNAPTORIGHT) | flags, text.c_str() ); }; diff --git a/src/menus/extras-challenges.c b/src/menus/extras-challenges.c index 94ca9aa2a..e50c67ef0 100644 --- a/src/menus/extras-challenges.c +++ b/src/menus/extras-challenges.c @@ -104,6 +104,8 @@ static void M_ChallengesAutoFocus(UINT16 unlockid, boolean fresh) return; challengesmenu.currentunlock = unlockid; + if (challengesmenu.unlockcondition) + Z_Free(challengesmenu.unlockcondition); challengesmenu.unlockcondition = M_BuildConditionSetString(challengesmenu.currentunlock); challengesmenu.unlockanim = (challengesmenu.pending && !challengesmenu.chaokeyadd ? 0 : MAXUNLOCKTIME); @@ -505,6 +507,8 @@ void M_ChallengesTick(void) M_UpdateUnlockablesAndExtraEmblems(true, true); // Update shown description just in case..? + if (challengesmenu.unlockcondition) + Z_Free(challengesmenu.unlockcondition); challengesmenu.unlockcondition = M_BuildConditionSetString(challengesmenu.currentunlock); challengesmenu.unlockcount[CC_TALLY]++; @@ -787,6 +791,8 @@ boolean M_ChallengesInputs(INT32 ch) // After movement has been determined, figure out the current selection. i = (challengesmenu.col * CHALLENGEGRIDHEIGHT) + challengesmenu.row; challengesmenu.currentunlock = (gamedata->challengegrid[i]); + if (challengesmenu.unlockcondition) + Z_Free(challengesmenu.unlockcondition); challengesmenu.unlockcondition = M_BuildConditionSetString(challengesmenu.currentunlock); challengesmenu.hilix = challengesmenu.col; diff --git a/src/menus/transient/message-box.c b/src/menus/transient/message-box.c index 50ef95fb7..f69b3ebfe 100644 --- a/src/menus/transient/message-box.c +++ b/src/menus/transient/message-box.c @@ -2,6 +2,7 @@ // \brief MESSAGE BOX (aka: a hacked, cobbled together menu) #include "../../k_menu.h" +#include "../../v_video.h" // V_ScaledWordWrap, HU_FONT #include "../../z_zone.h" // message prompt struct @@ -30,42 +31,17 @@ 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) { const UINT8 pid = 0; - size_t max = 0, maxatstart = 0, start = 0, strlines, i; static char *message = NULL; Z_Free(message); - message = Z_StrDup(string); - DEBFILE(message); + DEBFILE(string); - // Rudementary word wrapping. - // Simple and effective. Does not handle nonuniform letter sizes, etc. but who cares. - for (i = 0; message[i]; i++) - { - if (message[i] == ' ') - { - start = i; - max += 4; - maxatstart = max; - } - else if (message[i] == '\n') - { - start = 0; - max = 0; - maxatstart = 0; - continue; - } - else if (message[i] & 0x80) - continue; - else - max += 8; - - // Start trying to wrap if presumed length exceeds the screen width. - if (max >= BASEVIDWIDTH && start > 0) - { - message[start] = '\n'; - max -= maxatstart; - start = 0; - } - } + message = V_ScaledWordWrap( + BASEVIDWIDTH << FRACBITS, + FRACUNIT, FRACUNIT, FRACUNIT, + 0, + HU_FONT, + string + ); strncpy(menumessage.message, string, MAXMENUMESSAGE); menumessage.header = header; @@ -77,9 +53,6 @@ void M_StartMessage(const char *header, const char *string, void (*routine)(INT3 menumessage.closing = 0; menumessage.active = true; - start = 0; - max = 0; - if (!routine) { menumessage.flags = MM_NOTHING; @@ -108,29 +81,7 @@ void M_StartMessage(const char *header, const char *string, void (*routine)(INT3 }*/ //added : 06-02-98: now draw a textbox around the message - // compute lenght max and the numbers of lines - for (strlines = 0; *(message+start); strlines++) - { - for (i = 0; i < strlen(message+start);i++) - { - if (*(message+start+i) == '\n') - { - if (i > max) - max = i; - start += i; - i = (size_t)-1; //added : 07-02-98 : damned! - start++; - break; - } - } - - if (i == strlen(message+start)) - { - start += i; - if (i > max) - max = i; - } - } + // oogh my god this was replaced in 2023 menumessage.x = (8 * MAXSTRINGLENGTH) - 1; menumessage.y = M_StringHeight(message); diff --git a/src/p_mobj.c b/src/p_mobj.c index ae19e7844..d927090fb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13788,8 +13788,15 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 numi y + FixedMul(length, FINESINE(fineangle)), z, MT_LOOPCENTERPOINT); - if (!P_MobjWasRemoved(loopanchor)) - Obj_LinkLoopAnchor(loopanchor, loopcenter, mthing->args[0]); + if (P_MobjWasRemoved(loopanchor)) + { + // No recovery. + return; + } + + loopanchor->spawnpoint = NULL; + + Obj_LinkLoopAnchor(loopanchor, loopcenter, mthing->args[0]); } for (r = 0; r < numitems; r++) @@ -13809,15 +13816,15 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 numi if (!inclusive) mobj = P_SpawnMobjFromMapThing(&dummything, x, y, z, itemtype); - if (!mobj) + if (P_MobjWasRemoved(mobj)) continue; - if (isloopend) - { - Obj_InitLoopEndpoint(mobj, loopanchor); - } - mobj->spawnpoint = NULL; + + if (!isloopend) + continue; + + Obj_InitLoopEndpoint(mobj, loopanchor); } } @@ -13875,11 +13882,12 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n mobj = P_SpawnMobjFromMapThing(&dummything, x + v[0], y + v[1], z + v[2], itemtype); - if (!mobj) + if (P_MobjWasRemoved(mobj)) continue; - mobj->z -= mobj->height/2; mobj->spawnpoint = NULL; + + mobj->z -= mobj->height/2; } } diff --git a/src/p_saveg.c b/src/p_saveg.c index 885b7b5c0..655e915ff 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -4074,7 +4074,10 @@ static thinker_t* LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker) if (diff2 & MD2_RENDERFLAGS) mobj->renderflags = READUINT32(save->p); if (diff2 & MD2_TID) - P_SetThingTID(mobj, READINT16(save->p)); + { + INT16 tid = READINT16(save->p); + P_SetThingTID(mobj, tid); + } if (diff2 & MD2_SPRITESCALE) { mobj->spritexscale = READFIXED(save->p); diff --git a/src/p_spec.c b/src/p_spec.c index aa1e88256..0a8f74b15 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -34,7 +34,6 @@ #include "p_polyobj.h" #include "p_slopes.h" #include "hu_stuff.h" -#include "v_video.h" // V_ALLOWLOWERCASE #include "m_misc.h" #include "m_cond.h" //unlock triggers #include "lua_hook.h" // LUA_HookSpecialExecute diff --git a/src/rhi/gl3_core/gl3_core_rhi.cpp b/src/rhi/gl3_core/gl3_core_rhi.cpp index 7d6481f6d..b8144788f 100644 --- a/src/rhi/gl3_core/gl3_core_rhi.cpp +++ b/src/rhi/gl3_core/gl3_core_rhi.cpp @@ -568,8 +568,6 @@ GlCoreRhi::~GlCoreRhi() = default; rhi::Handle GlCoreRhi::create_render_pass(const rhi::RenderPassDesc& desc) { - SRB2_ASSERT(graphics_context_active_ == false); - // GL has no formal render pass object GlCoreRenderPass pass; pass.desc = desc; @@ -578,15 +576,11 @@ rhi::Handle GlCoreRhi::create_render_pass(const rhi::RenderPass void GlCoreRhi::destroy_render_pass(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - render_pass_slab_.remove(handle); } rhi::Handle GlCoreRhi::create_texture(const rhi::TextureDesc& desc) { - SRB2_ASSERT(graphics_context_active_ == false); - GLenum internal_format = map_internal_texture_format(desc.format); SRB2_ASSERT(internal_format != GL_ZERO); GLenum format = GL_RGBA; @@ -615,8 +609,6 @@ rhi::Handle GlCoreRhi::create_texture(const rhi::TextureDesc& desc void GlCoreRhi::destroy_texture(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(texture_slab_.is_valid(handle) == true); GlCoreTexture casted = texture_slab_.remove(handle); GLuint name = casted.texture; @@ -624,16 +616,14 @@ void GlCoreRhi::destroy_texture(rhi::Handle handle) } void GlCoreRhi::update_texture( - Handle ctx, + Handle ctx, Handle texture, Rect region, srb2::rhi::PixelFormat data_format, tcb::span data ) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - SRB2_ASSERT(ctx.generation() == transfer_context_generation_); + SRB2_ASSERT(graphics_context_active_ == true); if (data.empty()) { @@ -678,8 +668,6 @@ void GlCoreRhi::update_texture( rhi::Handle GlCoreRhi::create_buffer(const rhi::BufferDesc& desc) { - SRB2_ASSERT(graphics_context_active_ == false); - GLenum target = map_buffer_type(desc.type); SRB2_ASSERT(target != GL_ZERO); @@ -704,10 +692,7 @@ rhi::Handle GlCoreRhi::create_buffer(const rhi::BufferDesc& desc) void GlCoreRhi::destroy_buffer(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(buffer_slab_.is_valid(handle) == true); - SRB2_ASSERT(graphics_context_active_ == false); GlCoreBuffer casted = buffer_slab_.remove(handle); GLuint name = casted.buffer; @@ -715,15 +700,14 @@ void GlCoreRhi::destroy_buffer(rhi::Handle handle) } void GlCoreRhi::update_buffer( - rhi::Handle ctx, + rhi::Handle ctx, rhi::Handle handle, uint32_t offset, tcb::span data ) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - SRB2_ASSERT(ctx.generation() == transfer_context_generation_); + SRB2_ASSERT(graphics_context_active_ == true); + SRB2_ASSERT(ctx.generation() == graphics_context_generation_); if (data.empty()) { @@ -753,11 +737,10 @@ void GlCoreRhi::update_buffer( } rhi::Handle -GlCoreRhi::create_uniform_set(rhi::Handle ctx, const rhi::CreateUniformSetInfo& info) +GlCoreRhi::create_uniform_set(rhi::Handle ctx, const rhi::CreateUniformSetInfo& info) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - SRB2_ASSERT(ctx.generation() == transfer_context_generation_); + SRB2_ASSERT(graphics_context_active_ == true); + SRB2_ASSERT(ctx.generation() == graphics_context_generation_); GlCoreUniformSet uniform_set; @@ -770,14 +753,13 @@ GlCoreRhi::create_uniform_set(rhi::Handle ctx, const rhi:: } rhi::Handle GlCoreRhi::create_binding_set( - rhi::Handle ctx, + rhi::Handle ctx, Handle pipeline, const rhi::CreateBindingSetInfo& info ) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - SRB2_ASSERT(ctx.generation() == transfer_context_generation_); + SRB2_ASSERT(graphics_context_active_ == true); + SRB2_ASSERT(ctx.generation() == graphics_context_generation_); SRB2_ASSERT(pipeline_slab_.is_valid(pipeline) == true); auto& pl = pipeline_slab_[pipeline]; @@ -842,8 +824,6 @@ rhi::Handle GlCoreRhi::create_binding_set( rhi::Handle GlCoreRhi::create_renderbuffer(const rhi::RenderbufferDesc& desc) { - SRB2_ASSERT(graphics_context_active_ == false); - GLuint name = 0; gl_->GenRenderbuffers(1, &name); @@ -876,8 +856,6 @@ rhi::Handle GlCoreRhi::create_renderbuffer(const rhi::Renderb void GlCoreRhi::destroy_renderbuffer(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(renderbuffer_slab_.is_valid(handle) == true); GlCoreRenderbuffer casted = renderbuffer_slab_.remove(handle); GLuint name = casted.renderbuffer; @@ -1192,8 +1170,6 @@ rhi::Handle GlCoreRhi::create_pipeline(const PipelineDesc& desc) void GlCoreRhi::destroy_pipeline(rhi::Handle handle) { - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(pipeline_slab_.is_valid(handle) == true); GlCorePipeline casted = pipeline_slab_.remove(handle); GLuint vertex_shader = casted.vertex_shader; @@ -1222,25 +1198,6 @@ void GlCoreRhi::end_graphics(rhi::Handle handle) GL_ASSERT; } -rhi::Handle GlCoreRhi::begin_transfer() -{ - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == false); - - transfer_context_generation_ += 1; - transfer_context_active_ = true; - - return rhi::Handle(0, transfer_context_generation_); -} - -void GlCoreRhi::end_transfer(rhi::Handle ctx) -{ - SRB2_ASSERT(graphics_context_active_ == false); - SRB2_ASSERT(transfer_context_active_ == true); - - transfer_context_active_ = false; -} - void GlCoreRhi::present() { SRB2_ASSERT(platform_ != nullptr); @@ -1269,7 +1226,7 @@ void GlCoreRhi::begin_default_render_pass(Handle ctx, bool clea gl_->ClearColor(0.0f, 0.0f, 0.0f, 1.0f); gl_->ClearDepth(1.0f); gl_->ClearStencil(0); - gl_->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gl_->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); GL_ASSERT; } @@ -1661,7 +1618,6 @@ void GlCoreRhi::bind_binding_set(Handle ctx, Handle void GlCoreRhi::bind_index_buffer(Handle ctx, Handle buffer) { - SRB2_ASSERT(transfer_context_active_ == false); SRB2_ASSERT(graphics_context_active_ == true && graphics_context_generation_ == ctx.generation()); SRB2_ASSERT(current_render_pass_.has_value() == true && current_pipeline_.has_value() == true); diff --git a/src/rhi/gl3_core/gl3_core_rhi.hpp b/src/rhi/gl3_core/gl3_core_rhi.hpp index b5f499422..1284ea77d 100644 --- a/src/rhi/gl3_core/gl3_core_rhi.hpp +++ b/src/rhi/gl3_core/gl3_core_rhi.hpp @@ -123,10 +123,6 @@ struct GlCoreGraphicsContext : public rhi::GraphicsContext { }; -struct GlCoreTransferContext : public rhi::TransferContext -{ -}; - struct GlCoreActiveUniform { uint32_t type; @@ -159,10 +155,8 @@ class GlCoreRhi final : public Rhi std::optional> current_pipeline_; PrimitiveType current_primitive_type_ = PrimitiveType::kPoints; bool graphics_context_active_ = false; - bool transfer_context_active_ = false; uint32_t graphics_context_generation_ = 0; uint32_t index_buffer_offset_ = 0; - uint32_t transfer_context_generation_ = 0; uint8_t stencil_front_reference_ = 0; uint8_t stencil_front_compare_mask_ = 0xFF; @@ -193,26 +187,23 @@ public: virtual Rect get_renderbuffer_size(Handle renderbuffer) override; virtual uint32_t get_buffer_size(Handle buffer) override; - virtual Handle begin_transfer() override; - virtual void end_transfer(Handle handle) override; - virtual void update_buffer( - Handle ctx, + Handle ctx, Handle buffer, uint32_t offset, tcb::span data ) override; virtual void update_texture( - Handle ctx, + Handle ctx, Handle texture, Rect region, srb2::rhi::PixelFormat data_format, tcb::span data ) override; virtual Handle - create_uniform_set(Handle ctx, const CreateUniformSetInfo& info) override; + create_uniform_set(Handle ctx, const CreateUniformSetInfo& info) override; virtual Handle - create_binding_set(Handle ctx, Handle pipeline, const CreateBindingSetInfo& info) + create_binding_set(Handle ctx, Handle pipeline, const CreateBindingSetInfo& info) override; virtual Handle begin_graphics() override; diff --git a/src/rhi/rhi.hpp b/src/rhi/rhi.hpp index 20f0bb7ae..3587e2b26 100644 --- a/src/rhi/rhi.hpp +++ b/src/rhi/rhi.hpp @@ -569,9 +569,6 @@ struct BindingSet { }; -struct TransferContext -{ -}; struct GraphicsContext { }; @@ -607,26 +604,22 @@ struct Rhi virtual Rect get_renderbuffer_size(Handle renderbuffer) = 0; virtual uint32_t get_buffer_size(Handle buffer) = 0; - virtual Handle begin_transfer() = 0; - virtual void end_transfer(Handle handle) = 0; - - // Transfer Context functions virtual void update_buffer( - Handle ctx, + Handle ctx, Handle buffer, uint32_t offset, tcb::span data ) = 0; virtual void update_texture( - Handle ctx, + Handle ctx, Handle texture, Rect region, srb2::rhi::PixelFormat data_format, tcb::span data ) = 0; - virtual Handle create_uniform_set(Handle ctx, const CreateUniformSetInfo& info) = 0; + virtual Handle create_uniform_set(Handle ctx, const CreateUniformSetInfo& info) = 0; virtual Handle - create_binding_set(Handle ctx, Handle pipeline, const CreateBindingSetInfo& info) = 0; + create_binding_set(Handle ctx, Handle pipeline, const CreateBindingSetInfo& info) = 0; virtual Handle begin_graphics() = 0; virtual void end_graphics(Handle ctx) = 0; diff --git a/src/s_sound.c b/src/s_sound.c index 5e45232e7..7a1acce5a 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2165,7 +2165,7 @@ void S_ShowMusicCredit(void) } } - widthused -= V_ThinStringWidth(credittext, V_ALLOWLOWERCASE|V_6WIDTHSPACE); + widthused -= V_ThinStringWidth(credittext, 0); #define MUSICCREDITAPPEND(field)\ if (field)\ @@ -2174,7 +2174,7 @@ void S_ShowMusicCredit(void) worklen = strlen(work);\ if (worklen <= len)\ {\ - workwidth = V_ThinStringWidth(work, V_ALLOWLOWERCASE|V_6WIDTHSPACE);\ + workwidth = V_ThinStringWidth(work, 0);\ if (widthused >= workwidth)\ {\ strncat(credittext, work, len);\ diff --git a/src/screen.c b/src/screen.c index b584cb9f8..8f2113265 100644 --- a/src/screen.c +++ b/src/screen.c @@ -696,7 +696,7 @@ void SCR_ClosedCaptions(void) if (music && !gamestopped && (closedcaptions[i].t < flashingtics) && (closedcaptions[i].t & 1)) continue; - flags = V_SNAPTORIGHT|V_SNAPTOBOTTOM|V_ALLOWLOWERCASE; + flags = V_SNAPTORIGHT|V_SNAPTOBOTTOM; y = basey-((i + 2)*10); if (closedcaptions[i].b) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 0ab23236b..9c03b4010 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -305,6 +305,8 @@ static void I_ShowErrorMessageBox(const char *messagefordevelopers, boolean dump // Rudementary word wrapping. // Simple and effective. Does not handle nonuniform letter sizes, etc. but who cares. + // We can't use V_ScaledWordWrap, which this shares DNA with, because no guarantee + // string character graphics exist as reference in the error handler... { size_t max = 0, maxatstart = 0, start = 0, width = 0, i; diff --git a/src/st_stuff.c b/src/st_stuff.c index f04dd34fc..2b1abeadc 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -983,7 +983,7 @@ void ST_drawTitleCard(void) by += 5; } - V_DrawRightAlignedThinString((BASEVIDWIDTH+bx)/2, by, V_6WIDTHSPACE, bossinfo.subtitle); + V_DrawRightAlignedThinString((BASEVIDWIDTH+bx)/2, by, 0, bossinfo.subtitle); } // Now draw the under-bar itself. @@ -1172,7 +1172,7 @@ static void ST_overlayDrawer(void) if (!r_splitscreen) { V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("VIEWPOINT:")); - V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANSHALF|V_ALLOWLOWERCASE, player_names[stplyr-players]); + V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANSHALF, player_names[stplyr-players]); } else if (r_splitscreen == 1) { @@ -1180,11 +1180,11 @@ static void ST_overlayDrawer(void) INT32 y = (stplyr == &players[displayplayers[0]]) ? 4 : BASEVIDHEIGHT/2-12; sprintf(name, "VIEWPOINT: %s", player_names[stplyr-players]); - V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_ALLOWLOWERCASE|V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_SPLITSCREEN, name); + V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_SPLITSCREEN, name); } else if (r_splitscreen) { - V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_SPLITSCREEN, player_names[stplyr-players]); + V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_SPLITSCREEN, player_names[stplyr-players]); } } } @@ -1257,17 +1257,17 @@ void ST_DrawDemoTitleEntry(void) #define x (BASEVIDWIDTH/2 - 139) #define y (BASEVIDHEIGHT/2) M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1); - V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, nametodraw); + V_DrawString(x + 8, y + 12, 0, nametodraw); if (anim < 4) V_DrawCharacter(x + 8 + V_StringWidth(nametodraw, 0), y + 12, '_' | 0x80, false); M_DrawTextBox(x + 30, y - 24, 26, 1); - V_DrawString(x + 38, y - 16, V_ALLOWLOWERCASE, "Enter the name of the replay."); + V_DrawString(x + 38, y - 16, 0, "Enter the name of the replay."); M_DrawTextBox(x + 50, y + 20, 20, 1); - V_DrawThinString(x + 58, y + 28, V_ALLOWLOWERCASE, "Escape - Cancel"); - V_DrawRightAlignedThinString(x + 220, y + 28, V_ALLOWLOWERCASE, "Enter - Confirm"); + V_DrawThinString(x + 58, y + 28, 0, "Escape - Cancel"); + V_DrawRightAlignedThinString(x + 220, y + 28, 0, "Enter - Confirm"); #undef x #undef y } @@ -1384,20 +1384,20 @@ void ST_Drawer(void) INT32 buttony = 2; K_drawButtonAnim(buttonx - 76, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_b[1], leveltime); - V_DrawRightAlignedThinString(buttonx - 55, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_YELLOWMAP, "or"); + V_DrawRightAlignedThinString(buttonx - 55, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_YELLOWMAP, "or"); K_drawButtonAnim(buttonx - 55, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_x[1], leveltime); - V_DrawRightAlignedThinString(buttonx - 2, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_YELLOWMAP, "Save replay"); + V_DrawRightAlignedThinString(buttonx - 2, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_YELLOWMAP, "Save replay"); break; } case DSM_WILLAUTOSAVE: { - V_DrawRightAlignedThinString(BASEVIDWIDTH - 55, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_YELLOWMAP, "Replay will be saved."); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 55, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_YELLOWMAP, "Replay will be saved."); K_drawButtonAnim(BASEVIDWIDTH - 56, 0, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_b[1], leveltime); - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_YELLOWMAP, "Change title"); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_YELLOWMAP, "Change title"); break; } case DSM_WILLSAVE: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_YELLOWMAP, "Replay will be saved."); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_YELLOWMAP, "Replay will be saved."); break; case DSM_TITLEENTRY: diff --git a/src/v_draw.cpp b/src/v_draw.cpp index c10933707..c6ab93c59 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -128,12 +128,9 @@ int Draw::font_to_fontno(Font font) INT32 Draw::default_font_flags(Font font) { - INT32 flags = V_ALLOWLOWERCASE; + INT32 flags = 0; - if (font == Font::kThin) - { - flags |= V_6WIDTHSPACE; - } + (void)font; return flags; }; diff --git a/src/v_video.cpp b/src/v_video.cpp index 63e03068a..5c06f45e8 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1776,54 +1776,115 @@ INT32 V_DanceYOffset(INT32 counter) return abs(step - (duration / 2)) - (duration / 4); } -// Writes a single character (draw WHITE if bit 7 set) -// -void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed) +static boolean V_CharacterValid(font_t *font, int c) { - INT32 w, flags; - const UINT8 *colormap = V_GetStringColormap(c); - - flags = c & ~(V_CHARCOLORMASK | V_PARAMMASK); - c &= 0x7f; - if (lowercaseallowed) - c -= HU_FONTSTART; - else - c = toupper(c) - HU_FONTSTART; - if (c < 0 || c >= HU_FONTSIZE || !fontv[HU_FONT].font[c]) - return; - - w = fontv[HU_FONT].font[c]->width; - if (x + w > vid.width) - return; - - if (colormap != NULL) - V_DrawMappedPatch(x, y, flags, fontv[HU_FONT].font[c], colormap); - else - V_DrawScaledPatch(x, y, flags, fontv[HU_FONT].font[c]); + return (c >= 0 && c < font->size && font->font[c] != NULL); } -// Writes a single character for the chat (half scaled). (draw WHITE if bit 7 set) -// 16/02/19: Scratch the scaling thing, chat doesn't work anymore under 2x res -Lat' +// Writes a single character (draw WHITE if bit 7 set) // -void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UINT8 *colormap) +void V_DrawCharacterScaled( + fixed_t x, + fixed_t y, + fixed_t scale, + INT32 flags, + int fontno, + int c, + UINT8 *colormap) { - INT32 w, flags; - //const UINT8 *colormap = V_GetStringColormap(c); + font_t *font = &fontv[fontno]; + boolean notColored = false; - flags = c & ~(V_CHARCOLORMASK | V_PARAMMASK); - c &= 0x7f; - if (lowercaseallowed) - c -= HU_FONTSTART; - else - c = toupper(c) - HU_FONTSTART; - if (c < 0 || c >= HU_FONTSIZE || !fontv[HU_FONT].font[c]) + const boolean uppercase = ((flags & V_FORCEUPPERCASE) == V_FORCEUPPERCASE); + flags &= ~(V_FLIP); /* These two (V_FORCEUPPERCASE) share a bit. */ + + if (colormap == NULL) + { + colormap = V_GetStringColormap(( flags & V_CHARCOLORMASK )); + } + + notColored = (colormap == NULL); + + flags &= ~(V_CHARCOLORMASK | V_PARAMMASK); + + if (uppercase) + { + c = toupper(c); + } + else if (V_CharacterValid(font, c - font->start) == false) + { + // Try the other case if it doesn't exist + if (c >= 'A' && c <= 'Z') + { + c = tolower(c); + } + else if (c >= 'a' && c <= 'z') + { + c = toupper(c); + } + } + + c -= font->start; + if (V_CharacterValid(font, c) == false) + { return; + } - w = fontv[HU_FONT].font[c]->width / 2; - if (x + w > vid.width) - return; + if (notColored == true) + { + if (( c & 0x80 )) + { + colormap = V_GetStringColormap( + ( ( c & 0x7f ) << V_CHARCOLORSHIFT ) & V_CHARCOLORMASK + ); + } + } - V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT/2, flags, fontv[HU_FONT].font[c], colormap); + V_DrawFixedPatch( + x, y, + scale, + flags, + font->font[c], + colormap + ); +} + +void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercase) +{ + // Backwards compatibility + if (lowercase == false) + { + c |= V_FORCEUPPERCASE; + } + + V_DrawCharacterScaled( + x << FRACBITS, + y << FRACBITS, + FRACUNIT, + (c & ~V_PARAMMASK), + HU_FONT, + (c & V_PARAMMASK), + NULL + ); +} + +void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercase, UINT8 *colormap) +{ + // Backwards compatibility + if (lowercase == false) + { + c |= V_FORCEUPPERCASE; + } + + V_DrawCharacterScaled( + x << FRACBITS, + y << FRACBITS, + FRACUNIT >> 1, + (c & ~V_PARAMMASK), + HU_FONT, + (c & V_PARAMMASK), + colormap + ); } // V_TitleCardStringWidth @@ -1982,76 +2043,6 @@ void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boole } } - -// Precompile a wordwrapped string to any given width. -// This is a muuuch better method than V_WORDWRAP. -char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) -{ - int c; - size_t chw, i, lastusablespace = 0; - size_t slen; - char *newstring = Z_StrDup(string); - INT32 spacewidth = 4, charwidth = 0; - - slen = strlen(string); - - if (w == 0) - w = BASEVIDWIDTH; - w -= x; - x = 0; - - switch (option & V_SPACINGMASK) - { - case V_MONOSPACE: - spacewidth = 8; - /* FALLTHRU */ - case V_OLDSPACING: - charwidth = 8; - break; - case V_6WIDTHSPACE: - spacewidth = 6; - default: - break; - } - - for (i = 0; i < slen; ++i) - { - c = newstring[i]; - if ((UINT8)c & 0x80) //color parsing! -Inuyasha 2.16.09 - continue; - - if (c == '\n') - { - x = 0; - lastusablespace = 0; - continue; - } - - if (!(option & V_ALLOWLOWERCASE)) - c = toupper(c); - c -= HU_FONTSTART; - - if (c < 0 || c >= HU_FONTSIZE || !fontv[HU_FONT].font[c]) - { - chw = spacewidth; - lastusablespace = i; - } - else - chw = (charwidth ? charwidth : fontv[HU_FONT].font[c]->width); - - x += chw; - - if (lastusablespace != 0 && x > w) - { - newstring[lastusablespace] = '\n'; - i = lastusablespace; - lastusablespace = 0; - x = 0; - } - } - return newstring; -} - static inline fixed_t FixedCharacterDim( fixed_t scale, fixed_t chw, @@ -2156,6 +2147,182 @@ static inline fixed_t LSTitleCharacterDim( return 0; } +typedef struct +{ + fixed_t chw; + fixed_t spacew; + fixed_t lfh; + fixed_t (*dim_fn)(fixed_t,fixed_t,INT32,INT32,fixed_t *); +} fontspec_t; + +static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result) +{ + /* + Hardcoded until a better system can be implemented + for determining how fonts space. + */ + + // All other properties are guaranteed to be set + result->chw = 0; + + const INT32 spacing = ( flags & V_SPACINGMASK ); + + switch (fontno) + { + default: + case HU_FONT: + case MENU_FONT: + result->spacew = 4; + switch (spacing) + { + case V_MONOSPACE: + result->spacew = 8; + /* FALLTHRU */ + case V_OLDSPACING: + result->chw = 8; + break; + case V_6WIDTHSPACE: + result->spacew = 6; + break; + } + break; + case TINY_FONT: + result->spacew = 2; + switch (spacing) + { + case V_MONOSPACE: + result->spacew = 5; + /* FALLTHRU */ + case V_OLDSPACING: + result->chw = 5; + break; + case V_6WIDTHSPACE: + result->spacew = 3; + break; + } + break; + case LT_FONT: + result->spacew = 12; + break; + case CRED_FONT: + result->spacew = 16; + break; + case KART_FONT: + result->spacew = 3; + switch (spacing) + { + case V_MONOSPACE: + result->spacew = 12; + /* FALLTHRU */ + case V_OLDSPACING: + result->chw = 12; + break; + case V_6WIDTHSPACE: + result->spacew = 6; + } + break; + case GM_FONT: + result->spacew = 6; + break; + case FILE_FONT: + result->spacew = 0; + break; + case LSHI_FONT: + case LSLOW_FONT: + result->spacew = 10; + break; + case OPPRF_FONT: + result->spacew = 5; + break; + case PINGF_FONT: + result->spacew = 3; + break; + } + + switch (fontno) + { + default: + case HU_FONT: + case MENU_FONT: + case TINY_FONT: + case KART_FONT: + result->lfh = 12; + break; + case LT_FONT: + case CRED_FONT: + case FILE_FONT: + result->lfh = 12; + break; + case GM_FONT: + result->lfh = 32; + break; + case LSHI_FONT: + result->lfh = 56; + break; + case LSLOW_FONT: + result->lfh = 38; + break; + case OPPRF_FONT: + case PINGF_FONT: + result->lfh = 10; + break; + } + + switch (fontno) + { + default: + if (result->chw) + result->dim_fn = CenteredCharacterDim; + else + result->dim_fn = VariableCharacterDim; + break; + case HU_FONT: + if (result->chw) + result->dim_fn = CenteredCharacterDim; + else + result->dim_fn = BunchedCharacterDim; + break; + case KART_FONT: + if (result->chw) + result->dim_fn = FixedCharacterDim; + else + result->dim_fn = BunchedCharacterDim; + break; + case TINY_FONT: + if (result->chw) + result->dim_fn = FixedCharacterDim; + else + result->dim_fn = BunchedCharacterDim; + break; + case GM_FONT: + if (result->chw) + result->dim_fn = FixedCharacterDim; + else + result->dim_fn = GamemodeCharacterDim; + break; + case FILE_FONT: + if (result->chw) + result->dim_fn = FixedCharacterDim; + else + result->dim_fn = FileCharacterDim; + break; + case LSHI_FONT: + case LSLOW_FONT: + if (result->chw) + result->dim_fn = FixedCharacterDim; + else + result->dim_fn = LSTitleCharacterDim; + break; + case OPPRF_FONT: + case PINGF_FONT: + if (result->chw) + result->dim_fn = FixedCharacterDim; + else + result->dim_fn = BunchedCharacterDim; + break; + } +} + void V_DrawStringScaled( fixed_t x, fixed_t y, @@ -2167,18 +2334,13 @@ void V_DrawStringScaled( int fontno, const char *s) { - fixed_t chw; INT32 hchw;/* half-width for centering */ - fixed_t spacew; - fixed_t lfh; INT32 dupx; fixed_t right; fixed_t bot; - fixed_t (*dim_fn)(fixed_t,fixed_t,INT32,INT32,fixed_t *); - font_t *font; boolean uppercase; @@ -2193,13 +2355,12 @@ void V_DrawStringScaled( fixed_t cxoff, cyoff; fixed_t cw; - INT32 spacing; fixed_t left; int c; - uppercase = !( flags & V_ALLOWLOWERCASE ); - flags &= ~(V_FLIP);/* These two (V_ALLOWLOWERCASE) share a bit. */ + uppercase = ((flags & V_FORCEUPPERCASE) == V_FORCEUPPERCASE); + flags &= ~(V_FLIP);/* These two (V_FORCEUPPERCASE) share a bit. */ dance = (flags & V_STRINGDANCE) != 0; nodanceoverride = !dance; @@ -2218,125 +2379,23 @@ void V_DrawStringScaled( font = &fontv[fontno]; - chw = 0; + fontspec_t fontspec; - spacing = ( flags & V_SPACINGMASK ); + V_GetFontSpecification(fontno, flags, &fontspec); - /* - Hardcoded until a better system can be implemented - for determining how fonts space. - */ - switch (fontno) - { - default: - case HU_FONT: - spacew = 4; - switch (spacing) - { - case V_MONOSPACE: - spacew = 8; - /* FALLTHRU */ - case V_OLDSPACING: - chw = 8; - break; - case V_6WIDTHSPACE: - spacew = 6; - } - break; - case TINY_FONT: - spacew = 2; - switch (spacing) - { - case V_MONOSPACE: - spacew = 5; - /* FALLTHRU */ - case V_OLDSPACING: - chw = 5; - break; - // Out of video flags, so we're reusing this for alternate charwidth instead - /*case V_6WIDTHSPACE: - spacewidth = 3;*/ - } - break; - case LT_FONT: - spacew = 12; - break; - case CRED_FONT: - spacew = 16; - break; - case KART_FONT: - spacew = 3; - switch (spacing) - { - case V_MONOSPACE: - spacew = 12; - /* FALLTHRU */ - case V_OLDSPACING: - chw = 12; - break; - case V_6WIDTHSPACE: - spacew = 6; - } - break; - case GM_FONT: - spacew = 6; - break; - case FILE_FONT: - spacew = 0; - break; - case LSHI_FONT: - case LSLOW_FONT: - spacew = 10; - break; - case OPPRF_FONT: - spacew = 5; - break; - case PINGF_FONT: - spacew = 3; - break; - } + hchw = fontspec.chw >> 1; - switch (fontno) - { - default: - case HU_FONT: - case TINY_FONT: - case KART_FONT: - lfh = 12; - break; - case LT_FONT: - case CRED_FONT: - case FILE_FONT: - lfh = 12; - break; - case GM_FONT: - lfh = 32; - break; - case LSHI_FONT: - lfh = 56; - break; - case LSLOW_FONT: - lfh = 38; - break; - case OPPRF_FONT: - case PINGF_FONT: - lfh = 10; - break; - } - - hchw = chw >> 1; - - chw <<= FRACBITS; - spacew <<= FRACBITS; - lfh <<= FRACBITS; + fontspec.chw <<= FRACBITS; + fontspec.spacew <<= FRACBITS; + fontspec.lfh <<= FRACBITS; #define Mul( id, scale ) ( id = FixedMul (scale, id) ) - Mul (chw, scale); - Mul (spacew, scale); - Mul (lfh, scale); + Mul (fontspec.chw, scale); + Mul (fontspec.spacew, scale); + Mul (fontspec.lfh, scale); - Mul (spacew, spacescale); - Mul (lfh, lfscale); + Mul (fontspec.spacew, spacescale); + Mul (fontspec.lfh, lfscale); #undef Mul if (( flags & V_NOSCALESTART )) @@ -2345,9 +2404,9 @@ void V_DrawStringScaled( hchw *= dupx; - chw *= dupx; - spacew *= dupx; - lfh *= vid.dupy; + fontspec.chw *= dupx; + fontspec.spacew *= dupx; + fontspec.lfh *= vid.dupy; right = vid.width; } @@ -2366,60 +2425,6 @@ void V_DrawStringScaled( right <<= FRACBITS; bot = vid.height << FRACBITS; - switch (fontno) - { - default: - if (chw) - dim_fn = CenteredCharacterDim; - else - dim_fn = VariableCharacterDim; - break; - case KART_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = BunchedCharacterDim; - break; - case TINY_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - { - /* Reuse this flag for the alternate bunched-up spacing. */ - if (( flags & V_6WIDTHSPACE )) - dim_fn = BunchedCharacterDim; - else - dim_fn = VariableCharacterDim; - } - break; - case GM_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = GamemodeCharacterDim; - break; - case FILE_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = FileCharacterDim; - break; - case LSHI_FONT: - case LSLOW_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = LSTitleCharacterDim; - break; - case OPPRF_FONT: - case PINGF_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = BunchedCharacterDim; - break; - } - cx = x; cy = y; cyoff = 0; @@ -2429,7 +2434,7 @@ void V_DrawStringScaled( switch (c) { case '\n': - cy += lfh; + cy += fontspec.lfh; if (cy >= bot) return; cx = x; @@ -2455,22 +2460,39 @@ void V_DrawStringScaled( else if (cx < right) { if (uppercase) + { c = toupper(c); + } + else if (V_CharacterValid(font, c - font->start) == false) + { + // Try the other case if it doesn't exist + if (c >= 'A' && c <= 'Z') + { + c = tolower(c); + } + else if (c >= 'a' && c <= 'z') + { + c = toupper(c); + } + } + if (dance) + { cyoff = V_DanceYOffset(dancecounter) * FRACUNIT; + } c -= font->start; - if (c >= 0 && c < font->size && font->font[c]) + if (V_CharacterValid(font, c) == true) { cw = SHORT (font->font[c]->width) * dupx; - cxoff = (*dim_fn)(scale, chw, hchw, dupx, &cw); + cxoff = (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw); V_DrawFixedPatch(cx + cxoff, cy + cyoff, scale, flags, font->font[c], colormap); cx += cw; } else - cx += spacew; + cx += fontspec.spacew; } } } @@ -2484,151 +2506,44 @@ fixed_t V_StringScaledWidth( int fontno, const char *s) { - fixed_t chw; INT32 hchw;/* half-width for centering */ - fixed_t spacew; - fixed_t lfh; INT32 dupx; - fixed_t (*dim_fn)(fixed_t,fixed_t,INT32,INT32,fixed_t *); - font_t *font; boolean uppercase; - fixed_t cx, cy; + fixed_t cx; fixed_t right; fixed_t cw; - INT32 spacing; - int c; fixed_t fullwidth = 0; - uppercase = !( flags & V_ALLOWLOWERCASE ); - flags &= ~(V_FLIP);/* These two (V_ALLOWLOWERCASE) share a bit. */ + uppercase = ((flags & V_FORCEUPPERCASE) == V_FORCEUPPERCASE); + flags &= ~(V_FLIP);/* These two (V_FORCEUPPERCASE) share a bit. */ font = &fontv[fontno]; - chw = 0; + fontspec_t fontspec; - spacing = ( flags & V_SPACINGMASK ); + V_GetFontSpecification(fontno, flags, &fontspec); - /* - Hardcoded until a better system can be implemented - for determining how fonts space. - */ - switch (fontno) - { - default: - case HU_FONT: - spacew = 4; - switch (spacing) - { - case V_MONOSPACE: - spacew = 8; - /* FALLTHRU */ - case V_OLDSPACING: - chw = 8; - break; - case V_6WIDTHSPACE: - spacew = 6; - } - break; - case TINY_FONT: - spacew = 2; - switch (spacing) - { - case V_MONOSPACE: - spacew = 5; - /* FALLTHRU */ - case V_OLDSPACING: - chw = 5; - break; - // Out of video flags, so we're reusing this for alternate charwidth instead - /*case V_6WIDTHSPACE: - spacewidth = 3;*/ - } - break; - case LT_FONT: - spacew = 12; - break; - case CRED_FONT: - spacew = 16; - break; - case KART_FONT: - spacew = 3; - switch (spacing) - { - case V_MONOSPACE: - spacew = 12; - /* FALLTHRU */ - case V_OLDSPACING: - chw = 12; - break; - case V_6WIDTHSPACE: - spacew = 6; - } - break; - case GM_FONT: - case FILE_FONT: - spacew = 0; - break; - case LSHI_FONT: - case LSLOW_FONT: - spacew = 10; - break; - case OPPRF_FONT: - spacew = 5; - break; - case PINGF_FONT: - spacew = 3; - break; - } + hchw = fontspec.chw >> 1; - switch (fontno) - { - default: - case HU_FONT: - case TINY_FONT: - case KART_FONT: - lfh = 12; - break; - case LT_FONT: - case CRED_FONT: - case FILE_FONT: - lfh = 12; - break; - case GM_FONT: - lfh = 32; - break; - case LSHI_FONT: - lfh = 56; - break; - case LSLOW_FONT: - lfh = 38; - break; - case OPPRF_FONT: - case PINGF_FONT: - lfh = 10; - break; - } - - hchw = chw >> 1; - - chw <<= FRACBITS; - spacew <<= FRACBITS; + fontspec.chw <<= FRACBITS; + fontspec.spacew <<= FRACBITS; #define Mul( id, scale ) ( id = FixedMul (scale, id) ) - Mul (chw, scale); - Mul (spacew, scale); - Mul (lfh, scale); + Mul (fontspec.chw, scale); + Mul (fontspec.spacew, scale); + Mul (fontspec.lfh, scale); - Mul (spacew, spacescale); - Mul (lfh, lfscale); + Mul (fontspec.spacew, spacescale); + Mul (fontspec.lfh, lfscale); #undef Mul if (( flags & V_NOSCALESTART )) @@ -2637,70 +2552,16 @@ fixed_t V_StringScaledWidth( hchw *= dupx; - chw *= dupx; - spacew *= dupx; - lfh *= vid.dupy; + fontspec.chw *= dupx; + fontspec.spacew *= dupx; + fontspec.lfh *= vid.dupy; } else { dupx = 1; } - switch (fontno) - { - default: - if (chw) - dim_fn = CenteredCharacterDim; - else - dim_fn = VariableCharacterDim; - break; - case KART_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = BunchedCharacterDim; - break; - case TINY_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - { - /* Reuse this flag for the alternate bunched-up spacing. */ - if (( flags & V_6WIDTHSPACE )) - dim_fn = BunchedCharacterDim; - else - dim_fn = VariableCharacterDim; - } - break; - case GM_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = GamemodeCharacterDim; - break; - case FILE_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = FileCharacterDim; - break; - case LSHI_FONT: - case LSLOW_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = LSTitleCharacterDim; - break; - case OPPRF_FONT: - case PINGF_FONT: - if (chw) - dim_fn = FixedCharacterDim; - else - dim_fn = BunchedCharacterDim; - break; - } - - cx = cy = 0; + cx = 0; right = 0; for (; ( c = *s ); ++s) @@ -2708,15 +2569,31 @@ fixed_t V_StringScaledWidth( switch (c) { case '\n': - cy += lfh; cx = 0; break; default: + if (( c & 0x80 )) + continue; + if (uppercase) + { c = toupper(c); + } + else if (V_CharacterValid(font, c - font->start) == false) + { + // Try the other case if it doesn't exist + if (c >= 'A' && c <= 'Z') + { + c = tolower(c); + } + else if (c >= 'a' && c <= 'z') + { + c = toupper(c); + } + } c -= font->start; - if (c >= 0 && c < font->size && font->font[c]) + if (V_CharacterValid(font, c) == true) { cw = SHORT (font->font[c]->width) * dupx; @@ -2725,11 +2602,11 @@ fixed_t V_StringScaledWidth( // We need to count the full width to get the rightmost edge of the string though. right = cx + (cw * scale); - (*dim_fn)(scale, chw, hchw, dupx, &cw); + (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw); cx += cw; } else - cx += spacew; + cx += fontspec.spacew; } fullwidth = std::max(right, std::max(cx, fullwidth)); @@ -2738,6 +2615,171 @@ fixed_t V_StringScaledWidth( return fullwidth; } +// Modify a string to wordwrap at any given width. +char * V_ScaledWordWrap( + fixed_t w, + fixed_t scale, + fixed_t spacescale, + fixed_t lfscale, + INT32 flags, + int fontno, + const char *s) +{ + INT32 hchw;/* half-width for centering */ + + INT32 dupx; + + font_t *font; + + boolean uppercase; + + fixed_t cx; + fixed_t right; + + fixed_t cw; + + int c; + + uppercase = ((flags & V_FORCEUPPERCASE) == V_FORCEUPPERCASE); + flags &= ~(V_FLIP);/* These two (V_FORCEUPPERCASE) share a bit. */ + + font = &fontv[fontno]; + + fontspec_t fontspec; + + V_GetFontSpecification(fontno, flags, &fontspec); + + hchw = fontspec.chw >> 1; + + fontspec.chw <<= FRACBITS; + fontspec.spacew <<= FRACBITS; + +#define Mul( id, scale ) ( id = FixedMul (scale, id) ) + Mul (fontspec.chw, scale); + Mul (fontspec.spacew, scale); + Mul (fontspec.lfh, scale); + + Mul (fontspec.spacew, spacescale); + Mul (fontspec.lfh, lfscale); +#undef Mul + + if (( flags & V_NOSCALESTART )) + { + dupx = vid.dupx; + + hchw *= dupx; + + fontspec.chw *= dupx; + fontspec.spacew *= dupx; + fontspec.lfh *= vid.dupy; + } + else + { + dupx = 1; + } + + cx = 0; + right = 0; + + size_t reader = 0, writer = 0, startwriter = 0; + fixed_t cxatstart = 0; + + size_t len = strlen(s) + 1; + size_t potentialnewlines = 8; + size_t sparenewlines = potentialnewlines; + + char *newstring = static_cast(Z_Malloc(len + sparenewlines, PU_STATIC, NULL)); + + for (; ( c = s[reader] ); ++reader, ++writer) + { + newstring[writer] = s[reader]; + + right = 0; + + switch (c) + { + case '\n': + cx = 0; + cxatstart = 0; + startwriter = 0; + break; + default: + if (( c & 0x80 )) + ; + else + { + if (uppercase) + { + c = toupper(c); + } + else if (V_CharacterValid(font, c - font->start) == false) + { + // Try the other case if it doesn't exist + if (c >= 'A' && c <= 'Z') + { + c = tolower(c); + } + else if (c >= 'a' && c <= 'z') + { + c = toupper(c); + } + } + + c -= font->start; + if (V_CharacterValid(font, c) == true) + { + cw = SHORT (font->font[c]->width) * dupx; + + // How bunched dims work is by incrementing cx slightly less than a full character width. + // This causes the next character to be drawn overlapping the previous. + // We need to count the full width to get the rightmost edge of the string though. + right = cx + (cw * scale); + + (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw); + cx += cw; + } + else + { + cx += fontspec.spacew; + cxatstart = cx; + startwriter = writer; + } + } + } + + // Start trying to wrap if presumed length exceeds the space we have on-screen. + if (right && right > w) + { + if (startwriter != 0) + { + newstring[startwriter] = '\n'; + cx -= cxatstart; + cxatstart = 0; + startwriter = 0; + } + else + { + if (sparenewlines == 0) + { + sparenewlines = (potentialnewlines *= 2); + newstring = static_cast(Z_Realloc(newstring, len + sparenewlines, PU_STATIC, NULL)); + } + + sparenewlines--; + len++; + + newstring[writer++] = '\n'; // Over-write previous + cx = cw; // Valid value in the only case right is currently set + newstring[writer] = s[reader]; // Re-add + } + } + } + + newstring[writer] = '\0'; + + return newstring; +} + void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string) { x -= V_StringWidth(string, option)/2; @@ -2821,6 +2863,18 @@ void V_DrawRightAlignedTimerString(INT32 x, INT32 y, INT32 option, const char *s V_DrawTimerString(x, y, option, string); } +void V_DrawCenteredMenuString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x -= V_MenuStringWidth(string, option)/2; + V_DrawMenuString(x, y, option, string); +} + +void V_DrawRightAlignedMenuString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x -= V_MenuStringWidth(string, option); + V_DrawMenuString(x, y, option, string); +} + void V_DrawCenteredGamemodeString(INT32 x, INT32 y, INT32 option, const UINT8 *colormap, const char *string) { x -= V_GamemodeStringWidth(string, option)/2; @@ -2939,7 +2993,7 @@ INT32 V_LevelNameHeight(const char *string) INT32 c, w = 0; size_t i; - for (i = 0; i < strlen(string); i++) + for (i = 0; string[i]; i++) { c = string[i] - LT_FONTSTART; if (c < 0 || c >= LT_FONTSIZE || !fontv[LT_FONT].font[c]) diff --git a/src/v_video.h b/src/v_video.h index 65529c112..7a26591dc 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -175,7 +175,7 @@ void V_CubeApply(RGBA_t *input); #define V_SNAPTOLEFT 0x04000000 // for centering #define V_SNAPTORIGHT 0x08000000 // for centering -#define V_ALLOWLOWERCASE 0x10000000 // (strings only) allow fonts that have lowercase letters to use them +#define V_FORCEUPPERCASE 0x10000000 // (strings only) prevents fonts that have lowercase letters from using them #define V_FLIP 0x10000000 // (patches only) Horizontal flip #define V_SLIDEIN 0x20000000 // Slide in from the sides on level load, depending on snap flags @@ -257,8 +257,9 @@ void V_DrawPromptBack(INT32 boxheight, INT32 color); INT32 V_DanceYOffset(INT32 counter); // draw a single character -void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed); -// draw a single character, but for the chat +void V_DrawCharacterScaled(fixed_t x, fixed_t y, fixed_t scale, INT32 flags, int font, int c, UINT8 *colormap); +void V_DrawCharacter(INT32 x, INT32 y, INT32 option, boolean lowercase); + void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UINT8 *colormap); UINT8 *V_GetStringColormap(INT32 colorflags); @@ -272,9 +273,6 @@ UINT8 *V_GetStringColormap(INT32 colorflags); INT32 V_LevelNameHeight(const char *string); -// wordwrap a string using the hu_font -char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string); - // draw a string using a font void V_DrawStringScaled( fixed_t x, @@ -295,6 +293,15 @@ fixed_t V_StringScaledWidth( int fontno, const char *s); +char * V_ScaledWordWrap( + fixed_t w, + fixed_t scale, + fixed_t spacescale, + fixed_t lfscale, + INT32 flags, + int fontno, + const char *s); + // draw a string using the hu_font #define V_DrawString( x,y,option,string ) \ V__DrawDupxString (x,y,FRACUNIT,option,NULL,HU_FONT,string) @@ -340,7 +347,7 @@ void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, con // Draws a titlecard font string. // timer: when the letters start appearing (leave to 0 to disable) // threshold: when the letters start disappearing (leave to 0 to disable) (both are INT32 in case you supply negative values...) -// NOTE: This function ignores most conventional string flags (V_RETURN8, V_ALLOWLOWERCASE ...) +// NOTE: This function ignores most conventional string flags (V_RETURN8, V_FORCEUPPERCASE ...) // NOTE: This font only works with uppercase letters. void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boolean bossmode, INT32 timer, INT32 threshold); @@ -373,6 +380,15 @@ void V_DrawProfileNum(INT32 x, INT32 y, INT32 flags, UINT8 num); void V_DrawCenteredTimerString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawRightAlignedTimerString(INT32 x, INT32 y, INT32 option, const char *string); +#define V_DrawMenuString( x,y,option,string ) \ + V__DrawDupxString (x,y,FRACUNIT,option,NULL,MENU_FONT,string) + +#define V_MenuStringWidth( string,option ) \ + V__IntegerStringWidth ( FRACUNIT,option,MENU_FONT,string ) + +void V_DrawCenteredMenuString(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawRightAlignedMenuString(INT32 x, INT32 y, INT32 option, const char *string); + #define V_DrawGamemodeString( x,y,option,cm,string ) \ V__DrawDupxString (x,y,FRACUNIT,option,cm,GM_FONT,string) diff --git a/src/y_inter.c b/src/y_inter.c index 54e301db6..935691a17 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -573,13 +573,13 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) _isHighlightedPlayer(&players[pnum]) ? hilicol : 0 - )|V_ALLOWLOWERCASE|V_6WIDTHSPACE, + ), player_names[pnum] ); V_DrawRightAlignedThinString( x+118, y-2, - V_ALLOWLOWERCASE|V_6WIDTHSPACE, + 0, standings->strval[i] ); @@ -622,7 +622,7 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) { V_DrawThinString( x2, y-2, - V_ALLOWLOWERCASE|V_6WIDTHSPACE, + 0, increasenum ); } @@ -630,7 +630,7 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset) { V_DrawRightAlignedThinString( x2, y-2, - V_ALLOWLOWERCASE|V_6WIDTHSPACE, + 0, increasenum ); } @@ -1247,7 +1247,7 @@ void Y_RoundQueueDrawer(y_data_t *standings, INT32 offset, boolean doanimations, void Y_IntermissionDrawer(void) { // INFO SEGMENT - // Numbers are V_DrawRightAlignedThinString WITH v_6widthspace as flags + // Numbers are V_DrawRightAlignedThinString as flags // resbar 1 (48,82) 5 (176, 82) // 2 (48, 96) @@ -1397,7 +1397,7 @@ skiptallydrawer: { if (speedscramble != -1 && speedscramble != gamespeed) { - V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, highlightflags|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, + V_DrawCenteredThinString(BASEVIDWIDTH/2, 154, highlightflags|V_SNAPTOBOTTOM, va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[1+speedscramble].strvalue)); } } @@ -1414,13 +1414,13 @@ finalcounter: INT32 buttony = 2; K_drawButtonAnim(buttonx - 76, buttony, 0, kp_button_b[1], replayprompttic); - V_DrawRightAlignedThinString(buttonx - 55, buttony, V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "or"); + V_DrawRightAlignedThinString(buttonx - 55, buttony, highlightflags, "or"); K_drawButtonAnim(buttonx - 55, buttony, 0, kp_button_x[1], replayprompttic); - V_DrawRightAlignedThinString(buttonx - 2, buttony, V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "Save replay"); + V_DrawRightAlignedThinString(buttonx - 2, buttony, highlightflags, "Save replay"); break; } case DSM_SAVED: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_ALLOWLOWERCASE|V_6WIDTHSPACE|highlightflags, "Replay saved!"); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, highlightflags, "Replay saved!"); break; case DSM_TITLEENTRY: