diff --git a/include/functions.h b/include/functions.h index 832399af65..20440ca5ce 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1583,7 +1583,7 @@ void func_800F03C0(GlobalContext* globalCtx); void func_800F048C(GlobalContext* globalCtx, Vec3f* param_2, u8 param_3, u16 param_4, u8 param_5); void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* position, s32 param_3, u16 sfxId); void func_800F0590(GlobalContext* globalCtx, Vec3f* arg1, s32 arg2, s32 arg3); -// void func_800F05C0(void); +u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx); // void func_800F07C0(void); // void func_800F0888(void); // void func_800F0944(void); diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index a674f4564d..7308b33f4e 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -1,3 +1,62 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/func_800F05C0.s") +u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) { + if (INV_CONTENT(ITEM_OCARINA) == ITEM_OCARINA) { + return 0; + } + if (CURRENT_DAY <= 0) { + return 0; + } + if (gSaveContext.weekEventReg[88] & 0x20) { + return 0; + } + if (gSaveContext.weekEventReg[79] & 0x10) { + if (gSaveContext.weekEventReg[8] & 0x40) { + return 0; + } + return 0x224; + } + if (!(gSaveContext.weekEventReg[8] & 0x80)) { + if (gSaveContext.weekEventReg[9] & 1) { + return 0x21E; + } + if (globalCtx->sceneNum == SCENE_YOUSEI_IZUMI) { + return 0; + } + return 0x21D; + } + if (gSaveContext.magicAcquired != true) { + return 0x21F; + } + if (INV_CONTENT(ITEM_DEED_LAND) == ITEM_DEED_LAND) { + if (globalCtx->sceneNum != SCENE_OKUJOU) { + return 0x244; + } + return 0; + } + if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_MOON_TEAR) { + if (gSaveContext.weekEventReg[86] & 4) { + return 0x242; + } + return 0x243; + } + if (gSaveContext.weekEventReg[74] & 0x20) { + return 0x223; + } + if (gSaveContext.weekEventReg[73] & 0x80) { + return 0x222; + } + if (gSaveContext.weekEventReg[73] & 0x20) { + return 0x221; + } + if (gSaveContext.weekEventReg[77] & 2) { + if (gSaveContext.weekEventReg[73] & 0x10) { + return 0x240; + } + return 0x241; + } + if ((gSaveContext.weekEventReg[86] & 2) || (gSaveContext.weekEventReg[73] & 0x40)) { + return 0x23F; + } + return 0x220; +} diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index f3780d6a6e..9ce11b32c1 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1615,7 +1615,7 @@ 0x800F048C:("func_800F048C",), 0x800F0568:("Audio_PlaySoundAtPosition",), 0x800F0590:("func_800F0590",), - 0x800F05C0:("func_800F05C0",), + 0x800F05C0:("ElfMessage_GetFirstCycleHint",), 0x800F07C0:("func_800F07C0",), 0x800F0888:("func_800F0888",), 0x800F0944:("func_800F0944",),