summaryrefslogtreecommitdiff
path: root/mm/2s2h/Rando/ActorBehavior/EnSi.cpp
diff options
context:
space:
mode:
authorGarrett Cox <garrettjcox@gmail.com>2024-10-25 08:25:21 -0500
committerGarrett Cox <garrettjcox@gmail.com>2024-10-25 09:25:35 -0500
commit89e3bcac8ec64066a9cc7b042a46b7724fbe92fe (patch)
treeef40b0a65d41006c4d3fba592620e840189598bc /mm/2s2h/Rando/ActorBehavior/EnSi.cpp
parentf7dde41c6da8a35cfd9fefc9fc0f4239dee1031e (diff)
COND_HOOK macros
Diffstat (limited to 'mm/2s2h/Rando/ActorBehavior/EnSi.cpp')
-rw-r--r--mm/2s2h/Rando/ActorBehavior/EnSi.cpp49
1 files changed, 18 insertions, 31 deletions
diff --git a/mm/2s2h/Rando/ActorBehavior/EnSi.cpp b/mm/2s2h/Rando/ActorBehavior/EnSi.cpp
index c045b29fc..7e2f5dbb0 100644
--- a/mm/2s2h/Rando/ActorBehavior/EnSi.cpp
+++ b/mm/2s2h/Rando/ActorBehavior/EnSi.cpp
@@ -23,43 +23,30 @@ void EnSi_DrawCustom(Actor* thisx, PlayState* play) {
}
void Rando::ActorBehavior::InitEnSiBehavior() {
- static uint32_t onActorInitHookId = 0;
- static uint32_t shouldHookId = 0;
- GameInteractor::Instance->UnregisterGameHookForID<GameInteractor::OnActorInit>(onActorInitHookId);
- GameInteractor::Instance->UnregisterGameHookForID<GameInteractor::ShouldVanillaBehavior>(shouldHookId);
+ COND_ID_HOOK(OnActorInit, ACTOR_EN_SI, IS_RANDO, [](Actor* actor) {
+ EnSi* enSi = (EnSi*)actor;
- onActorInitHookId = 0;
- shouldHookId = 0;
-
- if (!IS_RANDO) {
- return;
- }
-
- onActorInitHookId =
- GameInteractor::Instance->RegisterGameHookForID<GameInteractor::OnActorInit>(ACTOR_EN_SI, [](Actor* actor) {
- EnSi* enSi = (EnSi*)actor;
-
- auto randoStaticCheck = Rando::StaticData::GetCheckFromFlag(
- FLAG_CYCL_SCENE_CHEST, ENSI_GET_CHEST_FLAG(&enSi->actor), gPlayState->sceneId);
- if (randoStaticCheck.randoCheckId == RC_UNKNOWN) {
- return;
- }
+ auto randoStaticCheck = Rando::StaticData::GetCheckFromFlag(
+ FLAG_CYCL_SCENE_CHEST, ENSI_GET_CHEST_FLAG(&enSi->actor), gPlayState->sceneId);
+ if (randoStaticCheck.randoCheckId == RC_UNKNOWN) {
+ return;
+ }
- auto randoSaveCheck = RANDO_SAVE_CHECKS[randoStaticCheck.randoCheckId];
+ auto randoSaveCheck = RANDO_SAVE_CHECKS[randoStaticCheck.randoCheckId];
- if (!randoSaveCheck.shuffled) {
- return;
- }
+ if (!randoSaveCheck.shuffled) {
+ return;
+ }
- if (randoSaveCheck.eligible) {
- Actor_Kill(&enSi->actor);
- return;
- }
+ if (randoSaveCheck.eligible) {
+ Actor_Kill(&enSi->actor);
+ return;
+ }
- actor->draw = EnSi_DrawCustom;
- });
+ actor->draw = EnSi_DrawCustom;
+ });
- shouldHookId = REGISTER_VB_SHOULD(VB_GIVE_ITEM_FROM_SI, {
+ COND_VB_SHOULD(VB_GIVE_ITEM_FROM_SI, IS_RANDO, {
EnSi* enSi = va_arg(args, EnSi*);
auto randoStaticCheck = Rando::StaticData::GetCheckFromFlag(