Merge branch 'rewrite/master' into rewrite/feature/save-data-rewrite

This commit is contained in:
EliteMasterEric 2023-10-15 01:15:49 -04:00
commit 9f293d3be8
9 changed files with 230 additions and 63 deletions

View file

@ -156,7 +156,6 @@
<haxedef name="HXCPP_CHECK_POINTER" /> <haxedef name="HXCPP_CHECK_POINTER" />
<haxedef name="HXCPP_STACK_LINE" /> <haxedef name="HXCPP_STACK_LINE" />
<haxedef name="HXCPP_STACK_TRACE" /> <haxedef name="HXCPP_STACK_TRACE" />
<haxedef name="openfl-enable-handle-error" />
<!-- This macro allows addition of new functionality to existing Flixel. --> <!-- This macro allows addition of new functionality to existing Flixel. -->
<haxeflag name="--macro" value="addMetadata('@:build(funkin.util.macro.FlxMacro.buildFlxBasic())', 'flixel.FlxBasic')" /> <haxeflag name="--macro" value="addMetadata('@:build(funkin.util.macro.FlxMacro.buildFlxBasic())', 'flixel.FlxBasic')" />
<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)--> <!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
@ -196,6 +195,22 @@
<haxedef name="REDIRECT_ASSETS_FOLDER" /> <haxedef name="REDIRECT_ASSETS_FOLDER" />
</section> </section>
<section>
<!--
This flag enables the popup/crashlog error handler.
However, it also messes with breakpoints on some platforms.
-->
<haxedef name="openfl-enable-handle-error" />
</section>
<section>
<!-- TODO: Add a flag to Github Actions to turn this on or something. -->
<!-- Forces the version string to include the Git hash even on release builds (which are used for performance reasons). -->
<haxedef name="FORCE_DEBUG_VERSION" />
</section>
<!-- Run a script before and after building. --> <!-- Run a script before and after building. -->
<postbuild haxe="source/Prebuild.hx"/> --> <postbuild haxe="source/Prebuild.hx"/> -->
<postbuild haxe="source/Postbuild.hx"/> --> <postbuild haxe="source/Postbuild.hx"/> -->

2
assets

@ -1 +1 @@
Subproject commit d2b3dcab92f5cb4b11774a80cbe2e270972a9577 Subproject commit 8104d43e584a1f25e574438d7b21a7e671358969

View file

@ -533,7 +533,7 @@ class FreeplayState extends MusicBeatSubState
var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem); var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem);
randomCapsule.init(FlxG.width, 0, "Random"); randomCapsule.init(FlxG.width, 0, "Random");
randomCapsule.onConfirm = function() { randomCapsule.onConfirm = function() {
trace("RANDOM SELECTED"); capsuleOnConfirmRandom(randomCapsule);
}; };
randomCapsule.y = randomCapsule.intendedY(0) + 10; randomCapsule.y = randomCapsule.intendedY(0) + 10;
randomCapsule.targetPos.x = randomCapsule.x; randomCapsule.targetPos.x = randomCapsule.x;
@ -595,6 +595,8 @@ class FreeplayState extends MusicBeatSubState
var spamTimer:Float = 0; var spamTimer:Float = 0;
var spamming:Bool = false; var spamming:Bool = false;
var busy:Bool = false; // Set to true once the user has pressed enter to select a song.
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
super.update(elapsed); super.update(elapsed);
@ -646,6 +648,13 @@ class FreeplayState extends MusicBeatSubState
txtCompletion.text = Math.floor(lerpCompletion * 100) + "%"; txtCompletion.text = Math.floor(lerpCompletion * 100) + "%";
handleInputs(elapsed);
}
function handleInputs(elapsed:Float):Void
{
if (busy) return;
var upP = controls.UI_UP_P; var upP = controls.UI_UP_P;
var downP = controls.UI_DOWN_P; var downP = controls.UI_DOWN_P;
var accepted = controls.ACCEPT; var accepted = controls.ACCEPT;
@ -908,8 +917,17 @@ class FreeplayState extends MusicBeatSubState
} }
} }
function capsuleOnConfirmRandom(cap:SongMenuItem):Void
{
trace("RANDOM SELECTED");
busy = true;
}
function capsuleOnConfirmDefault(cap:SongMenuItem):Void function capsuleOnConfirmDefault(cap:SongMenuItem):Void
{ {
busy = true;
PlayStatePlaylist.isStoryMode = false; PlayStatePlaylist.isStoryMode = false;
var songId:String = cap.songTitle.toLowerCase(); var songId:String = cap.songTitle.toLowerCase();

View file

@ -150,6 +150,11 @@ class PauseSubState extends MusicBeatSubState
super.update(elapsed); super.update(elapsed);
handleInputs();
}
function handleInputs():Void
{
var upP = controls.UI_UP_P; var upP = controls.UI_UP_P;
var downP = controls.UI_DOWN_P; var downP = controls.UI_DOWN_P;
var accepted = controls.ACCEPT; var accepted = controls.ACCEPT;
@ -229,9 +234,14 @@ class PauseSubState extends MusicBeatSubState
FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true; FlxTransitionableState.skipNextTransOut = true;
if (PlayStatePlaylist.isStoryMode) openSubState(new funkin.ui.StickerSubState(null, STORY)); if (PlayStatePlaylist.isStoryMode)
{
openSubState(new funkin.ui.StickerSubState(null, STORY));
}
else else
{
openSubState(new funkin.ui.StickerSubState(null, FREEPLAY)); openSubState(new funkin.ui.StickerSubState(null, FREEPLAY));
}
case 'Exit to Chart Editor': case 'Exit to Chart Editor':
this.close(); this.close();

View file

@ -17,6 +17,9 @@ import openfl.geom.Matrix;
import openfl.display.Sprite; import openfl.display.Sprite;
import openfl.display.Bitmap; import openfl.display.Bitmap;
using Lambda;
using StringTools;
class StickerSubState extends MusicBeatSubState class StickerSubState extends MusicBeatSubState
{ {
public var grpStickers:FlxTypedGroup<StickerSprite>; public var grpStickers:FlxTypedGroup<StickerSprite>;
@ -26,10 +29,60 @@ class StickerSubState extends MusicBeatSubState
var nextState:NEXTSTATE = FREEPLAY; var nextState:NEXTSTATE = FREEPLAY;
// what "folders" to potentially load from (as of writing only "keys" exist)
var soundSelections:Array<String> = [];
// what "folder" was randomly selected
var soundSelection:String = "";
var sounds:Array<String> = [];
public function new(?oldStickers:Array<StickerSprite>, ?nextState:NEXTSTATE = FREEPLAY):Void public function new(?oldStickers:Array<StickerSprite>, ?nextState:NEXTSTATE = FREEPLAY):Void
{ {
super(); super();
// todo still
// make sure that ONLY plays mp3/ogg files
// if there's no mp3/ogg file, then it regenerates/reloads the random folder
var assetsInList = openfl.utils.Assets.list();
var soundFilterFunc = function(a:String) {
return a.startsWith('assets/shared/sounds/stickersounds/');
};
soundSelections = assetsInList.filter(soundFilterFunc);
soundSelections = soundSelections.map(function(a:String) {
return a.replace('assets/shared/sounds/stickersounds/', '').split('/')[0];
});
// cracked cleanup... yuchh...
for (i in soundSelections)
{
while (soundSelections.contains(i))
{
soundSelections.remove(i);
}
soundSelections.push(i);
}
trace(soundSelections);
soundSelection = FlxG.random.getObject(soundSelections);
var filterFunc = function(a:String) {
return a.startsWith('assets/shared/sounds/stickersounds/' + soundSelection + '/');
};
var assetsInList3 = openfl.utils.Assets.list();
sounds = assetsInList3.filter(filterFunc);
for (i in 0...sounds.length)
{
sounds[i] = sounds[i].replace('assets/shared/sounds/', '');
sounds[i] = sounds[i].substring(0, sounds[i].lastIndexOf('.'));
}
trace(sounds);
// trace(assetsInList);
this.nextState = nextState; this.nextState = nextState;
grpStickers = new FlxTypedGroup<StickerSprite>(); grpStickers = new FlxTypedGroup<StickerSprite>();
@ -66,6 +119,8 @@ class StickerSubState extends MusicBeatSubState
{ {
new FlxTimer().start(sticker.timing, _ -> { new FlxTimer().start(sticker.timing, _ -> {
sticker.visible = false; sticker.visible = false;
var daSound:String = FlxG.random.getObject(sounds);
FlxG.sound.play(Paths.sound(daSound));
if (ind == grpStickers.members.length - 1) if (ind == grpStickers.members.length - 1)
{ {
@ -151,7 +206,11 @@ class StickerSubState extends MusicBeatSubState
sticker.timing = FlxMath.remapToRange(ind, 0, grpStickers.members.length, 0, 0.9); sticker.timing = FlxMath.remapToRange(ind, 0, grpStickers.members.length, 0, 0.9);
new FlxTimer().start(sticker.timing, _ -> { new FlxTimer().start(sticker.timing, _ -> {
if (grpStickers == null) return;
sticker.visible = true; sticker.visible = true;
var daSound:String = FlxG.random.getObject(sounds);
FlxG.sound.play(Paths.sound(daSound));
var frameTimer:Int = FlxG.random.int(0, 2); var frameTimer:Int = FlxG.random.int(0, 2);
@ -212,10 +271,10 @@ class StickerSubState extends MusicBeatSubState
{ {
super.update(elapsed); super.update(elapsed);
if (FlxG.keys.justPressed.ANY) // if (FlxG.keys.justPressed.ANY)
{ // {
regenStickers(); // regenStickers();
} // }
} }
var switchingState:Bool = false; var switchingState:Bool = false;

View file

@ -116,10 +116,10 @@ class ChartEditorImportExportHandler
/** /**
* @param force Whether to force the export without prompting the user for a file location. * @param force Whether to force the export without prompting the user for a file location.
* @param tmp If true, save to the temporary directory instead of the local `backup` directory.
*/ */
public static function exportAllSongData(state:ChartEditorState, force:Bool = false, tmp:Bool = false):Void public static function exportAllSongData(state:ChartEditorState, force:Bool = false):Void
{ {
var tmp = false;
var zipEntries:Array<haxe.zip.Entry> = []; var zipEntries:Array<haxe.zip.Entry> = [];
for (variation in state.availableVariations) for (variation in state.availableVariations)
@ -133,9 +133,9 @@ class ChartEditorImportExportHandler
if (variationId == '') if (variationId == '')
{ {
var variationMetadata:Null<SongMetadata> = state.songMetadata.get(variation); var variationMetadata:Null<SongMetadata> = state.songMetadata.get(variation);
if (variationMetadata != null) zipEntries.push(FileUtil.makeZIPEntry('${state.currentSongId}-metadata.json', SerializerUtil.toJSON(variationMetadata))); if (variationMetadata != null) zipEntries.push(FileUtil.makeZIPEntry('${state.currentSongId}-metadata.json', variationMetadata.serialize()));
var variationChart:Null<SongChartData> = state.songChartData.get(variation); var variationChart:Null<SongChartData> = state.songChartData.get(variation);
if (variationChart != null) zipEntries.push(FileUtil.makeZIPEntry('${state.currentSongId}-chart.json', SerializerUtil.toJSON(variationChart))); if (variationChart != null) zipEntries.push(FileUtil.makeZIPEntry('${state.currentSongId}-chart.json', variationChart.serialize()));
} }
else else
{ {

View file

@ -695,6 +695,16 @@ class ChartEditorState extends HaxeUIState
*/ */
var downKeyHandler:TurboKeyHandler = TurboKeyHandler.build(FlxKey.DOWN); var downKeyHandler:TurboKeyHandler = TurboKeyHandler.build(FlxKey.DOWN);
/**
* Variable used to track how long the user has been holding the W keybind.
*/
var wKeyHandler:TurboKeyHandler = TurboKeyHandler.build(FlxKey.W);
/**
* Variable used to track how long the user has been holding the S keybind.
*/
var sKeyHandler:TurboKeyHandler = TurboKeyHandler.build(FlxKey.S);
/** /**
* Variable used to track how long the user has been holding the page-up keybind. * Variable used to track how long the user has been holding the page-up keybind.
*/ */
@ -1609,6 +1619,7 @@ class ChartEditorState extends HaxeUIState
addUIClickListener('menubarItemSaveChartAs', _ -> ChartEditorImportExportHandler.exportAllSongData(this)); addUIClickListener('menubarItemSaveChartAs', _ -> ChartEditorImportExportHandler.exportAllSongData(this));
addUIClickListener('menubarItemLoadInst', _ -> ChartEditorDialogHandler.openUploadInstDialog(this, true)); addUIClickListener('menubarItemLoadInst', _ -> ChartEditorDialogHandler.openUploadInstDialog(this, true));
addUIClickListener('menubarItemImportChart', _ -> ChartEditorDialogHandler.openImportChartDialog(this, 'legacy', true)); addUIClickListener('menubarItemImportChart', _ -> ChartEditorDialogHandler.openImportChartDialog(this, 'legacy', true));
addUIClickListener('menubarItemExit', _ -> quitChartEditor());
addUIClickListener('menubarItemUndo', _ -> undoLastCommand()); addUIClickListener('menubarItemUndo', _ -> undoLastCommand());
@ -1663,16 +1674,20 @@ class ChartEditorState extends HaxeUIState
addUIClickListener('menubarItemSelectNone', _ -> performCommand(new DeselectAllItemsCommand(currentNoteSelection, currentEventSelection))); addUIClickListener('menubarItemSelectNone', _ -> performCommand(new DeselectAllItemsCommand(currentNoteSelection, currentEventSelection)));
// TODO: Implement these.
// addUIClickListener('menubarItemSelectRegion', _ -> doSomething());
// addUIClickListener('menubarItemSelectBeforeCursor', _ -> doSomething());
// addUIClickListener('menubarItemSelectAfterCursor', _ -> doSomething());
addUIClickListener('menubarItemPlaytestFull', _ -> testSongInPlayState(false)); addUIClickListener('menubarItemPlaytestFull', _ -> testSongInPlayState(false));
addUIClickListener('menubarItemPlaytestMinimal', _ -> testSongInPlayState(true)); addUIClickListener('menubarItemPlaytestMinimal', _ -> testSongInPlayState(true));
addUIChangeListener('menubarItemInputStyleGroup', function(event:UIEvent) { addUIClickListener('menuBarItemNoteSnapDecrease', _ -> noteSnapQuantIndex--);
trace('Change input style: ${event.target}'); addUIClickListener('menuBarItemNoteSnapIncrease', _ -> noteSnapQuantIndex++);
addUIChangeListener('menuBarItemInputStyleNone', function(event:UIEvent) {
currentLiveInputStyle = None;
});
addUIChangeListener('menuBarItemInputStyleNumberKeys', function(event:UIEvent) {
currentLiveInputStyle = NumberKeys;
});
addUIChangeListener('menuBarItemInputStyleWASD', function(event:UIEvent) {
currentLiveInputStyle = WASD;
}); });
addUIClickListener('menubarItemAbout', _ -> ChartEditorDialogHandler.openAboutDialog(this)); addUIClickListener('menubarItemAbout', _ -> ChartEditorDialogHandler.openAboutDialog(this));
@ -1769,6 +1784,8 @@ class ChartEditorState extends HaxeUIState
add(redoKeyHandler); add(redoKeyHandler);
add(upKeyHandler); add(upKeyHandler);
add(downKeyHandler); add(downKeyHandler);
add(wKeyHandler);
add(sKeyHandler);
add(pageUpKeyHandler); add(pageUpKeyHandler);
add(pageDownKeyHandler); add(pageDownKeyHandler);
} }
@ -1795,7 +1812,7 @@ class ChartEditorState extends HaxeUIState
// Auto-save to local storage. // Auto-save to local storage.
#else #else
// Auto-save to temp file. // Auto-save to temp file.
ChartEditorImportExportHandler.exportAllSongData(this, true, true); ChartEditorImportExportHandler.exportAllSongData(this, true);
#end #end
} }
@ -1817,6 +1834,13 @@ class ChartEditorState extends HaxeUIState
public override function update(elapsed:Float):Void public override function update(elapsed:Float):Void
{ {
// Override F4 behavior to include the autosave.
if (FlxG.keys.justPressed.F4)
{
quitChartEditor();
return;
}
// dispatchEvent gets called here. // dispatchEvent gets called here.
super.update(elapsed); super.update(elapsed);
@ -1896,20 +1920,33 @@ class ChartEditorState extends HaxeUIState
// Mouse Wheel = Scroll // Mouse Wheel = Scroll
if (FlxG.mouse.wheel != 0 && !FlxG.keys.pressed.CONTROL) if (FlxG.mouse.wheel != 0 && !FlxG.keys.pressed.CONTROL)
{ {
scrollAmount = -10 * FlxG.mouse.wheel; scrollAmount = -50 * FlxG.mouse.wheel;
shouldPause = true; shouldPause = true;
} }
// Up Arrow = Scroll Up // Up Arrow = Scroll Up
if (upKeyHandler.activated && currentLiveInputStyle != LiveInputStyle.WASD) if (upKeyHandler.activated && currentLiveInputStyle == None)
{ {
scrollAmount = -GRID_SIZE * 0.25 * 5.0; scrollAmount = -GRID_SIZE * 0.25 * 25.0;
shouldPause = true; shouldPause = true;
} }
// Down Arrow = Scroll Down // Down Arrow = Scroll Down
if (downKeyHandler.activated && currentLiveInputStyle != LiveInputStyle.WASD) if (downKeyHandler.activated && currentLiveInputStyle == None)
{ {
scrollAmount = GRID_SIZE * 0.25 * 5.0; scrollAmount = GRID_SIZE * 0.25 * 25.0;
shouldPause = true;
}
// W = Scroll Up (doesn't work with Ctrl+Scroll)
if (wKeyHandler.activated && currentLiveInputStyle == None && !FlxG.keys.pressed.CONTROL)
{
scrollAmount = -GRID_SIZE * 0.25 * 25.0;
shouldPause = true;
}
// S = Scroll Down (doesn't work with Ctrl+Scroll)
if (sKeyHandler.activated && currentLiveInputStyle == None && !FlxG.keys.pressed.CONTROL)
{
scrollAmount = GRID_SIZE * 0.25 * 25.0;
shouldPause = true; shouldPause = true;
} }
@ -1974,7 +2011,7 @@ class ChartEditorState extends HaxeUIState
// SHIFT + Scroll = Scroll Fast // SHIFT + Scroll = Scroll Fast
if (FlxG.keys.pressed.SHIFT) if (FlxG.keys.pressed.SHIFT)
{ {
scrollAmount *= 5; scrollAmount *= 2;
} }
// CONTROL + Scroll = Scroll Precise // CONTROL + Scroll = Scroll Precise
if (FlxG.keys.pressed.CONTROL) if (FlxG.keys.pressed.CONTROL)
@ -2045,14 +2082,17 @@ class ChartEditorState extends HaxeUIState
function handleSnap():Void function handleSnap():Void
{ {
if (FlxG.keys.justPressed.LEFT && !FlxG.keys.pressed.CONTROL) if (currentLiveInputStyle == None)
{ {
noteSnapQuantIndex--; if (FlxG.keys.justPressed.LEFT && !FlxG.keys.pressed.CONTROL)
} {
noteSnapQuantIndex--;
}
if (FlxG.keys.justPressed.RIGHT && !FlxG.keys.pressed.CONTROL) if (FlxG.keys.justPressed.RIGHT && !FlxG.keys.pressed.CONTROL)
{ {
noteSnapQuantIndex++; noteSnapQuantIndex++;
}
} }
} }
@ -3032,10 +3072,16 @@ class ChartEditorState extends HaxeUIState
// CTRL + Q = Quit to Menu // CTRL + Q = Quit to Menu
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.Q) if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.Q)
{ {
FlxG.switchState(new MainMenuState()); quitChartEditor();
} }
} }
function quitChartEditor():Void
{
autoSave();
FlxG.switchState(new MainMenuState());
}
/** /**
* Handle keybinds for edit menu items. * Handle keybinds for edit menu items.
*/ */
@ -3124,13 +3170,17 @@ class ChartEditorState extends HaxeUIState
*/ */
function handleViewKeybinds():Void function handleViewKeybinds():Void
{ {
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.LEFT) if (currentLiveInputStyle == None)
{ {
incrementDifficulty(-1); if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.LEFT)
} {
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT) incrementDifficulty(-1);
{ }
incrementDifficulty(1); if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT)
{
incrementDifficulty(1);
}
// Would bind Ctrl+A and Ctrl+D here, but they are already bound to Select All and Select None.
} }
} }
@ -3237,7 +3287,7 @@ class ChartEditorState extends HaxeUIState
*/ */
function handleTestKeybinds():Void function handleTestKeybinds():Void
{ {
if (!isHaxeUIDialogOpen && FlxG.keys.justPressed.ENTER) if (!isHaxeUIDialogOpen && !isCursorOverHaxeUI && FlxG.keys.justPressed.ENTER)
{ {
var minimal = FlxG.keys.pressed.SHIFT; var minimal = FlxG.keys.pressed.SHIFT;
testSongInPlayState(minimal); testSongInPlayState(minimal);
@ -3829,25 +3879,26 @@ class ChartEditorState extends HaxeUIState
switch (currentLiveInputStyle) switch (currentLiveInputStyle)
{ {
case LiveInputStyle.WASD: case LiveInputStyle.WASD:
if (FlxG.keys.justPressed.A) placeNoteAtPlayhead(0); if (FlxG.keys.justPressed.A) placeNoteAtPlayhead(4);
if (FlxG.keys.justPressed.S) placeNoteAtPlayhead(1); if (FlxG.keys.justPressed.S) placeNoteAtPlayhead(5);
if (FlxG.keys.justPressed.W) placeNoteAtPlayhead(2); if (FlxG.keys.justPressed.W) placeNoteAtPlayhead(6);
if (FlxG.keys.justPressed.D) placeNoteAtPlayhead(3); if (FlxG.keys.justPressed.D) placeNoteAtPlayhead(7);
if (FlxG.keys.justPressed.LEFT) placeNoteAtPlayhead(4); if (FlxG.keys.justPressed.LEFT) placeNoteAtPlayhead(0);
if (FlxG.keys.justPressed.DOWN) placeNoteAtPlayhead(5); if (FlxG.keys.justPressed.DOWN) placeNoteAtPlayhead(1);
if (FlxG.keys.justPressed.UP) placeNoteAtPlayhead(6); if (FlxG.keys.justPressed.UP) placeNoteAtPlayhead(2);
if (FlxG.keys.justPressed.RIGHT) placeNoteAtPlayhead(7); if (FlxG.keys.justPressed.RIGHT) placeNoteAtPlayhead(3);
case LiveInputStyle.NumberKeys: case LiveInputStyle.NumberKeys:
if (FlxG.keys.justPressed.ONE) placeNoteAtPlayhead(0); // Flipped because Dad is on the left but represents data 0-3.
if (FlxG.keys.justPressed.TWO) placeNoteAtPlayhead(1); if (FlxG.keys.justPressed.ONE) placeNoteAtPlayhead(4);
if (FlxG.keys.justPressed.THREE) placeNoteAtPlayhead(2); if (FlxG.keys.justPressed.TWO) placeNoteAtPlayhead(5);
if (FlxG.keys.justPressed.FOUR) placeNoteAtPlayhead(3); if (FlxG.keys.justPressed.THREE) placeNoteAtPlayhead(6);
if (FlxG.keys.justPressed.FOUR) placeNoteAtPlayhead(7);
if (FlxG.keys.justPressed.FIVE) placeNoteAtPlayhead(4); if (FlxG.keys.justPressed.FIVE) placeNoteAtPlayhead(0);
if (FlxG.keys.justPressed.SIX) placeNoteAtPlayhead(5); if (FlxG.keys.justPressed.SIX) placeNoteAtPlayhead(1);
if (FlxG.keys.justPressed.SEVEN) placeNoteAtPlayhead(6); if (FlxG.keys.justPressed.SEVEN) placeNoteAtPlayhead(2);
if (FlxG.keys.justPressed.EIGHT) placeNoteAtPlayhead(7); if (FlxG.keys.justPressed.EIGHT) placeNoteAtPlayhead(3);
case LiveInputStyle.None: case LiveInputStyle.None:
// Do nothing. // Do nothing.
} }
@ -3856,12 +3907,24 @@ class ChartEditorState extends HaxeUIState
function placeNoteAtPlayhead(column:Int):Void function placeNoteAtPlayhead(column:Int):Void
{ {
var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels;
var playheadPosFractionalStep:Float = playheadPos / GRID_SIZE / (16 / noteSnapQuant); var playheadPosFractionalStep:Float = playheadPos / GRID_SIZE / noteSnapRatio;
var playheadPosStep:Int = Std.int(Math.floor(playheadPosFractionalStep)); var playheadPosStep:Int = Std.int(Math.floor(playheadPosFractionalStep));
var playheadPosMs:Float = playheadPosStep * Conductor.stepLengthMs * (16 / noteSnapQuant); var playheadPosSnappedMs:Float = playheadPosStep * Conductor.stepLengthMs * noteSnapRatio;
var newNoteData:SongNoteData = new SongNoteData(playheadPosMs, column, 0, selectedNoteKind); // Look for notes within 1 step of the playhead.
performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL)); var notesAtPos:Array<SongNoteData> = SongDataUtils.getNotesInTimeRange(currentSongChartNoteData, playheadPosSnappedMs,
playheadPosSnappedMs + Conductor.stepLengthMs * noteSnapRatio);
notesAtPos = SongDataUtils.getNotesWithData(notesAtPos, [column]);
if (notesAtPos.length == 0)
{
var newNoteData:SongNoteData = new SongNoteData(playheadPosSnappedMs, column, 0, selectedNoteKind);
performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL));
}
else
{
trace('Already a note there.');
}
} }
function set_scrollPositionInPixels(value:Float):Float function set_scrollPositionInPixels(value:Float):Float
@ -3920,6 +3983,8 @@ class ChartEditorState extends HaxeUIState
*/ */
public function testSongInPlayState(minimal:Bool = false):Void public function testSongInPlayState(minimal:Bool = false):Void
{ {
autoSave();
var startTimestamp:Float = 0; var startTimestamp:Float = 0;
if (playtestStartTime) startTimestamp = scrollPositionInMs + playheadPositionInMs; if (playtestStartTime) startTimestamp = scrollPositionInMs + playheadPositionInMs;

View file

@ -39,7 +39,7 @@ class Constants
*/ */
public static final VERSION_SUFFIX:String = ' PROTOTYPE'; public static final VERSION_SUFFIX:String = ' PROTOTYPE';
#if debug #if (debug || FORCE_DEBUG_VERSION)
static function get_VERSION():String static function get_VERSION():String
{ {
return 'v${Application.current.meta.get('version')} (${GIT_BRANCH} : ${GIT_HASH})' + VERSION_SUFFIX; return 'v${Application.current.meta.get('version')} (${GIT_BRANCH} : ${GIT_HASH})' + VERSION_SUFFIX;
@ -71,7 +71,7 @@ class Constants
*/ */
// ============================== // ==============================
#if debug #if (debug || FORCE_DEBUG_VERSION)
/** /**
* The current Git branch. * The current Git branch.
*/ */

View file

@ -1,6 +1,6 @@
package funkin.util.macro; package funkin.util.macro;
#if debug #if (debug || FORCE_DEBUG_VERSION)
class GitCommit class GitCommit
{ {
/** /**