mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
Merge pull request #154 from FunkinCrew/feature/ghost-hold-notes
Chart Editor - Ghost Hold Notes
This commit is contained in:
commit
72f9cfdf76
2 changed files with 28 additions and 8 deletions
|
@ -142,8 +142,9 @@ class ChartEditorHoldNoteSprite extends SustainTrail
|
||||||
{
|
{
|
||||||
// noteData.stepTime is a calculated value which accounts for BPM changes
|
// noteData.stepTime is a calculated value which accounts for BPM changes
|
||||||
var stepTime:Float = this.noteData.stepTime;
|
var stepTime:Float = this.noteData.stepTime;
|
||||||
var roundedStepTime:Float = Math.floor(stepTime + 0.01); // Add epsilon to fix rounding issues
|
// Add epsilon to fix rounding issues?
|
||||||
this.y = roundedStepTime * ChartEditorState.GRID_SIZE;
|
// var roundedStepTime:Float = Math.floor((stepTime + 0.01) / noteSnapRatio) * noteSnapRatio;
|
||||||
|
this.y = stepTime * ChartEditorState.GRID_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.x += ChartEditorState.GRID_SIZE / 2;
|
this.x += ChartEditorState.GRID_SIZE / 2;
|
||||||
|
|
|
@ -1121,6 +1121,11 @@ class ChartEditorState extends HaxeUIState
|
||||||
*/
|
*/
|
||||||
var gridGhostNote:Null<ChartEditorNoteSprite> = null;
|
var gridGhostNote:Null<ChartEditorNoteSprite> = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A sprite used to indicate the note that will be placed on click.
|
||||||
|
*/
|
||||||
|
var gridGhostHoldNote:Null<ChartEditorHoldNoteSprite> = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sprite used to indicate the event that will be placed on click.
|
* A sprite used to indicate the event that will be placed on click.
|
||||||
*/
|
*/
|
||||||
|
@ -1297,6 +1302,13 @@ class ChartEditorState extends HaxeUIState
|
||||||
add(gridGhostNote);
|
add(gridGhostNote);
|
||||||
gridGhostNote.zIndex = 11;
|
gridGhostNote.zIndex = 11;
|
||||||
|
|
||||||
|
gridGhostHoldNote = new ChartEditorHoldNoteSprite(this);
|
||||||
|
gridGhostHoldNote.alpha = 0.6;
|
||||||
|
gridGhostHoldNote.noteData = new SongNoteData(0, 0, 0, "");
|
||||||
|
gridGhostHoldNote.visible = false;
|
||||||
|
add(gridGhostHoldNote);
|
||||||
|
gridGhostHoldNote.zIndex = 11;
|
||||||
|
|
||||||
gridGhostEvent = new ChartEditorEventSprite(this);
|
gridGhostEvent = new ChartEditorEventSprite(this);
|
||||||
gridGhostEvent.alpha = 0.6;
|
gridGhostEvent.alpha = 0.6;
|
||||||
gridGhostEvent.eventData = new SongEventData(-1, '', {});
|
gridGhostEvent.eventData = new SongEventData(-1, '', {});
|
||||||
|
@ -2272,6 +2284,8 @@ class ChartEditorState extends HaxeUIState
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Clicking and dragging.
|
||||||
|
|
||||||
// Scroll the screen if the mouse is above or below the grid.
|
// Scroll the screen if the mouse is above or below the grid.
|
||||||
if (FlxG.mouse.screenY < MENU_BAR_HEIGHT)
|
if (FlxG.mouse.screenY < MENU_BAR_HEIGHT)
|
||||||
{
|
{
|
||||||
|
@ -2403,15 +2417,17 @@ class ChartEditorState extends HaxeUIState
|
||||||
{
|
{
|
||||||
// Handle extending the note as you drag.
|
// Handle extending the note as you drag.
|
||||||
|
|
||||||
// TODO: This should be beat snapped?
|
|
||||||
var dragLengthSteps:Float = Conductor.getTimeInSteps(cursorSnappedMs) - currentPlaceNoteData.stepTime;
|
var dragLengthSteps:Float = Conductor.getTimeInSteps(cursorSnappedMs) - currentPlaceNoteData.stepTime;
|
||||||
|
var dragLengthMs:Float = dragLengthSteps * Conductor.stepLengthMs;
|
||||||
|
var dragLengthPixels:Float = dragLengthSteps * GRID_SIZE;
|
||||||
|
|
||||||
// Without this, the newly placed note feels too short compared to the user's input.
|
gridGhostHoldNote.visible = true;
|
||||||
var INCREMENT:Float = 1.0;
|
gridGhostHoldNote.noteData = gridGhostNote.noteData;
|
||||||
// TODO: Make this not busted with BPM changes
|
gridGhostHoldNote.noteDirection = gridGhostNote.noteData.getDirection();
|
||||||
var dragLengthMs:Float = Math.floor(dragLengthSteps + INCREMENT) * Conductor.stepLengthMs;
|
|
||||||
|
|
||||||
// TODO: Add and update some sort of preview?
|
gridGhostHoldNote.setHeightDirectly(dragLengthPixels);
|
||||||
|
|
||||||
|
gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes);
|
||||||
|
|
||||||
if (FlxG.mouse.justReleased)
|
if (FlxG.mouse.justReleased)
|
||||||
{
|
{
|
||||||
|
@ -2565,6 +2581,7 @@ class ChartEditorState extends HaxeUIState
|
||||||
if (cursorColumn == eventColumn)
|
if (cursorColumn == eventColumn)
|
||||||
{
|
{
|
||||||
if (gridGhostNote != null) gridGhostNote.visible = false;
|
if (gridGhostNote != null) gridGhostNote.visible = false;
|
||||||
|
gridGhostHoldNote.visible = false;
|
||||||
|
|
||||||
if (gridGhostEvent == null) throw "ERROR: Tried to handle cursor, but gridGhostEvent is null! Check ChartEditorState.buildGrid()";
|
if (gridGhostEvent == null) throw "ERROR: Tried to handle cursor, but gridGhostEvent is null! Check ChartEditorState.buildGrid()";
|
||||||
|
|
||||||
|
@ -2608,6 +2625,7 @@ class ChartEditorState extends HaxeUIState
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gridGhostNote != null) gridGhostNote.visible = false;
|
if (gridGhostNote != null) gridGhostNote.visible = false;
|
||||||
|
if (gridGhostHoldNote != null) gridGhostHoldNote.visible = false;
|
||||||
if (gridGhostEvent != null) gridGhostEvent.visible = false;
|
if (gridGhostEvent != null) gridGhostEvent.visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2648,6 +2666,7 @@ class ChartEditorState extends HaxeUIState
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gridGhostNote != null) gridGhostNote.visible = false;
|
if (gridGhostNote != null) gridGhostNote.visible = false;
|
||||||
|
if (gridGhostHoldNote != null) gridGhostHoldNote.visible = false;
|
||||||
if (gridGhostEvent != null) gridGhostEvent.visible = false;
|
if (gridGhostEvent != null) gridGhostEvent.visible = false;
|
||||||
|
|
||||||
// Do not set Cursor.cursorMode here, because it will be set by the HaxeUI.
|
// Do not set Cursor.cursorMode here, because it will be set by the HaxeUI.
|
||||||
|
|
Loading…
Reference in a new issue