useful stuff
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
2223
|
||||
2229
|
||||
@@ -73,10 +73,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
return new FlxPoint(event.x, event.y);
|
||||
}
|
||||
|
||||
public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Reversed:Bool = false, Frame:Int = 0) {
|
||||
public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) {
|
||||
var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"];
|
||||
|
||||
var event = EventManager.get(DirectionAnimEvent).recycle('${anims[direction]}$suffix', direction, suffix, Context, Reversed, Frame);
|
||||
var event = EventManager.get(DirectionAnimEvent).recycle('${anims[direction]}$suffix', direction, suffix, Context, Reversed, Frame, Force);
|
||||
script.call("onPlaySingAnim", [event]);
|
||||
if (!event.cancelled) playAnim(event.animName, event.force, Context, event.reversed, event.frame);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ import openfl.filters.ShaderFilter;
|
||||
import funkin.system.Conductor;
|
||||
import funkin.system.Song;
|
||||
import funkin.editors.ChartingState;
|
||||
import funkin.debug.AnimationDebug;
|
||||
import funkin.cutscenes.*;
|
||||
|
||||
import funkin.menus.*;
|
||||
@@ -1452,7 +1451,7 @@ class PlayState extends MusicBeatState
|
||||
if (event.note.strumLine != null) event.note.strumLine.addHealth(event.healthGain);
|
||||
if (gf != null && combo > 5 && gf.animOffsets.exists('sad'))
|
||||
{
|
||||
gf.playAnim('sad', true, MISS);
|
||||
gf.playAnim('sad', event.forceAnim, MISS);
|
||||
}
|
||||
combo = 0;
|
||||
|
||||
@@ -1615,7 +1614,7 @@ class PlayState extends MusicBeatState
|
||||
if (!event.animCancelled)
|
||||
for(char in event.characters)
|
||||
if (char != null)
|
||||
char.playSingAnim(event.direction, event.animSuffix);
|
||||
char.playSingAnim(event.direction, event.animSuffix, SING, event.forceAnim);
|
||||
|
||||
if (event.note.__strum != null) {
|
||||
if (!event.strumGlowCancelled) event.note.__strum.press(event.note.strumTime);
|
||||
|
||||
@@ -95,6 +95,10 @@ class NoteHitEvent extends CancellableEvent {
|
||||
* Whenever antialiasing should be enabled on ratings.
|
||||
*/
|
||||
public var ratingAntialiasing:Bool = true;
|
||||
/**
|
||||
* Whenever the animation should be forced to play.
|
||||
*/
|
||||
public var forceAnim:Bool = true;
|
||||
|
||||
/**
|
||||
* Prevents the default sing animation from being played.
|
||||
|
||||
@@ -208,7 +208,8 @@ class Main extends Sprite
|
||||
AudioSwitchFix.init();
|
||||
WindowsAPI.setDarkMode(true);
|
||||
EventManager.init();
|
||||
FlxG.signals.preStateCreate.add(onStateSwitch);
|
||||
FlxG.signals.preStateSwitch.add(onStateSwitch);
|
||||
FlxG.signals.postStateSwitch.add(onStateSwitchPost);
|
||||
|
||||
#if MOD_SUPPORT
|
||||
ModsFolder.switchMod(Options.lastLoadedMod);
|
||||
@@ -235,28 +236,33 @@ class Main extends Sprite
|
||||
{asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
|
||||
}
|
||||
|
||||
private static function onStateSwitch(newState:FlxState) {
|
||||
private static function onStateSwitch() {
|
||||
scaleMode.resetSize();
|
||||
}
|
||||
|
||||
private static function onStateSwitchPost() {
|
||||
// manual asset clearing since base openfl one doesnt clear lime one
|
||||
// doesnt clear bitmaps since flixel fork does it auto
|
||||
|
||||
@:privateAccess {
|
||||
// clear uint8 pools since it causes memory leak with openfl textfield
|
||||
// clear uint8 pools
|
||||
for(length=>pool in openfl.display3D.utils.UInt8Buff._pools) {
|
||||
for(b in pool.clear())
|
||||
b.destroy();
|
||||
}
|
||||
openfl.display3D.utils.UInt8Buff._pools.clear();
|
||||
}
|
||||
scaleMode.resetSize();
|
||||
|
||||
var cache = cast(Assets.cache, AssetCache);
|
||||
for (key=>font in cache.font)
|
||||
for (key=>_ in cache.font)
|
||||
cache.removeFont(key);
|
||||
for (key=>sound in cache.sound)
|
||||
for (key=>_ in cache.sound)
|
||||
cache.removeSound(key);
|
||||
|
||||
Paths.assetsTree.clearCache();
|
||||
|
||||
MemoryUtil.clearMajor();
|
||||
|
||||
FlxG.bitmap.dumpCache();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user