fixed memory leak
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
1731
|
||||
1739
|
||||
@@ -0,0 +1 @@
|
||||
(Get-ChildItem -Recurse -Directory).FullName | ForEach-Object {fsutil.exe file setCaseSensitiveInfo $_ disable}
|
||||
@@ -0,0 +1 @@
|
||||
(Get-ChildItem -Recurse -Directory).FullName | ForEach-Object {fsutil.exe file setCaseSensitiveInfo $_ enable}
|
||||
@@ -204,10 +204,9 @@ class PlayState extends MusicBeatState
|
||||
override public function create()
|
||||
{
|
||||
instance = this;
|
||||
|
||||
PauseSubState.script = "";
|
||||
if (FlxG.sound.music != null) FlxG.sound.music.stop();
|
||||
|
||||
PauseSubState.script = "";
|
||||
(scripts = new ScriptPack("PlayState")).setParent(this);
|
||||
|
||||
camGame = camera;
|
||||
@@ -215,7 +214,6 @@ class PlayState extends MusicBeatState
|
||||
camHUD.bgColor.alpha = 0;
|
||||
|
||||
downscroll = Options.downscroll;
|
||||
// camGame.widescreen = true;
|
||||
|
||||
persistentUpdate = true;
|
||||
persistentDraw = true;
|
||||
@@ -289,6 +287,17 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PRECACHING
|
||||
*/
|
||||
|
||||
for(content in Paths.getFolderContent('images/game/score/', true, true))
|
||||
FlxG.bitmap.add(content);
|
||||
|
||||
/**
|
||||
* END OF PRECACHING
|
||||
*/
|
||||
|
||||
scripts.load();
|
||||
scripts.call("create");
|
||||
|
||||
|
||||
@@ -152,8 +152,10 @@ class PauseSubState extends MusicBeatSubstate
|
||||
}
|
||||
override function destroy()
|
||||
{
|
||||
FlxG.cameras.remove(camera, true);
|
||||
pauseScript.call("destroy");
|
||||
if (pauseMusic != null) pauseMusic.destroy();
|
||||
pauseScript.destroy();
|
||||
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package funkin.system;
|
||||
|
||||
import flixel.math.FlxMath;
|
||||
import openfl.Lib;
|
||||
import flixel.FlxState;
|
||||
import funkin.interfaces.IBeatReceiver;
|
||||
import flixel.FlxG;
|
||||
@@ -71,7 +73,9 @@ class Conductor
|
||||
public static var curBeatFloat:Float = 0;
|
||||
|
||||
|
||||
@:dox(hide) public static var lastSongPos:Float;
|
||||
@:dox(hide) public static var lastSongPos:Float = 0;
|
||||
@:dox(hide) public static var lastSongPosTime:Float = 0;
|
||||
@:dox(hide) public static var speed:Float = 0;
|
||||
@:dox(hide) public static var offset:Float = 0;
|
||||
|
||||
@:dox(hide) public static var safeZoneOffset:Float = 175; // is calculated in create(), is safeFrames in milliseconds
|
||||
@@ -85,6 +89,7 @@ class Conductor
|
||||
|
||||
public static function reset() {
|
||||
songPosition = lastSongPos = curBeatFloat = curStepFloat = curBeat = curStep = 0;
|
||||
speed = 1;
|
||||
bpmChangeMap = [];
|
||||
changeBPM(0);
|
||||
}
|
||||
@@ -126,7 +131,7 @@ class Conductor
|
||||
}
|
||||
|
||||
public static function init() {
|
||||
FlxG.signals.preUpdate.add(update);
|
||||
FlxG.signals.postUpdate.add(update);
|
||||
FlxG.signals.preStateCreate.add(onStateSwitch);
|
||||
reset();
|
||||
}
|
||||
@@ -140,11 +145,15 @@ class Conductor
|
||||
|
||||
if (FlxG.sound.music == null || !FlxG.sound.music.playing) return;
|
||||
if (FlxG.state != null && FlxG.state is MusicBeatState && cast(FlxG.state, MusicBeatState).cancelConductorUpdate) return;
|
||||
|
||||
var lastPos = lastSongPos;
|
||||
if (lastSongPos != (lastSongPos = FlxG.sound.music.time)) {
|
||||
// update conductor
|
||||
var timeUntilUpdate = -(lastSongPosTime - (lastSongPosTime = Lib.getTimer()));
|
||||
speed = FlxMath.bound(FlxMath.lerp(speed, timeUntilUpdate / (lastSongPos - lastPos), FlxMath.bound(Math.abs(speed - 1), 0, 1)), 0, 2);
|
||||
songPosition = lastSongPos;
|
||||
} else {
|
||||
songPosition += elapsed * 1000;
|
||||
songPosition += elapsed * 1000 * speed;
|
||||
}
|
||||
|
||||
if (bpm > 0) {
|
||||
|
||||
@@ -75,6 +75,7 @@ class FramerateField extends TextField {
|
||||
text.push('=== CONDUCTOR INFO ===');
|
||||
text.push('Current Song Position: ${Conductor.songPosition} (${Conductor.curBeat} beats - ${Conductor.curStep} steps)');
|
||||
text.push('Current BPM: ${Conductor.bpm}');
|
||||
text.push('Current speed: ${FlxMath.roundDecimal(Conductor.speed, 2)}x');
|
||||
text.push('=== SYSTEM INFO ===');
|
||||
text.push('System: ${lime.system.System.platformLabel} ${lime.system.System.platformVersion}');
|
||||
text.push('Objs in state: ${FlxG.state.members.length}');
|
||||
|
||||
Reference in New Issue
Block a user