mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
[Enhancement] Preseve time speed during cycle reset (#658)
* preseve time speed during cycle reset enhancement * clang format * update variable assignment Co-authored-by: Archez <Archez@users.noreply.github.com> * add default value * better initial value --------- Co-authored-by: Archez <Archez@users.noreply.github.com>
This commit is contained in:
@@ -465,6 +465,10 @@ void DrawEnhancementsMenu() {
|
||||
{ .tooltip = "Playing the Song Of Time will not reset the Sword back to Kokiri Sword." });
|
||||
UIWidgets::CVarCheckbox("Do not reset Rupees", "gEnhancements.Cycle.DoNotResetRupees",
|
||||
{ .tooltip = "Playing the Song Of Time will not reset the your rupees." });
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Do not reset Time Speed", "gEnhancements.Cycle.DoNotResetTimeSpeed",
|
||||
{ .tooltip =
|
||||
"Playing the Song Of Time will not reset the current time speed set by Inverted Song of Time." });
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(255, 255, 0, 255));
|
||||
ImGui::SeparatorText("Unstable");
|
||||
|
||||
@@ -7,10 +7,13 @@ extern "C" {
|
||||
}
|
||||
|
||||
SaveInfo saveInfoCopy;
|
||||
s32 timeSpeedOffsetCopy = 0;
|
||||
|
||||
void RegisterEndOfCycleSaveHooks() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::BeforeEndOfCycleSave>(
|
||||
[]() { memcpy(&saveInfoCopy, &gSaveContext.save.saveInfo, sizeof(SaveInfo)); });
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::BeforeEndOfCycleSave>([]() {
|
||||
memcpy(&saveInfoCopy, &gSaveContext.save.saveInfo, sizeof(SaveInfo));
|
||||
timeSpeedOffsetCopy = gSaveContext.save.timeSpeedOffset;
|
||||
});
|
||||
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::AfterEndOfCycleSave>([]() {
|
||||
if (CVarGetInteger("gEnhancements.Cycle.DoNotResetRupees", 0)) {
|
||||
@@ -77,5 +80,9 @@ void RegisterEndOfCycleSaveHooks() {
|
||||
SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_RAZOR);
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_RAZOR;
|
||||
}
|
||||
|
||||
if (CVarGetInteger("gEnhancements.Cycle.DoNotResetTimeSpeed", 0)) {
|
||||
gSaveContext.save.timeSpeedOffset = timeSpeedOffsetCopy;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user