make markers non clamped

lockstep frees rendertextures when unloading
This commit is contained in:
minenice55 2023-11-26 21:57:17 -05:00
parent 3dda0f3da0
commit d5c443d40b
2 changed files with 17 additions and 9 deletions

View file

@ -476,16 +476,16 @@ namespace HeavenStudio
private void Update() private void Update()
{ {
if (BeatmapEntities() < 1) //bruh really you forgot to ckeck tempo changes if (BeatmapEntities() < 1)
return; return;
if (!Conductor.instance.isPlaying) if (!Conductor.instance.isPlaying)
return; return;
Conductor cond = Conductor.instance; Conductor cond = Conductor.instance;
double beat = Math.Max(cond.songPositionInBeatsAsDouble, 0); double clampedBeat = Math.Max(cond.songPositionInBeatsAsDouble, 0);
if (currentTempoEvent < Beatmap.TempoChanges.Count && currentTempoEvent >= 0) if (currentTempoEvent < Beatmap.TempoChanges.Count && currentTempoEvent >= 0)
{ {
if (beat >= tempoBeats[currentTempoEvent]) if (cond.songPositionInBeatsAsDouble >= tempoBeats[currentTempoEvent])
{ {
cond.SetBpm(Beatmap.TempoChanges[currentTempoEvent]["tempo"]); cond.SetBpm(Beatmap.TempoChanges[currentTempoEvent]["tempo"]);
currentTempoEvent++; currentTempoEvent++;
@ -494,7 +494,7 @@ namespace HeavenStudio
if (currentVolumeEvent < Beatmap.VolumeChanges.Count && currentVolumeEvent >= 0) if (currentVolumeEvent < Beatmap.VolumeChanges.Count && currentVolumeEvent >= 0)
{ {
if (beat >= volumeBeats[currentVolumeEvent]) if (cond.songPositionInBeatsAsDouble >= volumeBeats[currentVolumeEvent])
{ {
cond.SetVolume(Beatmap.VolumeChanges[currentVolumeEvent]["volume"]); cond.SetVolume(Beatmap.VolumeChanges[currentVolumeEvent]["volume"]);
currentVolumeEvent++; currentVolumeEvent++;
@ -503,7 +503,7 @@ namespace HeavenStudio
if (currentSectionEvent < Beatmap.SectionMarkers.Count && currentSectionEvent >= 0) if (currentSectionEvent < Beatmap.SectionMarkers.Count && currentSectionEvent >= 0)
{ {
if (beat >= sectionBeats[currentSectionEvent]) if (cond.songPositionInBeatsAsDouble >= sectionBeats[currentSectionEvent])
{ {
Debug.Log("Section " + Beatmap.SectionMarkers[currentSectionEvent]["sectionName"] + " started"); Debug.Log("Section " + Beatmap.SectionMarkers[currentSectionEvent]["sectionName"] + " started");
lastSection = currentSection; lastSection = currentSection;
@ -520,7 +520,7 @@ namespace HeavenStudio
} }
} }
if (beat >= Math.Ceiling(_playStartBeat) + _pulseTally) if (cond.songPositionInBeatsAsDouble >= Math.Ceiling(_playStartBeat) + _pulseTally)
{ {
if (_currentMinigame != null) _currentMinigame.OnBeatPulse(Math.Ceiling(_playStartBeat) + _pulseTally); if (_currentMinigame != null) _currentMinigame.OnBeatPulse(Math.Ceiling(_playStartBeat) + _pulseTally);
onBeatPulse?.Invoke(Math.Ceiling(_playStartBeat) + _pulseTally); onBeatPulse?.Invoke(Math.Ceiling(_playStartBeat) + _pulseTally);
@ -529,12 +529,12 @@ namespace HeavenStudio
float seekTime = 8f; float seekTime = 8f;
//seek ahead to preload games that have assetbundles //seek ahead to preload games that have assetbundles
SeekAheadAndPreload(beat, seekTime); SeekAheadAndPreload(clampedBeat, seekTime);
SeekAheadAndDoPreEvent(beat); SeekAheadAndDoPreEvent(clampedBeat);
if (currentEvent < Beatmap.Entities.Count && currentEvent >= 0) if (currentEvent < Beatmap.Entities.Count && currentEvent >= 0)
{ {
if (beat >= eventBeats[currentEvent]) if (clampedBeat >= eventBeats[currentEvent])
{ {
List<RiqEntity> entitiesAtSameBeat = ListPool<RiqEntity>.Get(); List<RiqEntity> entitiesAtSameBeat = ListPool<RiqEntity>.Get();
List<RiqEntity> fxEntities = ListPool<RiqEntity>.Get(); List<RiqEntity> fxEntities = ListPool<RiqEntity>.Get();

View file

@ -245,6 +245,14 @@ namespace HeavenStudio.Games
bachEvents = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "bach" }); bachEvents = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "bach" });
} }
void OnDestroy()
{
foreach (var rt in renderTextures)
{
rt.Release();
}
}
private static bool ForceStepOnBeat(double beat) private static bool ForceStepOnBeat(double beat)
{ {
return EventCaller.GetAllInGameManagerList("lockstep", new string[] { "marching" }).Find(x => beat >= x.beat && beat < x.beat + x.length) != null; return EventCaller.GetAllInGameManagerList("lockstep", new string[] { "marching" }).Find(x => beat >= x.beat && beat < x.beat + x.length) != null;