Skip to content

Commit 5364cd1

Browse files
committed
Remove freeplay preview music for now
1 parent 5350c99 commit 5364cd1

File tree

1 file changed

+3
-90
lines changed

1 file changed

+3
-90
lines changed

source/funkin/menus/FreeplayState.hx

Lines changed: 3 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -189,37 +189,6 @@ class FreeplayState extends MusicBeatState
189189
interpColor = new FlxInterpolateColor(bg.color);
190190
}
191191

192-
#if PRELOAD_ALL
193-
/**
194-
* How much time a song stays selected until it autoplays.
195-
*/
196-
public var timeUntilAutoplay:Float = 1;
197-
/**
198-
* Whenever the song autoplays when hovered over.
199-
*/
200-
public var disableAutoPlay:Bool = false;
201-
/**
202-
* Whenever the autoplayed song gets async loaded.
203-
*/
204-
public var disableAsyncLoading:Bool = #if desktop false #else true #end;
205-
/**
206-
* Time elapsed since last autoplay. If this time exceeds `timeUntilAutoplay`, the currently selected song will play.
207-
*/
208-
public var autoplayElapsed:Float = 0;
209-
/**
210-
* Whenever the currently selected song instrumental is playing.
211-
*/
212-
public var songInstPlaying:Bool = true;
213-
/**
214-
* Path to the currently playing song instrumental.
215-
*/
216-
public var curPlayingInst:String = null;
217-
/**
218-
* If it should play the song automatically.
219-
*/
220-
public var autoplayShouldPlay:Bool = true;
221-
#end
222-
223192
private var TEXT_FREEPLAY_SCORE = TU.getRaw("freeplay.score");
224193

225194
override function update(elapsed:Float)
@@ -255,46 +224,6 @@ class FreeplayState extends MusicBeatState
255224
interpColor.fpsLerpTo(curSong.color, 0.0625);
256225
bg.color = interpColor.color;
257226

258-
#if PRELOAD_ALL
259-
var dontPlaySongThisFrame = false;
260-
autoplayElapsed += elapsed;
261-
if (!disableAutoPlay && !songInstPlaying && (autoplayElapsed > timeUntilAutoplay)) {
262-
if (curPlayingInst != (curPlayingInst = Paths.inst(curSong.name, curDifficulties[curDifficulty], curSong.instSuffix))) {
263-
var streamed = false;
264-
if (Options.streamedMusic) {
265-
var sound = Assets.getMusic(curPlayingInst, true, false);
266-
streamed = sound != null;
267-
268-
if (streamed && autoplayShouldPlay) {
269-
FlxG.sound.playMusic(sound, 0);
270-
Conductor.changeBPM(curSong.bpm, curSong.beatsPerMeasure, curSong.stepsPerBeat);
271-
}
272-
}
273-
274-
if (!streamed) {
275-
var huh:Void->Void = function() {
276-
var soundPath = curPlayingInst;
277-
var sound = null;
278-
if (Assets.exists(soundPath, SOUND) || Assets.exists(soundPath, MUSIC))
279-
sound = Assets.getSound(soundPath);
280-
else
281-
FlxG.log.error('Could not find a Sound asset with an ID of \'$soundPath\'.');
282-
283-
if (sound != null && autoplayShouldPlay) {
284-
FlxG.sound.playMusic(sound, 0);
285-
Conductor.changeBPM(curSong.bpm, curSong.beatsPerMeasure, curSong.stepsPerBeat);
286-
}
287-
}
288-
if (!disableAsyncLoading) Main.execAsync(huh);
289-
else huh();
290-
}
291-
}
292-
songInstPlaying = true;
293-
if (disableAsyncLoading && !Options.streamedMusic) dontPlaySongThisFrame = true;
294-
}
295-
#end
296-
297-
298227
if (controls.BACK)
299228
{
300229
CoolUtil.playMenuSFX(CANCEL, 0.7);
@@ -306,7 +235,7 @@ class FreeplayState extends MusicBeatState
306235
convertChart();
307236
#end
308237

309-
if (controls.ACCEPT #if PRELOAD_ALL && !dontPlaySongThisFrame #end)
238+
if (controls.ACCEPT)
310239
select();
311240
}
312241

@@ -338,10 +267,6 @@ class FreeplayState extends MusicBeatState
338267

339268
if (event.cancelled) return;
340269

341-
#if PRELOAD_ALL
342-
autoplayShouldPlay = false;
343-
#end
344-
345270
Options.freeplayLastSong = curSong.name;
346271
Options.freeplayLastDifficulty = curDifficulties[curDifficulty];
347272
Options.freeplayLastVariation = curSong.variant;
@@ -377,13 +302,6 @@ class FreeplayState extends MusicBeatState
377302
updateCurSong();
378303
updateScore();
379304

380-
#if PRELOAD_ALL
381-
if (curSong != prevSong) {
382-
autoplayElapsed = 0;
383-
songInstPlaying = false;
384-
}
385-
#end
386-
387305
var text = validDifficulties ? curDifficulties[curDifficulty].toUpperCase() + (curSong != songs[curSelected] ? ' (${curSong.variant.toUpperCase()})' : '') : '-';
388306
diffText.text = curDifficulties.length > 1 ? '< $text >' : text;
389307
}
@@ -466,20 +384,15 @@ class FreeplayState extends MusicBeatState
466384

467385
changeDiff(0, true);
468386

469-
#if PRELOAD_ALL
470-
autoplayElapsed = 0;
471-
songInstPlaying = false;
472-
#end
473-
474387
coopText.visible = curSong.coopAllowed || curSong.opponentModeAllowed;
475388
}
476389

477390
function updateOptionsAlpha() {
478391
var event = event("onUpdateOptionsAlpha", EventManager.get(FreeplayAlphaUpdateEvent).recycle(0.6, 0.45, 1, 1, 0.25));
479392
if (event.cancelled) return;
480393

481-
final idleAlpha = #if PRELOAD_ALL songInstPlaying ? event.idlePlayingAlpha : #end event.idleAlpha;
482-
final selectedAlpha = #if PRELOAD_ALL songInstPlaying ? event.selectedPlayingAlpha : #end event.selectedAlpha;
394+
final idleAlpha = event.idleAlpha;
395+
final selectedAlpha = event.selectedAlpha;
483396

484397
for (i in 0...iconArray.length)
485398
iconArray[i].alpha = lerp(iconArray[i].alpha, idleAlpha, event.lerp);

0 commit comments

Comments
 (0)