1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-11 19:43:44 +00:00

Name Message_StartOcarina and related things (#1473)

* name functions and msg ctx var

* start ocarina

* clarifying comments

* typo
This commit is contained in:
fig02 2022-12-20 17:03:41 -05:00 committed by GitHub
parent 7100b17e5f
commit 1c6878b070
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 43 additions and 42 deletions

View file

@ -2008,8 +2008,8 @@ u8 Message_ShouldAdvance(PlayState* play);
void Message_CloseTextbox(PlayState*);
void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor);
void Message_ContinueTextbox(PlayState* play, u16 textId);
void func_8010BD58(PlayState* play, u16 ocarinaActionId);
void func_8010BD88(PlayState* play, u16 ocarinaActionId);
void Message_StartOcarina(PlayState* play, u16 ocarinaActionId);
void Message_StartOcarinaSunsSongDisabled(PlayState* play, u16 ocarinaActionId);
u8 Message_GetState(MessageContext* msgCtx);
void Message_Draw(PlayState* play);
void Message_Update(PlayState* play);

View file

@ -540,8 +540,8 @@ typedef struct {
/* 0xE404 */ s16 textboxColorAlphaTarget;
/* 0xE406 */ s16 textboxColorAlphaCurrent;
/* 0xE408 */ Actor* talkActor;
/* 0xE40C */ s16 disableWarpSongs; // warp song flag set by scene commands
/* 0xE40E */ s16 unk_E40E; // ocarina related
/* 0xE40C */ s16 disableWarpSongs; // disables ability to warp with warp songs
/* 0xE40E */ s16 disableSunsSong; // disables Suns Song effect from occurring after song is played
/* 0xE410 */ u8 lastOcarinaButtonIndex;
} MessageContext; // size = 0xE418

View file

@ -1510,7 +1510,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText
} else {
if (D_8011E1C4 != cmd->base) {
D_8011E1C4 = cmd->base;
func_8010BD58(play, cmd->base);
Message_StartOcarina(play, cmd->base);
return;
}
}
@ -1549,7 +1549,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText
if (dialogState == TEXT_STATE_EVENT) {
if (Message_ShouldAdvance(play)) {
func_8010BD58(play, cmd->base);
Message_StartOcarina(play, cmd->base);
}
}
}

View file

@ -1735,7 +1735,7 @@ void Message_ContinueTextbox(PlayState* play, u16 textId) {
msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget;
}
void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) {
void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
static u16 sOcarinaSongFlagsMap[] = {
(1 << OCARINA_SONG_MINUET),
(1 << OCARINA_SONG_BOLERO),
@ -1873,14 +1873,14 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) {
}
}
void func_8010BD58(PlayState* play, u16 ocarinaActionId) {
play->msgCtx.unk_E40E = 0;
Message_StartOcarina(play, ocarinaActionId);
void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) {
play->msgCtx.disableSunsSong = false;
Message_StartOcarinaImpl(play, ocarinaActionId);
}
void func_8010BD88(PlayState* play, u16 ocarinaActionId) {
play->msgCtx.unk_E40E = 1;
Message_StartOcarina(play, ocarinaActionId);
void Message_StartOcarinaSunsSongDisabled(PlayState* play, u16 ocarinaActionId) {
play->msgCtx.disableSunsSong = true;
Message_StartOcarinaImpl(play, ocarinaActionId);
}
u8 Message_GetState(MessageContext* msgCtx) {
@ -2577,7 +2577,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
case MSGMODE_OCARINA_AWAIT_INPUT:
Message_DrawText(play, &gfx);
if (Message_ShouldAdvance(play)) {
func_8010BD58(play, msgCtx->ocarinaAction);
Message_StartOcarina(play, msgCtx->ocarinaAction);
}
break;
case MSGMODE_SCARECROW_LONG_RECORDING_START:

View file

@ -302,7 +302,7 @@ void func_809C9700(EnBox* this, PlayState* play) {
}
if (this->unk_1FB == ENBOX_STATE_1) {
func_8010BD58(play, OCARINA_ACTION_FREE_PLAY);
Message_StartOcarina(play, OCARINA_ACTION_FREE_PLAY);
this->unk_1FB = ENBOX_STATE_2;
} else if (this->unk_1FB == ENBOX_STATE_2 && play->msgCtx.ocarinaMode == OCARINA_MODE_04) {
if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_LULLABY && this->type == ENBOX_TYPE_9) ||

View file

@ -321,7 +321,7 @@ void func_809FE3C0(EnDu* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (player->stateFlags2 & PLAYER_STATE2_24) {
func_8010BD88(play, OCARINA_ACTION_CHECK_SARIA);
Message_StartOcarinaSunsSongDisabled(play, OCARINA_ACTION_CHECK_SARIA);
player->stateFlags2 |= PLAYER_STATE2_25;
player->unk_6A8 = &this->actor;
EnDu_SetupAction(this, func_809FE4A4);

View file

@ -668,7 +668,7 @@ void func_80A1BE98(EnFr* this, PlayState* play) {
}
}
func_8010BD58(play, OCARINA_ACTION_CHECK_NOWARP);
Message_StartOcarina(play, OCARINA_ACTION_CHECK_NOWARP);
this->actionFunc = EnFr_ListeningToOcarinaNotes;
}
@ -822,7 +822,7 @@ void EnFr_SetupFrogSong(EnFr* this, PlayState* play) {
} else {
this->frogSongTimer = 40;
this->ocarinaNoteIndex = 0;
func_8010BD58(play, OCARINA_ACTION_FROGS);
Message_StartOcarina(play, OCARINA_ACTION_FROGS);
this->ocarinaNote = EnFr_GetNextNoteFrogSong(this->ocarinaNoteIndex);
EnFr_CheckOcarinaInputFrogSong(this->ocarinaNote);
this->actionFunc = EnFr_ContinueFrogSong;

View file

@ -191,7 +191,7 @@ void EnFu_WaitForPlayback(EnFu* this, PlayState* play) {
player->stateFlags2 |= PLAYER_STATE2_23;
// if dialog state is 7, player has played back the song
if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) {
func_8010BD58(play, OCARINA_ACTION_PLAYBACK_STORMS);
Message_StartOcarina(play, OCARINA_ACTION_PLAYBACK_STORMS);
this->actionFunc = func_80A1DBD4;
}
}
@ -205,7 +205,7 @@ void EnFu_TeachSong(EnFu* this, PlayState* play) {
this->behaviorFlags &= ~FU_WAIT;
// 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(play, OCARINA_ACTION_TEACH_STORMS);
Message_StartOcarina(play, OCARINA_ACTION_TEACH_STORMS);
this->actionFunc = EnFu_WaitForPlayback;
}
}

View file

@ -145,7 +145,7 @@ void func_80A4E470(EnGs* this, PlayState* play) {
if (this->unk_19D == 0) {
player->stateFlags2 |= PLAYER_STATE2_23;
if (player->stateFlags2 & PLAYER_STATE2_24) {
func_8010BD58(play, OCARINA_ACTION_FREE_PLAY);
Message_StartOcarina(play, OCARINA_ACTION_FREE_PLAY);
this->unk_19D |= 1;
}

View file

@ -215,7 +215,7 @@ void func_80A8F75C(EnKakasi* this, PlayState* play) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
this->subCamId = OnePointCutscene_Init(play, 2260, -99, &this->actor, CAM_ID_MAIN);
func_8010BD58(play, OCARINA_ACTION_SCARECROW_LONG_RECORDING);
Message_StartOcarina(play, OCARINA_ACTION_SCARECROW_LONG_RECORDING);
this->unk_19A = 0;
this->unk_1B8 = 0.0;
player->stateFlags2 |= PLAYER_STATE2_23;
@ -269,7 +269,7 @@ void func_80A8F9C8(EnKakasi* this, PlayState* play) {
this->subCamId = OnePointCutscene_Init(play, 2270, -99, &this->actor, CAM_ID_MAIN);
play->msgCtx.msgMode = MSGMODE_PAUSED;
func_8002DF54(play, NULL, PLAYER_CSMODE_8);
func_8010BD58(play, OCARINA_ACTION_SCARECROW_LONG_PLAYBACK);
Message_StartOcarina(play, OCARINA_ACTION_SCARECROW_LONG_PLAYBACK);
this->actionFunc = func_80A8FAA4;
}
}

View file

@ -269,7 +269,7 @@ void func_80A91348(EnKakasi3* this, PlayState* play) {
void func_80A915B8(EnKakasi3* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
func_8010BD58(play, OCARINA_ACTION_SCARECROW_SPAWN_RECORDING);
Message_StartOcarina(play, OCARINA_ACTION_SCARECROW_SPAWN_RECORDING);
this->actionFunc = func_80A91620;
}
}
@ -312,7 +312,7 @@ void func_80A91760(EnKakasi3* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
if (this->dialogState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) {
play->msgCtx.msgMode = MSGMODE_PAUSED;
func_8010BD58(play, OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK);
Message_StartOcarina(play, OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK);
this->actionFunc = func_80A917FC;
this->subCamId = OnePointCutscene_Init(play, 2280, -99, &this->actor, CAM_ID_MAIN);
}
@ -333,7 +333,7 @@ void func_80A917FC(EnKakasi3* this, PlayState* play) {
void func_80A9187C(EnKakasi3* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
func_8010BD58(play, OCARINA_ACTION_CHECK_SCARECROW_SPAWN);
Message_StartOcarina(play, OCARINA_ACTION_CHECK_SCARECROW_SPAWN);
this->actionFunc = func_80A918E4;
}
}

View file

@ -368,7 +368,7 @@ void func_80AA106C(EnMa1* this, PlayState* play) {
GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23;
if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_MALON);
func_8010BD58(play, OCARINA_ACTION_TEACH_EPONA);
Message_StartOcarina(play, OCARINA_ACTION_TEACH_EPONA);
this->actor.flags &= ~ACTOR_FLAG_16;
this->actionFunc = func_80AA10EC;
}
@ -377,7 +377,7 @@ void func_80AA106C(EnMa1* this, PlayState* play) {
void func_80AA10EC(EnMa1* this, PlayState* play) {
GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23;
if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) {
func_8010BD58(play, OCARINA_ACTION_PLAYBACK_EPONA);
Message_StartOcarina(play, OCARINA_ACTION_PLAYBACK_EPONA);
this->actionFunc = func_80AA1150;
}
}

View file

@ -266,7 +266,7 @@ void func_80AA204C(EnMa2* this, PlayState* play) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
player->unk_6A8 = &this->actor;
player->stateFlags2 |= PLAYER_STATE2_25;
func_8010BD58(play, OCARINA_ACTION_CHECK_EPONA);
Message_StartOcarina(play, OCARINA_ACTION_CHECK_EPONA);
this->actionFunc = func_80AA20E4;
} else if (this->actor.xzDistToPlayer < 30.0f + (f32)this->collider.dim.radius) {
player->stateFlags2 |= PLAYER_STATE2_23;

View file

@ -764,7 +764,7 @@ void func_80AAB948(EnMd* this, PlayState* play) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
player->stateFlags2 |= PLAYER_STATE2_25;
player->unk_6A8 = &this->actor;
func_8010BD58(play, OCARINA_ACTION_CHECK_SARIA);
Message_StartOcarina(play, OCARINA_ACTION_CHECK_SARIA);
this->actionFunc = func_80AABC10;
return;
}

View file

@ -127,7 +127,7 @@ void func_80ABEF2C(EnOkarinaTag* this, PlayState* play) {
ocarinaSong = 0xA;
}
player->stateFlags2 |= PLAYER_STATE2_23;
func_8010BD58(play, ocarinaSong + OCARINA_ACTION_CHECK_SARIA);
Message_StartOcarina(play, ocarinaSong + OCARINA_ACTION_CHECK_SARIA);
this->actionFunc = func_80ABF0CC;
} else if ((this->actor.xzDistToPlayer < (50.0f + this->interactRange) &&
((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 40.0f)))) {
@ -197,16 +197,16 @@ void func_80ABF28C(EnOkarinaTag* this, PlayState* play) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
switch (this->type) {
case 1:
func_8010BD58(play, OCARINA_ACTION_CHECK_LULLABY);
Message_StartOcarina(play, OCARINA_ACTION_CHECK_LULLABY);
break;
case 2:
func_8010BD58(play, OCARINA_ACTION_CHECK_STORMS);
Message_StartOcarina(play, OCARINA_ACTION_CHECK_STORMS);
break;
case 4:
func_8010BD58(play, OCARINA_ACTION_CHECK_TIME);
Message_StartOcarina(play, OCARINA_ACTION_CHECK_TIME);
break;
case 6:
func_8010BD58(play, OCARINA_ACTION_CHECK_LULLABY);
Message_StartOcarina(play, OCARINA_ACTION_CHECK_LULLABY);
break;
default:
// "Ocarina Invisible-kun demo start check error source"

View file

@ -910,7 +910,7 @@ void EnSkj_WaitInRange(EnSkj* this, PlayState* play) {
player->actor.world.pos.y = sSmallStumpSkullKid.skullkid->actor.world.pos.y;
player->actor.world.pos.z = sSmallStumpSkullKid.skullkid->actor.world.pos.z;
EnSkj_TurnPlayer(sSmallStumpSkullKid.skullkid, player);
func_8010BD88(play, OCARINA_ACTION_CHECK_SARIA);
Message_StartOcarinaSunsSongDisabled(play, OCARINA_ACTION_CHECK_SARIA);
EnSkj_SetupWaitForSong(this);
} else if (D_80B01EA0 != 0) {
player->actor.world.pos.x = sSmallStumpSkullKid.skullkid->actor.world.pos.x;
@ -1401,7 +1401,7 @@ void EnSkj_StartOcarinaMinigame(EnSkj* this, PlayState* play) {
EnSkj_TurnPlayer(this, player);
if (dialogState == TEXT_STATE_CLOSING) {
func_8010BD58(play, OCARINA_ACTION_MEMORY_GAME);
Message_StartOcarina(play, OCARINA_ACTION_MEMORY_GAME);
if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) {
sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCARINA_PLAY_NOTES;
}

View file

@ -171,7 +171,7 @@ s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, PlayState* play) {
if (ObjTimeblock_PlayerIsInRange(this, play)) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
func_8010BD58(play, OCARINA_ACTION_FREE_PLAY);
Message_StartOcarina(play, OCARINA_ACTION_FREE_PLAY);
this->songObserverFunc = ObjTimeblock_WaitForSong;
} else {
player->stateFlags2 |= PLAYER_STATE2_23;

View file

@ -158,7 +158,7 @@ s32 func_80BA2218(ObjWarp2block* this, PlayState* play) {
if (func_80BA1ECC(this, play)) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
func_8010BD58(play, OCARINA_ACTION_FREE_PLAY);
Message_StartOcarina(play, OCARINA_ACTION_FREE_PLAY);
this->func_168 = func_80BA228C;
} else {
player->stateFlags2 |= PLAYER_STATE2_23;

View file

@ -80,7 +80,8 @@ void OceffSpot_End(OceffSpot* this, PlayState* play) {
this->unk_174 -= 0.05f;
} else {
Actor_Kill(&this->actor);
if (gTimeSpeed != 400 && play->msgCtx.unk_E40E == 0 && GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_1) {
if (gTimeSpeed != 400 && !play->msgCtx.disableSunsSong &&
GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_1) {
if (play->msgCtx.ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE ||
play->msgCtx.ocarinaMode != OCARINA_MODE_08) {
gSaveContext.sunsSongState = SUNSSONG_START;

View file

@ -142,7 +142,7 @@ void ShotSun_UpdateFairySpawner(ShotSun* this, PlayState* play) {
}
}
if (this->fairySpawnerState == SPAWNER_OCARINA_START) {
func_8010BD58(play, OCARINA_ACTION_FREE_PLAY);
Message_StartOcarina(play, OCARINA_ACTION_FREE_PLAY);
this->fairySpawnerState = SPAWNER_OCARINA_PLAYING;
} else if (this->fairySpawnerState == SPAWNER_OCARINA_PLAYING && play->msgCtx.ocarinaMode == OCARINA_MODE_04) {
if ((params == 0x40 && play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) ||

View file

@ -12529,7 +12529,7 @@ void func_8084E3C4(Player* this, PlayState* play) {
if (this->stateFlags2 & (PLAYER_STATE2_23 | PLAYER_STATE2_25)) {
this->stateFlags2 |= PLAYER_STATE2_24;
} else {
func_8010BD58(play, OCARINA_ACTION_FREE_PLAY);
Message_StartOcarina(play, OCARINA_ACTION_FREE_PLAY);
}
return;
}