Merge branch 'master' of https://github.com/ninjamuffin99/funkin-secret into bugfix/formatting-cleanup

This commit is contained in:
Cameron Taylor 2023-06-09 14:12:37 -04:00
commit 27a9ef211e
5 changed files with 52 additions and 2 deletions

View file

@ -115,8 +115,16 @@
<haxedef name="FLX_NO_DEBUG" unless="debug" />
<!--Enable this for Nape release builds for a serious peformance improvement-->
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" />
<!-- TODO: REMOVE THIS!!!! -->
<!--
Hide deprecation warnings until they're fixed.
TODO: REMOVE THIS!!!!
-->
<haxeflag name="-w" value="-WDeprecated" />
<!-- Haxe 4.3.0+: Enable pretty syntax errors and stuff. -->
<haxedef name="message-reporting" value="pretty" />
<!-- _________________________________ Custom _______________________________ -->
<!-- Disable trace() calls in release builds to bump up performance. -->
<haxeflag name="--no-traces" unless="debug" />

View file

@ -582,6 +582,13 @@ class BaseCharacter extends Bopper
// restart even if already playing, because the character might sing the same note twice.
playAnimation(anim, true);
}
public override function playAnimation(name:String, restart:Bool = false, ?ignoreOther:Bool = false, ?reversed:Bool = false):Void
{
FlxG.watch.addQuick('playAnim(${characterName})', name);
trace('playAnim(${characterName}): ${name}');
super.playAnimation(name, restart, ignoreOther, reversed);
}
}
/**

View file

@ -43,7 +43,8 @@ class Level implements IRegistryEntry<LevelData>
*/
public function getSongs():Array<String>
{
return _data.songs;
// Copy the array so that it can't be modified on accident
return _data.songs.copy();
}
/**

View file

@ -1,6 +1,7 @@
package funkin.util;
import haxe.Json;
import haxe.io.Bytes;
import thx.semver.Version;
typedef ScoreInput =
@ -38,6 +39,14 @@ class SerializerUtil
return Json.parse(input);
}
/**
* Convert a JSON byte array to a Haxe object.
*/
public static function fromJSONBytes(input:Bytes):Dynamic
{
return Json.parse(input.toString());
}
/**
* Customize how certain types are serialized when converting to JSON.
*/

View file

@ -0,0 +1,25 @@
package funkin.util.tools;
/**
* A static extension which provides utility functions for Arrays.
*/
class ArrayTools
{
/**
* Returns a copy of the array with all duplicate elements removed.
* @param array The array to remove duplicates from.
* @return A copy of the array with all duplicate elements removed.
*/
public static function unique<T>(array:Array<T>):Array<T>
{
var result:Array<T> = [];
for (element in array)
{
if (!result.contains(element))
{
result.push(element);
}
}
return result;
}
}