diff --git a/assets/images/editors/charter/event-icons/Add Camera Zoom.png b/assets/images/editors/charter/event-icons/Add Camera Zoom.png new file mode 100644 index 00000000..e8657597 Binary files /dev/null and b/assets/images/editors/charter/event-icons/Add Camera Zoom.png differ diff --git a/assets/images/editors/charter/event-icons/Alt Animation Toggle.png b/assets/images/editors/charter/event-icons/Alt Animation Toggle.png index 39e1afd1..4c405944 100644 Binary files a/assets/images/editors/charter/event-icons/Alt Animation Toggle.png and b/assets/images/editors/charter/event-icons/Alt Animation Toggle.png differ diff --git a/assets/images/editors/charter/event-icons/Camera Flash.png b/assets/images/editors/charter/event-icons/Camera Flash.png new file mode 100644 index 00000000..5c7f0149 Binary files /dev/null and b/assets/images/editors/charter/event-icons/Camera Flash.png differ diff --git a/assets/images/editors/charter/event-icons/Camera Modulo Change.png b/assets/images/editors/charter/event-icons/Camera Modulo Change.png new file mode 100644 index 00000000..761a6be5 Binary files /dev/null and b/assets/images/editors/charter/event-icons/Camera Modulo Change.png differ diff --git a/assets/images/editors/charter/event-icons/Play Animation.png b/assets/images/editors/charter/event-icons/Play Animation.png new file mode 100644 index 00000000..6b8a0064 Binary files /dev/null and b/assets/images/editors/charter/event-icons/Play Animation.png differ diff --git a/assets/images/editors/charter/event-icons/Scroll Speed Change.png b/assets/images/editors/charter/event-icons/Scroll Speed Change.png new file mode 100644 index 00000000..e288b745 Binary files /dev/null and b/assets/images/editors/charter/event-icons/Scroll Speed Change.png differ diff --git a/source/funkin/backend/chart/EventsData.hx b/source/funkin/backend/chart/EventsData.hx index 2cb50557..39b332e0 100644 --- a/source/funkin/backend/chart/EventsData.hx +++ b/source/funkin/backend/chart/EventsData.hx @@ -10,12 +10,45 @@ import funkin.backend.assets.Paths; using StringTools; class EventsData { - public static var defaultEventsList:Array = ["HScript Call", "Camera Movement", "BPM Change", "Alt Animation Toggle"]; + public static var defaultEventsList:Array = ["HScript Call", "Camera Movement", "Add Camera Zoom", "Camera Modulo Change", "Camera Flash", "BPM Change", "Scroll Speed Change", "Alt Animation Toggle", "Play Animation"]; public static var defaultEventsParams:Map> = [ - "HScript Call" => [{name: "Function Name", type: TString, defValue: "myFunc"}, {name: "Function Parameters (String split with commas)", type: TString, defValue: ""}], + "HScript Call" => [ + {name: "Function Name", type: TString, defValue: "myFunc"}, + {name: "Function Parameters (String split with commas)", type: TString, defValue: ""} + ], "Camera Movement" => [{name: "Camera Target", type: TStrumLine, defValue: 0}], + "Add Camera Zoom" => [ + {name: "Amount", type: TFloat(-10, 10, 0.01, 2), defValue: 0.05}, + {name: "Camera", type: TDropDown(['camGame', 'camHUD']), defValue: "camGame"} + ], + "Camera Modulo Change" => [ + {name: "Modulo Interval (Beats)", type: TInt(1, 9999999, 1), defValue: 4}, + {name: "Bump Strength", type: TFloat(0.1, 10, 0.01, 2), defValue: 1} + ], + "Camera Flash" => [ + {name: "Reversed?", type: TBool, defValue: false}, + {name: "Color", type: TColorWheel, defValue: "#FFFFFF"}, + {name: "Time (Steps)", type: TFloat(0.25, 9999, 0.25, 2), defValue: 4}, + {name: "Camera", type: TDropDown(['camGame', 'camHUD']), defValue: "camHUD"} + ], "BPM Change" => [{name: "Target BPM", type: TFloat(1), defValue: 100}], + "Scroll Speed Change" => [ + {name: "Tween Speed?", type: TBool, defValue: true}, + {name: "New Speed", type: TFloat(0.01, 99, 0.01, 2), defValue: 1.}, + {name: "Tween Time (Steps)", type: TFloat(0.25, 9999, 0.25, 2), defValue: 4}, + { + name: "Tween Ease (ex: circ, quad, cube)", + type: TDropDown(['linear', 'back', 'bounce', 'circ', 'cube', 'elastic', 'expo', 'quad', 'quart', 'quint', 'sine', 'smoothStep', 'smootherStep']), + defValue: "linear" + }, + { + name: "Tween Type (ex: InOut)", + type: TDropDown(['In', 'Out', 'InOut']), + defValue: "In" + } + ], "Alt Animation Toggle" => [{name: "Strumline", type: TStrumLine, defValue: 0}, {name: "Enable", type: TBool, defValue: true}], + "Play Animation" => [{name: "Character", type: TStrumLine, defValue: 0}, {name: "Animation", type: TString, defValue: "animation"}], ]; public static var eventsList:Array = defaultEventsList.copy(); @@ -89,7 +122,7 @@ typedef EventParamInfo = { enum EventParamType { TBool; TInt(?min:Int, ?max:Int, ?step:Float); - TFloat(?min:Int, ?max:Int, ?step:Float, ?precision:Int); + TFloat(?min:Float, ?max:Float, ?step:Float, ?precision:Int); TString; TStrumLine; TColorWheel; diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx index 20d0f975..0b4cf25f 100644 --- a/source/funkin/backend/utils/CoolUtil.hx +++ b/source/funkin/backend/utils/CoolUtil.hx @@ -598,6 +598,9 @@ class CoolUtil frontEnd.list.remove(music); frontEnd.music = music; } + + public static inline function flxeaseFromString(mainEase:String, suffix:String) + return Reflect.field(FlxEase, mainEase + (mainEase == "linear" ? "" : suffix)); } /** diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index c68309a2..ae449173 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1234,7 +1234,9 @@ class PlayState extends MusicBeatState scripts.event("postDraw", e); } - public function executeEvent(event:ChartEvent) { + public var scrollSpeedTween:FlxTween = null; + + public function executeEvent(event:ChartEvent) @:privateAccess { if (event == null) return; if (event.params == null) return; @@ -1248,14 +1250,38 @@ class PlayState extends MusicBeatState case "Camera Movement": if (event.params[0] is Int) curCameraTarget = event.params[0]; + case "Add Camera Zoom": + var camera:FlxCamera = event.params[1] == "camHUD" ? camHUD : camGame; + camera.zoom += event.params[0]; + case "Camera Modulo Change": + camZoomingInterval = event.params[0]; + camZoomingStrength = event.params[1]; + case "Camera Flash": + var camera:FlxCamera = event.params[3] == "camHUD" ? camHUD : camGame; + + if (event.params[0]) // reversed + camera.fade(event.params[1], (Conductor.stepCrochet / 1000) * event.params[2], false, () -> {camera._fxFadeAlpha = 0;}, true); + else // Not Reversed + camera.flash(event.params[1], (Conductor.stepCrochet / 1000) * event.params[2], null, true); case "BPM Change": // automatically handled by conductor + case "Scroll Speed Change": + if (scrollSpeedTween != null) scrollSpeedTween.cancel(); + + if (event.params[0] == false) + scrollSpeed = event.params[1]; + else + scrollSpeedTween = FlxTween.tween(this, {scrollSpeed: event.params[1]}, (Conductor.stepCrochet / 1000) * event.params[2], {ease: CoolUtil.flxeaseFromString(event.params[3], event.params[4])}); case "Alt Animation Toggle": if (event.params[0] is Int && event.params[1] is Bool) { var strLine = strumLines.members[event.params[0]]; if (strLine != null) strLine.altAnim = cast event.params[1]; } - case "Unknown": + case "Play Animation": + if (strumLines.members[event.params[0]] != null && strumLines.members[event.params[0]].characters != null) + for (char in strumLines.members[event.params[0]].characters) + if (char != null) char.playAnim(event.params[1], event.params[2], null); + case "Unknown": // nothing } }