diff options
| author | robojumper <robojumper@gmail.com> | 2024-05-02 13:48:08 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2024-05-04 19:57:17 +0200 |
| commit | cf42625664a8bed75f0ab65307a355ad07f37e32 (patch) | |
| tree | 14a64e917d5c12961ee7f1db863a3127511dcd56 /src/toBeSorted/counters/rupee_counter.cpp | |
| parent | 1ecdfe9a4dfdd429c04424d77a9c0e6c148832a1 (diff) | |
Match the single-counter TUs
Diffstat (limited to 'src/toBeSorted/counters/rupee_counter.cpp')
| -rw-r--r-- | src/toBeSorted/counters/rupee_counter.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/toBeSorted/counters/rupee_counter.cpp b/src/toBeSorted/counters/rupee_counter.cpp new file mode 100644 index 00000000..d8b4920c --- /dev/null +++ b/src/toBeSorted/counters/rupee_counter.cpp @@ -0,0 +1,52 @@ +#include <toBeSorted/counters/counter.h> + +class RupeeCounter : public Counter { +public: + RupeeCounter(); + /* 8016DEF0 */ ~RupeeCounter() {} + virtual u16 getMax() override; +}; + +struct WalletStruct { + u32 flag; + u16 capacity; +}; + +/* 804E91B0 */ +const struct WalletStruct wallet_definitions[4] = { + {0x6c, 500}, + {0x6d, 1000}, + {0x6e, 5000}, + {0x6f, 9000}, +}; + +// TODO set up item flag manager +extern "C" void *lbl_80575400; +extern "C" u16 fn_800BF5E0(void *data, u16 flag); + +/* 8016DE10 */ u16 getBaseCapacity() { + int i = 0; + WalletStruct tmp[4] = {wallet_definitions[0], wallet_definitions[1], wallet_definitions[2], wallet_definitions[3]}; + const WalletStruct *wallet = &tmp[3]; + for (; i < 4; i++, wallet--) { + if (fn_800BF5E0(lbl_80575400, wallet->flag)) { + return wallet->capacity; + } + } + return 300; +} + +// TODO main counters class +extern "C" u16 fn_8016D730(u16); + +/* 8016DEC0 */ u16 getExtraWalletCapacity() { + return 300 * fn_8016D730(0x27); +} + +/* 80575610 */ RupeeCounter lbl_80575610; + +/* 8016DF30 */ RupeeCounter::RupeeCounter() : Counter(0x1f5) {} + +/* 8016DF50 */ u16 RupeeCounter::getMax() { + return (getBaseCapacity() + getExtraWalletCapacity()); +} |
