From d3eedf6293da4bfff01f92721d0bea264c240c93 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 17:11:39 +0100 Subject: [PATCH 01/68] Document `func_8002F368` as `Player_GetExchangeItemId` --- include/z64actor.h | 2 +- src/code/z_actor.c | 2 +- src/overlays/actors/ovl_En_Ds/z_en_ds.c | 2 +- src/overlays/actors/ovl_En_Gb/z_en_gb.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 4 ++-- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 10 +++++----- src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c | 2 +- src/overlays/actors/ovl_En_Hs/z_en_hs.c | 2 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 4 ++-- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 2 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 6 +++--- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 2 +- src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 2 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 4 ++-- src/overlays/actors/ovl_En_Toryo/z_en_toryo.c | 2 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 2 +- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index 228de4bcd65..1efe4426e2a 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -837,7 +837,7 @@ s32 Actor_OfferTalkExchangeEquiCylinder(Actor* actor, struct PlayState* play, f3 s32 Actor_OfferTalk(Actor* actor, struct PlayState* play, f32 radius); s32 Actor_OfferTalkNearColChkInfoCylinder(Actor* actor, struct PlayState* play); u32 Actor_TextboxIsClosing(Actor* actor, struct PlayState* play); -s8 func_8002F368(struct PlayState* play); +s8 Player_GetExchangeItemId(struct PlayState* play); void Actor_GetScreenPos(struct PlayState* play, Actor* actor, s16* x, s16* y); u32 Actor_HasParent(Actor* actor, struct PlayState* play); s32 Actor_OfferGetItem(Actor* actor, struct PlayState* play, s32 getItemId, f32 xzRange, f32 yRange); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index e91ab50d844..faa1360779c 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1759,7 +1759,7 @@ u32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) { } } -s8 func_8002F368(PlayState* play) { +s8 Player_GetExchangeItemId(PlayState* play) { Player* player = GET_PLAYER(play); return player->exchangeItemId; diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index b3899ae0b87..996857a70af 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -206,7 +206,7 @@ void EnDs_Wait(EnDs* this, PlayState* play) { s16 yawDiff; if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (func_8002F368(play) == EXCH_ITEM_ODD_MUSHROOM) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_ODD_MUSHROOM) { Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); player->actor.textId = 0x504A; diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 40612e8646b..1ce70bd2a2a 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -284,7 +284,7 @@ void func_80A2F83C(EnGb* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->dyna.actor, play)) { s32 pad; - switch (func_8002F368(play)) { + switch (Player_GetExchangeItemId(play)) { case EXCH_ITEM_NONE: func_80A2F180(this); this->actionFunc = func_80A2F94C; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 78376c98134..3466010d153 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -597,7 +597,7 @@ void func_80A3F908(EnGo* this, PlayState* play) { if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) && (dialogStarted == true)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_BROKEN_GORONS_SWORD) { - if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { if (GET_INFTABLE(INFTABLE_B4)) { this->actor.textId = 0x3055; } else { @@ -610,7 +610,7 @@ void func_80A3F908(EnGo* this, PlayState* play) { } if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { - if (func_8002F368(play) == EXCH_ITEM_EYE_DROPS) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_EYE_DROPS) { this->actor.textId = 0x3059; } else { this->actor.textId = 0x3058; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 397c9e7cc9b..c500368dd72 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -591,7 +591,7 @@ s16 EnGo2_UpdateTalkStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { case TEXT_STATE_DONE_FADING: switch (this->actor.textId) { case 0x305E: - if (func_8002F368(play) != EXCH_ITEM_CLAIM_CHECK) { + if (Player_GetExchangeItemId(play) != EXCH_ITEM_CLAIM_CHECK) { break; } FALLTHROUGH; @@ -1025,7 +1025,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { if (gSaveContext.save.info.playerData.bgsFlag) { - if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_CLAIM_CHECK) { this->actor.textId = 0x3003; } else { this->actor.textId = 0x305E; @@ -1033,7 +1033,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { player->actor.textId = this->actor.textId; } else if (!gSaveContext.save.info.playerData.bgsFlag && (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK)) { - if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_CLAIM_CHECK) { if (Environment_GetBgsDayCount() >= 3) { textId = 0x305E; } else { @@ -1052,7 +1052,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { } else if ((INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_PRESCRIPTION) && (INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_CLAIM_CHECK)) { - if (func_8002F368(play) == EXCH_ITEM_EYE_DROPS) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_EYE_DROPS) { this->actor.textId = 0x3059; } else { this->actor.textId = 0x3058; @@ -1063,7 +1063,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { player->actor.textId = this->actor.textId; } else if (INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_BROKEN_GORONS_SWORD) { - if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { if (GET_INFTABLE(INFTABLE_B4)) { textId = 0x3055; } else { diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index b1ee0997219..dec4c808896 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -402,7 +402,7 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { this->unk_300 = TEXT_STATE_DONE; if (Actor_TalkOfferAccepted(&this->actor, play)) { - s32 exchangeItemId = func_8002F368(play); + s32 exchangeItemId = Player_GetExchangeItemId(play); if (exchangeItemId == EXCH_ITEM_ZELDAS_LETTER) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index b5c521da2da..ea2e4e65bea 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -206,7 +206,7 @@ void func_80A6E9AC(EnHs* this, PlayState* play) { s16 yawDiff; if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (func_8002F368(play) == EXCH_ITEM_COJIRO) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_COJIRO) { player->actor.textId = 0x10B2; func_80A6E3A0(this, func_80A6E8CC); Animation_Change(&this->skelAnime, &object_hs_Anim_000304, 1.0f, 0.0f, diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 9ac751d4e7f..839916e56e8 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -957,7 +957,7 @@ void EnHy_OfferBuyBottledItem(EnHy* this, PlayState* play) { if (ENHY_GET_TYPE(&this->actor) == ENHY_TYPE_BEGGAR) { if (!Inventory_HasSpecificBottle(ITEM_BOTTLE_BLUE_FIRE) && !Inventory_HasSpecificBottle(ITEM_BOTTLE_BUG) && !Inventory_HasSpecificBottle(ITEM_BOTTLE_FISH)) { - switch (func_8002F368(play)) { + switch (Player_GetExchangeItemId(play)) { case EXCH_ITEM_BOTTLE_POE: case EXCH_ITEM_BOTTLE_BIG_POE: case EXCH_ITEM_BOTTLE_RUTOS_LETTER: @@ -971,7 +971,7 @@ void EnHy_OfferBuyBottledItem(EnHy* this, PlayState* play) { break; } } else { - switch (func_8002F368(play)) { + switch (Player_GetExchangeItemId(play)) { case EXCH_ITEM_BOTTLE_BLUE_FIRE: this->actor.textId = 0x70F0; break; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 2fb0b859772..34d8b1a6193 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -980,7 +980,7 @@ void func_80A9877C(EnKo* this, PlayState* play) { ENKO_TYPE == ENKO_TYPE_CHILD_FADO && play->sceneId == SCENE_LOST_WOODS) { this->actor.textId = INV_CONTENT(ITEM_TRADE_ADULT) > ITEM_ODD_POTION ? 0x10B9 : 0x10DF; - if (func_8002F368(play) == EXCH_ITEM_ODD_POTION) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_ODD_POTION) { #if OOT_VERSION < NTSC_1_1 this->actor.textId = GET_INFTABLE(INFTABLE_B6) ? 0x10B8 : 0x10B7; #else diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 9160bc41b1a..3b52c5785dd 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -292,7 +292,7 @@ void func_80A9CB18(EnKz* this, PlayState* play) { if (EnKz_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, 340.0f, EnKz_GetTextId, EnKz_UpdateTalkState)) { if ((this->actor.textId == 0x401A) && !GET_EVENTCHKINF(EVENTCHKINF_33)) { - if (func_8002F368(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { this->actor.textId = 0x401B; this->sfxPlayed = false; } else { @@ -304,7 +304,7 @@ void func_80A9CB18(EnKz* this, PlayState* play) { if (LINK_IS_ADULT) { if ((INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) && - (func_8002F368(play) == EXCH_ITEM_PRESCRIPTION)) { + (Player_GetExchangeItemId(play) == EXCH_ITEM_PRESCRIPTION)) { this->actor.textId = 0x4014; this->sfxPlayed = false; player->actor.textId = this->actor.textId; @@ -494,7 +494,7 @@ void EnKz_SetupGetItem(EnKz* this, PlayState* play) { this->actionFunc = EnKz_StartTimer; } else { #if OOT_VERSION < PAL_1_0 - getItemId = func_8002F368(play) == EXCH_ITEM_PRESCRIPTION ? GI_EYEBALL_FROG : GI_TUNIC_ZORA; + getItemId = Player_GetExchangeItemId(play) == EXCH_ITEM_PRESCRIPTION ? GI_EYEBALL_FROG : GI_TUNIC_ZORA; #else getItemId = this->isTrading == true ? GI_EYEBALL_FROG : GI_TUNIC_ZORA; #endif diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index ab748fe164c..9d6d84deb1b 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -216,7 +216,7 @@ void EnMk_Wait(EnMk* this, PlayState* play) { s32 playerExchangeItem; if (Actor_TalkOfferAccepted(&this->actor, play)) { - playerExchangeItem = func_8002F368(play); + playerExchangeItem = Player_GetExchangeItemId(play); if (this->actor.textId != 0x4018) { player->actor.textId = this->actor.textId; diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index cf4411a1d50..1603e9f6e33 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -374,7 +374,7 @@ void func_80ABA878(EnNiwLady* this, PlayState* play) { this->unk_26E = 11; } if (Actor_TalkOfferAccepted(&this->actor, play)) { - s8 playerExchangeItemId = func_8002F368(play); + s8 playerExchangeItemId = Player_GetExchangeItemId(play); if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 6990af1ac83..4e09c1e2d6f 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -368,7 +368,7 @@ void EnTa_IdleAsleepInCastle(EnTa* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_TalkOfferAccepted(&this->actor, play)) { - s32 exchangeItemId = func_8002F368(play); + s32 exchangeItemId = Player_GetExchangeItemId(play); switch (exchangeItemId) { case EXCH_ITEM_CHICKEN: @@ -403,7 +403,7 @@ void EnTa_IdleAsleepInKakariko(EnTa* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_TalkOfferAccepted(&this->actor, play)) { - s32 exchangeItemId = func_8002F368(play); + s32 exchangeItemId = Player_GetExchangeItemId(play); switch (exchangeItemId) { case EXCH_ITEM_POCKET_CUCCO: diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index 4b27209fcae..e6008341ac4 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -318,7 +318,7 @@ void EnToryo_HandleTalking(EnToryo* this, PlayState* play) { if (this->messageState == 0) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->exchangeItemId = func_8002F368(play); + this->exchangeItemId = Player_GetExchangeItemId(play); if (this->exchangeItemId != EXCH_ITEM_NONE) { player->actor.textId = EnToryo_ReactToExchangeItem(this, play); this->actor.textId = player->actor.textId; diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index a9cded57483..4b95b92e217 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -537,7 +537,7 @@ void ObjBean_SetupWaitForBean(ObjBean* this) { void ObjBean_WaitForBean(ObjBean* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->dyna.actor, play)) { - if (func_8002F368(play) == EXCH_ITEM_MAGIC_BEAN) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_MAGIC_BEAN) { func_80B8FE00(this); Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } From f24906855f513571229a6e9704abd7776297fc52 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 01:51:11 +0100 Subject: [PATCH 02/68] Document Goron's limbs --- assets/xml/objects/object_oF1d_map.xml | 22 ++++++++++++++++++ src/overlays/actors/ovl_En_Go/z_en_go.c | 10 ++++----- src/overlays/actors/ovl_En_Go/z_en_go.h | 27 ++++++++++++++++++++--- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 12 +++++----- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 8 +++---- 5 files changed, 61 insertions(+), 18 deletions(-) diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index 09a35dbd1c2..b77bded15a5 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -1,4 +1,5 @@ + @@ -13,14 +14,35 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 3466010d153..77a8201ddc9 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1033,7 +1033,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) { if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc || this->actionFunc == func_80A40B1C) { - func_80034F54(play, this->jointTable, this->morphTable, 18); + func_80034F54(play, this->jointTable, this->morphTable, GORON_LIMB_MAX); } EnGo_UpdateShadow(this); @@ -1088,7 +1088,7 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Ve EnGo* this = (EnGo*)thisx; Vec3s limbRot; - if (limb == 17) { + if (limb == GORON_LIMB_HEAD) { Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); limbRot = this->interactInfo.headRot; Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); @@ -1096,13 +1096,13 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Ve Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); } - if (limb == 10) { + if (limb == GORON_LIMB_TORSO) { limbRot = this->interactInfo.torsoRot; Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } - if ((limb == 10) || (limb == 11) || (limb == 14)) { + if ((limb == GORON_LIMB_TORSO) || (limb == GORON_LIMB_LEFT_ARM) || (limb == GORON_LIMB_RIGHT_ARM)) { rot->y += Math_SinS(this->jointTable[limb]) * 200.0f; rot->z += Math_CosS(this->morphTable[limb]) * 200.0f; } @@ -1114,7 +1114,7 @@ void EnGo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnGo* this = (EnGo*)thisx; Vec3f D_80A41BCC = { 600.0f, 0.0f, 0.0f }; - if (limbIndex == 17) { + if (limbIndex == GORON_LIMB_HEAD) { Matrix_MultVec3f(&D_80A41BCC, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index b769cff78f2..98762e9c32d 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -10,6 +10,28 @@ typedef void (*EnGoActionFunc)(struct EnGo*, PlayState*); typedef u16 (*callback1_80A3ED24)(PlayState*, struct EnGo*); typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*); +typedef enum GoronLimb { + /* 0 */ GORON_LIMB_NONE, // skeleton itself + /* 1 */ GORON_LIMB_ROOT, + /* 2 */ GORON_LIMB_WAIST, // drives bottom submesh + /* 3 */ GORON_LIMB_LEGS, + /* 4 */ GORON_LIMB_LEFT_THIGH, + /* 5 */ GORON_LIMB_LEFT_SHIN, + /* 6 */ GORON_LIMB_LEFT_FOOT, + /* 7 */ GORON_LIMB_RIGHT_THIGH, + /* 8 */ GORON_LIMB_RIGHT_SHIN, + /* 9 */ GORON_LIMB_RIGHT_FOOT, + /* 10 */ GORON_LIMB_TORSO, // drives top submesh + /* 11 */ GORON_LIMB_LEFT_ARM, + /* 12 */ GORON_LIMB_LEFT_FOREARM, + /* 13 */ GORON_LIMB_LEFT_HAND, + /* 14 */ GORON_LIMB_RIGHT_ARM, + /* 15 */ GORON_LIMB_RIGHT_FOREARM, + /* 16 */ GORON_LIMB_RIGHT_HAND, + /* 17 */ GORON_LIMB_HEAD, + /* 18 */ GORON_LIMB_MAX +} GoronLimb; + // WIP type docs // /* 0x00 */ GORON1_CITY_LINK, // /* 0x10 */ GORON1_FIRE_GENERIC, @@ -22,7 +44,6 @@ typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*); // /* 0x80 */ // Not Used // /* 0x90 */ GORON1_DMT_BIGGORON, - #define EN_GO_EFFECT_COUNT 20 typedef struct EnGoEffect { @@ -55,8 +76,8 @@ typedef struct EnGo { /* 0x021A */ s16 unk_21A; /* 0x021C */ s16 unk_21C; /* 0x021E */ s16 unk_21E; - /* 0x0220 */ s16 jointTable[18]; - /* 0x0244 */ s16 morphTable[18]; + /* 0x0220 */ s16 jointTable[GORON_LIMB_MAX]; + /* 0x0244 */ s16 morphTable[GORON_LIMB_MAX]; /* 0x0268 */ EnGoEffect effects[EN_GO_EFFECT_COUNT]; } EnGo; // size = 0x06C8 diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index c500368dd72..d9b50ec28dc 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1518,7 +1518,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, GORON_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); @@ -1995,7 +1995,7 @@ void EnGo2_Update(Actor* thisx, PlayState* play) { #endif this->actionFunc(this, play); if (this->unk_211 == true) { - func_80034F54(play, this->unk_226, this->unk_24A, 18); + func_80034F54(play, this->unk_226, this->unk_24A, GORON_LIMB_MAX); } func_80A45288(this, play); EnGo2_EyeMouthTexState(this); @@ -2035,19 +2035,19 @@ s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, V EnGo2* this = (EnGo2*)thisx; Vec3s limbRot; - if (limb == 17) { + if (limb == GORON_LIMB_HEAD) { Matrix_Translate(2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); limbRot = this->interactInfo.headRot; Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_Translate(-2800.0f, 0.0f, 0.0f, MTXMODE_APPLY); } - if (limb == 10) { + if (limb == GORON_LIMB_TORSO) { limbRot = this->interactInfo.torsoRot; Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } - if ((limb == 10) || (limb == 11) || (limb == 14)) { + if ((limb == GORON_LIMB_TORSO) || (limb == GORON_LIMB_LEFT_ARM) || (limb == GORON_LIMB_RIGHT_ARM)) { rot->y += Math_SinS(this->unk_226[limb]) * 200.0f; rot->z += Math_CosS(this->unk_24A[limb]) * 200.0f; } @@ -2058,7 +2058,7 @@ void EnGo2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnGo2* this = (EnGo2*)thisx; Vec3f D_80A4856C = { 600.0f, 0.0f, 0.0f }; - if (limbIndex == 17) { + if (limbIndex == GORON_LIMB_HEAD) { Matrix_MultVec3f(&D_80A4856C, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 9651f6bfeb8..7267cf4aed7 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -92,14 +92,14 @@ typedef struct EnGo2 { /* 0x021C */ char unk_21C[0x04]; /* 0x0220 */ f32 alpha; // Set to 0, used by func_80A45360, smoothed to this->actor.shape.shadowAlpha from either 0 or 255.0f /* 0x0224 */ s16 blinkTimer; - /* 0x0226 */ s16 unk_226[18]; // Remains unknown - /* 0x024A */ s16 unk_24A[18]; // Remains unknown + /* 0x0226 */ s16 unk_226[GORON_LIMB_MAX]; // Remains unknown + /* 0x024A */ s16 unk_24A[GORON_LIMB_MAX]; // Remains unknown /* 0x026E */ u16 trackingMode; /* 0x0270 */ EnGoEffect effects[EN_GO2_EFFECT_COUNT]; /* 0x04A0 */ Vec3f subCamEye; /* 0x04AC */ Vec3f subCamAt; - /* 0x04B8 */ Vec3s jointTable[18]; - /* 0x0524 */ Vec3s morphTable[18]; + /* 0x04B8 */ Vec3s jointTable[GORON_LIMB_MAX]; + /* 0x0524 */ Vec3s morphTable[GORON_LIMB_MAX]; /* 0x0590 */ s16 unk_590; // timer /* 0x0592 */ s16 animTimer; // animTimer. Plays NA_SE_EN_MORIBLIN_WALK, NA_SE_EV_IRON_DOOR_OPEN, NA_SE_EV_IRON_DOOR_CLOSE /* 0x0594 */ s32 getItemId; From a71747bfb2a852fcbf75d5dfb5b13496ea3544a3 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 02:16:53 +0100 Subject: [PATCH 03/68] Document Goron's limbs' display lists --- assets/xml/objects/object_oF1d_map.xml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index b77bded15a5..1f474d473d2 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -21,9 +21,10 @@ - + + @@ -42,6 +43,23 @@ + + + + + + + + + + + + + + + + + From b3b6b28477b60629211e01fa8f87747f79da5dd7 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 03:41:08 +0100 Subject: [PATCH 04/68] Document non-limb display lists --- assets/xml/objects/object_oF1d_map.xml | 13 ++++++------- src/overlays/actors/ovl_En_Go/z_en_go.c | 8 ++++---- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 8 ++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index 1f474d473d2..38c0473c421 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -14,13 +14,6 @@ - - - - - - - @@ -60,6 +53,12 @@ + + + + + + diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 77a8201ddc9..37438dd1c5f 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1059,7 +1059,7 @@ void EnGo_DrawCurledUp(EnGo* this, PlayState* play) { MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go.c", 2326); - gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00BD80); + gSPDisplayList(POLY_OPA_DISP++, gGoronCurledUpDL); Matrix_MultVec3f(&D_80A41BB4, &this->actor.focus.pos); Matrix_Pop(); @@ -1077,7 +1077,7 @@ void EnGo_DrawRolling(EnGo* this, PlayState* play) { Matrix_RotateZYX((s16)(play->state.frames * ((s16)this->actor.speed * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go.c", 2368); - gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00C140); + gSPDisplayList(POLY_OPA_DISP++, gGoronRollingDL); Matrix_MultVec3f(&D_80A41BC0, &this->actor.focus.pos); Matrix_Pop(); @@ -1213,7 +1213,7 @@ void EnGo_DrawEffects(EnGo* this, PlayState* play) { if (!materialFlag) { POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); + gSPDisplayList(POLY_XLU_DISP++, gGoronParticleMaterialDL); gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); materialFlag = true; } @@ -1228,7 +1228,7 @@ void EnGo_DrawEffects(EnGo* this, PlayState* play) { index = dustEffect->timer * (8.0f / dustEffect->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTex[index])); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + gSPDisplayList(POLY_XLU_DISP++, gGoronParticleDL); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2678); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index d9b50ec28dc..70b6a0dc992 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -223,7 +223,7 @@ void EnGo2_DrawEffects(EnGo2* this, PlayState* play) { if (!materialFlag) { POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); + gSPDisplayList(POLY_XLU_DISP++, gGoronParticleMaterialDL); gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); materialFlag = true; } @@ -237,7 +237,7 @@ void EnGo2_DrawEffects(EnGo2* this, PlayState* play) { MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_go2_eff.c", 137); index = dustEffect->timer * (8.0f / dustEffect->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + gSPDisplayList(POLY_XLU_DISP++, gGoronParticleDL); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2_eff.c", 151); @@ -2008,7 +2008,7 @@ s32 EnGo2_DrawCurledUp(EnGo2* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2881); Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go2.c", 2884); - gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00BD80); + gSPDisplayList(POLY_OPA_DISP++, gGoronCurledUpDL); CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2889); Matrix_MultVec3f(&D_80A48554, &this->actor.focus.pos); @@ -2025,7 +2025,7 @@ s32 EnGo2_DrawRolling(EnGo2* this, PlayState* play) { speedXZ = this->actionFunc == EnGo2_ReverseRolling ? 0.0f : this->actor.speed; Matrix_RotateZYX((play->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go2.c", 2926); - gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00C140); + gSPDisplayList(POLY_OPA_DISP++, gGoronRollingDL); CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2930); Matrix_MultVec3f(&D_80A48560, &this->actor.focus.pos); return 1; From ba0bb1094d7b736e464356ac3ef0ad5716fd3672 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 03:55:10 +0100 Subject: [PATCH 05/68] just align attributes --- assets/xml/objects/object_oF1d_map.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index 38c0473c421..4f3386613fa 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -63,14 +63,14 @@ - - - + + + - + From 40203d01438df9b71813cac7da6df70f7314b4d4 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 03:55:31 +0100 Subject: [PATCH 06/68] Document animations --- assets/xml/objects/object_oF1d_map.xml | 22 +++--- src/overlays/actors/ovl_Demo_Go/z_demo_go.c | 4 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 40 +++++----- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 86 +++++++++++---------- 4 files changed, 79 insertions(+), 73 deletions(-) diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index 4f3386613fa..26a7fbaa5a6 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -2,17 +2,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 2a6ac15c52f..a6801962d51 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -254,7 +254,7 @@ void func_8097CEEC(DemoGo* this, PlayState* play) { } void func_8097CF20(DemoGo* this, PlayState* play, s32 arg2) { - AnimationHeader* animation = &gGoronAnim_0029A8; + AnimationHeader* animation = &gGoronWalkingLoopAnim; if (arg2 != 0) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, -8.0f); @@ -328,7 +328,7 @@ void DemoGo_Update(Actor* thisx, PlayState* play) { void DemoGo_Init(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; - AnimationHeader* animation = &gGoronAnim_004930; + AnimationHeader* animation = &gGoronUncurlSitStandAnim; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 37438dd1c5f..ef3c9c80d1b 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -69,17 +69,17 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; typedef enum EnGoAnimation { - /* 0 */ ENGO_ANIM_0, - /* 1 */ ENGO_ANIM_1, - /* 2 */ ENGO_ANIM_2, - /* 3 */ ENGO_ANIM_3 + /* 0 */ ENGO_ANIM_UNCURL_SIT_STAND_IDLE, // default idle + /* 1 */ ENGO_ANIM_UNCURL_SIT_STAND, + /* 2 */ ENGO_ANIM_WALKING_LOOP, + /* 3 */ ENGO_ANIM_SIDESTEP_LOOP } EnGoAnimation; static AnimationSpeedInfo sAnimationInfo[] = { - { &gGoronAnim_004930, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f }, - { &gGoronAnim_004930, 0.0f, ANIMMODE_LOOP_INTERP, -10.0f }, - { &gGoronAnim_0029A8, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, - { &gGoronAnim_010590, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, + { &gGoronUncurlSitStandAnim, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f }, + { &gGoronUncurlSitStandAnim, 0.0f, ANIMMODE_LOOP_INTERP, -10.0f }, + { &gGoronWalkingLoopAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, + { &gGoronSidestepLoopAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, }; void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { @@ -455,8 +455,8 @@ void EnGo_ReverseAnimation(EnGo* this) { void EnGo_UpdateShadow(EnGo* this) { s16 shadowAlpha; f32 currentFrame = this->skelAnime.curFrame; - s16 shadowAlphaTarget = (this->skelAnime.animation == &gGoronAnim_004930 && currentFrame > 32.0f) || - this->skelAnime.animation != &gGoronAnim_004930 + s16 shadowAlphaTarget = (this->skelAnime.animation == &gGoronUncurlSitStandAnim && currentFrame > 32.0f) || + this->skelAnime.animation != &gGoronUncurlSitStandAnim ? 255 : 0; @@ -643,7 +643,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_5; } - EnGo_ChangeAnim(this, ENGO_ANIM_0); + EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND_IDLE); this->actor.attentionRangeType = ATTENTION_RANGE_6; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->actor.gravity = -1.0f; @@ -661,7 +661,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { } break; case 0x10: - this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); + this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); Actor_SetScale(&this->actor, 0.01f); EnGo_SetupAction(this, EnGo_FireGenericActionFunc); break; @@ -840,7 +840,7 @@ void func_80A405CC(EnGo* this, PlayState* play) { f32 lastFrame; f32 frame; - lastFrame = Animation_GetLastFrame(&gGoronAnim_004930); + lastFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); Math_SmoothStepToF(&this->skelAnime.playSpeed, PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f, 0.1f, 1000.0f, 0.1f); @@ -866,7 +866,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { - EnGo_ChangeAnim(this, ENGO_ANIM_2); + EnGo_ChangeAnim(this, ENGO_ANIM_WALKING_LOOP); this->unk_21E = 100; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; EnGo_SetupAction(this, EnGo_Eyedrops); @@ -928,13 +928,13 @@ void func_80A408D8(EnGo* this, PlayState* play) { } void func_80A40A54(EnGo* this, PlayState* play) { - f32 float1 = ((f32)0x8000 / Animation_GetLastFrame(&gGoronAnim_010590)); + f32 float1 = ((f32)0x8000 / Animation_GetLastFrame(&gGoronSidestepLoopAnim)); f32 float2 = this->skelAnime.curFrame * float1; this->actor.speed = Math_SinS((s16)float2); if (EnGo_FollowPath(this, play) && this->unk_218 == 0) { - EnGo_ChangeAnim(this, ENGO_ANIM_1); - this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); + EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND); + this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); this->actor.speed = 0.0f; EnGo_SetupAction(this, EnGo_BiggoronActionFunc); } @@ -942,7 +942,7 @@ void func_80A40A54(EnGo* this, PlayState* play) { void func_80A40B1C(EnGo* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_EB)) { - EnGo_ChangeAnim(this, ENGO_ANIM_3); + EnGo_ChangeAnim(this, ENGO_ANIM_SIDESTEP_LOOP); EnGo_SetupAction(this, func_80A40A54); } else { EnGo_BiggoronActionFunc(this, play); @@ -1015,8 +1015,8 @@ void EnGo_Eyedrops(EnGo* this, PlayState* play) { void func_80A40DCC(EnGo* this, PlayState* play) { if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { - EnGo_ChangeAnim(this, ENGO_ANIM_1); - this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930); + EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND); + this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); Message_CloseTextbox(play); EnGo_SetupAction(this, EnGo_GetItem); EnGo_GetItem(this, play); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 70b6a0dc992..6c4756e7206 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -118,29 +118,35 @@ static f32 sPlayerTrackingYOffsets[14][2] = { }; typedef enum EnGo2Animation { - /* 0 */ ENGO2_ANIM_0, - /* 1 */ ENGO2_ANIM_1, - /* 2 */ ENGO2_ANIM_2, - /* 3 */ ENGO2_ANIM_3, - /* 4 */ ENGO2_ANIM_4, - /* 5 */ ENGO2_ANIM_5, - /* 6 */ ENGO2_ANIM_6, - /* 7 */ ENGO2_ANIM_7, - /* 8 */ ENGO2_ANIM_8, - /* 9 */ ENGO2_ANIM_9, - /* 10 */ ENGO2_ANIM_10, - /* 11 */ ENGO2_ANIM_11, - /* 12 */ ENGO2_ANIM_12 + /* 0 */ ENGO2_ANIM_UNCURL_SIT_STAND_IDLE, // default idle + /* 1 */ ENGO2_ANIM_UNCURL_SIT_STAND, + /* 2 */ ENGO2_ANIM_WALKING_LOOP, + /* 3 */ ENGO2_ANIM_SIDESTEP_LOOP, + /* 4 */ ENGO2_ANIM_CRYING_LOOP, + /* 5 */ ENGO2_ANIM_EYEDROPS_LOOP, + /* 6 */ ENGO2_ANIM_EYEDROPS_TAKEN, + /* 7 */ ENGO2_ANIM_UNCURL_PRONE_UNUSED, + /* 8 */ ENGO2_ANIM_PRONE_LOOP_UNUSED, + /* 9 */ ENGO2_ANIM_SCRATCHING_LOOP, + /* 10 */ ENGO2_ANIM_UNCURL_SIT_STAND_BIG, + /* 11 */ ENGO2_ANIM_SOBBING_LOOP, + /* 12 */ ENGO2_ANIM_SHAKING_LOOP } EnGo2Animation; static AnimationInfo sAnimationInfo[] = { - { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x00, 0.0f }, { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronAnim_0029A8, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_010590, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronAnim_003768, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_0038E4, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, - { &gGoronAnim_002D80, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, { &gGoronAnim_00161C, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronAnim_001A00, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_0021D0, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x01, -8.0f }, { &gGoronAnim_000750, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronAnim_000D5C, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronUncurlSitStandAnim, 0.0f, 0.0f, -1.0f, 0x00, 0.0f }, + { &gGoronUncurlSitStandAnim, 0.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronWalkingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronSidestepLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronCryingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronEyeropsLoopAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, + { &gGoronEyedropsTakenAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, + { &gGoronUncurlToProneAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronProneLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronScratchingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronUncurlSitStandAnim, 0.0f, 0.0f, -1.0f, 0x01, -8.0f }, + { &gGoronSobbingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronShakingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, }; static EnGo2DustEffectData sDustEffectData[2][4] = { @@ -1099,7 +1105,7 @@ void func_80A45288(EnGo2* this, PlayState* play) { void func_80A45360(EnGo2* this, f32* alpha) { f32 alphaTarget = - (this->skelAnime.animation == &gGoronAnim_004930) && (this->skelAnime.curFrame <= 32.0f) ? 0.0f : 255.0f; + (this->skelAnime.animation == &gGoronUncurlSitStandAnim) && (this->skelAnime.curFrame <= 32.0f) ? 0.0f : 255.0f; Math_ApproachF(alpha, alphaTarget, 0.4f, 100.0f); this->actor.shape.shadowAlpha = (u8)(u32)*alpha; @@ -1126,12 +1132,12 @@ void func_80A454CC(EnGo2* this) { case GORON_CITY_ENTRANCE: case GORON_CITY_STAIRWELL: case GORON_DMT_FAIRY_HINT: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_9); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_SCRATCHING_LOOP); break; case GORON_DMT_BIGGORON: if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_BROKEN_GORONS_SWORD && INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYE_DROPS) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_4); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_CRYING_LOOP); break; } FALLTHROUGH; @@ -1270,7 +1276,7 @@ void EnGo2_EyeMouthTexState(EnGo2* this) { } void EnGo2_SitDownAnimation(EnGo2* this) { - if ((this->skelAnime.playSpeed != 0.0f) && (this->skelAnime.animation == &gGoronAnim_004930)) { + if ((this->skelAnime.playSpeed != 0.0f) && (this->skelAnime.animation == &gGoronUncurlSitStandAnim)) { if (this->skelAnime.playSpeed > 0.0f && this->skelAnime.curFrame == 14.0f) { if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BIGGORON) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_DOWN); @@ -1300,10 +1306,10 @@ void EnGo2_GetDustData(EnGo2* this, s32 index2) { void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_BIG); this->skelAnime.playSpeed = -0.5f; } else { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); this->skelAnime.playSpeed = -1.0f; } EnGo2_SwapInitialFrameAnimFrameCount(this); @@ -1323,17 +1329,17 @@ void EnGo2_WakeUp(EnGo2* this, PlayState* play) { } if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN); - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_BIG); this->skelAnime.playSpeed = 0.5f; } else { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); this->skelAnime.playSpeed = 1.0f; } this->actionFunc = func_80A46B40; } void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); this->unk_211 = true; this->actionFunc = func_80A46B40; this->skelAnime.playSpeed = 0.0f; @@ -1399,7 +1405,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { return false; } - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_3); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_SIDESTEP_LOOP); this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->isAwake = false; this->trackingMode = NPC_TRACKING_NONE; @@ -1454,21 +1460,21 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, PlayState* play) { if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_LINK) { if ((this->actor.textId == 0x3035 && this->unk_20C == 0) || (this->actor.textId == 0x3036 && this->unk_20C == 0)) { - if (this->skelAnime.animation != &gGoronAnim_000D5C) { - animation = ENGO2_ANIM_12; + if (this->skelAnime.animation != &gGoronShakingLoopAnim) { + animation = ENGO2_ANIM_SHAKING_LOOP; this->eyeMouthTexState = 0; } } if ((this->actor.textId == 0x3032 && this->unk_20C == 12) || (this->actor.textId == 0x3033) || (this->actor.textId == 0x3035 && this->unk_20C == 6)) { - if (this->skelAnime.animation != &gGoronAnim_000750) { - animation = ENGO2_ANIM_11; + if (this->skelAnime.animation != &gGoronSobbingLoopAnim) { + animation = ENGO2_ANIM_SOBBING_LOOP; this->eyeMouthTexState = 1; } } - if (this->skelAnime.animation == &gGoronAnim_000750) { + if (this->skelAnime.animation == &gGoronSobbingLoopAnim) { if (this->skelAnime.curFrame == 20.0f) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CRY); } @@ -1542,7 +1548,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { EnGo2_SetColliderDim(this); EnGo2_SetShape(this); - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_IDLE); this->actor.gravity = -1.0f; this->alpha = this->actor.shape.shadowAlpha = 0; this->reverse = 0; @@ -1832,7 +1838,7 @@ void EnGo2_SetGetItem(EnGo2* this, PlayState* play) { void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { switch (this->goronState) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_5); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_EYEDROPS_LOOP); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.shape.rot.y += 0x5B0; this->trackingMode = NPC_TRACKING_NONE; @@ -1851,7 +1857,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { } } else { func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_GOOD_BIG, 60); - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_6); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_EYEDROPS_TAKEN); Message_ContinueTextbox(play, 0x305A); this->eyeMouthTexState = 3; this->goronState++; @@ -1863,7 +1869,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { this->eyeMouthTexState = 0; } if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; this->skelAnime.playSpeed = 0.0f; @@ -1914,7 +1920,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { EnGo2_GoronFireCamera(this, play); play->msgCtx.msgMode = MSGMODE_PAUSED; - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_2); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_WALKING_LOOP); this->waypoint = 1; this->skelAnime.playSpeed = 2.0f; func_80A44D84(this); From 60b8664f78535345c4bbb81f3d06f4af26c759e1 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 10:57:20 +0100 Subject: [PATCH 07/68] remove unused EnGo callbacks - `callback1_80A3ED24` is `NpcGetTextIdFunc` - `callback2_80A3ED24` is `NpcUpdateTalkStateFunc` --- src/overlays/actors/ovl_En_Go/z_en_go.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 98762e9c32d..6feba87a155 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -7,8 +7,6 @@ struct EnGo; typedef void (*EnGoActionFunc)(struct EnGo*, PlayState*); -typedef u16 (*callback1_80A3ED24)(PlayState*, struct EnGo*); -typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*); typedef enum GoronLimb { /* 0 */ GORON_LIMB_NONE, // skeleton itself From 3411f1e508b258ccc7950eecda2152eaa198a628 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 15:15:35 +0100 Subject: [PATCH 08/68] redocument EnGo subtypes as an enum --- src/overlays/actors/ovl_En_Go/z_en_go.c | 138 ++++++++++++------------ src/overlays/actors/ovl_En_Go/z_en_go.h | 12 --- 2 files changed, 72 insertions(+), 78 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index ef3c9c80d1b..ca6035284ea 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -82,6 +82,19 @@ static AnimationSpeedInfo sAnimationInfo[] = { { &gGoronSidestepLoopAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, }; +#define ENGO_GET_TYPE(this) PARAMS_GET_NOSHIFT((this)->actor.params, 4, 4) +typedef enum EnGoType { + ENGO_TYPE_CITY_LINK = 0x00, + ENGO_TYPE_FIRE_GENERIC = 0x10, + ENGO_TYPE_DMT_DC_ENTRANCE = 0x20, + ENGO_TYPE_DMT_ROLLING_SMALL = 0x30, + ENGO_TYPE_DMT_BOMB_FLOWER = 0x40, + ENGO_TYPE_CITY_ENTRANCE = 0x50, + ENGO_TYPE_CITY_ISLAND = 0x60, + ENGO_TYPE_CITY_LOST_WOODS = 0x70, + ENGO_TYPE_DMT_BIGGORON = 0x90 +} EnGoType; + void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -89,8 +102,8 @@ void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { Player* player = GET_PLAYER(play); - switch (PARAMS_GET_NOSHIFT(thisx->params, 4, 4)) { - case 0x90: + switch (ENGO_GET_TYPE((EnGo*)thisx)) { + case ENGO_TYPE_DMT_BIGGORON: if (gSaveContext.save.info.playerData.bgsFlag) { return 0x305E; } else if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_CLAIM_CHECK) { @@ -108,7 +121,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { player->exchangeItemId = EXCH_ITEM_BROKEN_GORONS_SWORD; return 0x3053; } - case 0x00: + case ENGO_TYPE_CITY_LINK: if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) { if (GET_INFTABLE(INFTABLE_10F)) { return 0x3042; @@ -132,13 +145,13 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { return 0x3030; } } - case 0x10: + case ENGO_TYPE_FIRE_GENERIC: if (Flags_GetSwitch(play, PARAMS_GET_NOMASK(thisx->params, 8))) { return 0x3052; } else { return 0x3051; } - case 0x20: + case ENGO_TYPE_DMT_DC_ENTRANCE: if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else if (GET_EVENTCHKINF(EVENTCHKINF_23)) { @@ -148,7 +161,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } else { return 0x3008; } - case 0x30: + case ENGO_TYPE_DMT_ROLLING_SMALL: if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else if (GET_EVENTCHKINF(EVENTCHKINF_23)) { @@ -156,7 +169,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } else { return 0x3009; } - case 0x40: + case ENGO_TYPE_DMT_BOMB_FLOWER: if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else if (GET_EVENTCHKINF(EVENTCHKINF_23)) { @@ -164,7 +177,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } else { return 0x300A; } - case 0x50: + case ENGO_TYPE_CITY_ENTRANCE: if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else if (GET_INFTABLE(INFTABLE_F0)) { @@ -172,7 +185,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } else { return 0x3014; } - case 0x60: + case ENGO_TYPE_CITY_ISLAND: if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else if (GET_INFTABLE(INFTABLE_F4)) { @@ -180,7 +193,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } else { return 0x3016; } - case 0x70: + case ENGO_TYPE_CITY_LOST_WOODS: if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else if (GET_INFTABLE(INFTABLE_F8)) { @@ -349,30 +362,27 @@ s32 EnGo_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 intera void EnGo_ChangeAnim(EnGo* this, s32 index) { Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, - sAnimationInfo[index].playSpeed * - (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f), + sAnimationInfo[index].playSpeed * (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f), 0.0f, Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { - if (((this->actor.params) & 0xF0) == 0x90) { + if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { return true; } else if (play->sceneId == SCENE_FIRE_TEMPLE && !Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8)) && - LINK_IS_ADULT && PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x10) { + LINK_IS_ADULT && ENGO_GET_TYPE(this) == ENGO_TYPE_FIRE_GENERIC) { return true; - } else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_ADULT && - PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x00) { + } else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_ADULT && ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_LINK) { return true; } else if (play->sceneId == SCENE_DEATH_MOUNTAIN_TRAIL && LINK_IS_CHILD && - (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x20 || - PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x30 || - PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x40)) { + (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_DC_ENTRANCE || + ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_ROLLING_SMALL || + ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BOMB_FLOWER)) { return true; } else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_CHILD && - (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x50 || - PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x60 || - PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x70)) { + (ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_ENTRANCE || ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_ISLAND || + ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_LOST_WOODS)) { return true; } else { return false; @@ -380,16 +390,16 @@ s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { } f32 EnGo_GetPlayerTrackingYOffset(EnGo* this) { - switch (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4)) { - case 0x00: + switch (ENGO_GET_TYPE(this)) { + case ENGO_TYPE_CITY_LINK: return 10.0f; - case 0x20: - case 0x30: - case 0x50: - case 0x60: - case 0x70: + case ENGO_TYPE_DMT_DC_ENTRANCE: + case ENGO_TYPE_DMT_ROLLING_SMALL: + case ENGO_TYPE_CITY_ENTRANCE: + case ENGO_TYPE_CITY_ISLAND: + case ENGO_TYPE_CITY_LOST_WOODS: return 20.0f; - case 0x40: + case ENGO_TYPE_DMT_BOMB_FLOWER: return 60.0f; default: return 20.0f; @@ -430,7 +440,7 @@ s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) { } xyzDistSq = (this->actor.scale.x / 0.01f) * SQ(100.0f); - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { + if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW); xyzDistSq *= 4.8f; } @@ -488,7 +498,7 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { this->unk_218 = 0; } - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x00) { + if (ENGO_GET_TYPE(this) != ENGO_TYPE_CITY_LINK) { return true; } else if (Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8))) { return true; @@ -583,11 +593,11 @@ void func_80A3F908(EnGo* this, PlayState* play) { interactRange = (this->collider.dim.radius + 30.0f); interactRange *= (this->actor.scale.x / 0.01f); - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { + if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { interactRange *= 4.8f; } - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { + if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { dialogStarted = EnGo_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, interactRange, EnGo_GetTextID, EnGo_UpdateTalkState); } else { @@ -595,7 +605,7 @@ void func_80A3F908(EnGo* this, PlayState* play) { EnGo_GetTextID, EnGo_UpdateTalkState); } - if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) && (dialogStarted == true)) { + if ((ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) && (dialogStarted == true)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_BROKEN_GORONS_SWORD) { if (Player_GetExchangeItemId(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { if (GET_INFTABLE(INFTABLE_B4)) { @@ -638,7 +648,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { return; } - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) && (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90)) { + if (ENGO_GET_TYPE(this) && (ENGO_GET_TYPE(this) != ENGO_TYPE_DMT_BIGGORON)) { this->actor.flags &= ~ACTOR_FLAG_4; this->actor.flags &= ~ACTOR_FLAG_5; } @@ -648,8 +658,8 @@ void EnGo_Init(Actor* thisx, PlayState* play) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->actor.gravity = -1.0f; - switch (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4)) { - case 0x00: + switch (ENGO_GET_TYPE(this)) { + case ENGO_TYPE_CITY_LINK: Actor_SetScale(&this->actor, 0.008f); if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { EnGo_SetMovedPos(this, play); @@ -660,32 +670,32 @@ void EnGo_Init(Actor* thisx, PlayState* play) { EnGo_SetupAction(this, EnGo_GoronLinkRolling); } break; - case 0x10: + case ENGO_TYPE_FIRE_GENERIC: this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); Actor_SetScale(&this->actor, 0.01f); EnGo_SetupAction(this, EnGo_FireGenericActionFunc); break; - case 0x40: + case ENGO_TYPE_DMT_BOMB_FLOWER: if (GET_INFTABLE(INFTABLE_EB)) { EnGo_SetMovedPos(this, play); } Actor_SetScale(&this->actor, 0.015f); EnGo_SetupAction(this, EnGo_CurledUp); break; - case 0x30: + case ENGO_TYPE_DMT_ROLLING_SMALL: this->actor.shape.yOffset = 1400.0f; Actor_SetScale(&this->actor, 0.01f); EnGo_SetupAction(this, func_80A3FEB4); break; - case 0x90: + case ENGO_TYPE_DMT_BIGGORON: this->actor.attentionRangeType = ATTENTION_RANGE_5; Actor_SetScale(&this->actor, 0.16f); EnGo_SetupAction(this, EnGo_CurledUp); break; - case 0x20: - case 0x50: - case 0x60: - case 0x70: + case ENGO_TYPE_DMT_DC_ENTRANCE: + case ENGO_TYPE_CITY_ENTRANCE: + case ENGO_TYPE_CITY_ISLAND: + case ENGO_TYPE_CITY_LOST_WOODS: Actor_SetScale(&this->actor, 0.01f); EnGo_SetupAction(this, EnGo_CurledUp); break; @@ -773,10 +783,10 @@ void EnGo_CurledUp(EnGo* this, PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->skelAnime.playSpeed = 0.1f; - this->skelAnime.playSpeed *= PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f; + this->skelAnime.playSpeed *= ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f; EnGo_SetupAction(this, EnGo_WakeUp); - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { + if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN); } } @@ -787,8 +797,7 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { if (this->skelAnime.playSpeed != 0.0f) { Math_SmoothStepToF(&this->skelAnime.playSpeed, - (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * 0.5f, 0.1f, 1000.0f, - 0.1f); + (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) * 0.5f, 0.1f, 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -797,7 +806,7 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { } else { this->skelAnime.curFrame = 12.0f; this->skelAnime.playSpeed = 0.0f; - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) { + if (ENGO_GET_TYPE(this) != ENGO_TYPE_DMT_BIGGORON) { this->unk_212 = 30; return; } @@ -819,8 +828,7 @@ void func_80A40494(EnGo* this, PlayState* play) { f32 frame; Math_SmoothStepToF(&this->skelAnime.playSpeed, - (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * -0.5f, 0.1f, 1000.0f, - 0.1f); + (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) * -0.5f, 0.1f, 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -841,8 +849,8 @@ void func_80A405CC(EnGo* this, PlayState* play) { f32 frame; lastFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); - Math_SmoothStepToF(&this->skelAnime.playSpeed, PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f, - 0.1f, 1000.0f, 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f, 0.1f, + 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -851,7 +859,7 @@ void func_80A405CC(EnGo* this, PlayState* play) { this->skelAnime.curFrame = lastFrame; this->skelAnime.playSpeed = 0.0f; this->unk_212 = Rand_S16Offset(30, 30); - if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x40) && !GET_INFTABLE(INFTABLE_EB)) { + if ((ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BOMB_FLOWER) && !GET_INFTABLE(INFTABLE_EB)) { EnGo_SetupAction(this, func_80A40B1C); } else { EnGo_SetupAction(this, EnGo_BiggoronActionFunc); @@ -860,8 +868,7 @@ void func_80A405CC(EnGo* this, PlayState* play) { } void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { - if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) && - (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { + if ((ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { if (gSaveContext.save.info.playerData.bgsFlag) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else { @@ -880,7 +887,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { EnGo_GetItem(this, play); } } - } else if ((PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0) && + } else if ((ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_LINK) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { EnGo_SetupAction(this, EnGo_GetItem); play->msgCtx.stateTimer = 4; @@ -889,7 +896,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; - this->skelAnime.playSpeed *= PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f; + this->skelAnime.playSpeed *= ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f; EnGo_SetupAction(this, func_80A408D8); } } @@ -900,8 +907,7 @@ void func_80A408D8(EnGo* this, PlayState* play) { if (this->skelAnime.playSpeed != 0.0f) { Math_SmoothStepToF(&this->skelAnime.playSpeed, - (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90 ? 0.5f : 1.0f) * -1.0f, 0.1f, 1000.0f, - 0.1f); + (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) * -1.0f, 0.1f, 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; if (frame >= 12.0f) { @@ -909,7 +915,7 @@ void func_80A408D8(EnGo* this, PlayState* play) { } else { this->skelAnime.curFrame = 12.0f; this->skelAnime.playSpeed = 0.0f; - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) { + if (ENGO_GET_TYPE(this) != ENGO_TYPE_DMT_BIGGORON) { this->unk_212 = 30; return; } @@ -960,7 +966,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { EnGo_SetupAction(this, func_80A40C78); } else { this->unk_20C = 0; - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { + if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) { getItemId = GI_SWORD_BIGGORON; this->unk_20C = 1; @@ -973,7 +979,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { } } - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0) { + if (ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_LINK) { getItemId = GI_TUNIC_GORON; } @@ -986,7 +992,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { void func_80A40C78(EnGo* this, PlayState* play) { if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) { EnGo_SetupAction(this, EnGo_BiggoronActionFunc); - if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) != 0x90) { + if (ENGO_GET_TYPE(this) != ENGO_TYPE_DMT_BIGGORON) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else if (this->unk_20C) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 6feba87a155..894b457d142 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -30,18 +30,6 @@ typedef enum GoronLimb { /* 18 */ GORON_LIMB_MAX } GoronLimb; -// WIP type docs -// /* 0x00 */ GORON1_CITY_LINK, -// /* 0x10 */ GORON1_FIRE_GENERIC, -// /* 0x20 */ GORON1_DMT_DC_ENTRANCE, -// /* 0x30 */ GORON1_DMT_ROLLING_SMALL, -// /* 0x40 */ GORON1_DMT_BOMB_FLOWER, -// /* 0x50 */ GORON1_CITY_ENTRANCE, -// /* 0x60 */ GORON1_CITY_ISLAND, -// /* 0x70 */ GORON1_CITY_LOST_WOODS, -// /* 0x80 */ // Not Used -// /* 0x90 */ GORON1_DMT_BIGGORON, - #define EN_GO_EFFECT_COUNT 20 typedef struct EnGoEffect { From 687e70e33d33bcb9a217ff4a68aba3828f90df87 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 15:20:44 +0100 Subject: [PATCH 09/68] Document EnGo path param --- src/overlays/actors/ovl_En_Go/z_en_go.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index ca6035284ea..8ef7d3cbfdb 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -95,6 +95,9 @@ typedef enum EnGoType { ENGO_TYPE_DMT_BIGGORON = 0x90 } EnGoType; +#define ENGO_GET_PATH_INDEX(this) PARAMS_GET_U((this)->actor.params, 0, 4) +#define ENGO_PATH_INDEX_NONE 0xF // likely the count of available paths + void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -481,11 +484,11 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { f32 xDist; f32 zDist; - if (PARAMS_GET_U(this->actor.params, 0, 4) == 15) { + if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_INDEX_NONE) { return false; } - path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 4)]; + path = &play->pathList[ENGO_GET_PATH_INDEX(this)]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->unk_218; xDist = pointPos->x - this->actor.world.pos.x; @@ -516,10 +519,10 @@ s32 EnGo_SetMovedPos(EnGo* this, PlayState* play) { Path* path; Vec3s* pointPos; - if (PARAMS_GET_U(this->actor.params, 0, 4) == 0xF) { + if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_INDEX_NONE) { return false; } else { - path = &play->pathList[PARAMS_GET_U(this->actor.params, 0, 4)]; + path = &play->pathList[ENGO_GET_PATH_INDEX(this)]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += (path->count - 1); this->actor.world.pos.x = pointPos->x; From 78d0d41e9529571f0e16073625a81b5b9863a21c Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 17:00:08 +0100 Subject: [PATCH 10/68] Document EnGo opening Goron's cage --- src/overlays/actors/ovl_En_Go/z_en_go.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 8ef7d3cbfdb..fbe15fb6f6f 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -98,6 +98,9 @@ typedef enum EnGoType { #define ENGO_GET_PATH_INDEX(this) PARAMS_GET_U((this)->actor.params, 0, 4) #define ENGO_PATH_INDEX_NONE 0xF // likely the count of available paths +#define ENGO2_CAGED_FLAG(this) PARAMS_GET_NOMASK((this)->actor.params, 8) +#define ENGO2_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO2_CAGED_FLAG(this)) + void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -149,7 +152,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } } case ENGO_TYPE_FIRE_GENERIC: - if (Flags_GetSwitch(play, PARAMS_GET_NOMASK(thisx->params, 8))) { + if (ENGO2_IS_CAGE_OPEN((EnGo*)thisx, play)) { return 0x3052; } else { return 0x3051; @@ -373,8 +376,8 @@ void EnGo_ChangeAnim(EnGo* this, s32 index) { s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { return true; - } else if (play->sceneId == SCENE_FIRE_TEMPLE && !Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8)) && - LINK_IS_ADULT && ENGO_GET_TYPE(this) == ENGO_TYPE_FIRE_GENERIC) { + } else if (play->sceneId == SCENE_FIRE_TEMPLE && !ENGO2_IS_CAGE_OPEN(this, play) && LINK_IS_ADULT && + ENGO_GET_TYPE(this) == ENGO_TYPE_FIRE_GENERIC) { return true; } else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_ADULT && ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_LINK) { return true; @@ -503,7 +506,7 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { if (ENGO_GET_TYPE(this) != ENGO_TYPE_CITY_LINK) { return true; - } else if (Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8))) { + } else if (ENGO2_IS_CAGE_OPEN(this, play)) { return true; } else if (this->unk_218 >= this->actor.shape.rot.z) { this->unk_218 = 0; @@ -763,8 +766,7 @@ void func_80A4008C(EnGo* this, PlayState* play) { } void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) { - if ((EnGo_FollowPath(this, play) == true) && Flags_GetSwitch(play, PARAMS_GET_NOMASK(this->actor.params, 8)) && - (this->unk_218 == 0)) { + if ((EnGo_FollowPath(this, play) == true) && ENGO2_IS_CAGE_OPEN(this, play) && (this->unk_218 == 0)) { this->actor.speed = 0.0f; EnGo_SetupAction(this, func_80A4008C); SET_INFTABLE(INFTABLE_109); From 8784c81a3d2f144674939a7793856c3be0470ef5 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 11:37:08 +0100 Subject: [PATCH 11/68] Document `func_80A3F0E4` as `EnGo_UpdateBlinking` reason: `EnGo2_EyeMouthTexState` code analogy --- src/overlays/actors/ovl_En_Go/z_en_go.c | 17 ++++++++++------- src/overlays/actors/ovl_En_Go/z_en_go.h | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index fbe15fb6f6f..c472efd4934 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -426,12 +426,15 @@ void func_80A3F060(EnGo* this, PlayState* play) { Npc_TrackPoint(&this->actor, &this->interactInfo, 4, trackingMode); } -void func_80A3F0E4(EnGo* this) { - if (DECR(this->unk_214) == 0) { - this->unk_216++; - if (this->unk_216 >= 3) { - this->unk_214 = Rand_S16Offset(30, 30); - this->unk_216 = 0; +void EnGo_UpdateBlinking(EnGo* this) { + // @unused + // although this function runs a similar logic as `EnGo2_EyeMouthTexState` + // its results are never used: this Goron always sets `gGoronCsEyeOpenTex` + if (DECR(this->blinkTimer) == 0) { + this->eyeTexIndex++; + if (this->eyeTexIndex >= 3) { + this->blinkTimer = Rand_S16Offset(30, 30); + this->eyeTexIndex = 0; } } } @@ -1054,7 +1057,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) { } Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - func_80A3F0E4(this); + EnGo_UpdateBlinking(this); func_80A3F908(this, play); this->actionFunc(this, play); func_80A3F060(this, play); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 894b457d142..7b695a969bb 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -56,8 +56,8 @@ typedef struct EnGo { /* 0x020E */ s16 unk_20E; /* 0x0210 */ s16 unk_210; /* 0x0212 */ s16 unk_212; - /* 0x0214 */ s16 unk_214; - /* 0x0216 */ s16 unk_216; + /* 0x0214 */ s16 blinkTimer; // unused + /* 0x0216 */ s16 eyeTexIndex; // unused /* 0x0218 */ s16 unk_218; /* 0x021A */ s16 unk_21A; /* 0x021C */ s16 unk_21C; From 46a13d52f52efb52e89de7b59d00a56c68ce18a0 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 20:25:45 +0100 Subject: [PATCH 12/68] streamline EnGo `*_Draw` function into 3 sections returns are indeed required to match --- src/overlays/actors/ovl_En_Go/z_en_go.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index c472efd4934..d93aade9775 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1145,12 +1145,17 @@ void EnGo_Draw(Actor* thisx, PlayState* play) { if (this->actionFunc == EnGo_CurledUp) { EnGo_DrawCurledUp(this, play); - return; // needed for match? - } else if (this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == func_80A3FEB4 || - this->actionFunc == EnGo_StopRolling || this->actionFunc == func_80A3FEB4) { + return; + } + + if (this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == func_80A3FEB4 || + this->actionFunc == EnGo_StopRolling || this->actionFunc == func_80A3FEB4) { EnGo_DrawRolling(this, play); - return; // needed for match? - } else { + return; + } + + // draw normal + { Gfx_SetupDL_37Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gGoronCsEyeOpenTex)); From bbf4225db913ab8067d6f4b53b2568bf22ff29d1 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 20:29:40 +0100 Subject: [PATCH 13/68] Document bouncing in `EnGo_IsRollingOnGround` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 34 +++++++++++++++---------- src/overlays/actors/ovl_En_Go/z_en_go.h | 4 +-- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index d93aade9775..d6151060c17 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -562,30 +562,38 @@ s32 EnGo_SpawnDust(EnGo* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 nu return 0; } -s32 EnGo_IsRollingOnGround(EnGo* this, s16 unkArg1, f32 unkArg2) { +s32 EnGo_IsRollingOnGround(EnGo* this, s16 bounceCount, f32 boundSpeed) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.velocity.y > 0.0f) { return false; - } else if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { + } + + if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { return true; - } else if (DECR(this->unk_21C)) { - if (this->unk_21C & 1) { + } + + // rumble on odds and evens + if (DECR(this->bounceTimer)) { + if (this->bounceTimer & 1) { this->actor.world.pos.y += 1.5f; } else { this->actor.world.pos.y -= 1.5f; } return true; - } else { - this->unk_21A--; - if (this->unk_21A <= 0) { - if (this->unk_21A == 0) { - this->unk_21C = Rand_S16Offset(60, 30); - this->unk_21A = 0; + } + + // bounce! + { + this->bounceCounter--; + if (this->bounceCounter <= 0) { + if (this->bounceCounter == 0) { + this->bounceTimer = Rand_S16Offset(60, 30); + this->bounceCounter = 0; this->actor.velocity.y = 0.0f; return true; } - this->unk_21A = unkArg1; + this->bounceCounter = bounceCount; } - this->actor.velocity.y = ((f32)this->unk_21A / (f32)unkArg1) * unkArg2; + this->actor.velocity.y = ((f32)this->bounceCounter / (f32)bounceCount) * boundSpeed; return true; } } @@ -759,7 +767,7 @@ void EnGo_StopRolling(EnGo* this, PlayState* play) { void func_80A4008C(EnGo* this, PlayState* play) { if (EnGo_IsRollingOnGround(this, 3, 6.0f)) { - if (this->unk_21A == 0) { + if (this->bounceCounter == 0) { this->actor.shape.yOffset = 0.0f; EnGo_SetupAction(this, EnGo_CurledUp); } else { diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 7b695a969bb..aef8b6eded4 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -59,8 +59,8 @@ typedef struct EnGo { /* 0x0214 */ s16 blinkTimer; // unused /* 0x0216 */ s16 eyeTexIndex; // unused /* 0x0218 */ s16 unk_218; - /* 0x021A */ s16 unk_21A; - /* 0x021C */ s16 unk_21C; + /* 0x021A */ s16 bounceCounter; + /* 0x021C */ s16 bounceTimer; /* 0x021E */ s16 unk_21E; /* 0x0220 */ s16 jointTable[GORON_LIMB_MAX]; /* 0x0244 */ s16 morphTable[GORON_LIMB_MAX]; From 3be6be591ebcdcb1e910dbfc898ddec78f2a231a Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 17:24:31 +0100 Subject: [PATCH 14/68] Document EnGo `.unk_218` as `.waypoint` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 18 +++++++++--------- src/overlays/actors/ovl_En_Go/z_en_go.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index d6151060c17..4bf18ae5e74 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -496,23 +496,23 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { path = &play->pathList[ENGO_GET_PATH_INDEX(this)]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); - pointPos += this->unk_218; + pointPos += this->waypoint; xDist = pointPos->x - this->actor.world.pos.x; zDist = pointPos->z - this->actor.world.pos.z; Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(xDist, zDist)), 10, 1000, 1); if ((SQ(xDist) + SQ(zDist)) < 600.0f) { - this->unk_218++; - if (this->unk_218 >= path->count) { - this->unk_218 = 0; + this->waypoint++; + if (this->waypoint >= path->count) { + this->waypoint = 0; } if (ENGO_GET_TYPE(this) != ENGO_TYPE_CITY_LINK) { return true; } else if (ENGO2_IS_CAGE_OPEN(this, play)) { return true; - } else if (this->unk_218 >= this->actor.shape.rot.z) { - this->unk_218 = 0; + } else if (this->waypoint >= this->actor.shape.rot.z) { + this->waypoint = 0; } return true; @@ -747,7 +747,7 @@ void EnGo_StopRolling(EnGo* this, PlayState* play) { } this->actor.speed = 3.0f; - if ((EnGo_FollowPath(this, play) == true) && (this->unk_218 == 0)) { + if ((EnGo_FollowPath(this, play) == true) && (this->waypoint == 0)) { bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bomb != NULL) { @@ -777,7 +777,7 @@ void func_80A4008C(EnGo* this, PlayState* play) { } void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) { - if ((EnGo_FollowPath(this, play) == true) && ENGO2_IS_CAGE_OPEN(this, play) && (this->unk_218 == 0)) { + if ((EnGo_FollowPath(this, play) == true) && ENGO2_IS_CAGE_OPEN(this, play) && (this->waypoint == 0)) { this->actor.speed = 0.0f; EnGo_SetupAction(this, func_80A4008C); SET_INFTABLE(INFTABLE_109); @@ -954,7 +954,7 @@ void func_80A40A54(EnGo* this, PlayState* play) { f32 float2 = this->skelAnime.curFrame * float1; this->actor.speed = Math_SinS((s16)float2); - if (EnGo_FollowPath(this, play) && this->unk_218 == 0) { + if (EnGo_FollowPath(this, play) && this->waypoint == 0) { EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); this->actor.speed = 0.0f; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index aef8b6eded4..5d5afce8c38 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -58,7 +58,7 @@ typedef struct EnGo { /* 0x0212 */ s16 unk_212; /* 0x0214 */ s16 blinkTimer; // unused /* 0x0216 */ s16 eyeTexIndex; // unused - /* 0x0218 */ s16 unk_218; + /* 0x0218 */ s16 waypoint; /* 0x021A */ s16 bounceCounter; /* 0x021C */ s16 bounceTimer; /* 0x021E */ s16 unk_21E; From 87097be9ab74cb6ca70b706cbcf60138e936e585 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 20:34:23 +0100 Subject: [PATCH 15/68] Document EnGo `.unk_20E` as `.knockbackCooldown` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 4 ++-- src/overlays/actors/ovl_En_Go/z_en_go.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 4bf18ae5e74..b09f6ee3afd 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -737,12 +737,12 @@ void func_80A3FEB4(EnGo* this, PlayState* play) { void EnGo_StopRolling(EnGo* this, PlayState* play) { EnBom* bomb; - if (DECR(this->unk_20E) == 0) { + if (DECR(this->knockbackCooldown) == 0) { if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; play->damagePlayer(play, -4); Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); - this->unk_20E = 0x10; + this->knockbackCooldown = 0x10; } } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 5d5afce8c38..c4cb7db68e2 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -53,7 +53,7 @@ typedef struct EnGo { /* 0x01E0 */ NpcInteractInfo interactInfo; /* 0x0208 */ char unk_208[0x4]; /* 0x020C */ s16 unk_20C; - /* 0x020E */ s16 unk_20E; + /* 0x020E */ s16 knockbackCooldown; /* 0x0210 */ s16 unk_210; /* 0x0212 */ s16 unk_212; /* 0x0214 */ s16 blinkTimer; // unused From 9de2038db8af749bb7913b7d18c3ddcdfd7d07fb Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 23:03:16 +0100 Subject: [PATCH 16/68] Document EnGo `.unk_212` as `.attentionCooldown` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 12 ++++++------ src/overlays/actors/ovl_En_Go/z_en_go.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index b09f6ee3afd..49cf65b8d3f 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -823,13 +823,13 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { this->skelAnime.curFrame = 12.0f; this->skelAnime.playSpeed = 0.0f; if (ENGO_GET_TYPE(this) != ENGO_TYPE_DMT_BIGGORON) { - this->unk_212 = 30; + this->attentionCooldown = 30; return; } } } - if (DECR(this->unk_212) == 0) { + if (DECR(this->attentionCooldown) == 0) { Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); EnGo_SetupAction(this, func_80A405CC); @@ -874,7 +874,7 @@ void func_80A405CC(EnGo* this, PlayState* play) { if (!(frame < lastFrame)) { this->skelAnime.curFrame = lastFrame; this->skelAnime.playSpeed = 0.0f; - this->unk_212 = Rand_S16Offset(30, 30); + this->attentionCooldown = Rand_S16Offset(30, 30); if ((ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BOMB_FLOWER) && !GET_INFTABLE(INFTABLE_EB)) { EnGo_SetupAction(this, func_80A40B1C); } else { @@ -909,7 +909,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { play->msgCtx.stateTimer = 4; play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else { - if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, play)) { + if ((DECR(this->attentionCooldown) == 0) && !EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; this->skelAnime.playSpeed *= ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f; @@ -932,13 +932,13 @@ void func_80A408D8(EnGo* this, PlayState* play) { this->skelAnime.curFrame = 12.0f; this->skelAnime.playSpeed = 0.0f; if (ENGO_GET_TYPE(this) != ENGO_TYPE_DMT_BIGGORON) { - this->unk_212 = 30; + this->attentionCooldown = 30; return; } } } - if (DECR(this->unk_212) == 0) { + if (DECR(this->attentionCooldown) == 0) { EnGo_SetupAction(this, func_80A40494); } else if (EnGo_IsCameraModified(this, play)) { EnGo_ReverseAnimation(this); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index c4cb7db68e2..cd0ddfd86ac 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -55,7 +55,7 @@ typedef struct EnGo { /* 0x020C */ s16 unk_20C; /* 0x020E */ s16 knockbackCooldown; /* 0x0210 */ s16 unk_210; - /* 0x0212 */ s16 unk_212; + /* 0x0212 */ s16 attentionCooldown; /* 0x0214 */ s16 blinkTimer; // unused /* 0x0216 */ s16 eyeTexIndex; // unused /* 0x0218 */ s16 waypoint; From 91d1382c88db832eed87e8411f24e6e00470ce29 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 23:27:59 +0100 Subject: [PATCH 17/68] Document EnGo `.unk_21E` as `.eyedropsTimer` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 4 ++-- src/overlays/actors/ovl_En_Go/z_en_go.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 49cf65b8d3f..3ec06e95a9d 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -890,7 +890,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { } else { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { EnGo_ChangeAnim(this, ENGO_ANIM_WALKING_LOOP); - this->unk_21E = 100; + this->eyedropsTimer = 100; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; EnGo_SetupAction(this, EnGo_Eyedrops); play->msgCtx.msgMode = MSGMODE_PAUSED; @@ -1027,7 +1027,7 @@ void func_80A40C78(EnGo* this, PlayState* play) { } void EnGo_Eyedrops(EnGo* this, PlayState* play) { - if (DECR(this->unk_21E) == 0) { + if (DECR(this->eyedropsTimer) == 0) { this->actor.textId = 0x305A; Message_ContinueTextbox(play, this->actor.textId); this->interactInfo.talkState = NPC_TALK_STATE_TALKING; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index cd0ddfd86ac..4a8d4334403 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -61,7 +61,7 @@ typedef struct EnGo { /* 0x0218 */ s16 waypoint; /* 0x021A */ s16 bounceCounter; /* 0x021C */ s16 bounceTimer; - /* 0x021E */ s16 unk_21E; + /* 0x021E */ s16 eyedropsTimer; /* 0x0220 */ s16 jointTable[GORON_LIMB_MAX]; /* 0x0244 */ s16 morphTable[GORON_LIMB_MAX]; /* 0x0268 */ EnGoEffect effects[EN_GO_EFFECT_COUNT]; From 705ff1b2af403be202dd46bf9da933efec4e015a Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 01:41:07 +0100 Subject: [PATCH 18/68] Document EnGo `.unk_210` as `.curledTimer` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 4 ++-- src/overlays/actors/ovl_En_Go/z_en_go.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 3ec06e95a9d..4a426e44a6d 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -794,7 +794,7 @@ void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play) { } void EnGo_CurledUp(EnGo* this, PlayState* play) { - if ((DECR(this->unk_210) == 0) && EnGo_IsCameraModified(this, play)) { + if ((DECR(this->curledTimer) == 0) && EnGo_IsCameraModified(this, play)) { Audio_PlaySfxGeneral(NA_SE_EN_GOLON_WAKE_UP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -855,7 +855,7 @@ void func_80A40494(EnGo* this, PlayState* play) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = 0.0f; this->skelAnime.curFrame = 0.0f; - this->unk_210 = Rand_S16Offset(30, 30); + this->curledTimer = Rand_S16Offset(30, 30); EnGo_SetupAction(this, EnGo_CurledUp); } } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 4a8d4334403..c9463016dfd 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -54,7 +54,7 @@ typedef struct EnGo { /* 0x0208 */ char unk_208[0x4]; /* 0x020C */ s16 unk_20C; /* 0x020E */ s16 knockbackCooldown; - /* 0x0210 */ s16 unk_210; + /* 0x0210 */ s16 curledTimer; /* 0x0212 */ s16 attentionCooldown; /* 0x0214 */ s16 blinkTimer; // unused /* 0x0216 */ s16 eyeTexIndex; // unused From 8fb7fc2618de18b31aa28be694acb6e69379f1a9 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 01:45:42 +0100 Subject: [PATCH 19/68] Document EnGo `.unk_20C` as `.gaveSword` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 6 +++--- src/overlays/actors/ovl_En_Go/z_en_go.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 4a426e44a6d..571096b873f 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -981,11 +981,11 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { this->actor.parent = NULL; EnGo_SetupAction(this, func_80A40C78); } else { - this->unk_20C = 0; + this->gaveSword = 0; if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) { getItemId = GI_SWORD_BIGGORON; - this->unk_20C = 1; + this->gaveSword = 1; } if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { getItemId = GI_CLAIM_CHECK; @@ -1010,7 +1010,7 @@ void func_80A40C78(EnGo* this, PlayState* play) { EnGo_SetupAction(this, EnGo_BiggoronActionFunc); if (ENGO_GET_TYPE(this) != ENGO_TYPE_DMT_BIGGORON) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - } else if (this->unk_20C) { + } else if (this->gaveSword) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; gSaveContext.save.info.playerData.bgsFlag = true; } else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) { diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index c9463016dfd..fb1a679e343 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -52,7 +52,7 @@ typedef struct EnGo { /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ NpcInteractInfo interactInfo; /* 0x0208 */ char unk_208[0x4]; - /* 0x020C */ s16 unk_20C; + /* 0x020C */ s16 gaveSword; /* 0x020E */ s16 knockbackCooldown; /* 0x0210 */ s16 curledTimer; /* 0x0212 */ s16 attentionCooldown; From 4a793fa94d46c47402cbbda4d2e202f0f049f441 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 01:01:56 +0100 Subject: [PATCH 20/68] `EnGo_IsCameraModified` -> `EnGo_IsAttentionDrawn` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 571096b873f..41950b0cad3 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -439,7 +439,7 @@ void EnGo_UpdateBlinking(EnGo* this) { } } -s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) { +s32 EnGo_IsAttentionDrawn(EnGo* this, PlayState* play) { f32 xyzDistSq; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; @@ -459,9 +459,9 @@ s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) { Camera_RequestSetting(mainCam, CAM_SET_NORMAL0); } return 0; - } else { - return 1; } + + return 1; } void EnGo_ReverseAnimation(EnGo* this) { @@ -794,7 +794,7 @@ void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play) { } void EnGo_CurledUp(EnGo* this, PlayState* play) { - if ((DECR(this->curledTimer) == 0) && EnGo_IsCameraModified(this, play)) { + if ((DECR(this->curledTimer) == 0) && EnGo_IsAttentionDrawn(this, play)) { Audio_PlaySfxGeneral(NA_SE_EN_GOLON_WAKE_UP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -833,7 +833,7 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); EnGo_SetupAction(this, func_80A405CC); - } else if (!EnGo_IsCameraModified(this, play)) { + } else if (!EnGo_IsAttentionDrawn(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = 0.0f; EnGo_SetupAction(this, func_80A40494); @@ -909,7 +909,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { play->msgCtx.stateTimer = 4; play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else { - if ((DECR(this->attentionCooldown) == 0) && !EnGo_IsCameraModified(this, play)) { + if ((DECR(this->attentionCooldown) == 0) && !EnGo_IsAttentionDrawn(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; this->skelAnime.playSpeed *= ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f; @@ -940,7 +940,7 @@ void func_80A408D8(EnGo* this, PlayState* play) { if (DECR(this->attentionCooldown) == 0) { EnGo_SetupAction(this, func_80A40494); - } else if (EnGo_IsCameraModified(this, play)) { + } else if (EnGo_IsAttentionDrawn(this, play)) { EnGo_ReverseAnimation(this); Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); From c794de2a02f923e563ffd7e5343b55906a94ce1f Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 01:26:22 +0100 Subject: [PATCH 21/68] Document EnGo play speed factor --- src/overlays/actors/ovl_En_Go/z_en_go.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 41950b0cad3..05037583c9d 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -101,6 +101,8 @@ typedef enum EnGoType { #define ENGO2_CAGED_FLAG(this) PARAMS_GET_NOMASK((this)->actor.params, 8) #define ENGO2_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO2_CAGED_FLAG(this)) +#define ENGO_GET_SPEED_SCALE(this) (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) + void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -368,8 +370,8 @@ s32 EnGo_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 intera void EnGo_ChangeAnim(EnGo* this, s32 index) { Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, - sAnimationInfo[index].playSpeed * (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f), - 0.0f, Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, + sAnimationInfo[index].playSpeed * ENGO_GET_SPEED_SCALE(this), 0.0f, + Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); } @@ -799,7 +801,7 @@ void EnGo_CurledUp(EnGo* this, PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->skelAnime.playSpeed = 0.1f; - this->skelAnime.playSpeed *= ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f; + this->skelAnime.playSpeed *= ENGO_GET_SPEED_SCALE(this); EnGo_SetupAction(this, EnGo_WakeUp); if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { @@ -812,8 +814,7 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { - Math_SmoothStepToF(&this->skelAnime.playSpeed, - (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) * 0.5f, 0.1f, 1000.0f, 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, ENGO_GET_SPEED_SCALE(this) * 0.5f, 0.1f, 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -843,8 +844,7 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { void func_80A40494(EnGo* this, PlayState* play) { f32 frame; - Math_SmoothStepToF(&this->skelAnime.playSpeed, - (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) * -0.5f, 0.1f, 1000.0f, 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, ENGO_GET_SPEED_SCALE(this) * -0.5f, 0.1f, 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -865,8 +865,7 @@ void func_80A405CC(EnGo* this, PlayState* play) { f32 frame; lastFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); - Math_SmoothStepToF(&this->skelAnime.playSpeed, ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f, 0.1f, - 1000.0f, 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, ENGO_GET_SPEED_SCALE(this), 0.1f, 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; @@ -912,7 +911,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { if ((DECR(this->attentionCooldown) == 0) && !EnGo_IsAttentionDrawn(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; - this->skelAnime.playSpeed *= ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f; + this->skelAnime.playSpeed *= ENGO_GET_SPEED_SCALE(this); EnGo_SetupAction(this, func_80A408D8); } } @@ -922,8 +921,7 @@ void func_80A408D8(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { - Math_SmoothStepToF(&this->skelAnime.playSpeed, - (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) * -1.0f, 0.1f, 1000.0f, 0.1f); + Math_SmoothStepToF(&this->skelAnime.playSpeed, ENGO_GET_SPEED_SCALE(this) * -1.0f, 0.1f, 1000.0f, 0.1f); frame = this->skelAnime.curFrame; frame += this->skelAnime.playSpeed; if (frame >= 12.0f) { From d9bd40d1042a7d383d26c009348437c6887352eb Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 10 Nov 2024 20:35:55 +0100 Subject: [PATCH 22/68] Document EnGo funtions based on the context --- src/overlays/actors/ovl_En_Go/z_en_go.c | 147 ++++++++++++------------ 1 file changed, 76 insertions(+), 71 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 05037583c9d..40bdc6708fd 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -10,30 +10,32 @@ void EnGo_Destroy(Actor* thisx, PlayState* play); void EnGo_Update(Actor* thisx, PlayState* play); void EnGo_Draw(Actor* thisx, PlayState* play); -void func_80A3FEB4(EnGo* this, PlayState* play); -void EnGo_StopRolling(EnGo* this, PlayState* play); -void func_80A4008C(EnGo* this, PlayState* play); -void EnGo_GoronLinkRolling(EnGo* this, PlayState* play); -void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play); +void EnGo_RollingFar(EnGo* this, PlayState* play); +void EnGo_RollingNear(EnGo* this, PlayState* play); +void EnGo_RollingToCurledUp(EnGo* this, PlayState* play); +void EnGo_RollingLink(EnGo* this, PlayState* play); +void EnGo_GoronFireGeneric(EnGo* this, PlayState* play); void EnGo_CurledUp(EnGo* this, PlayState* play); -void EnGo_WakeUp(EnGo* this, PlayState* play); +void EnGo_AttentionDrawn(EnGo* this, PlayState* play); -void func_80A40494(EnGo* this, PlayState* play); -void func_80A405CC(EnGo* this, PlayState* play); -void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play); -void func_80A408D8(EnGo* this, PlayState* play); +void EnGo_CurlUp(EnGo* this, PlayState* play); +void EnGo_Sitting(EnGo* this, PlayState* play); +void EnGo_Standing(EnGo* this, PlayState* play); +void EnGo_LostAttention(EnGo* this, PlayState* play); -void func_80A40B1C(EnGo* this, PlayState* play); +void EnGo_GoronDmtBombFlower(EnGo* this, PlayState* play); +void EnGo_Interact(EnGo* this, PlayState* play); void EnGo_GetItem(EnGo* this, PlayState* play); -void func_80A40C78(EnGo* this, PlayState* play); -void EnGo_Eyedrops(EnGo* this, PlayState* play); -void func_80A40DCC(EnGo* this, PlayState* play); +void EnGo_TakingEyedrops(EnGo* this, PlayState* play); +void EnGo_EyedropsTaken(EnGo* this, PlayState* play); void EnGo_SpawnEffectDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep); void EnGo_UpdateEffects(EnGo* this); void EnGo_DrawEffects(EnGo* this, PlayState* play); +// @unused: unlike `ACTOR_EN_GO2`, this one doesn't participate in any scene whatsoever +// besides, this code bears a handful of bugs and WIP code; see `z_en_go2.c` instead ActorProfile En_Go_Profile = { /**/ ACTOR_EN_GO, /**/ ACTORCAT_NPC, @@ -414,12 +416,12 @@ f32 EnGo_GetPlayerTrackingYOffset(EnGo* this) { } } -void func_80A3F060(EnGo* this, PlayState* play) { +void EnGo_TrackPlayer(EnGo* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 trackingMode; - if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc && - this->actionFunc != func_80A40B1C) { + if (this->actionFunc != EnGo_Standing && this->actionFunc != EnGo_GoronFireGeneric && + this->actionFunc != EnGo_GoronDmtBombFlower) { trackingMode = NPC_TRACKING_NONE; } @@ -600,15 +602,15 @@ s32 EnGo_IsRollingOnGround(EnGo* this, s16 bounceCount, f32 boundSpeed) { } } -void func_80A3F908(EnGo* this, PlayState* play) { +void EnGo_UpdateInteraction(EnGo* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 interactRange; s32 dialogStarted; - if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_GoronLinkRolling || - this->actionFunc == EnGo_FireGenericActionFunc || this->actionFunc == EnGo_Eyedrops || - this->actionFunc == func_80A40DCC || this->actionFunc == EnGo_GetItem || this->actionFunc == func_80A40C78 || - this->actionFunc == func_80A40B1C) { + if (this->actionFunc == EnGo_Standing || this->actionFunc == EnGo_RollingLink || + this->actionFunc == EnGo_GoronFireGeneric || this->actionFunc == EnGo_TakingEyedrops || + this->actionFunc == EnGo_EyedropsTaken || this->actionFunc == EnGo_Interact || + this->actionFunc == EnGo_GetItem || this->actionFunc == EnGo_GoronDmtBombFlower) { interactRange = (this->collider.dim.radius + 30.0f); interactRange *= (this->actor.scale.x / 0.01f); @@ -686,13 +688,13 @@ void EnGo_Init(Actor* thisx, PlayState* play) { } else { this->actor.shape.yOffset = 1400.0f; this->actor.speed = 3.0f; - EnGo_SetupAction(this, EnGo_GoronLinkRolling); + EnGo_SetupAction(this, EnGo_RollingLink); } break; case ENGO_TYPE_FIRE_GENERIC: this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); Actor_SetScale(&this->actor, 0.01f); - EnGo_SetupAction(this, EnGo_FireGenericActionFunc); + EnGo_SetupAction(this, EnGo_GoronFireGeneric); break; case ENGO_TYPE_DMT_BOMB_FLOWER: if (GET_INFTABLE(INFTABLE_EB)) { @@ -704,7 +706,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { case ENGO_TYPE_DMT_ROLLING_SMALL: this->actor.shape.yOffset = 1400.0f; Actor_SetScale(&this->actor, 0.01f); - EnGo_SetupAction(this, func_80A3FEB4); + EnGo_SetupAction(this, EnGo_RollingFar); break; case ENGO_TYPE_DMT_BIGGORON: this->actor.attentionRangeType = ATTENTION_RANGE_5; @@ -730,13 +732,13 @@ void EnGo_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80A3FEB4(EnGo* this, PlayState* play) { +void EnGo_RollingFar(EnGo* this, PlayState* play) { if (!(this->actor.xyzDistToPlayerSq > SQ(1200.0f))) { - EnGo_SetupAction(this, EnGo_StopRolling); + EnGo_SetupAction(this, EnGo_RollingNear); } } -void EnGo_StopRolling(EnGo* this, PlayState* play) { +void EnGo_RollingNear(EnGo* this, PlayState* play) { EnBom* bomb; if (DECR(this->knockbackCooldown) == 0) { @@ -757,7 +759,7 @@ void EnGo_StopRolling(EnGo* this, PlayState* play) { } this->actor.speed = 0.0f; - EnGo_SetupAction(this, func_80A4008C); + EnGo_SetupAction(this, EnGo_RollingToCurledUp); } this->actor.shape.rot = this->actor.world.rot; @@ -767,7 +769,7 @@ void EnGo_StopRolling(EnGo* this, PlayState* play) { } } -void func_80A4008C(EnGo* this, PlayState* play) { +void EnGo_RollingToCurledUp(EnGo* this, PlayState* play) { if (EnGo_IsRollingOnGround(this, 3, 6.0f)) { if (this->bounceCounter == 0) { this->actor.shape.yOffset = 0.0f; @@ -778,10 +780,10 @@ void func_80A4008C(EnGo* this, PlayState* play) { } } -void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) { +void EnGo_RollingLink(EnGo* this, PlayState* play) { if ((EnGo_FollowPath(this, play) == true) && ENGO2_IS_CAGE_OPEN(this, play) && (this->waypoint == 0)) { this->actor.speed = 0.0f; - EnGo_SetupAction(this, func_80A4008C); + EnGo_SetupAction(this, EnGo_RollingToCurledUp); SET_INFTABLE(INFTABLE_109); } @@ -792,7 +794,7 @@ void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) { } } -void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play) { +void EnGo_GoronFireGeneric(EnGo* this, PlayState* play) { } void EnGo_CurledUp(EnGo* this, PlayState* play) { @@ -803,14 +805,14 @@ void EnGo_CurledUp(EnGo* this, PlayState* play) { this->skelAnime.playSpeed = 0.1f; this->skelAnime.playSpeed *= ENGO_GET_SPEED_SCALE(this); - EnGo_SetupAction(this, EnGo_WakeUp); + EnGo_SetupAction(this, EnGo_AttentionDrawn); if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN); } } } -void EnGo_WakeUp(EnGo* this, PlayState* play) { +void EnGo_AttentionDrawn(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { @@ -833,15 +835,15 @@ void EnGo_WakeUp(EnGo* this, PlayState* play) { if (DECR(this->attentionCooldown) == 0) { Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - EnGo_SetupAction(this, func_80A405CC); + EnGo_SetupAction(this, EnGo_Sitting); } else if (!EnGo_IsAttentionDrawn(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = 0.0f; - EnGo_SetupAction(this, func_80A40494); + EnGo_SetupAction(this, EnGo_CurlUp); } } -void func_80A40494(EnGo* this, PlayState* play) { +void EnGo_CurlUp(EnGo* this, PlayState* play) { f32 frame; Math_SmoothStepToF(&this->skelAnime.playSpeed, ENGO_GET_SPEED_SCALE(this) * -0.5f, 0.1f, 1000.0f, 0.1f); @@ -860,7 +862,7 @@ void func_80A40494(EnGo* this, PlayState* play) { } } -void func_80A405CC(EnGo* this, PlayState* play) { +void EnGo_Sitting(EnGo* this, PlayState* play) { f32 lastFrame; f32 frame; @@ -875,36 +877,37 @@ void func_80A405CC(EnGo* this, PlayState* play) { this->skelAnime.playSpeed = 0.0f; this->attentionCooldown = Rand_S16Offset(30, 30); if ((ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BOMB_FLOWER) && !GET_INFTABLE(INFTABLE_EB)) { - EnGo_SetupAction(this, func_80A40B1C); + EnGo_SetupAction(this, EnGo_GoronDmtBombFlower); } else { - EnGo_SetupAction(this, EnGo_BiggoronActionFunc); + EnGo_SetupAction(this, EnGo_Standing); } } } -void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { +void EnGo_Standing(EnGo* this, PlayState* play) { if ((ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { if (gSaveContext.save.info.playerData.bgsFlag) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { + // @bug: `gGoronEyedropsLoopAnim` is not applied; see `z_en_go2.c` for the correct behaviour EnGo_ChangeAnim(this, ENGO_ANIM_WALKING_LOOP); this->eyedropsTimer = 100; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - EnGo_SetupAction(this, EnGo_Eyedrops); + EnGo_SetupAction(this, EnGo_TakingEyedrops); play->msgCtx.msgMode = MSGMODE_PAUSED; gSaveContext.subTimerState = SUBTIMER_STATE_OFF; OnePointCutscene_Init(play, 4190, -99, &this->actor, CAM_ID_MAIN); } else { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - EnGo_SetupAction(this, EnGo_GetItem); + EnGo_SetupAction(this, EnGo_Interact); Message_CloseTextbox(play); - EnGo_GetItem(this, play); + EnGo_Interact(this, play); } } } else if ((ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_LINK) && (this->interactInfo.talkState == NPC_TALK_STATE_ACTION)) { - EnGo_SetupAction(this, EnGo_GetItem); + EnGo_SetupAction(this, EnGo_Interact); play->msgCtx.stateTimer = 4; play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else { @@ -912,12 +915,12 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; this->skelAnime.playSpeed *= ENGO_GET_SPEED_SCALE(this); - EnGo_SetupAction(this, func_80A408D8); + EnGo_SetupAction(this, EnGo_LostAttention); } } } -void func_80A408D8(EnGo* this, PlayState* play) { +void EnGo_LostAttention(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { @@ -937,17 +940,17 @@ void func_80A408D8(EnGo* this, PlayState* play) { } if (DECR(this->attentionCooldown) == 0) { - EnGo_SetupAction(this, func_80A40494); + EnGo_SetupAction(this, EnGo_CurlUp); } else if (EnGo_IsAttentionDrawn(this, play)) { EnGo_ReverseAnimation(this); Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->skelAnime.playSpeed = 0.0f; - EnGo_SetupAction(this, func_80A405CC); + EnGo_SetupAction(this, EnGo_Sitting); } } -void func_80A40A54(EnGo* this, PlayState* play) { +void EnGo_Sidestep(EnGo* this, PlayState* play) { f32 float1 = ((f32)0x8000 / Animation_GetLastFrame(&gGoronSidestepLoopAnim)); f32 float2 = this->skelAnime.curFrame * float1; @@ -956,20 +959,20 @@ void func_80A40A54(EnGo* this, PlayState* play) { EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); this->actor.speed = 0.0f; - EnGo_SetupAction(this, EnGo_BiggoronActionFunc); + EnGo_SetupAction(this, EnGo_Standing); } } -void func_80A40B1C(EnGo* this, PlayState* play) { +void EnGo_GoronDmtBombFlower(EnGo* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_EB)) { EnGo_ChangeAnim(this, ENGO_ANIM_SIDESTEP_LOOP); - EnGo_SetupAction(this, func_80A40A54); + EnGo_SetupAction(this, EnGo_Sidestep); } else { - EnGo_BiggoronActionFunc(this, play); + EnGo_Standing(this, play); } } -void EnGo_GetItem(EnGo* this, PlayState* play) { +void EnGo_Interact(EnGo* this, PlayState* play) { f32 xzDist; f32 yDist; s32 getItemId; @@ -977,7 +980,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->interactInfo.talkState = NPC_TALK_STATE_ACTION; this->actor.parent = NULL; - EnGo_SetupAction(this, func_80A40C78); + EnGo_SetupAction(this, EnGo_GetItem); } else { this->gaveSword = 0; if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { @@ -1003,9 +1006,9 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { } } -void func_80A40C78(EnGo* this, PlayState* play) { +void EnGo_GetItem(EnGo* this, PlayState* play) { if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) { - EnGo_SetupAction(this, EnGo_BiggoronActionFunc); + EnGo_SetupAction(this, EnGo_Standing); if (ENGO_GET_TYPE(this) != ENGO_TYPE_DMT_BIGGORON) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else if (this->gaveSword) { @@ -1024,22 +1027,23 @@ void func_80A40C78(EnGo* this, PlayState* play) { } } -void EnGo_Eyedrops(EnGo* this, PlayState* play) { +void EnGo_TakingEyedrops(EnGo* this, PlayState* play) { if (DECR(this->eyedropsTimer) == 0) { + // @bug: `gGoronEyedropsTakenAnim` is not applied; see `z_en_go2.c` for the correct behaviour this->actor.textId = 0x305A; Message_ContinueTextbox(play, this->actor.textId); this->interactInfo.talkState = NPC_TALK_STATE_TALKING; - EnGo_SetupAction(this, func_80A40DCC); + EnGo_SetupAction(this, EnGo_EyedropsTaken); } } -void func_80A40DCC(EnGo* this, PlayState* play) { +void EnGo_EyedropsTaken(EnGo* this, PlayState* play) { if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); Message_CloseTextbox(play); - EnGo_SetupAction(this, EnGo_GetItem); - EnGo_GetItem(this, play); + EnGo_SetupAction(this, EnGo_Interact); + EnGo_Interact(this, play); } } @@ -1051,8 +1055,8 @@ void EnGo_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); - if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc || - this->actionFunc == func_80A40B1C) { + if (this->actionFunc == EnGo_Standing || this->actionFunc == EnGo_GoronFireGeneric || + this->actionFunc == EnGo_GoronDmtBombFlower) { func_80034F54(play, this->jointTable, this->morphTable, GORON_LIMB_MAX); } @@ -1064,9 +1068,9 @@ void EnGo_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); EnGo_UpdateBlinking(this); - func_80A3F908(this, play); + EnGo_UpdateInteraction(this, play); this->actionFunc(this, play); - func_80A3F060(this, play); + EnGo_TrackPlayer(this, play); } void EnGo_DrawCurledUp(EnGo* this, PlayState* play) { @@ -1154,13 +1158,14 @@ void EnGo_Draw(Actor* thisx, PlayState* play) { return; } - if (this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == func_80A3FEB4 || - this->actionFunc == EnGo_StopRolling || this->actionFunc == func_80A3FEB4) { + // @bug? should've been `EnGo_RollingToCurledUp` instead of the second `EnGo_RollingFar` + if (this->actionFunc == EnGo_RollingLink || this->actionFunc == EnGo_RollingFar || + this->actionFunc == EnGo_RollingNear || this->actionFunc == EnGo_RollingFar) { EnGo_DrawRolling(this, play); return; } - // draw normal + // draw skeleton normally { Gfx_SetupDL_37Opa(play->state.gfxCtx); From 686f367f1b091a1a5417eccc855a18cbfdc12694 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 12:36:37 +0100 Subject: [PATCH 23/68] prepare EnGo2's `*_Draw` function --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 63 +++++++++++++---------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 6c4756e7206..a8ec3c6fda6 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -42,16 +42,16 @@ void EnGo2_Update(Actor* thisx, PlayState* play); void EnGo2_Draw(Actor* thisx, PlayState* play); void EnGo2_StopRolling(EnGo2* this, PlayState* play); -void EnGo2_CurledUp(EnGo2* this, PlayState* play); +void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play); void func_80A46B40(EnGo2* this, PlayState* play); void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, PlayState* play); void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play); -void EnGo2_ContinueRolling(EnGo2* this, PlayState* play); -void EnGo2_SlowRolling(EnGo2* this, PlayState* play); +void EnGo2_ActionRollingContinue(EnGo2* this, PlayState* play); +void EnGo2_ActionRollingSlow(EnGo2* this, PlayState* play); void EnGo2_GroundRolling(EnGo2* this, PlayState* play); -void EnGo2_ReverseRolling(EnGo2* this, PlayState* play); +void EnGo2_ActionRollingReverse(EnGo2* this, PlayState* play); void EnGo2_SetupGetItem(EnGo2* this, PlayState* play); void EnGo2_SetGetItem(EnGo2* this, PlayState* play); void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play); @@ -887,8 +887,8 @@ s32 func_80A44AB0(EnGo2* this, PlayState* play) { if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { return false; } else { - if ((this->actionFunc != EnGo2_SlowRolling) && (this->actionFunc != EnGo2_ReverseRolling) && - (this->actionFunc != EnGo2_ContinueRolling)) { + if ((this->actionFunc != EnGo2_ActionRollingSlow) && (this->actionFunc != EnGo2_ActionRollingReverse) && + (this->actionFunc != EnGo2_ActionRollingContinue)) { return false; } else { if (this->collider.base.acFlags & AC_HIT) { @@ -907,7 +907,7 @@ s32 func_80A44AB0(EnGo2* this, PlayState* play) { if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - arg2 = this->actionFunc == EnGo2_ContinueRolling ? 1.5f : this->actor.speed * 1.5f; + arg2 = this->actionFunc == EnGo2_ActionRollingContinue ? 1.5f : this->actor.speed * 1.5f; play->damagePlayer(play, -4); Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); @@ -1118,7 +1118,7 @@ void EnGo2_RollForward(EnGo2* this) { this->actor.speed = 0.0f; } - if (this->actionFunc != EnGo2_ContinueRolling) { + if (this->actionFunc != EnGo2_ActionRollingContinue) { Actor_MoveXZGravity(&this->actor); } @@ -1316,7 +1316,7 @@ void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { this->trackingMode = NPC_TRACKING_NONE; this->unk_211 = false; this->isAwake = false; - this->actionFunc = EnGo2_CurledUp; + this->actionFunc = EnGo2_ActionCurledUp; } void EnGo2_WakeUp(EnGo2* this, PlayState* play) { @@ -1359,7 +1359,7 @@ void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { this->animTimer = 10; this->actor.shape.yOffset = 1800.0f; this->actor.speed *= 2.0f; // Speeding up - this->actionFunc = EnGo2_ContinueRolling; + this->actionFunc = EnGo2_ActionRollingContinue; } void EnGo2_StopRolling(EnGo2* this, PlayState* play) { @@ -1568,7 +1568,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && LINK_IS_ADULT) { Actor_Kill(&this->actor); } - this->actionFunc = EnGo2_CurledUp; + this->actionFunc = EnGo2_ActionCurledUp; break; case GORON_MARKET_BAZAAR: if ((LINK_IS_ADULT) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { @@ -1584,7 +1584,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { EnGo2_GetItemAnimation(this, play); } else { - this->actionFunc = EnGo2_CurledUp; + this->actionFunc = EnGo2_ActionCurledUp; } } else { #if OOT_VERSION >= PAL_1_1 @@ -1605,7 +1605,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } else { this->isAwake = true; - this->actionFunc = EnGo2_CurledUp; + this->actionFunc = EnGo2_ActionCurledUp; } break; case GORON_DMT_BIGGORON: @@ -1617,7 +1617,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { } this->collider.base.acFlags = AC_NONE; this->collider.base.ocFlags1 = OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER; - this->actionFunc = EnGo2_CurledUp; + this->actionFunc = EnGo2_ActionCurledUp; break; case GORON_DMT_BOMB_FLOWER: if (GET_INFTABLE(INFTABLE_EB)) { @@ -1628,7 +1628,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { case GORON_DMT_DC_ENTRANCE: case GORON_DMT_FAIRY_HINT: default: - this->actionFunc = EnGo2_CurledUp; + this->actionFunc = EnGo2_ActionCurledUp; break; } } @@ -1636,7 +1636,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { void EnGo2_Destroy(Actor* thisx, PlayState* play) { } -void EnGo2_CurledUp(EnGo2* this, PlayState* play) { +void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play) { u8 index = PARAMS_GET_S(this->actor.params, 0, 5); s16 height; s32 quakeIndex; @@ -1723,26 +1723,26 @@ void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play) { } } -void EnGo2_ContinueRolling(EnGo2* this, PlayState* play) { +void EnGo2_ActionRollingContinue(EnGo2* this, PlayState* play) { f32 float1 = 1000.0f; if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_ROLLING_SMALL || !(this->actor.xyzDistToPlayerSq > SQ(float1))) && DECR(this->animTimer) == 0) { - this->actionFunc = EnGo2_SlowRolling; + this->actionFunc = EnGo2_ActionRollingSlow; this->actor.speed *= 0.5f; // slowdown } EnGo2_GetDustData(this, 2); } -void EnGo2_SlowRolling(EnGo2* this, PlayState* play) { +void EnGo2_ActionRollingSlow(EnGo2* this, PlayState* play) { s32 orientation; s32 index; if (!EnGo2_IsRolling(this)) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 1) == true) { if (EnGo2_IsGoronLinkReversing(this)) { - this->actionFunc = EnGo2_ReverseRolling; + this->actionFunc = EnGo2_ActionRollingReverse; return; } EnGo2_GetDustData(this, 3); @@ -1776,13 +1776,13 @@ void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { EnGo2_WakeUp(this, play); break; default: - this->actionFunc = EnGo2_CurledUp; + this->actionFunc = EnGo2_ActionCurledUp; } } } } -void EnGo2_ReverseRolling(EnGo2* this, PlayState* play) { +void EnGo2_ActionRollingReverse(EnGo2* this, PlayState* play) { if (!EnGo2_IsRolling(this)) { Math_ApproachF(&this->actor.speed, 0.0f, 0.6f, 0.8f); if (this->actor.speed >= 1.0f) { @@ -1907,7 +1907,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { this->trackingMode = NPC_TRACKING_NONE; this->unk_211 = false; this->isAwake = false; - this->actionFunc = EnGo2_CurledUp; + this->actionFunc = EnGo2_ActionCurledUp; } } @@ -2028,7 +2028,7 @@ s32 EnGo2_DrawRolling(EnGo2* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2914); Gfx_SetupDL_25Opa(play->state.gfxCtx); - speedXZ = this->actionFunc == EnGo2_ReverseRolling ? 0.0f : this->actor.speed; + speedXZ = this->actionFunc == EnGo2_ActionRollingReverse ? 0.0f : this->actor.speed; Matrix_RotateZYX((play->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go2.c", 2926); gSPDisplayList(POLY_OPA_DISP++, gGoronRollingDL); @@ -2079,14 +2079,21 @@ void EnGo2_Draw(Actor* thisx, PlayState* play) { EnGo2_DrawEffects(this, play); Matrix_Pop(); - if ((this->actionFunc == EnGo2_CurledUp) && (this->skelAnime.playSpeed == 0.0f) && + if ((this->actionFunc == EnGo2_ActionCurledUp) && (this->skelAnime.playSpeed == 0.0f) && (this->skelAnime.curFrame == 0.0f)) { if (1) {} EnGo2_DrawCurledUp(this, play); - } else if (this->actionFunc == EnGo2_SlowRolling || this->actionFunc == EnGo2_ReverseRolling || - this->actionFunc == EnGo2_ContinueRolling) { + return; + } + + if (this->actionFunc == EnGo2_ActionRollingSlow || this->actionFunc == EnGo2_ActionRollingReverse || + this->actionFunc == EnGo2_ActionRollingContinue) { EnGo2_DrawRolling(this, play); - } else { + return; + } + + // draw skeleton normally + { OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 3063); Gfx_SetupDL_25Opa(play->state.gfxCtx); From 2cc0e12364ec0ac451f2bb052c97e7cc4c455b64 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 12:41:19 +0100 Subject: [PATCH 24/68] Document bouncing in `EnGo2_IsRollingOnGround` --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 60 +++++++++++++---------- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 4 +- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index a8ec3c6fda6..459b2e375c5 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -988,42 +988,48 @@ s32 EnGo2_IsWakingUp(EnGo2* this) { } } -s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 arg1, f32 arg2, s16 arg3) { +s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 boundSpeed, s16 rumble) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.velocity.y > 0.0f) { return false; } - if (DECR(this->unk_590)) { - if (!arg3) { + // rumble on odds and evens + if (DECR(this->bounceTimer)) { + if (!rumble) { return true; - } else { + } + + { this->actor.world.pos.y = - (this->unk_590 & 1) ? this->actor.world.pos.y + 1.5f : this->actor.world.pos.y - 1.5f; + (this->bounceTimer & 1) ? this->actor.world.pos.y + 1.5f : this->actor.world.pos.y - 1.5f; Actor_PlaySfx(&this->actor, NA_SE_EV_BIGBALL_ROLL - SFX_FLAG); return true; } } - if (this->unk_59C >= 2) { - Actor_PlaySfx(&this->actor, (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG) - ? NA_SE_EN_GOLON_LAND_BIG - : NA_SE_EN_DODO_M_GND); - } + // bounce! + { + if (this->bounceCounter >= 2) { + Actor_PlaySfx(&this->actor, (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG) + ? NA_SE_EN_GOLON_LAND_BIG + : NA_SE_EN_DODO_M_GND); + } - this->unk_59C--; - if (this->unk_59C <= 0) { - if (this->unk_59C == 0) { - this->unk_590 = Rand_S16Offset(60, 30); - this->unk_59C = 0; - this->actor.velocity.y = 0.0f; - return true; - } else { - this->unk_59C = arg1; + this->bounceCounter--; + if (this->bounceCounter <= 0) { + if (this->bounceCounter == 0) { + this->bounceTimer = Rand_S16Offset(60, 30); + this->bounceCounter = 0; + this->actor.velocity.y = 0.0f; + return true; + } else { + this->bounceCounter = bounceCount; + } } - } - this->actor.velocity.y = ((f32)this->unk_59C / (f32)arg1) * arg2; - return true; + this->actor.velocity.y = ((f32)this->bounceCounter / (f32)bounceCount) * boundSpeed; + return true; + } } void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { @@ -1379,8 +1385,8 @@ void EnGo2_StopRolling(EnGo2* this, PlayState* play) { } this->actor.shape.rot = this->actor.world.rot; - this->unk_59C = 0; - this->unk_590 = 0; + this->bounceCounter = 0; + this->bounceTimer = 0; this->actionFunc = EnGo2_GroundRolling; this->actor.shape.yOffset = 0.0f; this->actor.speed = 0.0f; @@ -1446,8 +1452,8 @@ s32 EnGo2_IsRolling(EnGo2* this) { return false; } if (EnGo2_IsRollingOnGround(this, 2, 20.0 / 3.0f, 0)) { - if ((this->unk_590 >= 9) && (this->unk_59C == 0)) { - this->unk_590 = 8; + if ((this->bounceTimer >= 9) && (this->bounceCounter == 0)) { + this->bounceTimer = 8; } EnGo2_GetDustData(this, 0); } @@ -1766,7 +1772,7 @@ void EnGo2_ActionRollingSlow(EnGo2* this, PlayState* play) { void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 0)) { EnGo2_GetDustData(this, 0); - if (this->unk_59C == 0) { + if (this->bounceCounter == 0) { switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_CITY_LINK: this->goronState = 0; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 7267cf4aed7..97cf21fc374 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -100,12 +100,12 @@ typedef struct EnGo2 { /* 0x04AC */ Vec3f subCamAt; /* 0x04B8 */ Vec3s jointTable[GORON_LIMB_MAX]; /* 0x0524 */ Vec3s morphTable[GORON_LIMB_MAX]; - /* 0x0590 */ s16 unk_590; // timer + /* 0x0590 */ s16 bounceTimer; // timer /* 0x0592 */ s16 animTimer; // animTimer. Plays NA_SE_EN_MORIBLIN_WALK, NA_SE_EV_IRON_DOOR_OPEN, NA_SE_EV_IRON_DOOR_CLOSE /* 0x0594 */ s32 getItemId; /* 0x0598 */ char unk_598[0x02]; /* 0x059A */ s16 subCamId; - /* 0x059C */ s16 unk_59C; + /* 0x059C */ s16 bounceCounter; } EnGo2; // size = 0x05A0 #endif From 4ecd12d93c79171473711a6b536655122b4a1d4c Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 15:18:34 +0100 Subject: [PATCH 25/68] Document EnGo2 `.unk_211` as `.isUncurled` --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 14 +++++++------- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 11 ++++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 459b2e375c5..52b404f85ff 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1320,7 +1320,7 @@ void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { } EnGo2_SwapInitialFrameAnimFrameCount(this); this->trackingMode = NPC_TRACKING_NONE; - this->unk_211 = false; + this->isUncurled = false; this->isAwake = false; this->actionFunc = EnGo2_ActionCurledUp; } @@ -1346,7 +1346,7 @@ void EnGo2_WakeUp(EnGo2* this, PlayState* play) { void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); - this->unk_211 = true; + this->isUncurled = true; this->actionFunc = func_80A46B40; this->skelAnime.playSpeed = 0.0f; this->actor.speed = 0.0f; @@ -1559,7 +1559,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->alpha = this->actor.shape.shadowAlpha = 0; this->reverse = 0; this->isAwake = false; - this->unk_211 = false; + this->isUncurled = false; this->goronState = 0; this->waypoint = 0; this->unk_216 = this->actor.shape.rot.z; @@ -1680,7 +1680,7 @@ void func_80A46B40(EnGo2* this, PlayState* play) { u8 index = PARAMS_GET_S(this->actor.params, 0, 5); f32 height; - if (this->unk_211 == true) { + if (this->isUncurled == true) { EnGo2_BiggoronAnimation(this); EnGo2_GoronLinkAnimation(this, play); EnGo2_SelectGoronWakingUp(this); @@ -1698,7 +1698,7 @@ void func_80A46B40(EnGo2* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; } func_80A454CC(this); - this->unk_211 = true; + this->isUncurled = true; this->collider.dim.height = D_80A4816C[index].height; } else { height = D_80A4816C[index].height; @@ -1911,7 +1911,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { } else { SET_INFTABLE(INFTABLE_10C); this->trackingMode = NPC_TRACKING_NONE; - this->unk_211 = false; + this->isUncurled = false; this->isAwake = false; this->actionFunc = EnGo2_ActionCurledUp; } @@ -2006,7 +2006,7 @@ void EnGo2_Update(Actor* thisx, PlayState* play) { } #endif this->actionFunc(this, play); - if (this->unk_211 == true) { + if (this->isUncurled == true) { func_80034F54(play, this->unk_226, this->unk_24A, GORON_LIMB_MAX); } func_80A45288(this, play); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 97cf21fc374..d2f2012bfd1 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -40,7 +40,6 @@ typedef enum GoronType { // /* 0x0A */ GORON_FIRE_MAZE_UPPER, // /* 0x0B */ GORON_FIRE_HIGHEST - typedef struct EnGo2DataStruct1 { s16 unused; s16 yDist; @@ -77,9 +76,9 @@ typedef struct EnGo2 { /* 0x020C */ u8 unk_20C; // counter for GORON_CITY_LINK animation /* 0x020D */ u8 dialogState; /* 0x020E */ u8 reverse; - /* 0x020F */ u8 isAwake; // Conditional + /* 0x020F */ u8 isAwake; /* 0x0210 */ s8 waypoint; - /* 0x0211 */ u8 unk_211; // Conditional + /* 0x0211 */ u8 isUncurled; // goron link: 0 - rolling, 1 - frozen // biggoron: 0 - give eyedrops, 1 - applying eyedrops, 2 - getting claimcheck // generic fire: 0 - @@ -90,7 +89,8 @@ typedef struct EnGo2 { /* 0x0216 */ u8 unk_216; // Set to z rotation, checked by waypoint /* 0x0218 */ f32 interactRange; /* 0x021C */ char unk_21C[0x04]; - /* 0x0220 */ f32 alpha; // Set to 0, used by func_80A45360, smoothed to this->actor.shape.shadowAlpha from either 0 or 255.0f + /* 0x0220 */ f32 + alpha; // Set to 0, used by func_80A45360, smoothed to this->actor.shape.shadowAlpha from either 0 or 255.0f /* 0x0224 */ s16 blinkTimer; /* 0x0226 */ s16 unk_226[GORON_LIMB_MAX]; // Remains unknown /* 0x024A */ s16 unk_24A[GORON_LIMB_MAX]; // Remains unknown @@ -101,7 +101,8 @@ typedef struct EnGo2 { /* 0x04B8 */ Vec3s jointTable[GORON_LIMB_MAX]; /* 0x0524 */ Vec3s morphTable[GORON_LIMB_MAX]; /* 0x0590 */ s16 bounceTimer; // timer - /* 0x0592 */ s16 animTimer; // animTimer. Plays NA_SE_EN_MORIBLIN_WALK, NA_SE_EV_IRON_DOOR_OPEN, NA_SE_EV_IRON_DOOR_CLOSE + /* 0x0592 */ s16 + animTimer; // animTimer. Plays NA_SE_EN_MORIBLIN_WALK, NA_SE_EV_IRON_DOOR_OPEN, NA_SE_EV_IRON_DOOR_CLOSE /* 0x0594 */ s32 getItemId; /* 0x0598 */ char unk_598[0x02]; /* 0x059A */ s16 subCamId; From 50d3b8411589b647ba9818f0616f652b1fe91339 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 21:42:03 +0100 Subject: [PATCH 26/68] Document EnGo2 `.unk_216` as `.reverseWaypoint` --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 4 ++-- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 52b404f85ff..da76a6dad6d 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1440,7 +1440,7 @@ s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { } s32 EnGo2_IsGoronLinkReversing(EnGo2* this) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_LINK || (this->waypoint >= this->unk_216) || + if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_LINK || (this->waypoint >= this->reverseWaypoint) || !EnGo2_IsWakingUp(this)) { return false; } @@ -1562,7 +1562,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->isUncurled = false; this->goronState = 0; this->waypoint = 0; - this->unk_216 = this->actor.shape.rot.z; + this->reverseWaypoint = this->actor.shape.rot.z; this->trackingMode = NPC_TRACKING_NONE; this->path = Path_GetByIndex(play, PARAMS_GET_S(this->actor.params, 5, 5), 0x1F); switch (PARAMS_GET_S(this->actor.params, 0, 5)) { diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index d2f2012bfd1..34f40913834 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -86,7 +86,7 @@ typedef struct EnGo2 { /* 0x0213 */ u8 eyeMouthTexState; // 0, 1, 2, 3 /* 0x0214 */ u8 eyeTexIndex; /* 0x0215 */ u8 mouthTexIndex; - /* 0x0216 */ u8 unk_216; // Set to z rotation, checked by waypoint + /* 0x0216 */ u8 reverseWaypoint; // Set to z rotation, checked by waypoint /* 0x0218 */ f32 interactRange; /* 0x021C */ char unk_21C[0x04]; /* 0x0220 */ f32 From 7f30ab6ae5b3e35192bd9eb709b4816d7ac2fc72 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 21:46:28 +0100 Subject: [PATCH 27/68] redocument EnGo2 message states --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 28 +++++++++++------------ src/overlays/actors/ovl_En_Go2/z_en_go2.h | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index da76a6dad6d..c9f3ed09548 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -281,14 +281,14 @@ void EnGo2_GetItem(EnGo2* this, PlayState* play, s32 getItemId) { s32 EnGo2_GetDialogState(EnGo2* this, PlayState* play) { s16 dialogState = Message_GetState(&play->msgCtx); - if ((this->dialogState == TEXT_STATE_AWAITING_NEXT) || (this->dialogState == TEXT_STATE_EVENT) || - (this->dialogState == TEXT_STATE_CLOSING) || (this->dialogState == TEXT_STATE_DONE_HAS_NEXT)) { - if (dialogState != this->dialogState) { - this->unk_20C++; + if ((this->messageState == TEXT_STATE_AWAITING_NEXT) || (this->messageState == TEXT_STATE_EVENT) || + (this->messageState == TEXT_STATE_CLOSING) || (this->messageState == TEXT_STATE_DONE_HAS_NEXT)) { + if (dialogState != this->messageState) { + this->messageEntry++; } } - this->dialogState = dialogState; + this->messageState = dialogState; return dialogState; } @@ -492,8 +492,8 @@ u16 EnGo2_GetTextIdGoronCityLink(PlayState* play, EnGo2* this) { } else if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { return GET_INFTABLE(INFTABLE_10E) ? 0x3038 : 0x3037; } else if (GET_INFTABLE(INFTABLE_10C)) { - this->unk_20C = 0; - this->dialogState = TEXT_STATE_NONE; + this->messageEntry = 0; + this->messageState = TEXT_STATE_NONE; return GET_INFTABLE(INFTABLE_10A) ? 0x3033 : 0x3032; } else { return 0x3030; @@ -529,7 +529,7 @@ s16 EnGo2_UpdateTalkStateGoronCityLink(PlayState* play, EnGo2* this) { } } Message_ContinueTextbox(play, this->actor.textId); - this->unk_20C = 0; + this->messageEntry = 0; } } else { break; @@ -575,7 +575,7 @@ u16 EnGo2_GetTextIdGoronDmtBiggoron(PlayState* play, EnGo2* this) { s16 EnGo2_UpdateTalkStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { s32 unusedPad; - u8 dialogState = this->dialogState; + u8 dialogState = this->messageState; switch (EnGo2_GetDialogState(this, play)) { #if OOT_VERSION < PAL_1_0 @@ -1464,16 +1464,16 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, PlayState* play) { s32 animation = ARRAY_COUNT(sAnimationInfo); if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_LINK) { - if ((this->actor.textId == 0x3035 && this->unk_20C == 0) || - (this->actor.textId == 0x3036 && this->unk_20C == 0)) { + if ((this->actor.textId == 0x3035 && this->messageEntry == 0) || + (this->actor.textId == 0x3036 && this->messageEntry == 0)) { if (this->skelAnime.animation != &gGoronShakingLoopAnim) { animation = ENGO2_ANIM_SHAKING_LOOP; this->eyeMouthTexState = 0; } } - if ((this->actor.textId == 0x3032 && this->unk_20C == 12) || (this->actor.textId == 0x3033) || - (this->actor.textId == 0x3035 && this->unk_20C == 6)) { + if ((this->actor.textId == 0x3032 && this->messageEntry == 12) || (this->actor.textId == 0x3033) || + (this->actor.textId == 0x3035 && this->messageEntry == 6)) { if (this->skelAnime.animation != &gGoronSobbingLoopAnim) { animation = ENGO2_ANIM_SOBBING_LOOP; this->eyeMouthTexState = 1; @@ -1850,7 +1850,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { this->trackingMode = NPC_TRACKING_NONE; this->animTimer = this->skelAnime.endFrame + 60.0f + 60.0f; // eyeDrops animation timer this->eyeMouthTexState = 2; - this->unk_20C = 0; + this->messageEntry = 0; this->goronState++; Audio_SetMainBgmVolume(0x28, 5); OnePointCutscene_Init(play, 4190, -99, &this->actor, CAM_ID_MAIN); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 34f40913834..b6170ea1e5a 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -73,8 +73,8 @@ typedef struct EnGo2 { /* 0x0194 */ NpcInteractInfo interactInfo; /* 0x01BC */ ColliderCylinder collider; /* 0x0208 */ Path* path; - /* 0x020C */ u8 unk_20C; // counter for GORON_CITY_LINK animation - /* 0x020D */ u8 dialogState; + /* 0x020C */ u8 messageEntry; // tracks message state changes, like with `BOX_BREAK` or `TEXTID` + /* 0x020D */ u8 messageState; // last known result of `Message_GetState` /* 0x020E */ u8 reverse; /* 0x020F */ u8 isAwake; /* 0x0210 */ s8 waypoint; From 960c8b5d936cf3f7c5516cf479aa3dd7c67e87c1 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 21:56:31 +0100 Subject: [PATCH 28/68] move EnGo2 `.goronState` comments to the TU partially they already were there --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 10 +++++----- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 5 +---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index c9f3ed09548..e47862b0d0a 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1843,7 +1843,7 @@ void EnGo2_SetGetItem(EnGo2* this, PlayState* play) { void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { switch (this->goronState) { - case 0: + case 0: // give eyedrops Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_EYEDROPS_LOOP); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.shape.rot.y += 0x5B0; @@ -1855,7 +1855,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { Audio_SetMainBgmVolume(0x28, 5); OnePointCutscene_Init(play, 4190, -99, &this->actor, CAM_ID_MAIN); break; - case 1: + case 1: // applying eyedrops if (DECR(this->animTimer)) { if (this->animTimer == 60 || this->animTimer == 120) { Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); @@ -1870,7 +1870,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { Audio_SetMainBgmVolume(0x7F, 5); } break; - case 2: + case 2: // getting claimcheck if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->eyeMouthTexState = 0; } @@ -1892,7 +1892,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { Player* player = GET_PLAYER(play); switch (this->goronState) { - case 0: + case 0: // rolling if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { return; } else { @@ -1900,7 +1900,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { player->actor.freezeTimer = 10; this->goronState++; } - case 1: + case 1: // stunned break; default: return; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index b6170ea1e5a..531f1b1f82e 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -79,11 +79,8 @@ typedef struct EnGo2 { /* 0x020F */ u8 isAwake; /* 0x0210 */ s8 waypoint; /* 0x0211 */ u8 isUncurled; - // goron link: 0 - rolling, 1 - frozen - // biggoron: 0 - give eyedrops, 1 - applying eyedrops, 2 - getting claimcheck - // generic fire: 0 - /* 0x0212 */ u8 goronState; - /* 0x0213 */ u8 eyeMouthTexState; // 0, 1, 2, 3 + /* 0x0213 */ u8 eyeMouthTexState; /* 0x0214 */ u8 eyeTexIndex; /* 0x0215 */ u8 mouthTexIndex; /* 0x0216 */ u8 reverseWaypoint; // Set to z rotation, checked by waypoint From 3b0e2cec03287e39f602c1b03ad4a92d0ab78289 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 21:57:20 +0100 Subject: [PATCH 29/68] redocument EnGo2 `.alpha` as `.shadowAlpha` and `func_80A45360` as `EnGo2_UpdateShadowAlpha` --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 8 ++++---- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index e47862b0d0a..1aa6f7ca6d4 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1109,7 +1109,7 @@ void func_80A45288(EnGo2* this, PlayState* play) { } } -void func_80A45360(EnGo2* this, f32* alpha) { +void EnGo2_UpdateShadowAlpha(EnGo2* this, f32* alpha) { f32 alphaTarget = (this->skelAnime.animation == &gGoronUncurlSitStandAnim) && (this->skelAnime.curFrame <= 32.0f) ? 0.0f : 255.0f; @@ -1556,7 +1556,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { EnGo2_SetShape(this); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_IDLE); this->actor.gravity = -1.0f; - this->alpha = this->actor.shape.shadowAlpha = 0; + this->shadownAlpha = this->actor.shape.shadowAlpha = 0; this->reverse = 0; this->isAwake = false; this->isUncurled = false; @@ -1992,8 +1992,8 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { void EnGo2_Update(Actor* thisx, PlayState* play) { EnGo2* this = (EnGo2*)thisx; - func_80A45360(this, &this->alpha); - EnGo2_SitDownAnimation(this); + EnGo2_UpdateShadowAlpha(this, &this->shadownAlpha); + EnGo2_UpdateStandUpAnim(this); SkelAnime_Update(&this->skelAnime); EnGo2_RollForward(this); Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.height * 0.5f, this->collider.dim.radius * 0.6f, diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 531f1b1f82e..3b9a929a0f6 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -86,8 +86,7 @@ typedef struct EnGo2 { /* 0x0216 */ u8 reverseWaypoint; // Set to z rotation, checked by waypoint /* 0x0218 */ f32 interactRange; /* 0x021C */ char unk_21C[0x04]; - /* 0x0220 */ f32 - alpha; // Set to 0, used by func_80A45360, smoothed to this->actor.shape.shadowAlpha from either 0 or 255.0f + /* 0x0220 */ f32 shadownAlpha; /* 0x0224 */ s16 blinkTimer; /* 0x0226 */ s16 unk_226[GORON_LIMB_MAX]; // Remains unknown /* 0x024A */ s16 unk_24A[GORON_LIMB_MAX]; // Remains unknown From 787b2607220c9addfb96a569b8537dc0333f980b Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 15:09:56 +0100 Subject: [PATCH 30/68] `EnGo2_IsCameraModified`->`EnGo2_IsAttentionDrawn` --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 28 ++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 1aa6f7ca6d4..da3ad461325 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -962,7 +962,7 @@ s32 func_80A44D84(EnGo2* this) { return 1; } -s32 EnGo2_IsWakingUp(EnGo2* this) { +s32 EnGo2_IsAttentionDrawn(EnGo2* this) { s16 yawDiff; f32 xyzDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 800.0f : 200.0f; f32 yDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 400.0f : 60.0f; @@ -1165,14 +1165,14 @@ f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { } } -s32 EnGo2_IsCameraModified(EnGo2* this, PlayState* play) { +s32 EnGo2_IsAttentionDrawnExtented(EnGo2* this, PlayState* play) { Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { - if (EnGo2_IsWakingUp(this)) { + if (EnGo2_IsAttentionDrawn(this)) { Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW); Camera_UnsetStateFlag(mainCam, CAM_STATE_CHECK_BG); - } else if (!EnGo2_IsWakingUp(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { + } else if (!EnGo2_IsAttentionDrawn(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { Camera_RequestSetting(mainCam, CAM_SET_DUNGEON1); Camera_SetStateFlag(mainCam, CAM_STATE_CHECK_BG); } @@ -1184,15 +1184,17 @@ s32 EnGo2_IsCameraModified(EnGo2* this, PlayState* play) { PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON || PARAMS_GET_S(this->actor.params, 0, 5) == GORON_MARKET_BAZAAR) { return true; - } else if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { + } + + if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { return true; - } else { - return false; } + + return false; } void EnGo2_DefaultWakingUp(EnGo2* this) { - if (EnGo2_IsWakingUp(this)) { + if (EnGo2_IsAttentionDrawn(this)) { this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; } else { this->trackingMode = NPC_TRACKING_NONE; @@ -1219,7 +1221,7 @@ void EnGo2_WakingUp(EnGo2* this) { } void EnGo2_BiggoronWakingUp(EnGo2* this) { - if (EnGo2_IsWakingUp(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { + if (EnGo2_IsAttentionDrawn(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; this->isAwake = true; } else { @@ -1232,7 +1234,7 @@ void EnGo2_SelectGoronWakingUp(EnGo2* this) { switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_DMT_BOMB_FLOWER: this->isAwake = true; - this->trackingMode = EnGo2_IsWakingUp(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; + this->trackingMode = EnGo2_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; break; case GORON_FIRE_GENERIC: EnGo2_WakingUp(this); @@ -1441,7 +1443,7 @@ s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { s32 EnGo2_IsGoronLinkReversing(EnGo2* this) { if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_LINK || (this->waypoint >= this->reverseWaypoint) || - !EnGo2_IsWakingUp(this)) { + !EnGo2_IsAttentionDrawn(this)) { return false; } return true; @@ -1671,7 +1673,7 @@ void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play) { this->isAwake = false; EnGo2_WakeUp(this, play); } - if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_FIRE_GENERIC) && EnGo2_IsWakingUp(this)) { + if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_FIRE_GENERIC) && EnGo2_IsAttentionDrawn(this)) { EnGo2_WakeUp(this, play); } } @@ -1706,7 +1708,7 @@ void func_80A46B40(EnGo2* this, PlayState* play) { (s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f)); } } - if ((!EnGo2_IsCameraModified(this, play)) && (!EnGo2_IsWakingUp(this))) { + if ((!EnGo2_IsAttentionDrawnExtented(this, play)) && (!EnGo2_IsAttentionDrawn(this))) { EnGo2_RollingAnimation(this, play); } } From 7510ed085265661836e2c99bb64b5948421929e4 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 17:41:39 +0100 Subject: [PATCH 31/68] redocument EnGo2 subtypes as an enum --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 134 +++++++++++----------- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 17 --- 2 files changed, 70 insertions(+), 81 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index da3ad461325..94ce84a3697 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -149,6 +149,24 @@ static AnimationInfo sAnimationInfo[] = { { &gGoronShakingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, }; +#define ENGO2_GET_TYPE(this) PARAMS_GET_S((this)->actor.params, 0, 5) +typedef enum GoronType { + /* 0x00 */ GORON_CITY_ROLLING_BIG, + /* 0x01 */ GORON_CITY_LINK, + /* 0x02 */ GORON_DMT_BIGGORON, + /* 0x03 */ GORON_FIRE_GENERIC, + /* 0x04 */ GORON_DMT_BOMB_FLOWER, + /* 0x05 */ GORON_DMT_ROLLING_SMALL, + /* 0x06 */ GORON_DMT_DC_ENTRANCE, + /* 0x07 */ GORON_CITY_ENTRANCE, + /* 0x08 */ GORON_CITY_ISLAND, + /* 0x09 */ GORON_CITY_LOWEST_FLOOR, + /* 0x0A */ GORON_CITY_STAIRWELL, + /* 0x0B */ GORON_CITY_LOST_WOODS, + /* 0x0C */ GORON_DMT_FAIRY_HINT, + /* 0x0D */ GORON_MARKET_BAZAAR +} GoronType; + static EnGo2DustEffectData sDustEffectData[2][4] = { { { 12, 0.2f, 0.2f, 1, 18.0f, 0.0f }, @@ -742,7 +760,7 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { if (textId != 0) { return textId; } else { - switch (PARAMS_GET_S(this->actor.params, 0, 5)) { + switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_ROLLING_BIG: return EnGo2_GetTextIdGoronCityRollingBig(play, this); case GORON_CITY_LINK: @@ -780,7 +798,7 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; - switch (PARAMS_GET_S(this->actor.params, 0, 5)) { + switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_ROLLING_BIG: return EnGo2_UpdateTalkStateGoronCityRollingBig(play, this); case GORON_CITY_LINK: @@ -818,12 +836,10 @@ s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { } s32 func_80A44790(EnGo2* this, PlayState* play) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BIGGORON && - PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_ROLLING_BIG) { + if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON && ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG) { return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, EnGo2_GetTextId, EnGo2_UpdateTalkState); - } else if ((PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) && - !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { + } else if ((ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { return false; } else { if (Actor_TalkOfferAccepted(&this->actor, play)) { @@ -840,14 +856,14 @@ s32 func_80A44790(EnGo2* this, PlayState* play) { } void EnGo2_SetColliderDim(EnGo2* this) { - u8 index = PARAMS_GET_S(this->actor.params, 0, 5); + u8 index = ENGO2_GET_TYPE(this); this->collider.dim.radius = D_80A4816C[index].radius; this->collider.dim.height = D_80A4816C[index].height; } void EnGo2_SetShape(EnGo2* this) { - u8 index = PARAMS_GET_S(this->actor.params, 0, 5); + u8 index = ENGO2_GET_TYPE(this); this->actor.shape.shadowScale = D_80A481F8[index].shape_unk_10; Actor_SetScale(&this->actor, D_80A481F8[index].scale); @@ -863,10 +879,10 @@ void EnGo2_CheckCollision(EnGo2* this, PlayState* play) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z; - xzDist = D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].xzDist; + xzDist = D_80A4816C[ENGO2_GET_TYPE(this)].xzDist; pos.x += (s16)(xzDist * Math_SinS(this->actor.shape.rot.y)); pos.z += (s16)(xzDist * Math_CosS(this->actor.shape.rot.y)); - pos.y += D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].yDist; + pos.y += D_80A4816C[ENGO2_GET_TYPE(this)].yDist; this->collider.dim.pos = pos; CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); @@ -884,7 +900,7 @@ s32 func_80A44AB0(EnGo2* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 arg2; - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { return false; } else { if ((this->actionFunc != EnGo2_ActionRollingSlow) && (this->actionFunc != EnGo2_ActionRollingReverse) && @@ -964,11 +980,11 @@ s32 func_80A44D84(EnGo2* this) { s32 EnGo2_IsAttentionDrawn(EnGo2* this) { s16 yawDiff; - f32 xyzDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 800.0f : 200.0f; - f32 yDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 400.0f : 60.0f; + f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f; + f32 yDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 400.0f : 60.0f; s16 yawDiffAbs; - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { if (!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; return false; @@ -1010,9 +1026,8 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 boundSpeed, s16 ru // bounce! { if (this->bounceCounter >= 2) { - Actor_PlaySfx(&this->actor, (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG) - ? NA_SE_EN_GOLON_LAND_BIG - : NA_SE_EN_DODO_M_GND); + Actor_PlaySfx(&this->actor, (ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG) ? NA_SE_EN_GOLON_LAND_BIG + : NA_SE_EN_DODO_M_GND); } this->bounceCounter--; @@ -1035,7 +1050,7 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 boundSpeed, s16 ru void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { u16 textId; - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { if (gSaveContext.save.info.playerData.bgsFlag) { if (Player_GetExchangeItemId(play) == EXCH_ITEM_CLAIM_CHECK) { this->actor.textId = 0x3003; @@ -1099,7 +1114,7 @@ void func_80A45288(EnGo2* this, PlayState* play) { if (this->actionFunc != EnGo2_GoronFireGenericAction) { this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.yOffset = - sPlayerTrackingYOffsets[PARAMS_GET_S(this->actor.params, 0, 5)][((void)0, gSaveContext.save.linkAge)]; + sPlayerTrackingYOffsets[ENGO2_GET_TYPE(this)][((void)0, gSaveContext.save.linkAge)]; Npc_TrackPoint(&this->actor, &this->interactInfo, 4, this->trackingMode); } if ((this->actionFunc != EnGo2_SetGetItem) && (this->isAwake == true)) { @@ -1132,7 +1147,7 @@ void EnGo2_RollForward(EnGo2* this) { } void func_80A454CC(EnGo2* this) { - switch (PARAMS_GET_S(this->actor.params, 0, 5)) { + switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_ROLLING_BIG: case GORON_DMT_DC_ENTRANCE: case GORON_CITY_ENTRANCE: @@ -1154,8 +1169,8 @@ void func_80A454CC(EnGo2* this) { } f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { - f32 yDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 400.0f : 60.0f; - s32 index = PARAMS_GET_S(this->actor.params, 0, 5); + f32 yDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 400.0f : 60.0f; + s32 index = ENGO2_GET_TYPE(this); if (index == GORON_CITY_LINK && (fabsf(this->actor.yDistToPlayer) < yDist) && (this->actor.xzDistToPlayer < 400.0f)) { @@ -1168,7 +1183,7 @@ f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { s32 EnGo2_IsAttentionDrawnExtented(EnGo2* this, PlayState* play) { Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { if (EnGo2_IsAttentionDrawn(this)) { Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW); Camera_UnsetStateFlag(mainCam, CAM_STATE_CHECK_BG); @@ -1178,11 +1193,9 @@ s32 EnGo2_IsAttentionDrawnExtented(EnGo2* this, PlayState* play) { } } - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_FIRE_GENERIC || - PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG || - PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_STAIRWELL || - PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON || - PARAMS_GET_S(this->actor.params, 0, 5) == GORON_MARKET_BAZAAR) { + if (ENGO2_GET_TYPE(this) == GORON_FIRE_GENERIC || ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG || + ENGO2_GET_TYPE(this) == GORON_CITY_STAIRWELL || (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) || + ENGO2_GET_TYPE(this) == GORON_MARKET_BAZAAR) { return true; } @@ -1208,7 +1221,7 @@ void EnGo2_DefaultWakingUp(EnGo2* this) { } void EnGo2_WakingUp(EnGo2* this) { - f32 xyzDist = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON ? 800.0f : 200.0f; + f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f; s32 isTrue = true; xyzDist = SQ(xyzDist); @@ -1231,7 +1244,7 @@ void EnGo2_BiggoronWakingUp(EnGo2* this) { } void EnGo2_SelectGoronWakingUp(EnGo2* this) { - switch (PARAMS_GET_S(this->actor.params, 0, 5)) { + switch (ENGO2_GET_TYPE(this)) { case GORON_DMT_BOMB_FLOWER: this->isAwake = true; this->trackingMode = EnGo2_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; @@ -1286,7 +1299,7 @@ void EnGo2_EyeMouthTexState(EnGo2* this) { void EnGo2_SitDownAnimation(EnGo2* this) { if ((this->skelAnime.playSpeed != 0.0f) && (this->skelAnime.animation == &gGoronUncurlSitStandAnim)) { if (this->skelAnime.playSpeed > 0.0f && this->skelAnime.curFrame == 14.0f) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_DOWN); } else { func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_SIT_DOWN, 60); @@ -1304,7 +1317,7 @@ void EnGo2_SitDownAnimation(EnGo2* this) { } void EnGo2_GetDustData(EnGo2* this, s32 index2) { - s32 index1 = PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG ? 1 : 0; + s32 index1 = ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG ? 1 : 0; EnGo2DustEffectData* dustEffectData = &sDustEffectData[index1][index2]; EnGo2_SpawnDust(this, dustEffectData->initialTimer, dustEffectData->scale, dustEffectData->scaleStep, @@ -1312,7 +1325,7 @@ void EnGo2_GetDustData(EnGo2* this, s32 index2) { } void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_BIG); this->skelAnime.playSpeed = -0.5f; @@ -1329,13 +1342,13 @@ void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { void EnGo2_WakeUp(EnGo2* this, PlayState* play) { if (this->skelAnime.playSpeed == 0.0f) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WAKE_UP); } else { func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_WAKE_UP, 60); } } - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_BIG); this->skelAnime.playSpeed = 0.5f; @@ -1356,8 +1369,7 @@ void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) { } void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_ROLLING_BIG || - PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_LINK) { + if (ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG || ENGO2_GET_TYPE(this) == GORON_CITY_LINK) { this->collider.elem.acElemFlags = ACELEM_ON; this->actor.speed = GET_INFTABLE(INFTABLE_11E) ? 6.0f : 3.6000001f; } else { @@ -1373,9 +1385,8 @@ void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { void EnGo2_StopRolling(EnGo2* this, PlayState* play) { EnBom* bomb; - if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_ROLLING_BIG) && - (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_LINK)) { - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_ROLLING_SMALL) { + if ((ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG) && (ENGO2_GET_TYPE(this) != GORON_CITY_LINK)) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_ROLLING_SMALL) { bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bomb != NULL) { @@ -1395,7 +1406,7 @@ void EnGo2_StopRolling(EnGo2* this, PlayState* play) { } s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, PlayState* play) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_FIRE_GENERIC) { + if (ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) { return false; } @@ -1408,8 +1419,7 @@ s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, PlayState* play) { } s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_BOMB_FLOWER || - this->interactInfo.talkState != NPC_TALK_STATE_ACTION) { + if (ENGO2_GET_TYPE(this) != GORON_DMT_BOMB_FLOWER || this->interactInfo.talkState != NPC_TALK_STATE_ACTION) { return false; } @@ -1422,8 +1432,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { } s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_ROLLING_BIG || - (this->interactInfo.talkState != NPC_TALK_STATE_ACTION)) { + if (ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG || (this->interactInfo.talkState != NPC_TALK_STATE_ACTION)) { return false; } this->interactInfo.talkState = NPC_TALK_STATE_IDLE; @@ -1433,8 +1442,7 @@ s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { } s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_FIRE_GENERIC || - this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { + if (ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC || this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { return false; } this->actionFunc = EnGo2_GoronFireGenericAction; @@ -1442,7 +1450,7 @@ s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { } s32 EnGo2_IsGoronLinkReversing(EnGo2* this) { - if (PARAMS_GET_S(this->actor.params, 0, 5) != GORON_CITY_LINK || (this->waypoint >= this->reverseWaypoint) || + if (ENGO2_GET_TYPE(this) != GORON_CITY_LINK || (this->waypoint >= this->reverseWaypoint) || !EnGo2_IsAttentionDrawn(this)) { return false; } @@ -1465,7 +1473,7 @@ s32 EnGo2_IsRolling(EnGo2* this) { void EnGo2_GoronLinkAnimation(EnGo2* this, PlayState* play) { s32 animation = ARRAY_COUNT(sAnimationInfo); - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_CITY_LINK) { + if (ENGO2_GET_TYPE(this) == GORON_CITY_LINK) { if ((this->actor.textId == 0x3035 && this->messageEntry == 0) || (this->actor.textId == 0x3036 && this->messageEntry == 0)) { if (this->skelAnime.animation != &gGoronShakingLoopAnim) { @@ -1518,8 +1526,7 @@ void EnGo2_GoronFireClearCamera(EnGo2* this, PlayState* play) { void EnGo2_BiggoronAnimation(EnGo2* this) { if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_BROKEN_GORONS_SWORD && INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYE_DROPS && - PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON && - this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { + (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) && this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { if (DECR(this->animTimer) == 0) { this->animTimer = Rand_S16Offset(30, 30); func_800F4524(&gSfxDefaultPos, NA_SE_EN_GOLON_EYE_BIG, 60); @@ -1538,7 +1545,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); // Not GORON_CITY_ROLLING_BIG, GORON_CITY_LINK, GORON_DMT_BIGGORON - switch (PARAMS_GET_S(this->actor.params, 0, 5)) { + switch (ENGO2_GET_TYPE(this)) { case GORON_FIRE_GENERIC: case GORON_DMT_BOMB_FLOWER: case GORON_DMT_ROLLING_SMALL: @@ -1567,7 +1574,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->reverseWaypoint = this->actor.shape.rot.z; this->trackingMode = NPC_TRACKING_NONE; this->path = Path_GetByIndex(play, PARAMS_GET_S(this->actor.params, 5, 5), 0x1F); - switch (PARAMS_GET_S(this->actor.params, 0, 5)) { + switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_ENTRANCE: case GORON_CITY_ISLAND: case GORON_CITY_LOWEST_FLOOR: @@ -1598,14 +1605,14 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { #if OOT_VERSION >= PAL_1_1 CLEAR_INFTABLE(INFTABLE_10C); #endif - this->collider.dim.height = (D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].height * 0.6f); + this->collider.dim.height = (D_80A4816C[ENGO2_GET_TYPE(this)].height * 0.6f); EnGo2_SetupRolling(this, play); this->isAwake = true; } break; case GORON_CITY_ROLLING_BIG: case GORON_DMT_ROLLING_SMALL: - this->collider.dim.height = (D_80A4816C[PARAMS_GET_S(this->actor.params, 0, 5)].height * 0.6f); + this->collider.dim.height = (D_80A4816C[ENGO2_GET_TYPE(this)].height * 0.6f); EnGo2_SetupRolling(this, play); break; case GORON_FIRE_GENERIC: @@ -1645,12 +1652,12 @@ void EnGo2_Destroy(Actor* thisx, PlayState* play) { } void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play) { - u8 index = PARAMS_GET_S(this->actor.params, 0, 5); + u8 index = ENGO2_GET_TYPE(this); s16 height; s32 quakeIndex; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, -0x3CB0); Quake_SetPerturbations(quakeIndex, 8, 0, 0, 0); @@ -1673,13 +1680,13 @@ void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play) { this->isAwake = false; EnGo2_WakeUp(this, play); } - if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_FIRE_GENERIC) && EnGo2_IsAttentionDrawn(this)) { + if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsAttentionDrawn(this)) { EnGo2_WakeUp(this, play); } } void func_80A46B40(EnGo2* this, PlayState* play) { - u8 index = PARAMS_GET_S(this->actor.params, 0, 5); + u8 index = ENGO2_GET_TYPE(this); f32 height; if (this->isUncurled == true) { @@ -1696,7 +1703,7 @@ void func_80A46B40(EnGo2* this, PlayState* play) { } } else { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (PARAMS_GET_S(this->actor.params, 0, 5) == GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; } func_80A454CC(this); @@ -1734,8 +1741,7 @@ void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play) { void EnGo2_ActionRollingContinue(EnGo2* this, PlayState* play) { f32 float1 = 1000.0f; - if ((PARAMS_GET_S(this->actor.params, 0, 5) != GORON_DMT_ROLLING_SMALL || - !(this->actor.xyzDistToPlayerSq > SQ(float1))) && + if ((ENGO2_GET_TYPE(this) != GORON_DMT_ROLLING_SMALL || !(this->actor.xyzDistToPlayerSq > SQ(float1))) && DECR(this->animTimer) == 0) { this->actionFunc = EnGo2_ActionRollingSlow; this->actor.speed *= 0.5f; // slowdown @@ -1756,7 +1762,7 @@ void EnGo2_ActionRollingSlow(EnGo2* this, PlayState* play) { EnGo2_GetDustData(this, 3); } orientation = EnGo2_Orient(this, play); - index = PARAMS_GET_S(this->actor.params, 0, 5); + index = ENGO2_GET_TYPE(this); if (index != GORON_CITY_LINK) { if ((index == GORON_DMT_ROLLING_SMALL) && (orientation == 1) && (this->waypoint == 0)) { EnGo2_StopRolling(this, play); @@ -1775,7 +1781,7 @@ void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 0)) { EnGo2_GetDustData(this, 0); if (this->bounceCounter == 0) { - switch (PARAMS_GET_S(this->actor.params, 0, 5)) { + switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_LINK: this->goronState = 0; this->actionFunc = EnGo2_GoronLinkStopRolling; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 3b9a929a0f6..562acfc9592 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -9,23 +9,6 @@ struct EnGo2; typedef void (*EnGo2ActionFunc)(struct EnGo2*, PlayState*); -typedef enum GoronType { - /* 0x00 */ GORON_CITY_ROLLING_BIG, - /* 0x01 */ GORON_CITY_LINK, - /* 0x02 */ GORON_DMT_BIGGORON, - /* 0x03 */ GORON_FIRE_GENERIC, - /* 0x04 */ GORON_DMT_BOMB_FLOWER, - /* 0x05 */ GORON_DMT_ROLLING_SMALL, - /* 0x06 */ GORON_DMT_DC_ENTRANCE, - /* 0x07 */ GORON_CITY_ENTRANCE, - /* 0x08 */ GORON_CITY_ISLAND, - /* 0x09 */ GORON_CITY_LOWEST_FLOOR, - /* 0x0A */ GORON_CITY_STAIRWELL, - /* 0x0B */ GORON_CITY_LOST_WOODS, - /* 0x0C */ GORON_DMT_FAIRY_HINT, - /* 0x0D */ GORON_MARKET_BAZAAR -} GoronType; - // WIP fire temple type docs // /* 0x00 */ UNUSED // /* 0x01 */ GORON_FIRE_LAVA_ROOM_OPEN From 98afe53f7073b053edff9d50537b0e6c55c04683 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 17:51:09 +0100 Subject: [PATCH 32/68] Document EnGo2 path param --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 94ce84a3697..cd926db313a 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -167,6 +167,7 @@ typedef enum GoronType { /* 0x0D */ GORON_MARKET_BAZAAR } GoronType; +#define ENGO2_GET_PATH_INDEX(this) PARAMS_GET_S((this)->actor.params, 5, 5) static EnGo2DustEffectData sDustEffectData[2][4] = { { { 12, 0.2f, 0.2f, 1, 18.0f, 0.0f }, @@ -1573,7 +1574,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->waypoint = 0; this->reverseWaypoint = this->actor.shape.rot.z; this->trackingMode = NPC_TRACKING_NONE; - this->path = Path_GetByIndex(play, PARAMS_GET_S(this->actor.params, 5, 5), 0x1F); + this->path = Path_GetByIndex(play, ENGO2_GET_PATH_INDEX(this), 0x1F); switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_ENTRANCE: case GORON_CITY_ISLAND: From 9be708d6b93fdf9c872376b6fb566c3091eb3cd0 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 17:51:21 +0100 Subject: [PATCH 33/68] Document EnGo2 opening Goron's cage --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index cd926db313a..3abeb13f90a 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -168,6 +168,9 @@ typedef enum GoronType { } GoronType; #define ENGO2_GET_PATH_INDEX(this) PARAMS_GET_S((this)->actor.params, 5, 5) +#define ENGO2_CAGED_FLAG(this) PARAMS_GET_S((this)->actor.params, 10, 6) +#define ENGO2_IS_CAGE_OPEN(play, this) Flags_GetSwitch(play, ENGO2_CAGED_FLAG(this)) + static EnGo2DustEffectData sDustEffectData[2][4] = { { { 12, 0.2f, 0.2f, 1, 18.0f, 0.0f }, @@ -312,7 +315,7 @@ s32 EnGo2_GetDialogState(EnGo2* this, PlayState* play) { } u16 EnGo2_GoronFireGenericGetTextId(EnGo2* this) { - switch (PARAMS_GET_S(this->actor.params, 10, 6)) { + switch (ENGO2_CAGED_FLAG(this)) { case 3: return 0x3069; case 5: @@ -661,7 +664,7 @@ s16 EnGo2_UpdateTalkStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { } u16 EnGo2_GetTextIdGoronFireGeneric(PlayState* play, EnGo2* this) { - if (Flags_GetSwitch(play, PARAMS_GET_S(this->actor.params, 10, 6))) { + if (ENGO2_IS_CAGE_OPEN(play, this)) { return 0x3071; } else { return 0x3051; @@ -1413,7 +1416,7 @@ s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, PlayState* play) { // shaking curled up this->actor.world.pos.x += (play->state.frames & 1) ? 1.0f : -1.0f; - if (Flags_GetSwitch(play, PARAMS_GET_S(this->actor.params, 10, 6))) { + if (ENGO2_IS_CAGE_OPEN(play, this)) { return true; } return false; @@ -1617,7 +1620,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { EnGo2_SetupRolling(this, play); break; case GORON_FIRE_GENERIC: - if (Flags_GetSwitch(play, PARAMS_GET_S(this->actor.params, 10, 6))) { + if (ENGO2_IS_CAGE_OPEN(play, this)) { Actor_Kill(&this->actor); } else { this->isAwake = true; @@ -1966,9 +1969,8 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { } else { this->animTimer = 0; this->actor.speed = 0.0f; - if ((PARAMS_GET_S(this->actor.params, 10, 6) != 1) && (PARAMS_GET_S(this->actor.params, 10, 6) != 2) && - (PARAMS_GET_S(this->actor.params, 10, 6) != 4) && (PARAMS_GET_S(this->actor.params, 10, 6) != 5) && - (PARAMS_GET_S(this->actor.params, 10, 6) != 9) && (PARAMS_GET_S(this->actor.params, 10, 6) != 11)) { + if ((ENGO2_CAGED_FLAG(this) != 1) && (ENGO2_CAGED_FLAG(this) != 2) && (ENGO2_CAGED_FLAG(this) != 4) && + (ENGO2_CAGED_FLAG(this) != 5) && (ENGO2_CAGED_FLAG(this) != 9) && (ENGO2_CAGED_FLAG(this) != 11)) { this->goronState++; } this->goronState++; From fc1009a0a6431470c196e6799a7e62b4b688d8c9 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 19:37:50 +0100 Subject: [PATCH 34/68] Document EnGo2 known data --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 34 +++++++++++------------ src/overlays/actors/ovl_En_Go2/z_en_go2.h | 12 ++++---- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 3abeb13f90a..a2cd3352248 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -98,13 +98,13 @@ ActorProfile En_Go2_Profile = { /**/ EnGo2_Draw, }; -static EnGo2DataStruct1 D_80A4816C[14] = { +static EnGo2ColliderData sColliderData[14] = { { 0, 0, 0, 68, 148 }, { 0, 0, 0, 24, 52 }, { 0, 320, 380, 400, 120 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 46, 90 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 30, 68 }, { 0, 0, 0, 30, 68 }, }; -static EnGo2DataStruct2 D_80A481F8[14] = { +static EnGo2ShapeData sShapeData[14] = { { 30.0f, 0.026f, 6, 60.0f }, { 24.0f, 0.008f, 6, 30.0f }, { 28.0f, 0.16f, 5, 380.0f }, { 28.0f, 0.01f, 7, 40.0f }, { 30.0f, 0.015f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, { 28.0f, 0.01f, 6, 30.0f }, @@ -862,17 +862,17 @@ s32 func_80A44790(EnGo2* this, PlayState* play) { void EnGo2_SetColliderDim(EnGo2* this) { u8 index = ENGO2_GET_TYPE(this); - this->collider.dim.radius = D_80A4816C[index].radius; - this->collider.dim.height = D_80A4816C[index].height; + this->collider.dim.radius = sColliderData[index].radius; + this->collider.dim.height = sColliderData[index].height; } void EnGo2_SetShape(EnGo2* this) { u8 index = ENGO2_GET_TYPE(this); - this->actor.shape.shadowScale = D_80A481F8[index].shape_unk_10; - Actor_SetScale(&this->actor, D_80A481F8[index].scale); - this->actor.attentionRangeType = D_80A481F8[index].actor_unk_1F; - this->interactRange = D_80A481F8[index].interactRange; + this->actor.shape.shadowScale = sShapeData[index].shadowScale; + Actor_SetScale(&this->actor, sShapeData[index].scale); + this->actor.attentionRangeType = sShapeData[index].attentionRangeType; + this->interactRange = sShapeData[index].interactRange; this->interactRange += this->collider.dim.radius; } @@ -883,10 +883,10 @@ void EnGo2_CheckCollision(EnGo2* this, PlayState* play) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z; - xzDist = D_80A4816C[ENGO2_GET_TYPE(this)].xzDist; + xzDist = sColliderData[ENGO2_GET_TYPE(this)].xzDist; pos.x += (s16)(xzDist * Math_SinS(this->actor.shape.rot.y)); pos.z += (s16)(xzDist * Math_CosS(this->actor.shape.rot.y)); - pos.y += D_80A4816C[ENGO2_GET_TYPE(this)].yDist; + pos.y += sColliderData[ENGO2_GET_TYPE(this)].yDist; this->collider.dim.pos = pos; CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); @@ -1609,14 +1609,14 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { #if OOT_VERSION >= PAL_1_1 CLEAR_INFTABLE(INFTABLE_10C); #endif - this->collider.dim.height = (D_80A4816C[ENGO2_GET_TYPE(this)].height * 0.6f); + this->collider.dim.height = (sColliderData[ENGO2_GET_TYPE(this)].height * 0.6f); EnGo2_SetupRolling(this, play); this->isAwake = true; } break; case GORON_CITY_ROLLING_BIG: case GORON_DMT_ROLLING_SMALL: - this->collider.dim.height = (D_80A4816C[ENGO2_GET_TYPE(this)].height * 0.6f); + this->collider.dim.height = (sColliderData[ENGO2_GET_TYPE(this)].height * 0.6f); EnGo2_SetupRolling(this, play); break; case GORON_FIRE_GENERIC: @@ -1673,11 +1673,11 @@ void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play) { } if ((s32)this->skelAnime.curFrame == 0) { - this->collider.dim.height = (D_80A4816C[index].height * 0.6f); + this->collider.dim.height = (sColliderData[index].height * 0.6f); } else { - height = D_80A4816C[index].height; + height = sColliderData[index].height; this->collider.dim.height = - ((D_80A4816C[index].height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.startFrame)) + + ((sColliderData[index].height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.startFrame)) + (height * 0.6f)); } if (EnGo2_IsFreeingGoronInFire(this, play)) { @@ -1712,9 +1712,9 @@ void func_80A46B40(EnGo2* this, PlayState* play) { } func_80A454CC(this); this->isUncurled = true; - this->collider.dim.height = D_80A4816C[index].height; + this->collider.dim.height = sColliderData[index].height; } else { - height = D_80A4816C[index].height; + height = sColliderData[index].height; this->collider.dim.height = (s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f)); } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 562acfc9592..520d662aa37 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -23,20 +23,20 @@ typedef void (*EnGo2ActionFunc)(struct EnGo2*, PlayState*); // /* 0x0A */ GORON_FIRE_MAZE_UPPER, // /* 0x0B */ GORON_FIRE_HIGHEST -typedef struct EnGo2DataStruct1 { +typedef struct EnGo2ColliderData { s16 unused; s16 yDist; s16 xzDist; s16 radius; s16 height; -} EnGo2DataStruct1; // size = 0xA +} EnGo2ColliderData; // size = 0xA -typedef struct EnGo2DataStruct2 { - f32 shape_unk_10; +typedef struct EnGo2ShapeData { + f32 shadowScale; f32 scale; - s8 actor_unk_1F; + s8 attentionRangeType; f32 interactRange; -} EnGo2DataStruct2; // size = 0x10 +} EnGo2ShapeData; // size = 0x10 typedef struct EnGo2DustEffectData { u8 initialTimer; From b908614ceb19b0c5d898016d317b214cfc0f82f7 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 15:02:42 +0100 Subject: [PATCH 35/68] Document EnGo2 funtions based on the context --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 302 +++++++++++----------- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 5 +- 2 files changed, 157 insertions(+), 150 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index a2cd3352248..dec69d25008 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -42,21 +42,21 @@ void EnGo2_Update(Actor* thisx, PlayState* play); void EnGo2_Draw(Actor* thisx, PlayState* play); void EnGo2_StopRolling(EnGo2* this, PlayState* play); -void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play); +void EnGo2_CurledUp(EnGo2* this, PlayState* play); -void func_80A46B40(EnGo2* this, PlayState* play); -void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, PlayState* play); -void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play); -void EnGo2_ActionRollingContinue(EnGo2* this, PlayState* play); -void EnGo2_ActionRollingSlow(EnGo2* this, PlayState* play); +void EnGo2_Standing(EnGo2* this, PlayState* play); +void EnGo2_GoronDmtBombFlower(EnGo2* this, PlayState* play); +void EnGo2_GoronRollingBig(EnGo2* this, PlayState* play); +void EnGo2_RollingStart(EnGo2* this, PlayState* play); +void EnGo2_RollingSlow(EnGo2* this, PlayState* play); void EnGo2_GroundRolling(EnGo2* this, PlayState* play); -void EnGo2_ActionRollingReverse(EnGo2* this, PlayState* play); -void EnGo2_SetupGetItem(EnGo2* this, PlayState* play); -void EnGo2_SetGetItem(EnGo2* this, PlayState* play); +void EnGo2_RollingReverse(EnGo2* this, PlayState* play); +void EnGo2_HandleOffer(EnGo2* this, PlayState* play); +void EnGo2_HandleOfferParented(EnGo2* this, PlayState* play); void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play); -void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play); -void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play); +void EnGo2_GoronLink(EnGo2* this, PlayState* play); +void EnGo2_GoronFireGeneric(EnGo2* this, PlayState* play); static void* sDustTex[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex }; @@ -112,6 +112,7 @@ static EnGo2ShapeData sShapeData[14] = { }; static f32 sPlayerTrackingYOffsets[14][2] = { + // { adult, child } { 80.0f, 80.0f }, { -10.0f, -10.0f }, { 800.0f, 800.0f }, { 0.0f, 0.0f }, { 20.0f, 40.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, @@ -173,12 +174,14 @@ typedef enum GoronType { static EnGo2DustEffectData sDustEffectData[2][4] = { { + // default { 12, 0.2f, 0.2f, 1, 18.0f, 0.0f }, { 12, 0.1f, 0.2f, 12, 26.0f, 0.0f }, { 12, 0.1f, 0.3f, 4, 10.0f, 0.0f }, { 12, 0.2f, 0.2f, 1, 18.0f, 0.0f }, }, { + // GORON_CITY_ROLLING_BIG { 12, 0.5f, 0.4f, 3, 42.0f, 0.0f }, { 12, 0.5f, 0.4f, 3, 42.0f, 0.0f }, { 12, 0.5f, 0.4f, 3, 42.0f, 0.0f }, @@ -271,8 +274,8 @@ void EnGo2_DrawEffects(EnGo2* this, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2_eff.c", 151); } -s32 EnGo2_SpawnDust(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 numDustEffects, f32 radius, - f32 yAccel) { +s32 EnGo2_SpawnDustExplicitly(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 numDustEffects, f32 radius, + f32 yAccel) { Vec3f pos = sPos; Vec3f velocity = sVelocity; Vec3f accel = sAccel; @@ -294,7 +297,7 @@ s32 EnGo2_SpawnDust(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 return 0; } -void EnGo2_GetItem(EnGo2* this, PlayState* play, s32 getItemId) { +void EnGo2_OfferItem(EnGo2* this, PlayState* play, s32 getItemId) { this->getItemId = getItemId; Actor_OfferGetItem(&this->actor, play, getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); @@ -356,9 +359,9 @@ s16 EnGo2_UpdateTalkStateGoronCityRollingBig(PlayState* play, EnGo2* this) { case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { if (this->actor.textId == 0x3012) { - this->actionFunc = EnGo2_SetupGetItem; + this->actionFunc = EnGo2_HandleOffer; bombBagUpgrade = CUR_CAPACITY(UPG_BOMB_BAG) == 30 ? GI_BOMB_BAG_40 : GI_BOMB_BAG_30; - EnGo2_GetItem(this, play, bombBagUpgrade); + EnGo2_OfferItem(this, play, bombBagUpgrade); Message_CloseTextbox(play); SET_INFTABLE(INFTABLE_11E); return NPC_TALK_STATE_ACTION; @@ -527,8 +530,8 @@ s16 EnGo2_UpdateTalkStateGoronCityLink(PlayState* play, EnGo2* this) { case TEXT_STATE_CLOSING: switch (this->actor.textId) { case 0x3036: - EnGo2_GetItem(this, play, GI_TUNIC_GORON); - this->actionFunc = EnGo2_SetupGetItem; + EnGo2_OfferItem(this, play, GI_TUNIC_GORON); + this->actionFunc = EnGo2_HandleOffer; return NPC_TALK_STATE_ACTION; case 0x3037: SET_INFTABLE(INFTABLE_10E); @@ -607,8 +610,8 @@ s16 EnGo2_UpdateTalkStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { #endif if (this->actor.textId == 0x305E) { if (!gSaveContext.save.info.playerData.bgsFlag) { - EnGo2_GetItem(this, play, GI_SWORD_BIGGORON); - this->actionFunc = EnGo2_SetupGetItem; + EnGo2_OfferItem(this, play, GI_SWORD_BIGGORON); + this->actionFunc = EnGo2_HandleOffer; return NPC_TALK_STATE_ACTION; } else { return NPC_TALK_STATE_IDLE; @@ -640,8 +643,8 @@ s16 EnGo2_UpdateTalkStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { if (Message_ShouldAdvance(play)) { if ((this->actor.textId == 0x3054) || (this->actor.textId == 0x3055)) { if (play->msgCtx.choiceIndex == 0) { - EnGo2_GetItem(this, play, GI_PRESCRIPTION); - this->actionFunc = EnGo2_SetupGetItem; + EnGo2_OfferItem(this, play, GI_PRESCRIPTION); + this->actionFunc = EnGo2_HandleOffer; return NPC_TALK_STATE_ACTION; } this->actor.textId = 0x3056; @@ -900,42 +903,45 @@ void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { this->skelAnime.endFrame = initialFrame; } -s32 func_80A44AB0(EnGo2* this, PlayState* play) { +s32 EnGo2_UpdateRollingKnockback(EnGo2* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 arg2; + f32 knockbackSpeed; if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { return false; + } + + if ((this->actionFunc != EnGo2_RollingSlow) && (this->actionFunc != EnGo2_RollingReverse) && + (this->actionFunc != EnGo2_RollingStart)) { + return false; + } + + if (this->collider.base.acFlags & AC_HIT) { + Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + this->actor.flags &= ~ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; + this->collider.base.acFlags &= ~AC_HIT; + EnGo2_StopRolling(this, play); + return true; + } + + if (player->invincibilityTimer <= 0) { + this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; } else { - if ((this->actionFunc != EnGo2_ActionRollingSlow) && (this->actionFunc != EnGo2_ActionRollingReverse) && - (this->actionFunc != EnGo2_ActionRollingContinue)) { - return false; - } else { - if (this->collider.base.acFlags & AC_HIT) { - Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->actor.flags &= ~ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; - this->collider.base.acFlags &= ~AC_HIT; - EnGo2_StopRolling(this, play); - return true; - } - if (player->invincibilityTimer <= 0) { - this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; - } else { - return false; - } - if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { - this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; + return false; + } - arg2 = this->actionFunc == EnGo2_ActionRollingContinue ? 1.5f : this->actor.speed * 1.5f; + if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { + this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - play->damagePlayer(play, -4); - Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); - Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); - this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; - } - } + knockbackSpeed = this->actionFunc == EnGo2_RollingStart ? 1.5f : this->actor.speed * 1.5f; + + play->damagePlayer(play, -4); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, knockbackSpeed, this->actor.yawTowardsPlayer, 6.0f); + Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); + this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; } + return false; } @@ -962,7 +968,7 @@ s32 EnGo2_UpdateWaypoint(EnGo2* this, PlayState* play) { return 1; } -s32 EnGo2_Orient(EnGo2* this, PlayState* play) { +s32 EnGo2_FollowPath(EnGo2* this, PlayState* play) { s16 targetYaw; f32 waypointDistSq = Path_OrientAndGetDistSq(&this->actor, this->path, this->waypoint, &targetYaw); @@ -974,7 +980,7 @@ s32 EnGo2_Orient(EnGo2* this, PlayState* play) { } } -s32 func_80A44D84(EnGo2* this) { +s32 EnGo2_OrientInstant(EnGo2* this) { s16 targetYaw; Path_OrientAndGetDistSq(&this->actor, this->path, this->waypoint, &targetYaw); @@ -1112,16 +1118,16 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { } } -void func_80A45288(EnGo2* this, PlayState* play) { +void EnGo2_TrackPlayer(EnGo2* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->actionFunc != EnGo2_GoronFireGenericAction) { + if (this->actionFunc != EnGo2_GoronFireGeneric) { this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.yOffset = sPlayerTrackingYOffsets[ENGO2_GET_TYPE(this)][((void)0, gSaveContext.save.linkAge)]; Npc_TrackPoint(&this->actor, &this->interactInfo, 4, this->trackingMode); } - if ((this->actionFunc != EnGo2_SetGetItem) && (this->isAwake == true)) { + if ((this->actionFunc != EnGo2_HandleOfferParented) && (this->isAwake == true)) { if (func_80A44790(this, play)) { EnGo2_BiggoronSetTextId(this, play, player); } @@ -1143,14 +1149,14 @@ void EnGo2_RollForward(EnGo2* this) { this->actor.speed = 0.0f; } - if (this->actionFunc != EnGo2_ActionRollingContinue) { + if (this->actionFunc != EnGo2_RollingStart) { Actor_MoveXZGravity(&this->actor); } this->actor.speed = speedXZ; } -void func_80A454CC(EnGo2* this) { +void EnGo2_ChooseIdleAnimation(EnGo2* this) { switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_ROLLING_BIG: case GORON_DMT_DC_ENTRANCE: @@ -1247,7 +1253,7 @@ void EnGo2_BiggoronWakingUp(EnGo2* this) { } } -void EnGo2_SelectGoronWakingUp(EnGo2* this) { +void EnGo2_AnimateGoronWakingUp(EnGo2* this) { switch (ENGO2_GET_TYPE(this)) { case GORON_DMT_BOMB_FLOWER: this->isAwake = true; @@ -1300,7 +1306,7 @@ void EnGo2_EyeMouthTexState(EnGo2* this) { } } -void EnGo2_SitDownAnimation(EnGo2* this) { +void EnGo2_PlayStandingChangeSfx(EnGo2* this) { if ((this->skelAnime.playSpeed != 0.0f) && (this->skelAnime.animation == &gGoronUncurlSitStandAnim)) { if (this->skelAnime.playSpeed > 0.0f && this->skelAnime.curFrame == 14.0f) { if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON) { @@ -1320,15 +1326,15 @@ void EnGo2_SitDownAnimation(EnGo2* this) { } } -void EnGo2_GetDustData(EnGo2* this, s32 index2) { +void EnGo2_SpawnDust(EnGo2* this, s32 index2) { s32 index1 = ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG ? 1 : 0; EnGo2DustEffectData* dustEffectData = &sDustEffectData[index1][index2]; - EnGo2_SpawnDust(this, dustEffectData->initialTimer, dustEffectData->scale, dustEffectData->scaleStep, - dustEffectData->numDustEffects, dustEffectData->radius, dustEffectData->yAccel); + EnGo2_SpawnDustExplicitly(this, dustEffectData->initialTimer, dustEffectData->scale, dustEffectData->scaleStep, + dustEffectData->numDustEffects, dustEffectData->radius, dustEffectData->yAccel); } -void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { +void EnGo2_AnimateRolling(EnGo2* this, PlayState* play) { if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_BIG); @@ -1341,10 +1347,10 @@ void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { this->trackingMode = NPC_TRACKING_NONE; this->isUncurled = false; this->isAwake = false; - this->actionFunc = EnGo2_ActionCurledUp; + this->actionFunc = EnGo2_CurledUp; } -void EnGo2_WakeUp(EnGo2* this, PlayState* play) { +void EnGo2_WakeUpAnimated(EnGo2* this, PlayState* play) { if (this->skelAnime.playSpeed == 0.0f) { if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WAKE_UP); @@ -1360,19 +1366,19 @@ void EnGo2_WakeUp(EnGo2* this, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); this->skelAnime.playSpeed = 1.0f; } - this->actionFunc = func_80A46B40; + this->actionFunc = EnGo2_Standing; } -void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) { +void EnGo2_WakeUpInstant(EnGo2* this, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); this->isUncurled = true; - this->actionFunc = func_80A46B40; + this->actionFunc = EnGo2_Standing; this->skelAnime.playSpeed = 0.0f; this->actor.speed = 0.0f; this->skelAnime.curFrame = this->skelAnime.endFrame; } -void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { +void EnGo2_StartRolling(EnGo2* this, PlayState* play) { if (ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG || ENGO2_GET_TYPE(this) == GORON_CITY_LINK) { this->collider.elem.acElemFlags = ACELEM_ON; this->actor.speed = GET_INFTABLE(INFTABLE_11E) ? 6.0f : 3.6000001f; @@ -1383,7 +1389,7 @@ void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { this->animTimer = 10; this->actor.shape.yOffset = 1800.0f; this->actor.speed *= 2.0f; // Speeding up - this->actionFunc = EnGo2_ActionRollingContinue; + this->actionFunc = EnGo2_RollingStart; } void EnGo2_StopRolling(EnGo2* this, PlayState* play) { @@ -1409,7 +1415,7 @@ void EnGo2_StopRolling(EnGo2* this, PlayState* play) { this->actor.speed = 0.0f; } -s32 EnGo2_IsFreeingGoronInFire(EnGo2* this, PlayState* play) { +s32 EnGo2_IsGoronFireGenericFreed(EnGo2* this, PlayState* play) { if (ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) { return false; } @@ -1431,7 +1437,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->isAwake = false; this->trackingMode = NPC_TRACKING_NONE; - this->actionFunc = EnGo2_GoronDmtBombFlowerAnimation; + this->actionFunc = EnGo2_GoronDmtBombFlower; return true; } @@ -1440,8 +1446,8 @@ s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { return false; } this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - EnGo2_RollingAnimation(this, play); - this->actionFunc = EnGo2_GoronRollingBigContinueRolling; + EnGo2_AnimateRolling(this, play); + this->actionFunc = EnGo2_GoronRollingBig; return true; } @@ -1449,7 +1455,7 @@ s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { if (ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC || this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { return false; } - this->actionFunc = EnGo2_GoronFireGenericAction; + this->actionFunc = EnGo2_GoronFireGeneric; return true; } @@ -1469,12 +1475,12 @@ s32 EnGo2_IsRolling(EnGo2* this) { if ((this->bounceTimer >= 9) && (this->bounceCounter == 0)) { this->bounceTimer = 8; } - EnGo2_GetDustData(this, 0); + EnGo2_SpawnDust(this, 0); } return true; } -void EnGo2_GoronLinkAnimation(EnGo2* this, PlayState* play) { +void EnGo2_AnimateGoronLinkAndDoSfx(EnGo2* this, PlayState* play) { s32 animation = ARRAY_COUNT(sAnimationInfo); if (ENGO2_GET_TYPE(this) == GORON_CITY_LINK) { @@ -1506,7 +1512,7 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, PlayState* play) { } } -void EnGo2_GoronFireCamera(EnGo2* this, PlayState* play) { +void EnGo2_GoronFireGeneric_CreateSubcamera(EnGo2* this, PlayState* play) { s16 yaw; this->subCamId = Play_CreateSubCamera(play); @@ -1523,12 +1529,12 @@ void EnGo2_GoronFireCamera(EnGo2* this, PlayState* play) { Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } -void EnGo2_GoronFireClearCamera(EnGo2* this, PlayState* play) { +void EnGo2_GoronFireGeneric_ClearSubcamera(EnGo2* this, PlayState* play) { Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); Play_ClearCamera(play, this->subCamId); } -void EnGo2_BiggoronAnimation(EnGo2* this) { +void EnGo2_AnimateBiggoronAndDoSfx(EnGo2* this) { if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_BROKEN_GORONS_SWORD && INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYE_DROPS && (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) && this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { if (DECR(this->animTimer) == 0) { @@ -1587,13 +1593,13 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && LINK_IS_ADULT) { Actor_Kill(&this->actor); } - this->actionFunc = EnGo2_ActionCurledUp; + this->actionFunc = EnGo2_CurledUp; break; case GORON_MARKET_BAZAAR: if ((LINK_IS_ADULT) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { Actor_Kill(&this->actor); } - EnGo2_GetItemAnimation(this, play); + EnGo2_WakeUpInstant(this, play); break; case GORON_CITY_LINK: if (GET_INFTABLE(INFTABLE_109)) { @@ -1601,30 +1607,30 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->actor.home.pos = this->actor.world.pos; if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { - EnGo2_GetItemAnimation(this, play); + EnGo2_WakeUpInstant(this, play); } else { - this->actionFunc = EnGo2_ActionCurledUp; + this->actionFunc = EnGo2_CurledUp; } } else { #if OOT_VERSION >= PAL_1_1 CLEAR_INFTABLE(INFTABLE_10C); #endif this->collider.dim.height = (sColliderData[ENGO2_GET_TYPE(this)].height * 0.6f); - EnGo2_SetupRolling(this, play); + EnGo2_StartRolling(this, play); this->isAwake = true; } break; case GORON_CITY_ROLLING_BIG: case GORON_DMT_ROLLING_SMALL: this->collider.dim.height = (sColliderData[ENGO2_GET_TYPE(this)].height * 0.6f); - EnGo2_SetupRolling(this, play); + EnGo2_StartRolling(this, play); break; case GORON_FIRE_GENERIC: if (ENGO2_IS_CAGE_OPEN(play, this)) { Actor_Kill(&this->actor); } else { this->isAwake = true; - this->actionFunc = EnGo2_ActionCurledUp; + this->actionFunc = EnGo2_CurledUp; } break; case GORON_DMT_BIGGORON: @@ -1636,7 +1642,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { } this->collider.base.acFlags = AC_NONE; this->collider.base.ocFlags1 = OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER; - this->actionFunc = EnGo2_ActionCurledUp; + this->actionFunc = EnGo2_CurledUp; break; case GORON_DMT_BOMB_FLOWER: if (GET_INFTABLE(INFTABLE_EB)) { @@ -1647,7 +1653,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { case GORON_DMT_DC_ENTRANCE: case GORON_DMT_FAIRY_HINT: default: - this->actionFunc = EnGo2_ActionCurledUp; + this->actionFunc = EnGo2_CurledUp; break; } } @@ -1655,7 +1661,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { void EnGo2_Destroy(Actor* thisx, PlayState* play) { } -void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play) { +void EnGo2_CurledUp(EnGo2* this, PlayState* play) { u8 index = ENGO2_GET_TYPE(this); s16 height; s32 quakeIndex; @@ -1667,7 +1673,7 @@ void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play) { Quake_SetPerturbations(quakeIndex, 8, 0, 0, 0); Quake_SetDuration(quakeIndex, 16); } else { - EnGo2_GetDustData(this, 1); + EnGo2_SpawnDust(this, 1); } this->skelAnime.playSpeed = 0.0f; } @@ -1680,23 +1686,23 @@ void EnGo2_ActionCurledUp(EnGo2* this, PlayState* play) { ((sColliderData[index].height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.startFrame)) + (height * 0.6f)); } - if (EnGo2_IsFreeingGoronInFire(this, play)) { + if (EnGo2_IsGoronFireGenericFreed(this, play)) { this->isAwake = false; - EnGo2_WakeUp(this, play); + EnGo2_WakeUpAnimated(this, play); } if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsAttentionDrawn(this)) { - EnGo2_WakeUp(this, play); + EnGo2_WakeUpAnimated(this, play); } } -void func_80A46B40(EnGo2* this, PlayState* play) { +void EnGo2_Standing(EnGo2* this, PlayState* play) { u8 index = ENGO2_GET_TYPE(this); f32 height; if (this->isUncurled == true) { - EnGo2_BiggoronAnimation(this); - EnGo2_GoronLinkAnimation(this, play); - EnGo2_SelectGoronWakingUp(this); + EnGo2_AnimateBiggoronAndDoSfx(this); + EnGo2_AnimateGoronLinkAndDoSfx(this, play); + EnGo2_AnimateGoronWakingUp(this); if (!EnGo2_IsGoronRollingBig(this, play) && !EnGo2_IsGoronFireGeneric(this)) { if (EnGo2_IsGoronDmtBombFlower(this)) { @@ -1710,7 +1716,7 @@ void func_80A46B40(EnGo2* this, PlayState* play) { if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; } - func_80A454CC(this); + EnGo2_ChooseIdleAnimation(this); this->isUncurled = true; this->collider.dim.height = sColliderData[index].height; } else { @@ -1720,59 +1726,60 @@ void func_80A46B40(EnGo2* this, PlayState* play) { } } if ((!EnGo2_IsAttentionDrawnExtented(this, play)) && (!EnGo2_IsAttentionDrawn(this))) { - EnGo2_RollingAnimation(this, play); + EnGo2_AnimateRolling(this, play); } } -void EnGo2_GoronDmtBombFlowerAnimation(EnGo2* this, PlayState* play) { +void EnGo2_GoronDmtBombFlower(EnGo2* this, PlayState* play) { f32 float1 = this->skelAnime.endFrame; f32 float2 = this->skelAnime.curFrame * ((f32)0x8000 / float1); this->actor.speed = Math_SinS(float2); - if ((EnGo2_Orient(this, play)) && (this->waypoint == 0)) { - EnGo2_GetItemAnimation(this, play); + if ((EnGo2_FollowPath(this, play)) && (this->waypoint == 0)) { + EnGo2_WakeUpInstant(this, play); } } -void EnGo2_GoronRollingBigContinueRolling(EnGo2* this, PlayState* play) { +void EnGo2_GoronRollingBig(EnGo2* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - EnGo2_GetDustData(this, 1); + EnGo2_SpawnDust(this, 1); this->skelAnime.playSpeed = 0.0f; - EnGo2_SetupRolling(this, play); + EnGo2_StartRolling(this, play); } } -void EnGo2_ActionRollingContinue(EnGo2* this, PlayState* play) { +void EnGo2_RollingStart(EnGo2* this, PlayState* play) { f32 float1 = 1000.0f; if ((ENGO2_GET_TYPE(this) != GORON_DMT_ROLLING_SMALL || !(this->actor.xyzDistToPlayerSq > SQ(float1))) && DECR(this->animTimer) == 0) { - this->actionFunc = EnGo2_ActionRollingSlow; + this->actionFunc = EnGo2_RollingSlow; this->actor.speed *= 0.5f; // slowdown } - EnGo2_GetDustData(this, 2); + EnGo2_SpawnDust(this, 2); } -void EnGo2_ActionRollingSlow(EnGo2* this, PlayState* play) { - s32 orientation; +void EnGo2_RollingSlow(EnGo2* this, PlayState* play) { + s32 updatedWaypoint; s32 index; if (!EnGo2_IsRolling(this)) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 1) == true) { if (EnGo2_IsGoronLinkReversing(this)) { - this->actionFunc = EnGo2_ActionRollingReverse; + this->actionFunc = EnGo2_RollingReverse; return; } - EnGo2_GetDustData(this, 3); + EnGo2_SpawnDust(this, 3); } - orientation = EnGo2_Orient(this, play); + updatedWaypoint = EnGo2_FollowPath(this, play); index = ENGO2_GET_TYPE(this); if (index != GORON_CITY_LINK) { - if ((index == GORON_DMT_ROLLING_SMALL) && (orientation == 1) && (this->waypoint == 0)) { + if ((index == GORON_DMT_ROLLING_SMALL) && (updatedWaypoint == 1) && (this->waypoint == 0)) { EnGo2_StopRolling(this, play); return; } - } else if ((orientation == 2) && (this->waypoint == 1)) { + } else if ((updatedWaypoint == 2) && (this->waypoint == 1)) { + // @unreachable: `EnGo2_FollowPath` returns `0` or `1` EnGo2_StopRolling(this, play); return; } @@ -1783,73 +1790,74 @@ void EnGo2_ActionRollingSlow(EnGo2* this, PlayState* play) { void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 0)) { - EnGo2_GetDustData(this, 0); + EnGo2_SpawnDust(this, 0); if (this->bounceCounter == 0) { switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_LINK: this->goronState = 0; - this->actionFunc = EnGo2_GoronLinkStopRolling; + this->actionFunc = EnGo2_GoronLink; break; case GORON_CITY_ROLLING_BIG: - EnGo2_WakeUp(this, play); + EnGo2_WakeUpAnimated(this, play); break; default: - this->actionFunc = EnGo2_ActionCurledUp; + this->actionFunc = EnGo2_CurledUp; } } } } -void EnGo2_ActionRollingReverse(EnGo2* this, PlayState* play) { +void EnGo2_RollingReverse(EnGo2* this, PlayState* play) { if (!EnGo2_IsRolling(this)) { Math_ApproachF(&this->actor.speed, 0.0f, 0.6f, 0.8f); if (this->actor.speed >= 1.0f) { - EnGo2_GetDustData(this, 3); + EnGo2_SpawnDust(this, 3); } if ((s32)this->actor.speed == 0) { this->actor.world.rot.y ^= 0x8000; this->actor.shape.rot.y = this->actor.world.rot.y; this->reverse ^= 1; EnGo2_UpdateWaypoint(this, play); - EnGo2_SetupRolling(this, play); + EnGo2_StartRolling(this, play); } } } -void EnGo2_SetupGetItem(EnGo2* this, PlayState* play) { +void EnGo2_HandleOffer(EnGo2* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { #if OOT_VERSION >= PAL_1_0 this->actor.parent = NULL; #endif - this->actionFunc = EnGo2_SetGetItem; + this->actionFunc = EnGo2_HandleOfferParented; } else { + // @redundant: this action is always paired with `EnGo2_OfferItem`, which itself calls Actor_OfferGetItem Actor_OfferGetItem(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } } -void EnGo2_SetGetItem(EnGo2* this, PlayState* play) { +void EnGo2_HandleOfferParented(EnGo2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; switch (this->getItemId) { case GI_CLAIM_CHECK: Environment_ClearBgsDayCount(); - EnGo2_GetItemAnimation(this, play); + EnGo2_WakeUpInstant(this, play); return; case GI_TUNIC_GORON: SET_INFTABLE(INFTABLE_109); - EnGo2_GetItemAnimation(this, play); + EnGo2_WakeUpInstant(this, play); return; case GI_SWORD_BIGGORON: gSaveContext.save.info.playerData.bgsFlag = true; break; case GI_BOMB_BAG_30: case GI_BOMB_BAG_40: - EnGo2_RollingAnimation(this, play); - this->actionFunc = EnGo2_GoronRollingBigContinueRolling; + EnGo2_AnimateRolling(this, play); + this->actionFunc = EnGo2_GoronRollingBig; return; } - this->actionFunc = func_80A46B40; + this->actionFunc = EnGo2_Standing; } } @@ -1892,15 +1900,15 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; this->skelAnime.playSpeed = 0.0f; this->skelAnime.curFrame = this->skelAnime.endFrame; - EnGo2_GetItem(this, play, GI_CLAIM_CHECK); - this->actionFunc = EnGo2_SetupGetItem; + EnGo2_OfferItem(this, play, GI_CLAIM_CHECK); + this->actionFunc = EnGo2_HandleOffer; this->goronState = 0; } break; } } -void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { +void EnGo2_GoronLink(EnGo2* this, PlayState* play) { Player* player = GET_PLAYER(play); switch (this->goronState) { @@ -1925,23 +1933,23 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, PlayState* play) { this->trackingMode = NPC_TRACKING_NONE; this->isUncurled = false; this->isAwake = false; - this->actionFunc = EnGo2_ActionCurledUp; + this->actionFunc = EnGo2_CurledUp; } } -void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { +void EnGo2_GoronFireGeneric(EnGo2* this, PlayState* play) { Player* player = GET_PLAYER(play); Vec3s zeroVec = { 0x00, 0x00, 0x00 }; switch (this->goronState) { case 0: // Wake up if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - EnGo2_GoronFireCamera(this, play); + EnGo2_GoronFireGeneric_CreateSubcamera(this, play); play->msgCtx.msgMode = MSGMODE_PAUSED; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_WALKING_LOOP); this->waypoint = 1; this->skelAnime.playSpeed = 2.0f; - func_80A44D84(this); + EnGo2_OrientInstant(this); this->actor.shape.rot = this->actor.world.rot; this->animTimer = 60; this->actor.gravity = 0.0f; @@ -1991,7 +1999,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, PlayState* play) { } case 4: // Finalize walking away Message_CloseTextbox(play); - EnGo2_GoronFireClearCamera(this, play); + EnGo2_GoronFireGeneric_ClearSubcamera(this, play); Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); Actor_Kill(&this->actor); break; @@ -2004,23 +2012,23 @@ void EnGo2_Update(Actor* thisx, PlayState* play) { EnGo2* this = (EnGo2*)thisx; EnGo2_UpdateShadowAlpha(this, &this->shadownAlpha); - EnGo2_UpdateStandUpAnim(this); + EnGo2_PlayStandingChangeSfx(this); SkelAnime_Update(&this->skelAnime); EnGo2_RollForward(this); Actor_UpdateBgCheckInfo(play, &this->actor, this->collider.dim.height * 0.5f, this->collider.dim.radius * 0.6f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); #if OOT_VERSION < PAL_1_0 - func_80A44AB0(this, play); + EnGo2_UpdateRollingKnockback(this, play); #else if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { - func_80A44AB0(this, play); + EnGo2_UpdateRollingKnockback(this, play); } #endif this->actionFunc(this, play); if (this->isUncurled == true) { func_80034F54(play, this->unk_226, this->unk_24A, GORON_LIMB_MAX); } - func_80A45288(this, play); + EnGo2_TrackPlayer(this, play); EnGo2_EyeMouthTexState(this); EnGo2_CheckCollision(this, play); } @@ -2045,7 +2053,7 @@ s32 EnGo2_DrawRolling(EnGo2* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2914); Gfx_SetupDL_25Opa(play->state.gfxCtx); - speedXZ = this->actionFunc == EnGo2_ActionRollingReverse ? 0.0f : this->actor.speed; + speedXZ = this->actionFunc == EnGo2_RollingReverse ? 0.0f : this->actor.speed; Matrix_RotateZYX((play->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go2.c", 2926); gSPDisplayList(POLY_OPA_DISP++, gGoronRollingDL); @@ -2096,15 +2104,15 @@ void EnGo2_Draw(Actor* thisx, PlayState* play) { EnGo2_DrawEffects(this, play); Matrix_Pop(); - if ((this->actionFunc == EnGo2_ActionCurledUp) && (this->skelAnime.playSpeed == 0.0f) && + if ((this->actionFunc == EnGo2_CurledUp) && (this->skelAnime.playSpeed == 0.0f) && (this->skelAnime.curFrame == 0.0f)) { if (1) {} EnGo2_DrawCurledUp(this, play); return; } - if (this->actionFunc == EnGo2_ActionRollingSlow || this->actionFunc == EnGo2_ActionRollingReverse || - this->actionFunc == EnGo2_ActionRollingContinue) { + if (this->actionFunc == EnGo2_RollingSlow || this->actionFunc == EnGo2_RollingReverse || + this->actionFunc == EnGo2_RollingStart) { EnGo2_DrawRolling(this, play); return; } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 520d662aa37..86f6d1025dc 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -79,9 +79,8 @@ typedef struct EnGo2 { /* 0x04AC */ Vec3f subCamAt; /* 0x04B8 */ Vec3s jointTable[GORON_LIMB_MAX]; /* 0x0524 */ Vec3s morphTable[GORON_LIMB_MAX]; - /* 0x0590 */ s16 bounceTimer; // timer - /* 0x0592 */ s16 - animTimer; // animTimer. Plays NA_SE_EN_MORIBLIN_WALK, NA_SE_EV_IRON_DOOR_OPEN, NA_SE_EV_IRON_DOOR_CLOSE + /* 0x0590 */ s16 bounceTimer; + /* 0x0592 */ s16 animTimer; /* 0x0594 */ s32 getItemId; /* 0x0598 */ char unk_598[0x02]; /* 0x059A */ s16 subCamId; From 41b9cd04873a1a4fb59650866b0f6708d03bf30b Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 12 Nov 2024 09:40:32 +0100 Subject: [PATCH 36/68] rematch `EnGo2_StopRolling` --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index dec69d25008..9fcfe8614c3 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1395,16 +1395,19 @@ void EnGo2_StartRolling(EnGo2* this, PlayState* play) { void EnGo2_StopRolling(EnGo2* this, PlayState* play) { EnBom* bomb; - if ((ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG) && (ENGO2_GET_TYPE(this) != GORON_CITY_LINK)) { - if (ENGO2_GET_TYPE(this) == GORON_DMT_ROLLING_SMALL) { + switch (ENGO2_GET_TYPE(this)) { + case GORON_DMT_ROLLING_SMALL: bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); if (bomb != NULL) { bomb->timer = 0; } - } - } else { - this->collider.elem.acElemFlags = ACELEM_NONE; + break; + + case GORON_CITY_LINK: + case GORON_CITY_ROLLING_BIG: + this->collider.elem.acElemFlags = ACELEM_NONE; + break; } this->actor.shape.rot = this->actor.world.rot; From dbe0a46137ebfab2953fdf67596c38fbea165684 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 11 Nov 2024 23:51:59 +0100 Subject: [PATCH 37/68] unify EnGo2 waking up naming --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 25 ++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 9fcfe8614c3..c941a07d3aa 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1216,12 +1216,8 @@ s32 EnGo2_IsAttentionDrawnExtented(EnGo2* this, PlayState* play) { return false; } -void EnGo2_DefaultWakingUp(EnGo2* this) { - if (EnGo2_IsAttentionDrawn(this)) { - this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; - } else { - this->trackingMode = NPC_TRACKING_NONE; - } +void EnGo2_SetupUncurledFlags_Default(EnGo2* this) { + this->trackingMode = EnGo2_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_FULL_BODY; @@ -1230,7 +1226,8 @@ void EnGo2_DefaultWakingUp(EnGo2* this) { this->isAwake = true; } -void EnGo2_WakingUp(EnGo2* this) { +void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) { + // always false, he wakes up with `EnGo2_SetupUncurledFlags_Biggoron` f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f; s32 isTrue = true; @@ -1243,7 +1240,7 @@ void EnGo2_WakingUp(EnGo2* this) { this->isAwake = isTrue; } -void EnGo2_BiggoronWakingUp(EnGo2* this) { +void EnGo2_SetupUncurledFlags_Biggoron(EnGo2* this) { if (EnGo2_IsAttentionDrawn(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; this->isAwake = true; @@ -1253,26 +1250,26 @@ void EnGo2_BiggoronWakingUp(EnGo2* this) { } } -void EnGo2_AnimateGoronWakingUp(EnGo2* this) { +void EnGo2_SetupUncurledFlags(EnGo2* this) { switch (ENGO2_GET_TYPE(this)) { case GORON_DMT_BOMB_FLOWER: this->isAwake = true; this->trackingMode = EnGo2_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; break; case GORON_FIRE_GENERIC: - EnGo2_WakingUp(this); + EnGo2_SetupUncurledFlags_NearTracking(this); break; case GORON_DMT_BIGGORON: - EnGo2_BiggoronWakingUp(this); + EnGo2_SetupUncurledFlags_Biggoron(this); break; case GORON_CITY_LINK: if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) { - EnGo2_WakingUp(this); + EnGo2_SetupUncurledFlags_NearTracking(this); break; } FALLTHROUGH; default: - EnGo2_DefaultWakingUp(this); + EnGo2_SetupUncurledFlags_Default(this); break; } } @@ -1705,7 +1702,7 @@ void EnGo2_Standing(EnGo2* this, PlayState* play) { if (this->isUncurled == true) { EnGo2_AnimateBiggoronAndDoSfx(this); EnGo2_AnimateGoronLinkAndDoSfx(this, play); - EnGo2_AnimateGoronWakingUp(this); + EnGo2_SetupUncurledFlags(this); if (!EnGo2_IsGoronRollingBig(this, play) && !EnGo2_IsGoronFireGeneric(this)) { if (EnGo2_IsGoronDmtBombFlower(this)) { From 37569e2518112e09bb62d63dfc87d9c2cda1bb09 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 12 Nov 2024 16:48:12 +0100 Subject: [PATCH 38/68] Document `func_80A44790` as `EnGo2_UpdateTalking` rename `.isAwake` as `.isTalkative --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 30 +++++++++++------------ src/overlays/actors/ovl_En_Go2/z_en_go2.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index c941a07d3aa..78d1eab9b33 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -842,7 +842,7 @@ s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { #endif } -s32 func_80A44790(EnGo2* this, PlayState* play) { +s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) { if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON && ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG) { return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, EnGo2_GetTextId, EnGo2_UpdateTalkState); @@ -1127,8 +1127,8 @@ void EnGo2_TrackPlayer(EnGo2* this, PlayState* play) { sPlayerTrackingYOffsets[ENGO2_GET_TYPE(this)][((void)0, gSaveContext.save.linkAge)]; Npc_TrackPoint(&this->actor, &this->interactInfo, 4, this->trackingMode); } - if ((this->actionFunc != EnGo2_HandleOfferParented) && (this->isAwake == true)) { - if (func_80A44790(this, play)) { + if ((this->actionFunc != EnGo2_HandleOfferParented) && (this->isTalkative == true)) { + if (EnGo2_UpdateTalking(this, play)) { EnGo2_BiggoronSetTextId(this, play, player); } } @@ -1223,7 +1223,7 @@ void EnGo2_SetupUncurledFlags_Default(EnGo2* this) { this->trackingMode = NPC_TRACKING_FULL_BODY; } - this->isAwake = true; + this->isTalkative = true; } void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) { @@ -1237,23 +1237,23 @@ void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) { this->trackingMode = NPC_TRACKING_FULL_BODY; } - this->isAwake = isTrue; + this->isTalkative = isTrue; } void EnGo2_SetupUncurledFlags_Biggoron(EnGo2* this) { if (EnGo2_IsAttentionDrawn(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; - this->isAwake = true; + this->isTalkative = true; } else { this->trackingMode = NPC_TRACKING_NONE; - this->isAwake = false; + this->isTalkative = false; } } void EnGo2_SetupUncurledFlags(EnGo2* this) { switch (ENGO2_GET_TYPE(this)) { case GORON_DMT_BOMB_FLOWER: - this->isAwake = true; + this->isTalkative = true; this->trackingMode = EnGo2_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; break; case GORON_FIRE_GENERIC: @@ -1343,7 +1343,7 @@ void EnGo2_AnimateRolling(EnGo2* this, PlayState* play) { EnGo2_SwapInitialFrameAnimFrameCount(this); this->trackingMode = NPC_TRACKING_NONE; this->isUncurled = false; - this->isAwake = false; + this->isTalkative = false; this->actionFunc = EnGo2_CurledUp; } @@ -1435,7 +1435,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_SIDESTEP_LOOP); this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - this->isAwake = false; + this->isTalkative = false; this->trackingMode = NPC_TRACKING_NONE; this->actionFunc = EnGo2_GoronDmtBombFlower; return true; @@ -1577,7 +1577,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->actor.gravity = -1.0f; this->shadownAlpha = this->actor.shape.shadowAlpha = 0; this->reverse = 0; - this->isAwake = false; + this->isTalkative = false; this->isUncurled = false; this->goronState = 0; this->waypoint = 0; @@ -1617,7 +1617,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { #endif this->collider.dim.height = (sColliderData[ENGO2_GET_TYPE(this)].height * 0.6f); EnGo2_StartRolling(this, play); - this->isAwake = true; + this->isTalkative = true; } break; case GORON_CITY_ROLLING_BIG: @@ -1629,7 +1629,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { if (ENGO2_IS_CAGE_OPEN(play, this)) { Actor_Kill(&this->actor); } else { - this->isAwake = true; + this->isTalkative = true; this->actionFunc = EnGo2_CurledUp; } break; @@ -1687,7 +1687,7 @@ void EnGo2_CurledUp(EnGo2* this, PlayState* play) { (height * 0.6f)); } if (EnGo2_IsGoronFireGenericFreed(this, play)) { - this->isAwake = false; + this->isTalkative = false; EnGo2_WakeUpAnimated(this, play); } if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsAttentionDrawn(this)) { @@ -1932,7 +1932,7 @@ void EnGo2_GoronLink(EnGo2* this, PlayState* play) { SET_INFTABLE(INFTABLE_10C); this->trackingMode = NPC_TRACKING_NONE; this->isUncurled = false; - this->isAwake = false; + this->isTalkative = false; this->actionFunc = EnGo2_CurledUp; } } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 86f6d1025dc..46be63a714c 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -59,7 +59,7 @@ typedef struct EnGo2 { /* 0x020C */ u8 messageEntry; // tracks message state changes, like with `BOX_BREAK` or `TEXTID` /* 0x020D */ u8 messageState; // last known result of `Message_GetState` /* 0x020E */ u8 reverse; - /* 0x020F */ u8 isAwake; + /* 0x020F */ u8 isTalkative; /* 0x0210 */ s8 waypoint; /* 0x0211 */ u8 isUncurled; /* 0x0212 */ u8 goronState; From da79fb473fb7494ab59bad1d0d1856e693ce29c6 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 12 Nov 2024 20:08:46 +0100 Subject: [PATCH 39/68] document `focusOffset` variables --- src/overlays/actors/ovl_En_Go/z_en_go.c | 12 ++++++------ src/overlays/actors/ovl_En_Go2/z_en_go2.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 40bdc6708fd..4cbfb918480 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1074,7 +1074,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) { } void EnGo_DrawCurledUp(EnGo* this, PlayState* play) { - Vec3f D_80A41BB4 = { 0.0f, 0.0f, 0.0f }; + Vec3f focusOffset = { 0.0f, 0.0f, 0.0f }; OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2320); @@ -1085,14 +1085,14 @@ void EnGo_DrawCurledUp(EnGo* this, PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, gGoronCurledUpDL); - Matrix_MultVec3f(&D_80A41BB4, &this->actor.focus.pos); + Matrix_MultVec3f(&focusOffset, &this->actor.focus.pos); Matrix_Pop(); CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2341); } void EnGo_DrawRolling(EnGo* this, PlayState* play) { - Vec3f D_80A41BC0 = { 0.0f, 0.0f, 0.0f }; + Vec3f focusOffset = { 0.0f, 0.0f, 0.0f }; OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2355); @@ -1102,7 +1102,7 @@ void EnGo_DrawRolling(EnGo* this, PlayState* play) { MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go.c", 2368); gSPDisplayList(POLY_OPA_DISP++, gGoronRollingDL); - Matrix_MultVec3f(&D_80A41BC0, &this->actor.focus.pos); + Matrix_MultVec3f(&focusOffset, &this->actor.focus.pos); Matrix_Pop(); CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2383); @@ -1136,10 +1136,10 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Ve void EnGo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGo* this = (EnGo*)thisx; - Vec3f D_80A41BCC = { 600.0f, 0.0f, 0.0f }; + Vec3f focusOffset = { 600.0f, 0.0f, 0.0f }; // ahead, this distance if (limbIndex == GORON_LIMB_HEAD) { - Matrix_MultVec3f(&D_80A41BCC, &this->actor.focus.pos); + Matrix_MultVec3f(&focusOffset, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 78d1eab9b33..16f2f658200 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -2034,21 +2034,21 @@ void EnGo2_Update(Actor* thisx, PlayState* play) { } s32 EnGo2_DrawCurledUp(EnGo2* this, PlayState* play) { - Vec3f D_80A48554 = { 0.0f, 0.0f, 0.0f }; + Vec3f focusOffset = { 0.0f, 0.0f, 0.0f }; OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2881); Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go2.c", 2884); gSPDisplayList(POLY_OPA_DISP++, gGoronCurledUpDL); CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2889); - Matrix_MultVec3f(&D_80A48554, &this->actor.focus.pos); + Matrix_MultVec3f(&focusOffset, &this->actor.focus.pos); return 1; } s32 EnGo2_DrawRolling(EnGo2* this, PlayState* play) { s32 pad; - Vec3f D_80A48560 = { 0.0f, 0.0f, 0.0f }; + Vec3f focusOffset = { 0.0f, 0.0f, 0.0f }; f32 speedXZ; OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2914); @@ -2058,7 +2058,7 @@ s32 EnGo2_DrawRolling(EnGo2* this, PlayState* play) { MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_go2.c", 2926); gSPDisplayList(POLY_OPA_DISP++, gGoronRollingDL); CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 2930); - Matrix_MultVec3f(&D_80A48560, &this->actor.focus.pos); + Matrix_MultVec3f(&focusOffset, &this->actor.focus.pos); return 1; } @@ -2087,10 +2087,10 @@ s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, V void EnGo2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGo2* this = (EnGo2*)thisx; - Vec3f D_80A4856C = { 600.0f, 0.0f, 0.0f }; + Vec3f focusOffset = { 600.0f, 0.0f, 0.0f }; // ahead, this distance if (limbIndex == GORON_LIMB_HEAD) { - Matrix_MultVec3f(&D_80A4856C, &this->actor.focus.pos); + Matrix_MultVec3f(&focusOffset, &this->actor.focus.pos); } } From 1c416becd6b67bf9d3adc267f0db10d74736da66 Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 13 Nov 2024 12:25:22 +0100 Subject: [PATCH 40/68] rematch `EnGo2_UpdateTalking` a bit --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 16f2f658200..d8220d3bc76 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -843,12 +843,21 @@ s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { } s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) { - if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON && ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG) { - return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, - EnGo2_GetTextId, EnGo2_UpdateTalkState); - } else if ((ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { + // default: + if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON) { + if (ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG) { + return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, + EnGo2_GetTextId, EnGo2_UpdateTalkState); + } + } + + // `GORON_DMT_BIGGORON`, attention wasn't drawn + if ((ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { return false; - } else { + } + + // `GORON_DMT_BIGGORON` || `GORON_CITY_ROLLING_BIG` + { if (Actor_TalkOfferAccepted(&this->actor, play)) { this->interactInfo.talkState = NPC_TALK_STATE_TALKING; return true; @@ -1830,7 +1839,7 @@ void EnGo2_HandleOffer(EnGo2* this, PlayState* play) { #endif this->actionFunc = EnGo2_HandleOfferParented; } else { - // @redundant: this action is always paired with `EnGo2_OfferItem`, which itself calls Actor_OfferGetItem + // @redundant: this action is always paired with `EnGo2_OfferItem`, which itself calls `Actor_OfferGetItem` Actor_OfferGetItem(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); } From 35d0d71008aa13634e2983a027aa448f4384e084 Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 13 Nov 2024 12:26:33 +0100 Subject: [PATCH 41/68] `EnGo2_IsCameraModified` -> `EnGo2_ShouldStay` --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index d8220d3bc76..1be0406ae95 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -851,9 +851,11 @@ s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) { } } - // `GORON_DMT_BIGGORON`, attention wasn't drawn - if ((ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { - return false; + // `GORON_DMT_BIGGORON`, attention wasn't drawn; see `EnGo2_IsAttentionDrawn` + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { + if (!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { + return false; + } } // `GORON_DMT_BIGGORON` || `GORON_CITY_ROLLING_BIG` @@ -1199,7 +1201,7 @@ f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { } } -s32 EnGo2_IsAttentionDrawnExtented(EnGo2* this, PlayState* play) { +s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) { Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { @@ -1734,7 +1736,7 @@ void EnGo2_Standing(EnGo2* this, PlayState* play) { (s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f)); } } - if ((!EnGo2_IsAttentionDrawnExtented(this, play)) && (!EnGo2_IsAttentionDrawn(this))) { + if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsAttentionDrawn(this))) { EnGo2_AnimateRolling(this, play); } } From 7c1d6f54dfba2dd30c3b24242b47e349e8cfdeaf Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 13 Nov 2024 12:53:48 +0100 Subject: [PATCH 42/68] rename `func_80A408D8` -> `EnGo_AttentionLost` --- src/overlays/actors/ovl_En_Go/z_en_go.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 4cbfb918480..d8dfa500076 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -21,7 +21,7 @@ void EnGo_AttentionDrawn(EnGo* this, PlayState* play); void EnGo_CurlUp(EnGo* this, PlayState* play); void EnGo_Sitting(EnGo* this, PlayState* play); void EnGo_Standing(EnGo* this, PlayState* play); -void EnGo_LostAttention(EnGo* this, PlayState* play); +void EnGo_AttentionLost(EnGo* this, PlayState* play); void EnGo_GoronDmtBombFlower(EnGo* this, PlayState* play); void EnGo_Interact(EnGo* this, PlayState* play); @@ -915,12 +915,12 @@ void EnGo_Standing(EnGo* this, PlayState* play) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; this->skelAnime.playSpeed *= ENGO_GET_SPEED_SCALE(this); - EnGo_SetupAction(this, EnGo_LostAttention); + EnGo_SetupAction(this, EnGo_AttentionLost); } } } -void EnGo_LostAttention(EnGo* this, PlayState* play) { +void EnGo_AttentionLost(EnGo* this, PlayState* play) { f32 frame; if (this->skelAnime.playSpeed != 0.0f) { From 17d5b2aaa3f561e9f35d26dc02bf2698d72e44bb Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 13 Nov 2024 12:59:42 +0100 Subject: [PATCH 43/68] give better names to the attention switching funcs --- src/overlays/actors/ovl_En_Go/z_en_go.c | 10 +++++----- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index d8dfa500076..190354e2dab 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -443,7 +443,7 @@ void EnGo_UpdateBlinking(EnGo* this) { } } -s32 EnGo_IsAttentionDrawn(EnGo* this, PlayState* play) { +s32 EnGo_IsInRange(EnGo* this, PlayState* play) { f32 xyzDistSq; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; @@ -798,7 +798,7 @@ void EnGo_GoronFireGeneric(EnGo* this, PlayState* play) { } void EnGo_CurledUp(EnGo* this, PlayState* play) { - if ((DECR(this->curledTimer) == 0) && EnGo_IsAttentionDrawn(this, play)) { + if ((DECR(this->curledTimer) == 0) && EnGo_IsInRange(this, play)) { Audio_PlaySfxGeneral(NA_SE_EN_GOLON_WAKE_UP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -836,7 +836,7 @@ void EnGo_AttentionDrawn(EnGo* this, PlayState* play) { Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); EnGo_SetupAction(this, EnGo_Sitting); - } else if (!EnGo_IsAttentionDrawn(this, play)) { + } else if (!EnGo_IsInRange(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = 0.0f; EnGo_SetupAction(this, EnGo_CurlUp); @@ -911,7 +911,7 @@ void EnGo_Standing(EnGo* this, PlayState* play) { play->msgCtx.stateTimer = 4; play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; } else { - if ((DECR(this->attentionCooldown) == 0) && !EnGo_IsAttentionDrawn(this, play)) { + if ((DECR(this->attentionCooldown) == 0) && !EnGo_IsInRange(this, play)) { EnGo_ReverseAnimation(this); this->skelAnime.playSpeed = -0.1f; this->skelAnime.playSpeed *= ENGO_GET_SPEED_SCALE(this); @@ -941,7 +941,7 @@ void EnGo_AttentionLost(EnGo* this, PlayState* play) { if (DECR(this->attentionCooldown) == 0) { EnGo_SetupAction(this, EnGo_CurlUp); - } else if (EnGo_IsAttentionDrawn(this, play)) { + } else if (EnGo_IsInRange(this, play)) { EnGo_ReverseAnimation(this); Audio_PlaySfxGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 1be0406ae95..4d2c9fd598e 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -851,7 +851,7 @@ s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) { } } - // `GORON_DMT_BIGGORON`, attention wasn't drawn; see `EnGo2_IsAttentionDrawn` + // `GORON_DMT_BIGGORON`, close enough; see `EnGo2_IsInRange` if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { if (!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { return false; @@ -999,7 +999,7 @@ s32 EnGo2_OrientInstant(EnGo2* this) { return 1; } -s32 EnGo2_IsAttentionDrawn(EnGo2* this) { +s32 EnGo2_IsInRange(EnGo2* this) { s16 yawDiff; f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f; f32 yDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 400.0f : 60.0f; @@ -1205,10 +1205,10 @@ s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) { Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { - if (EnGo2_IsAttentionDrawn(this)) { + if (EnGo2_IsInRange(this)) { Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW); Camera_UnsetStateFlag(mainCam, CAM_STATE_CHECK_BG); - } else if (!EnGo2_IsAttentionDrawn(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { + } else if (!EnGo2_IsInRange(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { Camera_RequestSetting(mainCam, CAM_SET_DUNGEON1); Camera_SetStateFlag(mainCam, CAM_STATE_CHECK_BG); } @@ -1228,7 +1228,7 @@ s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) { } void EnGo2_SetupUncurledFlags_Default(EnGo2* this) { - this->trackingMode = EnGo2_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; + this->trackingMode = EnGo2_IsInRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_FULL_BODY; @@ -1252,7 +1252,7 @@ void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) { } void EnGo2_SetupUncurledFlags_Biggoron(EnGo2* this) { - if (EnGo2_IsAttentionDrawn(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { + if (EnGo2_IsInRange(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; this->isTalkative = true; } else { @@ -1265,7 +1265,7 @@ void EnGo2_SetupUncurledFlags(EnGo2* this) { switch (ENGO2_GET_TYPE(this)) { case GORON_DMT_BOMB_FLOWER: this->isTalkative = true; - this->trackingMode = EnGo2_IsAttentionDrawn(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; + this->trackingMode = EnGo2_IsInRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; break; case GORON_FIRE_GENERIC: EnGo2_SetupUncurledFlags_NearTracking(this); @@ -1472,7 +1472,7 @@ s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { s32 EnGo2_IsGoronLinkReversing(EnGo2* this) { if (ENGO2_GET_TYPE(this) != GORON_CITY_LINK || (this->waypoint >= this->reverseWaypoint) || - !EnGo2_IsAttentionDrawn(this)) { + !EnGo2_IsInRange(this)) { return false; } return true; @@ -1701,7 +1701,7 @@ void EnGo2_CurledUp(EnGo2* this, PlayState* play) { this->isTalkative = false; EnGo2_WakeUpAnimated(this, play); } - if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsAttentionDrawn(this)) { + if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsInRange(this)) { EnGo2_WakeUpAnimated(this, play); } } @@ -1736,7 +1736,7 @@ void EnGo2_Standing(EnGo2* this, PlayState* play) { (s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f)); } } - if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsAttentionDrawn(this))) { + if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsInRange(this))) { EnGo2_AnimateRolling(this, play); } } From 7f3642d522bcc0ed87741b0a5f5a60c639beff84 Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 13 Nov 2024 13:06:30 +0100 Subject: [PATCH 44/68] give better enum names --- src/overlays/actors/ovl_En_Go/z_en_go.c | 6 +-- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 46 +++++++++++------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 190354e2dab..0802d84ce47 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -72,7 +72,7 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; typedef enum EnGoAnimation { /* 0 */ ENGO_ANIM_UNCURL_SIT_STAND_IDLE, // default idle - /* 1 */ ENGO_ANIM_UNCURL_SIT_STAND, + /* 1 */ ENGO_ANIM_UNCURL_SIT_STAND_NORMAL, /* 2 */ ENGO_ANIM_WALKING_LOOP, /* 3 */ ENGO_ANIM_SIDESTEP_LOOP } EnGoAnimation; @@ -956,7 +956,7 @@ void EnGo_Sidestep(EnGo* this, PlayState* play) { this->actor.speed = Math_SinS((s16)float2); if (EnGo_FollowPath(this, play) && this->waypoint == 0) { - EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND); + EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND_NORMAL); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); this->actor.speed = 0.0f; EnGo_SetupAction(this, EnGo_Standing); @@ -1039,7 +1039,7 @@ void EnGo_TakingEyedrops(EnGo* this, PlayState* play) { void EnGo_EyedropsTaken(EnGo* this, PlayState* play) { if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { - EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND); + EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND_NORMAL); this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronUncurlSitStandAnim); Message_CloseTextbox(play); EnGo_SetupAction(this, EnGo_Interact); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 4d2c9fd598e..9d350ee8e0a 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -120,7 +120,7 @@ static f32 sPlayerTrackingYOffsets[14][2] = { typedef enum EnGo2Animation { /* 0 */ ENGO2_ANIM_UNCURL_SIT_STAND_IDLE, // default idle - /* 1 */ ENGO2_ANIM_UNCURL_SIT_STAND, + /* 1 */ ENGO2_ANIM_UNCURL_SIT_STAND_NORMAL, /* 2 */ ENGO2_ANIM_WALKING_LOOP, /* 3 */ ENGO2_ANIM_SIDESTEP_LOOP, /* 4 */ ENGO2_ANIM_CRYING_LOOP, @@ -152,7 +152,7 @@ static AnimationInfo sAnimationInfo[] = { #define ENGO2_GET_TYPE(this) PARAMS_GET_S((this)->actor.params, 0, 5) typedef enum GoronType { - /* 0x00 */ GORON_CITY_ROLLING_BIG, + /* 0x00 */ GORON_CITY_HOT_RODDER, /* 0x01 */ GORON_CITY_LINK, /* 0x02 */ GORON_DMT_BIGGORON, /* 0x03 */ GORON_FIRE_GENERIC, @@ -181,7 +181,7 @@ static EnGo2DustEffectData sDustEffectData[2][4] = { { 12, 0.2f, 0.2f, 1, 18.0f, 0.0f }, }, { - // GORON_CITY_ROLLING_BIG + // GORON_CITY_HOT_RODDER { 12, 0.5f, 0.4f, 3, 42.0f, 0.0f }, { 12, 0.5f, 0.4f, 3, 42.0f, 0.0f }, { 12, 0.5f, 0.4f, 3, 42.0f, 0.0f }, @@ -768,7 +768,7 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { return textId; } else { switch (ENGO2_GET_TYPE(this)) { - case GORON_CITY_ROLLING_BIG: + case GORON_CITY_HOT_RODDER: return EnGo2_GetTextIdGoronCityRollingBig(play, this); case GORON_CITY_LINK: return EnGo2_GetTextIdGoronCityLink(play, this); @@ -806,7 +806,7 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; switch (ENGO2_GET_TYPE(this)) { - case GORON_CITY_ROLLING_BIG: + case GORON_CITY_HOT_RODDER: return EnGo2_UpdateTalkStateGoronCityRollingBig(play, this); case GORON_CITY_LINK: return EnGo2_UpdateTalkStateGoronCityLink(play, this); @@ -845,7 +845,7 @@ s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) { // default: if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON) { - if (ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG) { + if (ENGO2_GET_TYPE(this) != GORON_CITY_HOT_RODDER) { return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, EnGo2_GetTextId, EnGo2_UpdateTalkState); } @@ -858,7 +858,7 @@ s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) { } } - // `GORON_DMT_BIGGORON` || `GORON_CITY_ROLLING_BIG` + // `GORON_DMT_BIGGORON` || `GORON_CITY_HOT_RODDER` { if (Actor_TalkOfferAccepted(&this->actor, play)) { this->interactInfo.talkState = NPC_TALK_STATE_TALKING; @@ -1047,8 +1047,8 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 boundSpeed, s16 ru // bounce! { if (this->bounceCounter >= 2) { - Actor_PlaySfx(&this->actor, (ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG) ? NA_SE_EN_GOLON_LAND_BIG - : NA_SE_EN_DODO_M_GND); + Actor_PlaySfx(&this->actor, (ENGO2_GET_TYPE(this) == GORON_CITY_HOT_RODDER) ? NA_SE_EN_GOLON_LAND_BIG + : NA_SE_EN_DODO_M_GND); } this->bounceCounter--; @@ -1169,7 +1169,7 @@ void EnGo2_RollForward(EnGo2* this) { void EnGo2_ChooseIdleAnimation(EnGo2* this) { switch (ENGO2_GET_TYPE(this)) { - case GORON_CITY_ROLLING_BIG: + case GORON_CITY_HOT_RODDER: case GORON_DMT_DC_ENTRANCE: case GORON_CITY_ENTRANCE: case GORON_CITY_STAIRWELL: @@ -1197,7 +1197,7 @@ f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { (this->actor.xzDistToPlayer < 400.0f)) { return 9.0f; } else { - return index == GORON_CITY_ROLLING_BIG ? 3.6000001f : 6.0f; + return index == GORON_CITY_HOT_RODDER ? 3.6000001f : 6.0f; } } @@ -1214,7 +1214,7 @@ s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) { } } - if (ENGO2_GET_TYPE(this) == GORON_FIRE_GENERIC || ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG || + if (ENGO2_GET_TYPE(this) == GORON_FIRE_GENERIC || ENGO2_GET_TYPE(this) == GORON_CITY_HOT_RODDER || ENGO2_GET_TYPE(this) == GORON_CITY_STAIRWELL || (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) || ENGO2_GET_TYPE(this) == GORON_MARKET_BAZAAR) { return true; @@ -1335,7 +1335,7 @@ void EnGo2_PlayStandingChangeSfx(EnGo2* this) { } void EnGo2_SpawnDust(EnGo2* this, s32 index2) { - s32 index1 = ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG ? 1 : 0; + s32 index1 = ENGO2_GET_TYPE(this) == GORON_CITY_HOT_RODDER ? 1 : 0; EnGo2DustEffectData* dustEffectData = &sDustEffectData[index1][index2]; EnGo2_SpawnDustExplicitly(this, dustEffectData->initialTimer, dustEffectData->scale, dustEffectData->scaleStep, @@ -1348,7 +1348,7 @@ void EnGo2_AnimateRolling(EnGo2* this, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_BIG); this->skelAnime.playSpeed = -0.5f; } else { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_NORMAL); this->skelAnime.playSpeed = -1.0f; } EnGo2_SwapInitialFrameAnimFrameCount(this); @@ -1371,14 +1371,14 @@ void EnGo2_WakeUpAnimated(EnGo2* this, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_BIG); this->skelAnime.playSpeed = 0.5f; } else { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_NORMAL); this->skelAnime.playSpeed = 1.0f; } this->actionFunc = EnGo2_Standing; } void EnGo2_WakeUpInstant(EnGo2* this, PlayState* play) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_NORMAL); this->isUncurled = true; this->actionFunc = EnGo2_Standing; this->skelAnime.playSpeed = 0.0f; @@ -1387,7 +1387,7 @@ void EnGo2_WakeUpInstant(EnGo2* this, PlayState* play) { } void EnGo2_StartRolling(EnGo2* this, PlayState* play) { - if (ENGO2_GET_TYPE(this) == GORON_CITY_ROLLING_BIG || ENGO2_GET_TYPE(this) == GORON_CITY_LINK) { + if (ENGO2_GET_TYPE(this) == GORON_CITY_HOT_RODDER || ENGO2_GET_TYPE(this) == GORON_CITY_LINK) { this->collider.elem.acElemFlags = ACELEM_ON; this->actor.speed = GET_INFTABLE(INFTABLE_11E) ? 6.0f : 3.6000001f; } else { @@ -1413,7 +1413,7 @@ void EnGo2_StopRolling(EnGo2* this, PlayState* play) { break; case GORON_CITY_LINK: - case GORON_CITY_ROLLING_BIG: + case GORON_CITY_HOT_RODDER: this->collider.elem.acElemFlags = ACELEM_NONE; break; } @@ -1453,7 +1453,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { } s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { - if (ENGO2_GET_TYPE(this) != GORON_CITY_ROLLING_BIG || (this->interactInfo.talkState != NPC_TALK_STATE_ACTION)) { + if (ENGO2_GET_TYPE(this) != GORON_CITY_HOT_RODDER || (this->interactInfo.talkState != NPC_TALK_STATE_ACTION)) { return false; } this->interactInfo.talkState = NPC_TALK_STATE_IDLE; @@ -1565,7 +1565,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - // Not GORON_CITY_ROLLING_BIG, GORON_CITY_LINK, GORON_DMT_BIGGORON + // Not GORON_CITY_HOT_RODDER, GORON_CITY_LINK, GORON_DMT_BIGGORON switch (ENGO2_GET_TYPE(this)) { case GORON_FIRE_GENERIC: case GORON_DMT_BOMB_FLOWER: @@ -1631,7 +1631,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->isTalkative = true; } break; - case GORON_CITY_ROLLING_BIG: + case GORON_CITY_HOT_RODDER: case GORON_DMT_ROLLING_SMALL: this->collider.dim.height = (sColliderData[ENGO2_GET_TYPE(this)].height * 0.6f); EnGo2_StartRolling(this, play); @@ -1808,7 +1808,7 @@ void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { this->goronState = 0; this->actionFunc = EnGo2_GoronLink; break; - case GORON_CITY_ROLLING_BIG: + case GORON_CITY_HOT_RODDER: EnGo2_WakeUpAnimated(this, play); break; default: @@ -1906,7 +1906,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { this->eyeMouthTexState = 0; } if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_NORMAL); this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; this->skelAnime.playSpeed = 0.0f; From 77fde2c89b87bb74378828e328a9cd61463644e3 Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 13 Nov 2024 13:28:59 +0100 Subject: [PATCH 45/68] rematch `EnGo2_RollingSlow` --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 9d350ee8e0a..5d816b5d134 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1772,7 +1772,6 @@ void EnGo2_RollingStart(EnGo2* this, PlayState* play) { void EnGo2_RollingSlow(EnGo2* this, PlayState* play) { s32 updatedWaypoint; - s32 index; if (!EnGo2_IsRolling(this)) { if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 1) == true) { @@ -1783,16 +1782,20 @@ void EnGo2_RollingSlow(EnGo2* this, PlayState* play) { EnGo2_SpawnDust(this, 3); } updatedWaypoint = EnGo2_FollowPath(this, play); - index = ENGO2_GET_TYPE(this); - if (index != GORON_CITY_LINK) { - if ((index == GORON_DMT_ROLLING_SMALL) && (updatedWaypoint == 1) && (this->waypoint == 0)) { - EnGo2_StopRolling(this, play); - return; - } - } else if ((updatedWaypoint == 2) && (this->waypoint == 1)) { - // @unreachable: `EnGo2_FollowPath` returns `0` or `1` - EnGo2_StopRolling(this, play); - return; + switch (ENGO2_GET_TYPE(this)) { + case GORON_DMT_ROLLING_SMALL: + if ((updatedWaypoint == 1) && (this->waypoint == 0)) { + EnGo2_StopRolling(this, play); + return; + } + break; + case GORON_CITY_LINK: + if ((updatedWaypoint == 2) && (this->waypoint == 1)) { + // @unreachable: `EnGo2_FollowPath` returns `0` or `1` + EnGo2_StopRolling(this, play); + return; + } + break; } Math_ApproachF(&this->actor.speed, EnGo2_GetTargetXZSpeed(this), 0.4f, 0.6f); this->actor.shape.rot = this->actor.world.rot; From 011cf6a5d1be9169fdfc3ee0f6f57e122888623c Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 13 Nov 2024 13:51:36 +0100 Subject: [PATCH 46/68] fix a misleading comment --- assets/xml/objects/object_oF1d_map.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index 26a7fbaa5a6..34f3dafded2 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -56,6 +56,8 @@ + + From 46648b4ab7faa368d709a0ebc9fcf5272aad6231 Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 00:02:44 +0100 Subject: [PATCH 47/68] name Hot Rodder consistently https://github.com/zeldaret/oot/pull/2295#discussion_r1841188972 --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 5d816b5d134..1deb6168434 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -46,7 +46,7 @@ void EnGo2_CurledUp(EnGo2* this, PlayState* play); void EnGo2_Standing(EnGo2* this, PlayState* play); void EnGo2_GoronDmtBombFlower(EnGo2* this, PlayState* play); -void EnGo2_GoronRollingBig(EnGo2* this, PlayState* play); +void EnGo2_GoronHotRodder(EnGo2* this, PlayState* play); void EnGo2_RollingStart(EnGo2* this, PlayState* play); void EnGo2_RollingSlow(EnGo2* this, PlayState* play); void EnGo2_GroundRolling(EnGo2* this, PlayState* play); @@ -340,7 +340,7 @@ u16 EnGo2_GoronFireGenericGetTextId(EnGo2* this) { } } -u16 EnGo2_GetTextIdGoronCityRollingBig(PlayState* play, EnGo2* this) { +u16 EnGo2_GetTextIdGoronCityHotRodder(PlayState* play, EnGo2* this) { if (GET_INFTABLE(INFTABLE_11E)) { return 0x3013; } else if (CUR_CAPACITY(UPG_BOMB_BAG) >= 20 && this->waypoint > 7 && this->waypoint < 12) { @@ -350,7 +350,7 @@ u16 EnGo2_GetTextIdGoronCityRollingBig(PlayState* play, EnGo2* this) { } } -s16 EnGo2_UpdateTalkStateGoronCityRollingBig(PlayState* play, EnGo2* this) { +s16 EnGo2_UpdateTalkStateGoronCityHotRodder(PlayState* play, EnGo2* this) { s32 bombBagUpgrade; switch (Message_GetState(&play->msgCtx)) { @@ -769,7 +769,7 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { } else { switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_HOT_RODDER: - return EnGo2_GetTextIdGoronCityRollingBig(play, this); + return EnGo2_GetTextIdGoronCityHotRodder(play, this); case GORON_CITY_LINK: return EnGo2_GetTextIdGoronCityLink(play, this); case GORON_DMT_BIGGORON: @@ -807,7 +807,7 @@ s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_HOT_RODDER: - return EnGo2_UpdateTalkStateGoronCityRollingBig(play, this); + return EnGo2_UpdateTalkStateGoronCityHotRodder(play, this); case GORON_CITY_LINK: return EnGo2_UpdateTalkStateGoronCityLink(play, this); case GORON_DMT_BIGGORON: @@ -1452,13 +1452,13 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { return true; } -s32 EnGo2_IsGoronRollingBig(EnGo2* this, PlayState* play) { +s32 EnGo2_IsGoronHotRodder(EnGo2* this, PlayState* play) { if (ENGO2_GET_TYPE(this) != GORON_CITY_HOT_RODDER || (this->interactInfo.talkState != NPC_TALK_STATE_ACTION)) { return false; } this->interactInfo.talkState = NPC_TALK_STATE_IDLE; EnGo2_AnimateRolling(this, play); - this->actionFunc = EnGo2_GoronRollingBig; + this->actionFunc = EnGo2_GoronHotRodder; return true; } @@ -1715,7 +1715,7 @@ void EnGo2_Standing(EnGo2* this, PlayState* play) { EnGo2_AnimateGoronLinkAndDoSfx(this, play); EnGo2_SetupUncurledFlags(this); - if (!EnGo2_IsGoronRollingBig(this, play) && !EnGo2_IsGoronFireGeneric(this)) { + if (!EnGo2_IsGoronHotRodder(this, play) && !EnGo2_IsGoronFireGeneric(this)) { if (EnGo2_IsGoronDmtBombFlower(this)) { return; } @@ -1751,7 +1751,7 @@ void EnGo2_GoronDmtBombFlower(EnGo2* this, PlayState* play) { } } -void EnGo2_GoronRollingBig(EnGo2* this, PlayState* play) { +void EnGo2_GoronHotRodder(EnGo2* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnGo2_SpawnDust(this, 1); this->skelAnime.playSpeed = 0.0f; @@ -1868,7 +1868,7 @@ void EnGo2_HandleOfferParented(EnGo2* this, PlayState* play) { case GI_BOMB_BAG_30: case GI_BOMB_BAG_40: EnGo2_AnimateRolling(this, play); - this->actionFunc = EnGo2_GoronRollingBig; + this->actionFunc = EnGo2_GoronHotRodder; return; } this->actionFunc = EnGo2_Standing; From 9fae0fa37c3c46309a0c0b2e488197937b90d2eb Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 00:04:54 +0100 Subject: [PATCH 48/68] make the `unused` comment a header https://github.com/zeldaret/oot/pull/2295#discussion_r1841145730 --- src/overlays/actors/ovl_En_Go/z_en_go.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 0802d84ce47..b2fe92cc2b4 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1,3 +1,7 @@ +/* @unused: unlike `ACTOR_EN_GO2`, this one doesn't participate in any scene whatsoever + * besides, this code bears a handful of bugs and WIP code; see `z_en_go2.c` instead + */ + #include "z_en_go.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" @@ -34,8 +38,6 @@ void EnGo_SpawnEffectDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, void EnGo_UpdateEffects(EnGo* this); void EnGo_DrawEffects(EnGo* this, PlayState* play); -// @unused: unlike `ACTOR_EN_GO2`, this one doesn't participate in any scene whatsoever -// besides, this code bears a handful of bugs and WIP code; see `z_en_go2.c` instead ActorProfile En_Go_Profile = { /**/ ACTOR_EN_GO, /**/ ACTORCAT_NPC, From 57c4c7653f2747c375c205d5eb6072264710252a Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 00:10:25 +0100 Subject: [PATCH 49/68] document the nature of type values https://github.com/zeldaret/oot/pull/2295#discussion_r1841150757 --- src/overlays/actors/ovl_En_Go/z_en_go.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index b2fe92cc2b4..95a4ebd0275 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -88,15 +88,15 @@ static AnimationSpeedInfo sAnimationInfo[] = { #define ENGO_GET_TYPE(this) PARAMS_GET_NOSHIFT((this)->actor.params, 4, 4) typedef enum EnGoType { - ENGO_TYPE_CITY_LINK = 0x00, - ENGO_TYPE_FIRE_GENERIC = 0x10, - ENGO_TYPE_DMT_DC_ENTRANCE = 0x20, - ENGO_TYPE_DMT_ROLLING_SMALL = 0x30, - ENGO_TYPE_DMT_BOMB_FLOWER = 0x40, - ENGO_TYPE_CITY_ENTRANCE = 0x50, - ENGO_TYPE_CITY_ISLAND = 0x60, - ENGO_TYPE_CITY_LOST_WOODS = 0x70, - ENGO_TYPE_DMT_BIGGORON = 0x90 + ENGO_TYPE_CITY_LINK = (0 << 4), + ENGO_TYPE_FIRE_GENERIC = (1 << 4), + ENGO_TYPE_DMT_DC_ENTRANCE = (2 << 4), + ENGO_TYPE_DMT_ROLLING_SMALL = (3 << 4), + ENGO_TYPE_DMT_BOMB_FLOWER = (4 << 4), + ENGO_TYPE_CITY_ENTRANCE = (5 << 4), + ENGO_TYPE_CITY_ISLAND = (6 << 4), + ENGO_TYPE_CITY_LOST_WOODS = (7 << 4), + ENGO_TYPE_DMT_BIGGORON = (9 << 4) } EnGoType; #define ENGO_GET_PATH_INDEX(this) PARAMS_GET_U((this)->actor.params, 0, 4) From a8dff36326b236b3f657275340d32a58e5262712 Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 00:11:25 +0100 Subject: [PATCH 50/68] remove unnecessary block braces https://github.com/zeldaret/oot/pull/2295#discussion_r1841154818 --- src/overlays/actors/ovl_En_Go/z_en_go.c | 16 +++++++--------- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 95a4ebd0275..6a40ed56555 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1168,17 +1168,15 @@ void EnGo_Draw(Actor* thisx, PlayState* play) { } // draw skeleton normally - { - Gfx_SetupDL_37Opa(play->state.gfxCtx); + Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gGoronCsEyeOpenTex)); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex)); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gGoronCsEyeOpenTex)); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex)); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor); - CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2525); - EnGo_DrawEffects(this, play); - } + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2525); + EnGo_DrawEffects(this, play); } void EnGo_SpawnEffectDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 1deb6168434..ff479b6c931 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -2132,15 +2132,13 @@ void EnGo2_Draw(Actor* thisx, PlayState* play) { } // draw skeleton normally - { - OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 3063); - Gfx_SetupDL_25Opa(play->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx, "../z_en_go2.c", 3063); + Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTexIndex])); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTextures[this->mouthTexIndex])); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnGo2_OverrideLimbDraw, EnGo2_PostLimbDraw, this); - CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 3081); - } + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGo2_OverrideLimbDraw, EnGo2_PostLimbDraw, this); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2.c", 3081); } From e2cda143b7be3cefca27997922e2d2c2103c41be Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 00:14:21 +0100 Subject: [PATCH 51/68] `CAGED_FLAG` -> `CAGED_SWITCH_FLAG` https://github.com/zeldaret/oot/pull/2295#discussion_r1841166305 --- src/overlays/actors/ovl_En_Go/z_en_go.c | 12 ++++++------ src/overlays/actors/ovl_En_Go2/z_en_go2.c | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 6a40ed56555..09b10b0e1c4 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -102,8 +102,8 @@ typedef enum EnGoType { #define ENGO_GET_PATH_INDEX(this) PARAMS_GET_U((this)->actor.params, 0, 4) #define ENGO_PATH_INDEX_NONE 0xF // likely the count of available paths -#define ENGO2_CAGED_FLAG(this) PARAMS_GET_NOMASK((this)->actor.params, 8) -#define ENGO2_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO2_CAGED_FLAG(this)) +#define ENGO_CAGED_SWITCH_FLAG(this) PARAMS_GET_NOMASK((this)->actor.params, 8) +#define ENGO_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO_CAGED_SWITCH_FLAG(this)) #define ENGO_GET_SPEED_SCALE(this) (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) @@ -158,7 +158,7 @@ u16 EnGo_GetTextID(PlayState* play, Actor* thisx) { } } case ENGO_TYPE_FIRE_GENERIC: - if (ENGO2_IS_CAGE_OPEN((EnGo*)thisx, play)) { + if (ENGO_IS_CAGE_OPEN((EnGo*)thisx, play)) { return 0x3052; } else { return 0x3051; @@ -382,7 +382,7 @@ void EnGo_ChangeAnim(EnGo* this, s32 index) { s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) { if (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) { return true; - } else if (play->sceneId == SCENE_FIRE_TEMPLE && !ENGO2_IS_CAGE_OPEN(this, play) && LINK_IS_ADULT && + } else if (play->sceneId == SCENE_FIRE_TEMPLE && !ENGO_IS_CAGE_OPEN(this, play) && LINK_IS_ADULT && ENGO_GET_TYPE(this) == ENGO_TYPE_FIRE_GENERIC) { return true; } else if (play->sceneId == SCENE_GORON_CITY && LINK_IS_ADULT && ENGO_GET_TYPE(this) == ENGO_TYPE_CITY_LINK) { @@ -515,7 +515,7 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { if (ENGO_GET_TYPE(this) != ENGO_TYPE_CITY_LINK) { return true; - } else if (ENGO2_IS_CAGE_OPEN(this, play)) { + } else if (ENGO_IS_CAGE_OPEN(this, play)) { return true; } else if (this->waypoint >= this->actor.shape.rot.z) { this->waypoint = 0; @@ -783,7 +783,7 @@ void EnGo_RollingToCurledUp(EnGo* this, PlayState* play) { } void EnGo_RollingLink(EnGo* this, PlayState* play) { - if ((EnGo_FollowPath(this, play) == true) && ENGO2_IS_CAGE_OPEN(this, play) && (this->waypoint == 0)) { + if ((EnGo_FollowPath(this, play) == true) && ENGO_IS_CAGE_OPEN(this, play) && (this->waypoint == 0)) { this->actor.speed = 0.0f; EnGo_SetupAction(this, EnGo_RollingToCurledUp); SET_INFTABLE(INFTABLE_109); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index ff479b6c931..a94d5323c00 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -169,8 +169,8 @@ typedef enum GoronType { } GoronType; #define ENGO2_GET_PATH_INDEX(this) PARAMS_GET_S((this)->actor.params, 5, 5) -#define ENGO2_CAGED_FLAG(this) PARAMS_GET_S((this)->actor.params, 10, 6) -#define ENGO2_IS_CAGE_OPEN(play, this) Flags_GetSwitch(play, ENGO2_CAGED_FLAG(this)) +#define ENGO2_CAGED_SWITCH_FLAG(this) PARAMS_GET_S((this)->actor.params, 10, 6) +#define ENGO2_IS_CAGE_OPEN(play, this) Flags_GetSwitch(play, ENGO2_CAGED_SWITCH_FLAG(this)) static EnGo2DustEffectData sDustEffectData[2][4] = { { @@ -318,7 +318,7 @@ s32 EnGo2_GetDialogState(EnGo2* this, PlayState* play) { } u16 EnGo2_GoronFireGenericGetTextId(EnGo2* this) { - switch (ENGO2_CAGED_FLAG(this)) { + switch (ENGO2_CAGED_SWITCH_FLAG(this)) { case 3: return 0x3069; case 5: @@ -1991,8 +1991,9 @@ void EnGo2_GoronFireGeneric(EnGo2* this, PlayState* play) { } else { this->animTimer = 0; this->actor.speed = 0.0f; - if ((ENGO2_CAGED_FLAG(this) != 1) && (ENGO2_CAGED_FLAG(this) != 2) && (ENGO2_CAGED_FLAG(this) != 4) && - (ENGO2_CAGED_FLAG(this) != 5) && (ENGO2_CAGED_FLAG(this) != 9) && (ENGO2_CAGED_FLAG(this) != 11)) { + if ((ENGO2_CAGED_SWITCH_FLAG(this) != 1) && (ENGO2_CAGED_SWITCH_FLAG(this) != 2) && + (ENGO2_CAGED_SWITCH_FLAG(this) != 4) && (ENGO2_CAGED_SWITCH_FLAG(this) != 5) && + (ENGO2_CAGED_SWITCH_FLAG(this) != 9) && (ENGO2_CAGED_SWITCH_FLAG(this) != 11)) { this->goronState++; } this->goronState++; From fff6cf4b49809366e75b7e9ad94a50b49a62437e Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 00:14:39 +0100 Subject: [PATCH 52/68] remove a [mis]leading zero --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index a94d5323c00..f40dcb0e1df 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -152,20 +152,20 @@ static AnimationInfo sAnimationInfo[] = { #define ENGO2_GET_TYPE(this) PARAMS_GET_S((this)->actor.params, 0, 5) typedef enum GoronType { - /* 0x00 */ GORON_CITY_HOT_RODDER, - /* 0x01 */ GORON_CITY_LINK, - /* 0x02 */ GORON_DMT_BIGGORON, - /* 0x03 */ GORON_FIRE_GENERIC, - /* 0x04 */ GORON_DMT_BOMB_FLOWER, - /* 0x05 */ GORON_DMT_ROLLING_SMALL, - /* 0x06 */ GORON_DMT_DC_ENTRANCE, - /* 0x07 */ GORON_CITY_ENTRANCE, - /* 0x08 */ GORON_CITY_ISLAND, - /* 0x09 */ GORON_CITY_LOWEST_FLOOR, - /* 0x0A */ GORON_CITY_STAIRWELL, - /* 0x0B */ GORON_CITY_LOST_WOODS, - /* 0x0C */ GORON_DMT_FAIRY_HINT, - /* 0x0D */ GORON_MARKET_BAZAAR + /* 0x0 */ GORON_CITY_HOT_RODDER, + /* 0x1 */ GORON_CITY_LINK, + /* 0x2 */ GORON_DMT_BIGGORON, + /* 0x3 */ GORON_FIRE_GENERIC, + /* 0x4 */ GORON_DMT_BOMB_FLOWER, + /* 0x5 */ GORON_DMT_ROLLING_SMALL, + /* 0x6 */ GORON_DMT_DC_ENTRANCE, + /* 0x7 */ GORON_CITY_ENTRANCE, + /* 0x8 */ GORON_CITY_ISLAND, + /* 0x9 */ GORON_CITY_LOWEST_FLOOR, + /* 0xA */ GORON_CITY_STAIRWELL, + /* 0xB */ GORON_CITY_LOST_WOODS, + /* 0xC */ GORON_DMT_FAIRY_HINT, + /* 0xD */ GORON_MARKET_BAZAAR } GoronType; #define ENGO2_GET_PATH_INDEX(this) PARAMS_GET_S((this)->actor.params, 5, 5) From 2ab3f6b66e2bb233d315dd13e5a6f190505a7f75 Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 00:15:08 +0100 Subject: [PATCH 53/68] remove unnecessary comment https://github.com/zeldaret/oot/pull/2295#discussion_r1841170202 --- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 09b10b0e1c4..ca6328e8a4b 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -100,7 +100,7 @@ typedef enum EnGoType { } EnGoType; #define ENGO_GET_PATH_INDEX(this) PARAMS_GET_U((this)->actor.params, 0, 4) -#define ENGO_PATH_INDEX_NONE 0xF // likely the count of available paths +#define ENGO_PATH_INDEX_NONE 0xF #define ENGO_CAGED_SWITCH_FLAG(this) PARAMS_GET_NOMASK((this)->actor.params, 8) #define ENGO_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO_CAGED_SWITCH_FLAG(this)) From e87bc05affcce1130ee80a857ec81ac8363eaecf Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 00:17:16 +0100 Subject: [PATCH 54/68] use uniform naming between variables https://github.com/zeldaret/oot/pull/2295#discussion_r1841202090 --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index f40dcb0e1df..1397ccd2b8f 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -304,17 +304,17 @@ void EnGo2_OfferItem(EnGo2* this, PlayState* play, s32 getItemId) { } s32 EnGo2_GetDialogState(EnGo2* this, PlayState* play) { - s16 dialogState = Message_GetState(&play->msgCtx); + s16 messageState = Message_GetState(&play->msgCtx); if ((this->messageState == TEXT_STATE_AWAITING_NEXT) || (this->messageState == TEXT_STATE_EVENT) || (this->messageState == TEXT_STATE_CLOSING) || (this->messageState == TEXT_STATE_DONE_HAS_NEXT)) { - if (dialogState != this->messageState) { + if (messageState != this->messageState) { this->messageEntry++; } } - this->messageState = dialogState; - return dialogState; + this->messageState = messageState; + return messageState; } u16 EnGo2_GoronFireGenericGetTextId(EnGo2* this) { From 1fa1922a9baf4899391b21bfa632709a42f2fc0c Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 01:10:38 +0100 Subject: [PATCH 55/68] tweak `EnGo2_UpdateTalking` code and comments https://github.com/zeldaret/oot/pull/2295#discussion_r1841205108 https://github.com/zeldaret/oot/pull/2295#discussion_r1841210644 https://github.com/zeldaret/oot/pull/2295#discussion_r1841256344 https://github.com/zeldaret/oot/pull/2295#discussion_r1841268480 --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 1397ccd2b8f..22c1df61b12 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -843,22 +843,17 @@ s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { } s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) { - // default: - if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON) { - if (ENGO2_GET_TYPE(this) != GORON_CITY_HOT_RODDER) { - return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, - EnGo2_GetTextId, EnGo2_UpdateTalkState); - } + if (ENGO2_GET_TYPE(this) != GORON_DMT_BIGGORON && ENGO2_GET_TYPE(this) != GORON_CITY_HOT_RODDER) { + return Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->interactRange, + EnGo2_GetTextId, EnGo2_UpdateTalkState); } - // `GORON_DMT_BIGGORON`, close enough; see `EnGo2_IsInRange` - if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { - if (!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { - return false; - } + // Biggoron is close enough; see `EnGo2_IsInRange` + if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { + return false; } - // `GORON_DMT_BIGGORON` || `GORON_CITY_HOT_RODDER` + // dialog with Biggoron or Hot Rodder { if (Actor_TalkOfferAccepted(&this->actor, play)) { this->interactInfo.talkState = NPC_TALK_STATE_TALKING; From 911550550f136a7251a17de2786dfe839087ec03 Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 01:12:16 +0100 Subject: [PATCH 56/68] link two `if` parts with and `else` https://github.com/zeldaret/oot/pull/2295#discussion_r1841272907 --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 22c1df61b12..80495501e67 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1029,9 +1029,7 @@ s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 bounceCount, f32 boundSpeed, s16 ru if (DECR(this->bounceTimer)) { if (!rumble) { return true; - } - - { + } else { this->actor.world.pos.y = (this->bounceTimer & 1) ? this->actor.world.pos.y + 1.5f : this->actor.world.pos.y - 1.5f; Actor_PlaySfx(&this->actor, NA_SE_EV_BIGBALL_ROLL - SFX_FLAG); From 57951edb82f7a77505e09c9428b8f842533efbff Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 01:56:32 +0100 Subject: [PATCH 57/68] Document `actor.params` bits allocation --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 80495501e67..00ab31934f8 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -150,7 +150,19 @@ static AnimationInfo sAnimationInfo[] = { { &gGoronShakingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, }; +/* + * `actor.params bits` allocation: + * type 01234........... + * path .....56789...... + * cage ..........ABCDEF + */ #define ENGO2_GET_TYPE(this) PARAMS_GET_S((this)->actor.params, 0, 5) +#define ENGO2_GET_PATH_INDEX(this) PARAMS_GET_S((this)->actor.params, 5, 5) +#define ENGO2_CAGED_SWITCH_FLAG(this) PARAMS_GET_S((this)->actor.params, 10, 6) + +#define ENGO2_PATH_INDEX_MAX NBITS_TO_MASK(5) +#define ENGO2_IS_CAGE_OPEN(play, this) Flags_GetSwitch(play, ENGO2_CAGED_SWITCH_FLAG(this)) + typedef enum GoronType { /* 0x0 */ GORON_CITY_HOT_RODDER, /* 0x1 */ GORON_CITY_LINK, @@ -168,10 +180,6 @@ typedef enum GoronType { /* 0xD */ GORON_MARKET_BAZAAR } GoronType; -#define ENGO2_GET_PATH_INDEX(this) PARAMS_GET_S((this)->actor.params, 5, 5) -#define ENGO2_CAGED_SWITCH_FLAG(this) PARAMS_GET_S((this)->actor.params, 10, 6) -#define ENGO2_IS_CAGE_OPEN(play, this) Flags_GetSwitch(play, ENGO2_CAGED_SWITCH_FLAG(this)) - static EnGo2DustEffectData sDustEffectData[2][4] = { { // default @@ -1587,7 +1595,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { this->waypoint = 0; this->reverseWaypoint = this->actor.shape.rot.z; this->trackingMode = NPC_TRACKING_NONE; - this->path = Path_GetByIndex(play, ENGO2_GET_PATH_INDEX(this), 0x1F); + this->path = Path_GetByIndex(play, ENGO2_GET_PATH_INDEX(this), ENGO2_PATH_INDEX_MAX); switch (ENGO2_GET_TYPE(this)) { case GORON_CITY_ENTRANCE: case GORON_CITY_ISLAND: From 406349987f2d70d453e0a8047d22b84f9ba1c261 Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 02:21:40 +0100 Subject: [PATCH 58/68] Document `actor.params` bits allocation an "ammendment" for 57951edb82f7a77505e09c9428b8f842533efbff somehow haven't saved the changes that time --- src/overlays/actors/ovl_En_Go/z_en_go.c | 43 ++++++++++++++----------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index ca6328e8a4b..fb18841acb8 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -86,27 +86,34 @@ static AnimationSpeedInfo sAnimationInfo[] = { { &gGoronSidestepLoopAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, }; -#define ENGO_GET_TYPE(this) PARAMS_GET_NOSHIFT((this)->actor.params, 4, 4) -typedef enum EnGoType { - ENGO_TYPE_CITY_LINK = (0 << 4), - ENGO_TYPE_FIRE_GENERIC = (1 << 4), - ENGO_TYPE_DMT_DC_ENTRANCE = (2 << 4), - ENGO_TYPE_DMT_ROLLING_SMALL = (3 << 4), - ENGO_TYPE_DMT_BOMB_FLOWER = (4 << 4), - ENGO_TYPE_CITY_ENTRANCE = (5 << 4), - ENGO_TYPE_CITY_ISLAND = (6 << 4), - ENGO_TYPE_CITY_LOST_WOODS = (7 << 4), - ENGO_TYPE_DMT_BIGGORON = (9 << 4) -} EnGoType; - +/* + * `actor.params bits` allocation: + * path 0123............ + * type ....4567........ + * cage ........89ABCDEF + */ #define ENGO_GET_PATH_INDEX(this) PARAMS_GET_U((this)->actor.params, 0, 4) -#define ENGO_PATH_INDEX_NONE 0xF - +#define ENGO_GET_TYPE(this) PARAMS_GET_NOSHIFT((this)->actor.params, 4, 4) #define ENGO_CAGED_SWITCH_FLAG(this) PARAMS_GET_NOMASK((this)->actor.params, 8) -#define ENGO_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO_CAGED_SWITCH_FLAG(this)) +#define ENGO_PATH_INDEX_MAX NBITS_TO_MASK(4) +#define ENGO_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO_CAGED_SWITCH_FLAG(this)) #define ENGO_GET_SPEED_SCALE(this) (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) +// clang-format off +typedef enum EnGoType { + ENGO_TYPE_CITY_LINK = (0 << 4), + ENGO_TYPE_FIRE_GENERIC = (1 << 4), + ENGO_TYPE_DMT_DC_ENTRANCE = (2 << 4), + ENGO_TYPE_DMT_ROLLING_SMALL = (3 << 4), + ENGO_TYPE_DMT_BOMB_FLOWER = (4 << 4), + ENGO_TYPE_CITY_ENTRANCE = (5 << 4), + ENGO_TYPE_CITY_ISLAND = (6 << 4), + ENGO_TYPE_CITY_LOST_WOODS = (7 << 4), + ENGO_TYPE_DMT_BIGGORON = (9 << 4) +} EnGoType; +// clang-format on + void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -496,7 +503,7 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { f32 xDist; f32 zDist; - if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_INDEX_NONE) { + if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_INDEX_MAX) { return false; } @@ -531,7 +538,7 @@ s32 EnGo_SetMovedPos(EnGo* this, PlayState* play) { Path* path; Vec3s* pointPos; - if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_INDEX_NONE) { + if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_INDEX_MAX) { return false; } else { path = &play->pathList[ENGO_GET_PATH_INDEX(this)]; From d8911078a4674c084a3b7c38fa5fcf01d692fc20 Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 14 Nov 2024 10:22:48 +0100 Subject: [PATCH 59/68] yeah, be less judgemental --- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index fb18841acb8..94f07114f10 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1,5 +1,5 @@ /* @unused: unlike `ACTOR_EN_GO2`, this one doesn't participate in any scene whatsoever - * besides, this code bears a handful of bugs and WIP code; see `z_en_go2.c` instead + * and nothing spawns this type of entities as well; see `z_en_go2.c` instead */ #include "z_en_go.h" From 768297f40025a6cb836c5685c56cbc1eab312bd8 Mon Sep 17 00:00:00 2001 From: feacur Date: Fri, 15 Nov 2024 00:43:56 +0100 Subject: [PATCH 60/68] clarify "in range" of what it is --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 00ab31934f8..392e247e663 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -856,7 +856,7 @@ s32 EnGo2_UpdateTalking(EnGo2* this, PlayState* play) { EnGo2_GetTextId, EnGo2_UpdateTalkState); } - // Biggoron is close enough; see `EnGo2_IsInRange` + // Biggoron is close enough; see `EnGo2_IsWithinInteactionRange` if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { return false; } @@ -1002,7 +1002,7 @@ s32 EnGo2_OrientInstant(EnGo2* this) { return 1; } -s32 EnGo2_IsInRange(EnGo2* this) { +s32 EnGo2_IsWithinInteactionRange(EnGo2* this) { s16 yawDiff; f32 xyzDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 800.0f : 200.0f; f32 yDist = (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) ? 400.0f : 60.0f; @@ -1206,10 +1206,10 @@ s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) { Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN]; if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { - if (EnGo2_IsInRange(this)) { + if (EnGo2_IsWithinInteactionRange(this)) { Camera_RequestSetting(mainCam, CAM_SET_DIRECTED_YAW); Camera_UnsetStateFlag(mainCam, CAM_STATE_CHECK_BG); - } else if (!EnGo2_IsInRange(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { + } else if (!EnGo2_IsWithinInteactionRange(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { Camera_RequestSetting(mainCam, CAM_SET_DUNGEON1); Camera_SetStateFlag(mainCam, CAM_STATE_CHECK_BG); } @@ -1229,7 +1229,7 @@ s32 EnGo2_ShouldStay(EnGo2* this, PlayState* play) { } void EnGo2_SetupUncurledFlags_Default(EnGo2* this) { - this->trackingMode = EnGo2_IsInRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; + this->trackingMode = EnGo2_IsWithinInteactionRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_FULL_BODY; @@ -1253,7 +1253,7 @@ void EnGo2_SetupUncurledFlags_NearTracking(EnGo2* this) { } void EnGo2_SetupUncurledFlags_Biggoron(EnGo2* this) { - if (EnGo2_IsInRange(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { + if (EnGo2_IsWithinInteactionRange(this) || this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_HEAD_AND_TORSO; this->isTalkative = true; } else { @@ -1266,7 +1266,7 @@ void EnGo2_SetupUncurledFlags(EnGo2* this) { switch (ENGO2_GET_TYPE(this)) { case GORON_DMT_BOMB_FLOWER: this->isTalkative = true; - this->trackingMode = EnGo2_IsInRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; + this->trackingMode = EnGo2_IsWithinInteactionRange(this) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; break; case GORON_FIRE_GENERIC: EnGo2_SetupUncurledFlags_NearTracking(this); @@ -1473,7 +1473,7 @@ s32 EnGo2_IsGoronFireGeneric(EnGo2* this) { s32 EnGo2_IsGoronLinkReversing(EnGo2* this) { if (ENGO2_GET_TYPE(this) != GORON_CITY_LINK || (this->waypoint >= this->reverseWaypoint) || - !EnGo2_IsInRange(this)) { + !EnGo2_IsWithinInteactionRange(this)) { return false; } return true; @@ -1702,7 +1702,7 @@ void EnGo2_CurledUp(EnGo2* this, PlayState* play) { this->isTalkative = false; EnGo2_WakeUpAnimated(this, play); } - if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsInRange(this)) { + if ((ENGO2_GET_TYPE(this) != GORON_FIRE_GENERIC) && EnGo2_IsWithinInteactionRange(this)) { EnGo2_WakeUpAnimated(this, play); } } @@ -1737,7 +1737,7 @@ void EnGo2_Standing(EnGo2* this, PlayState* play) { (s16)((height * 0.4f * (this->skelAnime.curFrame / this->skelAnime.endFrame)) + (height * 0.6f)); } } - if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsInRange(this))) { + if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsWithinInteactionRange(this))) { EnGo2_AnimateRolling(this, play); } } From 423748a140d296c1f589d1297cf1ae23648b9f1c Mon Sep 17 00:00:00 2001 From: feacur Date: Fri, 15 Nov 2024 00:44:24 +0100 Subject: [PATCH 61/68] use `BINANG` macros instead of hex values --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 392e247e663..21eb8c01d5c 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -292,14 +292,14 @@ s32 EnGo2_SpawnDustExplicitly(EnGo2* this, u8 initialTimer, f32 scale, f32 scale pos = this->actor.world.pos; // overwrites sPos data pos.y = this->actor.floorHeight; - angle = (Rand_ZeroOne() - 0.5f) * 0x10000; + angle = (Rand_ZeroOne() - 0.5f) * 0x10000; // `[-180 .. 180]` degrees i = numDustEffects; while (i >= 0) { accel.y += Rand_ZeroOne() * yAccel; pos.x = (Math_SinS(angle) * radius) + this->actor.world.pos.x; pos.z = (Math_CosS(angle) * radius) + this->actor.world.pos.z; EnGo2_SpawnEffectDust(this, &pos, &velocity, &accel, initialTimer, scale, scaleStep); - angle += (s16)(0x10000 / numDustEffects); + angle += (s16)(0x10000 / numDustEffects); // `360 / N` degrees i--; } return 0; @@ -1021,7 +1021,8 @@ s32 EnGo2_IsWithinInteactionRange(EnGo2* this) { xyzDist = SQ(xyzDist); yawDiff = (f32)this->actor.yawTowardsPlayer - (f32)this->actor.shape.rot.y; yawDiffAbs = ABS(yawDiff); - if (this->actor.xyzDistToPlayerSq <= xyzDist && fabsf(this->actor.yDistToPlayer) < yDist && yawDiffAbs < 0x2AA8) { + if (this->actor.xyzDistToPlayerSq <= xyzDist && fabsf(this->actor.yDistToPlayer) < yDist && + yawDiffAbs < DEG_TO_BINANG(59.99)) { return true; } else { return false; @@ -1531,7 +1532,7 @@ void EnGo2_GoronFireGeneric_CreateSubcamera(EnGo2* this, PlayState* play) { Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); Path_CopyLastPoint(this->path, &this->subCamAt); - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->subCamAt) + 0xE38; + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->subCamAt) + DEG_TO_BINANG(20); this->subCamEye.x = Math_SinS(yaw) * 100.0f + this->actor.world.pos.x; this->subCamEye.z = Math_CosS(yaw) * 100.0f + this->actor.world.pos.z; this->subCamEye.y = this->actor.world.pos.y + 20.0f; @@ -1829,7 +1830,7 @@ void EnGo2_RollingReverse(EnGo2* this, PlayState* play) { EnGo2_SpawnDust(this, 3); } if ((s32)this->actor.speed == 0) { - this->actor.world.rot.y ^= 0x8000; + this->actor.world.rot.y ^= 0x8000; // turn around 180 degrees this->actor.shape.rot.y = this->actor.world.rot.y; this->reverse ^= 1; EnGo2_UpdateWaypoint(this, play); @@ -1881,7 +1882,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { case 0: // give eyedrops Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_EYEDROPS_LOOP); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->actor.shape.rot.y += 0x5B0; + this->actor.shape.rot.y += DEG_TO_BINANG(8); this->trackingMode = NPC_TRACKING_NONE; this->animTimer = this->skelAnime.endFrame + 60.0f + 60.0f; // eyeDrops animation timer this->eyeMouthTexState = 2; From fe537321270b4f5a5a9ba9de6a0c2b00362142ed Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 18 Nov 2024 13:19:39 +0100 Subject: [PATCH 62/68] give a function a better name --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 21eb8c01d5c..0ea22caeee8 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1344,7 +1344,7 @@ void EnGo2_SpawnDust(EnGo2* this, s32 index2) { dustEffectData->numDustEffects, dustEffectData->radius, dustEffectData->yAccel); } -void EnGo2_AnimateRolling(EnGo2* this, PlayState* play) { +void EnGo2_SetupCurledUp(EnGo2* this, PlayState* play) { if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_BIG); @@ -1459,7 +1459,7 @@ s32 EnGo2_IsGoronHotRodder(EnGo2* this, PlayState* play) { return false; } this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - EnGo2_AnimateRolling(this, play); + EnGo2_SetupCurledUp(this, play); this->actionFunc = EnGo2_GoronHotRodder; return true; } @@ -1739,7 +1739,7 @@ void EnGo2_Standing(EnGo2* this, PlayState* play) { } } if ((!EnGo2_ShouldStay(this, play)) && (!EnGo2_IsWithinInteactionRange(this))) { - EnGo2_AnimateRolling(this, play); + EnGo2_SetupCurledUp(this, play); } } @@ -1869,7 +1869,7 @@ void EnGo2_HandleOfferParented(EnGo2* this, PlayState* play) { break; case GI_BOMB_BAG_30: case GI_BOMB_BAG_40: - EnGo2_AnimateRolling(this, play); + EnGo2_SetupCurledUp(this, play); this->actionFunc = EnGo2_GoronHotRodder; return; } From 5ba85a3f7ef5d2975f9f5fab518b2b8f75127d55 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 18 Nov 2024 13:32:57 +0100 Subject: [PATCH 63/68] name animation reversing func as such --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 0ea22caeee8..3aaab5d557b 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -909,7 +909,7 @@ void EnGo2_CheckCollision(EnGo2* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { +void EnGo2_ReverseAnimation(EnGo2* this) { f32 initialFrame; initialFrame = this->skelAnime.startFrame; @@ -1353,7 +1353,7 @@ void EnGo2_SetupCurledUp(EnGo2* this, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_NORMAL); this->skelAnime.playSpeed = -1.0f; } - EnGo2_SwapInitialFrameAnimFrameCount(this); + EnGo2_ReverseAnimation(this); this->trackingMode = NPC_TRACKING_NONE; this->isUncurled = false; this->isTalkative = false; From 5d1bf7727f30ff31b075fba8a55b28872896f475 Mon Sep 17 00:00:00 2001 From: feacur Date: Mon, 18 Nov 2024 21:09:13 +0100 Subject: [PATCH 64/68] follow the bugs documentation style guide --- src/overlays/actors/ovl_En_Go/z_en_go.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 94f07114f10..752f7dfff4d 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -899,7 +899,7 @@ void EnGo_Standing(EnGo* this, PlayState* play) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { - // @bug: `gGoronEyedropsLoopAnim` is not applied; see `z_en_go2.c` for the correct behaviour + //! @bug: `gGoronEyedropsLoopAnim` is not applied; see `z_en_go2.c` for the correct behaviour EnGo_ChangeAnim(this, ENGO_ANIM_WALKING_LOOP); this->eyedropsTimer = 100; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; @@ -1038,7 +1038,7 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { void EnGo_TakingEyedrops(EnGo* this, PlayState* play) { if (DECR(this->eyedropsTimer) == 0) { - // @bug: `gGoronEyedropsTakenAnim` is not applied; see `z_en_go2.c` for the correct behaviour + //! @bug: `gGoronEyedropsTakenAnim` is not applied; see `z_en_go2.c` for the correct behaviour this->actor.textId = 0x305A; Message_ContinueTextbox(play, this->actor.textId); this->interactInfo.talkState = NPC_TALK_STATE_TALKING; @@ -1167,7 +1167,8 @@ void EnGo_Draw(Actor* thisx, PlayState* play) { return; } - // @bug? should've been `EnGo_RollingToCurledUp` instead of the second `EnGo_RollingFar` + //! @bug? should've been `EnGo_RollingToCurledUp` instead of the second `EnGo_RollingFar` + //! in that state bouncing Goron will be drawn normally, rather than as a boulder if (this->actionFunc == EnGo_RollingLink || this->actionFunc == EnGo_RollingFar || this->actionFunc == EnGo_RollingNear || this->actionFunc == EnGo_RollingFar) { EnGo_DrawRolling(this, play); From 771570aaa634429275bbf7d3066d0b9fe2384100 Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 20 Nov 2024 15:37:25 +0100 Subject: [PATCH 65/68] give better names to rolling checks --- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 3aaab5d557b..26764177428 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1480,11 +1480,11 @@ s32 EnGo2_IsGoronLinkReversing(EnGo2* this) { return true; } -s32 EnGo2_IsRolling(EnGo2* this) { +s32 EnGo2_IsTalkingAndFast(EnGo2* this) { if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE || this->actor.speed < 1.0f) { return false; } - if (EnGo2_IsRollingOnGround(this, 2, 20.0 / 3.0f, 0)) { + if (EnGo2_IsRollingOnGround(this, 2, 20.0 / 3.0f, false)) { if ((this->bounceTimer >= 9) && (this->bounceCounter == 0)) { this->bounceTimer = 8; } @@ -1762,9 +1762,9 @@ void EnGo2_GoronHotRodder(EnGo2* this, PlayState* play) { } void EnGo2_RollingStart(EnGo2* this, PlayState* play) { - f32 float1 = 1000.0f; + f32 slowdownRadius = 1000.0f; - if ((ENGO2_GET_TYPE(this) != GORON_DMT_ROLLING_SMALL || !(this->actor.xyzDistToPlayerSq > SQ(float1))) && + if ((ENGO2_GET_TYPE(this) != GORON_DMT_ROLLING_SMALL || !(this->actor.xyzDistToPlayerSq > SQ(slowdownRadius))) && DECR(this->animTimer) == 0) { this->actionFunc = EnGo2_RollingSlow; this->actor.speed *= 0.5f; // slowdown @@ -1775,8 +1775,8 @@ void EnGo2_RollingStart(EnGo2* this, PlayState* play) { void EnGo2_RollingSlow(EnGo2* this, PlayState* play) { s32 updatedWaypoint; - if (!EnGo2_IsRolling(this)) { - if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 1) == true) { + if (!EnGo2_IsTalkingAndFast(this)) { + if (EnGo2_IsRollingOnGround(this, 4, 8.0f, true) == true) { if (EnGo2_IsGoronLinkReversing(this)) { this->actionFunc = EnGo2_RollingReverse; return; @@ -1805,7 +1805,7 @@ void EnGo2_RollingSlow(EnGo2* this, PlayState* play) { } void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { - if (EnGo2_IsRollingOnGround(this, 4, 8.0f, 0)) { + if (EnGo2_IsRollingOnGround(this, 4, 8.0f, false)) { EnGo2_SpawnDust(this, 0); if (this->bounceCounter == 0) { switch (ENGO2_GET_TYPE(this)) { @@ -1824,7 +1824,7 @@ void EnGo2_GroundRolling(EnGo2* this, PlayState* play) { } void EnGo2_RollingReverse(EnGo2* this, PlayState* play) { - if (!EnGo2_IsRolling(this)) { + if (!EnGo2_IsTalkingAndFast(this)) { Math_ApproachF(&this->actor.speed, 0.0f, 0.6f, 0.8f); if (this->actor.speed >= 1.0f) { EnGo2_SpawnDust(this, 3); From 220007ec7c7369ba88531721e451f0b5e0637325 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 8 Dec 2024 21:35:44 +0100 Subject: [PATCH 66/68] tweak animations' names --- assets/xml/objects/object_oF1d_map.xml | 16 +++--- src/overlays/actors/ovl_Demo_Go/z_demo_go.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 20 ++++---- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 56 ++++++++++----------- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index 34f3dafded2..501a89dc993 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -2,17 +2,17 @@ - - + + - - - + + + - - + + - + diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index a6801962d51..b638cbfd798 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -254,7 +254,7 @@ void func_8097CEEC(DemoGo* this, PlayState* play) { } void func_8097CF20(DemoGo* this, PlayState* play, s32 arg2) { - AnimationHeader* animation = &gGoronWalkingLoopAnim; + AnimationHeader* animation = &gGoronWalkingAnim; if (arg2 != 0) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, -8.0f); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index d18bc661750..0ab741b4544 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -73,17 +73,17 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; typedef enum EnGoAnimation { - /* 0 */ ENGO_ANIM_UNCURL_SIT_STAND_IDLE, // default idle + /* 0 */ ENGO_ANIM_UNCURL_SIT_STAND_DEFAULT, /* 1 */ ENGO_ANIM_UNCURL_SIT_STAND_NORMAL, - /* 2 */ ENGO_ANIM_WALKING_LOOP, - /* 3 */ ENGO_ANIM_SIDESTEP_LOOP + /* 2 */ ENGO_ANIM_WALKING, + /* 3 */ ENGO_ANIM_SIDESTEP } EnGoAnimation; static AnimationSpeedInfo sAnimationInfo[] = { { &gGoronUncurlSitStandAnim, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f }, { &gGoronUncurlSitStandAnim, 0.0f, ANIMMODE_LOOP_INTERP, -10.0f }, - { &gGoronWalkingLoopAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, - { &gGoronSidestepLoopAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, + { &gGoronWalkingAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, + { &gGoronSidestepAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, }; /* @@ -683,7 +683,7 @@ void EnGo_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_5; } - EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND_IDLE); + EnGo_ChangeAnim(this, ENGO_ANIM_UNCURL_SIT_STAND_DEFAULT); this->actor.attentionRangeType = ATTENTION_RANGE_6; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->actor.gravity = -1.0f; @@ -899,8 +899,8 @@ void EnGo_Standing(EnGo* this, PlayState* play) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } else { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { - //! @bug: `gGoronEyedropsLoopAnim` is not applied; see `z_en_go2.c` for the correct behaviour - EnGo_ChangeAnim(this, ENGO_ANIM_WALKING_LOOP); + //! @bug: `gGoronEyedropsAnim` is not applied; see `z_en_go2.c` for the correct behaviour + EnGo_ChangeAnim(this, ENGO_ANIM_WALKING); this->eyedropsTimer = 100; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; EnGo_SetupAction(this, EnGo_TakingEyedrops); @@ -960,7 +960,7 @@ void EnGo_AttentionLost(EnGo* this, PlayState* play) { } void EnGo_Sidestep(EnGo* this, PlayState* play) { - f32 float1 = ((f32)0x8000 / Animation_GetLastFrame(&gGoronSidestepLoopAnim)); + f32 float1 = ((f32)0x8000 / Animation_GetLastFrame(&gGoronSidestepAnim)); f32 float2 = this->skelAnime.curFrame * float1; this->actor.speed = Math_SinS((s16)float2); @@ -974,7 +974,7 @@ void EnGo_Sidestep(EnGo* this, PlayState* play) { void EnGo_GoronDmtBombFlower(EnGo* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_EB)) { - EnGo_ChangeAnim(this, ENGO_ANIM_SIDESTEP_LOOP); + EnGo_ChangeAnim(this, ENGO_ANIM_SIDESTEP); EnGo_SetupAction(this, EnGo_Sidestep); } else { EnGo_Standing(this, play); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 1f18df26856..2d04e92329c 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -119,35 +119,35 @@ static f32 sPlayerTrackingYOffsets[14][2] = { }; typedef enum EnGo2Animation { - /* 0 */ ENGO2_ANIM_UNCURL_SIT_STAND_IDLE, // default idle + /* 0 */ ENGO2_ANIM_UNCURL_SIT_STAND_DEFAULT, /* 1 */ ENGO2_ANIM_UNCURL_SIT_STAND_NORMAL, - /* 2 */ ENGO2_ANIM_WALKING_LOOP, - /* 3 */ ENGO2_ANIM_SIDESTEP_LOOP, - /* 4 */ ENGO2_ANIM_CRYING_LOOP, - /* 5 */ ENGO2_ANIM_EYEDROPS_LOOP, + /* 2 */ ENGO2_ANIM_WALKING, + /* 3 */ ENGO2_ANIM_SIDESTEP, + /* 4 */ ENGO2_ANIM_CRYING, + /* 5 */ ENGO2_ANIM_EYEDROPS, /* 6 */ ENGO2_ANIM_EYEDROPS_TAKEN, /* 7 */ ENGO2_ANIM_UNCURL_PRONE_UNUSED, - /* 8 */ ENGO2_ANIM_PRONE_LOOP_UNUSED, - /* 9 */ ENGO2_ANIM_SCRATCHING_LOOP, + /* 8 */ ENGO2_ANIM_PRONE_UNUSED, + /* 9 */ ENGO2_ANIM_SCRATCHING, /* 10 */ ENGO2_ANIM_UNCURL_SIT_STAND_BIG, - /* 11 */ ENGO2_ANIM_SOBBING_LOOP, - /* 12 */ ENGO2_ANIM_SHAKING_LOOP + /* 11 */ ENGO2_ANIM_SOBBING, + /* 12 */ ENGO2_ANIM_SHAKING } EnGo2Animation; static AnimationInfo sAnimationInfo[] = { { &gGoronUncurlSitStandAnim, 0.0f, 0.0f, -1.0f, 0x00, 0.0f }, { &gGoronUncurlSitStandAnim, 0.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronWalkingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronSidestepLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronCryingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronEyeropsLoopAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, + { &gGoronWalkingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronSidestepAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronCryingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronEyeropsAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, { &gGoronEyedropsTakenAnim, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, { &gGoronUncurlToProneAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronProneLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronScratchingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronProneAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronScratchingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronUncurlSitStandAnim, 0.0f, 0.0f, -1.0f, 0x01, -8.0f }, - { &gGoronSobbingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronShakingLoopAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronSobbingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, + { &gGoronShakingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, }; /* @@ -1176,12 +1176,12 @@ void EnGo2_ChooseIdleAnimation(EnGo2* this) { case GORON_CITY_ENTRANCE: case GORON_CITY_STAIRWELL: case GORON_DMT_FAIRY_HINT: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_SCRATCHING_LOOP); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_SCRATCHING); break; case GORON_DMT_BIGGORON: if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_BROKEN_GORONS_SWORD && INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYE_DROPS) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_CRYING_LOOP); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_CRYING); break; } FALLTHROUGH; @@ -1446,7 +1446,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) { return false; } - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_SIDESTEP_LOOP); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_SIDESTEP); this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->isTalkative = false; this->trackingMode = NPC_TRACKING_NONE; @@ -1499,21 +1499,21 @@ void EnGo2_AnimateGoronLinkAndDoSfx(EnGo2* this, PlayState* play) { if (ENGO2_GET_TYPE(this) == GORON_CITY_LINK) { if ((this->actor.textId == 0x3035 && this->messageEntry == 0) || (this->actor.textId == 0x3036 && this->messageEntry == 0)) { - if (this->skelAnime.animation != &gGoronShakingLoopAnim) { - animation = ENGO2_ANIM_SHAKING_LOOP; + if (this->skelAnime.animation != &gGoronShakingAnim) { + animation = ENGO2_ANIM_SHAKING; this->eyeMouthTexState = 0; } } if ((this->actor.textId == 0x3032 && this->messageEntry == 12) || (this->actor.textId == 0x3033) || (this->actor.textId == 0x3035 && this->messageEntry == 6)) { - if (this->skelAnime.animation != &gGoronSobbingLoopAnim) { - animation = ENGO2_ANIM_SOBBING_LOOP; + if (this->skelAnime.animation != &gGoronSobbingAnim) { + animation = ENGO2_ANIM_SOBBING; this->eyeMouthTexState = 1; } } - if (this->skelAnime.animation == &gGoronSobbingLoopAnim) { + if (this->skelAnime.animation == &gGoronSobbingAnim) { if (this->skelAnime.curFrame == 20.0f) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CRY); } @@ -1586,7 +1586,7 @@ void EnGo2_Init(Actor* thisx, PlayState* play) { EnGo2_SetColliderDim(this); EnGo2_SetShape(this); - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_IDLE); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_UNCURL_SIT_STAND_DEFAULT); this->actor.gravity = -1.0f; this->shadownAlpha = this->actor.shape.shadowAlpha = 0; this->reverse = 0; @@ -1880,7 +1880,7 @@ void EnGo2_HandleOfferParented(EnGo2* this, PlayState* play) { void EnGo2_BiggoronEyedrops(EnGo2* this, PlayState* play) { switch (this->goronState) { case 0: // give eyedrops - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_EYEDROPS_LOOP); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_EYEDROPS); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.shape.rot.y += DEG_TO_BINANG(8); this->trackingMode = NPC_TRACKING_NONE; @@ -1962,7 +1962,7 @@ void EnGo2_GoronFireGeneric(EnGo2* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { EnGo2_GoronFireGeneric_CreateSubcamera(this, play); play->msgCtx.msgMode = MSGMODE_PAUSED; - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_WALKING_LOOP); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_WALKING); this->waypoint = 1; this->skelAnime.playSpeed = 2.0f; EnGo2_OrientInstant(this); From 6b3eebb6d6f918aad23594cacd59064e0737e474 Mon Sep 17 00:00:00 2001 From: feacur Date: Sun, 8 Dec 2024 21:37:17 +0100 Subject: [PATCH 67/68] move defines into the headers --- src/overlays/actors/ovl_En_Go/z_en_go.c | 32 ++--------------------- src/overlays/actors/ovl_En_Go/z_en_go.h | 20 ++++++++++++++ src/overlays/actors/ovl_En_Go2/z_en_go2.c | 30 --------------------- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 24 +++++++++++++++++ 4 files changed, 46 insertions(+), 60 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 0ab741b4544..0b9f861ea96 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -86,34 +86,6 @@ static AnimationSpeedInfo sAnimationInfo[] = { { &gGoronSidestepAnim, 1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, }; -/* - * `actor.params bits` allocation: - * path 0123............ - * type ....4567........ - * cage ........89ABCDEF - */ -#define ENGO_GET_PATH_INDEX(this) PARAMS_GET_U((this)->actor.params, 0, 4) -#define ENGO_GET_TYPE(this) PARAMS_GET_NOSHIFT((this)->actor.params, 4, 4) -#define ENGO_CAGED_SWITCH_FLAG(this) PARAMS_GET_NOMASK((this)->actor.params, 8) - -#define ENGO_PATH_INDEX_MAX NBITS_TO_MASK(4) -#define ENGO_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO_CAGED_SWITCH_FLAG(this)) -#define ENGO_GET_SPEED_SCALE(this) (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) - -// clang-format off -typedef enum EnGoType { - ENGO_TYPE_CITY_LINK = (0 << 4), - ENGO_TYPE_FIRE_GENERIC = (1 << 4), - ENGO_TYPE_DMT_DC_ENTRANCE = (2 << 4), - ENGO_TYPE_DMT_ROLLING_SMALL = (3 << 4), - ENGO_TYPE_DMT_BOMB_FLOWER = (4 << 4), - ENGO_TYPE_CITY_ENTRANCE = (5 << 4), - ENGO_TYPE_CITY_ISLAND = (6 << 4), - ENGO_TYPE_CITY_LOST_WOODS = (7 << 4), - ENGO_TYPE_DMT_BIGGORON = (9 << 4) -} EnGoType; -// clang-format on - void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -503,7 +475,7 @@ s32 EnGo_FollowPath(EnGo* this, PlayState* play) { f32 xDist; f32 zDist; - if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_INDEX_MAX) { + if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_NONE) { return false; } @@ -538,7 +510,7 @@ s32 EnGo_SetMovedPos(EnGo* this, PlayState* play) { Path* path; Vec3s* pointPos; - if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_INDEX_MAX) { + if (ENGO_GET_PATH_INDEX(this) == ENGO_PATH_NONE) { return false; } else { path = &play->pathList[ENGO_GET_PATH_INDEX(this)]; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 6fe16fb8b01..6400cfc42d1 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -30,6 +30,26 @@ typedef enum GoronLimb { /* 18 */ GORON_LIMB_MAX } GoronLimb; +typedef enum EnGoType { + ENGO_TYPE_CITY_LINK = (0 << 4), + ENGO_TYPE_FIRE_GENERIC = (1 << 4), + ENGO_TYPE_DMT_DC_ENTRANCE = (2 << 4), + ENGO_TYPE_DMT_ROLLING_SMALL = (3 << 4), + ENGO_TYPE_DMT_BOMB_FLOWER = (4 << 4), + ENGO_TYPE_CITY_ENTRANCE = (5 << 4), + ENGO_TYPE_CITY_ISLAND = (6 << 4), + ENGO_TYPE_CITY_LOST_WOODS = (7 << 4), + ENGO_TYPE_DMT_BIGGORON = (9 << 4) +} EnGoType; + +#define ENGO_GET_PATH_INDEX(this) PARAMS_GET_U((this)->actor.params, 0, 4) +#define ENGO_GET_TYPE(this) PARAMS_GET_NOSHIFT((this)->actor.params, 4, 4) +#define ENGO_CAGED_SWITCH_FLAG(this) PARAMS_GET_NOMASK((this)->actor.params, 8) + +#define ENGO_PATH_NONE NBITS_TO_MASK(4) +#define ENGO_IS_CAGE_OPEN(this, play) Flags_GetSwitch(play, ENGO_CAGED_SWITCH_FLAG(this)) +#define ENGO_GET_SPEED_SCALE(this) (ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON ? 0.5f : 1.0f) + #define EN_GO_EFFECT_COUNT 20 typedef struct EnGoEffect { diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 2d04e92329c..8f165824f09 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -150,36 +150,6 @@ static AnimationInfo sAnimationInfo[] = { { &gGoronShakingAnim, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, }; -/* - * `actor.params bits` allocation: - * type 01234........... - * path .....56789...... - * cage ..........ABCDEF - */ -#define ENGO2_GET_TYPE(this) PARAMS_GET_S((this)->actor.params, 0, 5) -#define ENGO2_GET_PATH_INDEX(this) PARAMS_GET_S((this)->actor.params, 5, 5) -#define ENGO2_CAGED_SWITCH_FLAG(this) PARAMS_GET_S((this)->actor.params, 10, 6) - -#define ENGO2_PATH_INDEX_MAX NBITS_TO_MASK(5) -#define ENGO2_IS_CAGE_OPEN(play, this) Flags_GetSwitch(play, ENGO2_CAGED_SWITCH_FLAG(this)) - -typedef enum GoronType { - /* 0x0 */ GORON_CITY_HOT_RODDER, - /* 0x1 */ GORON_CITY_LINK, - /* 0x2 */ GORON_DMT_BIGGORON, - /* 0x3 */ GORON_FIRE_GENERIC, - /* 0x4 */ GORON_DMT_BOMB_FLOWER, - /* 0x5 */ GORON_DMT_ROLLING_SMALL, - /* 0x6 */ GORON_DMT_DC_ENTRANCE, - /* 0x7 */ GORON_CITY_ENTRANCE, - /* 0x8 */ GORON_CITY_ISLAND, - /* 0x9 */ GORON_CITY_LOWEST_FLOOR, - /* 0xA */ GORON_CITY_STAIRWELL, - /* 0xB */ GORON_CITY_LOST_WOODS, - /* 0xC */ GORON_DMT_FAIRY_HINT, - /* 0xD */ GORON_MARKET_BAZAAR -} GoronType; - static EnGo2DustEffectData sDustEffectData[2][4] = { { // default diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index bfe4cfad55c..59238f1556b 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -47,6 +47,30 @@ typedef struct EnGo2DustEffectData { f32 yAccel; } EnGo2DustEffectData; // size = 0x18 +typedef enum GoronType { + /* 0x0 */ GORON_CITY_HOT_RODDER, + /* 0x1 */ GORON_CITY_LINK, + /* 0x2 */ GORON_DMT_BIGGORON, + /* 0x3 */ GORON_FIRE_GENERIC, + /* 0x4 */ GORON_DMT_BOMB_FLOWER, + /* 0x5 */ GORON_DMT_ROLLING_SMALL, + /* 0x6 */ GORON_DMT_DC_ENTRANCE, + /* 0x7 */ GORON_CITY_ENTRANCE, + /* 0x8 */ GORON_CITY_ISLAND, + /* 0x9 */ GORON_CITY_LOWEST_FLOOR, + /* 0xA */ GORON_CITY_STAIRWELL, + /* 0xB */ GORON_CITY_LOST_WOODS, + /* 0xC */ GORON_DMT_FAIRY_HINT, + /* 0xD */ GORON_MARKET_BAZAAR +} GoronType; + +#define ENGO2_GET_TYPE(this) PARAMS_GET_S((this)->actor.params, 0, 5) +#define ENGO2_GET_PATH_INDEX(this) PARAMS_GET_S((this)->actor.params, 5, 5) +#define ENGO2_CAGED_SWITCH_FLAG(this) PARAMS_GET_S((this)->actor.params, 10, 6) + +#define ENGO2_PATH_INDEX_MAX NBITS_TO_MASK(5) +#define ENGO2_IS_CAGE_OPEN(play, this) Flags_GetSwitch(play, ENGO2_CAGED_SWITCH_FLAG(this)) + #define EN_GO2_EFFECT_COUNT 10 typedef struct EnGo2 { From e5c5c320f82c14d45a2d5796eb37bd5dd2f2894f Mon Sep 17 00:00:00 2001 From: feacur Date: Fri, 13 Dec 2024 16:57:41 +0100 Subject: [PATCH 68/68] restore `func_8002F368` name --- include/z64actor.h | 2 +- src/code/z_actor.c | 2 +- src/overlays/actors/ovl_En_Ds/z_en_ds.c | 2 +- src/overlays/actors/ovl_En_Gb/z_en_gb.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 4 ++-- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 10 +++++----- src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c | 2 +- src/overlays/actors/ovl_En_Hs/z_en_hs.c | 2 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 4 ++-- src/overlays/actors/ovl_En_Ko/z_en_ko.c | 2 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 6 +++--- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 2 +- src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 2 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 4 ++-- src/overlays/actors/ovl_En_Toryo/z_en_toryo.c | 2 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 2 +- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index 6094604c5af..344f5e15ced 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -857,7 +857,7 @@ s32 Actor_OfferTalkExchangeEquiCylinder(Actor* actor, struct PlayState* play, f3 s32 Actor_OfferTalk(Actor* actor, struct PlayState* play, f32 radius); s32 Actor_OfferTalkNearColChkInfoCylinder(Actor* actor, struct PlayState* play); u32 Actor_TextboxIsClosing(Actor* actor, struct PlayState* play); -s8 Player_GetExchangeItemId(struct PlayState* play); +s8 func_8002F368(struct PlayState* play); void Actor_GetScreenPos(struct PlayState* play, Actor* actor, s16* x, s16* y); u32 Actor_HasParent(Actor* actor, struct PlayState* play); s32 Actor_OfferGetItem(Actor* actor, struct PlayState* play, s32 getItemId, f32 xzRange, f32 yRange); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index ef4b2f394c5..c9f89ffc7f5 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1768,7 +1768,7 @@ u32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) { } } -s8 Player_GetExchangeItemId(PlayState* play) { +s8 func_8002F368(PlayState* play) { Player* player = GET_PLAYER(play); return player->exchangeItemId; diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 996857a70af..b3899ae0b87 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -206,7 +206,7 @@ void EnDs_Wait(EnDs* this, PlayState* play) { s16 yawDiff; if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_ODD_MUSHROOM) { + if (func_8002F368(play) == EXCH_ITEM_ODD_MUSHROOM) { Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); player->actor.textId = 0x504A; diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 1ce70bd2a2a..40612e8646b 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -284,7 +284,7 @@ void func_80A2F83C(EnGb* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->dyna.actor, play)) { s32 pad; - switch (Player_GetExchangeItemId(play)) { + switch (func_8002F368(play)) { case EXCH_ITEM_NONE: func_80A2F180(this); this->actionFunc = func_80A2F94C; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 0b9f861ea96..85470ab9529 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -609,7 +609,7 @@ void EnGo_UpdateInteraction(EnGo* this, PlayState* play) { if ((ENGO_GET_TYPE(this) == ENGO_TYPE_DMT_BIGGORON) && (dialogStarted == true)) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_BROKEN_GORONS_SWORD) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { + if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { if (GET_INFTABLE(INFTABLE_B4)) { this->actor.textId = 0x3055; } else { @@ -622,7 +622,7 @@ void EnGo_UpdateInteraction(EnGo* this, PlayState* play) { } if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_EYE_DROPS) { + if (func_8002F368(play) == EXCH_ITEM_EYE_DROPS) { this->actor.textId = 0x3059; } else { this->actor.textId = 0x3058; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 8f165824f09..f8a896194bf 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -600,7 +600,7 @@ s16 EnGo2_UpdateTalkStateGoronDmtBiggoron(PlayState* play, EnGo2* this) { case TEXT_STATE_DONE_FADING: switch (this->actor.textId) { case 0x305E: - if (Player_GetExchangeItemId(play) != EXCH_ITEM_CLAIM_CHECK) { + if (func_8002F368(play) != EXCH_ITEM_CLAIM_CHECK) { break; } FALLTHROUGH; @@ -1045,7 +1045,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { if (ENGO2_GET_TYPE(this) == GORON_DMT_BIGGORON) { if (gSaveContext.save.info.playerData.bgsFlag) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_CLAIM_CHECK) { + if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { this->actor.textId = 0x3003; } else { this->actor.textId = 0x305E; @@ -1053,7 +1053,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { player->actor.textId = this->actor.textId; } else if (!gSaveContext.save.info.playerData.bgsFlag && (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK)) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_CLAIM_CHECK) { + if (func_8002F368(play) == EXCH_ITEM_CLAIM_CHECK) { if (Environment_GetBgsDayCount() >= 3) { textId = 0x305E; } else { @@ -1072,7 +1072,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { } else if ((INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_PRESCRIPTION) && (INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_CLAIM_CHECK)) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_EYE_DROPS) { + if (func_8002F368(play) == EXCH_ITEM_EYE_DROPS) { this->actor.textId = 0x3059; } else { this->actor.textId = 0x3058; @@ -1083,7 +1083,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) { player->actor.textId = this->actor.textId; } else if (INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_BROKEN_GORONS_SWORD) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { + if (func_8002F368(play) == EXCH_ITEM_BROKEN_GORONS_SWORD) { if (GET_INFTABLE(INFTABLE_B4)) { textId = 0x3055; } else { diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index dec4c808896..b1ee0997219 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -402,7 +402,7 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { this->unk_300 = TEXT_STATE_DONE; if (Actor_TalkOfferAccepted(&this->actor, play)) { - s32 exchangeItemId = Player_GetExchangeItemId(play); + s32 exchangeItemId = func_8002F368(play); if (exchangeItemId == EXCH_ITEM_ZELDAS_LETTER) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index ea2e4e65bea..b5c521da2da 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -206,7 +206,7 @@ void func_80A6E9AC(EnHs* this, PlayState* play) { s16 yawDiff; if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_COJIRO) { + if (func_8002F368(play) == EXCH_ITEM_COJIRO) { player->actor.textId = 0x10B2; func_80A6E3A0(this, func_80A6E8CC); Animation_Change(&this->skelAnime, &object_hs_Anim_000304, 1.0f, 0.0f, diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 44306dca6ea..b861717e867 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -957,7 +957,7 @@ void EnHy_OfferBuyBottledItem(EnHy* this, PlayState* play) { if (ENHY_GET_TYPE(&this->actor) == ENHY_TYPE_BEGGAR) { if (!Inventory_HasSpecificBottle(ITEM_BOTTLE_BLUE_FIRE) && !Inventory_HasSpecificBottle(ITEM_BOTTLE_BUG) && !Inventory_HasSpecificBottle(ITEM_BOTTLE_FISH)) { - switch (Player_GetExchangeItemId(play)) { + switch (func_8002F368(play)) { case EXCH_ITEM_BOTTLE_POE: case EXCH_ITEM_BOTTLE_BIG_POE: case EXCH_ITEM_BOTTLE_RUTOS_LETTER: @@ -971,7 +971,7 @@ void EnHy_OfferBuyBottledItem(EnHy* this, PlayState* play) { break; } } else { - switch (Player_GetExchangeItemId(play)) { + switch (func_8002F368(play)) { case EXCH_ITEM_BOTTLE_BLUE_FIRE: this->actor.textId = 0x70F0; break; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 872aab11f10..006a06e64d6 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -991,7 +991,7 @@ void func_80A9877C(EnKo* this, PlayState* play) { ENKO_TYPE == ENKO_TYPE_CHILD_FADO && play->sceneId == SCENE_LOST_WOODS) { this->actor.textId = INV_CONTENT(ITEM_TRADE_ADULT) > ITEM_ODD_POTION ? 0x10B9 : 0x10DF; - if (Player_GetExchangeItemId(play) == EXCH_ITEM_ODD_POTION) { + if (func_8002F368(play) == EXCH_ITEM_ODD_POTION) { #if OOT_VERSION < NTSC_1_1 this->actor.textId = GET_INFTABLE(INFTABLE_B6) ? 0x10B8 : 0x10B7; #else diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index fbb33e33f07..ba8c0c4c9f4 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -292,7 +292,7 @@ void func_80A9CB18(EnKz* this, PlayState* play) { if (EnKz_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, 340.0f, EnKz_GetTextId, EnKz_UpdateTalkState)) { if ((this->actor.textId == 0x401A) && !GET_EVENTCHKINF(EVENTCHKINF_GAVE_LETTER_TO_KING_ZORA)) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { + if (func_8002F368(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { this->actor.textId = 0x401B; this->sfxPlayed = false; } else { @@ -304,7 +304,7 @@ void func_80A9CB18(EnKz* this, PlayState* play) { if (LINK_IS_ADULT) { if ((INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) && - (Player_GetExchangeItemId(play) == EXCH_ITEM_PRESCRIPTION)) { + (func_8002F368(play) == EXCH_ITEM_PRESCRIPTION)) { this->actor.textId = 0x4014; this->sfxPlayed = false; player->actor.textId = this->actor.textId; @@ -494,7 +494,7 @@ void EnKz_SetupGetItem(EnKz* this, PlayState* play) { this->actionFunc = EnKz_StartTimer; } else { #if OOT_VERSION < PAL_1_0 - getItemId = Player_GetExchangeItemId(play) == EXCH_ITEM_PRESCRIPTION ? GI_EYEBALL_FROG : GI_TUNIC_ZORA; + getItemId = func_8002F368(play) == EXCH_ITEM_PRESCRIPTION ? GI_EYEBALL_FROG : GI_TUNIC_ZORA; #else getItemId = this->isTrading == true ? GI_EYEBALL_FROG : GI_TUNIC_ZORA; #endif diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 9d6d84deb1b..ab748fe164c 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -216,7 +216,7 @@ void EnMk_Wait(EnMk* this, PlayState* play) { s32 playerExchangeItem; if (Actor_TalkOfferAccepted(&this->actor, play)) { - playerExchangeItem = Player_GetExchangeItemId(play); + playerExchangeItem = func_8002F368(play); if (this->actor.textId != 0x4018) { player->actor.textId = this->actor.textId; diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 3581b89673f..02887234c50 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -374,7 +374,7 @@ void func_80ABA878(EnNiwLady* this, PlayState* play) { this->unk_26E = 11; } if (Actor_TalkOfferAccepted(&this->actor, play)) { - s8 playerExchangeItemId = Player_GetExchangeItemId(play); + s8 playerExchangeItemId = func_8002F368(play); if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 536d9e76420..c94f1acef97 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -368,7 +368,7 @@ void EnTa_IdleAsleepInCastle(EnTa* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_TalkOfferAccepted(&this->actor, play)) { - s32 exchangeItemId = Player_GetExchangeItemId(play); + s32 exchangeItemId = func_8002F368(play); switch (exchangeItemId) { case EXCH_ITEM_CHICKEN: @@ -403,7 +403,7 @@ void EnTa_IdleAsleepInKakariko(EnTa* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_TalkOfferAccepted(&this->actor, play)) { - s32 exchangeItemId = Player_GetExchangeItemId(play); + s32 exchangeItemId = func_8002F368(play); switch (exchangeItemId) { case EXCH_ITEM_POCKET_CUCCO: diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index e6008341ac4..4b27209fcae 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -318,7 +318,7 @@ void EnToryo_HandleTalking(EnToryo* this, PlayState* play) { if (this->messageState == 0) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->exchangeItemId = Player_GetExchangeItemId(play); + this->exchangeItemId = func_8002F368(play); if (this->exchangeItemId != EXCH_ITEM_NONE) { player->actor.textId = EnToryo_ReactToExchangeItem(this, play); this->actor.textId = player->actor.textId; diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index c3447b84fef..570c645a24f 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -537,7 +537,7 @@ void ObjBean_SetupWaitForBean(ObjBean* this) { void ObjBean_WaitForBean(ObjBean* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->dyna.actor, play)) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_MAGIC_BEAN) { + if (func_8002F368(play) == EXCH_ITEM_MAGIC_BEAN) { func_80B8FE00(this); Flags_SetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); }