1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 14:34:32 +00:00

Audio Ocarina Documentation (#1026)

* Begin ocarina documentation

* Many ocarina-related docs

* More ocarina docs

* Introduce Ocarina Fonts Enum

* Fix ocarina font enum

* Fix incorrect documentation, more documentation

* Ocarina recording documentation

* cleanup

* Small touch-ups

* Fix font -> instrument

* format

* Better docs on playback, memory game

* more cleanup

* Add z64ocarina.h

* Clean up names

* final cleanup

* typo

* Fix description

* better docs

* Fix channel -> channelIdx

* Fix old "font" name to correct "instrument" name, add io port docs

* Add comments to clarify certain lines/functions

* format

* Rename noteIdx to pitch

* Missed a name

* Add comment on pitch

* `reset` -> `SetInstrument` and `displayed` -> `playback`

* Clarify audio_update and windmill comment

* Minor PR fixes

* Revert Audio_Update because there are 2 different Audio_Update functions

* PR Feedback

* Ocarina Idx -> Index

* Introduce OCARINA_BTN_C_RIGHT_OR_C_LEFT

* PR Suggestions

* Next PR Suggestions

* Next PR Feedback

* consistency

* Better docs (PR)

* Better comment
This commit is contained in:
engineer124 2022-05-10 02:59:23 +10:00 committed by GitHub
parent 6cd8029cd5
commit 95b4317931
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1872 additions and 1593 deletions

View file

@ -208,7 +208,7 @@ static u8 sJumpOrder[] = {
};
static u8 sOcarinaNotes[] = {
OCARINA_NOTE_A, OCARINA_NOTE_C_DOWN, OCARINA_NOTE_C_RIGHT, OCARINA_NOTE_C_LEFT, OCARINA_NOTE_C_UP,
OCARINA_BTN_A, OCARINA_BTN_C_DOWN, OCARINA_BTN_C_RIGHT, OCARINA_BTN_C_LEFT, OCARINA_BTN_C_UP,
};
void EnFr_OrientUnderwater(EnFr* this) {
@ -696,21 +696,22 @@ void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx) {
case OCARINA_MODE_04:
EnFr_OcarinaMistake(this, globalCtx);
break;
case OCARINA_MODE_01: // Ocarina note played, but no song played
switch (globalCtx->msgCtx.lastOcaNoteIdx) { // Jumping frogs in open ocarina based on ocarina note played
case OCARINA_NOTE_A:
case OCARINA_MODE_01: // Ocarina note played, but no song played
switch (globalCtx->msgCtx.lastOcarinaButtonIndex) {
// Jumping frogs in open ocarina based on ocarina note played
case OCARINA_BTN_A:
EnFr_SetupJumpingUp(this, FROG_BLUE);
break;
case OCARINA_NOTE_C_DOWN:
case OCARINA_BTN_C_DOWN:
EnFr_SetupJumpingUp(this, FROG_YELLOW);
break;
case OCARINA_NOTE_C_RIGHT:
case OCARINA_BTN_C_RIGHT:
EnFr_SetupJumpingUp(this, FROG_RED);
break;
case OCARINA_NOTE_C_LEFT:
case OCARINA_BTN_C_LEFT:
EnFr_SetupJumpingUp(this, FROG_PURPLE);
break;
case OCARINA_NOTE_C_UP:
case OCARINA_BTN_C_UP:
EnFr_SetupJumpingUp(this, FROG_WHITE);
break;
}
@ -834,7 +835,7 @@ s32 EnFr_IsFrogSongComplete(EnFr* this, GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
u8 ocarinaNoteIndex;
if (this->ocarinaNote == (*msgCtx).lastOcaNoteIdx) { // required to match, possibly an array?
if (this->ocarinaNote == (*msgCtx).lastOcarinaButtonIndex) { // required to match, possibly an array?
this->ocarinaNoteIndex++;
ocarinaNoteIndex = this->ocarinaNoteIndex;
if (1) {}
@ -856,7 +857,7 @@ void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx) {
Message_CloseTextbox(globalCtx);
this->reward = GI_NONE;
func_80078884(NA_SE_SY_OCARINA_ERROR);
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
sEnFrPointers.flags = 12;
EnFr_DeactivateButterfly();
this->actionFunc = EnFr_Deactivate;
@ -889,20 +890,20 @@ void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx) {
if (globalCtx->msgCtx.msgMode == MSGMODE_FROGS_WAITING) {
globalCtx->msgCtx.msgMode = MSGMODE_FROGS_START;
switch (globalCtx->msgCtx.lastOcaNoteIdx) {
case OCARINA_NOTE_A:
switch (globalCtx->msgCtx.lastOcarinaButtonIndex) {
case OCARINA_BTN_A:
EnFr_SetupJumpingUp(this, FROG_BLUE);
break;
case OCARINA_NOTE_C_DOWN:
case OCARINA_BTN_C_DOWN:
EnFr_SetupJumpingUp(this, FROG_YELLOW);
break;
case OCARINA_NOTE_C_RIGHT:
case OCARINA_BTN_C_RIGHT:
EnFr_SetupJumpingUp(this, FROG_RED);
break;
case OCARINA_NOTE_C_LEFT:
case OCARINA_BTN_C_LEFT:
EnFr_SetupJumpingUp(this, FROG_PURPLE);
break;
case OCARINA_NOTE_C_UP:
case OCARINA_BTN_C_UP:
EnFr_SetupJumpingUp(this, FROG_WHITE);
}
if (EnFr_IsFrogSongComplete(this, globalCtx)) {
@ -921,7 +922,7 @@ void EnFr_SetupReward(EnFr* this, GlobalContext* globalCtx, u8 unkCondition) {
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
this->actionFunc = EnFr_PrintTextBox;
}

View file

@ -203,7 +203,8 @@ void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) {
// if dialog state is 2, start song demonstration
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
this->behaviorFlags &= ~FU_WAIT;
Audio_OcaSetInstrument(4); // seems to be related to setting instrument type
// Ocarina is set to harp here but is immediately overwritten to the grind organ in the message system
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_HARP);
func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_STORMS);
this->actionFunc = EnFu_WaitForPlayback;
}

View file

@ -92,7 +92,7 @@ void func_80A8F28C(EnKakasi* this) {
}
void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) {
s16 ocarinaNote = globalCtx->msgCtx.lastOcaNoteIdx;
s16 ocarinaNote = globalCtx->msgCtx.lastOcarinaButtonIndex;
s16 currentFrame;
if (arg != 0) {
@ -105,30 +105,30 @@ void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) {
ocarinaNote = this->unk_1A6;
}
switch (ocarinaNote) {
case OCARINA_NOTE_A:
case OCARINA_BTN_A:
this->unk_19A++;
if (this->unk_1A4 == 0) {
this->unk_1A4 = 1;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_KAKASHI_ROLL);
}
break;
case OCARINA_NOTE_C_DOWN:
case OCARINA_BTN_C_DOWN:
this->unk_19A++;
this->unk_1B8 = 1.0f;
break;
case OCARINA_NOTE_C_RIGHT:
case OCARINA_BTN_C_RIGHT:
this->unk_19A++;
if (this->unk_1AC == 0) {
this->unk_1AC = 0x1388;
}
break;
case OCARINA_NOTE_C_LEFT:
case OCARINA_BTN_C_LEFT:
this->unk_19A++;
if (this->unk_1A8 == 0) {
this->unk_1A8 = 0x1388;
}
break;
case OCARINA_NOTE_C_UP:
case OCARINA_BTN_C_UP:
this->unk_19A++;
this->unk_1B8 = 2.0f;
break;
@ -178,13 +178,13 @@ void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx) {
this->unk_196 = TEXT_STATE_DONE;
if (!LINK_IS_ADULT) {
this->unk_194 = false;
if (gSaveContext.scarecrowCustomSongSet) {
if (gSaveContext.scarecrowLongSongSet) {
this->actor.textId = 0x407A;
this->unk_196 = TEXT_STATE_EVENT;
}
} else {
this->unk_194 = true;
if (gSaveContext.scarecrowCustomSongSet) {
if (gSaveContext.scarecrowLongSongSet) {
this->actor.textId = 0x4079;
this->unk_196 = TEXT_STATE_EVENT;
}
@ -341,7 +341,7 @@ void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (BREG(3) != 0) {
osSyncPrintf("\n\n");
// "flag!"
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.scarecrowCustomSongSet);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.scarecrowLongSongSet);
}
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount,

View file

@ -96,7 +96,7 @@ void func_80A90E28(EnKakasi3* this) {
void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) {
s16 currentFrame;
s16 ocarinaNote = globalCtx->msgCtx.lastOcaNoteIdx;
s16 ocarinaNote = globalCtx->msgCtx.lastOcarinaButtonIndex;
if (arg != 0) {
if (this->unk_19C[3] == 0) {
@ -108,30 +108,30 @@ void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) {
ocarinaNote = this->unk_1A6;
}
switch (ocarinaNote) {
case OCARINA_NOTE_A:
case OCARINA_BTN_A:
this->unk_19A++;
if (this->unk_1A4 == 0) {
this->unk_1A4 = 1;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_KAKASHI_ROLL);
}
break;
case OCARINA_NOTE_C_DOWN:
case OCARINA_BTN_C_DOWN:
this->unk_19A++;
this->unk_1B8 = 1.0f;
break;
case OCARINA_NOTE_C_RIGHT:
case OCARINA_BTN_C_RIGHT:
this->unk_19A++;
if (this->unk_1AE == 0x0) {
this->unk_1AE = 0x1388;
}
break;
case OCARINA_NOTE_C_LEFT:
case OCARINA_BTN_C_LEFT:
this->unk_19A++;
if (this->unk_1AA == 0x0) {
this->unk_1AA = 0x1388;
}
break;
case OCARINA_NOTE_C_UP:
case OCARINA_BTN_C_UP:
this->unk_19A++;
this->unk_1B8 = 2.0f;
break;
@ -269,7 +269,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_RECORDING);
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_SPAWN_RECORDING);
this->actionFunc = func_80A91620;
}
}
@ -312,7 +312,7 @@ void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) {
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_PLAYBACK);
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK);
this->actionFunc = func_80A917FC;
this->camId = OnePointCutscene_Init(globalCtx, 2280, -99, &this->actor, MAIN_CAM);
}
@ -333,7 +333,7 @@ void func_80A917FC(EnKakasi3* this, GlobalContext* globalCtx) {
void func_80A9187C(EnKakasi3* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SCARECROW);
func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SCARECROW_SPAWN);
this->actionFunc = func_80A918E4;
}
}

View file

@ -367,7 +367,7 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) {
void func_80AA106C(EnMa1* this, GlobalContext* globalCtx) {
GET_PLAYER(globalCtx)->stateFlags2 |= PLAYER_STATE2_23;
if (this->unk_1E8.unk_00 == 2) {
Audio_OcaSetInstrument(2);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_MALON);
func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_EPONA);
this->actor.flags &= ~ACTOR_FLAG_16;
this->actionFunc = func_80AA10EC;

View file

@ -1440,7 +1440,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) {
sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState =
SKULL_KID_OCARINA_PLAY_NOTES;
}
Message_UpdateOcarinaGame(globalCtx);
Message_UpdateOcarinaMemoryGame(globalCtx);
}
break;
case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT:
@ -1448,7 +1448,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) {
sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState = SKULL_KID_OCARINA_WAIT;
}
if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) {
Message_UpdateOcarinaGame(globalCtx);
Message_UpdateOcarinaMemoryGame(globalCtx);
this->songFailTimer = 160;
}
break;
@ -1472,8 +1472,8 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) {
SKULL_KID_OCARINA_PLAY_NOTES;
}
this->songFailTimer = 160;
Audio_OcaSetInstrument(6); // related instrument sound (flute?)
Audio_OcaSetSongPlayback(OCARINA_SONG_MEMORY_GAME + 1, 1);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_FLUTE);
AudioOcarina_SetPlaybackSong(OCARINA_SONG_MEMORY_GAME + 1, 1);
globalCtx->msgCtx.msgMode = MSGMODE_MEMORY_GAME_LEFT_SKULLKID_PLAYING;
globalCtx->msgCtx.stateTimer = 2;
}

View file

@ -2779,7 +2779,7 @@ s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s3
}
if (func_8084E3C4 == this->func_674) {
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
this->stateFlags2 &= ~(PLAYER_STATE2_24 | PLAYER_STATE2_25);
} else if (func_808507F4 == this->func_674) {
func_80832340(globalCtx, this);