From 2c8f3624bd480558e60ff410a7d0777df7a0d1fa Mon Sep 17 00:00:00 2001 From: somewhatlurker <52014015+somewhatlurker@users.noreply.github.com> Date: Wed, 23 Oct 2019 11:06:56 +1100 Subject: [PATCH] tlac: rename some text drawing stuff to be more correct --- .../source/plugins/TLAC/Components/Drawing.h | 13 +++--- .../source/plugins/TLAC/Components/Pause.cpp | 41 ++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/source-code/source/plugins/TLAC/Components/Drawing.h b/source-code/source/plugins/TLAC/Components/Drawing.h index d651c3a..1ef1242 100644 --- a/source-code/source/plugins/TLAC/Components/Drawing.h +++ b/source-code/source/plugins/TLAC/Components/Drawing.h @@ -82,13 +82,14 @@ namespace TLAC::Components uint32_t unk14; uint32_t unk18; uint32_t layer; // 8 seems similar to default but higher - // 0x19 is startup screen + // 0x18 is below 0x19 but still seems to be above any game elements + // 0x19 is startup screen (below dwgui) // I noticed some use different scaling uint32_t unk20; uint32_t unk24; uint32_t unk28; - Point originLoc; - Point currentLoc; + Point textCurrentLoc; + Point lineOriginLoc; // must be set for newlines to work as expected uint8_t padding3c[0x4]; uint64_t unk40; FontInfo* font; @@ -107,8 +108,8 @@ namespace TLAC::Components unk20 = 0x0; unk24 = 0xd; unk28 = 0; - originLoc = { 0, 0 }; - currentLoc = { 0, 0 }; + textCurrentLoc = { 0, 0 }; + lineOriginLoc = { 0, 0 }; unk40 = 0; font = fi; unk50 = 0x25a1; @@ -184,7 +185,7 @@ namespace TLAC::Components enum drawTextFlags : uint32_t { - DRAWTEXT_ENABLE_LAYOUT = 1, //? + DRAWTEXT_ENABLE_XADVANCE = 1, DRAWTEXT_ALIGN_RIGHT = 2, DRAWTEXT_ALIGN_CENTRE = 8, DRAWTEXT_STROKE = 0x10000, diff --git a/source-code/source/plugins/TLAC/Components/Pause.cpp b/source-code/source/plugins/TLAC/Components/Pause.cpp index b554b70..59bc796 100644 --- a/source-code/source/plugins/TLAC/Components/Pause.cpp +++ b/source-code/source/plugins/TLAC/Components/Pause.cpp @@ -298,7 +298,8 @@ namespace TLAC::Components // menu fontInfo.setSize(menuTextSize, menuTextSize); - dtParams.originLoc = { menuX, menuY - menuItemHeight * (menu[curMenuSet].items.size() / 2.0f) }; + dtParams.textCurrentLoc = { menuX, menuY - menuItemHeight * (menu[curMenuSet].items.size() / 2.0f) }; + dtParams.lineOriginLoc = dtParams.textCurrentLoc; for (int i = 0; i < menu[curMenuSet].items.size(); i++) { @@ -312,11 +313,11 @@ namespace TLAC::Components dtParams.colour = 0xffffffff; } - dtParams.currentLoc = dtParams.originLoc; drawText(&dtParams, (drawTextFlags)(DRAWTEXT_ALIGN_CENTRE), menu[curMenuSet].items[i].name); - dtParams.originLoc.y += menuItemHeight; + dtParams.textCurrentLoc.y += menuItemHeight; + dtParams.lineOriginLoc = dtParams.textCurrentLoc; } - + // key legend destroyAetLayer(triangleAet); @@ -325,38 +326,38 @@ namespace TLAC::Components destroyAetLayer(circleAet); fontInfo.setSize(18, 18); - dtParams.originLoc = { 32, 720 - 40 }; - dtParams.currentLoc = dtParams.originLoc; + dtParams.textCurrentLoc = { 32, 720 - 40 }; + dtParams.lineOriginLoc = dtParams.textCurrentLoc; const float spriteSize = 18; const float halfSpriteSize = spriteSize / 2; - Point spriteLoc = { 0, dtParams.originLoc.y + halfSpriteSize }; + Point spriteLoc = { 0, dtParams.textCurrentLoc.y + halfSpriteSize }; // the aets are centered on their location, so fudge this a little const Point spriteScale = { spriteSize / 64, spriteSize / 64 }; // just approximated dtParams.colour = 0xffffffff; - drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L"L/R:Move "); + drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_XADVANCE), L"L/R:Move "); if (curMenuSet != MENUSET_MAIN) { - spriteLoc.x = dtParams.originLoc.x + halfSpriteSize; + spriteLoc.x = dtParams.textCurrentLoc.x + halfSpriteSize; // the aets are centered on their location, so fudge this a little triangleAet = createAetLayer(3, 0x19, CREATEAET_20000, "button_sankaku", &spriteLoc, 0, nullptr, nullptr, 0, 0, &spriteScale, nullptr); - dtParams.originLoc.x += spriteSize; - drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Back "); + dtParams.textCurrentLoc.x += spriteSize; + drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_XADVANCE), L":Back "); } - spriteLoc.x = dtParams.originLoc.x + halfSpriteSize; + spriteLoc.x = dtParams.textCurrentLoc.x + halfSpriteSize; squareAet = createAetLayer(3, 0x19, CREATEAET_20000, "button_shikaku", &spriteLoc, 0, nullptr, nullptr, 0, 0, &spriteScale, nullptr); - dtParams.originLoc.x += spriteSize; - drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Hide Menu "); + dtParams.textCurrentLoc.x += spriteSize; + drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_XADVANCE), L":Hide Menu "); - spriteLoc.x = dtParams.originLoc.x + halfSpriteSize; + spriteLoc.x = dtParams.textCurrentLoc.x + halfSpriteSize; crossAet = createAetLayer(3, 0x19, CREATEAET_20000, "button_batsu", &spriteLoc, 0, nullptr, nullptr, 0, 0, &spriteScale, nullptr); - dtParams.originLoc.x += spriteSize; - drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Close "); + dtParams.textCurrentLoc.x += spriteSize; + drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_XADVANCE), L":Close "); - spriteLoc.x = dtParams.originLoc.x + halfSpriteSize; + spriteLoc.x = dtParams.textCurrentLoc.x + halfSpriteSize; circleAet = createAetLayer(3, 0x19, CREATEAET_20000, "button_maru", &spriteLoc, 0, nullptr, nullptr, 0, 0, &spriteScale, nullptr); - dtParams.originLoc.x += spriteSize; - drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Select"); + dtParams.textCurrentLoc.x += spriteSize; + drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_XADVANCE), L":Select"); } }