Small Optimizations
This commit is contained in:
@@ -227,7 +227,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
|
||||
for (key in animOffsets.keys()) {
|
||||
final point = animOffsets[key];
|
||||
animOffsets.remove(key);
|
||||
if(point != null)
|
||||
if (point != null)
|
||||
point.put();
|
||||
}
|
||||
animOffsets = null;
|
||||
@@ -322,19 +322,8 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
|
||||
return animateAtlas != null ? (animateAtlas.anim.animsMap.exists(AnimName)
|
||||
|| animateAtlas.anim.symbolDictionary.exists(AnimName)) : animation.exists(AnimName);
|
||||
|
||||
public inline function getAnimName()
|
||||
{
|
||||
var name = null;
|
||||
if (animateAtlas != null)
|
||||
{
|
||||
name = atlasPlayingAnim;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (animation.curAnim != null)
|
||||
name = animation.curAnim.name;
|
||||
}
|
||||
return name;
|
||||
public inline function getAnimName() {
|
||||
return (animateAtlas != null) ? atlasPlayingAnim : animation.name;
|
||||
}
|
||||
|
||||
public inline function removeAnimation(name:String) {
|
||||
@@ -358,8 +347,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
|
||||
animation.stop();
|
||||
}
|
||||
|
||||
public inline function isAnimFinished()
|
||||
{
|
||||
public inline function isAnimFinished() {
|
||||
return animateAtlas != null ? (animateAtlas.anim.finished) : (animation.curAnim != null ? animation.curAnim.finished : true);
|
||||
}
|
||||
#end
|
||||
|
||||
@@ -134,7 +134,7 @@ class MemoryUtil {
|
||||
if (process.exitCode() != 0) return "Unknown";
|
||||
var lines = process.stdout.readAll().toString().split("\n");
|
||||
for (line in lines) {
|
||||
if (line.indexOf("Type:") == 0) {
|
||||
if (line.startsWith("Type:")) {
|
||||
return line.substring("Type:".length).trim();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1811,7 +1811,7 @@ class Charter extends UIState {
|
||||
|
||||
public inline function __fixSelection(selection:Selection):Selection {
|
||||
var newSelection:Selection = new Selection();
|
||||
for (s in selection) if (newSelection.indexOf(s) == -1) newSelection.push(s);
|
||||
for (s in selection) if (!newSelection.contains(s)) newSelection.push(s);
|
||||
return newSelection.filter((s:ICharterSelectable) -> {return s != null;});
|
||||
}
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ class Note extends FlxSprite
|
||||
setClipRect(swagRect);
|
||||
}
|
||||
|
||||
public function setClipRect(rect:FlxRect) {
|
||||
public inline function setClipRect(rect:FlxRect) {
|
||||
this.clipRect = rect;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,8 +106,7 @@ class NoteGroup extends FlxTypedGroup<Note> {
|
||||
if (members == null)
|
||||
return null;
|
||||
|
||||
// TODO: maybe lastIndexOf
|
||||
var index:Int = members.indexOfFromLast(Object);
|
||||
var index:Int = members.lastIndexOf(Object);
|
||||
|
||||
if (index < 0)
|
||||
return null;
|
||||
|
||||
@@ -1677,8 +1677,9 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
|
||||
public function displayRating(myRating:String, ?evt:NoteHitEvent = null):Void {
|
||||
var pre:String = evt != null ? evt.ratingPrefix : "";
|
||||
var suf:String = evt != null ? evt.ratingSuffix : "";
|
||||
var hasEvent = evt != null;
|
||||
var pre:String = hasEvent ? evt.ratingPrefix : "";
|
||||
var suf:String = hasEvent ? evt.ratingSuffix : "";
|
||||
|
||||
var rating:FlxSprite = comboGroup.recycleLoop(FlxSprite);
|
||||
rating.resetSprite(comboGroup.x + -40, comboGroup.y + -60);
|
||||
@@ -1686,7 +1687,7 @@ class PlayState extends MusicBeatState
|
||||
rating.acceleration.y = 550;
|
||||
rating.velocity.y -= FlxG.random.int(140, 175);
|
||||
rating.velocity.x -= FlxG.random.int(0, 10);
|
||||
if (evt != null) {
|
||||
if (hasEvent) {
|
||||
rating.scale.set(evt.ratingScale, evt.ratingScale);
|
||||
rating.antialiasing = evt.ratingAntialiasing;
|
||||
}
|
||||
@@ -1701,8 +1702,9 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
|
||||
public function displayCombo(?evt:NoteHitEvent = null):Void {
|
||||
var pre:String = evt != null ? evt.ratingPrefix : "";
|
||||
var suf:String = evt != null ? evt.ratingSuffix : "";
|
||||
var hasEvent = evt != null;
|
||||
var pre:String = hasEvent ? evt.ratingPrefix : "";
|
||||
var suf:String = hasEvent ? evt.ratingSuffix : "";
|
||||
|
||||
var separatedScore:String = Std.string(combo).addZeros(3);
|
||||
|
||||
@@ -1714,7 +1716,7 @@ class PlayState extends MusicBeatState
|
||||
comboSpr.velocity.y -= 150;
|
||||
comboSpr.velocity.x += FlxG.random.int(1, 10);
|
||||
|
||||
if (evt != null) {
|
||||
if (hasEvent) {
|
||||
comboSpr.scale.set(evt.ratingScale, evt.ratingScale);
|
||||
comboSpr.antialiasing = evt.ratingAntialiasing;
|
||||
}
|
||||
@@ -1733,7 +1735,7 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
var numScore:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${pre}num${separatedScore.charAt(i)}${suf}'));
|
||||
numScore.resetSprite(comboGroup.x + (43 * i) - 90, comboGroup.y + 80);
|
||||
if (evt != null) {
|
||||
if (hasEvent) {
|
||||
numScore.antialiasing = evt.numAntialiasing;
|
||||
numScore.scale.set(evt.numScale, evt.numScale);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user