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

Live charting in Charter #432

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ba178cd
Add record icon
KadePleaseHelpMe Nov 5, 2024
14e875c
Add dropdown shit
KadePleaseHelpMe Nov 5, 2024
d8cfe19
Make the things play the song
KadePleaseHelpMe Nov 5, 2024
134ffe6
Add notes for coding
KadePleaseHelpMe Nov 5, 2024
adebf28
Keybind charting test
KadePleaseHelpMe Nov 6, 2024
a3f80da
add Live Charting check
KadePleaseHelpMe Nov 6, 2024
97b454b
Add checks for keybinds that could interfere
KadePleaseHelpMe Nov 6, 2024
0db2de6
whoopsie daisy gee willikers by jove oh stars
KadePleaseHelpMe Nov 6, 2024
e260ad0
Add stop to recording
KadePleaseHelpMe Nov 6, 2024
6628689
Actually just Shift + Alt + F the whole thing
KadePleaseHelpMe Nov 6, 2024
c310cf7
Moved the accept call
KadePleaseHelpMe Nov 6, 2024
e95c339
Bug I found
KadePleaseHelpMe Nov 6, 2024
b63ae93
oops
KadePleaseHelpMe Nov 6, 2024
80ca886
Add recording shit
KadePleaseHelpMe Nov 6, 2024
667d13c
Recording visuals + small bugfix
KadePleaseHelpMe Nov 6, 2024
bcfcf84
Merge branch 'FNF-CNE-Devs:main' into main
KadePleaseHelpMe Nov 8, 2024
4ba377d
Couldn't autoupdate
KadePleaseHelpMe Nov 9, 2024
6783685
Merge branch 'main' into pr/432
NeeEoo Nov 9, 2024
b3346f4
Removed (now unnecessary) trace functions
KadePleaseHelpMe Nov 9, 2024
c84cba2
I fucking hate Funkin Family Rush
KadePleaseHelpMe Nov 9, 2024
b8631c1
Merge branch 'FNF-CNE-Devs:main' into main
KadePleaseHelpMe Nov 11, 2024
770fb61
Merge branch 'main' into main
KadePleaseHelpMe Nov 27, 2024
2e58ed2
Merge branch 'main' into main
KadePleaseHelpMe Nov 30, 2024
99a15b7
Merge branch 'FNF-CNE-Devs:main' into main
KadePleaseHelpMe Dec 1, 2024
97cb25a
Merge branch 'FNF-CNE-Devs:main' into main
KadePleaseHelpMe Dec 8, 2024
156e528
Merge branch 'FNF-CNE-Devs:main' into main
KadePleaseHelpMe Dec 9, 2024
9838f8b
Merge branch 'CodenameCrew:main' into main
KadePleaseHelpMe Dec 11, 2024
0d380b9
Merge branch 'CodenameCrew:main' into main
KadePleaseHelpMe Dec 13, 2024
56ad986
Merge branch 'CodenameCrew:main' into main
KadePleaseHelpMe Dec 13, 2024
eb65284
Merge branch 'CodenameCrew:main' into main
KadePleaseHelpMe Dec 16, 2024
dbf3181
Slight Revival of Branch
KadePleaseHelpMe Dec 16, 2024
6b399f3
Typo
KadePleaseHelpMe Dec 16, 2024
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.
175 changes: 161 additions & 14 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,47 @@ class Charter extends UIState {
updateNoteLogic(elapsed);
updateAutoSaving(elapsed);

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

if (isLiveCharting) {
if (controls.LEFT) {
var leftrec = new CharterNote();
leftrec.updatePos(1.0, 0, 0, 0);
add(leftrec);
notesGroup.add(leftrec);
}
else if (controls.DOWN) {
var downrec = new CharterNote();
downrec.updatePos(1.0, 1, 0, 0);
add(downrec);
notesGroup.add(downrec);
}
else if (controls.UP) {
var uprec = new CharterNote();
uprec.updatePos(1.0, 2, 0, 0);
add(uprec);
notesGroup.add(uprec);
}
else if (controls.RIGHT) {
var rightrec = new CharterNote();
rightrec.updatePos(1.0, 3, 0, 0);
add(rightrec);
notesGroup.add(rightrec);
}
else if (controls.ACCEPT) {
trace("hey dummy I'm pressing accept");
FlxG.sound.music.pause();
vocals.pause();
for (strumLine in strumLines.members)
strumLine.vocals.pause();

isLiveCharting = false;
recordingDisplay(false);
}
}

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

if (FlxG.sound.music.playing || __firstFrame) {
gridBackdrops.conductorSprY = curStepFloat * 40;
} else {
Expand Down Expand Up @@ -1539,13 +1621,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 @@ -1642,12 +1777,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 +1826,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 +1991,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 +2182,4 @@ typedef PlaytestInfo = {
var hitSounds:Array<Bool>;
var mutedVocals:Array<Bool>;
var waveforms:Array<Int>;
}
}