Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFX: Support replaying the current BGM when changed #2150

Merged
merged 3 commits into from
Dec 24, 2022

Conversation

Archez
Copy link
Contributor

@Archez Archez commented Dec 12, 2022

This makes it so that when the sequence for the "current" BGM is updated/reset, the audio player will replay the BGM to force the sfx override to take over.

Two functions where added, one that performs the replay, and one that checks when to execute it. The randomize/reset buttons for the line item and any change to the dropdown will check if that line item is the current sequence being played, and replay it. The randomizer all/reset all for the BGM world group will also do a replay.

Build Artifacts

Comment on lines +194 to +204
void UpdateCurrentBGM(u16 seqKey, SeqType seqType) {
if (seqType != SEQ_BGM_WORLD) {
return;
}

u16 curSeqId = func_800FA0B4(SEQ_PLAYER_BGM_MAIN);
if (curSeqId == seqKey) {
ReplayCurrentBGM();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if you really should only keep this one method and call Audio_QueueSeqCmd(0x00000000 | curSeqId); in here.. In the two places where you do call ReplayCurrentBGM you actually do the SEQ_BGM_WORLD anyway.

Copy link
Contributor Author

@Archez Archez Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do the same BGM_WORLD check, but those two areas are the reset all/randomizer all, that first do a loop to update all the options, then sets the CVARs at the end. So ReplayCurrentBGM happens after the loop, and doesn't have the specific seqKey to pass in.

I could move the those BGM_WORLD checks to also be in ReplayCurrentBgm, or I could combine the two functions, but that would mean moving the function inside of that loop and having it check on each iteration, which is what I was trying to avoid. (it probably wouldn't have any performance impact, since it only happens on pressing a button)

@leggettc18
Copy link
Contributor

We should wait to merge this in pending the next develop-bradley merge-in, as there is likely to a be a merge conflict here. Shouldn't be too tricky of one to resolve though.

Copy link
Contributor

@leggettc18 leggettc18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, pending the potential merge conflict around line 342 (which might not even happen now that I'm looking closer at it).

@briaguya-ai briaguya-ai changed the base branch from develop to develop-bradley December 24, 2022 04:14
@briaguya-ai briaguya-ai changed the base branch from develop-bradley to develop December 24, 2022 04:14
@Archez Archez changed the base branch from develop to develop-bradley December 24, 2022 04:23
@briaguya-ai briaguya-ai merged commit 9529cc1 into HarbourMasters:develop-bradley Dec 24, 2022
@Archez Archez deleted the auto-replay-bgm branch December 24, 2022 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants