-
Notifications
You must be signed in to change notification settings - Fork 631
Adds a new Hook for adding locations to pools #5945
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
base: develop
Are you sure you want to change the base?
Changes from all commits
e6afc35
011039d
c127d54
d7091ac
7bff1e7
d9c40e7
527bd7c
b8755c5
722c7f2
e62dec5
95fa2f2
38bab99
7e82f9c
2c5d08c
cb83798
e0036bd
109a7f0
53eafc8
6b81d23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -279,6 +279,38 @@ void ObjKibako_RandomizerInit(void* actorRef) { | |
| } | ||
|
|
||
| void RegisterShuffleCrates() { | ||
| SHOULD_SHUFFLE_LOCATION({ | ||
| if (location->GetRCType() == RCTYPE_CRATE || location->GetRCType() == RCTYPE_SMALL_CRATE) { | ||
| if (RAND_GET_OPTION(RSK_SHUFFLE_CRATES) == RO_SHUFFLE_CRATES_OFF) { | ||
| *should = false; | ||
| } else if (ctx->GetOption(RSK_SHUFFLE_CRATES).Is(RO_SHUFFLE_CRATES_ALL)) { | ||
| *should = true; | ||
| } else { | ||
| if (location->IsOverworld()) { | ||
| *should = RAND_GET_OPTION(RSK_SHUFFLE_CRATES) == RO_SHUFFLE_CRATES_OVERWORLD; | ||
| } else { | ||
| *should = RAND_GET_OPTION(RSK_SHUFFLE_CRATES) == RO_SHUFFLE_CRATES_DUNGEONS; | ||
| } | ||
| } | ||
| } else if (location->GetRCType() == RCTYPE_NLCRATE) { | ||
| if (RAND_GET_OPTION(RSK_LOGIC_RULES) == RO_LOGIC_NO_LOGIC) { | ||
| if (RAND_GET_OPTION(RSK_SHUFFLE_CRATES) == RO_SHUFFLE_CRATES_OFF) { | ||
| *should = false; | ||
| } else if (ctx->GetOption(RSK_SHUFFLE_CRATES).Is(RO_SHUFFLE_CRATES_ALL)) { | ||
| *should = true; | ||
| } else { | ||
| if (location->IsOverworld()) { | ||
| *should = RAND_GET_OPTION(RSK_SHUFFLE_CRATES) == RO_SHUFFLE_CRATES_OVERWORLD; | ||
| } else { | ||
| *should = RAND_GET_OPTION(RSK_SHUFFLE_CRATES) == RO_SHUFFLE_CRATES_DUNGEONS; | ||
| } | ||
| } | ||
|
Comment on lines
+301
to
+307
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I appreciate why you didn't make this one long else-if chain, but the extra level of indentation still irks me ofc I'm degenerate enough to use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a few of the earlier ones I converted that I may go back and clean up a bit |
||
| } else { | ||
| *should = false; | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| bool shouldRegister = IS_RANDO && RAND_GET_OPTION(RSK_SHUFFLE_CRATES); | ||
|
|
||
| COND_ID_HOOK(OnActorInit, ACTOR_OBJ_KIBAKO2, shouldRegister, ObjKibako2_RandomizerInit); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #include "soh/Enhancements/game-interactor/GameInteractor.h" | ||
| #include "soh/Enhancements/randomizer/randomizerTypes.h" | ||
| #include "soh/OTRGlobals.h" | ||
| #include "soh/ShipInit.hpp" | ||
| void RegisterShuffleFrogs() { | ||
| SHOULD_SHUFFLE_LOCATION({ | ||
| if (location->GetRCType() == RCTYPE_FROG_SONG) { | ||
| if (RAND_GET_OPTION(RSK_SHUFFLE_FROG_SONG_RUPEES) == RO_GENERIC_OFF) { | ||
| *should = false; | ||
| } | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| static RegisterShipInitFunc registerShuffleFrogs(RegisterShuffleFrogs, { "IS_RANDO" }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #include "soh/Enhancements/game-interactor/GameInteractor.h" | ||
| #include "soh/Enhancements/randomizer/context.h" | ||
| #include "soh/OTRGlobals.h" | ||
| #include "soh/ShipInit.hpp" | ||
|
|
||
| // RANDOTODO: Convert remaining Shuffle Master Sword Changes to use | ||
| // hooks in this file. | ||
|
|
||
| void RegisterShuffleMasterSword() { | ||
| SHOULD_SHUFFLE_LOCATION({ | ||
| if (location->GetRandomizerCheck() == RC_TOT_MASTER_SWORD) { | ||
| if (RAND_GET_OPTION(RSK_SHUFFLE_MASTER_SWORD) == RO_GENERIC_OFF) { | ||
| *should = false; | ||
| } | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| static RegisterShipInitFunc registerShuffleMasterSword(RegisterShuffleMasterSword, { "IS_RANDO" }); |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||||
| #include "soh/Enhancements/game-interactor/GameInteractor.h" | ||||||||
| #include "soh/Enhancements/randomizer/context.h" | ||||||||
| #include "soh/Enhancements/randomizer/randomizerTypes.h" | ||||||||
| #include "soh/OTRGlobals.h" | ||||||||
| #include "soh/ShipInit.hpp" | ||||||||
|
|
||||||||
| // RANDOTODO: Convert the reset of Scrub Shuffle to be in this file and | ||||||||
| // use hooks appropriately | ||||||||
|
|
||||||||
| void RegisterShuffleScrubs() { | ||||||||
| SHOULD_SHUFFLE_LOCATION({ | ||||||||
| if (location->GetRCType() == RCTYPE_SCRUB) { | ||||||||
| switch (RAND_GET_OPTION(RSK_SHUFFLE_SCRUBS)) { | ||||||||
| case RO_SCRUBS_OFF: | ||||||||
| *should = false; | ||||||||
| break; | ||||||||
| case RO_SCRUBS_ONE_TIME_ONLY: | ||||||||
| switch (location->GetRandomizerCheck()) { | ||||||||
| case RC_LW_DEKU_SCRUB_GROTTO_FRONT: | ||||||||
| case RC_LW_DEKU_SCRUB_NEAR_BRIDGE: | ||||||||
| case RC_HF_DEKU_SCRUB_GROTTO: | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
need this no? I'm confused what not setting
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *should defaults to true, you only need to change it if it should be false. I did it that way on purpose so if you try to do a new shuffle, it's true and all the basic checks that we always shuffle don't need any hooks. Some of the ones I converted first set *should to a boolean expression, it's just that setting it to true is effectively "doing nothing" in those cases. These are what I meant when I said I might go back and clean some of those up a bit more. |
||||||||
| break; | ||||||||
| default: | ||||||||
| *should = false; | ||||||||
| break; | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
| }); | ||||||||
| } | ||||||||
|
|
||||||||
| static RegisterShipInitFunc registerShuffleScrubs(RegisterShuffleScrubs, { "IS_RANDO" }); | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include "soh/Enhancements/game-interactor/GameInteractor.h" | ||
| #include "soh/Enhancements/randomizer/context.h" | ||
| #include "soh/Enhancements/randomizer/randomizerTypes.h" | ||
| #include "soh/OTRGlobals.h" | ||
| #include "soh/ShipInit.hpp" | ||
|
|
||
| // RANDOTODO: Convert the rest of the skulltula reward handling | ||
| // to use hooks in this file. | ||
|
|
||
| void RegisterShuffleSkulltulaRewards() { | ||
| SHOULD_SHUFFLE_LOCATION({ | ||
| if (location->GetRandomizerCheck() == RC_KAK_100_GOLD_SKULLTULA_REWARD) { | ||
| if (RAND_GET_OPTION(RSK_SHUFFLE_100_GS_REWARD) == RO_GENERIC_OFF) { | ||
| *should = false; | ||
| } | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| static RegisterShipInitFunc registerShuffleSkulltulaRewards(RegisterShuffleSkulltulaRewards, { "IS_RANDO" }); |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surprised clang-format let this by
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it like that before, clang-format was the one that changed it.