pause: fix restart scoring, improve navigation implementation
This commit is contained in:
@@ -28,7 +28,7 @@ namespace TLAC::Components
|
||||
int Pause::crossAet = 0;
|
||||
int Pause::circleAet = 0;
|
||||
int Pause::curMenuPos = 0;
|
||||
int Pause::mainMenuPos = 0;
|
||||
std::vector<std::pair<Pause::menusets, int>> Pause::menuHistory;
|
||||
Pause::menusets Pause::curMenuSet = MENUSET_MAIN;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> Pause::menuItemMoveTime;
|
||||
std::vector<uint8_t> Pause::origAetMovOp;
|
||||
@@ -60,7 +60,7 @@ namespace TLAC::Components
|
||||
"SE VOLUME",
|
||||
{
|
||||
{ "+", sevolplus, true },
|
||||
{ "XX", mainmenu, false },
|
||||
{ "XX", menuback, false },
|
||||
{ "-", sevolminus, true },
|
||||
}
|
||||
},
|
||||
@@ -148,6 +148,7 @@ namespace TLAC::Components
|
||||
filteredButtons = allButtons;
|
||||
|
||||
setMenuPos(MENUSET_MAIN, 0);
|
||||
menuHistory.resize(0);
|
||||
showUI = true;
|
||||
isPaused = true;
|
||||
}
|
||||
@@ -210,7 +211,7 @@ namespace TLAC::Components
|
||||
}
|
||||
else
|
||||
{
|
||||
setMenuPos(MENUSET_MAIN, mainMenuPos);
|
||||
menuback();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,7 +554,7 @@ namespace TLAC::Components
|
||||
aetLoc.x = dtParams.textCurrentLoc.x + halfSpriteSize;
|
||||
crossAet = Drawing::createAetLayer(3, dtParams.layer, Drawing::CREATEAET_20000, "button_batsu", aetLoc, 0, nullptr, nullptr, 0, 0, aetScale, nullptr);
|
||||
dtParams.textCurrentLoc.x += spriteSize;
|
||||
if (curMenuSet == MENUSET_MAIN)
|
||||
if (menuHistory.size() == 0)
|
||||
Drawing::drawTextW(&dtParams, (Drawing::drawTextFlags)(Drawing::DRAWTEXT_ENABLE_XADVANCE), L":Close ");
|
||||
else
|
||||
Drawing::drawTextW(&dtParams, (Drawing::drawTextFlags)(Drawing::DRAWTEXT_ENABLE_XADVANCE), L":Back ");
|
||||
@@ -608,12 +609,19 @@ namespace TLAC::Components
|
||||
playerData->act_slide_vol = playerData->act_vol;
|
||||
}
|
||||
|
||||
void Pause::setMenuPos(menusets set, int pos)
|
||||
void Pause::setMenuPos(menusets set, int pos, bool updateHistory)
|
||||
{
|
||||
menusets newMenuSet;
|
||||
|
||||
if (set >= 0 && set < menu.size())
|
||||
curMenuSet = set;
|
||||
newMenuSet = set;
|
||||
else
|
||||
curMenuSet = MENUSET_MAIN;
|
||||
newMenuSet = MENUSET_MAIN;
|
||||
|
||||
if (updateHistory && newMenuSet != curMenuSet)
|
||||
menuHistory.push_back(std::pair<menusets, int>(curMenuSet, curMenuPos));
|
||||
|
||||
curMenuSet = newMenuSet;
|
||||
|
||||
if (pos < 0)
|
||||
pos = menu[curMenuSet].items.size() - 1;
|
||||
@@ -622,9 +630,6 @@ namespace TLAC::Components
|
||||
|
||||
curMenuPos = pos;
|
||||
|
||||
if (curMenuSet == MENUSET_MAIN)
|
||||
mainMenuPos = curMenuPos;
|
||||
|
||||
menuItemMoveTime = std::chrono::high_resolution_clock::now(); // restart animations
|
||||
}
|
||||
|
||||
|
||||
@@ -114,14 +114,30 @@ namespace TLAC::Components
|
||||
};
|
||||
|
||||
static int curMenuPos;
|
||||
static int mainMenuPos; // syncs to curMenuPos when curMenuSet == MENUSET_MAIN (used for restoring on back)
|
||||
static std::vector<std::pair<menusets, int>> menuHistory; // used for implementing back button in menus
|
||||
static menusets curMenuSet;
|
||||
|
||||
static std::chrono::time_point<std::chrono::high_resolution_clock> menuItemMoveTime; // used for animation
|
||||
|
||||
static void mainmenu() { setMenuPos(MENUSET_MAIN, mainMenuPos); };
|
||||
// static void mainmenu() { setMenuPos(MENUSET_MAIN, 0); menuHistory.resize(0); };
|
||||
static void menuback()
|
||||
{
|
||||
if (menuHistory.size() == 0)
|
||||
{
|
||||
// mainmenu();
|
||||
unpause();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::pair<menusets, int> menuPos = menuHistory.back();
|
||||
menuHistory.pop_back();
|
||||
|
||||
setMenuPos(menuPos.first, menuPos.second, false);
|
||||
}
|
||||
}
|
||||
static void unpause() { pause = false; };
|
||||
static void restart() {
|
||||
static void restart()
|
||||
{
|
||||
/*
|
||||
140d0b510+2 = 0, 140d0b510+14 = 8 for restart
|
||||
|
||||
@@ -146,6 +162,11 @@ namespace TLAC::Components
|
||||
|
||||
percentage doesn't fully reset by the looks of it????
|
||||
rip
|
||||
(actually was hold and slide scores -- fixed by manually clearing them now)
|
||||
|
||||
TODO:
|
||||
check holds count towards percentage after restart if 5% limit was reached
|
||||
reset not clear flag in protected mode
|
||||
*/
|
||||
|
||||
// inject flow overrides to switch cases in FUN_1400fddc0
|
||||
@@ -162,6 +183,11 @@ namespace TLAC::Components
|
||||
doLoading(0x140cdd8d0);
|
||||
}
|
||||
|
||||
// for some reason the above doesn't reset all scoring stuff
|
||||
*(int*)0x140D0A9BC = 0; // total holds
|
||||
*(int*)0x140D0A9B8 = 0; // hold + multi
|
||||
*(int*)0x140D0A9C0 = 0; // slide
|
||||
|
||||
// revert patches and unpause
|
||||
InjectCode((void*)0x1401038cd, { 0x12 }); InjectCode((void*)0x140103b94, { 0x16 });
|
||||
unpause();
|
||||
@@ -175,7 +201,7 @@ namespace TLAC::Components
|
||||
// contents are in Pause.cpp because they can't be inline here for a static (const) array/vec
|
||||
static std::vector<menuSet> menu;
|
||||
|
||||
static void setMenuPos(menusets set, int pos);
|
||||
static void setMenuPos(menusets set, int pos, bool updateHistory = true);
|
||||
|
||||
static float getMenuAnimPos();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user