Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -197,6 +197,9 @@
|
||||
|
||||
<haxeflag name="--macro" value="exclude('funkin.backend.system.updating')" unless="UPDATE_CHECKING"/>
|
||||
|
||||
<!-- Fix compiling issues -->
|
||||
<setenv name="HAXEPATH" value="./"/>
|
||||
|
||||
<haxedef name="HXCPP_CHECK_POINTER" if="release" />
|
||||
<haxedef name="HXCPP_STACK_LINE" if="release" />
|
||||
<haxedef name="HXCPP_DEBUG_LINK" if="release" />
|
||||
|
||||
@@ -63,6 +63,9 @@ class Main extends Sprite
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
|
||||
instance = this;
|
||||
|
||||
CrashHandler.init();
|
||||
|
||||
addChild(game = new FunkinGame(gameWidth, gameHeight, MainState, Options.framerate, Options.framerate, skipSplash, startFullscreen));
|
||||
|
||||
@@ -622,7 +622,7 @@ class Charter extends UIState {
|
||||
}
|
||||
}
|
||||
|
||||
if (gridActionType == NONE && mousePos.x < 0) {
|
||||
if (gridActionType == NONE && mousePos.x < 0 && mousePos.x > -addEventSpr.bWidth) {
|
||||
addEventSpr.incorporeal = false;
|
||||
addEventSpr.sprAlpha = lerp(addEventSpr.sprAlpha, 0.75, 0.25);
|
||||
var event = getHoveredEvent(mousePos.y);
|
||||
@@ -677,9 +677,16 @@ class Charter extends UIState {
|
||||
}, function (e:CharterEvent) {
|
||||
eventsGroup.add(e);
|
||||
e.revive();
|
||||
});
|
||||
e.refreshEventIcons();
|
||||
}, false);
|
||||
sortNotes();
|
||||
|
||||
for (s in selection)
|
||||
if (s is CharterEvent) {
|
||||
Charter.instance.updateBPMEvents();
|
||||
break;
|
||||
}
|
||||
|
||||
if (addToUndo)
|
||||
this.addToUndo(CCreateSelection(selection));
|
||||
return [];
|
||||
@@ -700,6 +707,12 @@ class Charter extends UIState {
|
||||
}
|
||||
sortNotes();
|
||||
|
||||
for (s in selection)
|
||||
if (s is CharterEvent) {
|
||||
Charter.instance.updateBPMEvents();
|
||||
break;
|
||||
}
|
||||
|
||||
if (addToUndo)
|
||||
this.addToUndo(CDeleteSelection(selection));
|
||||
return [];
|
||||
@@ -1035,21 +1048,26 @@ class Charter extends UIState {
|
||||
var v = undoList.shift();
|
||||
switch(v) {
|
||||
case null: // do nothing
|
||||
case CCreateSelection(selection):
|
||||
deleteSelection(selection, false);
|
||||
case CDeleteSelection(selection):
|
||||
createSelection(selection, false);
|
||||
case CSustainChange(changes):
|
||||
for(n in changes)
|
||||
n.note.updatePos(n.note.step, n.note.id, n.before, n.note.type);
|
||||
case CSelectionDrag(selection, change):
|
||||
for (s in selection)
|
||||
if (s.draggable) s.handleDrag(change * -1);
|
||||
this.selection = selection;
|
||||
case CDeleteStrumLine(strumLineID, strumLine):
|
||||
createStrumline(strumLineID, strumLine, false);
|
||||
case CCreateStrumLine(strumLineID, strumLine):
|
||||
deleteStrumline(strumLineID, false);
|
||||
case CCreateSelection(selection):
|
||||
deleteSelection(selection, false);
|
||||
case CDeleteSelection(selection):
|
||||
createSelection(selection, false);
|
||||
case CSelectionDrag(selection, change):
|
||||
for (s in selection)
|
||||
if (s.draggable) s.handleDrag(change * -1);
|
||||
this.selection = selection;
|
||||
case CEditSustains(changes):
|
||||
for(n in changes)
|
||||
n.note.updatePos(n.note.step, n.note.id, n.before, n.note.type);
|
||||
case CEditEvent(event, oldEvents, newEvents):
|
||||
event.events = oldEvents.copy();
|
||||
event.refreshEventIcons();
|
||||
|
||||
Charter.instance.updateBPMEvents();
|
||||
}
|
||||
if (v != null)
|
||||
redoList.insert(0, v);
|
||||
@@ -1071,21 +1089,26 @@ class Charter extends UIState {
|
||||
var v = redoList.shift();
|
||||
switch(v) {
|
||||
case null: // do nothing
|
||||
case CCreateSelection(selection):
|
||||
createSelection(selection, false);
|
||||
case CDeleteSelection(selection):
|
||||
deleteSelection(selection, false);
|
||||
case CSustainChange(changes):
|
||||
for(n in changes)
|
||||
n.note.updatePos(n.note.step, n.note.id, n.after, n.note.type);
|
||||
case CSelectionDrag(selection, change):
|
||||
for (s in selection)
|
||||
if (s.draggable) s.handleDrag(change);
|
||||
this.selection = selection;
|
||||
case CDeleteStrumLine(strumLineID, strumLine):
|
||||
deleteStrumline(strumLineID, false);
|
||||
case CCreateStrumLine(strumLineID, strumLine):
|
||||
createStrumline(strumLineID, strumLine, false);
|
||||
case CCreateSelection(selection):
|
||||
createSelection(selection, false);
|
||||
case CDeleteSelection(selection):
|
||||
deleteSelection(selection, false);
|
||||
case CSelectionDrag(selection, change):
|
||||
for (s in selection)
|
||||
if (s.draggable) s.handleDrag(change);
|
||||
this.selection = selection;
|
||||
case CEditSustains(changes):
|
||||
for(n in changes)
|
||||
n.note.updatePos(n.note.step, n.note.id, n.after, n.note.type);
|
||||
case CEditEvent(event, oldEvents, newEvents):
|
||||
event.events = newEvents.copy();
|
||||
event.refreshEventIcons();
|
||||
|
||||
Charter.instance.updateBPMEvents();
|
||||
}
|
||||
if (v != null)
|
||||
undoList.insert(0, v);
|
||||
@@ -1174,7 +1197,7 @@ class Charter extends UIState {
|
||||
function changeNoteSustain(change:Float) {
|
||||
if (selection.length <= 0 || change == 0) return;
|
||||
|
||||
addToUndo(CSustainChange([
|
||||
addToUndo(CEditSustains([
|
||||
for(s in selection) {
|
||||
if (s is CharterNote) {
|
||||
var n:CharterNote = cast(s, CharterNote);
|
||||
@@ -1231,7 +1254,7 @@ class Charter extends UIState {
|
||||
}
|
||||
}
|
||||
|
||||
public function updateBPMEvents(newEvent:CharterEvent) {
|
||||
public function updateBPMEvents() {
|
||||
buildEvents();
|
||||
|
||||
Conductor.mapBPMChanges(PlayState.SONG);
|
||||
@@ -1245,12 +1268,13 @@ class Charter extends UIState {
|
||||
}
|
||||
|
||||
enum CharterChange {
|
||||
CCreateStrumLine(strumLineID:Int, strumLine:ChartStrumLine);
|
||||
CDeleteStrumLine(strumLineID:Int, strumLine:ChartStrumLine);
|
||||
CCreateSelection(selection:Selection);
|
||||
CDeleteSelection(selection:Selection);
|
||||
CSelectionDrag(selection:Selection, change:FlxPoint);
|
||||
CSustainChange(notes:Array<NoteSustainChange>);
|
||||
CCreateStrumLine(strumLineID:Int, strumLine:ChartStrumLine);
|
||||
CDeleteStrumLine(strumLineID:Int, strumLine:ChartStrumLine);
|
||||
CEditSustains(notes:Array<NoteSustainChange>);
|
||||
CEditEvent(event:CharterEvent, oldEvents:Array<ChartEvent>, newEvents:Array<ChartEvent>);
|
||||
}
|
||||
|
||||
enum CharterCopyboardObject {
|
||||
@@ -1269,11 +1293,11 @@ typedef NoteSustainChange = {
|
||||
this = array == null ? [] : array;
|
||||
|
||||
// too lazy to put this in every for loop so i made it a abstract
|
||||
public inline function loop(onNote:CharterNote->Void, ?onEvent:CharterEvent->Void) {
|
||||
public inline function loop(onNote:CharterNote->Void, ?onEvent:CharterEvent->Void, ?draggableOnly:Bool = true) {
|
||||
for (s in this) {
|
||||
if (s is CharterNote && onNote != null && s.draggable)
|
||||
if (s is CharterNote && onNote != null && (draggableOnly ? s.draggable: true))
|
||||
onNote(cast(s, CharterNote));
|
||||
else if (s is CharterEvent && onEvent != null && s.draggable)
|
||||
else if (s is CharterEvent && onEvent != null && (draggableOnly ? s.draggable: true))
|
||||
onEvent(cast(s, CharterEvent));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,10 +77,8 @@ class CharterEvent extends UISliceSprite implements ICharterSelectable {
|
||||
return (selectionBox.x + selectionBox.bWidth > x) && (selectionBox.x < x + bWidth) && (selectionBox.y + selectionBox.bHeight > y) && (selectionBox.y < y + bHeight);
|
||||
}
|
||||
|
||||
public function handleDrag(change:FlxPoint) {
|
||||
public function handleDrag(change:FlxPoint)
|
||||
y = ((step += change.x) * 40) - 17;
|
||||
Charter.instance.updateBPMEvents(this);
|
||||
}
|
||||
|
||||
public function refreshEventIcons() {
|
||||
while(icons.length > 0) {
|
||||
|
||||
@@ -19,14 +19,10 @@ class CharterEventAdd extends UISliceSprite {
|
||||
public override function onHovered() {
|
||||
super.onHovered();
|
||||
if (FlxG.mouse.justReleased) {
|
||||
if (curCharterEvent != null) {
|
||||
Charter.instance.openSubState(new CharterEventScreen(curCharterEvent));
|
||||
} else {
|
||||
var event:CharterEvent = new CharterEvent(step, []);
|
||||
Charter.instance.eventsGroup.add(event);
|
||||
|
||||
Charter.instance.openSubState(new CharterEventScreen(event));
|
||||
}
|
||||
if (curCharterEvent != null)
|
||||
Charter.instance.openSubState(new CharterEventScreen(step, curCharterEvent));
|
||||
else
|
||||
Charter.instance.openSubState(new CharterEventScreen(step));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import funkin.backend.chart.ChartData.ChartEvent;
|
||||
import funkin.backend.system.Conductor;
|
||||
import flixel.group.FlxGroup;
|
||||
import funkin.editors.charter.EventsData;
|
||||
@@ -11,6 +12,9 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
public var cam:FlxCamera;
|
||||
public var chartEvent:CharterEvent;
|
||||
|
||||
public var step:Float = 0;
|
||||
public var events:Array<ChartEvent> = [];
|
||||
|
||||
public var iconsPanel:FlxGroup;
|
||||
|
||||
public var eventName:UIText;
|
||||
@@ -22,13 +26,17 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
public var saveButton:UIButton;
|
||||
public var deleteButton:UIButton;
|
||||
|
||||
public function new(chartEvent:CharterEvent) {
|
||||
public function new(step:Float, ?chartEvent:Null<CharterEvent>) {
|
||||
if (chartEvent != null) this.chartEvent = chartEvent;
|
||||
this.step = step;
|
||||
super();
|
||||
this.chartEvent = chartEvent;
|
||||
}
|
||||
|
||||
public override function create() {
|
||||
winTitle = "Event group properties";
|
||||
var creatingEvent:Bool = chartEvent == null;
|
||||
if (creatingEvent) chartEvent = new CharterEvent(step, []);
|
||||
|
||||
winTitle = creatingEvent ? "Create Event Group" : "Edit Event Group";
|
||||
winWidth = 960;
|
||||
|
||||
super.create();
|
||||
@@ -36,6 +44,8 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
FlxG.sound.music.pause(); // prevent the song from continuing
|
||||
Charter.instance.vocals.pause();
|
||||
|
||||
events = chartEvent.events.copy();
|
||||
|
||||
var bg:FlxSprite = new FlxSprite(windowSpr.x + 1, windowSpr.y + 31, Paths.image('editors/ui/scrollbar-bg'));
|
||||
bg.setGraphicSize(30, windowSpr.bHeight - 32);
|
||||
bg.updateHitbox();
|
||||
@@ -46,12 +56,12 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
|
||||
addButton = new UIButton(windowSpr.x + 1, windowSpr.y + 31, "", function() {
|
||||
openSubState(new CharterEventTypeSelection(function(eventName) {
|
||||
chartEvent.events.push({
|
||||
events.push({
|
||||
time: Conductor.getTimeForStep(chartEvent.step),
|
||||
params: [],
|
||||
name: eventName
|
||||
});
|
||||
changeTab(chartEvent.events.length-1);
|
||||
changeTab(events.length-1);
|
||||
}));
|
||||
});
|
||||
addButton.bWidth = addButton.bHeight = 30;
|
||||
@@ -69,10 +79,24 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
saveCurTab();
|
||||
chartEvent.refreshEventIcons();
|
||||
|
||||
if (chartEvent.events.length <= 0)
|
||||
Charter.instance.eventsGroup.remove(chartEvent, true);
|
||||
if (events.length <= 0)
|
||||
Charter.instance.deleteSelection([chartEvent]);
|
||||
else {
|
||||
var oldEvents:Array<ChartEvent> = chartEvent.events.copy();
|
||||
chartEvent.events = events;
|
||||
|
||||
if (creatingEvent)
|
||||
Charter.instance.createSelection([chartEvent]);
|
||||
else {
|
||||
chartEvent.events = events;
|
||||
chartEvent.refreshEventIcons();
|
||||
|
||||
Charter.instance.addToUndo(CEditEvent(chartEvent, oldEvents, events.copy()));
|
||||
}
|
||||
}
|
||||
|
||||
close();
|
||||
Charter.instance.updateBPMEvents(chartEvent);
|
||||
Charter.instance.updateBPMEvents();
|
||||
});
|
||||
saveButton.x -= saveButton.bWidth;
|
||||
saveButton.y -= saveButton.bHeight;
|
||||
@@ -80,7 +104,7 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
|
||||
deleteButton = new UIButton(saveButton.x - 10, saveButton.y, "Delete", function() {
|
||||
if (curEvent >= 0) {
|
||||
chartEvent.events.splice(curEvent, 1);
|
||||
events.splice(curEvent, 1);
|
||||
changeTab(curEvent, false);
|
||||
}
|
||||
});
|
||||
@@ -106,9 +130,9 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
paramsPanel.remove(e);
|
||||
}
|
||||
|
||||
if (id >= 0 && id < chartEvent.events.length) {
|
||||
if (id >= 0 && id < events.length) {
|
||||
curEvent = id;
|
||||
var curEvent = chartEvent.events[curEvent];
|
||||
var curEvent = events[curEvent];
|
||||
eventName.text = curEvent.name;
|
||||
// add new elements
|
||||
var y:Float = eventName.y + eventName.height + 10;
|
||||
@@ -176,7 +200,7 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
while(iconsPanel.members.length > 0)
|
||||
iconsPanel.remove(iconsPanel.members[0], true).destroy();
|
||||
|
||||
for(k=>e in chartEvent.events) {
|
||||
for(k=>e in events) {
|
||||
var butt = new UIButton(windowSpr.x + 1, windowSpr.y + 66 + (k*30), "", function() {
|
||||
changeTab(k);
|
||||
});
|
||||
@@ -197,10 +221,10 @@ class CharterEventScreen extends UISubstateWindow {
|
||||
public function saveCurTab() {
|
||||
if (curEvent < 0) return;
|
||||
|
||||
chartEvent.events[curEvent].params = [
|
||||
events[curEvent].params = [
|
||||
for(p in paramsFields) {
|
||||
if (p is UIDropDown) {
|
||||
var dataParams = EventsData.getEventParams(chartEvent.events[curEvent].name);
|
||||
var dataParams = EventsData.getEventParams(events[curEvent].name);
|
||||
if (dataParams[paramsFields.indexOf(p)].type == TStrumLine) cast(p, UIDropDown).index;
|
||||
else cast(p, UIDropDown).label.text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user