NEW EVENTS GUYS

This commit is contained in:
lunarcleint
2024-02-01 19:24:26 -07:00
parent 229b9ba5a3
commit c4d92f8cfc
9 changed files with 67 additions and 5 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

+36 -3
View File
@@ -10,12 +10,45 @@ import funkin.backend.assets.Paths;
using StringTools; using StringTools;
class EventsData { class EventsData {
public static var defaultEventsList:Array<String> = ["HScript Call", "Camera Movement", "BPM Change", "Alt Animation Toggle"]; public static var defaultEventsList:Array<String> = ["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<String, Array<EventParamInfo>> = [ public static var defaultEventsParams:Map<String, Array<EventParamInfo>> = [
"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}], "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}], "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}], "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<String> = defaultEventsList.copy(); public static var eventsList:Array<String> = defaultEventsList.copy();
@@ -89,7 +122,7 @@ typedef EventParamInfo = {
enum EventParamType { enum EventParamType {
TBool; TBool;
TInt(?min:Int, ?max:Int, ?step:Float); 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; TString;
TStrumLine; TStrumLine;
TColorWheel; TColorWheel;
+3
View File
@@ -598,6 +598,9 @@ class CoolUtil
frontEnd.list.remove(music); frontEnd.list.remove(music);
frontEnd.music = music; frontEnd.music = music;
} }
public static inline function flxeaseFromString(mainEase:String, suffix:String)
return Reflect.field(FlxEase, mainEase + (mainEase == "linear" ? "" : suffix));
} }
/** /**
+28 -2
View File
@@ -1234,7 +1234,9 @@ class PlayState extends MusicBeatState
scripts.event("postDraw", e); 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 == null) return;
if (event.params == null) return; if (event.params == null) return;
@@ -1248,14 +1250,38 @@ class PlayState extends MusicBeatState
case "Camera Movement": case "Camera Movement":
if (event.params[0] is Int) if (event.params[0] is Int)
curCameraTarget = event.params[0]; 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 "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": case "Alt Animation Toggle":
if (event.params[0] is Int && event.params[1] is Bool) { if (event.params[0] is Int && event.params[1] is Bool) {
var strLine = strumLines.members[event.params[0]]; var strLine = strumLines.members[event.params[0]];
if (strLine != null) if (strLine != null)
strLine.altAnim = cast event.params[1]; 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
} }
} }