tlac: (drawing:) use Point struct in more places and add more/better aet funcs, (pause:) use button aets in key legend
This commit is contained in:
@@ -5,6 +5,12 @@
|
||||
namespace TLAC::Components
|
||||
{
|
||||
#pragma pack(push, 1)
|
||||
struct Point
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
struct RawFont
|
||||
{
|
||||
uint32_t sprId; // ?
|
||||
@@ -81,10 +87,8 @@ namespace TLAC::Components
|
||||
uint32_t unk20;
|
||||
uint32_t unk24;
|
||||
uint32_t unk28;
|
||||
float xBegin; // ?
|
||||
float yBegin; // ?
|
||||
float xCurrent; // ?
|
||||
float yCurrent; // ?
|
||||
Point originLoc;
|
||||
Point currentLoc;
|
||||
uint8_t padding3c[0x4];
|
||||
uint64_t unk40;
|
||||
FontInfo* font;
|
||||
@@ -103,10 +107,8 @@ namespace TLAC::Components
|
||||
unk20 = 0x0;
|
||||
unk24 = 0xd;
|
||||
unk28 = 0;
|
||||
xBegin = 0;
|
||||
yBegin = 0;
|
||||
xCurrent = 0;
|
||||
yCurrent = 0;
|
||||
originLoc = { 0, 0 };
|
||||
currentLoc = { 0, 0 };
|
||||
unk40 = 0;
|
||||
font = fi;
|
||||
unk50 = 0x25a1;
|
||||
@@ -240,26 +242,30 @@ namespace TLAC::Components
|
||||
dtParam->fillColour = oldFillColour;
|
||||
}
|
||||
|
||||
struct Point
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
enum createAetFlags : uint32_t
|
||||
{
|
||||
CREATEAET_20000 = 0x20000,
|
||||
};
|
||||
|
||||
// draw an aet layer (with animation settings)
|
||||
int createAetLayer(uint32_t drawLayer, createAetFlags flags, char* name, Point* loc, float animationVar1, float animationVar2)
|
||||
// draw an aet layer (with all settings)
|
||||
int createAetLayer(int32_t unk1, uint32_t drawLayer, createAetFlags flags, char* name, Point* loc, int32_t unk2, char* animation, char* animation2, float animationInTime, float animationOutTime, Point* scale, int32_t unk5)
|
||||
{
|
||||
return ((int(*)(uint32_t, createAetFlags, char*, Point*, float, float))0x14013c020)(drawLayer, flags, name, loc, animationVar1, animationVar2);
|
||||
return ((int(*)(int32_t, uint32_t, createAetFlags, char*, Point*, int32_t, char*, char*, float, float, Point*, int32_t))0x14013be60)(unk1, drawLayer, flags, name, loc, unk2, animation, animation2, animationInTime, animationOutTime, scale, unk5);
|
||||
}
|
||||
// draw an aet layer (with default animation)
|
||||
// draw an aet layer (with animation timing override)
|
||||
int createAetLayer(uint32_t drawLayer, createAetFlags flags, char* name, Point* loc, float animationInTime, float animationOutTime)
|
||||
{
|
||||
return createAetLayer(3, drawLayer, flags, name, loc, 0, 0, 0, animationInTime, animationOutTime, 0, 0);
|
||||
}
|
||||
// draw an aet layer (with scale)
|
||||
int createAetLayer(uint32_t drawLayer, createAetFlags flags, char* name, Point* loc, Point* scale)
|
||||
{
|
||||
return createAetLayer(3, drawLayer, flags, name, loc, 0, 0, 0, -1, -1, scale, 0);
|
||||
}
|
||||
// draw an aet layer
|
||||
int createAetLayer(uint32_t drawLayer, createAetFlags flags, char* name, Point* loc)
|
||||
{
|
||||
return createAetLayer(drawLayer, flags, name, loc, -1, -1);
|
||||
return createAetLayer(3, drawLayer, flags, name, loc, 0, 0, 0, -1, -1, 0, 0);
|
||||
}
|
||||
|
||||
void destroyAetLayer(int &layer)
|
||||
|
||||
@@ -190,12 +190,10 @@ namespace TLAC::Components
|
||||
*playstate = streamPlayStates[i];
|
||||
}
|
||||
|
||||
/*
|
||||
destroyAetLayer(triangleAet);
|
||||
destroyAetLayer(squareAet);
|
||||
destroyAetLayer(crossAet);
|
||||
destroyAetLayer(circleAet);
|
||||
*/
|
||||
|
||||
isPaused = false;
|
||||
}
|
||||
@@ -218,7 +216,7 @@ namespace TLAC::Components
|
||||
// setup draw objects
|
||||
FontInfo fontInfo(0x11);
|
||||
DrawParams dtParams(&fontInfo);
|
||||
dtParams.layer = 0x19; // same as startup screen
|
||||
dtParams.layer = bgLayer;
|
||||
|
||||
|
||||
// bg rect
|
||||
@@ -251,6 +249,8 @@ namespace TLAC::Components
|
||||
*/
|
||||
|
||||
|
||||
dtParams.layer = contentLayer;
|
||||
|
||||
// selection cursor
|
||||
int selectBoxOrigin = menuY - menuItemHeight * (menuItems[menuSet].size() / 2.0) - (menuItemHeight - menuTextSize) / 2;
|
||||
int selectBoxPos = selectBoxOrigin + menuItemHeight * menuPos;
|
||||
@@ -270,8 +270,7 @@ namespace TLAC::Components
|
||||
// menu
|
||||
fontInfo.setSize(menuTextSize, menuTextSize);
|
||||
|
||||
dtParams.xBegin = menuX;
|
||||
dtParams.yBegin = menuY - menuItemHeight * (menuItems[menuSet].size() / 2.0);
|
||||
dtParams.originLoc = { menuX, menuY - menuItemHeight * (menuItems[menuSet].size() / 2.0f) };
|
||||
|
||||
for (int i = 0; i < menuItems[menuSet].size(); i++)
|
||||
{
|
||||
@@ -289,56 +288,51 @@ namespace TLAC::Components
|
||||
dtParams.colour = 0xffffffff;
|
||||
}
|
||||
|
||||
dtParams.xCurrent = dtParams.xBegin;
|
||||
dtParams.yCurrent = dtParams.yBegin;
|
||||
dtParams.currentLoc = dtParams.originLoc;
|
||||
drawText(&dtParams, (drawTextFlags)(DRAWTEXT_ALIGN_CENTRE), item.first);
|
||||
dtParams.yBegin += menuItemHeight;
|
||||
dtParams.originLoc.y += menuItemHeight;
|
||||
}
|
||||
|
||||
|
||||
// key legend
|
||||
fontInfo.setSize(18, 18);
|
||||
|
||||
dtParams.xBegin = 32;
|
||||
dtParams.yBegin = 720 - 40;
|
||||
dtParams.xCurrent = dtParams.xBegin;
|
||||
dtParams.yCurrent = dtParams.yBegin;
|
||||
dtParams.colour = 0xffffffff;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L"L/R:Move ");
|
||||
if (menuSet != MENUSET_MAIN)
|
||||
{
|
||||
dtParams.colour = 0xff40ff40;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L"△");
|
||||
dtParams.colour = 0xffffffff;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Back ");
|
||||
}
|
||||
dtParams.colour = 0xffc0c0ff;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L"□");
|
||||
dtParams.colour = 0xffffffff;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Hide Menu ");
|
||||
dtParams.colour = 0xffff8020;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L"×");
|
||||
dtParams.colour = 0xffffffff;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Close ");
|
||||
dtParams.colour = 0xff4040ff;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L"○");
|
||||
dtParams.colour = 0xffffffff;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Select");
|
||||
|
||||
/*
|
||||
destroyAetLayer(triangleAet);
|
||||
destroyAetLayer(squareAet);
|
||||
destroyAetLayer(crossAet);
|
||||
destroyAetLayer(circleAet);
|
||||
Point spriteLoc = { 64, 64 };
|
||||
triangleAet = createAetLayer(0x19, CREATEAET_20000, "button_sankaku", &spriteLoc, 0, 1);
|
||||
spriteLoc.x += 64;
|
||||
squareAet = createAetLayer(0x19, CREATEAET_20000, "button_shikaku", &spriteLoc, 0, 1);
|
||||
spriteLoc.x += 64;
|
||||
crossAet = createAetLayer(0x19, CREATEAET_20000, "button_batsu", &spriteLoc, 0, 1);
|
||||
spriteLoc.x += 64;
|
||||
circleAet = createAetLayer(0x19, CREATEAET_20000, "button_maru", &spriteLoc, 0, 1);
|
||||
*/
|
||||
|
||||
fontInfo.setSize(18, 18);
|
||||
dtParams.originLoc = { 32, 720 - 40 };
|
||||
dtParams.currentLoc = dtParams.originLoc;
|
||||
const float spriteSize = 18;
|
||||
const float halfSpriteSize = spriteSize / 2;
|
||||
Point spriteLoc = { 0, dtParams.originLoc.y + halfSpriteSize };
|
||||
Point spriteScale = { spriteSize / 64, spriteSize / 64 }; // just approximated
|
||||
|
||||
dtParams.colour = 0xffffffff;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L"L/R:Move ");
|
||||
|
||||
if (menuSet != MENUSET_MAIN)
|
||||
{
|
||||
spriteLoc.x = dtParams.originLoc.x + halfSpriteSize;
|
||||
triangleAet = createAetLayer(3, 0x19, CREATEAET_20000, "button_sankaku", &spriteLoc, 0, 0, 0, 0, 0, &spriteScale, 0);
|
||||
dtParams.originLoc.x += spriteSize;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Back ");
|
||||
}
|
||||
|
||||
spriteLoc.x = dtParams.originLoc.x + halfSpriteSize;
|
||||
squareAet = createAetLayer(3, 0x19, CREATEAET_20000, "button_shikaku", &spriteLoc, 0, 0, 0, 0, 0, &spriteScale, 0);
|
||||
dtParams.originLoc.x += spriteSize;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Hide Menu ");
|
||||
|
||||
spriteLoc.x = dtParams.originLoc.x + halfSpriteSize;
|
||||
crossAet = createAetLayer(3, 0x19, CREATEAET_20000, "button_batsu", &spriteLoc, 0, 0, 0, 0, 0, &spriteScale, 0);
|
||||
dtParams.originLoc.x += spriteSize;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Close ");
|
||||
|
||||
spriteLoc.x = dtParams.originLoc.x + halfSpriteSize;
|
||||
circleAet = createAetLayer(3, 0x19, CREATEAET_20000, "button_maru", &spriteLoc, 0, 0, 0, 0, 0, &spriteScale, 0);
|
||||
dtParams.originLoc.x += spriteSize;
|
||||
drawTextW(&dtParams, (drawTextFlags)(DRAWTEXT_ENABLE_LAYOUT), L":Select");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,18 +51,19 @@ namespace TLAC::Components
|
||||
static const int menuY = 360;
|
||||
static const int menuItemHeight = 36;
|
||||
static const int menuTextSize = 24;
|
||||
|
||||
static const uint32_t bgLayer = 0x18;
|
||||
static const uint32_t contentLayer = 0x19; // same as startup screen
|
||||
|
||||
static bool showUI;
|
||||
static unsigned int menuPos;
|
||||
static unsigned int mainMenuPos; // syncs to menuPos when menuSet == menuset_main (used for restoring on back)
|
||||
static unsigned int menuSet;
|
||||
|
||||
/*
|
||||
int triangleAet;
|
||||
int squareAet;
|
||||
int crossAet;
|
||||
int circleAet;
|
||||
*/
|
||||
|
||||
static std::chrono::time_point<std::chrono::high_resolution_clock> menuItemSelectTime;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user