diff --git a/include/z64save.h b/include/z64save.h index 430577f354..5a0e9103ea 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -293,11 +293,11 @@ typedef enum { #define EVENTCHKINF_10 0x10 #define EVENTCHKINF_11 0x11 #define EVENTCHKINF_12 0x12 -#define EVENTCHKINF_13 0x13 -#define EVENTCHKINF_14 0x14 +#define EVENTCHKINF_TALON_WOKEN_IN_CASTLE 0x13 +#define EVENTCHKINF_TALON_RETURNED_FROM_CASTLE 0x14 #define EVENTCHKINF_15 0x15 #define EVENTCHKINF_16 0x16 -#define EVENTCHKINF_18 0x18 +#define EVENTCHKINF_EPONA_OBTAINED 0x18 #define EVENTCHKINF_1B 0x1B #define EVENTCHKINF_1C 0x1C #define EVENTCHKINF_1D 0x1D @@ -354,13 +354,13 @@ typedef enum { #define EVENTCHKINF_67 0x67 #define EVENTCHKINF_68 0x68 #define EVENTCHKINF_69 0x69 -#define EVENTCHKINF_6A 0x6A +#define EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO 0x6A // 0x6B -#define EVENTCHKINF_6B_INDEX 6 -#define EVENTCHKINF_6B_SHIFT 11 -#define EVENTCHKINF_6B_MASK (1 << EVENTCHKINF_6B_SHIFT) -#define EVENTCHKINF_6B ((EVENTCHKINF_6B_INDEX << 4) | EVENTCHKINF_6B_SHIFT) +#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_INDEX 6 +#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_SHIFT 11 +#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_MASK (1 << EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_SHIFT) +#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO ((EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_INDEX << 4) | EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_SHIFT) #define EVENTCHKINF_6E 0x6E #define EVENTCHKINF_6F 0x6F @@ -473,7 +473,7 @@ typedef enum { * SaveContext.itemGetInf */ -#define ITEMGETINF_02 0x02 +#define ITEMGETINF_TALON_BOTTLE 0x02 #define ITEMGETINF_03 0x03 #define ITEMGETINF_04 0x04 #define ITEMGETINF_05 0x05 @@ -563,7 +563,7 @@ typedef enum { #define INFTABLE_71 0x71 #define INFTABLE_76 0x76 #define INFTABLE_77 0x77 -#define INFTABLE_7E 0x7E +#define INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE 0x7E #define INFTABLE_84 0x84 #define INFTABLE_85 0x85 #define INFTABLE_8B 0x8B @@ -709,8 +709,13 @@ typedef enum { #define EVENTINF_HORSES_0F_MASK (1 << EVENTINF_HORSES_0F_SHIFT) #define EVENTINF_HORSES_05 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_05_SHIFT) #define EVENTINF_HORSES_06 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_06_SHIFT) +// Used in z_en_ta (Talon) to store Cucco game winning status +// and in z_en_ge1 (Gerudo) to store archery in-progress status #define EVENTINF_HORSES_08 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_08_SHIFT) +#define EVENTINF_CUCCO_GAME_WON EVENTINF_HORSES_08 +// Used in z_en_ta (Talon) and z_en_ma3 (Malon) to store minigame finishing status #define EVENTINF_HORSES_0A ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_0A_SHIFT) +#define EVENTINF_CUCCO_GAME_FINISHED EVENTINF_HORSES_0A typedef enum { /* 0 */ EVENTINF_HORSES_STATE_0, diff --git a/src/code/z_actor.c b/src/code/z_actor.c index b14f32a84d..e1f9390296 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4602,7 +4602,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) { if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) && Flags_GetEventChkInf(EVENTCHKINF_37)) { retTextId = 0x7047; - } else if (Flags_GetEventChkInf(EVENTCHKINF_14)) { + } else if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { retTextId = 0x701A; } else if (Flags_GetEventChkInf(EVENTCHKINF_11)) { if (Flags_GetInfTable(INFTABLE_C6)) { @@ -4911,9 +4911,10 @@ u32 func_80035BFC(PlayState* play, s16 arg1) { retTextId = 0x2049; } else if (Flags_GetEventChkInf(EVENTCHKINF_15)) { retTextId = 0x2048; - } else if (Flags_GetEventChkInf(EVENTCHKINF_14)) { + } else if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { retTextId = 0x2047; - } else if (Flags_GetEventChkInf(EVENTCHKINF_12) && !Flags_GetEventChkInf(EVENTCHKINF_14)) { + } else if (Flags_GetEventChkInf(EVENTCHKINF_12) && + !Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { retTextId = 0x2044; } else if (Flags_GetEventChkInf(EVENTCHKINF_10)) { if (Flags_GetEventChkInf(EVENTCHKINF_11)) { @@ -4927,7 +4928,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) { break; case 72: if (!LINK_IS_ADULT) { - if (Flags_GetEventChkInf(EVENTCHKINF_14)) { + if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { retTextId = 0x2040; } else if (Flags_GetInfTable(INFTABLE_94)) { retTextId = 0x2040; @@ -4935,7 +4936,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) { retTextId = 0x203F; } } else { - if (!Flags_GetEventChkInf(EVENTCHKINF_18)) { + if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) { if (!IS_DAY) { retTextId = 0x204E; } else if (Flags_GetInfTable(INFTABLE_9A)) { diff --git a/src/code/z_demo.c b/src/code/z_demo.c index b7c178ee6f..9aba6c7fec 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -61,10 +61,10 @@ EntranceCutscene sEntranceCutsceneTable[] = { { ENTR_SPOT18_0, 2, EVENTCHKINF_A6, gGoronCityIntroCs }, { ENTR_TOKINOMA_0, 2, EVENTCHKINF_A7, gTempleOfTimeIntroCs }, { ENTR_YDAN_0, 2, EVENTCHKINF_A8, gDekuTreeIntroCs }, - { ENTR_SPOT00_11, 0, EVENTCHKINF_18, gHyruleFieldSouthEponaJumpCs }, - { ENTR_SPOT00_13, 0, EVENTCHKINF_18, gHyruleFieldEastEponaJumpCs }, - { ENTR_SPOT00_12, 0, EVENTCHKINF_18, gHyruleFieldWestEponaJumpCs }, - { ENTR_SPOT00_15, 0, EVENTCHKINF_18, gHyruleFieldGateEponaJumpCs }, + { ENTR_SPOT00_11, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldSouthEponaJumpCs }, + { ENTR_SPOT00_13, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldEastEponaJumpCs }, + { ENTR_SPOT00_12, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldWestEponaJumpCs }, + { ENTR_SPOT00_15, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldGateEponaJumpCs }, { ENTR_SPOT00_16, 1, EVENTCHKINF_A9, gHyruleFieldGetOoTCs }, { ENTR_SPOT06_0, 2, EVENTCHKINF_B1, gLakeHyliaIntroCs }, { ENTR_SPOT09_0, 2, EVENTCHKINF_B2, gGerudoValleyIntroCs }, @@ -2061,7 +2061,7 @@ void Cutscene_HandleEntranceTriggers(PlayState* play) { } if ((gSaveContext.entranceIndex == entranceCutscene->entrance) && - (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_18)) && + (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_EPONA_OBTAINED)) && (gSaveContext.cutsceneIndex < 0xFFF0) && ((u8)gSaveContext.linkAge == requiredAge) && (gSaveContext.respawnFlag <= 0)) { Flags_SetEventChkInf(entranceCutscene->flag); diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 27cca3d2e9..e1b316dffc 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -48,7 +48,7 @@ void func_8006D0EC(PlayState* play, Player* player) { { SCENE_SPOT20, 928, 0, -2280, 0, 2 }, }; - if ((AREG(6) != 0) && (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0))) { + if ((AREG(6) != 0) && (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0))) { player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x, player->actor.shape.rot.y, player->actor.shape.rot.z, 9); @@ -67,15 +67,15 @@ void func_8006D0EC(PlayState* play, Player* player) { gSaveContext.minigameState = 0; horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1); horseActor->room = -1; - } else if ((gSaveContext.entranceIndex == ENTR_SPOT20_7) && GET_EVENTCHKINF(EVENTCHKINF_18)) { + } else if ((gSaveContext.entranceIndex == ENTR_SPOT20_7) && GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1); ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 389); } else if ((play->sceneId == gSaveContext.horseData.sceneId) && - (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0)) { + (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1) != 0)) { // "Set by existence of horse %d %d %d" osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horseData.sceneId, - Flags_GetEventChkInf(EVENTCHKINF_18), DREG(1)); + Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED), DREG(1)); if (func_8006CFC0(gSaveContext.horseData.sceneId)) { Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, gSaveContext.horseData.pos.x, @@ -92,10 +92,10 @@ void func_8006D0EC(PlayState* play, Player* player) { osSyncPrintf(VT_RST); func_8006D074(play); } - } else if ((play->sceneId == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) { + } else if ((play->sceneId == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) { Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1); ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 443); - } else if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) { + } else if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0)) { for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) { HorseSpawn* horseSpawn = &horseSpawns[i]; if (horseSpawn->sceneId == play->sceneId) { @@ -110,7 +110,7 @@ void func_8006D0EC(PlayState* play, Player* player) { break; } } - } else if (!Flags_GetEventChkInf(EVENTCHKINF_18)) { + } else if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) { if ((DREG(1) == 0) && (play->sceneId == SCENE_SOUKO) && !IS_DAY) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1); } @@ -158,7 +158,7 @@ void func_8006D684(PlayState* play, Player* player) { func_8002DE74(play, player); gSaveContext.horseData.sceneId = play->sceneId; } else if ((play->sceneId == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) && - !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) { + !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) { player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5); ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 582); @@ -252,7 +252,7 @@ void func_8006DC68(PlayState* play, Player* player) { gSaveContext.entranceIndex == ENTR_SPOT00_13 || gSaveContext.entranceIndex == ENTR_SPOT00_15) && (gSaveContext.respawnFlag == 0)) || ((play->sceneId == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) && - !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0))) { + !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0))) { func_8006D684(play, player); } else { func_8006D0EC(play, player); diff --git a/src/elf_message/elf_message_field.c b/src/elf_message/elf_message_field.c index 57736c5a3b..cd48f53ff3 100644 --- a/src/elf_message/elf_message_field.c +++ b/src/elf_message/elf_message_field.c @@ -5,7 +5,7 @@ ElfMessage gOverworldNaviMsgs[] = { ELF_MSG_FLAG(CHECK, 0x40, false, EVENTCHKINF_05), ELF_MSG_FLAG(CHECK, 0x41, false, EVENTCHKINF_09), ELF_MSG_FLAG(CHECK, 0x42, false, EVENTCHKINF_12), - ELF_MSG_FLAG(CHECK, 0x43, false, EVENTCHKINF_14), + ELF_MSG_FLAG(CHECK, 0x43, false, EVENTCHKINF_TALON_RETURNED_FROM_CASTLE), ELF_MSG_FLAG(CHECK, 0x44, false, EVENTCHKINF_40), ELF_MSG_SONG(CHECK, 0x45, false, ITEM_SONG_SARIA), ELF_MSG_STRENGTH_UPG(CHECK, 0x46, true, 0), diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index df0cdd482c..b21671614e 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -45,7 +45,7 @@ void BgInGate_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if ((play->sceneId != SCENE_SPOT20 || !LINK_IS_ADULT) || - (GET_EVENTCHKINF(EVENTCHKINF_18) && (gSaveContext.cutsceneIndex != 0xFFF0))) { + (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (gSaveContext.cutsceneIndex != 0xFFF0))) { Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 2c89f5a6bb..1ecfeca0cf 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -110,7 +110,7 @@ s32 func_808B3AAC(BgSpot15Rrbox* this, PlayState* play) { } if (rotY < 0x2000 && rotY > -0x6000) { - return GET_EVENTCHKINF(EVENTCHKINF_14); + return GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE); } return true; } diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index d02ffbbf22..bb907e07c0 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -41,7 +41,7 @@ void BgUmaJump_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.params == 1) { - if (!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) { + if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) { Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index ddbdd5ed5b..1983c86d07 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -197,7 +197,7 @@ void EnDoor_SetupType(EnDoor* this, PlayState* play) { } } else if (doorType == DOOR_CHECKABLE) { this->actor.textId = ENDOOR_GET_CHECKABLE_TEXT_ID(&this->actor) + 0x0200; - if (this->actor.textId == 0x0229 && !GET_EVENTCHKINF(EVENTCHKINF_14)) { + if (this->actor.textId == 0x0229 && !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { // Talon's house door. If Talon has not been woken up at Hyrule Castle // this door should be openable at any time of day. // Note that there is no check for time of day, as the night layers for Lon Lon diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index d1243950b1..c617960412 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -316,7 +316,7 @@ void EnGirlA_SetupAction(EnGirlA* this, EnGirlAActionFunc func) { s32 EnGirlA_TryChangeShopItem(EnGirlA* this) { switch (this->actor.params) { case SI_MILK_BOTTLE: - if (GET_ITEMGETINF(ITEMGETINF_02)) { + if (GET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE)) { this->actor.params = SI_RECOVERY_HEART; return true; } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 69149c8e7e..ccfcb39775 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -682,8 +682,9 @@ s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { player = GET_PLAYER(play); if (play->sceneId != SCENE_SPOT20 || //! Same flag checked twice - (Flags_GetEventChkInf(EVENTCHKINF_18) && - (GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_6 || Flags_GetEventChkInf(EVENTCHKINF_18))) || + (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && + (GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_6 || + Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED))) || // always load two spawns inside lon lon ((sHorseSpawns[i].pos.x == 856 && sHorseSpawns[i].pos.y == 0 && sHorseSpawns[i].pos.z == -918) || (sHorseSpawns[i].pos.x == -1003 && sHorseSpawns[i].pos.y == 0 && sHorseSpawns[i].pos.z == -755))) { @@ -794,7 +795,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->stateFlags = ENHORSE_FLAG_19 | ENHORSE_CANT_JUMP | ENHORSE_UNRIDEABLE; } else if (this->actor.params == 6) { this->stateFlags = ENHORSE_FLAG_19 | ENHORSE_CANT_JUMP; - if (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0) { + if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1) != 0) { this->stateFlags &= ~ENHORSE_CANT_JUMP; this->stateFlags |= ENHORSE_FLAG_26; } else if (GET_EVENTINF(EVENTINF_HORSES_06) && this->type == HORSE_HNI) { @@ -808,7 +809,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { } if (play->sceneId == SCENE_SPOT20 && GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6 && - !Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1)) { + !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && !DREG(1)) { this->stateFlags |= ENHORSE_FLAG_25; } @@ -834,7 +835,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Actor_Kill(&this->actor); return; } - if (Flags_GetEventChkInf(EVENTCHKINF_18)) { + if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) { Actor_Kill(&this->actor); return; } @@ -842,12 +843,12 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Actor_Kill(&this->actor); return; } - } else if (!Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1) && !IS_DAY) { + } else if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && !DREG(1) && !IS_DAY) { Actor_Kill(&this->actor); return; } } else if (play->sceneId == SCENE_MALON_STABLE) { - if (IS_DAY || Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0 || !LINK_IS_ADULT) { + if (IS_DAY || Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1) != 0 || !LINK_IS_ADULT) { Actor_Kill(&this->actor); return; } @@ -882,7 +883,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { } else if (this->actor.params == 8) { EnHorse_InitHorsebackArchery(this); Interface_InitHorsebackArchery(play); - } else if (play->sceneId == SCENE_SPOT20 && !Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1)) { + } else if (play->sceneId == SCENE_SPOT20 && !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && !DREG(1)) { EnHorse_InitFleePlayer(this); } else { if (play->sceneId == SCENE_SOUKO) { diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 933c71617e..2aad608dbb 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -444,7 +444,7 @@ void EnHorseGameCheck_Init(Actor* thisx, PlayState* play) { s32 pad; EnHorseGameCheckBase* this = (EnHorseGameCheckBase*)thisx; - if ((play->sceneId == SCENE_SPOT20) && (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1))) { + if ((play->sceneId == SCENE_SPOT20) && (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1))) { this->actor.params = HORSEGAME_MALON_RACE; } if (sInitFuncs[this->actor.params] != NULL) { diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index fcd84eb335..64101df33b 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -165,7 +165,7 @@ void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { if (IS_CUTSCENE_LAYER) { func_80A69EC0(this); } else if (play->sceneId == SCENE_SPOT20) { - if (!Flags_GetEventChkInf(EVENTCHKINF_14)) { + if (!Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index a61df481d4..f9596531c7 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -207,7 +207,7 @@ void EnHorseNormal_Init(Actor* thisx, PlayState* play) { return; } if (!LINK_IS_ADULT) { - if (Flags_GetEventChkInf(EVENTCHKINF_14)) { + if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { if (this->actor.world.rot.z != 3) { Actor_Kill(&this->actor); return; @@ -216,7 +216,7 @@ void EnHorseNormal_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - } else if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) { + } else if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0)) { if (this->actor.world.rot.z != 7) { Actor_Kill(&this->actor); return; 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 c8161c3a9e..f4c16cae63 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -429,7 +429,9 @@ u16 func_80A6F810(PlayState* play, Actor* thisx) { switch (this->actor.params & 0x7F) { case ENHY_TYPE_AOB: if (play->sceneId == SCENE_KAKARIKO) { - return (this->unk_330 & EVENTCHKINF_6B_MASK) ? 0x508D : (GET_INFTABLE(INFTABLE_CB) ? 0x508C : 0x508B); + return (this->unk_330 & EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_MASK) + ? 0x508D + : (GET_INFTABLE(INFTABLE_CB) ? 0x508C : 0x508B); } else if (play->sceneId == SCENE_MARKET_DAY) { return GET_EVENTINF(EVENTINF_30) ? 0x709B : 0x709C; } else if (gSaveContext.dogIsLost) { @@ -457,7 +459,7 @@ u16 func_80A6F810(PlayState* play, Actor* thisx) { return 0x5085; } else if (GET_EVENTCHKINF(EVENTCHKINF_80)) { return GET_INFTABLE(INFTABLE_C3) ? 0x701A : 0x7047; - } else if (GET_EVENTCHKINF(EVENTCHKINF_14)) { + } else if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { return 0x701A; } else if (GET_EVENTCHKINF(EVENTCHKINF_10)) { return 0x701B; @@ -537,7 +539,9 @@ u16 func_80A6F810(PlayState* play, Actor* thisx) { if (!LINK_IS_ADULT) { return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x505F : (GET_INFTABLE(INFTABLE_163) ? 0x505E : 0x505D); } else { - return (this->unk_330 & EVENTCHKINF_6B_MASK) ? 0x5062 : (GET_INFTABLE(INFTABLE_164) ? 0x5061 : 0x5060); + return (this->unk_330 & EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_MASK) + ? 0x5062 + : (GET_INFTABLE(INFTABLE_164) ? 0x5061 : 0x5060); } case ENHY_TYPE_BJI_19: return 0x7120; @@ -909,7 +913,7 @@ void EnHy_InitImpl(EnHy* this, PlayState* play) { } if (play->sceneId == SCENE_KAKARIKO) { - this->unk_330 = gSaveContext.eventChkInf[EVENTCHKINF_6B_INDEX]; + this->unk_330 = gSaveContext.eventChkInf[EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_INDEX]; } EnHy_InitSetProperties(this); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 33a2e33f1f..64849d8551 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -110,7 +110,7 @@ static Gfx* sAdultEraDLs[] = { }; u16 func_80A78FB0(PlayState* play) { - if (GET_EVENTCHKINF(EVENTCHKINF_14)) { + if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { if (GET_INFTABLE(INFTABLE_97)) { return 0x2046; } else { @@ -131,7 +131,7 @@ u16 func_80A79010(PlayState* play) { if (temp_v0 != 0) { return temp_v0; } - if (GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { if (IS_DAY) { return 0x205F; } else { @@ -364,34 +364,34 @@ s32 func_80A7975C(EnIn* this, PlayState* play) { s32 func_80A79830(EnIn* this, PlayState* play) { if (play->sceneId == SCENE_SPOT20 && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 1 && - !GET_EVENTCHKINF(EVENTCHKINF_14)) { + !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { return 1; } if (play->sceneId == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 3 && - GET_EVENTCHKINF(EVENTCHKINF_14)) { + GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { return 1; } if (play->sceneId == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_NIGHT) { - if ((this->actor.shape.rot.z == 2) && !GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((this->actor.shape.rot.z == 2) && !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { return 1; } - if ((this->actor.shape.rot.z == 4) && GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((this->actor.shape.rot.z == 4) && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { return 1; } } if (play->sceneId == SCENE_SPOT20 && LINK_IS_ADULT && IS_DAY) { - if ((this->actor.shape.rot.z == 5) && !GET_EVENTCHKINF(EVENTCHKINF_18)) { + if ((this->actor.shape.rot.z == 5) && !GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { return 2; } - if ((this->actor.shape.rot.z == 7) && GET_EVENTCHKINF(EVENTCHKINF_18)) { + if ((this->actor.shape.rot.z == 7) && GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { return 4; } } if (play->sceneId == SCENE_SOUKO && LINK_IS_ADULT && IS_NIGHT) { - if (this->actor.shape.rot.z == 6 && !GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (this->actor.shape.rot.z == 6 && !GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { return 3; } - if (this->actor.shape.rot.z == 8 && GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (this->actor.shape.rot.z == 8 && GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { return 3; } } @@ -530,7 +530,7 @@ void func_80A79FB0(EnIn* this, PlayState* play) { case 3: EnIn_ChangeAnim(this, ENIN_ANIM_7); this->actionFunc = func_80A7A4BC; - if (!GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { this->actor.params = 5; } break; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 6248a77dde..dc75f79ff2 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -107,7 +107,7 @@ u16 EnMa1_GetText(PlayState* play, Actor* thisx) { return 0x2048; } } - if (GET_EVENTCHKINF(EVENTCHKINF_14)) { + if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { return 0x2047; } if (GET_EVENTCHKINF(EVENTCHKINF_12)) { @@ -188,10 +188,10 @@ s32 func_80AA08C4(EnMa1* this, PlayState* play) { return 0; } if (((play->sceneId == SCENE_MARKET_NIGHT) || (play->sceneId == SCENE_MARKET_DAY)) && - !GET_EVENTCHKINF(EVENTCHKINF_14) && !GET_INFTABLE(INFTABLE_8B)) { + !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) && !GET_INFTABLE(INFTABLE_8B)) { return 1; } - if ((play->sceneId == SCENE_SPOT15) && !GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((play->sceneId == SCENE_SPOT15) && !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { if (GET_INFTABLE(INFTABLE_8B)) { return 1; } else { @@ -199,13 +199,13 @@ s32 func_80AA08C4(EnMa1* this, PlayState* play) { return 0; } } - if ((play->sceneId == SCENE_SOUKO) && IS_NIGHT && GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((play->sceneId == SCENE_SOUKO) && IS_NIGHT && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { return 1; } if (play->sceneId != SCENE_SPOT20) { return 0; } - if ((this->actor.shape.rot.z == 3) && IS_DAY && GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((this->actor.shape.rot.z == 3) && IS_DAY && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { return 1; } return 0; @@ -282,7 +282,7 @@ void EnMa1_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 6; this->unk_1E8.unk_00 = 0; - if (!GET_EVENTCHKINF(EVENTCHKINF_14) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { this->actionFunc = func_80AA0D88; EnMa1_ChangeAnim(this, ENMA1_ANIM_2); } else { @@ -309,9 +309,9 @@ void func_80AA0D88(EnMa1* this, PlayState* play) { } } - if ((play->sceneId == SCENE_SPOT15) && GET_EVENTCHKINF(EVENTCHKINF_14)) { + if ((play->sceneId == SCENE_SPOT15) && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { Actor_Kill(&this->actor); - } else if (!GET_EVENTCHKINF(EVENTCHKINF_14) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { + } else if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { if (this->unk_1E8.unk_00 == 2) { this->actionFunc = func_80AA0EA0; play->msgCtx.stateTimer = 4; diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 8c34610a44..8fbcac0f10 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -74,7 +74,7 @@ u16 func_80AA19A0(PlayState* play, Actor* thisx) { if (faceReaction != 0) { return faceReaction; } - if (GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { return 0x2056; } if (IS_NIGHT) { @@ -141,15 +141,15 @@ u16 func_80AA1B58(EnMa2* this, PlayState* play) { if (LINK_IS_CHILD) { return 0; } - if (!GET_EVENTCHKINF(EVENTCHKINF_18) && (play->sceneId == SCENE_MALON_STABLE) && IS_DAY && + if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (play->sceneId == SCENE_MALON_STABLE) && IS_DAY && (this->actor.shape.rot.z == 5)) { return 1; } - if (!GET_EVENTCHKINF(EVENTCHKINF_18) && (play->sceneId == SCENE_SPOT20) && IS_NIGHT && + if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (play->sceneId == SCENE_SPOT20) && IS_NIGHT && (this->actor.shape.rot.z == 6)) { return 2; } - if (!GET_EVENTCHKINF(EVENTCHKINF_18) || (play->sceneId != SCENE_SPOT20)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) || (play->sceneId != SCENE_SPOT20)) { return 0; } if ((this->actor.shape.rot.z == 7) && IS_DAY) { diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index bf3110892e..1d83f2016e 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -201,7 +201,7 @@ s32 func_80AA2EC8(EnMa3* this, PlayState* play) { if (LINK_IS_CHILD) { return 2; } - if (!GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { return 2; } if (GET_EVENTINF(EVENTINF_HORSES_0A)) { diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 06abff8ec4..9b624f9fe4 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -188,22 +188,22 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { } break; case 1: - if (GET_EVENTCHKINF(EVENTCHKINF_14)) { + if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { Actor_Kill(&this->actor); } break; case 3: - if (!GET_EVENTCHKINF(EVENTCHKINF_14)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { Actor_Kill(&this->actor); } break; case 5: - if (GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { Actor_Kill(&this->actor); } break; case 7: - if (!GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { Actor_Kill(&this->actor); } break; 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 05276ddf1e..0c1e47c7b9 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 @@ -342,7 +342,7 @@ void func_80ABA778(EnNiwLady* this, PlayState* play) { this->unk_27A = 2; if (!GET_ITEMGETINF(ITEMGETINF_2E)) { this->unk_27A = 3; - if (GET_EVENTCHKINF(EVENTCHKINF_6A)) { + if (GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { this->unk_27A = 9; if (this->unk_277 != 0) { this->unk_27A = 10; @@ -365,7 +365,7 @@ void func_80ABA878(EnNiwLady* this, PlayState* play) { } if (Actor_ProcessTalkRequest(&this->actor, play)) { playerExchangeItemId = func_8002F368(play); - if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_6A)) { + if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); player->actor.textId = sTradeItemTextIds[5]; this->unk_26E = this->unk_27A + 21; 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 b6b9e2c054..26c1d6e98c 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -10,26 +10,54 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) +#define TALON_STATE_FLAG_TRACKING_PLAYER (1 << 0) +#define TALON_STATE_FLAG_GIVING_MILK_REFILL (1 << 1) +#define TALON_STATE_FLAG_SUPPRESS_BLINK (1 << 2) +// This has no effect, see EnTa_OverrideLimbDraw for details +#define TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM (1 << 3) +#define TALON_STATE_FLAG_ANIMATION_FINISHED (1 << 4) +#define TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED (1 << 5) +#define TALON_STATE_FLAG_FLOOR_CAMERA_ACTIVE (1 << 7) +#define TALON_STATE_FLAG_RAISING_HANDS (1 << 8) +#define TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY (1 << 9) + +#define TALON_FACE_REACTION_SET 24 + +typedef enum { + /* 0 */ TALON_EYE_INDEX_OPEN, + /* 1 */ TALON_EYE_INDEX_HALF, + /* 2 */ TALON_EYE_INDEX_CLOSED, + /* 3 */ TALON_EYE_INDEX_MAX +} TalonEyeIndex; + +typedef enum { + /* 0 */ TALON_CANBUYMILK_NOT_ENOUGH_RUPEES, + /* 1 */ TALON_CANBUYMILK_NO_EMPTY_BOTTLE, + /* 2 */ TALON_CANBUYMILK_SUCCESS +} TalonCanBuyMilkResult; + void EnTa_Init(Actor* thisx, PlayState* play2); void EnTa_Destroy(Actor* thisx, PlayState* play); void EnTa_Update(Actor* thisx, PlayState* play); void EnTa_Draw(Actor* thisx, PlayState* play); -void func_80B14634(EnTa* this, PlayState* play); -void func_80B146F8(EnTa* this, PlayState* play); -void func_80B14754(EnTa* this, PlayState* play); -void func_80B14C18(EnTa* this, PlayState* play); -void func_80B14CAC(EnTa* this, PlayState* play); -void func_80B14D98(EnTa* this, PlayState* play); -void func_80B154FC(EnTa* this, PlayState* play); -void func_80B16504(EnTa* this, PlayState* play); -void func_80B16608(EnTa* this, PlayState* play); -void func_80B166CC(EnTa* this); -void func_80B16700(EnTa* this); -void func_80B167C0(EnTa* this); -void func_80B167FC(EnTa* this); -void func_80B16854(EnTa* this); -void func_80B16938(EnTa* this); +void EnTa_IdleAsleepInCastle(EnTa* this, PlayState* play); +void EnTa_IdleAsleepInLonLonHouse(EnTa* this, PlayState* play); +void EnTa_IdleAsleepInKakariko(EnTa* this, PlayState* play); +void EnTa_IdleAwakeInCastle(EnTa* this, PlayState* play); +void EnTa_IdleAwakeInKakariko(EnTa* this, PlayState* play); +void EnTa_IdleAtRanch(EnTa* this, PlayState* play); +void EnTa_RunCuccoGame(EnTa* this, PlayState* play); +void EnTa_IdleSittingInLonLonHouse(EnTa* this, PlayState* play); +void EnTa_IdleAfterCuccoGameFinished(EnTa* this, PlayState* play); + +void EnTa_BlinkWaitUntilNext(EnTa* this); +void EnTa_BlinkAdvanceState(EnTa* this); + +void EnTa_AnimRepeatCurrent(EnTa* this); +void EnTa_AnimSleeping(EnTa* this); +void EnTa_AnimSitSleeping(EnTa* this); +void EnTa_AnimRunToEnd(EnTa* this); const ActorInit En_Ta_InitVars = { ACTOR_EN_TA, @@ -63,33 +91,41 @@ static ColliderCylinderInit sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -void func_80B13AA0(EnTa* this, EnTaActionFunc arg1, EnTaUnkFunc arg2) { - this->actionFunc = arg1; - this->unk_260 = arg2; +void EnTa_SetupAction(EnTa* this, EnTaActionFunc actionFunc, EnTaAnimFunc animFunc) { + this->actionFunc = actionFunc; + this->animFunc = animFunc; } -void func_80B13AAC(EnTa* this, PlayState* play) { - u16 faceReaction = Text_GetFaceReaction(play, 24); +void EnTa_SetTextForTalkInLonLonHouse(EnTa* this, PlayState* play) { + u16 faceReaction = Text_GetFaceReaction(play, TALON_FACE_REACTION_SET); - if (GET_EVENTINF(EVENTINF_HORSES_0A)) { - if (GET_EVENTINF(EVENTINF_HORSES_08)) { - if (GET_ITEMGETINF(ITEMGETINF_02)) { + // Check if cucco game was just finished + if (GET_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED)) { + // Check if the game was won + if (GET_EVENTINF(EVENTINF_CUCCO_GAME_WON)) { + if (GET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE)) { + // Game won already before this->actor.textId = 0x2088; } else { + // First time winning this->actor.textId = 0x2086; } } else { + // Try again this->actor.textId = 0x2085; } - CLEAR_EVENTINF(EVENTINF_HORSES_08); + CLEAR_EVENTINF(EVENTINF_CUCCO_GAME_WON); } else if (faceReaction == 0) { - if (GET_INFTABLE(INFTABLE_7E)) { - if (GET_ITEMGETINF(ITEMGETINF_02)) { + if (GET_INFTABLE(INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE)) { + if (GET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE)) { + // Play cucco game or buy milk this->actor.textId = 0x208B; } else { + // Play cucco game? this->actor.textId = 0x207F; } } else { + // First time talking to Talon in Lon Lon house this->actor.textId = 0x207E; } } else { @@ -102,16 +138,17 @@ void EnTa_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gTalonSkel, &gTalonStandAnim, this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &gTalonSkel, &gTalonStandAnim, this->jointTable, this->morphTable, + ENTA_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->unk_2E0 = 0; - this->unk_2CE = 0; - this->unk_2E2 = 0; + this->stateFlags = 0; + this->rapidBlinks = 0; + this->nodOffTimer = 0; this->blinkTimer = 20; - this->unk_2B0 = func_80B166CC; + this->blinkFunc = EnTa_BlinkWaitUntilNext; Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->actor.velocity.y = -4.0f; @@ -119,28 +156,31 @@ void EnTa_Init(Actor* thisx, PlayState* play2) { this->actor.gravity = -1.0f; switch (this->actor.params) { - case 1: + case ENTA_IN_KAKARIKO: + // "Exile Talon" osSyncPrintf(VT_FGCOL(CYAN) " 追放タロン \n" VT_RST); - if (GET_EVENTCHKINF(EVENTCHKINF_6B)) { + if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO)) { Actor_Kill(&this->actor); } else if (!LINK_IS_ADULT) { Actor_Kill(&this->actor); - } else if (GET_EVENTCHKINF(EVENTCHKINF_6A)) { - func_80B13AA0(this, func_80B14CAC, func_80B167C0); - this->eyeIndex = 0; + } else if (GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { + EnTa_SetupAction(this, EnTa_IdleAwakeInKakariko, EnTa_AnimRepeatCurrent); + this->eyeIndex = TALON_EYE_INDEX_OPEN; Animation_PlayOnce(&this->skelAnime, &gTalonStandAnim); this->currentAnimation = &gTalonStandAnim; } else { - func_80B13AA0(this, func_80B14754, func_80B167FC); - this->eyeIndex = 2; + EnTa_SetupAction(this, EnTa_IdleAsleepInKakariko, EnTa_AnimSleeping); + this->eyeIndex = TALON_EYE_INDEX_CLOSED; Animation_PlayOnce(&this->skelAnime, &gTalonSleepAnim); this->currentAnimation = &gTalonSleepAnim; this->actor.shape.shadowScale = 54.0f; } break; - case 2: + + case ENTA_RETURNED_FROM_KAKARIKO: + // "Return Talon" osSyncPrintf(VT_FGCOL(CYAN) " 出戻りタロン \n" VT_RST); - if (!GET_EVENTCHKINF(EVENTCHKINF_6B)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO)) { Actor_Kill(&this->actor); } else if (!LINK_IS_ADULT) { Actor_Kill(&this->actor); @@ -148,39 +188,41 @@ void EnTa_Init(Actor* thisx, PlayState* play2) { Actor_Kill(&this->actor); osSyncPrintf(VT_FGCOL(CYAN) " 夜はいない \n" VT_RST); } else { - func_80B13AA0(this, func_80B14D98, func_80B167C0); - this->eyeIndex = 0; + EnTa_SetupAction(this, EnTa_IdleAtRanch, EnTa_AnimRepeatCurrent); + this->eyeIndex = TALON_EYE_INDEX_OPEN; Animation_PlayOnce(&this->skelAnime, &gTalonStandAnim); this->currentAnimation = &gTalonStandAnim; } break; - default: + + default: // Child era Talon + // "Other Talon" osSyncPrintf(VT_FGCOL(CYAN) " その他のタロン \n" VT_RST); if (play->sceneId == SCENE_SPOT15) { - if (GET_EVENTCHKINF(EVENTCHKINF_14)) { + if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { Actor_Kill(&this->actor); - } else if (GET_EVENTCHKINF(EVENTCHKINF_13)) { - func_80B13AA0(this, func_80B14C18, func_80B167C0); - this->eyeIndex = 0; + } else if (GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_CASTLE)) { + EnTa_SetupAction(this, EnTa_IdleAwakeInCastle, EnTa_AnimRepeatCurrent); + this->eyeIndex = TALON_EYE_INDEX_OPEN; Animation_PlayOnce(&this->skelAnime, &gTalonStandAnim); this->currentAnimation = &gTalonStandAnim; } else { - func_80B13AA0(this, func_80B14634, func_80B167FC); - this->eyeIndex = 2; + EnTa_SetupAction(this, EnTa_IdleAsleepInCastle, EnTa_AnimSleeping); + this->eyeIndex = TALON_EYE_INDEX_CLOSED; Animation_PlayOnce(&this->skelAnime, &gTalonSleepAnim); this->currentAnimation = &gTalonSleepAnim; this->actor.shape.shadowScale = 54.0f; } } else if (play->sceneId == SCENE_SOUKO) { osSyncPrintf(VT_FGCOL(CYAN) " ロンロン牧場の倉庫 の タロン\n" VT_RST); - if (!GET_EVENTCHKINF(EVENTCHKINF_14)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { Actor_Kill(&this->actor); } else if (LINK_IS_ADULT) { Actor_Kill(&this->actor); } else { if (IS_DAY) { this->actor.flags |= ACTOR_FLAG_4; - this->unk_2C4[0] = this->unk_2C4[1] = this->unk_2C4[2] = 7; + this->superCuccoTimers[0] = this->superCuccoTimers[1] = this->superCuccoTimers[2] = 7; this->superCuccos[0] = (EnNiw*)Actor_Spawn( &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 5.0f, this->actor.world.pos.y + 3.0f, this->actor.world.pos.z + 26.0f, 0, 0, 0, 0xD); @@ -190,31 +232,31 @@ void EnTa_Init(Actor* thisx, PlayState* play2) { this->superCuccos[2] = (EnNiw*)Actor_Spawn( &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 20.0f, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD); - func_80B13AAC(this, play); + EnTa_SetTextForTalkInLonLonHouse(this, play); - if (GET_EVENTINF(EVENTINF_HORSES_0A)) { - func_80B13AA0(this, func_80B16608, func_80B16938); + if (GET_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED)) { + EnTa_SetupAction(this, EnTa_IdleAfterCuccoGameFinished, EnTa_AnimRunToEnd); Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 0.0f); - CLEAR_EVENTINF(EVENTINF_HORSES_0A); + CLEAR_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED); } else { - func_80B13AA0(this, func_80B16504, func_80B16854); - this->eyeIndex = 0; + EnTa_SetupAction(this, EnTa_IdleSittingInLonLonHouse, EnTa_AnimSitSleeping); + this->eyeIndex = TALON_EYE_INDEX_OPEN; Animation_PlayOnce(&this->skelAnime, &gTalonSitSleepingAnim); this->currentAnimation = &gTalonSitSleepingAnim; } } else { - func_80B13AA0(this, func_80B146F8, func_80B167FC); - this->eyeIndex = 2; + EnTa_SetupAction(this, EnTa_IdleAsleepInLonLonHouse, EnTa_AnimSleeping); + this->eyeIndex = TALON_EYE_INDEX_CLOSED; Animation_PlayOnce(&this->skelAnime, &gTalonSleepAnim); this->currentAnimation = &gTalonSleepAnim; this->actor.shape.shadowScale = 54.0f; } } } else { - func_80B13AA0(this, func_80B14634, func_80B167FC); - this->eyeIndex = 2; + EnTa_SetupAction(this, EnTa_IdleAsleepInCastle, EnTa_AnimSleeping); + this->eyeIndex = TALON_EYE_INDEX_CLOSED; Animation_PlayOnce(&this->skelAnime, &gTalonSleepAnim); this->currentAnimation = &gTalonSleepAnim; this->actor.shape.shadowScale = 54.0f; @@ -223,7 +265,7 @@ void EnTa_Init(Actor* thisx, PlayState* play2) { } } -void func_80B14248(EnTa* this) { +void EnTa_DecreaseShadowSize(EnTa* this) { if (this->actor.shape.shadowScale > 36.0f) { this->actor.shape.shadowScale -= 0.8f; } @@ -234,16 +276,17 @@ void EnTa_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); - if (this->actor.params != 1 && this->actor.params != 2 && play->sceneId == SCENE_SOUKO) { + if (this->actor.params != ENTA_IN_KAKARIKO && this->actor.params != ENTA_RETURNED_FROM_KAKARIKO && + play->sceneId == SCENE_SOUKO) { gSaveContext.timer1State = 0; } - if (this->unk_2E0 & 0x200) { + if (this->stateFlags & TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY) { func_800F5B58(); } } -s32 func_80B142F4(EnTa* this, PlayState* play, u16 textId) { +s32 EnTa_RequestTalk(EnTa* this, PlayState* play, u16 textId) { if (Actor_ProcessTalkRequest(&this->actor, play)) { return true; } @@ -252,77 +295,78 @@ s32 func_80B142F4(EnTa* this, PlayState* play, u16 textId) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; func_8002F2CC(&this->actor, play, 100.0f); } return false; } -void func_80B14398(EnTa* this, PlayState* play) { +void EnTa_SleepTalkInKakariko(EnTa* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B13AA0(this, func_80B14754, func_80B167FC); + EnTa_SetupAction(this, EnTa_IdleAsleepInKakariko, EnTa_AnimSleeping); } } -void func_80B143D4(EnTa* this, PlayState* play) { +void EnTa_SleepTalkInLonLonHouse(EnTa* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B13AA0(this, func_80B146F8, func_80B167FC); + EnTa_SetupAction(this, EnTa_IdleAsleepInLonLonHouse, EnTa_AnimSleeping); } } -void func_80B14410(EnTa* this) { +void EnTa_SetupAwake(EnTa* this) { if (!LINK_IS_ADULT) { - func_80B13AA0(this, func_80B14C18, func_80B167C0); - SET_EVENTCHKINF(EVENTCHKINF_13); + EnTa_SetupAction(this, EnTa_IdleAwakeInCastle, EnTa_AnimRepeatCurrent); + SET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_CASTLE); } else { - func_80B13AA0(this, func_80B14CAC, func_80B167C0); - SET_EVENTCHKINF(EVENTCHKINF_6A); + EnTa_SetupAction(this, EnTa_IdleAwakeInKakariko, EnTa_AnimRepeatCurrent); + SET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO); } } -void func_80B1448C(EnTa* this, PlayState* play) { +void EnTa_TalkWakingUp2(EnTa* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B14410(this); + EnTa_SetupAwake(this); } - func_80B14248(this); - this->unk_2E0 |= 0x4; + EnTa_DecreaseShadowSize(this); + this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_BLINK; } -void func_80B144D8(EnTa* this, PlayState* play) { +void EnTa_TalkWakingUp1(EnTa* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B14410(this); + EnTa_SetupAwake(this); this->blinkTimer = 1; - this->unk_2B0 = func_80B16700; + this->blinkFunc = EnTa_BlinkAdvanceState; } if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { - this->eyeIndex = 1; - func_80B13AA0(this, func_80B1448C, func_80B167C0); + // Half-open eyes once the textbox reaches its end + this->eyeIndex = TALON_EYE_INDEX_HALF; + EnTa_SetupAction(this, EnTa_TalkWakingUp2, EnTa_AnimRepeatCurrent); } - func_80B14248(this); - this->unk_2E0 |= 4; + EnTa_DecreaseShadowSize(this); + this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_BLINK; } -void func_80B14570(EnTa* this, PlayState* play) { - this->unk_2E0 |= 4; +void EnTa_WakeUp(EnTa* this, PlayState* play) { + this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_BLINK; - if (this->unk_2CC == 0) { - func_80B13AA0(this, func_80B144D8, func_80B167C0); - this->unk_2CE = 3; - this->unk_2CC = 60; + if (this->timer == 0) { + EnTa_SetupAction(this, EnTa_TalkWakingUp1, EnTa_AnimRepeatCurrent); + this->rapidBlinks = 3; + this->timer = 60; Animation_PlayOnce(&this->skelAnime, &gTalonWakeUpAnim); this->currentAnimation = &gTalonStandAnim; Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_SURPRISE); } } -void func_80B145F8(EnTa* this, PlayState* play) { +void EnTa_SleepTalkInCastle(EnTa* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B13AA0(this, func_80B14634, func_80B167FC); + EnTa_SetupAction(this, EnTa_IdleAsleepInCastle, EnTa_AnimSleeping); } } -void func_80B14634(EnTa* this, PlayState* play) { +void EnTa_IdleAsleepInCastle(EnTa* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_ProcessTalkRequest(&this->actor, play)) { @@ -331,14 +375,15 @@ void func_80B14634(EnTa* this, PlayState* play) { switch (exchangeItemId) { case EXCH_ITEM_CHICKEN: player->actor.textId = 0x702B; - func_80B13AA0(this, func_80B14570, func_80B167C0); - this->unk_2CC = 40; + EnTa_SetupAction(this, EnTa_WakeUp, EnTa_AnimRepeatCurrent); + this->timer = 40; break; + default: if (exchangeItemId != EXCH_ITEM_NONE) { player->actor.textId = 0x702A; } - func_80B13AA0(this, func_80B145F8, func_80B167FC); + EnTa_SetupAction(this, EnTa_SleepTalkInCastle, EnTa_AnimSleeping); break; } } else { @@ -347,15 +392,16 @@ void func_80B14634(EnTa* this, PlayState* play) { } } -void func_80B146F8(EnTa* this, PlayState* play) { +void EnTa_IdleAsleepInLonLonHouse(EnTa* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, play)) { - func_80B13AA0(this, func_80B143D4, func_80B167FC); + EnTa_SetupAction(this, EnTa_SleepTalkInLonLonHouse, EnTa_AnimSleeping); } + this->actor.textId = 0x204B; func_8002F2CC(&this->actor, play, 100.0f); } -void func_80B14754(EnTa* this, PlayState* play) { +void EnTa_IdleAsleepInKakariko(EnTa* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_ProcessTalkRequest(&this->actor, play)) { @@ -364,14 +410,15 @@ void func_80B14754(EnTa* this, PlayState* play) { switch (exchangeItemId) { case EXCH_ITEM_POCKET_CUCCO: player->actor.textId = 0x702B; - func_80B13AA0(this, func_80B14570, func_80B167C0); - this->unk_2CC = 40; + EnTa_SetupAction(this, EnTa_WakeUp, EnTa_AnimRepeatCurrent); + this->timer = 40; break; + default: if (exchangeItemId != EXCH_ITEM_NONE) { player->actor.textId = 0x5015; } - func_80B13AA0(this, func_80B14398, func_80B167FC); + EnTa_SetupAction(this, EnTa_SleepTalkInKakariko, EnTa_AnimSleeping); break; } } else { @@ -380,7 +427,7 @@ void func_80B14754(EnTa* this, PlayState* play) { } } -void func_80B14818(EnTa* this, PlayState* play) { +void EnTa_RunWithAccelerationAndSfx(EnTa* this, PlayState* play) { s32 framesMod12 = (s32)play->state.frames % 12; if (framesMod12 == 0 || framesMod12 == 6) { @@ -392,132 +439,137 @@ void func_80B14818(EnTa* this, PlayState* play) { Actor_MoveForward(&this->actor); } -void func_80B14898(EnTa* this, PlayState* play) { +void EnTa_RunAwayRunOutOfGate(EnTa* this, PlayState* play) { + // Spawn dust particles func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, play); + EnTa_RunWithAccelerationAndSfx(this, play); - if (this->unk_2CC == 0) { + if (this->timer == 0) { Actor_Kill(&this->actor); } } -void func_80B1490C(EnTa* this, PlayState* play) { +void EnTa_RunAwayTurnTowardsGate(EnTa* this, PlayState* play) { this->actor.world.rot.y += 0xC00; this->actor.shape.rot.y += 0xC00; - if (this->unk_2CC == 0) { - func_80B13AA0(this, func_80B14898, func_80B167C0); - this->unk_2CC = 60; + if (this->timer == 0) { + EnTa_SetupAction(this, EnTa_RunAwayRunOutOfGate, EnTa_AnimRepeatCurrent); + this->timer = 60; } } -void func_80B1496C(EnTa* this, PlayState* play) { +void EnTa_RunAwayRunWest(EnTa* this, PlayState* play) { + // Spawn dust particles func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, play); + EnTa_RunWithAccelerationAndSfx(this, play); - if (this->unk_2CC == 0) { - func_80B13AA0(this, func_80B1490C, func_80B167C0); - this->unk_2CC = 5; + if (this->timer == 0) { + EnTa_SetupAction(this, EnTa_RunAwayTurnTowardsGate, EnTa_AnimRepeatCurrent); + this->timer = 5; } } -void func_80B149F4(EnTa* this, PlayState* play) { +void EnTa_RunAwayTurnWest(EnTa* this, PlayState* play) { this->actor.world.rot.y -= 0xD00; this->actor.shape.rot.y -= 0xD00; - if (this->unk_2CC == 0) { - func_80B13AA0(this, func_80B1496C, func_80B167C0); - this->unk_2CC = 65; + if (this->timer == 0) { + EnTa_SetupAction(this, EnTa_RunAwayRunWest, EnTa_AnimRepeatCurrent); + this->timer = 65; } } -void func_80B14A54(EnTa* this, PlayState* play) { +void EnTa_RunAwayRunSouth(EnTa* this, PlayState* play) { + // Spawn dust particles func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1); - func_80B14818(this, play); - if (this->unk_2CC == 20) { + EnTa_RunWithAccelerationAndSfx(this, play); + + if (this->timer == 20) { Message_CloseTextbox(play); } - if (this->unk_2CC == 0) { - this->unk_2CC = 5; - func_80B13AA0(this, func_80B149F4, func_80B167C0); + if (this->timer == 0) { + this->timer = 5; + EnTa_SetupAction(this, EnTa_RunAwayTurnWest, EnTa_AnimRepeatCurrent); } } -void func_80B14AF4(EnTa* this, PlayState* play) { +void EnTa_RunAwayStart(EnTa* this, PlayState* play) { this->actor.world.rot.y -= 0xC00; this->actor.shape.rot.y -= 0xC00; - if (this->unk_2CC == 0) { + if (this->timer == 0) { Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_CRY_1); - func_80B13AA0(this, func_80B14A54, func_80B167C0); - this->unk_2CC = 65; + EnTa_SetupAction(this, EnTa_RunAwayRunSouth, EnTa_AnimRepeatCurrent); + this->timer = 65; this->actor.flags |= ACTOR_FLAG_4; } } -void func_80B14B6C(EnTa* this, PlayState* play) { +void EnTa_TalkAwakeInCastle(EnTa* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) { + // Start the running away cutscene OnePointCutscene_Init(play, 4175, -99, &this->actor, CAM_ID_MAIN); - func_80B13AA0(this, func_80B14AF4, func_80B167C0); - this->unk_2CC = 5; - SET_EVENTCHKINF(EVENTCHKINF_14); + EnTa_SetupAction(this, EnTa_RunAwayStart, EnTa_AnimRepeatCurrent); + this->timer = 5; + SET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE); Animation_PlayOnce(&this->skelAnime, &gTalonRunTransitionAnim); this->currentAnimation = &gTalonRunAnim; } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B14C18(EnTa* this, PlayState* play) { - if (func_80B142F4(this, play, 0x702C)) { - func_80B13AA0(this, func_80B14B6C, func_80B167C0); +void EnTa_IdleAwakeInCastle(EnTa* this, PlayState* play) { + if (EnTa_RequestTalk(this, play, 0x702C)) { + EnTa_SetupAction(this, EnTa_TalkAwakeInCastle, EnTa_AnimRepeatCurrent); } - func_80B14248(this); + EnTa_DecreaseShadowSize(this); } -void func_80B14C60(EnTa* this, PlayState* play) { +void EnTa_TalkAwakeInKakariko(EnTa* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B13AA0(this, func_80B14CAC, func_80B167C0); + EnTa_SetupAction(this, EnTa_IdleAwakeInKakariko, EnTa_AnimRepeatCurrent); } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B14CAC(EnTa* this, PlayState* play) { - if (GET_EVENTCHKINF(EVENTCHKINF_18)) { - if (func_80B142F4(this, play, 0x5017)) { - func_80B13AA0(this, func_80B14C60, func_80B167C0); - SET_EVENTCHKINF(EVENTCHKINF_6B); +void EnTa_IdleAwakeInKakariko(EnTa* this, PlayState* play) { + if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { + if (EnTa_RequestTalk(this, play, 0x5017)) { + EnTa_SetupAction(this, EnTa_TalkAwakeInKakariko, EnTa_AnimRepeatCurrent); + SET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO); } - } else if (func_80B142F4(this, play, 0x5016)) { - func_80B13AA0(this, func_80B14C60, func_80B167C0); + } else if (EnTa_RequestTalk(this, play, 0x5016)) { + EnTa_SetupAction(this, EnTa_TalkAwakeInKakariko, EnTa_AnimRepeatCurrent); } - func_80B14248(this); + EnTa_DecreaseShadowSize(this); } -void func_80B14D4C(EnTa* this, PlayState* play) { +void EnTa_TalkAtRanch(EnTa* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B13AA0(this, func_80B14D98, func_80B167C0); + EnTa_SetupAction(this, EnTa_IdleAtRanch, EnTa_AnimRepeatCurrent); } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B14D98(EnTa* this, PlayState* play) { - if (func_80B142F4(this, play, 0x2055)) { - func_80B13AA0(this, func_80B14D4C, func_80B167C0); +void EnTa_IdleAtRanch(EnTa* this, PlayState* play) { + if (EnTa_RequestTalk(this, play, 0x2055)) { + EnTa_SetupAction(this, EnTa_TalkAtRanch, EnTa_AnimRepeatCurrent); } } -s32 func_80B14DD8(void) { +s32 EnTa_CheckCanBuyMilk(void) { if (gSaveContext.rupees < 30) { - return 0; + return TALON_CANBUYMILK_NOT_ENOUGH_RUPEES; } else if (!Inventory_HasEmptyBottle()) { - return 1; + return TALON_CANBUYMILK_NO_EMPTY_BOTTLE; } else { - return 2; + return TALON_CANBUYMILK_SUCCESS; } } -void func_80B14E28(EnTa* this, PlayState* play) { +void EnTa_CreateFloorCamera(EnTa* this, PlayState* play) { Vec3f subCamEye; Vec3f subCamAt; @@ -537,89 +589,92 @@ void func_80B14E28(EnTa* this, PlayState* play) { Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); } -void func_80B14EDC(EnTa* this, PlayState* play) { +void EnTa_RemoveFloorCamera(EnTa* this, PlayState* play) { Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_ACTIVE); Play_ClearCamera(play, this->subCamId); } -void func_80B14F20(EnTa* this, EnTaActionFunc arg1) { - func_80B13AA0(this, arg1, func_80B16854); - this->eyeIndex = 2; +void EnTa_SetupActionWithSleepAnimation(EnTa* this, EnTaActionFunc actionFunc) { + EnTa_SetupAction(this, actionFunc, EnTa_AnimSitSleeping); + this->eyeIndex = TALON_EYE_INDEX_CLOSED; Animation_Change(&this->skelAnime, &gTalonSitSleepingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gTalonSitSleepingAnim), ANIMMODE_ONCE, -5.0f); - this->unk_2E2 = 0; + this->nodOffTimer = 0; this->currentAnimation = &gTalonSitSleepingAnim; } -void func_80B14FAC(EnTa* this, EnTaActionFunc arg1) { - this->eyeIndex = 1; - func_80B13AA0(this, arg1, func_80B16938); - this->unk_2E0 &= ~0x10; +void EnTa_SetupActionWithWakeUpAnimation(EnTa* this, EnTaActionFunc actionFunc) { + this->eyeIndex = TALON_EYE_INDEX_HALF; + EnTa_SetupAction(this, actionFunc, EnTa_AnimRunToEnd); + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, -5.0f); } -void func_80B15034(EnTa* this, PlayState* play) { +void EnTa_TalkNotEnoughRupees(EnTa* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - func_80B14F20(this, func_80B16504); - func_80B13AAC(this, play); + EnTa_SetupActionWithSleepAnimation(this, EnTa_IdleSittingInLonLonHouse); + EnTa_SetTextForTalkInLonLonHouse(this, play); } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -s32 func_80B150AC(EnTa* this, PlayState* play, s32 idx) { +s32 EnTa_IsPlayerHoldingSuperCucco(EnTa* this, PlayState* play, s32 cuccoIdx) { Player* player = GET_PLAYER(play); Actor* interactRangeActor; if (player->stateFlags1 & PLAYER_STATE1_11) { interactRangeActor = player->interactRangeActor; if (interactRangeActor != NULL && interactRangeActor->id == ACTOR_EN_NIW && - interactRangeActor == &this->superCuccos[idx]->actor) { + interactRangeActor == &this->superCuccos[cuccoIdx]->actor) { return true; } } return false; } -void func_80B15100(EnTa* this, PlayState* play) { +void EnTa_TalkFoundSuperCucco(EnTa* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - s32 unk_2CA; + s32 lastFoundSuperCuccoIdx; Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f); - this->unk_2E0 &= ~0x10; + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; Message_CloseTextbox(play); - unk_2CA = this->unk_2CA; - this->actionFunc = func_80B154FC; - this->superCuccos[unk_2CA]->actor.gravity = 0.1f; - this->superCuccos[unk_2CA]->actor.velocity.y = 0.0f; - this->superCuccos[unk_2CA]->actor.speedXZ = 0.0f; - this->superCuccos[unk_2CA]->actor.parent = NULL; + lastFoundSuperCuccoIdx = this->lastFoundSuperCuccoIdx; + this->actionFunc = EnTa_RunCuccoGame; - if (player->interactRangeActor == &this->superCuccos[unk_2CA]->actor) { + // Make the found cucco fly directly upwards and then forget about it + this->superCuccos[lastFoundSuperCuccoIdx]->actor.gravity = 0.1f; + this->superCuccos[lastFoundSuperCuccoIdx]->actor.velocity.y = 0.0f; + this->superCuccos[lastFoundSuperCuccoIdx]->actor.speedXZ = 0.0f; + this->superCuccos[lastFoundSuperCuccoIdx]->actor.parent = NULL; + + if (player->interactRangeActor == &this->superCuccos[lastFoundSuperCuccoIdx]->actor) { player->interactRangeActor = NULL; } - if (player->heldActor == &this->superCuccos[unk_2CA]->actor) { + if (player->heldActor == &this->superCuccos[lastFoundSuperCuccoIdx]->actor) { player->heldActor = NULL; } player->stateFlags1 &= ~PLAYER_STATE1_11; - this->superCuccos[unk_2CA] = NULL; + this->superCuccos[lastFoundSuperCuccoIdx] = NULL; } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B15260(EnTa* this, PlayState* play) { +void EnTa_IdleFoundSuperCucco(EnTa* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, play)) { - this->actionFunc = func_80B15100; + this->actionFunc = EnTa_TalkFoundSuperCucco; + // Unset auto-talking this->actor.flags &= ~ACTOR_FLAG_16; } else { func_8002F2CC(&this->actor, play, 1000.0f); } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } s32 EnTa_GetSuperCuccosCount(EnTa* this, PlayState* play) { @@ -634,37 +689,37 @@ s32 EnTa_GetSuperCuccosCount(EnTa* this, PlayState* play) { return count; } -void func_80B15308(EnTa* this) { - if (this->unk_2E0 & 0x10) { - if (this->unk_2E0 & 0x100) { +void EnTa_AnimateHandsUpDown(EnTa* this) { + if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) { + if (this->stateFlags & TALON_STATE_FLAG_RAISING_HANDS) { Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 17.0f, 22.0f, ANIMMODE_ONCE, 0.0f); - this->unk_2E0 &= ~0x100; + this->stateFlags &= ~TALON_STATE_FLAG_RAISING_HANDS; } else { Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, -1.0f, 21.0f, 16.0f, ANIMMODE_ONCE, 3.0f); - this->unk_2E0 |= 0x100; + this->stateFlags |= TALON_STATE_FLAG_RAISING_HANDS; } - this->unk_2E0 &= ~0x10; + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; } } -void func_80B153D4(EnTa* this, PlayState* play) { - func_80B15308(this); +void EnTa_TransitionToPostCuccoGame(EnTa* this, PlayState* play) { + EnTa_AnimateHandsUpDown(this); - if (this->unk_2CC == 0) { - if (this->unk_2E0 & 0x80) { - this->unk_2E0 &= ~0x80; - func_80B14EDC(this, play); + if (this->timer == 0) { + if (this->stateFlags & TALON_STATE_FLAG_FLOOR_CAMERA_ACTIVE) { + this->stateFlags &= ~TALON_STATE_FLAG_FLOOR_CAMERA_ACTIVE; + EnTa_RemoveFloorCamera(this, play); } } } -void func_80B15424(EnTa* this, PlayState* play) { - func_80B15308(this); +void EnTa_TalkCuccoGameEnd(EnTa* this, PlayState* play) { + EnTa_AnimateHandsUpDown(this); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { play->nextEntranceIndex = ENTR_SOUKO_2; - if (GET_EVENTINF(EVENTINF_HORSES_08)) { + if (GET_EVENTINF(EVENTINF_CUCCO_GAME_WON)) { play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; } else { @@ -673,13 +728,13 @@ void func_80B15424(EnTa* this, PlayState* play) { } play->transitionTrigger = TRANS_TRIGGER_START; - SET_EVENTINF(EVENTINF_HORSES_0A); - this->actionFunc = func_80B153D4; - this->unk_2CC = 22; + SET_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED); + this->actionFunc = EnTa_TransitionToPostCuccoGame; + this->timer = 22; } } -void func_80B154FC(EnTa* this, PlayState* play) { +void EnTa_RunCuccoGame(EnTa* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(this->superCuccos); i++) { @@ -688,46 +743,55 @@ void func_80B154FC(EnTa* this, PlayState* play) { this->superCuccos[i]->actor.gravity -= 0.03f; } - if (func_80B150AC(this, play, i)) { - if (this->unk_2C4[i] > 0) { - this->unk_2C4[i]--; + if (EnTa_IsPlayerHoldingSuperCucco(this, play, i)) { + if (this->superCuccoTimers[i] > 0) { + // Wait until the cucco's timer runs out after + // acknowledging that the player picked it up. + this->superCuccoTimers[i]--; } else { - this->unk_2CA = i; + this->lastFoundSuperCuccoIdx = i; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); - this->unk_2E0 &= ~0x10; + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; switch (EnTa_GetSuperCuccosCount(this, play)) { case 1: + // Last cucco found, end the game gSaveContext.timer1State = 0; func_8002DF54(play, &this->actor, 1); Message_StartTextbox(play, 0x2084, &this->actor); - this->actionFunc = func_80B15424; + this->actionFunc = EnTa_TalkCuccoGameEnd; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); - this->unk_2E0 &= ~0x10; - this->unk_2E0 &= ~0x100; - SET_EVENTINF(EVENTINF_HORSES_08); + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; + this->stateFlags &= ~TALON_STATE_FLAG_RAISING_HANDS; + SET_EVENTINF(EVENTINF_CUCCO_GAME_WON); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); - this->unk_2E0 &= ~0x200; + this->stateFlags &= ~TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY; Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); return; + case 2: + // One cucco remaining this->actor.textId = 0x2083; Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_CRY_1); break; + case 3: + // Two cuccos remaining this->actor.textId = 0x2082; Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_SURPRISE); break; } - this->actionFunc = func_80B15260; + this->actionFunc = EnTa_IdleFoundSuperCucco; + + // Automatically talk to player this->actor.flags |= ACTOR_FLAG_16; func_8002F2CC(&this->actor, play, 1000.0f); return; } } else { - this->unk_2C4[i] = 7; + this->superCuccoTimers[i] = 7; } } } @@ -738,47 +802,57 @@ void func_80B154FC(EnTa* this, PlayState* play) { if (gSaveContext.timer1Value == 0 && !Play_InCsMode(play)) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); - this->unk_2E0 &= ~0x200; + this->stateFlags &= ~TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY; func_80078884(NA_SE_SY_FOUND); gSaveContext.timer1State = 0; func_8002DF54(play, &this->actor, 1); + + // Time's up text Message_StartTextbox(play, 0x2081, &this->actor); - this->actionFunc = func_80B15424; - func_80B14E28(this, play); - CLEAR_EVENTINF(EVENTINF_HORSES_08); - this->unk_2E0 |= 0x80; + this->actionFunc = EnTa_TalkCuccoGameEnd; + EnTa_CreateFloorCamera(this, play); + CLEAR_EVENTINF(EVENTINF_CUCCO_GAME_WON); + this->stateFlags |= TALON_STATE_FLAG_FLOOR_CAMERA_ACTIVE; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); - this->unk_2E0 &= ~0x10; - this->unk_2E0 &= ~0x100; + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; + this->stateFlags &= ~TALON_STATE_FLAG_RAISING_HANDS; } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B1585C(EnTa* this, PlayState* play) { +void EnTa_ThrowSuperCuccos(EnTa* this, PlayState* play) { s32 i; - if (this->unk_2CC > 35) { + if (this->timer > 35) { + // During the first part of the throw animation, + // just turn them (on the table or the floor) for (i = 1; i < ARRAY_COUNT(this->superCuccos); i++) { if (this->superCuccos[i] != NULL) { Math_SmoothStepToS(&this->superCuccos[i]->actor.world.rot.y, i * -10000 - 3000, 2, 0x800, 0x100); this->superCuccos[i]->actor.shape.rot.y = this->superCuccos[i]->actor.world.rot.y; } } - } else if (this->unk_2CC == 35) { + } else if (this->timer == 35) { + // At this point, prepare each super cucco for flight for (i = 0; i < ARRAY_COUNT(this->superCuccos); i++) { - this->unk_2C4[i] = (s32)(Rand_CenteredFloat(6.0f) + 10.0f); + // Set a 7-12 frame zero-gravity time for each super cucco + this->superCuccoTimers[i] = (s32)(Rand_CenteredFloat(6.0f) + 10.0f); if (this->superCuccos[i] != NULL) { EnNiw* niw = this->superCuccos[i]; + // Mark the cucco as a super cucco, this will cause the cucco + // to set random xz and y velocities niw->unk_308 = 1; niw->actor.gravity = 0.0f; } } } else { for (i = 0; i < ARRAY_COUNT(this->superCuccos); i++) { - if (this->unk_2CC < 35 - this->unk_2C4[i]) { + // If the zero-gravity time of the cucco is over, + // add gravity to it + if (this->timer < 35 - this->superCuccoTimers[i]) { if (this->superCuccos[i] != NULL) { if (this->superCuccos[i]->actor.gravity > -2.0f) { this->superCuccos[i]->actor.gravity -= 0.03f; @@ -788,9 +862,9 @@ void func_80B1585C(EnTa* this, PlayState* play) { } } - if (this->unk_2CC == 0) { - func_80B13AA0(this, func_80B154FC, func_80B16938); - this->unk_2E0 &= ~0x10; + if (this->timer == 0) { + EnTa_SetupAction(this, EnTa_RunCuccoGame, EnTa_AnimRunToEnd); + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f); @@ -798,138 +872,145 @@ void func_80B1585C(EnTa* this, PlayState* play) { } } -void func_80B15AD4(EnTa* this, PlayState* play) { - if (this->unk_2CC == 0 && this->unk_2E0 & 0x20) { - func_80B13AA0(this, func_80B1585C, func_80B16938); - this->unk_2E0 &= ~0x10; +void EnTa_StartingCuccoGame3(EnTa* this, PlayState* play) { + if (this->timer == 0 && this->stateFlags & TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED) { + EnTa_SetupAction(this, EnTa_ThrowSuperCuccos, EnTa_AnimRunToEnd); + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; + // Play hand raise animation again so that it looks like Talon throws the cuccos Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 1.0f, Animation_GetLastFrame(&gTalonSitHandsUpAnim), ANIMMODE_ONCE, 0.0f); - this->unk_2CC = 50; - func_80088B34(0x1E); + this->timer = 50; + + func_80088B34(30); func_800F5ACC(NA_BGM_TIMED_MINI_GAME); - this->unk_2E0 |= 0x200; + this->stateFlags |= TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY; Message_CloseTextbox(play); func_8002DF54(play, &this->actor, 1); } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - this->unk_2E0 |= 0x20; + this->stateFlags |= TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED; } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B15BF8(EnTa* this, PlayState* play) { - if (this->unk_2E0 & 0x10) { - func_80B13AA0(this, func_80B15AD4, func_80B16938); - this->unk_2E0 &= ~0x10; +void EnTa_StartingCuccoGame2(EnTa* this, PlayState* play) { + if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) { + EnTa_SetupAction(this, EnTa_StartingCuccoGame3, EnTa_AnimRunToEnd); + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 0.0f, 1.0f, ANIMMODE_ONCE, 0.0f); - this->unk_2CC = 5; + this->timer = 5; } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - this->unk_2E0 |= 0x20; + this->stateFlags |= TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED; } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B15CC8(EnTa* this, PlayState* play) { - if (this->unk_2E0 & 0x10) { - func_80B13AA0(this, func_80B15BF8, func_80B16938); - this->unk_2E0 &= ~0x10; +void EnTa_StartingCuccoGame1(EnTa* this, PlayState* play) { + if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) { + EnTa_SetupAction(this, EnTa_StartingCuccoGame2, EnTa_AnimRunToEnd); + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, -1.0f, 29.0f, 0.0f, ANIMMODE_ONCE, 10.0f); } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - this->unk_2E0 |= 0x20; + this->stateFlags |= TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED; } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B15D90(EnTa* this, PlayState* play) { - func_80B13AA0(this, func_80B15CC8, func_80B16938); - this->unk_2E0 &= ~0x10; +void EnTa_StartCuccoGame(EnTa* this, PlayState* play) { + EnTa_SetupAction(this, EnTa_StartingCuccoGame1, EnTa_AnimRunToEnd); + this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED; Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f); Message_ContinueTextbox(play, 0x2080); - this->unk_2E0 &= ~0x20; + this->stateFlags &= ~TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED; } -void func_80B15E28(EnTa* this, PlayState* play) { +void EnTa_TalkGeneralInLonLonHouse(EnTa* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B14F20(this, func_80B16504); - func_80B13AAC(this, play); + EnTa_SetupActionWithSleepAnimation(this, EnTa_IdleSittingInLonLonHouse); + EnTa_SetTextForTalkInLonLonHouse(this, play); } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B15E80(EnTa* this, PlayState* play) { +void EnTa_GiveItemInLonLonHouse(EnTa* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->actionFunc = func_80B15E28; - if (!(this->unk_2E0 & 0x2)) { - SET_ITEMGETINF(ITEMGETINF_02); + this->actionFunc = EnTa_TalkGeneralInLonLonHouse; + if (!(this->stateFlags & TALON_STATE_FLAG_GIVING_MILK_REFILL)) { + SET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE); } - this->unk_2E0 &= ~0x2; - } else if (this->unk_2E0 & 2) { + this->stateFlags &= ~TALON_STATE_FLAG_GIVING_MILK_REFILL; + } else if (this->stateFlags & TALON_STATE_FLAG_GIVING_MILK_REFILL) { func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); } else { func_8002F434(&this->actor, play, GI_MILK_BOTTLE, 10000.0f, 50.0f); } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B15F54(EnTa* this, PlayState* play) { +void EnTa_TalkAfterCuccoGameFirstWon(EnTa* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->unk_2E0 &= ~0x2; - func_80B13AA0(this, func_80B15E80, func_80B16938); + this->stateFlags &= ~TALON_STATE_FLAG_GIVING_MILK_REFILL; + EnTa_SetupAction(this, EnTa_GiveItemInLonLonHouse, EnTa_AnimRunToEnd); func_8002F434(&this->actor, play, GI_MILK_BOTTLE, 10000.0f, 50.0f); } } -void func_80B15FE8(EnTa* this, PlayState* play) { +void EnTa_WaitBuyMilkOrPlayCuccoGameResponse(EnTa* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { - case 0: - switch (func_80B14DD8()) { - case 0: + case 0: // Buy milk + switch (EnTa_CheckCanBuyMilk()) { + case TALON_CANBUYMILK_NOT_ENOUGH_RUPEES: Message_ContinueTextbox(play, 0x85); - func_80B13AA0(this, func_80B15034, func_80B16938); + EnTa_SetupAction(this, EnTa_TalkNotEnoughRupees, EnTa_AnimRunToEnd); break; - case 1: + + case TALON_CANBUYMILK_NO_EMPTY_BOTTLE: Message_ContinueTextbox(play, 0x208A); - func_80B13AA0(this, func_80B15E28, func_80B16938); + EnTa_SetupAction(this, EnTa_TalkGeneralInLonLonHouse, EnTa_AnimRunToEnd); break; - case 2: - this->unk_2E0 |= 2; - func_80B13AA0(this, func_80B15E80, func_80B16938); + + case TALON_CANBUYMILK_SUCCESS: + this->stateFlags |= TALON_STATE_FLAG_GIVING_MILK_REFILL; + EnTa_SetupAction(this, EnTa_GiveItemInLonLonHouse, EnTa_AnimRunToEnd); Rupees_ChangeBy(-30); func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); break; } break; - case 1: + + case 1: // Play cucco game if (gSaveContext.rupees < 10) { Message_ContinueTextbox(play, 0x85); - func_80B13AA0(this, func_80B15034, func_80B16938); + EnTa_SetupAction(this, EnTa_TalkNotEnoughRupees, EnTa_AnimRunToEnd); } else { Rupees_ChangeBy(-10); - func_80B15D90(this, play); + EnTa_StartCuccoGame(this, play); } break; - case 2: - func_80B14F20(this, func_80B16504); - func_80B13AAC(this, play); + + case 2: // Cancel + EnTa_SetupActionWithSleepAnimation(this, EnTa_IdleSittingInLonLonHouse); + EnTa_SetTextForTalkInLonLonHouse(this, play); break; } } - if (this->unk_2E0 & 0x10) { - this->unk_2E0 |= 1; + if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) { + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } } -void func_80B161C0(EnTa* this, PlayState* play) { +void EnTa_WaitForPlayCuccoGameResponse(EnTa* this, PlayState* play) { s32 price; + // Check if this is a retry if (this->actor.textId == 0x2085) { price = 5; } else { @@ -941,107 +1022,114 @@ void func_80B161C0(EnTa* this, PlayState* play) { case 0: if (gSaveContext.rupees < price) { Message_ContinueTextbox(play, 0x85); - func_80B13AA0(this, func_80B15034, func_80B16938); + EnTa_SetupAction(this, EnTa_TalkNotEnoughRupees, EnTa_AnimRunToEnd); } else { Rupees_ChangeBy(-price); - func_80B15D90(this, play); + EnTa_StartCuccoGame(this, play); } break; + case 1: - func_80B14F20(this, func_80B16504); - func_80B13AAC(this, play); + EnTa_SetupActionWithSleepAnimation(this, EnTa_IdleSittingInLonLonHouse); + EnTa_SetTextForTalkInLonLonHouse(this, play); break; } } - if (this->unk_2E0 & 0x10) { - this->unk_2E0 |= 1; + if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) { + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } } -void func_80B162E8(EnTa* this, PlayState* play) { +void EnTa_WaitForMarryMalonResponse(EnTa* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { Message_ContinueTextbox(play, 0x2087); - func_80B13AA0(this, func_80B15F54, func_80B16938); + EnTa_SetupAction(this, EnTa_TalkAfterCuccoGameFirstWon, EnTa_AnimRunToEnd); } - if (this->unk_2E0 & 0x10) { - this->unk_2E0 |= 1; + if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) { + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } } -void func_80B16364(EnTa* this, PlayState* play) { +void EnTa_ContinueTalkInLonLonHouse(EnTa* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - SET_INFTABLE(INFTABLE_7E); - if (GET_ITEMGETINF(ITEMGETINF_02)) { + SET_INFTABLE(INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE); + if (GET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE)) { + // Play cucco game or buy milk Message_ContinueTextbox(play, 0x208B); - func_80B13AA0(this, func_80B15FE8, func_80B16938); + EnTa_SetupAction(this, EnTa_WaitBuyMilkOrPlayCuccoGameResponse, EnTa_AnimRunToEnd); } else { + // Play cucco game? Message_ContinueTextbox(play, 0x207F); - func_80B13AA0(this, func_80B161C0, func_80B16938); + EnTa_SetupAction(this, EnTa_WaitForPlayCuccoGameResponse, EnTa_AnimRunToEnd); } } - if (this->unk_2E0 & 0x10) { - this->unk_2E0 |= 1; + if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) { + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } } -void func_80B1642C(EnTa* this, PlayState* play) { +void EnTa_TalkAfterCuccoGameWon(EnTa* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { Message_CloseTextbox(play); - this->unk_2E0 |= 2; - func_80B13AA0(this, func_80B15E80, func_80B16938); + this->stateFlags |= TALON_STATE_FLAG_GIVING_MILK_REFILL; + EnTa_SetupAction(this, EnTa_GiveItemInLonLonHouse, EnTa_AnimRunToEnd); func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f); } else { Message_ContinueTextbox(play, 0x208A); - func_80B13AA0(this, func_80B15E28, func_80B16938); + EnTa_SetupAction(this, EnTa_TalkGeneralInLonLonHouse, EnTa_AnimRunToEnd); } } } -void func_80B16504(EnTa* this, PlayState* play) { - u16 faceReaction = Text_GetFaceReaction(play, 0x18); +void EnTa_IdleSittingInLonLonHouse(EnTa* this, PlayState* play) { + u16 faceReaction = Text_GetFaceReaction(play, TALON_FACE_REACTION_SET); - func_80B13AAC(this, play); + EnTa_SetTextForTalkInLonLonHouse(this, play); - if (func_80B142F4(this, play, this->actor.textId)) { + if (EnTa_RequestTalk(this, play, this->actor.textId)) { Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_SURPRISE); if (faceReaction != 0) { - func_80B14FAC(this, func_80B15E28); + EnTa_SetupActionWithWakeUpAnimation(this, EnTa_TalkGeneralInLonLonHouse); } else { - SET_INFTABLE(INFTABLE_7E); + SET_INFTABLE(INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE); switch (this->actor.textId) { - case 0x207E: - case 0x207F: - func_80B14FAC(this, func_80B161C0); + case 0x207E: // First time talking in Lon Lon House + case 0x207F: // Play cucco game + EnTa_SetupActionWithWakeUpAnimation(this, EnTa_WaitForPlayCuccoGameResponse); break; - case 0x208B: - func_80B14FAC(this, func_80B15FE8); + + case 0x208B: // Play cucco game or buy milk + EnTa_SetupActionWithWakeUpAnimation(this, EnTa_WaitBuyMilkOrPlayCuccoGameResponse); break; + default: - func_80B14FAC(this, func_80B16364); + EnTa_SetupActionWithWakeUpAnimation(this, EnTa_ContinueTalkInLonLonHouse); break; } } } - this->unk_2E0 &= ~1; + this->stateFlags &= ~TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B16608(EnTa* this, PlayState* play) { +void EnTa_IdleAfterCuccoGameFinished(EnTa* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, play)) { switch (this->actor.textId) { - case 0x2085: - this->actionFunc = func_80B161C0; + case 0x2085: // Retry? + this->actionFunc = EnTa_WaitForPlayCuccoGameResponse; break; - case 0x2086: - this->actionFunc = func_80B162E8; + + case 0x2086: // Initial win + this->actionFunc = EnTa_WaitForMarryMalonResponse; break; - case 0x2088: - this->actionFunc = func_80B1642C; + + case 0x2088: // Later win + this->actionFunc = EnTa_TalkAfterCuccoGameWon; break; } this->actor.flags &= ~ACTOR_FLAG_16; @@ -1049,38 +1137,41 @@ void func_80B16608(EnTa* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_16; func_8002F2CC(&this->actor, play, 1000.0f); } - this->unk_2E0 |= 1; + this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER; } -void func_80B166CC(EnTa* this) { - s16 temp_v0 = this->blinkTimer - 1; - - if (temp_v0 != 0) { - this->blinkTimer = temp_v0; - } else { - this->unk_2B0 = func_80B16700; - } -} - -void func_80B16700(EnTa* this) { +void EnTa_BlinkWaitUntilNext(EnTa* this) { s16 blinkTimer = this->blinkTimer - 1; if (blinkTimer != 0) { this->blinkTimer = blinkTimer; } else { - s16 nextEyeIndex = this->eyeIndex + 1; - s16 blinkTimer = 3; + this->blinkFunc = EnTa_BlinkAdvanceState; + } +} - if (nextEyeIndex >= blinkTimer) { - this->eyeIndex = 0; - if (this->unk_2CE > 0) { - this->unk_2CE--; +void EnTa_BlinkAdvanceState(EnTa* this) { + s16 blinkTimer = this->blinkTimer - 1; + + if (blinkTimer != 0) { + this->blinkTimer = blinkTimer; + } else { + // Next towards closed eyes: open -> half, half -> closed + s16 nextEyeIndex = this->eyeIndex + 1; + + // If the eyes were already closed, set the eyes open and set a new blink timer. + // If just woken up (rapidBlinks > 0), blink a few times + // in quick succession before starting the normal blink cycle. + if (nextEyeIndex >= TALON_EYE_INDEX_MAX) { + this->eyeIndex = TALON_EYE_INDEX_OPEN; + if (this->rapidBlinks > 0) { + this->rapidBlinks--; blinkTimer = 1; } else { blinkTimer = (s32)(Rand_ZeroOne() * 60.0f) + 20; } this->blinkTimer = blinkTimer; - this->unk_2B0 = func_80B166CC; + this->blinkFunc = EnTa_BlinkWaitUntilNext; } else { this->eyeIndex = nextEyeIndex; this->blinkTimer = 1; @@ -1088,45 +1179,50 @@ void func_80B16700(EnTa* this) { } } -void func_80B167C0(EnTa* this) { +void EnTa_AnimRepeatCurrent(EnTa* this) { if (SkelAnime_Update(&this->skelAnime)) { Animation_PlayOnce(&this->skelAnime, this->currentAnimation); } } -void func_80B167FC(EnTa* this) { +void EnTa_AnimSleeping(EnTa* this) { if (SkelAnime_Update(&this->skelAnime)) { Animation_PlayOnce(&this->skelAnime, this->currentAnimation); Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_SLEEP); } - this->unk_2E0 |= 0xC; + this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM | TALON_STATE_FLAG_SUPPRESS_BLINK; } -void func_80B16854(EnTa* this) { - if (this->unk_2E2 > 0) { - this->unk_2E2--; +void EnTa_AnimSitSleeping(EnTa* this) { + if (this->nodOffTimer > 0) { + // Pause the sleep animation until the nodding timer is at zero. + // The torso and arms will still do the rocking movement because of EnTa_OverrideLimbDraw + this->nodOffTimer--; } else { if (SkelAnime_Update(&this->skelAnime)) { Animation_PlayOnce(&this->skelAnime, this->currentAnimation); - this->unk_2E2 = Rand_ZeroFloat(100.0f) + 100.0f; + this->nodOffTimer = Rand_ZeroFloat(100.0f) + 100.0f; } if (this->skelAnime.curFrame < 96.0f && this->skelAnime.curFrame >= 53.0f) { - this->eyeIndex = 1; + // Half-open eyes during the part of the sleeping animation where Talon + // raises his head after nodding off + this->eyeIndex = TALON_EYE_INDEX_HALF; } else { - this->eyeIndex = 2; + // Otherwise keep the eyes closed + this->eyeIndex = TALON_EYE_INDEX_CLOSED; } - this->unk_2E0 |= 8; + this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM; } - this->unk_2E0 |= 4; + this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_BLINK; } -void func_80B16938(EnTa* this) { - if (!(this->unk_2E0 & 0x10)) { +void EnTa_AnimRunToEnd(EnTa* this) { + if (!(this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED)) { if (SkelAnime_Update(&this->skelAnime)) { - this->unk_2E0 |= 0x10; + this->stateFlags |= TALON_STATE_FLAG_ANIMATION_FINISHED; } - this->unk_2E0 |= 8; + this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM; } } @@ -1138,46 +1234,56 @@ void EnTa_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveForward(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->unk_260(this); + this->animFunc(this); this->actionFunc(this, play); - if (!(this->unk_2E0 & 4)) { - this->unk_2B0(this); + if (!(this->stateFlags & TALON_STATE_FLAG_SUPPRESS_BLINK)) { + this->blinkFunc(this); } - if (this->unk_2E0 & 1) { - Actor_TrackPlayer(play, &this->actor, &this->unk_2D4, &this->unk_2DA, this->actor.focus.pos); + if (this->stateFlags & TALON_STATE_FLAG_TRACKING_PLAYER) { + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->unk_2D4.x, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->unk_2D4.y, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->unk_2DA.x, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->unk_2DA.y, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->torsoRot.x, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->torsoRot.y, 0, 6, 6200, 100); } - this->unk_2E0 &= ~0x5; + this->stateFlags &= ~(TALON_STATE_FLAG_TRACKING_PLAYER | TALON_STATE_FLAG_SUPPRESS_BLINK); - if (this->unk_2CC > 0) { - this->unk_2CC--; + if (this->timer > 0) { + this->timer--; } } s32 EnTa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTa* this = (EnTa*)thisx; + // Turn head and chest towards the target (the rotation steps are calculated in EnTa_Update) switch (limbIndex) { - case 8: - rot->x += this->unk_2DA.y; - rot->y -= this->unk_2DA.x; + case ENTA_LIMB_CHEST: + rot->x += this->torsoRot.y; + rot->y -= this->torsoRot.x; break; - case 15: - rot->x += this->unk_2D4.y; - rot->z += this->unk_2D4.x; + + case ENTA_LIMB_HEAD: + rot->x += this->headRot.y; + rot->z += this->headRot.x; break; } - if (this->unk_2E0 & 0x8) { - this->unk_2E0 &= ~0x8; - } else if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { + // Rocking/wobbling animation for the torso and arms + if (this->stateFlags & TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM) { + // TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM might have been supposed to prevent + // the rocking in some situations, (e.g. while sleeping). + // But because this function is run first for the root limb (limbIndex 1), + // and the flag is immediately unset, all subsequent calls end up + // in the else if branch below and rocking always occurs. + // So this flag has no effect. + this->stateFlags &= ~TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM; + } else if ((limbIndex == ENTA_LIMB_CHEST) || (limbIndex == ENTA_LIMB_LEFT_ARM) || + (limbIndex == ENTA_LIMB_RIGHT_ARM)) { s32 limbIdx50 = limbIndex * 50; rot->y += Math_SinS(play->state.frames * (limbIdx50 + 0x814)) * 200.0f; @@ -1188,15 +1294,11 @@ s32 EnTa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po } void EnTa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - static Vec3f D_80B16E7C = { - 1100.0f, - 1000.0f, - 0.0f, - }; + static Vec3f headOffset = { 1100.0f, 1000.0f, 0.0f }; EnTa* this = (EnTa*)thisx; - if (limbIndex == 15) { - Matrix_MultVec3f(&D_80B16E7C, &this->actor.focus.pos); + if (limbIndex == ENTA_LIMB_HEAD) { + Matrix_MultVec3f(&headOffset, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.h b/src/overlays/actors/ovl_En_Ta/z_en_ta.h index ebb3823b5a..d5bd5c49a3 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.h +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.h @@ -9,31 +9,60 @@ struct EnTa; typedef void (*EnTaActionFunc)(struct EnTa*, PlayState*); -typedef void (*EnTaUnkFunc)(struct EnTa*); +typedef void (*EnTaBlinkFunc)(struct EnTa*); +typedef void (*EnTaAnimFunc)(struct EnTa*); + +typedef enum { + /* 0xFFFF */ ENTA_CHILD_ERA = -1, + /* 0x0001 */ ENTA_IN_KAKARIKO = 1, + /* 0x0002 */ ENTA_RETURNED_FROM_KAKARIKO + } EnTaType; + +typedef enum { + /* 0x00 */ ENTA_LIMB_NONE, + /* 0x01 */ ENTA_LIMB_ROOT, + /* 0x02 */ ENTA_LIMB_LEFT_THIGH, + /* 0x03 */ ENTA_LIMB_LEFT_LEG, + /* 0x04 */ ENTA_LIMB_LEFT_FOOT, + /* 0x05 */ ENTA_LIMB_RIGHT_THIGH, + /* 0x06 */ ENTA_LIMB_RIGHT_LEG, + /* 0x07 */ ENTA_LIMB_RIGHT_FOOT, + /* 0x08 */ ENTA_LIMB_CHEST, + /* 0x09 */ ENTA_LIMB_LEFT_SHOULDER, + /* 0x0A */ ENTA_LIMB_LEFT_ARM, + /* 0x0B */ ENTA_LIMB_LEFT_HAND, + /* 0x0C */ ENTA_LIMB_RIGHT_SHOULDER, + /* 0x0D */ ENTA_LIMB_RIGHT_ARM, + /* 0x0E */ ENTA_LIMB_RIGHT_HAND, + /* 0x0F */ ENTA_LIMB_HEAD, + /* 0x10 */ ENTA_LIMB_TORSO, + /* 0x11 */ ENTA_LIMB_MAX +} EnTaLimb; typedef struct EnTa { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[17]; - /* 0x01F6 */ Vec3s morphTable[17]; + /* 0x0190 */ Vec3s jointTable[ENTA_LIMB_MAX]; + /* 0x01F6 */ Vec3s morphTable[ENTA_LIMB_MAX]; /* 0x025C */ EnTaActionFunc actionFunc; - /* 0x0260 */ EnTaUnkFunc unk_260; + /* 0x0260 */ EnTaAnimFunc animFunc; /* 0x0264 */ ColliderCylinder collider; - /* 0x02B0 */ EnTaUnkFunc unk_2B0; + /* 0x02B0 */ EnTaBlinkFunc blinkFunc; /* 0x02B4 */ s16 eyeIndex; /* 0x02B6 */ s16 blinkTimer; /* 0x02B8 */ EnNiw* superCuccos[3]; - /* 0x02C4 */ s16 unk_2C4[3]; - /* 0x02CA */ u8 unk_2CA; - /* 0x02CC */ s16 unk_2CC; - /* 0x02CE */ s16 unk_2CE; + /* 0x02C4 */ s16 superCuccoTimers[3]; // This is used to time animations and actions for super-cuccos + /* 0x02CA */ u8 lastFoundSuperCuccoIdx; + /* 0x02CC */ s16 timer; + /* 0x02CE */ s16 rapidBlinks; /* 0x02D0 */ s16 subCamId; /* 0x02D2 */ s16 returnToCamId; - /* 0x02D4 */ Vec3s unk_2D4; - /* 0x02DA */ Vec3s unk_2DA; - /* 0x02E0 */ u16 unk_2E0; - /* 0x02E2 */ s16 unk_2E2; + /* 0x02D4 */ Vec3s headRot; + /* 0x02DA */ Vec3s torsoRot; + /* 0x02E0 */ u16 stateFlags; + /* 0x02E2 */ s16 nodOffTimer; /* 0x02E4 */ AnimationHeader* currentAnimation; } EnTa; // size = 0x02E8 + #endif diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 9d03e485d2..bae3874c58 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -66,7 +66,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { osSyncPrintf("\n\n"); // "☆☆☆☆☆ Cloudy (._.) Ah Melancholy ☆☆☆☆☆" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ くもり (._.) あーあ 憂鬱 ☆☆☆☆☆ \n" VT_RST); - if (Flags_GetEventChkInf(EVENTCHKINF_18)) { + if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) { Actor_Kill(&this->actor); } EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyLonLonRanch); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 7b3c4a0d55..04dea8f5f1 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -11840,7 +11840,7 @@ void func_8084D3E4(Player* this, PlayState* play) { this->actor.parent = NULL; AREG(6) = 0; - if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) { + if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0)) { gSaveContext.horseData.pos.x = rideActor->actor.world.pos.x; gSaveContext.horseData.pos.y = rideActor->actor.world.pos.y; gSaveContext.horseData.pos.z = rideActor->actor.world.pos.z; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index cfdb53cf85..474c3a4b4a 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -2708,11 +2708,11 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->worldMapPoints[4] = 1; } - if (GET_EVENTCHKINF(EVENTCHKINF_6A)) { + if (GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { pauseCtx->worldMapPoints[4] = 2; } - if (GET_EVENTCHKINF(EVENTCHKINF_18)) { + if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { pauseCtx->worldMapPoints[4] = 1; }