Audio BGM Macros (#460)

* Introduce bgms

* Fill in bgm enums

* Rename bgm to clearer names

* Fix spacing

* Fix "No_Music" define

* remove comment

* Improve bgm names, found another seqId function

* Another seqId function

* Another name change

* Woods of Mystery -> Sarias Song

* add saria's song bgm to pierre

* Another bgm function found!

* Add bgm's to `gSaveContext.seqIndex`
This commit is contained in:
engineer124
2021-11-21 01:01:37 +11:00
committed by GitHub
parent 97425f68ae
commit ea17d924e4
28 changed files with 184 additions and 54 deletions
+1 -1
View File
@@ -296,7 +296,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2D54.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2DE0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2E54.s")
+2 -2
View File
@@ -5,9 +5,9 @@ SaveContext gSaveContext;
void SaveContext_Init(void) {
bzero(&gSaveContext, sizeof(gSaveContext));
gSaveContext.playerForm = 0;
gSaveContext.seqIndex = 0xFF;
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.unk_3F46 = 0;
gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.cutsceneTrigger = 0;
gSaveContext.unk_3F4D = 0;
+2 -2
View File
@@ -45,7 +45,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
gSaveContext.unk_3DC0 = 2000;
gSaveContext.naviTimer = 0;
gSaveContext.seqIndex = 0xFF;
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.eventInf[0] = 0;
gSaveContext.eventInf[1] = 0;
@@ -66,7 +66,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
break;
case GAMEOVER_DEATH_FADE_OUT:
if (func_801A8A50(1) != 32) {
if (func_801A8A50(1) != NA_BGM_GAME_OVER) {
func_80169F78(globalCtx);
if (gSaveContext.respawnFlag != -7) {
gSaveContext.respawnFlag = -6;
+1 -1
View File
@@ -449,7 +449,7 @@ void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->soundCtx.seqIndex = cmd->soundSettings.musicSeq;
globalCtx->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX;
if (gSaveContext.seqIndex == 0xFF || func_801A8A50(0) == 0x57) {
if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) {
audio_setBGM(cmd->soundSettings.bgmId);
}
}
+2 -2
View File
@@ -1005,7 +1005,7 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) {
}
if (spB0->unk_0144 >= 10) {
Audio_QueueSeqCmd(0x8021);
Audio_QueueSeqCmd(NA_BGM_CLEAR_BOSS | 0x8000);
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_INBOSS_DEAD_OLD);
@@ -1342,7 +1342,7 @@ void func_809DC78C(Actor* thisx, GlobalContext* globalCtx) {
if (D_809E0430 != 0) {
D_809E0430--;
if (D_809E0430 == 0) {
Audio_QueueSeqCmd(0x801B);
Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000);
}
}
}
@@ -449,7 +449,7 @@ void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, GlobalContext* globalCtx) {
void EnBigpo_SpawnCutsceneStage7(EnBigpo* this) {
this->idleTimer = 15;
if (this->unkBool204 == false) {
func_801A2E54(0x38);
func_801A2E54(NA_BGM_MINI_BOSS);
this->unkBool204 = true;
}
this->actionFunc = EnBigpo_SpawnCutsceneStage8;
@@ -535,7 +535,7 @@ void EnBigpo_WarpingIn(EnBigpo* this, GlobalContext* globalCtx) {
if (this->idleTimer == 32) {
this->mainColor.a = 255; // fully visible
if (this->unkBool204 == false) {
func_801A2E54(0x38);
func_801A2E54(NA_BGM_MINI_BOSS);
this->unkBool204 = true;
}
EnBigpo_SetupIdleFlying(this);
@@ -528,7 +528,7 @@ void func_8089B3D4(EnDinofos* this, GlobalContext* globalCtx) {
Math_Vec3f_StepTo(&camera->eye, &this->unk_2BC, 10.0f);
this->unk_290++;
if (this->unk_290 == 10) {
func_801A2E54(0x38);
func_801A2E54(NA_BGM_MINI_BOSS);
}
sp28.x = this->actor.world.pos.x;
@@ -547,7 +547,7 @@ void func_8089B3D4(EnDinofos* this, GlobalContext* globalCtx) {
void func_8089B4A4(EnDinofos* this) {
if (this->unk_290 < 10) {
func_801A2E54(0x38);
func_801A2E54(NA_BGM_MINI_BOSS);
}
Animation_PlayOnce(&this->skelAnime, &D_0600C974);
this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x;
@@ -464,7 +464,7 @@ void EnElforg_FreeFloating(EnElforg* this, GlobalContext* globalCtx) {
gSaveContext.inventory.strayFairies[gSaveContext.unk_48C8]++;
func_801518B0(globalCtx, 0x11, NULL);
if (gSaveContext.inventory.strayFairies[(void)0, gSaveContext.unk_48C8] >= 15) {
func_801A3098(0x922);
func_801A3098(NA_BGM_GET_ITEM | 0x900);
}
}
}
+2 -2
View File
@@ -543,7 +543,7 @@ void func_80962660(EnFu* this, GlobalContext* globalCtx) {
player->stateFlags1 |= 0x20;
this->unk_53C = 0;
func_800BDC5C(&this->skelAnime, sAnimations, 3);
func_801A2BB8(0x25);
func_801A2BB8(NA_BGM_MINI_GAME_2);
if (this->unk_542 == 0) {
if (this->unk_546 == 1) {
func_80961EC8(globalCtx);
@@ -805,7 +805,7 @@ void func_80962F4C(EnFu* this, GlobalContext* globalCtx) {
func_801A2C20();
gSaveContext.unk_3DE0[4] = 0;
gSaveContext.unk_3DD0[4] = 5;
func_801A3098(0x922);
func_801A3098(NA_BGM_GET_ITEM | 0x900);
func_8011B4E0(globalCtx, 1);
this->unk_54A = 3;
func_809632D0(this);
@@ -339,12 +339,12 @@ void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actor.params == 2) {
if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f) {
func_801A1DB8(&this->actor.projectedPos, 0x2E, 540.0f);
func_801A1DB8(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f);
}
return;
}
if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 200.0f) {
func_801A1D44(&this->actor.projectedPos, 0x2E, 540.0f);
func_801A1D44(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f);
}
if (this->unusedTimer != 0) {
this->unusedTimer--;
+2 -2
View File
@@ -860,7 +860,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) {
break;
case 0x3475:
SET_FLAGS_START_RACE;
func_800FD750(0x40);
func_800FD750(NA_BGM_HORSE);
globalCtx->nextEntranceIndex = 0xCE50;
globalCtx->unk_1887F = 5;
globalCtx->sceneLoadFlag = 0x14;
@@ -1107,7 +1107,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) {
break;
case 0x3475:
SET_FLAGS_START_RACE;
func_800FD750(0x40);
func_800FD750(NA_BGM_HORSE);
globalCtx->nextEntranceIndex = 0xCE50;
globalCtx->unk_1887F = 5;
globalCtx->sceneLoadFlag = 0x14;
@@ -1699,7 +1699,7 @@ void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) {
} else {
func_80B454BC(this, globalCtx);
func_80B452EC(this, globalCtx);
Audio_QueueSeqCmd(0x800D);
Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000);
func_80B46F88(this);
}
} else if (D_80B4E940 == 3) {
@@ -1987,7 +1987,7 @@ void func_80B46EE8(EnInvadepoh* this, GlobalContext* globalCtx) {
this->actionTimer--;
if (this->actionTimer <= 0) {
ActorCutscene_Stop(D_80B50404[0]);
Audio_QueueSeqCmd(0x800D);
Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000);
func_80B46F88(this);
}
}
@@ -2036,7 +2036,7 @@ void func_80B470E0(EnInvadepoh* this) {
void func_80B47108(EnInvadepoh* this, GlobalContext* globalCtx) {
if (this->actionTimer == 100) {
func_801A3098(0x19);
func_801A3098(NA_BGM_CLEAR_EVENT);
}
this->actionTimer--;
if (this->actionTimer <= 0) {
@@ -811,7 +811,7 @@ void EnKakasi_DancingRemark(EnKakasi* this, GlobalContext* globalCtx) {
if (currentDay == 3 && gSaveContext.isNight) {
EnKakasi_SetupDigAway(this);
} else {
func_801A2BB8(0x3E);
func_801A2BB8(NA_BGM_SARIAS_SONG);
EnKakasi_SetupDanceNightAway(this);
}
}
+1 -1
View File
@@ -751,7 +751,7 @@ void EnMa4_SetupHorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) {
gSaveContext.weekEventReg[0x8] &= (u8)~0x01;
this->actionFunc = EnMa4_HorsebackGameEnd;
Audio_QueueSeqCmd(NA_BGM_STOP);
Audio_QueueSeqCmd(0x8041);
Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000);
}
void EnMa4_HorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) {
@@ -903,7 +903,7 @@ void EnMaYto_SetupAfterMilkRunInit(EnMaYto* this) {
if (gSaveContext.weekEventReg[0x34] & 1) { // if (ProtectedCremia)
EnMaYto_SetFaceExpression(this, 3, 1);
} else {
func_801A3098(9);
func_801A3098(NA_BGM_FAILURE_1);
EnMaYto_SetFaceExpression(this, 5, 2);
}
this->actionFunc = EnMaYto_AfterMilkRunInit;
@@ -462,7 +462,7 @@ void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, GlobalContext* globalCtx) {
ActorCutscene_Start(this->actor.cutscene, &this->actor);
this->actionFunc = EnMinifrog_SetupNextFrogChoir;
this->timer = 5;
func_801A1F00(3, 0x5A);
func_801A1F00(3, NA_BGM_FROG_SONG);
this->flags |= 0x100;
globalCtx->setPlayerTalkAnim(globalCtx, &D_0400E2A8, 0);
} else {
+4 -4
View File
@@ -367,7 +367,7 @@ void func_8095AE60(EnOwl* this, GlobalContext* globalCtx) {
void func_8095AEC0(EnOwl* this, GlobalContext* globalCtx) {
func_8095A920(this, globalCtx);
if (func_8095A978(this, globalCtx, 0x7D0, 360.0f, 200.0f)) {
func_801A3098(0x45);
func_801A3098(NA_BGM_OWL);
this->actionFunc = func_8095AE60;
}
}
@@ -396,7 +396,7 @@ void func_8095AF2C(EnOwl* this, GlobalContext* globalCtx) {
void func_8095AFEC(EnOwl* this, GlobalContext* globalCtx) {
func_8095A920(this, globalCtx);
if (func_8095A978(this, globalCtx, 0xBF6, 200.0f, 100.0f)) {
func_801A3098(0x45);
func_801A3098(NA_BGM_OWL);
this->actionFunc = func_8095AF2C;
this->unk_406 = 0;
this->actionFlags |= 0x40;
@@ -511,7 +511,7 @@ void func_8095B574(EnOwl* this, GlobalContext* globalCtx) {
func_8095A920(this, globalCtx);
if (func_800B84D0(&this->actor, globalCtx)) {
this->actionFunc = func_8095BA84;
func_801A3098(0x45);
func_801A3098(NA_BGM_OWL);
this->actionFlags |= 0x40;
this->unk_406 = 2;
} else if (this->actor.xzDistToPlayer < 200.0f) {
@@ -721,7 +721,7 @@ void func_8095BE0C(EnOwl* this, GlobalContext* globalCtx) {
func_8095A920(this, globalCtx);
if (func_800B84D0(&this->actor, globalCtx)) {
this->actionFunc = func_8095BA84;
func_801A3098(0x45);
func_801A3098(NA_BGM_OWL);
this->unk_406 = 1;
this->actionFlags |= 0x40;
} else if (this->actor.textId == 0xBF0) {
@@ -590,9 +590,9 @@ void func_80BD9840(EnPamera* this, GlobalContext* globalCtx) {
func_80BD9904(this);
}
if (gSaveContext.weekEventReg[14] & 4) {
func_801A0204(0x27);
func_801A0204(NA_BGM_MUSIC_BOX_HOUSE);
} else {
func_801A0204(0x1F);
func_801A0204(NA_BGM_INSIDE_A_HOUSE);
}
}
@@ -1054,7 +1054,7 @@ void EnPametfrog_LookAround(EnPametfrog* this, GlobalContext* globalCtx) {
this->actor.shape.rot.y = this->actor.world.rot.y;
if (SkelAnime_Update(&this->skelAnime) && (func_801690CC(globalCtx) == 0)) {
if (!this->unk_2AE) {
func_801A2E54(0x38);
func_801A2E54(NA_BGM_MINI_BOSS);
this->unk_2AE = true;
}
EnPametfrog_SetupJumpToLink(this);
@@ -1274,7 +1274,7 @@ void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, GlobalContext* g
void EnPametfrog_TransitionGekkoSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
if (this->actor.params == GEKKO_INIT_SNAPPER) {
func_801A2E54(0x38);
func_801A2E54(NA_BGM_MINI_BOSS);
EnPametfrog_SetupRunToSnapper(this);
}
}
@@ -1139,7 +1139,7 @@ void func_80BAD230(EnSuttari* this, GlobalContext* globalCtx) {
this->textId = 0x2A31;
func_801518B0(globalCtx, this->textId, &this->actor);
this->flags1 |= 0x4000;
Audio_QueueSeqCmd(0x8003);
Audio_QueueSeqCmd(NA_BGM_CHASE | 0x8000);
this->actionFunc = func_80BAD380;
} else {
ActorCutscene_SetIntentToPlay(this->cutscenes[1]);
@@ -337,7 +337,7 @@ void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) {
func_80123F2C(globalCtx, 80);
this->unk_26A = 1;
this->actionFunc = func_809C80C0;
func_801A2BB8(0x25);
func_801A2BB8(NA_BGM_MINI_GAME_2);
break;
case 0xA32:
@@ -657,7 +657,7 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) {
func_80112AFC(globalCtx);
func_80123F2C(globalCtx, 0x63);
this->unk_26A = 1;
func_801A2BB8(0x25);
func_801A2BB8(NA_BGM_MINI_GAME_2);
this->actionFunc = func_809C8808;
break;
@@ -1160,7 +1160,7 @@ void func_809C898C(EnSyatekiMan* this, GlobalContext* globalCtx) {
func_801A2C20();
this->actionFunc = func_809C8BF0;
if (this->unk_280 == 50) {
func_801A3098(0x922);
func_801A3098(NA_BGM_GET_ITEM | 0x900);
func_8011B4E0(globalCtx, 1);
}
}
+3 -3
View File
@@ -612,7 +612,7 @@ s32 func_80BA47E0(EnToto* this, GlobalContext* globalCtx) {
s32 func_80BA49A4(EnToto* this, GlobalContext* globalCtx) {
func_800B7298(globalCtx, NULL, 0x44);
func_801A31EC(0x54, 4, this->unk2B3 ^ 0xF);
func_801A31EC(NA_BGM_BALLAD_OF_THE_WIND_FISH, 4, this->unk2B3 ^ 0xF);
this->unk2B1 = 4;
return 0;
}
@@ -621,8 +621,8 @@ s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) {
Actor* actor;
if (DECR(this->unk2B1) == 0) {
if (!func_801A2DE0(0x54)) {
actor = (Actor*)GET_PLAYER(globalCtx); // Needed for regalloc, possible FAKE MATCH
if (!Audio_IsSequencePlaying(NA_BGM_BALLAD_OF_THE_WIND_FISH)) {
actor = &GET_PLAYER(globalCtx)->actor;
actor = actor->next;
while (actor != NULL) {
Actor_MarkForDeath(actor);
@@ -45,7 +45,7 @@ void Select_LoadGame(SelectContext* this, u32 entranceIndex, s32 opt) {
}
gSaveContext.respawn[0].entranceIndex = 0xFFFF;
gSaveContext.seqIndex = 0xFF;
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.showTitleCard = true;
gSaveContext.respawnFlag = 0;
+1 -1
View File
@@ -127,7 +127,7 @@ void Title_Main(GameState* thisx) {
Title_UpdateCounters(this);
Title_Draw(&this->gameState);
if (this->exit) {
gSaveContext.seqIndex = 0xFF;
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.gameMode = 1;