diff --git a/assets/xml/overlays/ovl_En_Gakufu.xml b/assets/xml/overlays/ovl_En_Gakufu.xml new file mode 100644 index 0000000000..92b2672d4c --- /dev/null +++ b/assets/xml/overlays/ovl_En_Gakufu.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/include/functions.h b/include/functions.h index 87846d8d9e..a956de5ee7 100644 --- a/include/functions.h +++ b/include/functions.h @@ -3383,7 +3383,7 @@ void Audio_QueueCmdS8(u32 opArgs, s8 data); // void func_80194528(void); // void func_80194548(void); // void func_80194568(void); -// void func_80194668(void); +u32 Audio_NextRandom(void); void Audio_InitMesgQueues(void); void Audio_InvalDCache(void* buf, size_t size); void Audio_WritebackDCache(void* buf, size_t size); @@ -3455,13 +3455,13 @@ void func_8019AEC0(UNK_PTR param_1, UNK_PTR param_2); // void func_8019AF58(void); // void func_8019AFE8(void); // void func_8019B02C(void); -// void func_8019B074(void); +// void AudioOcarina_MapSongFromNotesToButtons(void); // void func_8019B144(void); // void func_8019B378(void); // void func_8019B38C(void); // void func_8019B3D0(void); // void func_8019B4B8(void); -void func_8019B544(u16 arg0); +void AudioOcarina_StartDefault(u32 arg0); // void func_8019B568(void); // void func_8019B5AC(void); // void func_8019B5EC(void); @@ -3473,7 +3473,7 @@ void func_8019B544(u16 arg0); // void func_8019C1D0(void); // void func_8019C268(void); // void func_8019C2E4(void); -void func_8019C300(s32 arg0); +u32 AudioOcarina_SetInstrumentId(u8 arg0); // void func_8019C398(void); // void func_8019C5A0(void); // void func_8019C8D8(void); @@ -3483,12 +3483,12 @@ void func_8019C300(s32 arg0); // void func_8019CEBC(void); // void func_8019CF6C(void); // void func_8019CF78(void); -// void func_8019CF9C(void); +OcarinaStaff* AudioOcarina_GetPlaybackStaff(void); // void func_8019CFA8(void); -// void func_8019D134(void); -// void func_8019D26C(void); -// void func_8019D488(void); -// void func_8019D4F8(void); +// void AudioOcarina_TerminaWallValidateNotes(void); +void AudioOcarina_TerminaWallGenerateNotes(void); +// void AudioOcarina_MemoryGameSetNumNotes(void); +// void AudioOcarina_MemoryGameGenerateNotes(void); // void func_8019D600(void); void func_8019D758(void); // void func_8019D864(void); diff --git a/include/variables.h b/include/variables.h index 1fccfc97bd..7d3070f581 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1774,7 +1774,7 @@ extern UNK_PTR D_801D88A0; extern UNK_PTR D_801D88A4; // extern UNK_TYPE1 D_801D88A8; // extern UNK_TYPE1 D_801D88B8; -// extern UNK_TYPE1 D_801D8A48; +extern OcarinaSongButtons gOcarinaSongButtons[24]; // extern UNK_TYPE1 D_801D8B20; extern UNK_PTR D_801D8B24; // extern UNK_TYPE2 D_801D8B28; diff --git a/include/z64ocarina.h b/include/z64ocarina.h index cc1662fbd7..ed634f520e 100644 --- a/include/z64ocarina.h +++ b/include/z64ocarina.h @@ -39,7 +39,7 @@ typedef enum { /* 3 */ OCARINA_BTN_C_LEFT, /* 4 */ OCARINA_BTN_C_UP, /* -1 */ OCARINA_BTN_INVALID = 0xFF -} OcarinaButtonIdx; +} OcarinaButtonIndex; // Uses scientific pitch notation relative to middle C // https://en.wikipedia.org/wiki/Scientific_pitch_notation @@ -93,7 +93,7 @@ typedef enum { /** * BFlat4Flag Note: - * Flag for resolving whether (noteIdx = NOTE_BFLAT4) + * Flag for resolving whether (pitch = OCARINA_PITCH_BFLAT4) * gets mapped to either C_RIGHT and C_LEFT * * This is required as C_RIGHT and C_LEFT are the only notes @@ -103,21 +103,21 @@ typedef enum { */ typedef struct { - /* 0x0 */ u8 noteIdx; // number of semitones above middle C + /* 0x0 */ u8 pitch; // number of semitones above middle C /* 0x2 */ u16 length; // number of frames the note is sustained /* 0x4 */ u8 volume; /* 0x5 */ u8 vibrato; - /* 0x6 */ s8 bend; // frequency multiplicative offset from the pitch defined by noteIdx + /* 0x6 */ s8 bend; // frequency multiplicative offset from the pitch defined by pitch /* 0x7 */ u8 BFlat4Flag; // See note above } OcarinaNote; // size = 0x8 typedef struct { /* 0x0 */ u8 numButtons; - /* 0x1 */ u8 buttonIdx[8]; + /* 0x1 */ u8 buttonIndex[8]; } OcarinaSongButtons; // size = 0x9 typedef struct { - /* 0x0 */ u8 buttonIdx; + /* 0x0 */ u8 buttonIndex; /* 0x1 */ u8 state; // original name: "status" /* 0x2 */ u8 pos; // original name: "locate" } OcarinaStaff; // size = 0x3 diff --git a/spec b/spec index 8ec0081541..7aa66bcfb9 100644 --- a/spec +++ b/spec @@ -3745,8 +3745,7 @@ beginseg name "ovl_En_Gakufu" compress include "build/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.o" - include "build/data/ovl_En_Gakufu/ovl_En_Gakufu.data.o" - include "build/data/ovl_En_Gakufu/ovl_En_Gakufu.reloc.o" + include "build/src/overlays/actors/ovl_En_Gakufu/ovl_En_Gakufu_reloc.o" endseg beginseg diff --git a/src/code/audio/code_80192BE0.c b/src/code/audio/code_80192BE0.c index d088db6072..20b4239da7 100644 --- a/src/code/audio/code_80192BE0.c +++ b/src/code/audio/code_80192BE0.c @@ -76,6 +76,6 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_80194568.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_80194668.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/Audio_NextRandom.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/Audio_InitMesgQueues.s") diff --git a/src/code/audio/code_8019AF00.c b/src/code/audio/code_8019AF00.c index 0006122c2c..2e7cc91e17 100644 --- a/src/code/audio/code_8019AF00.c +++ b/src/code/audio/code_8019AF00.c @@ -45,7 +45,7 @@ typedef enum { /* 0xD */ SFX_CHANNEL_OCARINA, // SfxOcarinaBank /* 0xE */ SFX_CHANNEL_VOICE0, // SfxVoiceBank /* 0xF */ SFX_CHANNEL_VOICE1 -} SfxChannelIdx; // playerIdx = 2 +} SfxChannelIndex; // playerIndex = 2 // Global IO ports for sequences, 8 global ports per seqPlayer typedef enum { @@ -66,6 +66,7 @@ typedef struct { /* 0xC */ s32 remainingFrames; } FreqLerp; // size = 0x10 +s32 AudioOcarina_MemoryGameGenerateNotes(void); s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume); void func_801A3238(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 arg3, u8 arg4); @@ -107,7 +108,7 @@ u8 sIsFinalHoursOrSoaring; u8 sObjSoundFanfareSeqId; u8 sObjSoundFanfareRequested; Vec3f sObjSoundFanfarePos; -u8 sObjSoundPlayerIdx; +u8 sObjSoundPlayerIndex; Vec3f sObjSoundPos; s16 sObjSoundFlags; f32 sObjSoundMinDist; @@ -122,7 +123,7 @@ u8 sSpatialSeqFlags; u8 D_801FD432; u8 sSpatialSubBgmFadeTimer; u8 D_801FD434; -u8 sSpatialSeqPlayerIdx; +u8 sSpatialSeqPlayerIndex; u8 sSpatialSeqFadeTimer; u16 D_801FD438; @@ -139,8 +140,8 @@ s32 sOcaInputBtnPress; u8 sOcarinaResetDelay; u8 sOcarinaResetUnused; u8 sOcarinaHasStartedSong; -u8 sFirstOcarinaSongIdx; -u8 sLastOcarinaSongIdx; +u8 sFirstOcarinaSongIndex; +u8 sLastOcarinaSongIndex; u32 sOcarinaAvailSongs; u8 sOcarinaStaffPlayingPos; u16 sMusicStaffPos[OCARINA_SONG_MAX]; @@ -987,11 +988,11 @@ u8 sIsOcarinaInputEnabled = false; s8 sOcarinaInstrumentId = OCARINA_INSTRUMENT_OFF; u8 sCurOcarinaPitch = OCARINA_PITCH_NONE; u8 sPrevOcarinaPitch = 0; -u8 sCurOcarinaButtonIdx = 0; +u8 sCurOcarinaButtonIndex = 0; u8 sMusicStaffPrevPitch = 0; f32 sCurOcarinaBendFreq = 1.0f; f32 sDefaultOcarinaVolume = 0.68503935f; -s8 sCurOcarinaBendIdx = 0; +s8 sCurOcarinaBendIndex = 0; s8 sCurOcarinaVolume = 0x57; s8 sCurOcarinaVibrato = 0; u8 sPlaybackState = 0; @@ -1017,7 +1018,7 @@ u8 sCurOcarinaSong[8] = { u8 sOcarinaSongAppendPos = 0; u8 sOcarinaSongStartingPos = 0; -u8 sButtonToNoteMap[5] = { +u8 sButtonToPitchMap[5] = { OCARINA_PITCH_D4, // OCARINA_BTN_A OCARINA_PITCH_F4, // OCARINA_BTN_C_DOWN OCARINA_PITCH_A4, // OCARINA_BTN_C_RIGHT @@ -1025,7 +1026,7 @@ u8 sButtonToNoteMap[5] = { OCARINA_PITCH_D5, // OCARINA_BTN_C_UP }; -u8 sOcaMemoryGameAppendPos = 0; +u8 sOcarinaMemoryGameAppendPos = 0; u8 sOcaMemoryGameEndPos = 0; u8 sOcaMemoryGameNumNotes[] = { 5, 6, 8 }; OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { @@ -1446,9 +1447,9 @@ u32 sOcarinaRecordTaskStart = 0; u8 sRecordOcarinaPitch = 0; u8 sRecordOcarinaVolume = 0; u8 sRecordOcarinaVibrato = 0; -s8 sRecordOcarinaBendIdx = 0; -u8 sRecordOcarinaButtonIdx = 0; -u8 sPlayedOcarinaSongIdxPlusOne = 0; +s8 sRecordOcarinaBendIndex = 0; +u8 sRecordOcarinaButtonIndex = 0; +u8 sPlayedOcarinaSongIndexPlusOne = 0; u8 sMusicStaffNumNotesPerTest = 0; u8 D_801D8530 = false; u32 D_801D8534 = 0; @@ -1463,7 +1464,7 @@ OcarinaNote* gScarecrowLongSongPtr = sScarecrowsLongSongNotes; u8* gScarecrowSpawnSongPtr = (u8*)&sOcarinaSongNotes[OCARINA_SONG_SCARECROW]; OcarinaNote* sTerminaWallSongPtr = sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL]; -u8 sNoteToButtonMap[16] = { +u8 sPitchToButtonMap[16] = { OCARINA_BTN_A, // OCARINA_PITCH_C4 OCARINA_BTN_A, // OCARINA_PITCH_DFLAT4 OCARINA_BTN_A, // OCARINA_PITCH_D4 @@ -1852,6 +1853,7 @@ const u16 gAudioEnvironmentalSfx[] = { NA_SE_EV_WAVE_S - SFX_FLAG, NA_SE_EV_WAVE_S - SFX_FLAG, }; +extern const u8 sIsOcarinaSongReserved[OCARINA_SONG_MAX]; /** const u8 sIsOcarinaSongReserved[OCARINA_SONG_MAX] = { true, // OCARINA_SONG_SONATA @@ -1889,7 +1891,8 @@ const u8 sIsOcarinaSongReserved[OCARINA_SONG_MAX] = { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B02C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B074.s") +void AudioOcarina_MapSongFromNotesToButtons(u8 noteSongIndex, u8 buttonSongIndex, u8 numButtons); +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_MapSongFromNotesToButtons.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B144.s") @@ -1901,7 +1904,7 @@ const u8 sIsOcarinaSongReserved[OCARINA_SONG_MAX] = { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B4B8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B544.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_StartDefault.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B568.s") @@ -1927,7 +1930,7 @@ const u8 sIsOcarinaSongReserved[OCARINA_SONG_MAX] = { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C2E4.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C300.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_SetInstrumentId.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C398.s") @@ -1956,17 +1959,154 @@ const char sAudioOcarinaUnusedText7[] = "check is over!!! %d %d %d\n"; #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CF78.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CF9C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_GetPlaybackStaff.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CFA8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D134.s") +/** + * Tests to see if the notes from songIndex contain identical notes + * within its song to any of the reserved songIndex from 0 up to maxSongIndex + */ +s32 AudioOcarina_TerminaWallValidateNotes(u8 songIndex, u8 maxSongIndex) { + u8 curSongIndex; + u8 j; + u8 k; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D26C.s") + // loop through all possible songs up to maxSongIndex + for (curSongIndex = 0; curSongIndex < maxSongIndex; curSongIndex++) { + // check to see if the song is reserved or not + if (sIsOcarinaSongReserved[curSongIndex]) { + // starting index to test the song + for (j = 0; j < (9 - gOcarinaSongButtons[curSongIndex].numButtons); j++) { + // loop through each note in the song + for (k = 0; (k < gOcarinaSongButtons[curSongIndex].numButtons) && ((k + j) < 8) && + (gOcarinaSongButtons[curSongIndex].buttonIndex[k] == + gOcarinaSongButtons[songIndex].buttonIndex[(k + j)]); + k++) { + continue; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D488.s") + if (k == gOcarinaSongButtons[curSongIndex].numButtons) { + // failure: songIndex is identical to curSongIndex. + return -1; + } + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D4F8.s") + // success: notes are accepted and used + return 0; +} + +/** + * Generates the notes displayed on the Termina Field wall of musical notes + * Song generation loop alternates between 8 random notes and a random song from Ocarina of Time (OoT). + * Will check to see that the notes are valid by ensuring no playable song is within the selected notes + * All OoT songs are valid, so the outer loop will run a maxiumum of two times. + * i.e. if random notes fails, then the next set of notes will be from a valid OoT song + */ +void AudioOcarina_TerminaWallGenerateNotes(void) { + OcarinaNote* ocarinaNote; + u8 randButtonIndex; + u8 i; + u8 j; + + do { + i = 0; + if (sOcarinaWallCounter++ % 2) { + j = 0; + + for (; i < 8; i++) { + randButtonIndex = Audio_NextRandom() % ARRAY_COUNT(sButtonToPitchMap); + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].pitch = sButtonToPitchMap[randButtonIndex]; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].length = 19; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].volume = 80; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].vibrato = 0; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].bend = 0; + j++; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].pitch = OCARINA_PITCH_NONE; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].length = 3; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].volume = 0; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].vibrato = 0; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].bend = 0; + j++; + } + + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j - 2].length = 90; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j - 1].length = 22; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j + 1].pitch = OCARINA_PITCH_NONE; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j + 1].length = 0; + AudioOcarina_MapSongFromNotesToButtons(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_TERMINA_WALL, 8); + } else { + j = Audio_NextRandom() % ARRAY_COUNT(sOoTOcarinaSongNotes); + ocarinaNote = sOoTOcarinaSongNotes[j]; + + for (; ocarinaNote[i].length != 0; i++) { + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][i] = ocarinaNote[i]; + } + + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][i].pitch = OCARINA_PITCH_NONE; + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][i].length = 0; + AudioOcarina_MapSongFromNotesToButtons(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_TERMINA_WALL, + sOoTOcarinaSongsNumNotes[j]); + } + } while (AudioOcarina_TerminaWallValidateNotes(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_TERMINA_WALL) != 0); +} + +/** + * Unused remnant of OoT + */ +void AudioOcarina_MemoryGameSetNumNotes(u8 minigameRound) { + u8 i; + + if (minigameRound > 2) { + minigameRound = 2; + } + + sOcarinaMemoryGameAppendPos = 0; + sOcaMemoryGameEndPos = sOcaMemoryGameNumNotes[minigameRound]; + + for (i = 0; i < 3; i++) { + AudioOcarina_MemoryGameGenerateNotes(); + } +} + +/** + * Unused remnant of OoT, Id 14 now represent Goron Lullaby Intro instead of the OoT ocarina memory game + * //! @bug calling this function in MM will overwrite Goron Lullaby Intro + */ +#define OCARINA_SONG_MEMORYGAME 14 +s32 AudioOcarina_MemoryGameGenerateNotes(void) { + u32 randButtonIndex; + u8 randPitch; + + if (sOcarinaMemoryGameAppendPos == sOcaMemoryGameEndPos) { + return true; + } + + randButtonIndex = Audio_NextRandom(); + randPitch = sButtonToPitchMap[randButtonIndex % ARRAY_COUNT(sButtonToPitchMap)]; + + if (sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos - 1].pitch == randPitch) { + randPitch = sButtonToPitchMap[(randButtonIndex + 1) % ARRAY_COUNT(sButtonToPitchMap)]; + } + + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].pitch = randPitch; + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].length = 45; + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].volume = 0x50; + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].vibrato = 0; + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].bend = 0; + + sOcarinaMemoryGameAppendPos++; + + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].pitch = OCARINA_PITCH_NONE; + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].length = 0; + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos + 1].pitch = OCARINA_PITCH_NONE; + sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos + 1].length = 0; + if (1) {} + return false; +} +#undef OCARINA_SONG_MEMORYGAME #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D600.s") diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c index 024c857ea5..6923c6679a 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -5,6 +5,7 @@ */ #include "z_en_gakufu.h" +#include "interface/parameter_static/parameter_static.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_2000000) @@ -15,13 +16,15 @@ void EnGakufu_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnGakufu_Update(Actor* thisx, GlobalContext* globalCtx); void EnGakufu_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80AFCB94(EnGakufu* this, GlobalContext* globalCtx); -void func_80AFCBD4(EnGakufu* this, GlobalContext* globalCtx); -void func_80AFCC14(EnGakufu* this, GlobalContext* globalCtx); -void func_80AFCD44(EnGakufu* this, GlobalContext* globalCtx); -void func_80AFCDC8(EnGakufu* this, GlobalContext* globalCtx); +void EnGakufu_ProcessNotes(EnGakufu* this); +s32 EnGakufu_IsPlayerInRange(EnGakufu* this, GlobalContext* globalCtx); +void EnGakufu_DisplayOnTimer(EnGakufu* this, GlobalContext* globalCtx); +void EnGakufu_WaitForTimer(EnGakufu* this, GlobalContext* globalCtx); +void EnGakufu_DoNothing(EnGakufu* this, GlobalContext* globalCtx); +void EnGakufu_GiveReward(EnGakufu* this, GlobalContext* globalCtx); +void EnGakufu_PlayRewardCutscene(EnGakufu* this, GlobalContext* globalCtx); +void EnGakufu_WaitForSong(EnGakufu* this, GlobalContext* globalCtx); -#if 0 const ActorInit En_Gakufu_InitVars = { ACTOR_EN_GAKUFU, ACTORCAT_ITEMACTION, @@ -34,28 +37,257 @@ const ActorInit En_Gakufu_InitVars = { (ActorFunc)EnGakufu_Draw, }; -#endif +Vec3f sRewardDropsSpawnTerminaFieldPos = { + -710.0f, + -123.0f, + -3528.0f, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/func_80AFC960.s") +/** + * Determines which set of `sRewardDrops` to collect when successfully playing the notes on the wall. + * Rewards come in batches of three, and the reward you get depends on the time of day. + */ +u8 sRewardDropsIndex[] = { + 3, // CLOCK_TIME(0, 0) to CLOCKTIME(1, 0) + 12, // CLOCK_TIME(1, 0) to CLOCKTIME(2, 0) + 6, // CLOCK_TIME(2, 0) to CLOCKTIME(3, 0) + 12, // CLOCK_TIME(3, 0) to CLOCKTIME(4, 0) + 9, // CLOCK_TIME(4, 0) to CLOCKTIME(5, 0) + 12, // CLOCK_TIME(5, 0) to CLOCKTIME(6, 0) + 0, // CLOCK_TIME(6, 0) to CLOCKTIME(7, 0) + 12, // CLOCK_TIME(7, 0) to CLOCKTIME(8, 0) + 3, // CLOCK_TIME(8, 0) to CLOCKTIME(9, 0) + 12, // CLOCK_TIME(9, 0) to CLOCKTIME(10, 0) + 6, // CLOCK_TIME(10, 0) to CLOCKTIME(11, 0) + 12, // CLOCK_TIME(11, 0) to CLOCKTIME(12, 0) + 3, // CLOCK_TIME(12, 0) to CLOCKTIME(13, 0) + 12, // CLOCK_TIME(13, 0) to CLOCKTIME(14, 0) + 6, // CLOCK_TIME(14, 0) to CLOCKTIME(15, 0) + 12, // CLOCK_TIME(15, 0) to CLOCKTIME(16, 0) + 3, // CLOCK_TIME(16, 0) to CLOCKTIME(17, 0) + 12, // CLOCK_TIME(17, 0) to CLOCKTIME(18, 0) + 6, // CLOCK_TIME(18, 0) to CLOCKTIME(19, 0) + 12, // CLOCK_TIME(19, 0) to CLOCKTIME(20, 0) + 9, // CLOCK_TIME(20, 0) to CLOCKTIME(21, 0) + 12, // CLOCK_TIME(21, 0) to CLOCKTIME(22, 0) + 6, // CLOCK_TIME(22, 0) to CLOCKTIME(23, 0) + 12, // CLOCK_TIME(23, 0) to CLOCKTIME(0, 0) +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/EnGakufu_Init.s") +/** + * The set of rewards when the song notes on the wall are played. + * Should be thought of as a 2D array: sRewardDrops[5][3] + * i.e. there are 5 sets of possible rewards. And each set gives out three rewards + */ +u8 sRewardDrops[] = { + ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, // Set 1 (index 0) + ITEM00_RUPEE_RED, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, // Set 2 (index 3) + ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, // Set 3 (index 6) + ITEM00_RUPEE_RED, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, // Set 4 (index 9) + ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, // Set 5 (index 12) +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/EnGakufu_Destroy.s") +// y-offsets of ocarina buttons drawn on wall +f32 sOcarinaBtnWallYOffsets[] = { + -4.0f, -2.0f, 0.0f, 1.0f, 3.0f, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/func_80AFCB94.s") +TexturePtr sOcarinaBtnWallTextures[] = { + gOcarinaATex, gOcarinaCDownTex, gOcarinaCRightTex, gOcarinaCLeftTex, gOcarinaCUpTex, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/func_80AFCBD4.s") +#include "overlays/ovl_En_Gakufu/ovl_En_Gakufu.c" -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/func_80AFCC14.s") +void EnGakufu_ProcessNotes(EnGakufu* this) { + OcarinaStaff* playbackStaff; + OcarinaSongButtons* ocarinaSongButtons; + s32 songNumButtons; + s32 i; + s32 songIndex; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/func_80AFCC24.s") + AudioOcarina_TerminaWallGenerateNotes(); + AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_DEFAULT); + AudioOcarina_StartDefault((1 << this->songIndex) | 0x80000000); + playbackStaff = AudioOcarina_GetPlaybackStaff(); + playbackStaff->pos = 0; + playbackStaff->state = 0xFF; + AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/func_80AFCC58.s") + songIndex = this->songIndex; + ocarinaSongButtons = &gOcarinaSongButtons[songIndex]; + songNumButtons = gOcarinaSongButtons[this->songIndex].numButtons; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/func_80AFCD44.s") + for (i = 0; i < songNumButtons; i++) { + this->buttonIndex[i] = ocarinaSongButtons->buttonIndex[i]; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/func_80AFCDC8.s") + for (; i < ARRAY_COUNT(this->buttonIndex); i++) { + this->buttonIndex[i] = OCARINA_BTN_INVALID; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/EnGakufu_Update.s") +void EnGakufu_Init(Actor* thisx, GlobalContext* globalCtx) { + EnGakufu* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gakufu/EnGakufu_Draw.s") + this->songIndex = OCARINA_SONG_TERMINA_WALL; + EnGakufu_ProcessNotes(this); + Actor_SetScale(&this->actor, 1.0f); + + if (GAKUFU_GET_TYPE(&this->actor) == GAKUFU_MILK_BAR) { + this->actor.draw = NULL; + this->actionFunc = EnGakufu_WaitForTimer; + return; + } + + this->actor.flags &= ~ACTOR_FLAG_2000000; + + if (EnGakufu_IsPlayerInRange(this, globalCtx)) { + gSaveContext.eventInf[3] |= 2; + } else { + gSaveContext.eventInf[3] &= (u8)~2; + } + + this->actionFunc = EnGakufu_WaitForSong; + gSaveContext.eventInf[3] &= (u8)~4; +} + +void EnGakufu_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnGakufu* this = THIS; + + if (GAKUFU_GET_TYPE(&this->actor) != GAKUFU_MILK_BAR) { + gSaveContext.eventInf[3] &= (u8)~2; + } +} + +/** + * Special behaviour for the Milk Bar: + * this->actor.home.rot.x acts as a timer. Draws the notes on the back of the stage + * until the timer runs out + */ +void EnGakufu_DisplayOnTimer(EnGakufu* this, GlobalContext* globalCtx) { + if (this->actor.home.rot.x > 0) { + this->actor.draw = EnGakufu_Draw; + this->actor.home.rot.x--; + } else { + this->actor.draw = NULL; + this->actor.home.rot.x = 0; + this->actionFunc = EnGakufu_WaitForTimer; + } +} + +/** + * Special behaviour for the Milk Bar: + * this->actor.home.rot.x acts as a timer. Waits for this timer to be set, + * then rerolls the notes and start displaying the notes + */ +void EnGakufu_WaitForTimer(EnGakufu* this, GlobalContext* globalCtx) { + if (this->actor.home.rot.x > 0) { + EnGakufu_ProcessNotes(this); + this->actionFunc = EnGakufu_DisplayOnTimer; + } +} + +void EnGakufu_DoNothing(EnGakufu* this, GlobalContext* globalCtx) { +} + +s32 EnGakufu_IsPlayerInRange(EnGakufu* this, GlobalContext* globalCtx) { + if (this->actor.xzDistToPlayer < 600.0f) { + return true; + } else { + return false; + } +} + +/** + * Reward the player with three item drops depending on the time of day + */ +void EnGakufu_GiveReward(EnGakufu* this, GlobalContext* globalCtx) { + s32 hour; + s32 i; + + play_sound(NA_SE_SY_CORRECT_CHIME); + + hour = gSaveContext.time * (24.0f / 0x10000); + for (i = 0; i < 3; i++) { + Item_DropCollectible(globalCtx, &sRewardDropsSpawnTerminaFieldPos, sRewardDrops[i + sRewardDropsIndex[hour]]); + } + + this->actionFunc = EnGakufu_DoNothing; +} + +void EnGakufu_PlayRewardCutscene(EnGakufu* this, GlobalContext* globalCtx) { + if (this->actor.cutscene == -1) { + EnGakufu_GiveReward(this, globalCtx); + } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + EnGakufu_GiveReward(this, globalCtx); + } else { + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } +} + +/** + * Waits for the notes on the wall to be played and updates the corresponding flags + * (gSaveContext.eventInf[3] & 2) is checking if Player is within range of the wall + * (gSaveContext.eventInf[3] & 4) is checking if Player has played the notes of the wall + */ +void EnGakufu_WaitForSong(EnGakufu* this, GlobalContext* globalCtx) { + if (gSaveContext.eventInf[3] & 2) { + if (gSaveContext.eventInf[3] & 4) { + gSaveContext.eventInf[3] &= (u8)~2; + gSaveContext.eventInf[3] &= (u8)~4; + + this->actionFunc = EnGakufu_PlayRewardCutscene; + EnGakufu_PlayRewardCutscene(this, globalCtx); + this->actor.draw = NULL; + } else if (!EnGakufu_IsPlayerInRange(this, globalCtx)) { + gSaveContext.eventInf[3] &= (u8)~2; + } + } else if (EnGakufu_IsPlayerInRange(this, globalCtx)) { + gSaveContext.eventInf[3] |= 2; + } +} + +void EnGakufu_Update(Actor* thisx, GlobalContext* globalCtx) { + EnGakufu* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void EnGakufu_Draw(Actor* thisx, GlobalContext* globalCtx) { + s32 i; + s32 pad; + EnGakufu* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + gDPPipeSync(POLY_XLU_DISP++); + gSPSegment(POLY_XLU_DISP++, 0x02, globalCtx->interfaceCtx.parameterSegment); + + for (i = 0; (i < ARRAY_COUNT(this->buttonIndex)) && (this->buttonIndex[i] != OCARINA_BTN_INVALID); i++) { + Matrix_StatePush(); + Matrix_InsertTranslation(30 * i - 105, sOcarinaBtnWallYOffsets[this->buttonIndex[i]] * 7.5f, 1.0f, + MTXMODE_APPLY); + Matrix_Scale(0.6f, 0.6f, 0.6f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE); + gDPLoadTextureBlock(POLY_XLU_DISP++, sOcarinaBtnWallTextures[this->buttonIndex[i]], G_IM_FMT_IA, G_IM_SIZ_8b, + 16, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, + G_TX_NOLOD); + + if (this->buttonIndex[i] == OCARINA_BTN_A) { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 80, 150, 255, 200); + } else { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 50, 200); + } + + gSPDisplayList(POLY_XLU_DISP++, gGakufuButtonIndexDL); + + Matrix_StatePop(); + } + + gSPSegment(POLY_XLU_DISP++, 0x02, globalCtx->sceneSegment); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.h b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.h index b4bf8643c7..9ba96a7246 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.h +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.h @@ -7,10 +7,18 @@ struct EnGakufu; typedef void (*EnGakufuActionFunc)(struct EnGakufu*, GlobalContext*); +#define GAKUFU_GET_TYPE(thisx) ((thisx)->params & 0xF) + +typedef enum { + /* 0x00 */ GAKUFU_TERMINA_FIELD, + /* 0x01 */ GAKUFU_MILK_BAR +} GakufuType; + typedef struct EnGakufu { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0xC]; - /* 0x0150 */ EnGakufuActionFunc actionFunc; + /* 0x000 */ Actor actor; + /* 0x144 */ s32 songIndex; + /* 0x148 */ u8 buttonIndex[8]; + /* 0x150 */ EnGakufuActionFunc actionFunc; } EnGakufu; // size = 0x154 extern const ActorInit En_Gakufu_InitVars; diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 08a49d8914..88c236e980 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -1104,14 +1104,14 @@ void func_80B98AD0(EnZot* this, GlobalContext* globalCtx) { func_801477B4(globalCtx); this->actionFunc = func_80B98CA8; gSaveContext.weekEventReg[41] &= (u8)~0x20; - func_8019C300(0); + AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); break; case 0x12BA: func_801477B4(globalCtx); this->actionFunc = func_80B98CA8; gSaveContext.weekEventReg[41] |= 0x20; - func_8019C300(0); + AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); break; default: @@ -1140,7 +1140,7 @@ void func_80B98BF4(EnZot* this, GlobalContext* globalCtx) { void func_80B98CA8(EnZot* this, GlobalContext* globalCtx) { if (func_800B8718(&this->actor, &globalCtx->state)) { globalCtx->msgCtx.ocarinaMode = 4; - func_8019B544(0xFFFF); + AudioOcarina_StartDefault(0xFFFF); this->actionFunc = func_80B98BF4; this->actor.flags |= ACTOR_FLAG_10000; func_800B8614(&this->actor, globalCtx, 120.0f); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index e7afe14527..0373f06e25 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -3718,7 +3718,7 @@ 0x80194528:("func_80194528",), 0x80194548:("func_80194548",), 0x80194568:("func_80194568",), - 0x80194668:("func_80194668",), + 0x80194668:("Audio_NextRandom",), 0x801946E4:("Audio_InitMesgQueues",), 0x80194710:("Audio_InvalDCache",), 0x80194750:("Audio_WritebackDCache",), @@ -3809,13 +3809,13 @@ 0x8019AF58:("func_8019AF58",), 0x8019AFE8:("func_8019AFE8",), 0x8019B02C:("func_8019B02C",), - 0x8019B074:("func_8019B074",), + 0x8019B074:("AudioOcarina_MapSongFromNotesToButtons",), 0x8019B144:("func_8019B144",), 0x8019B378:("func_8019B378",), 0x8019B38C:("func_8019B38C",), 0x8019B3D0:("func_8019B3D0",), 0x8019B4B8:("func_8019B4B8",), - 0x8019B544:("func_8019B544",), + 0x8019B544:("AudioOcarina_StartDefault",), 0x8019B568:("func_8019B568",), 0x8019B5AC:("func_8019B5AC",), 0x8019B5EC:("func_8019B5EC",), @@ -3828,7 +3828,7 @@ 0x8019C1D0:("func_8019C1D0",), 0x8019C268:("func_8019C268",), 0x8019C2E4:("func_8019C2E4",), - 0x8019C300:("func_8019C300",), + 0x8019C300:("AudioOcarina_SetInstrumentId",), 0x8019C398:("func_8019C398",), 0x8019C5A0:("func_8019C5A0",), 0x8019C8D8:("func_8019C8D8",), @@ -3838,12 +3838,12 @@ 0x8019CEBC:("func_8019CEBC",), 0x8019CF6C:("func_8019CF6C",), 0x8019CF78:("func_8019CF78",), - 0x8019CF9C:("func_8019CF9C",), + 0x8019CF9C:("AudioOcarina_GetPlaybackStaff",), 0x8019CFA8:("func_8019CFA8",), - 0x8019D134:("func_8019D134",), - 0x8019D26C:("func_8019D26C",), - 0x8019D488:("func_8019D488",), - 0x8019D4F8:("func_8019D4F8",), + 0x8019D134:("AudioOcarina_TerminaWallValidateNotes",), + 0x8019D26C:("AudioOcarina_TerminaWallGenerateNotes",), + 0x8019D488:("AudioOcarina_MemoryGameSetNumNotes",), + 0x8019D4F8:("AudioOcarina_MemoryGameGenerateNotes",), 0x8019D600:("func_8019D600",), 0x8019D758:("func_8019D758",), 0x8019D864:("func_8019D864",), @@ -12776,14 +12776,14 @@ 0x80AFAA44:("EnPm_PostLimbDraw",), 0x80AFABAC:("EnPm_TransformLimbDraw",), 0x80AFACAC:("EnPm_Draw",), - 0x80AFC960:("func_80AFC960",), + 0x80AFC960:("EnGakufu_ProcessNotes",), 0x80AFCA94:("EnGakufu_Init",), 0x80AFCB64:("EnGakufu_Destroy",), - 0x80AFCB94:("func_80AFCB94",), - 0x80AFCBD4:("func_80AFCBD4",), - 0x80AFCC14:("func_80AFCC14",), - 0x80AFCC24:("func_80AFCC24",), - 0x80AFCC58:("func_80AFCC58",), + 0x80AFCB94:("EnGakufu_DisplayOnTimer",), + 0x80AFCBD4:("EnGakufu_WaitForTimer",), + 0x80AFCC14:("EnGakufu_DoNothing",), + 0x80AFCC24:("EnGakufu_IsPlayerInRange",), + 0x80AFCC58:("EnGakufu_GiveReward",), 0x80AFCD44:("func_80AFCD44",), 0x80AFCDC8:("func_80AFCDC8",), 0x80AFCE70:("EnGakufu_Update",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index cf0c734af4..2b6e72ca91 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -2351,11 +2351,11 @@ 0x801D6FB8:("sOcarinaInstrumentId","UNK_TYPE1","",0x1), 0x801D6FBC:("sCurOcarinaPitch","UNK_TYPE1","",0x1), 0x801D6FC0:("sPrevOcarinaPitch","UNK_TYPE1","",0x1), - 0x801D6FC4:("sCurOcarinaButtonIdx","UNK_TYPE1","",0x1), + 0x801D6FC4:("sCurOcarinaButtonIndex","UNK_TYPE1","",0x1), 0x801D6FC8:("sMusicStaffPrevPitch","UNK_TYPE1","",0x1), 0x801D6FCC:("sCurOcarinaBendFreq","f32","",0x4), 0x801D6FD0:("sDefaultOcarinaVolume","UNK_TYPE1","",0x1), - 0x801D6FD4:("sCurOcarinaBendIdx","UNK_TYPE1","",0x1), + 0x801D6FD4:("sCurOcarinaBendIndex","UNK_TYPE1","",0x1), 0x801D6FD8:("sCurOcarinaVolume","UNK_TYPE1","",0x1), 0x801D6FDC:("sCurOcarinaVibrato","UNK_TYPE1","",0x1), 0x801D6FE0:("sPlaybackState","UNK_TYPE1","",0x1), @@ -2377,8 +2377,8 @@ 0x801D7020:("sCurOcarinaSong","u8","[8]",0x8), 0x801D7028:("sOcarinaSongAppendPos","UNK_TYPE1","",0x1), 0x801D702C:("sOcarinaSongStartingPos","UNK_TYPE1","",0x1), - 0x801D7030:("sButtonToNoteMap","UNK_TYPE1","",0x1), - 0x801D7038:("sOcaMemoryGameAppendPos","UNK_TYPE1","",0x1), + 0x801D7030:("sButtonToPitchMap","UNK_TYPE1","",0x1), + 0x801D7038:("sOcarinaMemoryGameAppendPos","UNK_TYPE1","",0x1), 0x801D703C:("sOcaMemoryGameEndPos","UNK_TYPE1","",0x1), 0x801D7040:("sOcaMemoryGameNumNotes","UNK_TYPE1","",0x1), 0x801D7044:("sOcarinaSongNotes","OcarinaNote","[24][20]",0xF00), @@ -2393,9 +2393,9 @@ 0x801D8514:("sRecordOcarinaPitch","UNK_TYPE1","",0x1), 0x801D8518:("sRecordOcarinaVolume","UNK_TYPE1","",0x1), 0x801D851C:("sRecordOcarinaVibrato","UNK_TYPE1","",0x1), - 0x801D8520:("sRecordOcarinaBendIdx","UNK_TYPE1","",0x1), - 0x801D8524:("sRecordOcarinaButtonIdx","UNK_TYPE1","",0x1), - 0x801D8528:("sPlayedOcarinaSongIdxPlusOne","UNK_TYPE1","",0x1), + 0x801D8520:("sRecordOcarinaBendIndex","UNK_TYPE1","",0x1), + 0x801D8524:("sRecordOcarinaButtonIndex","UNK_TYPE1","",0x1), + 0x801D8528:("sPlayedOcarinaSongIndexPlusOne","UNK_TYPE1","",0x1), 0x801D852C:("sMusicStaffNumNotesPerTest","UNK_TYPE1","",0x1), 0x801D8530:("D_801D8530","UNK_TYPE1","",0x1), 0x801D8534:("D_801D8534","UNK_TYPE4","",0x4), @@ -2404,7 +2404,7 @@ 0x801D889C:("gScarecrowLongSongPtr","UNK_PTR","",0x4), 0x801D88A0:("gScarecrowSpawnSongPtr","UNK_PTR","",0x4), 0x801D88A4:("sTerminaWallSongPtr","UNK_PTR","",0x4), - 0x801D88A8:("sNoteToButtonMap","UNK_TYPE1","",0x1), + 0x801D88A8:("sPitchToButtonMap","UNK_TYPE1","",0x1), 0x801D88B8:("sCustomSequenceScript","UNK_TYPE1","",0x1), 0x801D8A48:("gOcarinaSongButtons","UNK_TYPE1","",0x1), 0x801D8B20:("sScarecrowAfterCreditsState","UNK_TYPE1","",0x1), @@ -4326,7 +4326,7 @@ 0x801FD3D9:("sObjSoundFanfareSeqId","UNK_TYPE1","",0x1), 0x801FD3DA:("sObjSoundFanfareRequested","UNK_TYPE1","",0x1), 0x801FD3E0:("sObjSoundFanfarePos","UNK_TYPE1","",0x1), - 0x801FD3EC:("sObjSoundPlayerIdx","UNK_TYPE1","",0x1), + 0x801FD3EC:("sObjSoundPlayerIndex","UNK_TYPE1","",0x1), 0x801FD3F0:("sObjSoundPos","UNK_TYPE1","",0x1), 0x801FD3FC:("sObjSoundFlags","UNK_TYPE1","",0x1), 0x801FD400:("sObjSoundMinDist","UNK_TYPE1","",0x1), @@ -4341,7 +4341,7 @@ 0x801FD432:("D_801FD432","UNK_TYPE1","",0x1), 0x801FD433:("sSpatialSubBgmFadeTimer","UNK_TYPE1","",0x1), 0x801FD434:("D_801FD434","UNK_TYPE1","",0x1), - 0x801FD435:("sSpatialSeqPlayerIdx","UNK_TYPE1","",0x1), + 0x801FD435:("sSpatialSeqPlayerIndex","UNK_TYPE1","",0x1), 0x801FD436:("sSpatialSeqFadeTimer","UNK_TYPE1","",0x1), 0x801FD438:("D_801FD438","UNK_TYPE1","",0x1), 0x801FD43A:("sPlayingStaff","OcarinaStaff","",0x3), @@ -4356,8 +4356,8 @@ 0x801FD460:("sOcarinaResetDelay","UNK_TYPE1","",0x1), 0x801FD461:("sOcarinaResetUnused","UNK_TYPE1","",0x1), 0x801FD462:("sOcarinaHasStartedSong","UNK_TYPE1","",0x1), - 0x801FD463:("sFirstOcarinaSongIdx","UNK_TYPE1","",0x1), - 0x801FD464:("sLastOcarinaSongIdx","UNK_TYPE1","",0x1), + 0x801FD463:("sFirstOcarinaSongIndex","UNK_TYPE1","",0x1), + 0x801FD464:("sLastOcarinaSongIndex","UNK_TYPE1","",0x1), 0x801FD468:("sOcarinaAvailSongs","UNK_TYPE1","",0x1), 0x801FD46C:("sOcarinaStaffPlayingPos","UNK_TYPE1","",0x1), 0x801FD470:("sMusicStaffPos","UNK_TYPE1","",0x1), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index bc8fd6f48c..bf777cba18 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -3234,7 +3234,7 @@ asm/non_matchings/code/code_80192BE0/func_8019440C.s,func_8019440C,0x8019440C,0x asm/non_matchings/code/code_80192BE0/func_80194528.s,func_80194528,0x80194528,0x8 asm/non_matchings/code/code_80192BE0/func_80194548.s,func_80194548,0x80194548,0x8 asm/non_matchings/code/code_80192BE0/func_80194568.s,func_80194568,0x80194568,0x40 -asm/non_matchings/code/code_80192BE0/func_80194668.s,func_80194668,0x80194668,0x1F +asm/non_matchings/code/code_80192BE0/Audio_NextRandom.s,Audio_NextRandom,0x80194668,0x1F asm/non_matchings/code/code_80192BE0/Audio_InitMesgQueues.s,Audio_InitMesgQueues,0x801946E4,0xB asm/non_matchings/code/code_80194710/Audio_InvalDCache.s,Audio_InvalDCache,0x80194710,0x10 asm/non_matchings/code/code_80194710/Audio_WritebackDCache.s,Audio_WritebackDCache,0x80194750,0x10 @@ -3325,13 +3325,13 @@ asm/non_matchings/code/code_8019AF00/func_8019AF00.s,func_8019AF00,0x8019AF00,0x asm/non_matchings/code/code_8019AF00/func_8019AF58.s,func_8019AF58,0x8019AF58,0x24 asm/non_matchings/code/code_8019AF00/func_8019AFE8.s,func_8019AFE8,0x8019AFE8,0x11 asm/non_matchings/code/code_8019AF00/func_8019B02C.s,func_8019B02C,0x8019B02C,0x12 -asm/non_matchings/code/code_8019AF00/func_8019B074.s,func_8019B074,0x8019B074,0x34 +asm/non_matchings/code/code_8019AF00/AudioOcarina_MapSongFromNotesToButtons.s,AudioOcarina_MapSongFromNotesToButtons,0x8019B074,0x34 asm/non_matchings/code/code_8019AF00/func_8019B144.s,func_8019B144,0x8019B144,0x8D asm/non_matchings/code/code_8019AF00/func_8019B378.s,func_8019B378,0x8019B378,0x5 asm/non_matchings/code/code_8019AF00/func_8019B38C.s,func_8019B38C,0x8019B38C,0x11 asm/non_matchings/code/code_8019AF00/func_8019B3D0.s,func_8019B3D0,0x8019B3D0,0x3A asm/non_matchings/code/code_8019AF00/func_8019B4B8.s,func_8019B4B8,0x8019B4B8,0x23 -asm/non_matchings/code/code_8019AF00/func_8019B544.s,func_8019B544,0x8019B544,0x9 +asm/non_matchings/code/code_8019AF00/AudioOcarina_StartDefault.s,AudioOcarina_StartDefault,0x8019B544,0x9 asm/non_matchings/code/code_8019AF00/func_8019B568.s,func_8019B568,0x8019B568,0x11 asm/non_matchings/code/code_8019AF00/func_8019B5AC.s,func_8019B5AC,0x8019B5AC,0x10 asm/non_matchings/code/code_8019AF00/func_8019B5EC.s,func_8019B5EC,0x8019B5EC,0xB @@ -3344,7 +3344,7 @@ asm/non_matchings/code/code_8019AF00/func_8019C1C0.s,func_8019C1C0,0x8019C1C0,0x asm/non_matchings/code/code_8019AF00/func_8019C1D0.s,func_8019C1D0,0x8019C1D0,0x26 asm/non_matchings/code/code_8019AF00/func_8019C268.s,func_8019C268,0x8019C268,0x1F asm/non_matchings/code/code_8019AF00/func_8019C2E4.s,func_8019C2E4,0x8019C2E4,0x7 -asm/non_matchings/code/code_8019AF00/func_8019C300.s,func_8019C300,0x8019C300,0x26 +asm/non_matchings/code/code_8019AF00/AudioOcarina_SetInstrumentId.s,AudioOcarina_SetInstrumentId,0x8019C300,0x26 asm/non_matchings/code/code_8019AF00/func_8019C398.s,func_8019C398,0x8019C398,0x82 asm/non_matchings/code/code_8019AF00/func_8019C5A0.s,func_8019C5A0,0x8019C5A0,0xCE asm/non_matchings/code/code_8019AF00/func_8019C8D8.s,func_8019C8D8,0x8019C8D8,0x10C @@ -3354,12 +3354,12 @@ asm/non_matchings/code/code_8019AF00/func_8019CE6C.s,func_8019CE6C,0x8019CE6C,0x asm/non_matchings/code/code_8019AF00/func_8019CEBC.s,func_8019CEBC,0x8019CEBC,0x2C asm/non_matchings/code/code_8019AF00/func_8019CF6C.s,func_8019CF6C,0x8019CF6C,0x3 asm/non_matchings/code/code_8019AF00/func_8019CF78.s,func_8019CF78,0x8019CF78,0x9 -asm/non_matchings/code/code_8019AF00/func_8019CF9C.s,func_8019CF9C,0x8019CF9C,0x3 +asm/non_matchings/code/code_8019AF00/AudioOcarina_GetPlaybackStaff.s,AudioOcarina_GetPlaybackStaff,0x8019CF9C,0x3 asm/non_matchings/code/code_8019AF00/func_8019CFA8.s,func_8019CFA8,0x8019CFA8,0x63 -asm/non_matchings/code/code_8019AF00/func_8019D134.s,func_8019D134,0x8019D134,0x4E -asm/non_matchings/code/code_8019AF00/func_8019D26C.s,func_8019D26C,0x8019D26C,0x87 -asm/non_matchings/code/code_8019AF00/func_8019D488.s,func_8019D488,0x8019D488,0x1C -asm/non_matchings/code/code_8019AF00/func_8019D4F8.s,func_8019D4F8,0x8019D4F8,0x42 +asm/non_matchings/code/code_8019AF00/AudioOcarina_TerminaWallValidateNotes.s,AudioOcarina_TerminaWallValidateNotes,0x8019D134,0x4E +asm/non_matchings/code/code_8019AF00/AudioOcarina_TerminaWallGenerateNotes.s,AudioOcarina_TerminaWallGenerateNotes,0x8019D26C,0x87 +asm/non_matchings/code/code_8019AF00/AudioOcarina_MemoryGameSetNumNotes.s,AudioOcarina_MemoryGameSetNumNotes,0x8019D488,0x1C +asm/non_matchings/code/code_8019AF00/AudioOcarina_MemoryGameGenerateNotes.s,AudioOcarina_MemoryGameGenerateNotes,0x8019D4F8,0x42 asm/non_matchings/code/code_8019AF00/func_8019D600.s,func_8019D600,0x8019D600,0x56 asm/non_matchings/code/code_8019AF00/func_8019D758.s,func_8019D758,0x8019D758,0x43 asm/non_matchings/code/code_8019AF00/func_8019D864.s,func_8019D864,0x8019D864,0x14