diff options
| author | mckinlee <mckinlee@ymail.com> | 2026-01-05 20:52:39 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-05 20:52:39 -0500 |
| commit | 2b139c215f478ef5deca007dfa6f9b6052db3d1d (patch) | |
| tree | fe84164b375f7bdb9ede52359efb1d1b3060100d /mm/2s2h/Rando/ConvertItem.cpp | |
| parent | 51209378530531e237893ef78cda16f5b6a4b186 (diff) | |
[Rando] Clock Shuffle + Logic (#1275)
* Add Clocks as Items feature
* refactor
* some clean up
* forgot to clangify
* use proper randoinf flags and some fixes
* proper skipsotcutscene fix
* Animated Clock Item (Thank you Caladius!)
* Close attempt at animating the clock, not perfect but a good start.
* Git gud Clock
* fix clock item get crash
Co-Authored-By: Caladius <Caladius@users.noreply.github.com>
* some enhancements
* logic refactor, minor changes, and new enhancements
* huge rework
* clang
* fix a oops; any day, not current day
* housekeeping and starting items menu support
* splits up some milkroad regions and fixes a audio bug
* i suck at merging
* feedback update
* scarecrow dance fix
* add clocks to new item tracker
* day 2 bean patches
* add time logic to enemy drops and simplify day 2 bean macro
* rebrand to "Shuffle Time"
* more eblo feedback
* some more feedback
* rename feedback
* pauseSaveEntrance fix
* fix take 2
* Time Shuffle cleanup
Fix pause save Time Shuffle bug
Fix event queue daytelop bug
Finish merge commit header include
Clean up with shouldRegister
Co-authored-by: mckinlee <mckinlee@ymail.com>
---------
Co-authored-by: Caladius <Caladius@users.noreply.github.com>
Co-authored-by: Eblo <7004497+Eblo@users.noreply.github.com>
Diffstat (limited to 'mm/2s2h/Rando/ConvertItem.cpp')
| -rw-r--r-- | mm/2s2h/Rando/ConvertItem.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mm/2s2h/Rando/ConvertItem.cpp b/mm/2s2h/Rando/ConvertItem.cpp index 26ba83a94..46bc5f214 100644 --- a/mm/2s2h/Rando/ConvertItem.cpp +++ b/mm/2s2h/Rando/ConvertItem.cpp @@ -1,4 +1,5 @@ #include "Rando/Rando.h" +#include "Rando/MiscBehavior/ClockShuffle.h" #include "2s2h/ShipUtils.h" #include <cassert> @@ -427,6 +428,16 @@ bool Rando::IsItemObtainable(RandoItemId randoItemId, RandoCheckId randoCheckId) case RI_SOUL_ODOLWA: case RI_SOUL_TWINMOLD: return !Flags_GetRandoInf(RANDO_INF_OBTAINED_SOUL_OF_GOHT + (randoItemId - RI_SOUL_GOHT)); + case RI_TIME_DAY_1: + case RI_TIME_NIGHT_1: + case RI_TIME_DAY_2: + case RI_TIME_NIGHT_2: + case RI_TIME_DAY_3: + case RI_TIME_NIGHT_3: + return !Flags_GetRandoInf(RANDO_INF_OBTAINED_CLOCK_DAY_1 + + Rando::ClockItems::GetHalfDayIndexFromClockItem(randoItemId)); + case RI_TIME_PROGRESSIVE: + return true; // These items are technically fine to receive again because they don't do anything, but we'll convert them to // ensure it's clear to the player something didn't go wrong. We just simply check the inventory state // Masks @@ -471,6 +482,31 @@ bool Rando::IsItemObtainable(RandoItemId randoItemId, RandoCheckId randoCheckId) RandoItemId Rando::ConvertItem(RandoItemId randoItemId, RandoCheckId randoCheckId) { if (IsItemObtainable(randoItemId, randoCheckId)) { switch (randoItemId) { + case RI_TIME_PROGRESSIVE: { + // Choose the next clock according to mode and current owned half-days + int mode = RANDO_SAVE_OPTIONS[RO_CLOCK_SHUFFLE_PROGRESSIVE]; + + if (mode == RO_CLOCK_SHUFFLE_RANDOM) { + // Random mode should never have progressive items + return RI_JUNK; + } + + // Build list in target order + RandoItemId ascending[] = { RI_TIME_DAY_1, RI_TIME_NIGHT_1, RI_TIME_DAY_2, + RI_TIME_NIGHT_2, RI_TIME_DAY_3, RI_TIME_NIGHT_3 }; + RandoItemId descending[] = { RI_TIME_NIGHT_3, RI_TIME_DAY_3, RI_TIME_NIGHT_2, + RI_TIME_DAY_2, RI_TIME_NIGHT_1, RI_TIME_DAY_1 }; + RandoItemId* order = (mode == RO_CLOCK_SHUFFLE_DESCENDING) ? descending : ascending; + for (int i = 0; i < 6; ++i) { + int halfIndex = Rando::ClockItems::GetHalfDayIndexFromClockItem(order[i]); + if (halfIndex >= 0 && + !Flags_GetRandoInf(static_cast<RandoInf>(RANDO_INF_OBTAINED_CLOCK_DAY_1 + halfIndex))) { + return order[i]; + } + } + // All owned; degrade to junk + return RI_JUNK; + } case RI_PROGRESSIVE_BOMB_BAG: if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { return RI_BOMB_BAG_20; |
