Optimizations
This commit is contained in:
@@ -446,7 +446,7 @@ class CoolUtil
|
||||
stepsPerBeat = timeSignParsed[1] == null || timeSignParsed[1] <= 0 ? 4 : cast timeSignParsed[1];
|
||||
}
|
||||
|
||||
var bpm:Null<Float> = Std.parseFloat(musicInfo["BPM"]).getDefault(DefaultBPM);
|
||||
var bpm:Null<Float> = Std.parseFloat(musicInfo["BPM"]).getDefaultFloat(DefaultBPM);
|
||||
Conductor.changeBPM(bpm, beatsPerMeasure, stepsPerBeat);
|
||||
} else
|
||||
Conductor.changeBPM(DefaultBPM);
|
||||
|
||||
@@ -143,10 +143,10 @@ class XMLUtil {
|
||||
if (node.has.updateHitbox && node.att.updateHitbox == "true") spr.updateHitbox();
|
||||
|
||||
if (node.has.zoomfactor)
|
||||
spr.zoomFactor = Std.parseFloat(node.getAtt("zoomfactor")).getDefault(spr.zoomFactor);
|
||||
spr.zoomFactor = Std.parseFloat(node.getAtt("zoomfactor")).getDefaultFloat(spr.zoomFactor);
|
||||
|
||||
if (node.has.alpha)
|
||||
spr.alpha = Std.parseFloat(node.getAtt("alpha")).getDefault(spr.alpha);
|
||||
spr.alpha = Std.parseFloat(node.getAtt("alpha")).getDefaultFloat(spr.alpha);
|
||||
|
||||
if(node.has.color)
|
||||
spr.color = FlxColor.fromString(node.getAtt("color")).getDefault(0xFFFFFFFF);
|
||||
@@ -203,9 +203,9 @@ class XMLUtil {
|
||||
if (anim.has.name) animData.name = anim.att.name;
|
||||
if (anim.has.type) animData.animType = XMLAnimType.fromString(anim.att.type, animData.animType);
|
||||
if (anim.has.anim) animData.anim = anim.att.anim;
|
||||
if (anim.has.fps) animData.fps = Std.parseFloat(anim.att.fps).getDefault(animData.fps);
|
||||
if (anim.has.x) animData.x = Std.parseFloat(anim.att.x).getDefault(animData.x);
|
||||
if (anim.has.y) animData.y = Std.parseFloat(anim.att.y).getDefault(animData.y);
|
||||
if (anim.has.fps) animData.fps = Std.parseFloat(anim.att.fps).getDefaultFloat(animData.fps);
|
||||
if (anim.has.x) animData.x = Std.parseFloat(anim.att.x).getDefaultFloat(animData.x);
|
||||
if (anim.has.y) animData.y = Std.parseFloat(anim.att.y).getDefaultFloat(animData.y);
|
||||
if (anim.has.loop) animData.loop = anim.att.loop == "true";
|
||||
if (anim.has.forced) animData.forced = anim.att.forced == "true";
|
||||
if (anim.has.indices) animData.indices = CoolUtil.parseNumberRange(anim.att.indices);
|
||||
|
||||
@@ -319,7 +319,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
if (xml.x.exists("icon")) icon = xml.x.get("icon");
|
||||
if (xml.x.exists("color")) iconColor = FlxColor.fromString(xml.x.get("color"));
|
||||
if (xml.x.exists("scale")) {
|
||||
var scale:Float = Std.parseFloat(xml.x.get("scale")).getDefault(1);
|
||||
var scale:Float = Std.parseFloat(xml.x.get("scale")).getDefaultFloat(1);
|
||||
this.scale.set(scale, scale);
|
||||
updateHitbox();
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ class SplashGroup extends FlxTypedGroup<FunkinSprite> {
|
||||
splash.antialiasing = true;
|
||||
splash.active = splash.visible = false;
|
||||
splash.loadSprite(Paths.image(imagePath));
|
||||
if (xml.has.scale) splash.scale.scale(Std.parseFloat(xml.att.scale).getDefault(1));
|
||||
if (xml.has.alpha) splash.alpha = Std.parseFloat(xml.att.alpha).getDefault(1);
|
||||
if (xml.has.scale) splash.scale.scale(Std.parseFloat(xml.att.scale).getDefaultFloat(1));
|
||||
if (xml.has.alpha) splash.alpha = Std.parseFloat(xml.att.alpha).getDefaultFloat(1);
|
||||
if (xml.has.antialiasing) splash.antialiasing = xml.att.antialiasing == "true";
|
||||
return splash;
|
||||
}
|
||||
|
||||
+12
-12
@@ -90,8 +90,8 @@ class Stage extends FlxBasic implements IBeatReceiver {
|
||||
if (!node.has.name || !node.has.width || !node.has.height) continue;
|
||||
|
||||
var spr = new FlxSprite(
|
||||
(node.has.x) ? Std.parseFloat(node.att.x).getDefault(0) : 0,
|
||||
(node.has.y) ? Std.parseFloat(node.att.y).getDefault(0) : 0
|
||||
(node.has.x) ? Std.parseFloat(node.att.x).getDefaultFloat(0) : 0,
|
||||
(node.has.y) ? Std.parseFloat(node.att.y).getDefaultFloat(0) : 0
|
||||
);
|
||||
|
||||
(node.name == "solid" ? spr.makeSolid : spr.makeGraphic)(
|
||||
@@ -130,8 +130,8 @@ class Stage extends FlxBasic implements IBeatReceiver {
|
||||
case "ratings" | "combo":
|
||||
if (PlayState.instance == null) continue;
|
||||
PlayState.instance.comboGroup.setPosition(
|
||||
Std.parseFloat(node.getAtt("x")).getDefault(PlayState.instance.comboGroup.x),
|
||||
Std.parseFloat(node.getAtt("y")).getDefault(PlayState.instance.comboGroup.y)
|
||||
Std.parseFloat(node.getAtt("x")).getDefaultFloat(PlayState.instance.comboGroup.x),
|
||||
Std.parseFloat(node.getAtt("y")).getDefaultFloat(PlayState.instance.comboGroup.y)
|
||||
);
|
||||
PlayState.instance.add(PlayState.instance.comboGroup);
|
||||
PlayState.instance.comboGroup;
|
||||
@@ -219,16 +219,16 @@ class Stage extends FlxBasic implements IBeatReceiver {
|
||||
}
|
||||
|
||||
if (node != null) {
|
||||
charPos.x = Std.parseFloat(node.getAtt("x")).getDefault(charPos.x);
|
||||
charPos.y = Std.parseFloat(node.getAtt("y")).getDefault(charPos.y);
|
||||
charPos.camxoffset = Std.parseFloat(node.getAtt("camxoffset")).getDefault(charPos.camxoffset);
|
||||
charPos.camyoffset = Std.parseFloat(node.getAtt("camyoffset")).getDefault(charPos.camyoffset);
|
||||
charPos.skewX = Std.parseFloat(node.getAtt("skewx")).getDefault(charPos.skewX);
|
||||
charPos.skewY = Std.parseFloat(node.getAtt("skewy")).getDefault(charPos.skewY);
|
||||
charPos.alpha = Std.parseFloat(node.getAtt("alpha")).getDefault(charPos.alpha);
|
||||
charPos.x = Std.parseFloat(node.getAtt("x")).getDefaultFloat(charPos.x);
|
||||
charPos.y = Std.parseFloat(node.getAtt("y")).getDefaultFloat(charPos.y);
|
||||
charPos.camxoffset = Std.parseFloat(node.getAtt("camxoffset")).getDefaultFloat(charPos.camxoffset);
|
||||
charPos.camyoffset = Std.parseFloat(node.getAtt("camyoffset")).getDefaultFloat(charPos.camyoffset);
|
||||
charPos.skewX = Std.parseFloat(node.getAtt("skewx")).getDefaultFloat(charPos.skewX);
|
||||
charPos.skewY = Std.parseFloat(node.getAtt("skewy")).getDefaultFloat(charPos.skewY);
|
||||
charPos.alpha = Std.parseFloat(node.getAtt("alpha")).getDefaultFloat(charPos.alpha);
|
||||
charPos.flipX = (node.has.flip || node.has.flipX) ? (node.getAtt("flip") == "true" || node.getAtt("flipX") == "true") : charPos.flipX;
|
||||
|
||||
var scale = Std.parseFloat(node.getAtt("scale")).getDefault(charPos.scale.x);
|
||||
var scale = Std.parseFloat(node.getAtt("scale")).getDefaultFloat(charPos.scale.x);
|
||||
charPos.scale.set(scale, scale);
|
||||
|
||||
if (node.has.scroll) {
|
||||
|
||||
@@ -87,8 +87,8 @@ class DialogueCutscene extends Cutscene {
|
||||
bubble: node.getAtt('bubble').getDefault('normal'),
|
||||
callback: node.getAtt('callback'),
|
||||
changeDefAnim: node.getAtt('changeDefAnim'),
|
||||
speed: Std.parseFloat(node.getAtt("speed")).getDefault(0.05),
|
||||
musicVolume: node.has.musicVolume ? (volume = Std.parseFloat(node.att.speed).getDefault(0.8)) : null,
|
||||
speed: Std.parseFloat(node.getAtt("speed")).getDefaultFloat(0.05),
|
||||
musicVolume: node.has.musicVolume ? (volume = Std.parseFloat(node.att.speed).getDefaultFloat(0.8)) : null,
|
||||
changeMusic: node.has.changeMusic ? FlxG.sound.load(Paths.music(node.att.changeMusic), volume, true) : null,
|
||||
playSound: node.has.playSound ? FlxG.sound.load(Paths.sound(node.att.playSound)) : null,
|
||||
nextSound: node.has.nextSound ? FlxG.sound.load(Paths.music(node.att.nextSound)) : null,
|
||||
|
||||
@@ -55,8 +55,8 @@ class DialogueBox extends FunkinSprite {
|
||||
for(pos in dialogueBoxData.nodes.charpos) {
|
||||
if (!pos.has.name) continue;
|
||||
positions[pos.att.name] = {
|
||||
x: pos.has.x ? Std.parseFloat(pos.att.x).getDefault(0) : 0,
|
||||
y: pos.has.y ? Std.parseFloat(pos.att.y).getDefault(0) : 0,
|
||||
x: pos.has.x ? Std.parseFloat(pos.att.x).getDefaultFloat(0) : 0,
|
||||
y: pos.has.y ? Std.parseFloat(pos.att.y).getDefaultFloat(0) : 0,
|
||||
flipBubble: pos.getAtt('flipBubble') == "true"
|
||||
};
|
||||
}
|
||||
@@ -65,8 +65,8 @@ class DialogueBox extends FunkinSprite {
|
||||
if (textNode == null)
|
||||
throw "The dialog box XML requires one text element.";
|
||||
text = new FlxTypeText(
|
||||
textNode.has.x ? Std.parseFloat(textNode.att.x).getDefault(0) : 0,
|
||||
FlxG.height - (textNode.has.y ? Std.parseFloat(textNode.att.y).getDefault(0) : 0),
|
||||
textNode.has.x ? Std.parseFloat(textNode.att.x).getDefaultFloat(0) : 0,
|
||||
FlxG.height - (textNode.has.y ? Std.parseFloat(textNode.att.y).getDefaultFloat(0) : 0),
|
||||
textNode.has.width ? Std.parseInt(textNode.att.width).getDefault(FlxG.width) : FlxG.width, "");
|
||||
text.color = textNode.getAtt("color").getColorFromDynamic().getDefault(0xFF000000);
|
||||
text.size = Std.parseInt(textNode.att.size).getDefault(20);
|
||||
@@ -79,10 +79,10 @@ class DialogueBox extends FunkinSprite {
|
||||
case "outline_fast": OUTLINE_FAST;
|
||||
default: OUTLINE;
|
||||
}
|
||||
text.borderQuality = Std.parseFloat(textNode.getAtt("borderQuality")).getDefault(1);
|
||||
text.shadowOffset.x = Std.parseFloat(textNode.getAtt("shadowOffsetX")).getDefault(1);
|
||||
text.shadowOffset.y = Std.parseFloat(textNode.getAtt("shadowOffsetY")).getDefault(1);
|
||||
text.borderSize = Std.parseFloat(textNode.getAtt("borderSize")).getDefault(1);
|
||||
text.borderQuality = Std.parseFloat(textNode.getAtt("borderQuality")).getDefaultFloat(1);
|
||||
text.shadowOffset.x = Std.parseFloat(textNode.getAtt("shadowOffsetX")).getDefaultFloat(1);
|
||||
text.shadowOffset.y = Std.parseFloat(textNode.getAtt("shadowOffsetY")).getDefaultFloat(1);
|
||||
text.borderSize = Std.parseFloat(textNode.getAtt("borderSize")).getDefaultFloat(1);
|
||||
text.borderColor = textNode.getAtt("borderColor").getColorFromDynamic().getDefault(0xFFFFFFFF);
|
||||
}
|
||||
} catch(e) {
|
||||
|
||||
@@ -308,11 +308,11 @@ class StoryMenuState extends MusicBeatState {
|
||||
if (characters[charName] != null) return;
|
||||
var charObj:MenuCharacter = {
|
||||
spritePath: Paths.image(char.getAtt('sprite').getDefault('menus/storymenu/characters/${charName}')),
|
||||
scale: Std.parseFloat(char.getAtt('scale')).getDefault(1),
|
||||
scale: Std.parseFloat(char.getAtt('scale')).getDefaultFloat(1),
|
||||
xml: char,
|
||||
offset: FlxPoint.get(
|
||||
Std.parseFloat(char.getAtt('x')).getDefault(0),
|
||||
Std.parseFloat(char.getAtt('y')).getDefault(0)
|
||||
Std.parseFloat(char.getAtt('x')).getDefaultFloat(0),
|
||||
Std.parseFloat(char.getAtt('y')).getDefaultFloat(0)
|
||||
)
|
||||
};
|
||||
characters[charName] = charObj;
|
||||
|
||||
Reference in New Issue
Block a user