diff options
| author | Jordan Longstaff <JordanLongstaff@users.noreply.github.com> | 2025-12-09 10:46:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-09 12:46:54 -0300 |
| commit | f75a5e1d2b63e1e89ae4f76bf5db95b666271c5b (patch) | |
| tree | f465eb90485d168b39c785465e9c3d1e66e69adc /src | |
| parent | 311cdd9db0cfff10c2e8bb3ba1429ffab5232ac2 (diff) | |
Document `func_808B849C` (#1841)
* Document `func_808B849C`
* Clarify doc about number returned
Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
* Add number comparisons
* Try arithmetic in remains function
* Reverse addition operation - will it break matching?
---------
Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index f5e98e9f9..167358e11 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -70,19 +70,27 @@ void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) { this->actionFunc = actionFunc; } -s32 func_808B849C(DoorWarp1* this, PlayState* play) { - s32 ret = 0; +/** + * Returns a number representing which remains was obtained inside this warp. + * * 0: None (if it's not a boss or the remains were already obtained) + * * 1: Odolwa + * * 2: Goht + * * 3: Gyorg + * * 4: Twinmold + */ +s32 DoorWarp1_GetRemains(DoorWarp1* this, PlayState* play) { + s32 remains = 0; if ((play->sceneId == SCENE_MITURIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA)) { - ret = 1; + remains = 1 + GI_REMAINS_ODOLWA - GI_REMAINS_ODOLWA; } else if ((play->sceneId == SCENE_HAKUGIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { - ret = 2; + remains = 1 + GI_REMAINS_GOHT - GI_REMAINS_ODOLWA; } else if ((play->sceneId == SCENE_SEA_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { - ret = 3; + remains = 1 + GI_REMAINS_GYORG - GI_REMAINS_ODOLWA; } else if ((play->sceneId == SCENE_INISIE_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { - ret = 4; + remains = 1 + GI_REMAINS_TWINMOLD - GI_REMAINS_ODOLWA; } - return ret; + return remains; } void func_808B8568(DoorWarp1* this, PlayState* play) { @@ -502,10 +510,11 @@ void func_808B98A8(DoorWarp1* this, PlayState* play) { void func_808B9B30(DoorWarp1* this, PlayState* play) { if (fabsf(this->dyna.actor.xzDistToPlayer) >= 60.0f) { - if (func_808B849C(this, play)) { - this->unk_1A0 = (DmHina*)Actor_SpawnAsChild( - &play->actorCtx, &this->dyna.actor, play, ACTOR_DM_HINA, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, func_808B849C(this, play) - 1); + if (DoorWarp1_GetRemains(this, play) != 0) { + this->unk_1A0 = (DmHina*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_DM_HINA, + this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, + this->dyna.actor.world.pos.z, 0, 0, 0, + DoorWarp1_GetRemains(this, play) - 1); } DoorWarp1_SetupAction(this, func_808B9BE8); } @@ -529,7 +538,7 @@ void func_808B9BE8(DoorWarp1* this, PlayState* play) { } this->dyna.actor.parent = NULL; - if (func_808B849C(this, play)) { + if (DoorWarp1_GetRemains(this, play) != 0) { this->unk_202 = 1; DoorWarp1_SetupAction(this, func_808B9CE8); } else { @@ -544,7 +553,8 @@ void func_808B9CE8(DoorWarp1* this, PlayState* play) { } if (!Actor_HasParent(&this->dyna.actor, play)) { - Actor_OfferGetItem(&this->dyna.actor, play, (GI_REMAINS_ODOLWA - 1) + func_808B849C(this, play), 30.0f, 80.0f); + Actor_OfferGetItem(&this->dyna.actor, play, DoorWarp1_GetRemains(this, play) + (GI_REMAINS_ODOLWA - 1), 30.0f, + 80.0f); return; } @@ -575,7 +585,7 @@ void func_808B9CE8(DoorWarp1* this, PlayState* play) { gSaveContext.save.saveInfo.unk_EA8[1] = (gSaveContext.save.saveInfo.unk_EA8[1] & 0xFFFFFF00) | ((((u8)gSaveContext.save.saveInfo.unk_EA8[1]) + 1) & 0xFF); - Item_Give(play, func_808B849C(this, play) + (ITEM_REMAINS_ODOLWA - 1)); + Item_Give(play, DoorWarp1_GetRemains(this, play) + (ITEM_REMAINS_ODOLWA - 1)); DoorWarp1_SetupAction(this, func_808B9E94); } |
