Skip to content

Commit 71b4a58

Browse files
KoloInDaCribHundrec
authored andcommitted
make going into chart editor thru a song go to the current song pos
1 parent 934bce7 commit 71b4a58

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

source/funkin/play/PlayState.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3067,6 +3067,7 @@ class PlayState extends MusicBeatSubState
30673067
targetSongId: currentSong.id,
30683068
targetSongDifficulty: currentDifficulty,
30693069
targetSongVariation: currentVariation,
3070+
targetSongPosition: Conductor.instance.songPosition
30703071
}));
30713072
}
30723073
}

source/funkin/ui/debug/charting/ChartEditorState.hx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2377,6 +2377,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
23772377
var targetSongDifficulty = params.targetSongDifficulty ?? null;
23782378
var targetSongVariation = params.targetSongVariation ?? null;
23792379
this.loadSongAsTemplate(params.targetSongId, targetSongDifficulty, targetSongVariation);
2380+
2381+
// Set the scroll position to the current song time.
2382+
scrollPositionInMs = Math.min(params.targetSongPosition ?? 0, songLengthInMs);
2383+
currentScrollEase = scrollPositionInPixels;
2384+
moveSongToScrollPosition();
23802385
}
23812386
else
23822387
{
@@ -6126,7 +6131,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
61266131
}
61276132

61286133
PlayStatePlaylist.reset();
6129-
6134+
61306135
// TODO: Rework asset system so we can remove this jank.
61316136
switch (currentSongStage)
61326137
{
@@ -7060,6 +7065,11 @@ typedef ChartEditorParams =
70607065
* If non-null, load this variation immediately instead of the default variation.
70617066
*/
70627067
var ?targetSongVariation:String;
7068+
7069+
/**
7070+
* If non-null, set this as the song position immediately instead of the default song position.
7071+
*/
7072+
var ?targetSongPosition:Float;
70637073
};
70647074

70657075
/**

0 commit comments

Comments
 (0)