From bf6bd9d0d3a90fe2f8960e034fbfd328e8bdef22 Mon Sep 17 00:00:00 2001 From: Alexis Cooper <89618924+AACooper1@users.noreply.github.com> Date: Sat, 10 Oct 2026 20:53:23 -0600 Subject: [PATCH] Document `EnToto` (#1887) * Start documenting Toto * Document EnToto_IsFacingPlayer and Unk2B6/isPlayerCancelingSoundCheck * Rename EnTotoText to EnTotoSpeakData to align with EnTest3 (Kafei) * Update gitignore * Document some HandleTalk and SetupTalk functions similar to EnTest3 * Rename D_80BA502C to sEnTotoSpeakData1 * Document TalkState setup funcs * Update gitignore, document talk state update functions (from En_Test3) * Toto talk loop animations * Update gitignore for functions.txt * Document ActionFuncs * Clean up remaining undocumented variables * Clean up comments * Run format.py and clean up result, and revert makefile changes * Add missing newline at end of z_en_toto.h * Clean up gitignore and other local stuff * gitignore again * Gitignore again again * Gitignore again again again * Restore old graphovl.py * Update include/z64save.h Co-authored-by: Anghelo Carvajal * Update src/overlays/actors/ovl_En_Toto/z_en_toto.c Co-authored-by: Anghelo Carvajal * Rename SetupAction and Action functions; fix block comments; create enum for TalkData * move enum up so it's declared before it's used lol * Change shouldCancelSoundCheck and ShouldPlaySoundCheckCompleteCutscene to bool * Run format.py even though it makes the SpeakData array less readable yay * Remove accidentally pushed files * Enum for SpeakDataIndex * SpeakDataIndex * Index into SpeakData with enums * Apply requested changes * Apply clang-format * Apply requested changes (rename SetPlayedFlags, add formsPlayed enum, fix a few missing enum replacements) * Change enum to macros * Apply more suggested changes --------- Co-authored-by: AlexisACooper1 Co-authored-by: Anghelo Carvajal --- assets/xml/objects/object_zm.xml | 26 +- include/z64cutscene.h | 2 +- include/z64save.h | 12 +- .../actors/ovl_En_Gm/scheduleScripts.schl | 2 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 14 +- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 650 +++++++++++------- src/overlays/actors/ovl_En_Toto/z_en_toto.h | 44 +- tools/disasm/n64-jp-1.1/functions.txt | 74 +- tools/disasm/n64-us/functions.txt | 74 +- tools/overlayhelpers/mscriptdis.py | 12 +- tools/weekeventregconvert.py | 12 +- 11 files changed, 536 insertions(+), 386 deletions(-) diff --git a/assets/xml/objects/object_zm.xml b/assets/xml/objects/object_zm.xml index bbfbad1d11..bd6a908e32 100644 --- a/assets/xml/objects/object_zm.xml +++ b/assets/xml/objects/object_zm.xml @@ -1,13 +1,13 @@  - - - - - - - - + + + + + + + + @@ -55,10 +55,10 @@ - - - - - + + + + + diff --git a/include/z64cutscene.h b/include/z64cutscene.h index a7e19ebf58..e83b7c3b3c 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -457,7 +457,7 @@ typedef enum { /* 0x20A */ CS_CMD_ACTOR_CUE_522, /* 0x20B */ CS_CMD_ACTOR_CUE_523, /* 0x20C */ CS_CMD_ACTOR_CUE_524, - /* 0x20D */ CS_CMD_ACTOR_CUE_525, + /* 0x20D */ CS_CMD_ACTOR_CUE_525, // Toto and Gorman interaction in Milk Bar /* 0x20E */ CS_CMD_ACTOR_CUE_526, /* 0x20F */ CS_CMD_ACTOR_CUE_527, /* 0x210 */ CS_CMD_ACTOR_CUE_528, diff --git a/include/z64save.h b/include/z64save.h index 0b06f2a8d9..c25778742c 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -1102,7 +1102,7 @@ typedef enum { #define WEEKEVENTREG_49_20 PACK_WEEKEVENTREG_FLAG(49, 0x20) #define WEEKEVENTREG_49_40 PACK_WEEKEVENTREG_FLAG(49, 0x40) #define WEEKEVENTREG_49_80 PACK_WEEKEVENTREG_FLAG(49, 0x80) -#define WEEKEVENTREG_50_01 PACK_WEEKEVENTREG_FLAG(50, 0x01) +#define WEEKEVENTREG_HELPED_GORMAN_DAY_1 PACK_WEEKEVENTREG_FLAG(50, 0x01) #define WEEKEVENTREG_50_02 PACK_WEEKEVENTREG_FLAG(50, 0x02) #define WEEKEVENTREG_50_04 PACK_WEEKEVENTREG_FLAG(50, 0x04) #define WEEKEVENTREG_PROMISED_MIDNIGHT_MEETING PACK_WEEKEVENTREG_FLAG(50, 0x08) @@ -1120,7 +1120,7 @@ typedef enum { // Set by Kafei #define WEEKEVENTREG_COUPLES_MASK_CUTSCENE_FINISHED PACK_WEEKEVENTREG_FLAG(51, 0x40) -#define WEEKEVENTREG_51_80 PACK_WEEKEVENTREG_FLAG(51, 0x80) +#define WEEKEVENTREG_HELPED_GORMAN_DAY_2 PACK_WEEKEVENTREG_FLAG(51, 0x80) // Protected Cremia #define WEEKEVENTREG_ESCORTED_CREMIA PACK_WEEKEVENTREG_FLAG(52, 0x01) @@ -1167,10 +1167,10 @@ typedef enum { #define WEEKEVENTREG_RECEIVED_MARINE_RESEARCH_LAB_FISH_HEART_PIECE PACK_WEEKEVENTREG_FLAG(56, 0x02) #define WEEKEVENTREG_56_04 PACK_WEEKEVENTREG_FLAG(56, 0x04) #define WEEKEVENTREG_56_08 PACK_WEEKEVENTREG_FLAG(56, 0x08) -#define WEEKEVENTREG_56_10 PACK_WEEKEVENTREG_FLAG(56, 0x10) -#define WEEKEVENTREG_56_20 PACK_WEEKEVENTREG_FLAG(56, 0x20) -#define WEEKEVENTREG_56_40 PACK_WEEKEVENTREG_FLAG(56, 0x40) -#define WEEKEVENTREG_56_80 PACK_WEEKEVENTREG_FLAG(56, 0x80) +#define WEEKEVENTREG_PLAYED_WIND_FISH_AS_HUMAN PACK_WEEKEVENTREG_FLAG(56, 0x10) +#define WEEKEVENTREG_PLAYED_WIND_FISH_AS_DEKU PACK_WEEKEVENTREG_FLAG(56, 0x20) +#define WEEKEVENTREG_PLAYED_WIND_FISH_AS_ZORA PACK_WEEKEVENTREG_FLAG(56, 0x40) +#define WEEKEVENTREG_PLAYED_WIND_FISH_AS_GORON PACK_WEEKEVENTREG_FLAG(56, 0x80) #define WEEKEVENTREG_57_01 PACK_WEEKEVENTREG_FLAG(57, 0x01) #define WEEKEVENTREG_57_02 PACK_WEEKEVENTREG_FLAG(57, 0x02) #define WEEKEVENTREG_57_04 PACK_WEEKEVENTREG_FLAG(57, 0x04) diff --git a/src/overlays/actors/ovl_En_Gm/scheduleScripts.schl b/src/overlays/actors/ovl_En_Gm/scheduleScripts.schl index 75ce268de7..7a0b03fa6f 100644 --- a/src/overlays/actors/ovl_En_Gm/scheduleScripts.schl +++ b/src/overlays/actors/ovl_En_Gm/scheduleScripts.schl @@ -68,7 +68,7 @@ D_80951820 { return_none } } else if_day (2) { - if_week_event_reg (WEEKEVENTREG_50_01) { + if_week_event_reg (WEEKEVENTREG_HELPED_GORMAN_DAY_1) { if_scene (SCENE_YADOYA) { if_time_range (6, 0, 18, 0) { return_time (6, 0, 18, 0, 7) diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index b421279fb3..c4f6b2371a 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -210,8 +210,8 @@ static MsgScript D_80951B98[] = { static MsgScript D_80951BE8[] = { /* 0x0000 0x03 */ MSCRIPT_CMD_CHECK_CALLBACK(0x0), - /* 0x0003 0x05 */ MSCRIPT_CMD_CHECK_WEEK_EVENT_REG(WEEKEVENTREG_50_01, 0x0039 - 0x0008), - /* 0x0008 0x05 */ MSCRIPT_CMD_CHECK_WEEK_EVENT_REG(WEEKEVENTREG_51_80, 0x0039 - 0x000D), + /* 0x0003 0x05 */ MSCRIPT_CMD_CHECK_WEEK_EVENT_REG(WEEKEVENTREG_HELPED_GORMAN_DAY_1, 0x0039 - 0x0008), + /* 0x0008 0x05 */ MSCRIPT_CMD_CHECK_WEEK_EVENT_REG(WEEKEVENTREG_HELPED_GORMAN_DAY_2, 0x0039 - 0x000D), /* 0x000D 0x05 */ MSCRIPT_CMD_CHECK_WEEK_EVENT_REG(WEEKEVENTREG_75_02, 0x001F - 0x0012), /* 0x0012 0x03 */ MSCRIPT_CMD_BEGIN_TEXT(0x2B13), /* 0x0015 0x03 */ MSCRIPT_CMD_NOTEBOOK_EVENT(BOMBERS_NOTEBOOK_EVENT_MET_GORMAN), @@ -758,8 +758,8 @@ s32 func_8094EB1C(Actor* thisx, PlayState* play) { switch (this->unk_3E0) { case 0: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) || CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80) || - CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_1) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_2) || CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { ret = true; break; } @@ -865,8 +865,8 @@ s32 func_8094EE84(EnGm* this, PlayState* play) { this->actor.child = this->unk_268; this->msgScript = EnGm_GetMsgScript(this, play); - if ((this->scheduleResult == 5) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) && - !CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { + if ((this->scheduleResult == 5) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_1) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_2) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { this->unk_3A4 |= 0x20; } else if ((this->scheduleResult != 1) && (this->scheduleResult != 5) && (this->scheduleResult != 7)) { this->unk_3A4 |= 0x20; @@ -1481,7 +1481,7 @@ s32 func_80950490(EnGm* this, PlayState* play) { }; s32 pad; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) || CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_2)) { if (this->unk_400 == 0) { this->unk_3C8 = 1; this->unk_3CA = 1; diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index d2fca6f1f6..56a5690ec6 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -8,44 +8,45 @@ #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) -#define ENTOTO_WEEK_EVENT_FLAGS (CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) || CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80)) +#define ENTOTO_HELPED_GORMAN \ + (CHECK_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_2)) void EnToto_Init(Actor* thisx, PlayState* play); void EnToto_Destroy(Actor* thisx, PlayState* play); void EnToto_Update(Actor* thisx, PlayState* play); void EnToto_Draw(Actor* thisx, PlayState* play); -void func_80BA3930(EnToto* this, PlayState* play); -void func_80BA39C8(EnToto* this, PlayState* play); -void func_80BA3DBC(EnToto* this, PlayState* play); -void func_80BA3BFC(EnToto* this, PlayState* play); -void func_80BA3CC4(EnToto* this, PlayState* play); -void func_80BA3D38(EnToto* this, PlayState* play); -s32 func_80BA3EC0(EnToto* this, PlayState* play); -s32 func_80BA3ED4(EnToto* this, PlayState* play); -s32 func_80BA3EE8(EnToto* this, PlayState* play); -s32 func_80BA3F2C(EnToto* this, PlayState* play); -s32 func_80BA3FB0(EnToto* this, PlayState* play); -s32 func_80BA3FCC(EnToto* this, PlayState* play); -s32 func_80BA402C(EnToto* this, PlayState* play); -s32 func_80BA407C(EnToto* this, PlayState* play); -s32 func_80BA40D4(EnToto* this, PlayState* play); -s32 func_80BA4128(EnToto* this, PlayState* play); -s32 func_80BA415C(EnToto* this, PlayState* play); -s32 func_80BA4204(EnToto* this, PlayState* play); -s32 func_80BA42BC(EnToto* this, PlayState* play); -s32 func_80BA43F4(EnToto* this, PlayState* play); -s32 func_80BA445C(EnToto* this, PlayState* play); -s32 func_80BA44A0(EnToto* this, PlayState* play); -s32 func_80BA4530(EnToto* this, PlayState* play); -s32 func_80BA46D8(EnToto* this, PlayState* play); -s32 func_80BA4740(EnToto* this, PlayState* play); -s32 func_80BA47E0(EnToto* this, PlayState* play); -s32 func_80BA49A4(EnToto* this, PlayState* play); -s32 func_80BA4A00(EnToto* this, PlayState* play); -s32 func_80BA4B24(EnToto* this, PlayState* play); -s32 func_80BA4C0C(EnToto* this, PlayState* play); -s32 func_80BA4C44(EnToto* this, PlayState* play); +void EnToto_SetupIdle(EnToto* this, PlayState* play); +void EnToto_Idle(EnToto* this, PlayState* play); +void EnToto_SoundCheck(EnToto* this, PlayState* play); +void EnToto_SetupTalk(EnToto* this, PlayState* play); +void EnToto_Talk(EnToto* this, PlayState* play); +void EnToto_SetupSoundCheck(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_ReturnTrue(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_ReturnFalse(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_AfterChoice(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_NextMessage(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_SetNextMessageTimer(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_Wait(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_StartAdditionalCutscene(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_StartCutscene(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_Event(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_Closing(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_Choice(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_SoundCheck_WaitAdvanceText(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_InitSoundCheck(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_SoundCheck_MovePlayerToStage(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_SoundCheck_WaitForPromptTextbox(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_StopCutsceneAndResetTimer(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_SoundCheck_WaitForPlayerToEnterSpotlight(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_InitWindFishOcarinaStaff(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_SoundCheck_UpdatePlayedFlags(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_InitWindFishPlayback(EnToto* this, PlayState* play); +s32 EnToto_SetupTalk_StartWindFishPlayback(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_SoundCheck_EndWindFishCutscene(EnToto* this, PlayState* play); +s32 EnToto_HandleTalk_SetupMayorsResidence(EnToto* this, PlayState* play); +s32 EnToto_RunTalkStateSetupFunc(EnToto* this, PlayState* play); +s32 EnToto_RunTalkStateHandlerFunc(EnToto* this, PlayState* play); ActorProfile En_Toto_Profile = { /**/ ACTOR_EN_TOTO, @@ -79,49 +80,123 @@ static ColliderCylinderInit sCylinderInit = { { 20, 60, 0, { 0, 0, 0 } }, }; -static EnTotoActionFunc D_80BA501C[] = { - func_80BA3930, - func_80BA3BFC, - func_80BA3D38, +static EnTotoActionFunc sActionSetupFuncs[] = { + /* 0 */ EnToto_SetupIdle, + /* 1 */ EnToto_SetupTalk, + /* 2 */ EnToto_SetupSoundCheck, }; static InitChainEntry sInitChain[] = { ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_1, ICHAIN_STOP), }; -static EnTotoText D_80BA502C[] = { - { 0, 0, 0x2B21 }, { 3, 2, 0 }, { 0, 0, 0x2B23 }, { 2, 1, 0x2B24 }, { 4, 0, 0x2B25 }, - { 3, 2, 0 }, { 4, 0, 0x2B25 }, { 16, 0, 0x2A94 }, { 0, 0, 0x2A95 }, { 4, 0, 0x2A96 }, - { 4, 0, 0x2A97 }, { 0, 0, 0x2A98 }, { 0, 0, 0x2A99 }, { 4, 0, 0x2A9A }, { 4, 0, 0x2A9B }, - { 0, 0, 0x2AE1 }, { 0, 0, 0x2AE2 }, { 4, 0, 0x2AE3 }, { 4, 0, 0x2AE4 }, +typedef enum EnTotoTalkActionIndex { + // 0 - 4: Milk Bar Dialog + /* 0 */ ENTOTO_TALK_EVENT, + /* 1 */ ENTOTO_TALK_CLOSING, + /* 2 */ ENTOTO_TALK_CHOICE, + /* 3 */ ENTOTO_TALK_AFTER_CHOICE, + /* 4 */ ENTOTO_TALK_NEXT_MESSAGE, // Also used for declining Sound Check request + + /* 5 - 15: Sound Check Actions */ + /* 5 */ ENTOTO_TALK_START_CUTSCENE, + /* 6 */ ENTOTO_TALK_MOVE_PLAYER_TO_STAGE, + /* 7 */ ENTOTO_TALK_SPOTLIGHT_PROMPT, + /* 8 */ ENTOTO_TALK_WAIT_PLAYER_ENTER_SPOTLIGHT, + /* 9 */ ENTOTO_TALK_WAIT_ADVANCE_TEXT, + /* 10 */ ENTOTO_TALK_START_CUTSCENE_ON_STAGE, + /* 11 */ ENTOTO_TALK_WIND_FISH_OCARINA_STAFF, + /* 12 */ ENTOTO_TALK_START_CUTSCENE_WIND_FISH, + /* 13 */ ENTOTO_TALK_WAIT_WIND_FISH_CUTSCENE, + /* 14 */ ENTOTO_TALK_WAIT_AFTER_WIND_FISH, + /* 15 */ ENTOTO_TALK_START_GORMAN_CUTSCENE, + + /* 16 - 17: Mayor's Residence Dialog */ + /* 16 */ ENTOTO_TALK_SET_UP_MAYORS_RESIDENCE, + /* 17 */ ENTOTO_TALK_RETURN_TRUE // Only in SetupFuncs +} EnTotoTalkActionIndex; + +typedef enum EnTotoSpeakDataIndex { + /* 0 */ ENTOTO_SPEAKDATA_SOUND_CHECK_REPLAY = 0, + /* 2 */ ENTOTO_SPEAKDATA_SOUND_CHECK_INTRO = 2, + /* 3 */ ENTOTO_SPEAKDATA_SOUND_CHECK_ASK_FOR_HELP = 3, + /* 6 */ ENTOTO_SPEAKDATA_SOUND_CHECK_CANCEL = 6, + /* 7 */ ENTOTO_SPEAKDATA_MAYORS_RESIDENCE_GREET_NON_DEKU = 7, + /* 13 */ ENTOTO_SPEAKDATA_WIND_FISH_PROMPT = 13, + /* 15 */ ENTOTO_SPEAKDATA_MAYORS_RESIDENCE_GREET_DEKU = 15, + /* 18 */ ENTOTO_SPEAKDATA_MAYORS_RESIDENCE_REPEAT_DEKU = 18 +} EnTotoSpeakDataIndex; + +static EnTotoSpeakData sDialogSpeakData[] = { + /* Milk Bar */ + { ENTOTO_TALK_EVENT, 0, 0x2B21 }, // After completed Sound Check + { ENTOTO_TALK_AFTER_CHOICE, 2, 0 }, + { ENTOTO_TALK_EVENT, 0, 0x2B23 }, // Ask for Sound Check (first time only) + { ENTOTO_TALK_CHOICE, 1, 0x2B24 }, // Ask for Sound Check + { ENTOTO_TALK_NEXT_MESSAGE, 0, 0x2B25 }, // Sound Check declined + { ENTOTO_TALK_AFTER_CHOICE, 2, 0 }, + { ENTOTO_TALK_NEXT_MESSAGE, 0, 0x2B25 }, // Sound Check declined + /* Mayor's Residence */ + { ENTOTO_TALK_SET_UP_MAYORS_RESIDENCE, 0, 0x2A94 }, // Greet in mayor's residence + { ENTOTO_TALK_EVENT, 0, 0x2A95 }, // Speak as Zora first time + { ENTOTO_TALK_NEXT_MESSAGE, 0, 0x2A96 }, // + { ENTOTO_TALK_NEXT_MESSAGE, 0, 0x2A97 }, // + { ENTOTO_TALK_EVENT, 0, 0x2A98 }, // Greet as human or Goron (first time) + { ENTOTO_TALK_EVENT, 0, 0x2A99 }, // + { ENTOTO_TALK_NEXT_MESSAGE, 0, 0x2A9A }, // + { ENTOTO_TALK_NEXT_MESSAGE, 0, 0x2A9B }, // Talk as human or Goron + { ENTOTO_TALK_EVENT, 0, 0x2AE1 }, // Greet as Deku (first time) + { ENTOTO_TALK_EVENT, 0, 0x2AE2 }, // + { ENTOTO_TALK_NEXT_MESSAGE, 0, 0x2AE3 }, // + { ENTOTO_TALK_NEXT_MESSAGE, 0, 0x2AE4 }, // Talk as Deku }; typedef enum EnTotoAnimation { - /* 0 */ ENTOTO_ANIM_0, - /* 1 */ ENTOTO_ANIM_1, - /* 2 */ ENTOTO_ANIM_2, - /* 3 */ ENTOTO_ANIM_3, + /* 0 */ ENTOTO_ANIM_TALK_SITTING, + /* 1 */ ENTOTO_ANIM_MOVE_CANE_BEHIND_HEAD, + /* 2 */ ENTOTO_ANIM_TAP_HEAD_WITH_CANE, + /* 3 */ ENTOTO_ANIM_MOVE_CANE_TO_FLOOR, /* 4 */ ENTOTO_ANIM_MAX } EnTotoAnimation; -static AnimationHeader* sAnimations[ENTOTO_ANIM_MAX] = { - &object_zm_Anim_0028B8, // ENTOTO_ANIM_0 - &object_zm_Anim_00B894, // ENTOTO_ANIM_1 - &object_zm_Anim_002F20, // ENTOTO_ANIM_2 - &object_zm_Anim_00BC08, // ENTOTO_ANIM_3 +static AnimationHeader* sTalkSittingAnimations[ENTOTO_ANIM_MAX] = { + &gTotoTalkSittingAnim, // ENTOTO_ANIM_TALK_SITTING + &gTotoMoveCaneBehindHeadAnim, // ENTOTO_ANIM_MOVE_CANE_BEHIND_HEAD + &gTotoTapHeadWithCaneAnim, // ENTOTO_ANIM_TAP_HEAD_WITH_CANE + &gTotoMoveCaneBackDownAnim, // ENTOTO_ANIM_MOVE_CANE_TO_FLOOR }; -static EnTotoText D_80BA5088[] = { - { 5, 0, 0 }, { 6, 20, 0 }, { 7, 0, 0 }, { 8, 9, 0 }, { 9, 10, 0 }, { 1, 0, 0 }, { 10, 0, 0 }, - { 11, 0, 0 }, { 12, 0, 0 }, { 13, 0, 0 }, { 15, 0, 0 }, { 17, 1, 0 }, { 17, 0, 0 }, { 5, 0, 0 }, - { 6, 20, 0 }, { 8, 5, 0 }, { 12, 0, 0 }, { 13, 0, 0 }, { 14, 20, 0x2B22 }, { 1, 0, 0 }, { 17, 0, 0 }, +static EnTotoSpeakData sSoundCheckSpeakData[] = { + /* Sound Check Before Completion */ + { ENTOTO_TALK_START_CUTSCENE, 0, 0 }, + { ENTOTO_TALK_MOVE_PLAYER_TO_STAGE, 20, 0 }, + { ENTOTO_TALK_SPOTLIGHT_PROMPT, 0, 0 }, + { ENTOTO_TALK_WAIT_PLAYER_ENTER_SPOTLIGHT, 9, 0 }, + { ENTOTO_TALK_WAIT_ADVANCE_TEXT, 10, 0 }, + { ENTOTO_TALK_CLOSING, 0, 0 }, + { ENTOTO_TALK_START_CUTSCENE_ON_STAGE, 0, 0 }, + { ENTOTO_TALK_WIND_FISH_OCARINA_STAFF, 0, 0 }, + { ENTOTO_TALK_START_CUTSCENE_WIND_FISH, 0, 0 }, + { ENTOTO_TALK_WAIT_WIND_FISH_CUTSCENE, 0, 0 }, + { ENTOTO_TALK_START_GORMAN_CUTSCENE, 0, 0 }, + { ENTOTO_TALK_RETURN_TRUE, 1, 0 }, + { ENTOTO_TALK_RETURN_TRUE, 0, 0 }, + /* Sound Check After Completion */ + { ENTOTO_TALK_START_CUTSCENE, 0, 0 }, + { ENTOTO_TALK_MOVE_PLAYER_TO_STAGE, 20, 0 }, + { ENTOTO_TALK_WAIT_PLAYER_ENTER_SPOTLIGHT, 5, 0 }, + { ENTOTO_TALK_START_CUTSCENE_WIND_FISH, 0, 0 }, + { ENTOTO_TALK_WAIT_WIND_FISH_CUTSCENE, 0, 0 }, + { ENTOTO_TALK_WAIT_AFTER_WIND_FISH, 20, 0x2B22 }, // After replay Sound Check + { ENTOTO_TALK_CLOSING, 0, 0 }, + { ENTOTO_TALK_RETURN_TRUE, 0, 0 } }; -static EnTotoUnkStruct2 D_80BA50DC[] = { - { 0x2B2F, 0x2B30, 0x2B31, { 0xFF96, 0x0016, 0xFE16 } }, - { 0x2B26, 0x2B27, 0x2B28, { 0x0072, 0x0016, 0xFE3C } }, - { 0x2B29, 0x2B2A, 0x2B2B, { 0xFF67, 0x0016, 0xFE6E } }, - { 0x2B2C, 0x2B2D, 0x2B2E, { 0xFFF1, 0x0016, 0xFE74 } }, +static EnTotoSpotlight sSpotlightList[] = { + /* PLAYER_FORM_GORON */ { 0x2B2F, 0x2B30, 0x2B31, { 0xFF96, 0x0016, 0xFE16 } }, + /* PLAYER_FORM_ZORA */ { 0x2B26, 0x2B27, 0x2B28, { 0x0072, 0x0016, 0xFE3C } }, + /* PLAYER_FORM_DEKU */ { 0x2B29, 0x2B2A, 0x2B2B, { 0xFF67, 0x0016, 0xFE6E } }, + /* PLAYER_FORM_HUMAN */ { 0x2B2C, 0x2B2D, 0x2B2E, { 0xFFF1, 0x0016, 0xFE74 } }, }; static Vec3s sPlayerOverrideInputPosList[] = { @@ -137,30 +212,63 @@ static u16 sOcarinaActionWindFishPrompts[] = { OCARINA_ACTION_PROMPT_WIND_FISH_DEKU, }; -static u8 D_80BA5128[] = { 8, 4, 2, 1 }; +static u8 sSpotlightIndexToForm[] = { 8, 4, 2, 1 }; // Spotlight index to form flag -static EnTotoUnkFunc D_80BA512C[] = { - func_80BA3F2C, func_80BA3ED4, func_80BA3F2C, func_80BA3F2C, func_80BA3F2C, func_80BA3ED4, - func_80BA42BC, func_80BA3ED4, func_80BA44A0, func_80BA3FB0, func_80BA402C, func_80BA46D8, - func_80BA47E0, func_80BA49A4, func_80BA3FB0, func_80BA402C, func_80BA3F2C, func_80BA3EC0, +static EnTotoTalkFunc sTalkStateSetupFuncs[] = { + /* 0 */ EnToto_SetupTalk_NextMessage, + /* 1 */ EnToto_SetupTalk_ReturnFalse, + /* 2 */ EnToto_SetupTalk_NextMessage, + /* 3 */ EnToto_SetupTalk_NextMessage, + /* 4 */ EnToto_SetupTalk_NextMessage, + /* 5 */ EnToto_SetupTalk_ReturnFalse, + /* 6 */ EnToto_SetupTalk_InitSoundCheck, + /* 7 */ EnToto_SetupTalk_ReturnFalse, + /* 8 */ EnToto_SetupTalk_StopCutsceneAndResetTimer, + /* 9 */ EnToto_SetupTalk_SetNextMessageTimer, + /* 10 */ EnToto_SetupTalk_StartAdditionalCutscene, + /* 11 */ EnToto_SetupTalk_InitWindFishOcarinaStaff, + /* 12 */ EnToto_SetupTalk_InitWindFishPlayback, + /* 13 */ EnToto_SetupTalk_StartWindFishPlayback, + /* 14 */ EnToto_SetupTalk_SetNextMessageTimer, + /* 15 */ EnToto_SetupTalk_StartAdditionalCutscene, + /* 16 */ EnToto_SetupTalk_NextMessage, + /* 17 */ EnToto_SetupTalk_ReturnTrue, }; -static EnTotoUnkFunc D_80BA5174[] = { - func_80BA40D4, func_80BA4128, func_80BA415C, func_80BA3EE8, func_80BA3EE8, func_80BA407C, - func_80BA43F4, func_80BA445C, func_80BA4530, func_80BA4204, func_80BA407C, func_80BA4740, - func_80BA407C, func_80BA4A00, func_80BA3FCC, func_80BA407C, func_80BA4B24, +/** + * Functions called repeatedly until text pointer changed + * Similar to EnTest3 (Kafei)'s sTalkStateHandlerFuncs + */ +static EnTotoTalkFunc sTalkStateHandlerFuncs[] = { + /* 0 */ EnToto_HandleTalk_Event, + /* 1 */ EnToto_HandleTalk_Closing, + /* 2 */ EnToto_HandleTalk_Choice, + /* 3 */ EnToto_HandleTalk_AfterChoice, + /* 4 */ EnToto_HandleTalk_AfterChoice, + /* 5 */ EnToto_HandleTalk_StartCutscene, + /* 6 */ EnToto_HandleTalk_SoundCheck_MovePlayerToStage, + /* 7 */ EnToto_HandleTalk_SoundCheck_WaitForPromptTextbox, + /* 8 */ EnToto_HandleTalk_SoundCheck_WaitForPlayerToEnterSpotlight, + /* 9 */ EnToto_HandleTalk_SoundCheck_WaitAdvanceText, + /* 10 */ EnToto_HandleTalk_StartCutscene, + /* 11 */ EnToto_HandleTalk_SoundCheck_UpdatePlayedFlags, + /* 12 */ EnToto_HandleTalk_StartCutscene, + /* 13 */ EnToto_HandleTalk_SoundCheck_EndWindFishCutscene, + /* 14 */ EnToto_HandleTalk_Wait, + /* 15 */ EnToto_HandleTalk_StartCutscene, + /* 16 */ EnToto_HandleTalk_SetupMayorsResidence, }; -static EnTotoActionFunc D_80BA51B8[] = { - func_80BA39C8, - func_80BA3CC4, - func_80BA3DBC, +static EnTotoActionFunc sActionHandlerFuncs[] = { + /* 0 */ EnToto_Idle, + /* 1 */ EnToto_Talk, + /* 2 */ EnToto_SoundCheck, }; -void func_80BA36C0(EnToto* this, PlayState* play, s32 index) { - this->unk2B7 = false; +void EnToto_SetMainAction(EnToto* this, PlayState* play, s32 index) { + this->shouldPlaySoundCheckCompleteCutscene = false; this->actionFuncIndex = index; - D_80BA501C[this->actionFuncIndex](this, play); + sActionSetupFuncs[this->actionFuncIndex](this, play); } void EnToto_Init(Actor* thisx, PlayState* play) { @@ -175,10 +283,10 @@ void EnToto_Init(Actor* thisx, PlayState* play) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; - SkelAnime_InitFlex(play, &this->skelAnime, &object_zm_Skel_00A978, - ((play->sceneId == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), + SkelAnime_InitFlex(play, &this->skelAnime, &gTotoSkel, + ((play->sceneId == SCENE_SONCHONOIE) ? &gTotoIdleSittingAnim : &gTotoIdleStandingAnim), this->jointTable, this->morphTable, OBJECT_ZM_LIMB_MAX); - func_80BA36C0(this, play, 0); + EnToto_SetMainAction(this, play, 0); this->actor.shape.rot.x = 0; } @@ -188,58 +296,63 @@ void EnToto_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80BA383C(EnToto* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) && (this->actionFuncIndex == 1) && - (this->skelAnime.animation != &object_zm_Anim_000C80)) { - if ((play->msgCtx.currentTextId != 0x2A98) && (play->msgCtx.currentTextId != 0x2A99)) { - if ((this->animIndex & 1) || (Rand_ZeroOne() > 0.5f)) { - this->animIndex = (this->animIndex + 1) & 3; +void EnToto_UpdateAnimation(EnToto* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime) && // Animation is complete + (this->actionFuncIndex == 1) && // Is talking to player + (this->skelAnime.animation != &gTotoWaveHelloAnim)) { // Not currently waving to Link + + if ((play->msgCtx.currentTextId != 0x2A98) && + (play->msgCtx.currentTextId != 0x2A99)) { // If not first 2 text boxes after Mayor's Residence greeting + if ((this->animIndex & 1) || (Rand_ZeroOne() > 0.5f)) { // 50% chance + this->animIndex = (this->animIndex + 1) & 3; // Tap on head with cane } } - Animation_PlayOnce(&this->skelAnime, sAnimations[this->animIndex]); + Animation_PlayOnce(&this->skelAnime, sTalkSittingAnimations[this->animIndex]); } FaceChange_UpdateBlinkingNonHuman(&this->faceChange, 20, 80, 3); } -void func_80BA3930(EnToto* this, PlayState* play) { - AnimationHeader* anim = &object_zm_Anim_00C880; +void EnToto_SetupIdle(EnToto* this, PlayState* play) { + AnimationHeader* anim = &gTotoIdleStandingAnim; if (play->sceneId == SCENE_SONCHONOIE) { - anim = &object_zm_Anim_003AA8; + anim = &gTotoIdleSittingAnim; } Animation_MorphToLoop(&this->skelAnime, anim, -4.0f); } -s32 func_80BA397C(EnToto* this, s16 arg1) { +s32 EnToto_IsFacingPlayer(EnToto* this, s16 angle) { s16 diff; diff = this->actor.yawTowardsPlayer - this->actor.home.rot.y; - if (ABS_ALT(diff) < arg1) { - return 1; + if (ABS_ALT(diff) < angle) { + return true; } - return 0; + return false; } -void func_80BA39C8(EnToto* this, PlayState* play) { +void EnToto_Idle(EnToto* this, PlayState* play) { Player* player = GET_PLAYER(play); - func_80BA383C(this, play); + EnToto_UpdateAnimation(this, play); if (Actor_TalkOfferAccepted(&this->actor, &play->state)) { - func_80BA36C0(this, play, 1); + EnToto_SetMainAction(this, play, 1); + if (play->sceneId != SCENE_SONCHONOIE) { - Flags_SetSwitch(play, ENTOTO_GET_SWITCH_FLAG_1(&this->actor)); + Flags_SetSwitch(play, ENTOTO_GET_ZORA_SPOKEN_FLAG(&this->actor)); } else if (player->transformation == PLAYER_FORM_DEKU) { - Flags_SetSwitch(play, ENTOTO_GET_SWITCH_FLAG_3(&this->actor)); + Flags_SetSwitch(play, ENTOTO_GET_DEKU_SPOKEN_FLAG(&this->actor)); } - this->unk2B6 = 0; + this->shouldCancelSoundCheck = false; return; } if (((play->sceneId == SCENE_MILK_BAR) && !((CURRENT_TIME >= CLOCK_TIME(6, 0)) && (CURRENT_TIME <= (CLOCK_TIME(22, 13) + 7)))) || - ((play->sceneId != SCENE_MILK_BAR) && func_80BA397C(this, 0x2000))) { - if (this->unk2B6 != 0) { - this->text = &D_80BA502C[6]; + ((play->sceneId != SCENE_MILK_BAR) && EnToto_IsFacingPlayer(this, 0x2000))) { + + if (this->shouldCancelSoundCheck) { + this->speakData = &sDialogSpeakData[ENTOTO_SPEAKDATA_SOUND_CHECK_CANCEL]; this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; Actor_OfferTalkExchange(&this->actor, play, 9999.9f, 9999.9f, PLAYER_IA_NONE); } else { @@ -247,71 +360,72 @@ void func_80BA39C8(EnToto* this, PlayState* play) { Actor_OfferTalk(&this->actor, play, 50.0f); if (play->sceneId == SCENE_SONCHONOIE) { if (player->transformation == PLAYER_FORM_DEKU) { - if (!Flags_GetSwitch(play, ENTOTO_GET_SWITCH_FLAG_3(&this->actor))) { - this->text = &D_80BA502C[15]; + if (!Flags_GetSwitch(play, ENTOTO_GET_DEKU_SPOKEN_FLAG(&this->actor))) { + this->speakData = &sDialogSpeakData[ENTOTO_SPEAKDATA_MAYORS_RESIDENCE_GREET_DEKU]; } else { - this->text = &D_80BA502C[18]; + this->speakData = &sDialogSpeakData[ENTOTO_SPEAKDATA_MAYORS_RESIDENCE_REPEAT_DEKU]; } } else { - this->text = &D_80BA502C[7]; + this->speakData = &sDialogSpeakData[ENTOTO_SPEAKDATA_MAYORS_RESIDENCE_GREET_NON_DEKU]; } - } else if (ENTOTO_WEEK_EVENT_FLAGS) { - this->text = &D_80BA502C[0]; - } else if (!Flags_GetSwitch(play, ENTOTO_GET_SWITCH_FLAG_1(&this->actor))) { - this->text = &D_80BA502C[2]; + } else if (ENTOTO_HELPED_GORMAN) { + this->speakData = &sDialogSpeakData[ENTOTO_SPEAKDATA_SOUND_CHECK_REPLAY]; + } else if (!Flags_GetSwitch(play, ENTOTO_GET_ZORA_SPOKEN_FLAG(&this->actor))) { + this->speakData = &sDialogSpeakData[ENTOTO_SPEAKDATA_SOUND_CHECK_INTRO]; } else { - this->text = &D_80BA502C[3]; + this->speakData = &sDialogSpeakData[ENTOTO_SPEAKDATA_SOUND_CHECK_ASK_FOR_HELP]; } } - this->actor.textId = this->text->textId; + this->actor.textId = this->speakData->textId; } } -void func_80BA3BFC(EnToto* this, PlayState* play) { +void EnToto_SetupTalk(EnToto* this, PlayState* play) { if (play->sceneId == SCENE_SONCHONOIE) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_000C80, -4.0f); - this->animIndex = ENTOTO_ANIM_0; + Animation_MorphToPlayOnce(&this->skelAnime, &gTotoWaveHelloAnim, -4.0f); + this->animIndex = ENTOTO_ANIM_TALK_SITTING; } else { - if (this->text->unk0 == 4) { + if (this->speakData->talkActionIndex == ENTOTO_TALK_NEXT_MESSAGE) { Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_TOTO); } - Animation_MorphToLoop(&this->skelAnime, &object_zm_Anim_00B3E0, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gTotoTalkStandingAnim, -4.0f); } } -void func_80BA3C88(EnToto* this) { +void EnToto_TurnTowardsPlayer(EnToto* this) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xFA0, 0x320); } -void func_80BA3CC4(EnToto* this, PlayState* play) { - func_80BA383C(this, play); - func_80BA3C88(this); +void EnToto_Talk(EnToto* this, PlayState* play) { + EnToto_UpdateAnimation(this, play); + EnToto_TurnTowardsPlayer(this); if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80BA36C0(this, play, this->text->unk1); + EnToto_SetMainAction(this, play, this->speakData->arg); } else { - func_80BA4C44(this, play); + EnToto_RunTalkStateHandlerFunc(this, play); } } -void func_80BA3D38(EnToto* this, PlayState* play) { +void EnToto_SetupSoundCheck(EnToto* this, PlayState* play) { this->csId = this->actor.csId; - this->text = ENTOTO_WEEK_EVENT_FLAGS ? &D_80BA5088[13] : &D_80BA5088[0]; - func_80BA4C0C(this, play); + this->speakData = ENTOTO_HELPED_GORMAN ? &sSoundCheckSpeakData[ENTOTO_SPEAKDATA_WIND_FISH_PROMPT] + : &sSoundCheckSpeakData[ENTOTO_SPEAKDATA_SOUND_CHECK_REPLAY]; + EnToto_RunTalkStateSetupFunc(this, play); play->actorCtx.flags |= ACTORCTX_FLAG_5; this->faceChange.face = 0; } -void func_80BA3DBC(EnToto* this, PlayState* play) { +void EnToto_SoundCheck(EnToto* this, PlayState* play) { Player* player; - func_80BA383C(this, play); - if (!this->unk2B7) { - if (!func_80BA4C44(this, play)) { + EnToto_UpdateAnimation(this, play); + if (!this->shouldPlaySoundCheckCompleteCutscene) { + if (!EnToto_RunTalkStateHandlerFunc(this, play)) { return; } - if ((this->text->unk1 != 0) && ENTOTO_WEEK_EVENT_FLAGS) { - this->unk2B7 = true; + if ((this->speakData->arg != 0) && ENTOTO_HELPED_GORMAN) { + this->shouldPlaySoundCheckCompleteCutscene = true; return; } } else { @@ -325,62 +439,62 @@ void func_80BA3DBC(EnToto* this, PlayState* play) { } } - func_80BA36C0(this, play, 0); + EnToto_SetMainAction(this, play, 0); CutsceneManager_Stop(this->csId); play->actorCtx.flags &= ~ACTORCTX_FLAG_5; } -s32 func_80BA3EC0(EnToto* this, PlayState* play) { - return 1; +s32 EnToto_SetupTalk_ReturnTrue(EnToto* this, PlayState* play) { + return true; } -s32 func_80BA3ED4(EnToto* this, PlayState* play) { - return 0; +s32 EnToto_SetupTalk_ReturnFalse(EnToto* this, PlayState* play) { + return false; } -s32 func_80BA3EE8(EnToto* this, PlayState* play) { - if (this->text->unk1 == 2) { +s32 EnToto_HandleTalk_AfterChoice(EnToto* this, PlayState* play) { + if (this->speakData->arg == 2) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_WAIT); } return 0; } -s32 func_80BA3F2C(EnToto* this, PlayState* play) { - if (this->text->textId != 0) { - Message_ContinueTextbox(play, this->text->textId); +s32 EnToto_SetupTalk_NextMessage(EnToto* this, PlayState* play) { + if (this->speakData->textId != 0) { + Message_ContinueTextbox(play, this->speakData->textId); } else { Message_CloseTextbox(play); - func_80BA3EE8(this, play); + EnToto_HandleTalk_AfterChoice(this, play); } - if (this->text->unk0 == 4) { + if (this->speakData->talkActionIndex == ENTOTO_TALK_NEXT_MESSAGE) { Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_TOTO); } - return 0; + return false; } -s32 func_80BA3FB0(EnToto* this, PlayState* play) { - this->unk2B1 = this->text->unk1; - return 0; +s32 EnToto_SetupTalk_SetNextMessageTimer(EnToto* this, PlayState* play) { + this->timer = this->speakData->arg; + return false; } -s32 func_80BA3FCC(EnToto* this, PlayState* play) { - if (DECR(this->unk2B1) == 0) { - Message_StartTextbox(play, this->text->textId, NULL); +s32 EnToto_HandleTalk_Wait(EnToto* this, PlayState* play) { + if (DECR(this->timer) == 0) { + Message_StartTextbox(play, this->speakData->textId, NULL); return 1; } return 0; } -s32 func_80BA402C(EnToto* this, PlayState* play) { +s32 EnToto_SetupTalk_StartAdditionalCutscene(EnToto* this, PlayState* play) { s16 prevCsId = this->csId; this->csId = CutsceneManager_GetAdditionalCsId(this->csId); CutsceneManager_Queue(this->csId); CutsceneManager_Stop(prevCsId); - return 0; + return false; } -s32 func_80BA407C(EnToto* this, PlayState* play) { +s32 EnToto_HandleTalk_StartCutscene(EnToto* this, PlayState* play) { if (CutsceneManager_IsNext(this->csId)) { CutsceneManager_StartWithPlayerCs(this->csId, &GET_PLAYER(play)->actor); return 1; @@ -390,51 +504,59 @@ s32 func_80BA407C(EnToto* this, PlayState* play) { return 0; } -s32 func_80BA40D4(EnToto* this, PlayState* play) { +s32 EnToto_HandleTalk_Event(EnToto* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { return 1; } return 0; } -s32 func_80BA4128(EnToto* this, PlayState* play) { +s32 EnToto_HandleTalk_Closing(EnToto* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 1; } return 0; } -s32 func_80BA415C(EnToto* this, PlayState* play) { +s32 EnToto_HandleTalk_Choice(EnToto* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex != 0) { Audio_PlaySfx_MessageCancel(); } else { Audio_PlaySfx_MessageDecide(); } - return ((play->msgCtx.choiceIndex != 0) ? 0 : this->text->unk1) + 1; + return ((play->msgCtx.choiceIndex != 0) ? 0 : this->speakData->arg) + 1; } return 0; } -s32 func_80BA4204(EnToto* this, PlayState* play) { - EnTotoUnkStruct2* temp_v1_2; +s32 EnToto_HandleTalk_SoundCheck_WaitAdvanceText(EnToto* this, PlayState* play) { + EnTotoSpotlight* targetSpotlight; - if (DECR(this->unk2B1) == 0) { - if (!ENTOTO_WEEK_EVENT_FLAGS) { - temp_v1_2 = &D_80BA50DC[gSaveContext.save.playerForm - 1]; - Message_StartTextbox(play, (this->text->unk0 == 6) ? temp_v1_2->unk0 : temp_v1_2->unk4, NULL); + if (DECR(this->timer) == 0) { + if (!ENTOTO_HELPED_GORMAN) { + targetSpotlight = &sSpotlightList[gSaveContext.save.playerForm - 1]; + Message_StartTextbox(play, + (this->speakData->talkActionIndex == ENTOTO_TALK_MOVE_PLAYER_TO_STAGE) + ? targetSpotlight->promptTextId + : targetSpotlight->rightLightTextId, + NULL); } return 1; } return 0; } -s32 func_80BA42BC(EnToto* this, PlayState* play) { +/** + * Start moving Link to the stairs in front of the stage, and spawn the spotlights. + * Omits points based on initial distance to end point. + */ +s32 EnToto_SetupTalk_InitSoundCheck(EnToto* this, PlayState* play) { Player* player = GET_PLAYER(play); u32 numPoints = 0; Vec3s* endPosListPtr = &sPlayerOverrideInputPosList[ARRAY_COUNT(sPlayerOverrideInputPosList)]; - func_80BA3FB0(this, play); + EnToto_SetupTalk_SetNextMessageTimer(this, play); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_END); if (player->actor.world.pos.z > -310.0f) { if ((player->actor.world.pos.x > -150.0f) || (player->actor.world.pos.z > -172.0f)) { @@ -447,150 +569,159 @@ s32 func_80BA42BC(EnToto* this, PlayState* play) { } Player_InitOverrideInput(play, &this->overrideInputEntry, numPoints, endPosListPtr - numPoints); this->spotlights = Actor_Spawn(&play->actorCtx, play, ACTOR_DM_CHAR07, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0xF02); - return 0; + return false; } -s32 func_80BA43F4(EnToto* this, PlayState* play) { - func_80BA3C88(this); +s32 EnToto_HandleTalk_SoundCheck_MovePlayerToStage(EnToto* this, PlayState* play) { + EnToto_TurnTowardsPlayer(this); if (Player_UpdateOverrideInput(play, &this->overrideInputEntry, 60.0f)) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_19); - return func_80BA4204(this, play); + return EnToto_HandleTalk_SoundCheck_WaitAdvanceText(this, play); } return 0; } -s32 func_80BA445C(EnToto* this, PlayState* play) { - if (func_80BA4128(this, play)) { +s32 EnToto_HandleTalk_SoundCheck_WaitForPromptTextbox(EnToto* this, PlayState* play) { + if (EnToto_HandleTalk_Closing(this, play)) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_END); return 1; } return 0; } -s32 func_80BA44A0(EnToto* this, PlayState* play) { +s32 EnToto_SetupTalk_StopCutsceneAndResetTimer(EnToto* this, PlayState* play) { CutsceneManager_Stop(this->csId); - this->unk2B1 = 0; - return 0; + this->timer = 0; + return false; } -s32 func_80BA44D4(EnTotoUnkStruct2* arg0, Player* player) { - Vec3f unk6; +s32 EnToto_CheckIfPlayerInSpotlight(EnTotoSpotlight* spotlight, Player* player) { + Vec3f pos; - Math_Vec3s_ToVec3f(&unk6, &arg0->unk6); - if (Math_Vec3f_DistXZ(&player->actor.world.pos, &unk6) < 10.0f) { - return 1; + Math_Vec3s_ToVec3f(&pos, &spotlight->pos); + if (Math_Vec3f_DistXZ(&player->actor.world.pos, &pos) < 10.0f) { + return true; } - return 0; + return false; } -s32 func_80BA4530(EnToto* this, PlayState* play) { +s32 EnToto_HandleTalk_SoundCheck_WaitForPlayerToEnterSpotlight(EnToto* this, PlayState* play) { Player* player = GET_PLAYER(play); - EnTotoUnkStruct2* temp_s0; + EnTotoSpotlight* targetSpotlight; s32 i; - func_80BA3C88(this); + EnToto_TurnTowardsPlayer(this); + + // Player leaves the stage area if (player->actor.world.pos.z > -270.0f) { if (this->spotlights != NULL) { Actor_Kill(this->spotlights); } - this->unk2B6 = 1; - return this->text->unk1; + this->shouldCancelSoundCheck = true; + return this->speakData->arg; } if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - temp_s0 = &D_80BA50DC[gSaveContext.save.playerForm - 1]; - if (func_80BA44D4(temp_s0, player)) { - Math_Vec3s_ToVec3f(&player->actor.world.pos, &temp_s0->unk6); + targetSpotlight = &sSpotlightList[gSaveContext.save.playerForm - 1]; + + // Player is in correct spotlight + if (EnToto_CheckIfPlayerInSpotlight(targetSpotlight, player)) { + Math_Vec3s_ToVec3f(&player->actor.world.pos, &targetSpotlight->pos); player->actor.shape.rot.y = 0; player->yaw = 0; - return func_80BA407C(this, play); + return EnToto_HandleTalk_StartCutscene(this, play); } - if (!ENTOTO_WEEK_EVENT_FLAGS) { - for (i = 0; i < ARRAY_COUNT(D_80BA50DC); i++) { - if (func_80BA44D4(&D_80BA50DC[i], player)) { - if (this->unk2B1 < 10) { - this->unk2B1++; - if (this->unk2B1 >= 10) { - Message_StartTextbox(play, D_80BA50DC[GET_PLAYER_FORM - 1].unk2, NULL); + if (!ENTOTO_HELPED_GORMAN) { + for (i = 0; i < ARRAY_COUNT(sSpotlightList); i++) { + + // Player is in incorrect spotlight + if (EnToto_CheckIfPlayerInSpotlight(&sSpotlightList[i], player)) { + if (this->timer < 10) { + this->timer++; + if (this->timer >= 10) { + Message_StartTextbox(play, sSpotlightList[GET_PLAYER_FORM - 1].wrongLightTextId, NULL); } } return 0; } } - this->unk2B1 = 0; + this->timer = 0; } } return 0; } -s32 func_80BA46D8(EnToto* this, PlayState* play) { +s32 EnToto_SetupTalk_InitWindFishOcarinaStaff(EnToto* this, PlayState* play) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_68); Message_DisplayOcarinaStaff(play, sOcarinaActionWindFishPrompts[CUR_FORM]); - return 0; + return false; } -s32 func_80BA4740(EnToto* this, PlayState* play) { +s32 EnToto_HandleTalk_SoundCheck_UpdatePlayedFlags(EnToto* this, PlayState* play) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_END) { if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { - SET_WEEKEVENTREG(WEEKEVENTREG_56_10); + SET_WEEKEVENTREG(WEEKEVENTREG_PLAYED_WIND_FISH_AS_HUMAN); } if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { - SET_WEEKEVENTREG(WEEKEVENTREG_56_20); + SET_WEEKEVENTREG(WEEKEVENTREG_PLAYED_WIND_FISH_AS_DEKU); } if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { - SET_WEEKEVENTREG(WEEKEVENTREG_56_40); + SET_WEEKEVENTREG(WEEKEVENTREG_PLAYED_WIND_FISH_AS_ZORA); } if (GET_PLAYER_FORM == PLAYER_FORM_GORON) { - SET_WEEKEVENTREG(WEEKEVENTREG_56_80); + SET_WEEKEVENTREG(WEEKEVENTREG_PLAYED_WIND_FISH_AS_GORON); } return 1; } return 0; } -s32 func_80BA47E0(EnToto* this, PlayState* play) { +s32 EnToto_SetupTalk_InitWindFishPlayback(EnToto* this, PlayState* play) { Vec3f spawnPos; s32 i; - this->unk2B3 = 0; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_56_10)) { - this->unk2B3 += 1; + this->windFishFormsPlayed = 0; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_PLAYED_WIND_FISH_AS_HUMAN)) { + this->windFishFormsPlayed += WIND_FISH_PLAYED_HUMAN; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_56_20)) { - this->unk2B3 += 2; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_PLAYED_WIND_FISH_AS_DEKU)) { + this->windFishFormsPlayed += WIND_FISH_PLAYED_DEKU; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_56_40)) { - this->unk2B3 += 4; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_PLAYED_WIND_FISH_AS_ZORA)) { + this->windFishFormsPlayed += WIND_FISH_PLAYED_ZORA; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_56_80)) { - this->unk2B3 += 8; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_PLAYED_WIND_FISH_AS_GORON)) { + this->windFishFormsPlayed += WIND_FISH_PLAYED_GORON; } - for (i = 0; i < ARRAY_COUNT(D_80BA50DC); i++) { - if ((GET_PLAYER_FORM != (i + 1)) && (D_80BA5128[i] & this->unk2B3)) { - Math_Vec3s_ToVec3f(&spawnPos, &D_80BA50DC[i].unk6); + for (i = 0; i < ARRAY_COUNT(sSpotlightList); i++) { + if ((GET_PLAYER_FORM != (i + 1)) && (sSpotlightIndexToForm[i] & this->windFishFormsPlayed)) { + Math_Vec3s_ToVec3f(&spawnPos, &sSpotlightList[i].pos); Actor_Spawn(&play->actorCtx, play, ACTOR_PLAYER, spawnPos.x, spawnPos.y, spawnPos.z, i + 2, 0, 0, PLAYER_PARAMS(0xFF, PLAYER_START_MODE_F) | 0xFFFFF000); } } - func_80BA402C(this, play); - if (ENTOTO_WEEK_EVENT_FLAGS) { - func_80BA402C(this, play); + EnToto_SetupTalk_StartAdditionalCutscene(this, play); + if (ENTOTO_HELPED_GORMAN) { + EnToto_SetupTalk_StartAdditionalCutscene(this, play); } - return 0; + return false; } -s32 func_80BA49A4(EnToto* this, PlayState* play) { +s32 EnToto_SetupTalk_StartWindFishPlayback(EnToto* this, PlayState* play) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_68); - Audio_PlayFanfareWithPlayerIOCustomPort(NA_BGM_BALLAD_OF_THE_WIND_FISH, 4, this->unk2B3 ^ 0xF); - this->unk2B1 = 4; - return 0; + Audio_PlayFanfareWithPlayerIOCustomPort(NA_BGM_BALLAD_OF_THE_WIND_FISH, 4, + this->windFishFormsPlayed ^ WIND_FISH_PLAYED_ALL); + this->timer = 4; + return false; } -s32 func_80BA4A00(EnToto* this, PlayState* play) { +s32 EnToto_HandleTalk_SoundCheck_EndWindFishCutscene(EnToto* this, PlayState* play) { Actor* actor; - if (DECR(this->unk2B1) == 0) { + if (DECR(this->timer) == 0) { + // If Wind Fish is not done playing, stay in this state if (!Audio_IsSequencePlaying(NA_BGM_BALLAD_OF_THE_WIND_FISH)) { + // Destroy the spotlights and the Links playing them actor = &GET_PLAYER(play)->actor; actor = actor->next; while (actor != NULL) { @@ -600,15 +731,17 @@ s32 func_80BA4A00(EnToto* this, PlayState* play) { if (this->spotlights != NULL) { Actor_Kill(this->spotlights); } + Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_69); - if (this->unk2B3 == 0xF) { + + if (this->windFishFormsPlayed == WIND_FISH_PLAYED_ALL) { if (CURRENT_DAY == 1) { - SET_WEEKEVENTREG(WEEKEVENTREG_50_01); + SET_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_1); } else { - SET_WEEKEVENTREG(WEEKEVENTREG_51_80); + SET_WEEKEVENTREG(WEEKEVENTREG_HELPED_GORMAN_DAY_2); } } else { - func_80BA402C(this, play); + EnToto_SetupTalk_StartAdditionalCutscene(this, play); // Set up Gorman booing cutscene } return 1; } @@ -616,22 +749,22 @@ s32 func_80BA4A00(EnToto* this, PlayState* play) { return 0; } -s32 func_80BA4B24(EnToto* this, PlayState* play) { +s32 EnToto_HandleTalk_SetupMayorsResidence(EnToto* this, PlayState* play) { Player* player; - if (func_80BA40D4(this, play)) { + if (EnToto_HandleTalk_Event(this, play)) { player = GET_PLAYER(play); - Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_0028B8, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gTotoTalkSittingAnim, -4.0f); if (player->transformation == PLAYER_FORM_ZORA) { - if (!Flags_GetSwitch(play, ENTOTO_GET_SWITCH_FLAG_1(&this->actor))) { - Flags_SetSwitch(play, ENTOTO_GET_SWITCH_FLAG_1(&this->actor)); + if (!Flags_GetSwitch(play, ENTOTO_GET_ZORA_SPOKEN_FLAG(&this->actor))) { + Flags_SetSwitch(play, ENTOTO_GET_ZORA_SPOKEN_FLAG(&this->actor)); return 1; } else { return 3; } } else { - if (!Flags_GetSwitch(play, ENTOTO_GET_SWITCH_FLAG_2(&this->actor))) { - Flags_SetSwitch(play, ENTOTO_GET_SWITCH_FLAG_2(&this->actor)); + if (!Flags_GetSwitch(play, ENTOTO_GET_OTHER_SPOKEN_FLAG(&this->actor))) { + Flags_SetSwitch(play, ENTOTO_GET_OTHER_SPOKEN_FLAG(&this->actor)); return 4; } else { return 7; @@ -641,32 +774,42 @@ s32 func_80BA4B24(EnToto* this, PlayState* play) { return 0; } -s32 func_80BA4C0C(EnToto* this, PlayState* play) { - return D_80BA512C[this->text->unk0](this, play); +s32 EnToto_RunTalkStateSetupFunc(EnToto* this, PlayState* play) { + return sTalkStateSetupFuncs[this->speakData->talkActionIndex](this, play); } -s32 func_80BA4C44(EnToto* this, PlayState* play) { - s32 ret = D_80BA5174[this->text->unk0](this, play); +/** + * These functions generally stay in the same state until one of them returns + * something nonzero, then it sets up the next one. + */ +s32 EnToto_RunTalkStateHandlerFunc(EnToto* this, PlayState* play) { + s32 nextOffset = sTalkStateHandlerFuncs[this->speakData->talkActionIndex](this, play); - if (ret != 0) { - this->text += ret; - return func_80BA4C0C(this, play); + if (nextOffset != 0) { + this->speakData += nextOffset; + return EnToto_RunTalkStateSetupFunc(this, play); } - return 0; + return false; } -void func_80BA4CB4(EnToto* this, PlayState* play) { +/** + * Cue 4: Gorman gives Circus Leader's Mask + * Cue 3: Toto feel good text + * Cue 2: Toto turns around to look at Gorman + * Cue 1: Toto turn back around to stage + */ +void EnToto_HandleGormanCutscene(EnToto* this, PlayState* play) { CsCmdActorCue* cue = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_525)]; if (this->cueId != cue->id) { this->cueId = cue->id; if (this->cueId != 4) { if (this->cueId == 3) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_001DF0, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gTotoCheerAnim, -4.0f); } else { Animation_PlayOnce(&this->skelAnime, - (this->cueId == 1) ? &object_zm_Anim_0016A4 : &object_zm_Anim_0022C8); - if ((this->cueId == 2) && (this->unk2B3 != 0xF)) { + (this->cueId == 1) ? &gTotoTurnLookAtStageAnim : &gTotoTurnLookAtGormanAnim); + if ((this->cueId == 2) && (this->windFishFormsPlayed != WIND_FISH_PLAYED_ALL)) { Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_TOTO); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_GORMAN); } @@ -676,7 +819,8 @@ void func_80BA4CB4(EnToto* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x320); if (SkelAnime_Update(&this->skelAnime)) { if (this->cueId != 3) { - Animation_PlayLoop(&this->skelAnime, (this->cueId == 1) ? &object_zm_Anim_00C880 : &object_zm_Anim_001324); + Animation_PlayLoop(&this->skelAnime, + (this->cueId == 1) ? &gTotoIdleStandingAnim : &gTotoIdleLookAtGormanAnim); } } if ((this->cueId == 4) && !Actor_HasParent(&this->actor, play)) { @@ -689,9 +833,9 @@ void EnToto_Update(Actor* thisx, PlayState* play) { s32 pad; if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_525)) { - func_80BA4CB4(this, play); + EnToto_HandleGormanCutscene(this, play); } else { - D_80BA51B8[this->actionFuncIndex](this, play); + sActionHandlerFuncs[this->actionFuncIndex](this, play); } Collider_ResetCylinderAC(play, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.h b/src/overlays/actors/ovl_En_Toto/z_en_toto.h index 04f8733e40..f5ad2aa62d 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.h +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.h @@ -8,24 +8,30 @@ struct EnToto; typedef void (*EnTotoActionFunc)(struct EnToto*, PlayState*); -typedef s32 (*EnTotoUnkFunc)(struct EnToto*, PlayState*); +typedef s32 (*EnTotoTalkFunc)(struct EnToto*, PlayState*); -#define ENTOTO_GET_SWITCH_FLAG_1(thisx) ((thisx)->params & 0x7F) -#define ENTOTO_GET_SWITCH_FLAG_2(thisx) (((thisx)->params >> 7) & 0x7F) -#define ENTOTO_GET_SWITCH_FLAG_3(thisx) ((thisx)->home.rot.x) +#define ENTOTO_GET_ZORA_SPOKEN_FLAG(thisx) ((thisx)->params & 0x7F) +#define ENTOTO_GET_OTHER_SPOKEN_FLAG(thisx) (((thisx)->params >> 7) & 0x7F) +#define ENTOTO_GET_DEKU_SPOKEN_FLAG(thisx) ((thisx)->home.rot.x) -typedef struct EnTotoText { - /* 0x0 */ u8 unk0; - /* 0x1 */ u8 unk1; +#define WIND_FISH_PLAYED_HUMAN (1 << 0) +#define WIND_FISH_PLAYED_DEKU (1 << 1) +#define WIND_FISH_PLAYED_ZORA (1 << 2) +#define WIND_FISH_PLAYED_GORON (1 << 3) +#define WIND_FISH_PLAYED_ALL (WIND_FISH_PLAYED_HUMAN + WIND_FISH_PLAYED_DEKU + WIND_FISH_PLAYED_ZORA + WIND_FISH_PLAYED_GORON) + +typedef struct EnTotoSpeakData { + /* 0x0 */ u8 talkActionIndex; + /* 0x1 */ u8 arg; // Used for various functions, including as a timer /* 0x2 */ u16 textId; -} EnTotoText; // size = 0x4 +} EnTotoSpeakData; // size = 0x4 -typedef struct EnTotoUnkStruct2 { - /* 0x0 */ u16 unk0; - /* 0x2 */ u16 unk2; - /* 0x4 */ u16 unk4; - /* 0x6 */ Vec3s unk6; -} EnTotoUnkStruct2; // size = 0xC +typedef struct EnTotoSpotlight { + /* 0x0 */ u16 promptTextId; + /* 0x2 */ u16 wrongLightTextId; + /* 0x4 */ u16 rightLightTextId; + /* 0x6 */ Vec3s pos; +} EnTotoSpotlight; // size = 0xC typedef struct EnToto { /* 0x000 */ Actor actor; @@ -35,14 +41,14 @@ typedef struct EnToto { /* 0x260 */ FaceChange faceChange; /* 0x264 */ ColliderCylinder collider; /* 0x2B0 */ u8 actionFuncIndex; - /* 0x2B1 */ u8 unk2B1; + /* 0x2B1 */ u8 timer; /* 0x2B2 */ s8 csId; - /* 0x2B3 */ u8 unk2B3; + /* 0x2B3 */ u8 windFishFormsPlayed; /* 0x2B4 */ u8 animIndex; /* 0x2B5 */ u8 cueId; - /* 0x2B6 */ u8 unk2B6; - /* 0x2B7 */ u8 unk2B7; - /* 0x2B8 */ EnTotoText* text; + /* 0x2B6 */ u8 shouldCancelSoundCheck; + /* 0x2B7 */ u8 shouldPlaySoundCheckCompleteCutscene; + /* 0x2B8 */ EnTotoSpeakData* speakData; /* 0x2BC */ PlayerOverrideInputEntry overrideInputEntry; /* 0x2C4 */ Actor* spotlights; /* 0x2C8 */ s32 pad2C8; diff --git a/tools/disasm/n64-jp-1.1/functions.txt b/tools/disasm/n64-jp-1.1/functions.txt index fa59815959..c4ae42ba4e 100644 --- a/tools/disasm/n64-jp-1.1/functions.txt +++ b/tools/disasm/n64-jp-1.1/functions.txt @@ -15066,45 +15066,45 @@ func_80BA3230 = 0x80BA6550; // type:func size:0x114 func_80BA3344 = 0x80BA6664; // type:func size:0xCC ObjNozoki_Update = 0x80BA6730; // type:func size:0x24 ObjNozoki_Draw = 0x80BA6754; // type:func size:0x5C -func_80BA36C0 = 0x80BA69E0; // type:func size:0x3C +EnToto_SetMainAction = 0x80BA69E0; // type:func size:0x3C EnToto_Init = 0x80BA6A1C; // type:func size:0x114 EnToto_Destroy = 0x80BA6B30; // type:func size:0x2C -func_80BA383C = 0x80BA6B5C; // type:func size:0xF4 -func_80BA3930 = 0x80BA6C50; // type:func size:0x4C -func_80BA397C = 0x80BA6C9C; // type:func size:0x4C -func_80BA39C8 = 0x80BA6CE8; // type:func size:0x218 -func_80BA3BFC = 0x80BA6F00; // type:func size:0x8C -func_80BA3C88 = 0x80BA6F8C; // type:func size:0x3C -func_80BA3CC4 = 0x80BA6FC8; // type:func size:0x74 -func_80BA3D38 = 0x80BA703C; // type:func size:0x84 -func_80BA3DBC = 0x80BA70C0; // type:func size:0x104 -func_80BA3EC0 = 0x80BA71C4; // type:func size:0x14 -func_80BA3ED4 = 0x80BA71D8; // type:func size:0x14 -func_80BA3EE8 = 0x80BA71EC; // type:func size:0x44 -func_80BA3F2C = 0x80BA7230; // type:func size:0x84 -func_80BA3FB0 = 0x80BA72B4; // type:func size:0x1C -func_80BA3FCC = 0x80BA72D0; // type:func size:0x60 -func_80BA402C = 0x80BA7330; // type:func size:0x50 -func_80BA407C = 0x80BA7380; // type:func size:0x58 -func_80BA40D4 = 0x80BA73D8; // type:func size:0x54 -func_80BA4128 = 0x80BA742C; // type:func size:0x34 -func_80BA415C = 0x80BA7460; // type:func size:0xA8 -func_80BA4204 = 0x80BA7508; // type:func size:0xB8 -func_80BA42BC = 0x80BA75C0; // type:func size:0x138 -func_80BA43F4 = 0x80BA76F8; // type:func size:0x68 -func_80BA445C = 0x80BA7760; // type:func size:0x44 -func_80BA44A0 = 0x80BA77A4; // type:func size:0x34 -func_80BA44D4 = 0x80BA77D8; // type:func size:0x5C -func_80BA4530 = 0x80BA7834; // type:func size:0x1A8 -func_80BA46D8 = 0x80BA79DC; // type:func size:0x68 -func_80BA4740 = 0x80BA7A44; // type:func size:0xA0 -func_80BA47E0 = 0x80BA7AE4; // type:func size:0x1C4 -func_80BA49A4 = 0x80BA7CA8; // type:func size:0x5C -func_80BA4A00 = 0x80BA7D04; // type:func size:0x124 -func_80BA4B24 = 0x80BA7E28; // type:func size:0xE8 -func_80BA4C0C = 0x80BA7F10; // type:func size:0x38 -func_80BA4C44 = 0x80BA7F48; // type:func size:0x70 -func_80BA4CB4 = 0x80BA7FB8; // type:func size:0x178 +EnToto_UpdateAnimation = 0x80BA6B5C; // type:func size:0xF4 +EnToto_SetupIdle = 0x80BA6C50; // type:func size:0x4C +EnToto_IsFacingPlayer = 0x80BA6C9C; // type:func size:0x4C +EnToto_Idle = 0x80BA6CE8; // type:func size:0x218 +EnToto_SetupTalk = 0x80BA6F00; // type:func size:0x8C +EnToto_TurnTowardsPlayer = 0x80BA6F8C; // type:func size:0x3C +EnToto_Talk = 0x80BA6FC8; // type:func size:0x74 +EnToto_SetupSoundCheck = 0x80BA703C; // type:func size:0x84 +EnToto_SoundCheck = 0x80BA70C0; // type:func size:0x104 +EnToto_SetupTalk_ReturnTrue = 0x80BA71C4; // type:func size:0x14 +EnToto_SetupTalk_ReturnFalse = 0x80BA71D8; // type:func size:0x14 +EnToto_HandleTalk_AfterChoice = 0x80BA71EC; // type:func size:0x44 +EnToto_SetupTalk_NextMessage = 0x80BA7230; // type:func size:0x84 +EnToto_SetupTalk_SetNextMessageTimer = 0x80BA72B4; // type:func size:0x1C +EnToto_HandleTalk_Wait = 0x80BA72D0; // type:func size:0x60 +EnToto_SetupTalk_StartAdditionalCutscene = 0x80BA7330; // type:func size:0x50 +EnToto_HandleTalk_StartCutscene = 0x80BA7380; // type:func size:0x58 +EnToto_HandleTalk_Event = 0x80BA73D8; // type:func size:0x54 +EnToto_HandleTalk_Closing = 0x80BA742C; // type:func size:0x34 +EnToto_HandleTalk_Choice = 0x80BA7460; // type:func size:0xA8 +EnToto_HandleTalk_SoundCheck_WaitAdvanceText = 0x80BA7508; // type:func size:0xB8 +EnToto_SetupTalk_InitSoundCheck = 0x80BA75C0; // type:func size:0x138 +EnToto_HandleTalk_SoundCheck_MovePlayerToStage = 0x80BA76F8; // type:func size:0x68 +EnToto_HandleTalk_SoundCheck_WaitForPromptTextbox = 0x80BA7760; // type:func size:0x44 +EnToto_SetupTalk_StopCutsceneAndResetTimer = 0x80BA77A4; // type:func size:0x34 +EnToto_CheckIfPlayerInSpotlight = 0x80BA77D8; // type:func size:0x5C +EnToto_HandleTalk_SoundCheck_WaitForPlayerToEnterSpotlight = 0x80BA7834; // type:func size:0x1A8 +EnToto_SetupTalk_InitWindFishOcarinaStaff = 0x80BA79DC; // type:func size:0x68 +EnToto_HandleTalk_SoundCheck_UpdatePlayedFlags = 0x80BA7A44; // type:func size:0xA0 +EnToto_SetupTalk_InitWindFishPlayback = 0x80BA7AE4; // type:func size:0x1C4 +EnToto_SetupTalk_StartWindFishPlayback = 0x80BA7CA8; // type:func size:0x5C +EnToto_HandleTalk_SoundCheck_EndWindFishCutscene = 0x80BA7D04; // type:func size:0x124 +EnToto_HandleTalk_SetupMayorsResidence = 0x80BA7E28; // type:func size:0xE8 +EnToto_RunTalkStateSetupFunc = 0x80BA7F10; // type:func size:0x38 +EnToto_RunTalkStateHandlerFunc = 0x80BA7F48; // type:func size:0x70 +EnToto_HandleGormanCutscene = 0x80BA7FB8; // type:func size:0x178 EnToto_Update = 0x80BA8130; // type:func size:0xD0 EnToto_Draw = 0x80BA8200; // type:func size:0xD0 EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation = 0x80BA8700; // type:func size:0x220 diff --git a/tools/disasm/n64-us/functions.txt b/tools/disasm/n64-us/functions.txt index c1e5622ef8..73ce68a592 100644 --- a/tools/disasm/n64-us/functions.txt +++ b/tools/disasm/n64-us/functions.txt @@ -15074,45 +15074,45 @@ func_80BA3230 = 0x80BA3230; // type:func func_80BA3344 = 0x80BA3344; // type:func ObjNozoki_Update = 0x80BA3410; // type:func ObjNozoki_Draw = 0x80BA3434; // type:func -func_80BA36C0 = 0x80BA36C0; // type:func +EnToto_SetMainAction = 0x80BA36C0; // type:func EnToto_Init = 0x80BA36FC; // type:func EnToto_Destroy = 0x80BA3810; // type:func -func_80BA383C = 0x80BA383C; // type:func -func_80BA3930 = 0x80BA3930; // type:func -func_80BA397C = 0x80BA397C; // type:func -func_80BA39C8 = 0x80BA39C8; // type:func -func_80BA3BFC = 0x80BA3BFC; // type:func -func_80BA3C88 = 0x80BA3C88; // type:func -func_80BA3CC4 = 0x80BA3CC4; // type:func -func_80BA3D38 = 0x80BA3D38; // type:func -func_80BA3DBC = 0x80BA3DBC; // type:func -func_80BA3EC0 = 0x80BA3EC0; // type:func -func_80BA3ED4 = 0x80BA3ED4; // type:func -func_80BA3EE8 = 0x80BA3EE8; // type:func -func_80BA3F2C = 0x80BA3F2C; // type:func -func_80BA3FB0 = 0x80BA3FB0; // type:func -func_80BA3FCC = 0x80BA3FCC; // type:func -func_80BA402C = 0x80BA402C; // type:func -func_80BA407C = 0x80BA407C; // type:func -func_80BA40D4 = 0x80BA40D4; // type:func -func_80BA4128 = 0x80BA4128; // type:func -func_80BA415C = 0x80BA415C; // type:func -func_80BA4204 = 0x80BA4204; // type:func -func_80BA42BC = 0x80BA42BC; // type:func -func_80BA43F4 = 0x80BA43F4; // type:func -func_80BA445C = 0x80BA445C; // type:func -func_80BA44A0 = 0x80BA44A0; // type:func -func_80BA44D4 = 0x80BA44D4; // type:func -func_80BA4530 = 0x80BA4530; // type:func -func_80BA46D8 = 0x80BA46D8; // type:func -func_80BA4740 = 0x80BA4740; // type:func -func_80BA47E0 = 0x80BA47E0; // type:func -func_80BA49A4 = 0x80BA49A4; // type:func -func_80BA4A00 = 0x80BA4A00; // type:func -func_80BA4B24 = 0x80BA4B24; // type:func -func_80BA4C0C = 0x80BA4C0C; // type:func -func_80BA4C44 = 0x80BA4C44; // type:func -func_80BA4CB4 = 0x80BA4CB4; // type:func +EnToto_UpdateAnimation = 0x80BA383C; // type:func +EnToto_SetupIdle = 0x80BA3930; // type:func +EnToto_IsFacingPlayer = 0x80BA397C; // type:func +EnToto_Idle = 0x80BA39C8; // type:func +EnToto_SetupTalk = 0x80BA3BFC; // type:func +EnToto_TurnTowardsPlayer = 0x80BA3C88; // type:func +EnToto_Talk = 0x80BA3CC4; // type:func +EnToto_SetupSoundCheck = 0x80BA3D38; // type:func +EnToto_SoundCheck = 0x80BA3DBC; // type:func +EnToto_SetupTalk_ReturnTrue = 0x80BA3EC0; // type:func +EnToto_SetupTalk_ReturnFalse = 0x80BA3ED4; // type:func +EnToto_HandleTalk_AfterChoice = 0x80BA3EE8; // type:func +EnToto_SetupTalk_NextMessage = 0x80BA3F2C; // type:func +EnToto_SetupTalk_SetNextMessageTimer = 0x80BA3FB0; // type:func +EnToto_HandleTalk_Wait = 0x80BA3FCC; // type:func +EnToto_SetupTalk_StartAdditionalCutscene = 0x80BA402C; // type:func +EnToto_HandleTalk_StartCutscene = 0x80BA407C; // type:func +EnToto_HandleTalk_Event = 0x80BA40D4; // type:func +EnToto_HandleTalk_Closing = 0x80BA4128; // type:func +EnToto_HandleTalk_Choice = 0x80BA415C; // type:func +EnToto_HandleTalk_SoundCheck_WaitAdvanceText = 0x80BA4204; // type:func +EnToto_SetupTalk_InitSoundCheck = 0x80BA42BC; // type:func +EnToto_HandleTalk_SoundCheck_MovePlayerToStage = 0x80BA43F4; // type:func +EnToto_HandleTalk_SoundCheck_WaitForPromptTextbox = 0x80BA445C; // type:func +EnToto_SetupTalk_StopCutsceneAndResetTimer = 0x80BA44A0; // type:func +EnToto_CheckIfPlayerInSpotlight = 0x80BA44D4; // type:func +EnToto_HandleTalk_SoundCheck_WaitForPlayerToEnterSpotlight = 0x80BA4530; // type:func +EnToto_SetupTalk_InitWindFishOcarinaStaff = 0x80BA46D8; // type:func +EnToto_HandleTalk_SoundCheck_UpdatePlayedFlags = 0x80BA4740; // type:func +EnToto_SetupTalk_InitWindFishPlayback = 0x80BA47E0; // type:func +EnToto_SetupTalk_StartWindFishPlayback = 0x80BA49A4; // type:func +EnToto_HandleTalk_SoundCheck_EndWindFishCutscene = 0x80BA4A00; // type:func +EnToto_HandleTalk_SetupMayorsResidence = 0x80BA4B24; // type:func +EnToto_RunTalkStateSetupFunc = 0x80BA4C0C; // type:func +EnToto_RunTalkStateHandlerFunc = 0x80BA4C44; // type:func +EnToto_HandleGormanCutscene = 0x80BA4CB4; // type:func EnToto_Update = 0x80BA4E2C; // type:func EnToto_Draw = 0x80BA4EFC; // type:func EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation = 0x80BA5400; // type:func diff --git a/tools/overlayhelpers/mscriptdis.py b/tools/overlayhelpers/mscriptdis.py index 755fd7f60d..1ad9f37362 100644 --- a/tools/overlayhelpers/mscriptdis.py +++ b/tools/overlayhelpers/mscriptdis.py @@ -461,7 +461,7 @@ week_event_reg = { (49 << 8) | 0x20: "WEEKEVENTREG_49_20", (49 << 8) | 0x40: "WEEKEVENTREG_49_40", (49 << 8) | 0x80: "WEEKEVENTREG_49_80", - (50 << 8) | 0x01: "WEEKEVENTREG_50_01", + (50 << 8) | 0x01: "WEEKEVENTREG_HELPED_GORMAN_DAY_1", (50 << 8) | 0x02: "WEEKEVENTREG_50_02", (50 << 8) | 0x04: "WEEKEVENTREG_50_04", (50 << 8) | 0x08: "WEEKEVENTREG_PROMISED_MIDNIGHT_MEETING", @@ -476,7 +476,7 @@ week_event_reg = { (51 << 8) | 0x10: "WEEKEVENTREG_51_10", (51 << 8) | 0x20: "WEEKEVENTREG_ESCAPED_SAKONS_HIDEOUT", (51 << 8) | 0x40: "WEEKEVENTREG_COUPLES_MASK_CUTSCENE_FINISHED", - (51 << 8) | 0x80: "WEEKEVENTREG_51_80", + (51 << 8) | 0x80: "WEEKEVENTREG_HELPED_GORMAN_DAY_2", (52 << 8) | 0x01: "WEEKEVENTREG_ESCORTED_CREMIA", (52 << 8) | 0x02: "WEEKEVENTREG_52_02", (52 << 8) | 0x04: "WEEKEVENTREG_52_04", @@ -513,10 +513,10 @@ week_event_reg = { (56 << 8) | 0x02: "WEEKEVENTREG_RECEIVED_MARINE_RESEARCH_LAB_FISH_HEART_PIECE", (56 << 8) | 0x04: "WEEKEVENTREG_56_04", (56 << 8) | 0x08: "WEEKEVENTREG_56_08", - (56 << 8) | 0x10: "WEEKEVENTREG_56_10", - (56 << 8) | 0x20: "WEEKEVENTREG_56_20", - (56 << 8) | 0x40: "WEEKEVENTREG_56_40", - (56 << 8) | 0x80: "WEEKEVENTREG_56_80", + (56 << 8) | 0x10: "WEEKEVENTREG_PLAYED_WIND_FISH_AS_HUMAN", + (56 << 8) | 0x20: "WEEKEVENTREG_PLAYED_WIND_FISH_AS_DEKU", + (56 << 8) | 0x40: "WEEKEVENTREG_PLAYED_WIND_FISH_AS_ZORA", + (56 << 8) | 0x80: "WEEKEVENTREG_PLAYED_WIND_FISH_AS_GORON", (57 << 8) | 0x01: "WEEKEVENTREG_57_01", (57 << 8) | 0x02: "WEEKEVENTREG_57_02", (57 << 8) | 0x04: "WEEKEVENTREG_57_04", diff --git a/tools/weekeventregconvert.py b/tools/weekeventregconvert.py index 756c2c5a2f..50c87a9d9e 100755 --- a/tools/weekeventregconvert.py +++ b/tools/weekeventregconvert.py @@ -404,7 +404,7 @@ weekEventReg = { (49 << 8) | 0x20: "WEEKEVENTREG_49_20", (49 << 8) | 0x40: "WEEKEVENTREG_49_40", (49 << 8) | 0x80: "WEEKEVENTREG_49_80", - (50 << 8) | 0x01: "WEEKEVENTREG_50_01", + (50 << 8) | 0x01: "WEEKEVENTREG_HELPED_GORMAN_DAY_1", (50 << 8) | 0x02: "WEEKEVENTREG_50_02", (50 << 8) | 0x04: "WEEKEVENTREG_50_04", (50 << 8) | 0x08: "WEEKEVENTREG_PROMISED_MIDNIGHT_MEETING", @@ -419,7 +419,7 @@ weekEventReg = { (51 << 8) | 0x10: "WEEKEVENTREG_51_10", (51 << 8) | 0x20: "WEEKEVENTREG_ESCAPED_SAKONS_HIDEOUT", (51 << 8) | 0x40: "WEEKEVENTREG_COUPLES_MASK_CUTSCENE_FINISHED", - (51 << 8) | 0x80: "WEEKEVENTREG_51_80", + (51 << 8) | 0x80: "WEEKEVENTREG_HELPED_GORMAN_DAY_2", (52 << 8) | 0x01: "WEEKEVENTREG_ESCORTED_CREMIA", (52 << 8) | 0x02: "WEEKEVENTREG_52_02", (52 << 8) | 0x04: "WEEKEVENTREG_52_04", @@ -456,10 +456,10 @@ weekEventReg = { (56 << 8) | 0x02: "WEEKEVENTREG_RECEIVED_MARINE_RESEARCH_LAB_FISH_HEART_PIECE", (56 << 8) | 0x04: "WEEKEVENTREG_56_04", (56 << 8) | 0x08: "WEEKEVENTREG_56_08", - (56 << 8) | 0x10: "WEEKEVENTREG_56_10", - (56 << 8) | 0x20: "WEEKEVENTREG_56_20", - (56 << 8) | 0x40: "WEEKEVENTREG_56_40", - (56 << 8) | 0x80: "WEEKEVENTREG_56_80", + (56 << 8) | 0x10: "WEEKEVENTREG_PLAYED_WIND_FISH_AS_HUMAN", + (56 << 8) | 0x20: "WEEKEVENTREG_PLAYED_WIND_FISH_AS_DEKU", + (56 << 8) | 0x40: "WEEKEVENTREG_PLAYED_WIND_FISH_AS_ZORA", + (56 << 8) | 0x80: "WEEKEVENTREG_PLAYED_WIND_FISH_AS_GORON", (57 << 8) | 0x01: "WEEKEVENTREG_57_01", (57 << 8) | 0x02: "WEEKEVENTREG_57_02", (57 << 8) | 0x04: "WEEKEVENTREG_57_04",