mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 23:10:14 -05:00
Add faster rupee accumulator (#4490)
This commit is contained in:
parent
1df91890fe
commit
2c08fca46c
47
soh/soh/Enhancements/TimeSavers/FasterRupeeAccumulator.cpp
Normal file
47
soh/soh/Enhancements/TimeSavers/FasterRupeeAccumulator.cpp
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
@ -12,4 +12,5 @@ void TimeSavers_Register() {
|
||||
// SkipMiscInteractions
|
||||
MoveMidoInKokiriForest_Register();
|
||||
FasterHeavyBlockLift_Register();
|
||||
FasterRupeeAccumulator_Register();
|
||||
}
|
||||
|
@ -14,5 +14,6 @@ void TimeSavers_Register();
|
||||
// SkipMiscInteractions
|
||||
void MoveMidoInKokiriForest_Register();
|
||||
void FasterHeavyBlockLift_Register();
|
||||
void FasterRupeeAccumulator_Register();
|
||||
|
||||
#endif // TIME_SAVERS_H
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user