Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add faster rupee accumulator #4490

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions soh/soh/Enhancements/TimeSavers/FasterRupeeAccumulator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/OTRGlobals.h"
#include "spdlog/spdlog.h"

extern "C" {
#include "z64save.h"
#include "macros.h"
#include "variables.h"
#include "functions.h"
extern PlayState* gPlayState;
extern SaveContext gSaveContext;
}

void FasterRupeeAccumulator_Register() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnInterfaceUpdate>([]() {
if (!CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.FasterRupeeAccumulator"), 0)) return;

if (gSaveContext.rupeeAccumulator == 0) {
return;
}

// Gaining rupees
if (gSaveContext.rupeeAccumulator > 0) {
// Wallet is full
if (gSaveContext.rupees >= CUR_CAPACITY(UPG_WALLET)) {
return;
}

if (gSaveContext.rupeeAccumulator >= 10 && gSaveContext.rupees + 10 < CUR_CAPACITY(UPG_WALLET)) {
gSaveContext.rupeeAccumulator-= 10;
gSaveContext.rupees += 10;
}
// Losing rupees
} else if (gSaveContext.rupeeAccumulator < 0) {
// No rupees to lose
if (gSaveContext.rupees == 0) {
return;
}

if (gSaveContext.rupeeAccumulator <= -10 && gSaveContext.rupees > 10) {
gSaveContext.rupeeAccumulator += 10;
gSaveContext.rupees -= 10;
}
}
});
}
1 change: 1 addition & 0 deletions soh/soh/Enhancements/TimeSavers/TimeSavers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ void TimeSavers_Register() {
// SkipMiscInteractions
MoveMidoInKokiriForest_Register();
FasterHeavyBlockLift_Register();
FasterRupeeAccumulator_Register();
}
1 change: 1 addition & 0 deletions soh/soh/Enhancements/TimeSavers/TimeSavers.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ void TimeSavers_Register();
// SkipMiscInteractions
void MoveMidoInKokiriForest_Register();
void FasterHeavyBlockLift_Register();
void FasterRupeeAccumulator_Register();

#endif // TIME_SAVERS_H
1 change: 1 addition & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ void DrawEnhancementsMenu() {
UIWidgets::PaddedEnhancementSliderInt("Crawl speed %dx", "##CRAWLSPEED", CVAR_ENHANCEMENT("CrawlSpeed"), 1, 4, "", 1, true, false, true);
UIWidgets::PaddedEnhancementCheckbox("Faster Heavy Block Lift", CVAR_ENHANCEMENT("FasterHeavyBlockLift"), false, false);
UIWidgets::Tooltip("Speeds up lifting silver rocks and obelisks");
UIWidgets::PaddedEnhancementCheckbox("Faster Rupee Accumulator", CVAR_ENHANCEMENT("TimeSavers.FasterRupeeAccumulator"), false, false);
UIWidgets::PaddedEnhancementCheckbox("Skip Pickup Messages", CVAR_ENHANCEMENT("FastDrops"), true, false);
UIWidgets::Tooltip("Skip pickup messages for new consumable items and bottle swipes");
UIWidgets::PaddedEnhancementCheckbox("Fast Ocarina Playback", CVAR_ENHANCEMENT("FastOcarinaPlayback"), true, false);
Expand Down
Loading