Skip to content

Live charting in Charter #432

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

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ba178cd
Add record icon
THEkatinamicrowave Nov 5, 2024
14e875c
Add dropdown shit
THEkatinamicrowave Nov 5, 2024
d8cfe19
Make the things play the song
THEkatinamicrowave Nov 5, 2024
134ffe6
Add notes for coding
THEkatinamicrowave Nov 5, 2024
adebf28
Keybind charting test
THEkatinamicrowave Nov 6, 2024
a3f80da
add Live Charting check
THEkatinamicrowave Nov 6, 2024
97b454b
Add checks for keybinds that could interfere
THEkatinamicrowave Nov 6, 2024
0db2de6
whoopsie daisy gee willikers by jove oh stars
THEkatinamicrowave Nov 6, 2024
e260ad0
Add stop to recording
THEkatinamicrowave Nov 6, 2024
6628689
Actually just Shift + Alt + F the whole thing
THEkatinamicrowave Nov 6, 2024
c310cf7
Moved the accept call
THEkatinamicrowave Nov 6, 2024
e95c339
Bug I found
THEkatinamicrowave Nov 6, 2024
b63ae93
oops
THEkatinamicrowave Nov 6, 2024
80ca886
Add recording shit
THEkatinamicrowave Nov 6, 2024
667d13c
Recording visuals + small bugfix
THEkatinamicrowave Nov 6, 2024
bcfcf84
Merge branch 'FNF-CNE-Devs:main' into main
THEkatinamicrowave Nov 8, 2024
4ba377d
Couldn't autoupdate
THEkatinamicrowave Nov 9, 2024
6783685
Merge branch 'main' into pr/432
NeeEoo Nov 9, 2024
b3346f4
Removed (now unnecessary) trace functions
THEkatinamicrowave Nov 9, 2024
c84cba2
I fucking hate Funkin Family Rush
THEkatinamicrowave Nov 9, 2024
b8631c1
Merge branch 'FNF-CNE-Devs:main' into main
THEkatinamicrowave Nov 11, 2024
770fb61
Merge branch 'main' into main
THEkatinamicrowave Nov 27, 2024
2e58ed2
Merge branch 'main' into main
THEkatinamicrowave Nov 30, 2024
99a15b7
Merge branch 'FNF-CNE-Devs:main' into main
THEkatinamicrowave Dec 1, 2024
97cb25a
Merge branch 'FNF-CNE-Devs:main' into main
THEkatinamicrowave Dec 8, 2024
156e528
Merge branch 'FNF-CNE-Devs:main' into main
THEkatinamicrowave Dec 9, 2024
9838f8b
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Dec 11, 2024
0d380b9
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Dec 13, 2024
56ad986
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Dec 13, 2024
eb65284
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Dec 16, 2024
dbf3181
Slight Revival of Branch
THEkatinamicrowave Dec 16, 2024
6b399f3
Typo
THEkatinamicrowave Dec 16, 2024
46c51e9
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Jan 6, 2025
5ed70bb
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Jan 7, 2025
165a639
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Jan 12, 2025
e27702a
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Jan 20, 2025
835a080
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Feb 8, 2025
1f99e76
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Feb 10, 2025
3fb6c8e
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Feb 22, 2025
848b72f
FINALLY got around to working on this
THEkatinamicrowave Feb 22, 2025
41a98a5
dang it moro !!!!!
THEkatinamicrowave Feb 22, 2025
e01f12a
gridBackdrops.conductorSprY discovered
THEkatinamicrowave Feb 22, 2025
70c98f4
playback speed change check
THEkatinamicrowave Feb 22, 2025
43f60a4
switch control for control_pressed
THEkatinamicrowave Feb 22, 2025
d9ecaa8
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Mar 5, 2025
5400489
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Apr 4, 2025
d773c7b
Merge branch 'CodenameCrew:main' into main
THEkatinamicrowave Apr 9, 2025
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
Binary file added assets/images/editors/charter/recording.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/editors/ui/context-icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
204 changes: 187 additions & 17 deletions source/funkin/editors/charter/Charter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class Charter extends UIState {
public var strumlineAddButton:CharterStrumlineButton;
public var strumlineLockButton:CharterStrumlineButton;

public var liveChartRecording:FlxSprite;
public var isLiveCharting:Bool = false;

public var hitsound:FlxSound;
public var metronome:FlxSound;

Expand Down Expand Up @@ -241,6 +244,21 @@ class Charter extends UIState {
onSelect: _chart_playtest_opponent_here
},
null,
{
label: "Record live charting",
color: 0xFFD21239,
icon: 7,
keybind: [CONTROL, R],
onSelect: _chart_live
},
{
label: "Record live charting here",
color: 0xFFD21239,
icon: 7,
keybind: [CONTROL, SHIFT, R],
onSelect: _chart_live_here
},
null,
{
label: 'Enable scripts during playtesting',
onSelect: _chart_enablescripts,
Expand Down Expand Up @@ -471,6 +489,14 @@ class Charter extends UIState {
autoSaveNotif = new CharterAutoSaveUI(20, strumlineInfoBG.y + strumlineInfoBG.height + 20);
uiGroup.add(autoSaveNotif);

liveChartRecording = new UISprite();
liveChartRecording.loadGraphic(Paths.image('editors/charter/recording'), true, 78, 78);
liveChartRecording.animation.add("off", [0]);
liveChartRecording.animation.add("on", [1]);
liveChartRecording.x = (FlxG.width - liveChartRecording.frameWidth - scrollBar.width) - 20;
liveChartRecording.y = (strumlineInfoBG.y + strumlineInfoBG.height) + 20;
liveChartRecording.scrollFactor.set();

strumlineAddButton = new CharterStrumlineButton("editors/new", "Create New");
strumlineAddButton.onClick = createStrumWithUI;
strumlineAddButton.animationOnClick = false;
Expand Down Expand Up @@ -503,6 +529,7 @@ class Charter extends UIState {
add(notesGroup);
add(selectionBox);
add(strumlineInfoBG);
add(liveChartRecording);
add(strumlineLockButton);
add(strumlineAddButton);
add(strumLines);
Expand All @@ -512,6 +539,8 @@ class Charter extends UIState {
// add the ui group
add(uiGroup);

liveChartRecording.animation.play('off');

loadSong();

if(Framerate.isLoaded) {
Expand Down Expand Up @@ -543,6 +572,18 @@ class Charter extends UIState {
super.destroy();
}

public function recordingDisplay(isIt:Bool = true) {
switch isIt {
case true:
charterBG.color = 0xFF0B0B0B;
liveChartRecording.animation.play("on");

case false:
charterBG.color = 0xFF181818;
liveChartRecording.animation.play("off");
}
}

public function loadSong() {
if (__reload) {
EventsData.reloadEvents();
Expand Down Expand Up @@ -1169,6 +1210,70 @@ class Charter extends UIState {
updateNoteLogic(elapsed);
updateAutoSaving(elapsed);

// TEST CODE -----------------------------

if (isLiveCharting) {
if (controls.LEFT_P) {
var note = new CharterNote();
note.updatePos(
FlxMath.bound(quantStep((gridBackdrops.conductorSprY)/40), 0, __endStep-1),
0,
0,
noteType,
strumLines.members[0]
);
notesGroup.add(note);
selection = [note];
undos.addToUndo(CCreateSelection([note]));
}
else if (controls.DOWN_P) {
var note = new CharterNote();
note.updatePos(
FlxMath.bound(quantStep((gridBackdrops.conductorSprY)/40), 0, __endStep-1),
1,
0,
noteType,
strumLines.members[0]
);
notesGroup.add(note);
selection = [note];
undos.addToUndo(CCreateSelection([note]));
}
else if (controls.UP_P) {
var note = new CharterNote();
note.updatePos(
FlxMath.bound(quantStep((gridBackdrops.conductorSprY)/40), 0, __endStep-1),
2,
0,
noteType,
strumLines.members[0]
);
notesGroup.add(note);
selection = [note];
undos.addToUndo(CCreateSelection([note]));
}
else if (controls.RIGHT_P) {
var note = new CharterNote();
note.updatePos(
FlxMath.bound(quantStep((gridBackdrops.conductorSprY)/40), 0, __endStep-1),
3,
0,
noteType,
strumLines.members[0]
);
notesGroup.add(note);
selection = [note];
undos.addToUndo(CCreateSelection([note]));
}
else if (controls.ACCEPT) {
trace("hey dummy I'm pressing accept");
isLiveCharting = false;
recordingDisplay(false);
}
}

// TEST CODE -----------------------------

if (FlxG.sound.music.playing || __firstFrame) {
gridBackdrops.conductorSprY = curStepFloat * 40;
} else {
Expand Down Expand Up @@ -1539,13 +1644,66 @@ class Charter extends UIState {
}

inline function _chart_playtest(_)
playtestChart(0, false);
if (!isLiveCharting)
playtestChart(0, false);
inline function _chart_playtest_here(_)
playtestChart(Conductor.songPosition, false, true);
if (!isLiveCharting)
playtestChart(Conductor.songPosition, false, true);
inline function _chart_playtest_opponent(_)
playtestChart(0, true);
if (!isLiveCharting)
playtestChart(0, true);
inline function _chart_playtest_opponent_here(_)
playtestChart(Conductor.songPosition, true, true);
if (!isLiveCharting)
playtestChart(Conductor.songPosition, true, true);

inline function _chart_live(_) {
if (!isLiveCharting) {
trace("make this");

isLiveCharting = true;
Conductor.songPosition = 0; // fuck you

// make SL selection functionality
// pause until a SL was selected
// start countdown
// only after all that can it...

recordingDisplay(true);

FlxG.sound.music.play();
vocals.play();

vocals.time = FlxG.sound.music.time = Conductor.songPosition + Conductor.songOffset * 2;
for (strumLine in strumLines.members) {
strumLine.vocals.play();
strumLine.vocals.time = vocals.time;
}
}
}

inline function _chart_live_here(_) {
if (!isLiveCharting) {
trace("and this too");

isLiveCharting = true;

// make SL selection functionality
// pause until a SL was selected
// start countdown
// only after all that can it...

recordingDisplay(true);

FlxG.sound.music.play();
vocals.play();
vocals.time = FlxG.sound.music.time = Conductor.songPosition + Conductor.songOffset * 2;
for (strumLine in strumLines.members) {
strumLine.vocals.play();
strumLine.vocals.time = vocals.time;
}
}
}

function _chart_enablescripts(t) {
t.icon = (Options.charterEnablePlaytestScripts = !Options.charterEnablePlaytestScripts) ? 1 : 0;
}
Expand Down Expand Up @@ -1573,9 +1731,9 @@ class Charter extends UIState {
}
}

function _playback_speed_raise(_) playBackSlider.value += .25;
function _playback_speed_reset(_) playBackSlider.value = 1;
function _playback_speed_lower(_) playBackSlider.value -= .25;
function _playback_speed_raise(_) if (!isLiveCharting) playBackSlider.value += .25;
function _playback_speed_reset(_) if (!isLiveCharting) playBackSlider.value = 1;
function _playback_speed_lower(_) if (!isLiveCharting) playBackSlider.value -= .25;

function _playback_metronome(t) {
t.icon = (Options.charterMetronomeEnabled = !Options.charterMetronomeEnabled) ? 1 : 0;
Expand Down Expand Up @@ -1642,12 +1800,22 @@ class Charter extends UIState {
for (shader in waveformHandler.waveShaders) shader.data.lowDetail.value = [Options.charterLowDetailWaveforms];
}

inline function _snap_increasesnap(_) changequant(1);
inline function _snap_decreasesnap(_) changequant(-1);
inline function _snap_resetsnap(_) setquant(16);

inline function changequant(change:Int) {quant = quants[FlxMath.wrap(quants.indexOf(quant) + change, 0, quants.length-1)]; buildSnapsUI();};
inline function setquant(newquant:Int) {quant = newquant; buildSnapsUI();}
inline function _snap_increasesnap(_) if (!isLiveCharting) changequant(1);
inline function _snap_decreasesnap(_) if (!isLiveCharting) changequant(-1);
inline function _snap_resetsnap(_) if (!isLiveCharting) setquant(16);

inline function changequant(change:Int) {
if (!isLiveCharting) {
quant = quants[FlxMath.wrap(quants.indexOf(quant) + change, 0, quants.length-1)];
buildSnapsUI();
}
}
inline function setquant(newquant:Int) {
if (!isLiveCharting) {
quant = newquant;
buildSnapsUI();
}
}

function buildSnapsUI():Array<UIContextMenuOption> {
var snapsTopButton:UITopMenuButton = topMenuSpr == null ? null : cast topMenuSpr.members[snapIndex];
Expand Down Expand Up @@ -1681,10 +1849,12 @@ class Charter extends UIState {
}

inline function _note_addsustain(t)
changeNoteSustain(1);
if (!isLiveCharting)
changeNoteSustain(1);

inline function _note_subtractsustain(t)
changeNoteSustain(-1);
if (!isLiveCharting)
changeNoteSustain(-1);

function _note_selectall(_) {
selection = cast notesGroup.members.copy();
Expand Down Expand Up @@ -1844,7 +2014,7 @@ class Charter extends UIState {
}

public inline function hitsoundsEnabled(id:Int)
return strumLines.members[id] != null && strumLines.members[id].hitsounds;
return isLiveCharting ? false : (strumLines.members[id] != null && strumLines.members[id].hitsounds);

public inline function __fixSelection(selection:Selection):Selection {
var newSelection:Selection = new Selection();
Expand Down Expand Up @@ -2035,4 +2205,4 @@ typedef PlaytestInfo = {
var hitSounds:Array<Bool>;
var mutedVocals:Array<Bool>;
var waveforms:Array<Int>;
}
}