mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 23:36:22 +00:00
Document Scene Sequences and Remaining SeqFlags (#1308)
* Begin scene sequence docs * Better docs * cleanup * Better Docs * cleanup * Move flag * Off -> None * Fix comment * spacing * address pr, spot -> resumePoint * SEQ_IO_VAL_NONE * missed one
This commit is contained in:
parent
b6d9a8183b
commit
76803f1534
7 changed files with 100 additions and 67 deletions
|
@ -1866,8 +1866,8 @@ void Audio_ClearSariaBgm(void);
|
||||||
void Audio_ClearSariaBgmAtPos(Vec3f* pos);
|
void Audio_ClearSariaBgmAtPos(Vec3f* pos);
|
||||||
void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax);
|
void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax);
|
||||||
void Audio_ClearSariaBgm2(void);
|
void Audio_ClearSariaBgm2(void);
|
||||||
void func_800F5510(u16 seqId);
|
void Audio_PlayMorningSceneSequence(u16 seqId);
|
||||||
void func_800F5550(u16 seqId);
|
void Audio_PlaySceneSequence(u16 seqId);
|
||||||
void func_800F574C(f32 scaleTempoAndFreq, u8 duration);
|
void func_800F574C(f32 scaleTempoAndFreq, u8 duration);
|
||||||
void func_800F5718(void);
|
void func_800F5718(void);
|
||||||
void func_800F5918(void);
|
void func_800F5918(void);
|
||||||
|
@ -1879,7 +1879,7 @@ void func_800F5B58(void);
|
||||||
void func_800F5BF0(u8 natureAmbienceId);
|
void func_800F5BF0(u8 natureAmbienceId);
|
||||||
void Audio_PlayFanfare(u16);
|
void Audio_PlayFanfare(u16);
|
||||||
void func_800F5C2C(void);
|
void func_800F5C2C(void);
|
||||||
void func_800F5E18(u8 seqPlayerIndex, u16 seqId, u8 fadeTimer, s8 ioPort, s8 ioData);
|
void Audio_PlaySequenceWithSeqPlayerIO(u8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, s8 ioData);
|
||||||
void Audio_SetSequenceMode(u8 seqMode);
|
void Audio_SetSequenceMode(u8 seqMode);
|
||||||
void Audio_SetBgmEnemyVolume(f32 dist);
|
void Audio_SetBgmEnemyVolume(f32 dist);
|
||||||
void func_800F6268(f32 dist, u16);
|
void func_800F6268(f32 dist, u16);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#define IS_SEQUENCE_CHANNEL_VALID(ptr) ((u32)(ptr) != (u32)&gAudioCtx.sequenceChannelNone)
|
#define IS_SEQUENCE_CHANNEL_VALID(ptr) ((u32)(ptr) != (u32)&gAudioCtx.sequenceChannelNone)
|
||||||
#define SEQ_NUM_CHANNELS 16
|
#define SEQ_NUM_CHANNELS 16
|
||||||
|
#define SEQ_IO_VAL_NONE -1
|
||||||
|
|
||||||
#define MAX_CHANNELS_PER_BANK 3
|
#define MAX_CHANNELS_PER_BANK 3
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
|
||||||
channel->freqScale = 1.0f;
|
channel->freqScale = 1.0f;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) {
|
for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) {
|
||||||
channel->soundScriptIO[i] = -1;
|
channel->soundScriptIO[i] = SEQ_IO_VAL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel->unused = false;
|
channel->unused = false;
|
||||||
|
@ -1664,12 +1664,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
||||||
|
|
||||||
case 0x10:
|
case 0x10:
|
||||||
if (lowBits < 8) {
|
if (lowBits < 8) {
|
||||||
channel->soundScriptIO[lowBits] = -1;
|
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||||
if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value,
|
if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value,
|
||||||
&channel->soundScriptIO[lowBits]) == -1) {}
|
&channel->soundScriptIO[lowBits]) == -1) {}
|
||||||
} else {
|
} else {
|
||||||
lowBits -= 8;
|
lowBits -= 8;
|
||||||
channel->soundScriptIO[lowBits] = -1;
|
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||||
if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100,
|
if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100,
|
||||||
&channel->soundScriptIO[lowBits]) == -1) {}
|
&channel->soundScriptIO[lowBits]) == -1) {}
|
||||||
}
|
}
|
||||||
|
@ -1678,7 +1678,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
||||||
case 0x60:
|
case 0x60:
|
||||||
scriptState->value = channel->soundScriptIO[lowBits];
|
scriptState->value = channel->soundScriptIO[lowBits];
|
||||||
if (lowBits < 2) {
|
if (lowBits < 2) {
|
||||||
channel->soundScriptIO[lowBits] = -1;
|
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1992,7 +1992,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
||||||
case 0x80:
|
case 0x80:
|
||||||
seqScript->value = seqPlayer->soundScriptIO[cmdLowBits];
|
seqScript->value = seqPlayer->soundScriptIO[cmdLowBits];
|
||||||
if (cmdLowBits < 2) {
|
if (cmdLowBits < 2) {
|
||||||
seqPlayer->soundScriptIO[cmdLowBits] = -1;
|
seqPlayer->soundScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2123,7 +2123,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
|
||||||
seqPlayer->applyBend = false;
|
seqPlayer->applyBend = false;
|
||||||
|
|
||||||
for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) {
|
for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) {
|
||||||
seqPlayer->soundScriptIO[j] = -1;
|
seqPlayer->soundScriptIO[j] = SEQ_IO_VAL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
seqPlayer->muteBehavior = MUTE_BEHAVIOR_SOFTEN | MUTE_BEHAVIOR_STOP_NOTES;
|
seqPlayer->muteBehavior = MUTE_BEHAVIOR_SOFTEN | MUTE_BEHAVIOR_STOP_NOTES;
|
||||||
|
|
|
@ -112,8 +112,11 @@ u8 sPrevSeqMode = 0;
|
||||||
f32 sAudioEnemyDist = 0.0f;
|
f32 sAudioEnemyDist = 0.0f;
|
||||||
s8 sAudioEnemyVol = 127;
|
s8 sAudioEnemyVol = 127;
|
||||||
u16 sPrevMainBgmSeqId = NA_BGM_DISABLED;
|
u16 sPrevMainBgmSeqId = NA_BGM_DISABLED;
|
||||||
u8 D_8013062C = 0;
|
|
||||||
u8 D_80130630 = NA_BGM_GENERAL_SFX;
|
#define SEQ_RESUME_POINT_NONE 0xC0
|
||||||
|
u8 sSeqResumePoint = 0;
|
||||||
|
u8 sPrevSceneSeqId = NA_BGM_GENERAL_SFX;
|
||||||
|
|
||||||
u32 sNumFramesStill = 0;
|
u32 sNumFramesStill = 0;
|
||||||
u32 sNumFramesMoving = 0;
|
u32 sNumFramesMoving = 0;
|
||||||
u8 sAudioBaseFilter = 0;
|
u8 sAudioBaseFilter = 0;
|
||||||
|
@ -128,12 +131,31 @@ u8 sSeqModeInput = 0;
|
||||||
#define SEQ_FLAG_FANFARE (1 << 1)
|
#define SEQ_FLAG_FANFARE (1 << 1)
|
||||||
#define SEQ_FLAG_FANFARE_GANON (1 << 2)
|
#define SEQ_FLAG_FANFARE_GANON (1 << 2)
|
||||||
#define SEQ_FLAG_RESTORE (1 << 3) // required for func_800F5B58 to restore a sequence after func_800F5ACC
|
#define SEQ_FLAG_RESTORE (1 << 3) // required for func_800F5B58 to restore a sequence after func_800F5ACC
|
||||||
#define SEQ_FLAG_4 (1 << 4)
|
|
||||||
#define SEQ_FLAG_5 (1 << 5)
|
/**
|
||||||
#define SEQ_FLAG_6 (1 << 6)
|
* These two sequence flags work together to implement a “resume playing from where you left off” system for scene
|
||||||
|
* sequences when leaving and returning to a scene. For a scene to resume playing from the point where it left off, it
|
||||||
|
* must have `SEQ_FLAG_RESUME` attached to it. Then, if the scene changes and the new scene sequence contain
|
||||||
|
* `SEQ_FLAG_RESUME_PREV`, the point from the previous scene sequence will be stored. Then, when returning to the
|
||||||
|
* scene with the sequence `SEQ_FLAG_RESUME`, then the sequence will resume playing from where it left off.
|
||||||
|
*
|
||||||
|
* There are only 5 sequences with `SEQ_FLAG_RESUME`, and all 5 of those sequences have special sequence
|
||||||
|
* instructions in their .seq files to read io port 7 and branch to different starting points along the sequence
|
||||||
|
* i.e. this system will only work for: kokiri forest, kakariko child, kakariko adult, zoras domain, gerudo valley
|
||||||
|
*/
|
||||||
|
#define SEQ_FLAG_RESUME (1 << 4)
|
||||||
|
#define SEQ_FLAG_RESUME_PREV (1 << 5)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will write a value of 1 to ioPort 7 when called through the scene. How it's used depends on the sequence:
|
||||||
|
* NA_BGM_CHAMBER_OF_SAGES - ioPort 7 is never read from
|
||||||
|
* NA_BGM_FILE_SELECT - ioPort 7 skips the harp intro when a value of 1 is written to it.
|
||||||
|
* Note: NA_BGM_FILE_SELECT is not called through the scene. So this flag serves no purpose
|
||||||
|
*/
|
||||||
|
#define SEQ_FLAG_SKIP_HARP_INTRO (1 << 6)
|
||||||
#define SEQ_FLAG_NO_AMBIENCE (1 << 7)
|
#define SEQ_FLAG_NO_AMBIENCE (1 << 7)
|
||||||
|
|
||||||
u8 sSeqFlags[0x6E] = {
|
u8 sSeqFlags[] = {
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_GENERAL_SFX
|
SEQ_FLAG_FANFARE, // NA_BGM_GENERAL_SFX
|
||||||
SEQ_FLAG_ENEMY, // NA_BGM_NATURE_BACKGROUND
|
SEQ_FLAG_ENEMY, // NA_BGM_NATURE_BACKGROUND
|
||||||
0, // NA_BGM_FIELD_LOGIC
|
0, // NA_BGM_FIELD_LOGIC
|
||||||
|
@ -158,14 +180,14 @@ u8 sSeqFlags[0x6E] = {
|
||||||
0, // NA_BGM_FIELD_STILL_2
|
0, // NA_BGM_FIELD_STILL_2
|
||||||
0, // NA_BGM_FIELD_STILL_3
|
0, // NA_BGM_FIELD_STILL_3
|
||||||
0, // NA_BGM_FIELD_STILL_4
|
0, // NA_BGM_FIELD_STILL_4
|
||||||
SEQ_FLAG_5 | SEQ_FLAG_ENEMY, // NA_BGM_DUNGEON
|
SEQ_FLAG_RESUME_PREV | SEQ_FLAG_ENEMY, // NA_BGM_DUNGEON
|
||||||
SEQ_FLAG_4, // NA_BGM_KAKARIKO_ADULT
|
SEQ_FLAG_RESUME, // NA_BGM_KAKARIKO_ADULT
|
||||||
0, // NA_BGM_ENEMY
|
0, // NA_BGM_ENEMY
|
||||||
SEQ_FLAG_NO_AMBIENCE | SEQ_FLAG_RESTORE, // NA_BGM_BOSS
|
SEQ_FLAG_NO_AMBIENCE | SEQ_FLAG_RESTORE, // NA_BGM_BOSS
|
||||||
SEQ_FLAG_ENEMY, // NA_BGM_INSIDE_DEKU_TREE
|
SEQ_FLAG_ENEMY, // NA_BGM_INSIDE_DEKU_TREE
|
||||||
0, // NA_BGM_MARKET
|
0, // NA_BGM_MARKET
|
||||||
0, // NA_BGM_TITLE
|
0, // NA_BGM_TITLE
|
||||||
SEQ_FLAG_5, // NA_BGM_LINK_HOUSE
|
SEQ_FLAG_RESUME_PREV, // NA_BGM_LINK_HOUSE
|
||||||
0, // NA_BGM_GAME_OVER
|
0, // NA_BGM_GAME_OVER
|
||||||
0, // NA_BGM_BOSS_CLEAR
|
0, // NA_BGM_BOSS_CLEAR
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_ITEM_GET
|
SEQ_FLAG_FANFARE, // NA_BGM_ITEM_GET
|
||||||
|
@ -173,7 +195,7 @@ u8 sSeqFlags[0x6E] = {
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_HEART_GET
|
SEQ_FLAG_FANFARE, // NA_BGM_HEART_GET
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_OCA_LIGHT
|
SEQ_FLAG_FANFARE, // NA_BGM_OCA_LIGHT
|
||||||
SEQ_FLAG_ENEMY, // NA_BGM_JABU_JABU
|
SEQ_FLAG_ENEMY, // NA_BGM_JABU_JABU
|
||||||
SEQ_FLAG_4, // NA_BGM_KAKARIKO_KID
|
SEQ_FLAG_RESUME, // NA_BGM_KAKARIKO_KID
|
||||||
0, // NA_BGM_GREAT_FAIRY
|
0, // NA_BGM_GREAT_FAIRY
|
||||||
0, // NA_BGM_ZELDA_THEME
|
0, // NA_BGM_ZELDA_THEME
|
||||||
SEQ_FLAG_ENEMY, // NA_BGM_FIRE_TEMPLE
|
SEQ_FLAG_ENEMY, // NA_BGM_FIRE_TEMPLE
|
||||||
|
@ -194,7 +216,7 @@ u8 sSeqFlags[0x6E] = {
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_SMALL_ITEM_GET
|
SEQ_FLAG_FANFARE, // NA_BGM_SMALL_ITEM_GET
|
||||||
0, // NA_BGM_TEMPLE_OF_TIME
|
0, // NA_BGM_TEMPLE_OF_TIME
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_EVENT_CLEAR
|
SEQ_FLAG_FANFARE, // NA_BGM_EVENT_CLEAR
|
||||||
SEQ_FLAG_4 | SEQ_FLAG_ENEMY, // NA_BGM_KOKIRI
|
SEQ_FLAG_RESUME | SEQ_FLAG_ENEMY, // NA_BGM_KOKIRI
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_OCA_FAIRY_GET
|
SEQ_FLAG_FANFARE, // NA_BGM_OCA_FAIRY_GET
|
||||||
SEQ_FLAG_ENEMY, // NA_BGM_SARIA_THEME
|
SEQ_FLAG_ENEMY, // NA_BGM_SARIA_THEME
|
||||||
SEQ_FLAG_ENEMY, // NA_BGM_SPIRIT_TEMPLE
|
SEQ_FLAG_ENEMY, // NA_BGM_SPIRIT_TEMPLE
|
||||||
|
@ -212,16 +234,16 @@ u8 sSeqFlags[0x6E] = {
|
||||||
0, // NA_BGM_DEKU_TREE_CS
|
0, // NA_BGM_DEKU_TREE_CS
|
||||||
0, // NA_BGM_WINDMILL
|
0, // NA_BGM_WINDMILL
|
||||||
0, // NA_BGM_HYRULE_CS
|
0, // NA_BGM_HYRULE_CS
|
||||||
SEQ_FLAG_5, // NA_BGM_MINI_GAME
|
SEQ_FLAG_RESUME_PREV, // NA_BGM_MINI_GAME
|
||||||
0, // NA_BGM_SHEIK
|
0, // NA_BGM_SHEIK
|
||||||
SEQ_FLAG_4, // NA_BGM_ZORA_DOMAIN
|
SEQ_FLAG_RESUME, // NA_BGM_ZORA_DOMAIN
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_APPEAR
|
SEQ_FLAG_FANFARE, // NA_BGM_APPEAR
|
||||||
0, // NA_BGM_ADULT_LINK
|
0, // NA_BGM_ADULT_LINK
|
||||||
0, // NA_BGM_MASTER_SWORD
|
0, // NA_BGM_MASTER_SWORD
|
||||||
SEQ_FLAG_FANFARE_GANON, // NA_BGM_INTRO_GANON
|
SEQ_FLAG_FANFARE_GANON, // NA_BGM_INTRO_GANON
|
||||||
SEQ_FLAG_5, // NA_BGM_SHOP
|
SEQ_FLAG_RESUME_PREV, // NA_BGM_SHOP
|
||||||
SEQ_FLAG_6, // NA_BGM_CHAMBER_OF_SAGES
|
SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_CHAMBER_OF_SAGES
|
||||||
SEQ_FLAG_6, // NA_BGM_FILE_SELECT
|
SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_FILE_SELECT
|
||||||
SEQ_FLAG_ENEMY, // NA_BGM_ICE_CAVERN
|
SEQ_FLAG_ENEMY, // NA_BGM_ICE_CAVERN
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_DOOR_OF_TIME
|
SEQ_FLAG_FANFARE, // NA_BGM_DOOR_OF_TIME
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_OWL
|
SEQ_FLAG_FANFARE, // NA_BGM_OWL
|
||||||
|
@ -229,7 +251,7 @@ u8 sSeqFlags[0x6E] = {
|
||||||
SEQ_FLAG_ENEMY, // NA_BGM_WATER_TEMPLE
|
SEQ_FLAG_ENEMY, // NA_BGM_WATER_TEMPLE
|
||||||
SEQ_FLAG_FANFARE, // NA_BGM_BRIDGE_TO_GANONS
|
SEQ_FLAG_FANFARE, // NA_BGM_BRIDGE_TO_GANONS
|
||||||
0, // NA_BGM_OCARINA_OF_TIME
|
0, // NA_BGM_OCARINA_OF_TIME
|
||||||
SEQ_FLAG_4 | SEQ_FLAG_ENEMY, // NA_BGM_GERUDO_VALLEY
|
SEQ_FLAG_RESUME | SEQ_FLAG_ENEMY, // NA_BGM_GERUDO_VALLEY
|
||||||
0, // NA_BGM_POTION_SHOP
|
0, // NA_BGM_POTION_SHOP
|
||||||
0, // NA_BGM_KOTAKE_KOUME
|
0, // NA_BGM_KOTAKE_KOUME
|
||||||
SEQ_FLAG_NO_AMBIENCE, // NA_BGM_ESCAPE
|
SEQ_FLAG_NO_AMBIENCE, // NA_BGM_ESCAPE
|
||||||
|
@ -1250,7 +1272,7 @@ f32 sAudioMalonBgmDist;
|
||||||
void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest);
|
void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest);
|
||||||
|
|
||||||
void Audio_StepFreqLerp(FreqLerp* lerp);
|
void Audio_StepFreqLerp(FreqLerp* lerp);
|
||||||
void func_800F56A8(void);
|
void Audio_UpdateSceneSequenceResumePoint(void);
|
||||||
void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId);
|
void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId);
|
||||||
s32 Audio_SetGanonsTowerBgmVolume(u8 targetVol);
|
s32 Audio_SetGanonsTowerBgmVolume(u8 targetVol);
|
||||||
|
|
||||||
|
@ -3684,7 +3706,7 @@ void func_800F3054(void) {
|
||||||
Audio_StepFreqLerp(&sRiverFreqScaleLerp);
|
Audio_StepFreqLerp(&sRiverFreqScaleLerp);
|
||||||
Audio_StepFreqLerp(&sWaterfallFreqScaleLerp);
|
Audio_StepFreqLerp(&sWaterfallFreqScaleLerp);
|
||||||
Audio_UpdateRiverSoundVolumes();
|
Audio_UpdateRiverSoundVolumes();
|
||||||
func_800F56A8();
|
Audio_UpdateSceneSequenceResumePoint();
|
||||||
func_800F5CF8();
|
func_800F5CF8();
|
||||||
if (gAudioSpecId == 7) {
|
if (gAudioSpecId == 7) {
|
||||||
Audio_ClearSariaBgm();
|
Audio_ClearSariaBgm();
|
||||||
|
@ -3772,7 +3794,7 @@ s8 Audio_ComputeSfxReverb(u8 bankId, u8 entryIdx, u8 channelIdx) {
|
||||||
|
|
||||||
if (IS_SEQUENCE_CHANNEL_VALID(gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx])) {
|
if (IS_SEQUENCE_CHANNEL_VALID(gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx])) {
|
||||||
scriptAdd = gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1];
|
scriptAdd = gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1];
|
||||||
if (gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1] < 0) {
|
if (gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1] <= SEQ_IO_VAL_NONE) {
|
||||||
scriptAdd = 0;
|
scriptAdd = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4309,7 +4331,8 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVol) {
|
||||||
for (channelIdx = 0; channelIdx < 16; channelIdx++) {
|
for (channelIdx = 0; channelIdx < 16; channelIdx++) {
|
||||||
if (gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx] != &gAudioCtx.sequenceChannelNone) {
|
if (gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx] != &gAudioCtx.sequenceChannelNone) {
|
||||||
// soundScriptIO[5] is set to 0x40 in channels 0, 1, and 4
|
// soundScriptIO[5] is set to 0x40 in channels 0, 1, and 4
|
||||||
if ((u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] != 0xFF) {
|
if ((u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] !=
|
||||||
|
(u8)SEQ_IO_VAL_NONE) {
|
||||||
// Higher volume leads to lower reverb
|
// Higher volume leads to lower reverb
|
||||||
reverb = ((u16)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] -
|
reverb = ((u16)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] -
|
||||||
targetVol) +
|
targetVol) +
|
||||||
|
@ -4516,7 +4539,7 @@ void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) {
|
||||||
dist = sqrtf(SQ(pos->z) + SQ(pos->x));
|
dist = sqrtf(SQ(pos->z) + SQ(pos->x));
|
||||||
if (sSariaBgmPtr == NULL) {
|
if (sSariaBgmPtr == NULL) {
|
||||||
sSariaBgmPtr = pos;
|
sSariaBgmPtr = pos;
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2);
|
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2);
|
||||||
} else {
|
} else {
|
||||||
prevDist = sqrtf(SQ(sSariaBgmPtr->z) + SQ(sSariaBgmPtr->x));
|
prevDist = sqrtf(SQ(sSariaBgmPtr->z) + SQ(sSariaBgmPtr->x));
|
||||||
if (dist < prevDist) {
|
if (dist < prevDist) {
|
||||||
|
@ -4552,52 +4575,60 @@ void Audio_ClearSariaBgm2(void) {
|
||||||
sSariaBgmPtr = NULL;
|
sSariaBgmPtr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_800F5510(u16 seqId) {
|
void Audio_PlayMorningSceneSequence(u16 seqId) {
|
||||||
func_800F5550(seqId);
|
Audio_PlaySceneSequence(seqId);
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1);
|
// Writing a value of 1 to ioPort 0 will be used by
|
||||||
|
// `NA_BGM_FIELD_LOGIC` to play `NA_BGM_FIELD_MORNING` first
|
||||||
|
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_800F5550(u16 seqId) {
|
void Audio_PlaySceneSequence(u16 seqId) {
|
||||||
u8 sp27 = 0;
|
u8 fadeInDuration = 0;
|
||||||
u16 nv;
|
u8 skipHarpIntro;
|
||||||
|
|
||||||
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_WINDMILL) {
|
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_WINDMILL) {
|
||||||
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_LONLON) {
|
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_LONLON) {
|
||||||
Audio_StopSequence(SEQ_PLAYER_BGM_SUB, 0);
|
Audio_StopSequence(SEQ_PLAYER_BGM_SUB, 0);
|
||||||
|
// Terminate all internal audio cmds
|
||||||
Audio_QueueCmdS32(0xF8000000, 0);
|
Audio_QueueCmdS32(0xF8000000, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sSeqFlags[D_80130630] & SEQ_FLAG_5) && sSeqFlags[(seqId & 0xFF) & 0xFF] & SEQ_FLAG_4) {
|
if ((sSeqFlags[sPrevSceneSeqId] & SEQ_FLAG_RESUME_PREV) && sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME) {
|
||||||
|
// Resume the sequence from the point where it left off last time it was played in the scene
|
||||||
if ((D_8013062C & 0x3F) != 0) {
|
if ((sSeqResumePoint & 0x3F) != 0) {
|
||||||
sp27 = 0x1E;
|
fadeInDuration = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, sp27, 7, D_8013062C);
|
// Write the sequence resumePoint to start from into ioPort 7
|
||||||
|
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, fadeInDuration, 7, sSeqResumePoint);
|
||||||
|
|
||||||
D_8013062C = 0;
|
sSeqResumePoint = 0;
|
||||||
} else {
|
} else {
|
||||||
nv = (sSeqFlags[(seqId & 0xFF) & 0xFF] & SEQ_FLAG_6) ? 1 : 0xFF;
|
// Start the sequence from the beginning
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, nv);
|
|
||||||
if (!(sSeqFlags[seqId] & SEQ_FLAG_5)) {
|
// Writes to ioPort 7. See `SEQ_FLAG_SKIP_HARP_INTRO` for writing a value of 1 to ioPort 7.
|
||||||
D_8013062C = 0xC0;
|
skipHarpIntro = (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_SKIP_HARP_INTRO) ? 1 : (u8)SEQ_IO_VAL_NONE;
|
||||||
|
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, skipHarpIntro);
|
||||||
|
|
||||||
|
if (!(sSeqFlags[seqId] & SEQ_FLAG_RESUME_PREV)) {
|
||||||
|
// Reset the sequence resumePoint
|
||||||
|
sSeqResumePoint = SEQ_RESUME_POINT_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
D_80130630 = seqId & 0xFF;
|
sPrevSceneSeqId = seqId & 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_800F56A8(void) {
|
void Audio_UpdateSceneSequenceResumePoint(void) {
|
||||||
u16 temp_v0;
|
u16 seqId = Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
|
||||||
u8 bvar;
|
|
||||||
|
|
||||||
temp_v0 = Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
|
if ((seqId != NA_BGM_DISABLED) && (sSeqFlags[(u8)seqId & 0xFF] & SEQ_FLAG_RESUME)) {
|
||||||
bvar = temp_v0 & 0xFF;
|
if (sSeqResumePoint != SEQ_RESUME_POINT_NONE) {
|
||||||
if ((temp_v0 != NA_BGM_DISABLED) && (sSeqFlags[bvar] & SEQ_FLAG_4)) {
|
// Get the current point to resume from
|
||||||
if (D_8013062C != 0xC0) {
|
sSeqResumePoint = gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3];
|
||||||
D_8013062C = gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3];
|
|
||||||
} else {
|
} else {
|
||||||
D_8013062C = 0;
|
// Initialize the point to resume from to the start of the sequence.
|
||||||
|
sSeqResumePoint = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4634,7 +4665,7 @@ void func_800F595C(u16 arg0) {
|
||||||
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, 0, arg0);
|
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, 0, arg0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, arg0, 0, 7, -1);
|
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, arg0, 0, 7, SEQ_IO_VAL_NONE);
|
||||||
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
|
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4780,9 +4811,9 @@ void func_800F5CF8(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_800F5E18(u8 seqPlayerIndex, u16 seqId, u8 fadeTimer, s8 ioPort, s8 ioData) {
|
void Audio_PlaySequenceWithSeqPlayerIO(u8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, s8 ioData) {
|
||||||
SEQCMD_SET_PLAYER_IO(seqPlayerIndex, ioPort, ioData);
|
SEQCMD_SET_PLAYER_IO(seqPlayerIndex, ioPort, ioData);
|
||||||
SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeTimer, 0, seqId);
|
SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeInDuration, 0, seqId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio_SetSequenceMode(u8 seqMode) {
|
void Audio_SetSequenceMode(u8 seqMode) {
|
||||||
|
@ -4918,7 +4949,7 @@ void func_800F6268(f32 dist, u16 arg1) {
|
||||||
} else if ((temp_a0 == NA_BGM_NATURE_AMBIENCE) && ((arg1 & 0xFF) == NA_BGM_LONLON)) {
|
} else if ((temp_a0 == NA_BGM_NATURE_AMBIENCE) && ((arg1 & 0xFF) == NA_BGM_LONLON)) {
|
||||||
temp_a0 = (s8)(Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) & 0xFF);
|
temp_a0 = (s8)(Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) & 0xFF);
|
||||||
if ((temp_a0 != (arg1 & 0xFF)) && (D_8016B9D8 < 10)) {
|
if ((temp_a0 != (arg1 & 0xFF)) && (D_8016B9D8 < 10)) {
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
|
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
|
||||||
SEQCMD_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_BGM_SUB, 0xFFFC);
|
SEQCMD_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_BGM_SUB, 0xFFFC);
|
||||||
D_8016B9D8 = 10;
|
D_8016B9D8 = 10;
|
||||||
}
|
}
|
||||||
|
@ -4977,7 +5008,7 @@ void func_800F6584(u8 arg0) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) {
|
if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) {
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
|
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
|
||||||
}
|
}
|
||||||
SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 0, 1, 0x7F);
|
SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 0, 1, 0x7F);
|
||||||
SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 1, 1, 0x7F);
|
SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 1, 1, 0x7F);
|
||||||
|
|
|
@ -476,7 +476,7 @@ void Audio_PlayActiveSfx(u8 bankId) {
|
||||||
} else {
|
} else {
|
||||||
entry->state = SFX_STATE_PLAYING_2;
|
entry->state = SFX_STATE_PLAYING_2;
|
||||||
}
|
}
|
||||||
} else if ((u8)channel->soundScriptIO[1] == 0xFF) {
|
} else if ((u8)channel->soundScriptIO[1] == (u8)SEQ_IO_VAL_NONE) {
|
||||||
Audio_RemoveSfxBankEntry(bankId, entryIndex);
|
Audio_RemoveSfxBankEntry(bankId, entryIndex);
|
||||||
} else if (entry->state == SFX_STATE_PLAYING_REFRESH) {
|
} else if (entry->state == SFX_STATE_PLAYING_REFRESH) {
|
||||||
Audio_SetSfxProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
|
Audio_SetSfxProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
|
||||||
|
|
|
@ -2050,12 +2050,12 @@ void Environment_PlaySceneSequence(PlayState* play) {
|
||||||
osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", play->sequenceCtx.seqId,
|
osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", play->sequenceCtx.seqId,
|
||||||
((void)0, gSaveContext.seqId));
|
((void)0, gSaveContext.seqId));
|
||||||
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) {
|
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) {
|
||||||
func_800F5550(play->sequenceCtx.seqId);
|
Audio_PlaySceneSequence(play->sequenceCtx.seqId);
|
||||||
}
|
}
|
||||||
} else if (((void)0, gSaveContext.dayTime) >= CLOCK_TIME(7, 0) &&
|
} else if (((void)0, gSaveContext.dayTime) >= CLOCK_TIME(7, 0) &&
|
||||||
((void)0, gSaveContext.dayTime) <= CLOCK_TIME(17, 10)) {
|
((void)0, gSaveContext.dayTime) <= CLOCK_TIME(17, 10)) {
|
||||||
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) {
|
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) {
|
||||||
func_800F5550(play->sequenceCtx.seqId);
|
Audio_PlaySceneSequence(play->sequenceCtx.seqId);
|
||||||
}
|
}
|
||||||
|
|
||||||
play->envCtx.timeSeqState = TIMESEQ_FADE_DAY_BGM;
|
play->envCtx.timeSeqState = TIMESEQ_FADE_DAY_BGM;
|
||||||
|
@ -2092,7 +2092,7 @@ void Environment_PlayTimeBasedSequence(PlayState* play) {
|
||||||
|
|
||||||
if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) {
|
if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) {
|
||||||
osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n");
|
osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n");
|
||||||
func_800F5510(play->sequenceCtx.seqId);
|
Audio_PlayMorningSceneSequence(play->sequenceCtx.seqId);
|
||||||
}
|
}
|
||||||
|
|
||||||
play->envCtx.timeSeqState++;
|
play->envCtx.timeSeqState++;
|
||||||
|
|
|
@ -1895,5 +1895,6 @@ void FileSelect_Init(GameState* thisx) {
|
||||||
FileSelect_InitContext(&this->state);
|
FileSelect_InitContext(&this->state);
|
||||||
Font_LoadOrderedFont(&this->font);
|
Font_LoadOrderedFont(&this->font);
|
||||||
SEQCMD_RESET_AUDIO_HEAP(0, 10);
|
SEQCMD_RESET_AUDIO_HEAP(0, 10);
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
|
// Setting ioData to 1 and writing it to ioPort 7 will skip the harp intro
|
||||||
|
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue