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

Fix BombRushRadio tracks not continuing when entering new stage #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Patches/MusicPlayer-Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ public static void Refresh(MusicPlayer __instance, ChapterMusic chapterMusic, St
}
}

static void Prefix(MusicPlayer __instance, ChapterMusic chapterMusic, MusicTrack trackToPlay, Stage stage)
static bool Prefix(MusicPlayer __instance, ChapterMusic chapterMusic, MusicTrack trackToPlay, Stage stage)
{
CurrentChapter = chapterMusic;
CurrentStage = stage;

Refresh(__instance, chapterMusic, stage);

__instance.musicTrackQueue.UpdateMusicQueueForStage(trackToPlay);
return false;
}
}

Expand Down
22 changes: 22 additions & 0 deletions Patches/StageManager-Patches.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using HarmonyLib;
using Reptile;
using System;
using UnityEngine;

namespace BombRushRadio;

[HarmonyPatch(typeof(StageManager), nameof(StageManager.GetCurrentNonChapterTrackToPlay))]
public class StageManager_Patches_NonChapterTrack
{
private static void Postfix(int playbackSamples, ref int playbackSamplesToPlay, StageManager __instance, ref MusicTrack __result) {
if (__result == null) {
foreach (MusicTrack track in BombRushRadio.Audios) {
if (track.GetInstanceID() == __instance.baseModule.lastPlayingSongOnStageExistInstanceID) {
__result = track;
playbackSamplesToPlay = __instance.baseModule.lastPlayingSongOnStageExistSamples;
break;
}
}
}
}
}