This commit is contained in:
Antonio Martinez 2024-09-21 19:30:59 -07:00 committed by AJ Martinez
parent dfdd46d69f
commit 7573c7dac9
5 changed files with 82 additions and 45 deletions

View file

@ -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 = "<large>";
if (Dismissable() && typewriter.text.length() > 0)
{
if (TextDone())
{
drawer
.xy(-14, -7-5)
.patch(patchCache["TUTDIAG2"]);
}
intertext += " <large>";
if (Held())
intertext += "<z_pressed>";
else if (TextDone())
intertext += "<z_animated>";
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 += "<z_pressed>";
else
intertext += "<z_animated>";
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())

View file

@ -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);

View file

@ -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, "<left> <right> <up> <down> Steering", 0, 0);
K_DrawGameControl(4, 184 - 45 + offset/2, 0, "<a> Accelerate", 0, 0);
K_DrawGameControl(4, 184 - 30 + offset/2, 0, "<b> Look Back", 0, 0);
K_DrawGameControl(4, 184 - 15 + offset/2, 0, "<c> Spindash", 0, 0);
K_DrawGameControl(4, 184 - 0 + offset/2, 0, "<l> Item", 0, 0);
K_DrawGameControl(90, 184 - 45 + offset/2, 0, "<x> Brake", 0, 0);
K_DrawGameControl(90, 184 - 30 + offset/2, 0, "<y> Respawn", 0, 0);
K_DrawGameControl(90, 184 - 15 + offset/2, 0, "<z> Dialogue / Action", 0, 0);
K_DrawGameControl(90, 184 - 0 + offset/2, 0, "<r> Drift", 0, 0);
}
else
{
V_DrawMenuString(4, 188 + offset/2, V_YELLOWMAP, M_GetGameplayMode());

View file

@ -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},

View file

@ -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
{