Rewrote Anim Suffix system

This commit is contained in:
NeeEoo
2023-08-14 16:53:52 +02:00
parent 7d993189ca
commit 964e2ad55b
5 changed files with 29 additions and 6 deletions
@@ -20,6 +20,7 @@ class ScriptsMacro {
"flixel.addons.plugin", "flixel.addons.text", "flixel.addons.tile", "flixel.addons.transition",
"flixel.addons.util",
// OTHER LIBRARIES & STUFF
"funkin",
"away3d", "flx3d",
#if VIDEO_CUTSCENES "hxcodec.flixel", "hxcodec.openfl", "hxcodec.lime", #end
// BASE HAXE
+2 -2
View File
@@ -31,7 +31,7 @@ class NdllUtil {
* @param name Name of the function.
* @param args Number of arguments of that function.
*/
public static function getFunction(ndll:String, name:String, args:Int) {
public static function getFunction(ndll:String, name:String, args:Int):Dynamic {
#if NDLLS_SUPPORTED
return getFunctionFromPath(Paths.ndll('$ndll-$os'), name, args);
#else
@@ -47,7 +47,7 @@ class NdllUtil {
* @param name Name of the function.
* @param args Number of arguments of that function.
*/
public static function getFunctionFromPath(ndll:String, name:String, args:Int) {
public static function getFunctionFromPath(ndll:String, name:String, args:Int):Dynamic {
#if NDLLS_SUPPORTED
if (!Assets.exists(ndll)) {
Logs.trace('Couldn\'t find ndll at ${ndll}.', WARNING);
+2 -2
View File
@@ -1456,9 +1456,9 @@ class PlayState extends MusicBeatState
var event:NoteHitEvent;
if (strumLine != null && !strumLine.cpu)
event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(strumLine.altAnim ? "-alt" : ""), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, 0.023, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick"));
event = scripts.event("onPlayerHit", EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, 0.023, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick"));
else
event = scripts.event("onDadHit", EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(strumLine.altAnim ? "-alt" : ""), "game/score/", "", note.strumID, 0, null, 0, daRating, false));
event = scripts.event("onDadHit", EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, 0, null, 0, daRating, false));
strumLine.onHit.dispatch(event);
scripts.event("onNoteHit", event);
+6 -1
View File
@@ -6,7 +6,12 @@ import funkin.backend.system.Conductor;
class Strum extends FlxSprite {
public var extra:Map<String, Dynamic> = [];
public var cpu = false;
/**
* Which animation suffix on characters that should be used when hitting notes.
*/
public var animSuffix:String = "";
public var cpu = false; // Unused
public var lastHit:Float = -5000;
public var scrollSpeed:Null<Float> = null; // custom scroll speed per strum
+18 -1
View File
@@ -65,7 +65,11 @@ class StrumLine extends FlxTypedGroup<Strum> {
/**
* Whenever alt animation is enabled on this strumline.
*/
public var altAnim:Bool = false;
public var altAnim(get, set):Bool;
/**
* Which animation suffix on characters that should be used when hitting notes.
*/
public var animSuffix(default, set):String = "";
/**
* TODO: Write documention about this being a variable that can help when making multi key
*/
@@ -353,5 +357,18 @@ class StrumLine extends FlxTypedGroup<Strum> {
s.cpu = b;
return cpu = b;
}
private inline function set_animSuffix(str:String):String {
for(s in members)
if (s != null)
s.animSuffix = str;
return animSuffix = str;
}
private inline function set_altAnim(b:Bool):Bool {
animSuffix = b ? "-alt" : "";
return b;
}
private inline function get_altAnim():Bool {
return animSuffix == "-alt";
}
#end
}