From 7573c7dac90b4ed07e17e6768e9c55dd4d650445 Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Sat, 21 Sep 2024 19:30:59 -0700 Subject: [PATCH] idk --- src/k_dialogue.cpp | 39 ++++++++++++----------------- src/k_hud.cpp | 10 ++++++++ src/k_menudraw.c | 13 ++++++++++ src/v_draw.cpp | 4 +++ src/v_video.cpp | 61 +++++++++++++++++++++++++++++----------------- 5 files changed, 82 insertions(+), 45 deletions(-) diff --git a/src/k_dialogue.cpp b/src/k_dialogue.cpp index fc163498f..4f965c25a 100644 --- a/src/k_dialogue.cpp +++ b/src/k_dialogue.cpp @@ -241,7 +241,7 @@ void Dialogue::NewText(std::string_view rawText) Init(); char* newText = V_ScaledWordWrap( - 290 << FRACBITS, + 275 << FRACBITS, FRACUNIT, FRACUNIT, FRACUNIT, 0, HU_FONT, srb2::Draw::TextElement().parse(rawText).string().c_str() // parse special characters @@ -474,31 +474,24 @@ void Dialogue::Draw(void) std::string intertext = ""; - if (Dismissable() && typewriter.text.length() > 0) - { - if (TextDone()) - { - drawer - .xy(-14, -7-5) - .patch(patchCache["TUTDIAG2"]); - } - - intertext += " "; - - if (Held()) - intertext += ""; - else if (TextDone()) - intertext += ""; - else - intertext += ""; - } - - std::string fulltext = typewriter.text + srb2::Draw::TextElement().parse(intertext).string(); - drawer .xy(10 - BASEVIDWIDTH, -3-32) .font(srb2::Draw::Font::kConsole) - .text( fulltext.c_str() ); + .text( typewriter.text.c_str() ); + + if (TextDone()) + { + drawer + .xy(-18 - 5, -7-5) + .patch(patchCache["TUTDIAG2"]); + + if (Held()) + intertext += ""; + else + intertext += ""; + + drawer.xy(-18 + 4 - 5, -7-8 - 14).align(Draw::Align::kCenter).font(Draw::Font::kMenu).text(srb2::Draw::TextElement().parse(intertext).string()); + } /* if (Dismissable()) diff --git a/src/k_hud.cpp b/src/k_hud.cpp index 8f8eae434..7c098fb07 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -6516,6 +6516,16 @@ void K_drawKartHUD(void) Draw(55+offset, 5).align((srb2::Draw::Align)1).font(Draw::Font::kMenu).text(text); } + if (0) + { + Draw::TextElement text = Draw::TextElement().parse("\xEELEFTSPACE\xEE\n\xEESPC\xEE \xEETAB\xEE\nA \xEB\xEF\xA0 A\nB \xEB\xEF\xA1 B\nX \xEB\xEF\xA2 X\nY \xEB\xEF\xA3 Y\nLB \xEB\xEF\xA4 LB\nRB \xEB\xEF\xA5 RB\nLT \xEB\xEF\xA6 LT\nRT \xEB\xEF\xA7 RT\nST \xEB\xEF\xA8 ST\nBK \xEB\xEF\xA9 BK\nLS \xEB\xEF\xAA LS\nRS \xEB\xEF\xAB RS\n"); + + UINT8 offset = 0; + Draw(160+offset, 5).align((srb2::Draw::Align)1).font(Draw::Font::kThin).text(text); + Draw(55+offset, 5).align((srb2::Draw::Align)1).font(Draw::Font::kMenu).text(text); + } + + /* stplyr = &players[2]; Draw(5, 25).align((srb2::Draw::Align)0).font(Draw::Font::kConsole).text(text); diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 459148362..c63f94242 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -6099,6 +6099,19 @@ void M_DrawPause(void) Y_RoundQueueDrawer(&standings, offset/2, false, false); } + else if (gametype == GT_TUTORIAL) + { + K_DrawGameControl(4, 184 - 60 + offset/2, 0, " Steering", 0, 0); + K_DrawGameControl(4, 184 - 45 + offset/2, 0, " Accelerate", 0, 0); + K_DrawGameControl(4, 184 - 30 + offset/2, 0, " Look Back", 0, 0); + K_DrawGameControl(4, 184 - 15 + offset/2, 0, " Spindash", 0, 0); + K_DrawGameControl(4, 184 - 0 + offset/2, 0, " Item", 0, 0); + + K_DrawGameControl(90, 184 - 45 + offset/2, 0, " Brake", 0, 0); + K_DrawGameControl(90, 184 - 30 + offset/2, 0, " Respawn", 0, 0); + K_DrawGameControl(90, 184 - 15 + offset/2, 0, " Dialogue / Action", 0, 0); + K_DrawGameControl(90, 184 - 0 + offset/2, 0, " Drift", 0, 0); + } else { V_DrawMenuString(4, 188 + offset/2, V_YELLOWMAP, M_GetGameplayMode()); diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 4120a8dc1..d9c6ea44d 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -63,6 +63,10 @@ Draw::TextElement& Draw::TextElement::parse(std::string_view raw) {"large", 0xEB}, + {"box", 0xEC}, + {"box_pressed", 0xED}, + {"box_animated", 0xEE}, + {"white", 0x80}, {"purple", 0x81}, {"yellow", 0x82}, diff --git a/src/v_video.cpp b/src/v_video.cpp index 10bdb41f0..1adaaa851 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -2494,7 +2494,7 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result) } } -static UINT8 V_GetButtonCodeWidth(UINT8 c) +static UINT8 V_GetButtonCodeWidth(UINT8 c, boolean largebutton) { UINT8 x = 0; @@ -2527,14 +2527,14 @@ static UINT8 V_GetButtonCodeWidth(UINT8 c) case 0x0E: case 0x0F: // faces - x = 10; + x = largebutton ? 13 : 10; break; } return x; } -static UINT8 V_GetGenericButtonCodeWidth(UINT8 c) +static UINT8 V_GetGenericButtonCodeWidth(UINT8 c, boolean largebutton) { UINT8 x = 0; @@ -2545,7 +2545,7 @@ static UINT8 V_GetGenericButtonCodeWidth(UINT8 c) case 0x02: case 0x03: // buttons - x = 14; + x = largebutton ? 17 : 14; break; case 0x04: @@ -2563,7 +2563,7 @@ static UINT8 V_GetGenericButtonCodeWidth(UINT8 c) case 0x08: case 0x09: // nav - x = 16; + x = 14; break; case 0x0A: @@ -2706,7 +2706,7 @@ void V_DrawStringScaled( cx = x; break; case '\xEB': - if (fontno != TINY_FONT) + if (fontno != TINY_FONT && fontno != HU_FONT) largebutton = true; break; case '\xEF': @@ -2862,17 +2862,13 @@ void V_DrawStringScaled( } }; - cw = V_GetButtonCodeWidth(c) * dupx; - - // FIXME do real widths - if (largebutton) - cw += 3*dupx; + cw = V_GetButtonCodeWidth(c, largebutton) * dupx; cxoff = (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw); Draw bt = Draw( FixedToFloat(cx + cxoff) - (bt_inst->x * dupx), - FixedToFloat(cy + cyoff) - ((bt_inst->y + fontspec.button_yofs) * dupy) - (largebutton ? 2*dupy : 0)) + FixedToFloat(cy + cyoff) - ((bt_inst->y + fontspec.button_yofs) * dupy) - (largebutton ? 0*dupy : 0)) .flags(flags); if (largebutton) @@ -2929,17 +2925,13 @@ void V_DrawStringScaled( } }; - cw = V_GetGenericButtonCodeWidth(c) * dupx; - - // FIXME do real widths - if (largebutton) - cw += 3*dupx; + cw = V_GetGenericButtonCodeWidth(c, largebutton) * dupx; cxoff = (*fontspec.dim_fn)(scale, fontspec.chw, hchw, dupx, &cw); Draw bt = Draw( FixedToFloat(cx + cxoff) - (bt_inst->x * dupx), - FixedToFloat(cy + cyoff) - ((bt_inst->y + fontspec.button_yofs) * dupy) - (largebutton ? 2*dupy : 0)) + FixedToFloat(cy + cyoff) - ((bt_inst->y + fontspec.button_yofs) * dupy) - (largebutton ? 0*dupy : 0)) .flags(flags); if (largebutton) @@ -3056,7 +3048,7 @@ fixed_t V_StringScaledWidth( cx = 0; break; case '\xEB': - if (fontno != TINY_FONT) + if (fontno != TINY_FONT && fontno != HU_FONT) largebutton = true; case '\xEF': descriptive = true; @@ -3078,13 +3070,13 @@ fixed_t V_StringScaledWidth( { if (descriptive) { - cw = V_GetGenericButtonCodeWidth(c) * dupx; + cw = V_GetGenericButtonCodeWidth(c, largebutton) * dupx; cx += cw * scale; right = cx; } else { - cw = V_GetButtonCodeWidth(c) * dupx; + cw = V_GetButtonCodeWidth(c, largebutton) * dupx; cx += cw * scale; right = cx; } @@ -3152,6 +3144,9 @@ char * V_ScaledWordWrap( font_t *font; boolean uppercase; + boolean largebutton = false; + boolean descriptive = false; + boolean boxed = false; fixed_t cx; fixed_t right; @@ -3223,14 +3218,36 @@ char * V_ScaledWordWrap( cxatstart = 0; startwriter = 0; break; + case '\xEB': + if (fontno != TINY_FONT && fontno != HU_FONT) + largebutton = true; + case '\xEF': + descriptive = true; + break; + case '\xEE': + case '\xED': + case '\xEC': + if (boxed) + cx += 3*FRACUNIT; + else + cx += 3*FRACUNIT; + boxed = !boxed; + break; default: if (( c & 0xF0 ) == 0x80 || c == V_STRINGDANCE) ; else if (( c & 0xB0 ) & 0x80) // button prompts { - cw = V_GetButtonCodeWidth(c) * dupx; + if (descriptive) + cw = V_GetGenericButtonCodeWidth(c, largebutton) * dupx; + else + cw = V_GetButtonCodeWidth(c, largebutton) * dupx; + cx += cw * scale; right = cx; + + descriptive = false; + boxed = false; } else {