From c4d92f8cfc09af6f00f55f5912f20414f0b37cbd Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:24:26 -0700 Subject: [PATCH] NEW EVENTS GUYS --- .../charter/event-icons/Add Camera Zoom.png | Bin 0 -> 214 bytes .../event-icons/Alt Animation Toggle.png | Bin 209 -> 221 bytes .../charter/event-icons/Camera Flash.png | Bin 0 -> 218 bytes .../event-icons/Camera Modulo Change.png | Bin 0 -> 221 bytes .../charter/event-icons/Play Animation.png | Bin 0 -> 198 bytes .../event-icons/Scroll Speed Change.png | Bin 0 -> 217 bytes source/funkin/backend/chart/EventsData.hx | 39 ++++++++++++++++-- source/funkin/backend/utils/CoolUtil.hx | 3 ++ source/funkin/game/PlayState.hx | 30 +++++++++++++- 9 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 assets/images/editors/charter/event-icons/Add Camera Zoom.png create mode 100644 assets/images/editors/charter/event-icons/Camera Flash.png create mode 100644 assets/images/editors/charter/event-icons/Camera Modulo Change.png create mode 100644 assets/images/editors/charter/event-icons/Play Animation.png create mode 100644 assets/images/editors/charter/event-icons/Scroll Speed Change.png 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 0000000000000000000000000000000000000000..e8657597df3f30113c647fd37c0252fb3142abbe GIT binary patch literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~l>na**Z=?j z*VY0#4FCV1>iRqR|9=LS&4O320=fSgy15vpa5HuDoKg$21*+gF3GxdDNx%T-kpMNI zxQC~UV~E7mxxLX`32vfpiKzopr02L)s$^ZZW literal 0 HcmV?d00001 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 39e1afd14082fba9419bd998a0004b1d3350beae..4c4059444fcf57dbebcec6fb411cb8a765b01ef8 100644 GIT binary patch delta 180 zcmcb}c$aa4VZCmEPl)UP|Nm=i8Gzvb|5IImC;$J?z_MBJ>Qx~3KSMVc!xV0&ZXV^T z&2dXE$#|uQN$zj~D&;Q;@(Tv3Kmt#D=Pd(DIeWS|hDc0Z+Hc6mpuoY*Y5es6dC>_g zd`muU%bvyN@-D;SUD}0y1$ONhiMp-T6@j{~x)(&h&6U}lFrV{B*@owa{o7L+xXhWK Tu+G|70&Qx~3e{a`cPL|Cq=9?LG zW`wFseN0%E(QaRBTvjO{@=e{H_WD$@9Z>% zA|?KYhpS%X9eZjq{e#xa$W!@^yQ=LKZ~hRxGJ|8!V|xyJ8J#o5%#lBSPVE9Y#naW# JWt~$(698RBP00WN 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 0000000000000000000000000000000000000000..5c7f01497a0624c37f0e0df9af5a60309993c759 GIT binary patch literal 218 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~tpJ}8*Z)A! z)CA!sa)1+|qm4 uvZ!rMx6lc%-3&+gHz>*-iRqR|9=LS&4O320=fSgy15vpa5HuDY-iuIYSk*X+f0{%>i9~6{DMK! z2oUadTLdWM?&;zfA~AJtk2xQM0SB|Lf83A%<<1&j6E{6!iRqR|9=LS&4O320=fU0x_MSUnP3Ez<0=XA3kC^6KwYOu7*N!~)5S4F zVruI7KrRLa4i`s3&OQHIjW?E<|G(F;KiRqR|9=LS&4O320=fSgy15vpa5HuDoRg6F-QHfw%d4u?^9QJuza+>n z7^DITJnfyg3@Byq>Eak7F?DL6As2%I$B`##U;m%aJ=&GN(0Q|J$D9+)4~mR^!k-GA wQ{C%bIrUp`!aF;EGr1A-LI3~& literal 0 HcmV?d00001 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 } }