fixed things that pissed me off
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE codename-engine-stage>
|
||||
<stage zoom="1.05" name="spooky" folder="stages/spooky/">
|
||||
<sprite name="bg" x="-200" y="-100" sprite="halloween_bg" anim="idle" type="none">
|
||||
<sprite name="bg" x="-200" y="-100" sprite="halloween_bg" anim="idle" type="none" scale="1.05">
|
||||
<anim name="idle" anim="halloweem bg0" type="loop" />
|
||||
<anim name="lightning" anim="halloweem bg lightning strike" loop="false"/>
|
||||
</sprite>
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 55 KiB |
@@ -2,16 +2,16 @@
|
||||
<TextureAtlas imagePath="donate.png">
|
||||
<!-- Created with Adobe Animate version 21.0.1.37179 -->
|
||||
<!-- http://www.adobe.com/products/animate.html -->
|
||||
<SubTexture name="donate basic0000" x="0" y="0" width="444" height="117" pivotX="10.5" pivotY="14.85"/>
|
||||
<SubTexture name="donate basic0001" x="0" y="0" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0002" x="0" y="0" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0003" x="0" y="117" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0004" x="0" y="117" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0005" x="0" y="117" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0006" x="0" y="234" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0007" x="0" y="234" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0008" x="0" y="234" width="444" height="117"/>
|
||||
<SubTexture name="donate white0000" x="0" y="351" width="590" height="157" pivotX="18.2" pivotY="23.95" frameX="0" frameY="-2" frameWidth="590" frameHeight="159"/>
|
||||
<SubTexture name="donate white0001" x="0" y="508" width="587" height="154" frameX="-1" frameY="-5" frameWidth="590" frameHeight="159"/>
|
||||
<SubTexture name="donate white0002" x="0" y="662" width="585" height="155" frameX="-3" frameY="0" frameWidth="590" frameHeight="159"/>
|
||||
<SubTexture name="donate basic0000" x="2" y="2" width="444" height="117" pivotX="10.5" pivotY="14.85"/>
|
||||
<SubTexture name="donate basic0001" x="2" y="2" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0002" x="2" y="2" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0003" x="2" y="121" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0004" x="2" y="121" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0005" x="2" y="121" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0006" x="2" y="240" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0007" x="2" y="240" width="444" height="117"/>
|
||||
<SubTexture name="donate basic0008" x="2" y="240" width="444" height="117"/>
|
||||
<SubTexture name="donate white0000" x="2" y="359" width="590" height="157" pivotX="18.2" pivotY="23.95" frameX="0" frameY="-2" frameWidth="590" frameHeight="159"/>
|
||||
<SubTexture name="donate white0001" x="2" y="518" width="587" height="154" frameX="-1" frameY="-5" frameWidth="590" frameHeight="159"/>
|
||||
<SubTexture name="donate white0002" x="2" y="674" width="585" height="155" frameX="-3" frameY="0" frameWidth="590" frameHeight="159"/>
|
||||
</TextureAtlas>
|
||||
|
||||
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 68 KiB |
@@ -2,16 +2,16 @@
|
||||
<TextureAtlas imagePath="freeplay.png">
|
||||
<!-- Created with Adobe Animate version 21.0.1.37179 -->
|
||||
<!-- http://www.adobe.com/products/animate.html -->
|
||||
<SubTexture name="freeplay basic0000" x="0" y="0" width="484" height="122" pivotX="7.65" pivotY="10.55"/>
|
||||
<SubTexture name="freeplay basic0001" x="0" y="0" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0002" x="0" y="0" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0003" x="0" y="122" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0004" x="0" y="122" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0005" x="0" y="122" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0006" x="0" y="244" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0007" x="0" y="244" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0008" x="0" y="244" width="484" height="122"/>
|
||||
<SubTexture name="freeplay white0000" x="0" y="366" width="627" height="169" pivotX="15" pivotY="17.15" frameX="0" frameY="0" frameWidth="635" frameHeight="174"/>
|
||||
<SubTexture name="freeplay white0001" x="0" y="535" width="632" height="170" frameX="-3" frameY="-1" frameWidth="635" frameHeight="174"/>
|
||||
<SubTexture name="freeplay white0002" x="0" y="705" width="629" height="173" frameX="-4" frameY="-1" frameWidth="635" frameHeight="174"/>
|
||||
<SubTexture name="freeplay basic0000" x="2" y="2" width="484" height="122" pivotX="7.65" pivotY="10.55"/>
|
||||
<SubTexture name="freeplay basic0001" x="2" y="2" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0002" x="2" y="2" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0003" x="2" y="126" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0004" x="2" y="126" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0005" x="2" y="126" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0006" x="2" y="250" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0007" x="2" y="250" width="484" height="122"/>
|
||||
<SubTexture name="freeplay basic0008" x="2" y="250" width="484" height="122"/>
|
||||
<SubTexture name="freeplay white0000" x="2" y="374" width="627" height="169" pivotX="15" pivotY="17.15" frameX="0" frameY="0" frameWidth="635" frameHeight="174"/>
|
||||
<SubTexture name="freeplay white0001" x="2" y="545" width="632" height="170" frameX="-3" frameY="-1" frameWidth="635" frameHeight="174"/>
|
||||
<SubTexture name="freeplay white0002" x="2" y="717" width="629" height="173" frameX="-4" frameY="-1" frameWidth="635" frameHeight="174"/>
|
||||
</TextureAtlas>
|
||||
|
||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 62 KiB |
@@ -2,16 +2,16 @@
|
||||
<TextureAtlas imagePath="options.png">
|
||||
<!-- Created with Adobe Animate version 21.0.1.37179 -->
|
||||
<!-- http://www.adobe.com/products/animate.html -->
|
||||
<SubTexture name="options basic0000" x="0" y="0" width="487" height="111" pivotX="14.15" pivotY="11.95"/>
|
||||
<SubTexture name="options basic0001" x="0" y="0" width="487" height="111"/>
|
||||
<SubTexture name="options basic0002" x="0" y="0" width="487" height="111"/>
|
||||
<SubTexture name="options basic0003" x="0" y="111" width="487" height="111"/>
|
||||
<SubTexture name="options basic0004" x="0" y="111" width="487" height="111"/>
|
||||
<SubTexture name="options basic0005" x="0" y="111" width="487" height="111"/>
|
||||
<SubTexture name="options basic0006" x="0" y="222" width="487" height="111"/>
|
||||
<SubTexture name="options basic0007" x="0" y="222" width="487" height="111"/>
|
||||
<SubTexture name="options basic0008" x="0" y="222" width="487" height="111"/>
|
||||
<SubTexture name="options white0000" x="0" y="333" width="606" height="155" pivotX="18.2" pivotY="23.95" frameX="-2" frameY="-1" frameWidth="610" frameHeight="163"/>
|
||||
<SubTexture name="options white0001" x="0" y="488" width="607" height="158" frameX="-3" frameY="-1" frameWidth="610" frameHeight="163"/>
|
||||
<SubTexture name="options white0002" x="0" y="646" width="610" height="163"/>
|
||||
<SubTexture name="options basic0000" x="2" y="2" width="487" height="111" pivotX="14.15" pivotY="11.95"/>
|
||||
<SubTexture name="options basic0001" x="2" y="2" width="487" height="111"/>
|
||||
<SubTexture name="options basic0002" x="2" y="2" width="487" height="111"/>
|
||||
<SubTexture name="options basic0003" x="2" y="115" width="487" height="111"/>
|
||||
<SubTexture name="options basic0004" x="2" y="115" width="487" height="111"/>
|
||||
<SubTexture name="options basic0005" x="2" y="115" width="487" height="111"/>
|
||||
<SubTexture name="options basic0006" x="2" y="228" width="487" height="111"/>
|
||||
<SubTexture name="options basic0007" x="2" y="228" width="487" height="111"/>
|
||||
<SubTexture name="options basic0008" x="2" y="228" width="487" height="111"/>
|
||||
<SubTexture name="options white0000" x="2" y="341" width="606" height="155" pivotX="18.2" pivotY="23.95" frameX="-2" frameY="-1" frameWidth="610" frameHeight="163"/>
|
||||
<SubTexture name="options white0001" x="2" y="498" width="607" height="158" frameX="-3" frameY="-1" frameWidth="610" frameHeight="163"/>
|
||||
<SubTexture name="options white0002" x="2" y="658" width="610" height="163"/>
|
||||
</TextureAtlas>
|
||||
|
||||
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 97 KiB |
@@ -2,16 +2,16 @@
|
||||
<TextureAtlas imagePath="story mode.png">
|
||||
<!-- Created with Adobe Animate version 21.0.1.37179 -->
|
||||
<!-- http://www.adobe.com/products/animate.html -->
|
||||
<SubTexture name="story mode basic0000" x="0" y="0" width="615" height="122" pivotX="8.4" pivotY="9.8"/>
|
||||
<SubTexture name="story mode basic0001" x="0" y="0" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0002" x="0" y="0" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0003" x="0" y="122" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0004" x="0" y="122" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0005" x="0" y="122" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0006" x="0" y="244" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0007" x="0" y="244" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0008" x="0" y="244" width="615" height="122"/>
|
||||
<SubTexture name="story mode white0000" x="0" y="366" width="796" height="173" pivotX="11.05" pivotY="17.15" frameX="0" frameY="-3" frameWidth="796" frameHeight="181"/>
|
||||
<SubTexture name="story mode white0001" x="0" y="539" width="794" height="174" frameX="-2" frameY="-2" frameWidth="796" frameHeight="181"/>
|
||||
<SubTexture name="story mode white0002" x="0" y="713" width="794" height="181" frameX="0" frameY="0" frameWidth="796" frameHeight="181"/>
|
||||
<SubTexture name="story mode basic0000" x="2" y="2" width="615" height="122" pivotX="8.4" pivotY="9.8"/>
|
||||
<SubTexture name="story mode basic0001" x="2" y="2" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0002" x="2" y="2" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0003" x="2" y="126" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0004" x="2" y="126" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0005" x="2" y="126" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0006" x="2" y="250" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0007" x="2" y="250" width="615" height="122"/>
|
||||
<SubTexture name="story mode basic0008" x="2" y="250" width="615" height="122"/>
|
||||
<SubTexture name="story mode white0000" x="2" y="374" width="796" height="173" pivotX="11.05" pivotY="17.15" frameX="0" frameY="-3" frameWidth="796" frameHeight="181"/>
|
||||
<SubTexture name="story mode white0001" x="2" y="549" width="794" height="174" frameX="-2" frameY="-2" frameWidth="796" frameHeight="181"/>
|
||||
<SubTexture name="story mode white0002" x="2" y="725" width="794" height="181" frameX="0" frameY="0" frameWidth="796" frameHeight="181"/>
|
||||
</TextureAtlas>
|
||||
|
||||
|
Before Width: | Height: | Size: 4.9 MiB |
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextureAtlas imagePath="halloween_bg.png">
|
||||
<!-- Created with Adobe Animate version 20.0.0.17400 -->
|
||||
<!-- http://www.adobe.com/products/animate.html -->
|
||||
<SubTexture name="halloweem bg0000" x="0" y="0" width="2114" height="1075"/>
|
||||
<SubTexture name="halloweem bg lightning strike0000" x="2124" y="0" width="2114" height="1075" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0001" x="4248" y="0" width="2114" height="1000" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0002" x="0" y="1085" width="2114" height="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0003" x="2124" y="1085" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0004" x="4248" y="1085" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0005" x="4248" y="1085" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0006" x="0" y="2185" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0007" x="2124" y="2185" width="2114" height="1081" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0008" x="4248" y="2185" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0009" x="0" y="3276" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0010" x="2124" y="3276" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0011" x="4248" y="3276" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0012" x="0" y="4366" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0013" x="2124" y="4366" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0014" x="4248" y="4366" width="2114" height="1080" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0015" x="0" y="5456" width="2114" height="1079" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0016" x="2124" y="5456" width="2114" height="1079" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0017" x="4248" y="5456" width="2114" height="1079" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0018" x="0" y="6545" width="2114" height="1079" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0019" x="2124" y="6545" width="2114" height="1078" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0020" x="4248" y="6545" width="2114" height="1078" frameX="0" frameY="0" frameWidth="2114" frameHeight="1090"/>
|
||||
<SubTexture name="halloweem bg lightning strike0029" x="0" y="0" width="2114" height="1075"/>
|
||||
</TextureAtlas>
|
||||
@@ -0,0 +1,16 @@
|
||||
{"ATLAS": {"SPRITES":[
|
||||
{"SPRITE" : {"name": "0000","x":2,"y":2,"w":2114,"h":1074,"rotated": false}},
|
||||
{"SPRITE" : {"name": "0001","x":2,"y":3074,"w":1037,"h":320,"rotated": false}},
|
||||
{"SPRITE" : {"name": "0002","x":2,"y":1078,"w":2111,"h":996,"rotated": false}},
|
||||
{"SPRITE" : {"name": "0003","x":1041,"y":3074,"w":594,"h":394,"rotated": false}},
|
||||
{"SPRITE" : {"name": "0004","x":2,"y":2076,"w":2094,"h":996,"rotated": false}}
|
||||
]},
|
||||
"meta": {
|
||||
"app": "Adobe Animate",
|
||||
"version": "21.0.1.37179",
|
||||
"image": "spritemap1.png",
|
||||
"format": "RGBA8888",
|
||||
"size": {"w":2118,"h":3470},
|
||||
"resolution": "1"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 423 KiB |
@@ -677,6 +677,14 @@ class PlayState extends MusicBeatState
|
||||
startingSong = true;
|
||||
|
||||
super.create();
|
||||
|
||||
for(s in introSprites)
|
||||
if (s != null)
|
||||
graphicCache.cache(Paths.image(s));
|
||||
|
||||
for(s in introSounds)
|
||||
if (s != null)
|
||||
FlxG.sound.load(Paths.sound(s));
|
||||
}
|
||||
|
||||
@:dox(hide) public override function createPost() {
|
||||
@@ -827,7 +835,7 @@ class PlayState extends MusicBeatState
|
||||
inst.onComplete = endSong;
|
||||
|
||||
if (!paused) {
|
||||
FlxG.sound.music = inst;
|
||||
FlxG.sound.setMusic(inst);
|
||||
FlxG.sound.music.play();
|
||||
}
|
||||
vocals.play();
|
||||
@@ -882,14 +890,12 @@ class PlayState extends MusicBeatState
|
||||
curSong = songData.meta.name.toLowerCase();
|
||||
|
||||
inst = FlxG.sound.load(Paths.inst(SONG.meta.name, difficulty));
|
||||
vocals = FlxG.sound.list.recycle(FlxSound);
|
||||
@:privateAccess {
|
||||
vocals.reset();
|
||||
vocals.exists = true;
|
||||
}
|
||||
if (SONG.meta.needsVoices != false) // null or true
|
||||
vocals.loadEmbedded(Paths.voices(SONG.meta.name, difficulty));
|
||||
FlxG.sound.list.add(vocals);
|
||||
vocals = FlxG.sound.load(Paths.voices(SONG.meta.name, difficulty));
|
||||
else
|
||||
vocals = new FlxSound();
|
||||
inst.group = FlxG.sound.defaultMusicGroup;
|
||||
vocals.group = FlxG.sound.defaultMusicGroup;
|
||||
|
||||
inst.persist = vocals.persist = false;
|
||||
|
||||
@@ -965,16 +971,6 @@ class PlayState extends MusicBeatState
|
||||
override public function onFocus():Void
|
||||
{
|
||||
scripts.call("onFocus");
|
||||
|
||||
|
||||
if (__wasAutoPause) {
|
||||
updateDiscordPresence();
|
||||
if (__songPlaying) {
|
||||
inst.play();
|
||||
vocals.play();
|
||||
}
|
||||
}
|
||||
|
||||
super.onFocus();
|
||||
}
|
||||
|
||||
@@ -983,13 +979,6 @@ class PlayState extends MusicBeatState
|
||||
{
|
||||
scripts.call("onFocusLost");
|
||||
updateDiscordPresence();
|
||||
if (__wasAutoPause = FlxG.autoPause) {
|
||||
__songPlaying = inst.playing;
|
||||
inst.pause();
|
||||
vocals.pause();
|
||||
}
|
||||
|
||||
|
||||
super.onFocusLost();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,11 @@ class TreeMenu extends MusicBeatState {
|
||||
|
||||
FlxG.camera.scroll.set(-FlxG.width, 0);
|
||||
|
||||
pathLabel = new FunkinText(4, 4, FlxG.width - 8, "> Tree Menu", 32, false);
|
||||
pathLabel = new FunkinText(4, 4, FlxG.width - 8, "> Tree Menu", 32, true);
|
||||
pathLabel.borderSize = 1.25;
|
||||
pathLabel.scrollFactor.set();
|
||||
|
||||
pathDesc = new FunkinText(4, pathLabel.y + pathLabel.height + 2, FlxG.width - 8, "Current Tree Menu Description", 16, false);
|
||||
pathDesc = new FunkinText(4, pathLabel.y + pathLabel.height + 2, FlxG.width - 8, "Current Tree Menu Description", 16, true);
|
||||
pathDesc.scrollFactor.set();
|
||||
|
||||
pathBG = new FlxSprite().makeGraphic(1, 1, 0xFF000000);
|
||||
|
||||
@@ -237,7 +237,7 @@ class KeybindsOptions extends MusicBeatSubstate {
|
||||
|
||||
curSelected = FlxMath.wrap(curSelected + change, 0, alphabets.length-1);
|
||||
alphabets.forEach(function(e) {
|
||||
e.alpha = 0.2;
|
||||
e.alpha = 0.45;
|
||||
});
|
||||
if (alphabets.members[curSelected] != null) {
|
||||
var alphabet = alphabets.members[curSelected];
|
||||
|
||||
@@ -108,8 +108,6 @@ class Main extends Sprite
|
||||
addChild(new funkin.system.framerate.Framerate());
|
||||
SystemInfo.init();
|
||||
#end
|
||||
|
||||
trace("Hello", "World");
|
||||
}
|
||||
|
||||
@:dox(hide)
|
||||
|
||||
@@ -53,7 +53,6 @@ class Alphabet extends FlxSpriteGroup
|
||||
|
||||
// TODO: fix this shit refreshing
|
||||
public function refreshAlphabetXML(path:String) {
|
||||
trace("Needs refresh!!");
|
||||
AlphaCharacter.__alphaPath = path;
|
||||
try {
|
||||
var xml = new Access(Xml.parse(Assets.getText(path)).firstElement());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.utils;
|
||||
|
||||
import flixel.system.frontEnds.SoundFrontEnd;
|
||||
import flixel.system.FlxSound;
|
||||
import funkin.system.Conductor;
|
||||
import flixel.system.FlxSoundGroup;
|
||||
@@ -36,23 +37,48 @@ class CoolUtil
|
||||
return (v == null || isNaN(v)) ? defaultValue : v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut to parse JSON from an Asset path
|
||||
* @param assetPath Path to the JSON asset.
|
||||
*/
|
||||
public static function parseJson(assetPath:String) {
|
||||
return Json.parse(Assets.getText(assetPath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut to parse a JSON string
|
||||
* @param str Path to the JSON string
|
||||
* @return Parsed JSON
|
||||
*/
|
||||
public inline static function parseJsonString(str:String)
|
||||
return Json.parse(str);
|
||||
|
||||
/**
|
||||
* Whenever a value is NaN or not.
|
||||
* @param v Value
|
||||
*/
|
||||
public static inline function isNaN(v:Dynamic) {
|
||||
if (v is Float || v is Int)
|
||||
return Math.isNaN(cast(v, Float));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last of an Array
|
||||
* @param array Array
|
||||
* @return T Last element
|
||||
*/
|
||||
public static inline function last<T>(array:Array<T>):T {
|
||||
return array[array.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a field's default value, and returns it. In case it already exists, returns the existing one.
|
||||
* @param v Dynamic to set the default value to
|
||||
* @param name Name of the value
|
||||
* @param defaultValue Default value
|
||||
* @return T New/old value.
|
||||
*/
|
||||
public static function setFieldDefault<T>(v:Dynamic, name:String, defaultValue:T):T {
|
||||
if (Reflect.hasField(v, name)) {
|
||||
var f:Null<Dynamic> = Reflect.field(v, name);
|
||||
@@ -63,11 +89,21 @@ class CoolUtil
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add several zeros at the beginning of a string, so that `2` becomes `02`.
|
||||
* @param str String to add zeros
|
||||
* @param num The length required
|
||||
*/
|
||||
public static inline function addZeros(str:String, num:Int) {
|
||||
while(str.length < num) str = '0${str}';
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of a size, following this format: `1.02 GB`, `134.00 MB`
|
||||
* @param size Size to convert ot string
|
||||
* @return String Result string representation
|
||||
*/
|
||||
public static function getSizeString(size:Float):String {
|
||||
var labels = ["B", "KB", "MB", "GB", "TB"];
|
||||
var rSize:Float = size;
|
||||
@@ -79,6 +115,13 @@ class CoolUtil
|
||||
return '${Std.int(rSize) + "." + addZeros(Std.string(Std.int((rSize % 1) * 100)), 2)}${labels[label]}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternative linear interpolation function for each frame use, without worrying about framerate changes.
|
||||
* @param v1 Begin value
|
||||
* @param v2 End value
|
||||
* @param ratio Ratio
|
||||
* @return Float Final value
|
||||
*/
|
||||
public static inline function fpsLerp(v1:Float, v2:Float, ratio:Float):Float {
|
||||
return FlxMath.lerp(v1, v2, getFPSRatio(ratio));
|
||||
}
|
||||
@@ -140,6 +183,10 @@ class CoolUtil
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays the main menu theme.
|
||||
* @param fadeIn
|
||||
*/
|
||||
public static function playMenuSong(fadeIn:Bool = false) {
|
||||
if (FlxG.sound.music == null || !FlxG.sound.music.playing)
|
||||
{
|
||||
@@ -149,6 +196,11 @@ class CoolUtil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Preloads a character.
|
||||
* @param name Character name
|
||||
* @param spriteName (Optional) sprite name.
|
||||
*/
|
||||
public static function preloadCharacter(name:String, ?spriteName:String) {
|
||||
if (name == null) return;
|
||||
if (spriteName == null)
|
||||
@@ -157,6 +209,14 @@ class CoolUtil
|
||||
Paths.getFrames('characters/$spriteName');
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays music, while resetting the Conductor, and taking info from INI in count.
|
||||
* @param path Path to the music
|
||||
* @param DefaultBPM Default BPM of the music (102)
|
||||
* @param Volume Volume of the music (1)
|
||||
* @param Looped Whenever the music loops (true)
|
||||
* @param Group A group that this music belongs to (default)
|
||||
*/
|
||||
public static function playMusic(path:String, DefaultBPM:Int = 102, Volume:Int = 1, Looped:Bool = true, ?Group:FlxSoundGroup) {
|
||||
Conductor.reset();
|
||||
FlxG.sound.playMusic(path, Volume, Looped, Group);
|
||||
@@ -200,17 +260,38 @@ class CoolUtil
|
||||
}), volume);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows you to split a text file from a path, into a "cool text file", AKA a list. Allows for comments. For example,
|
||||
* `# comment`
|
||||
* `test1`
|
||||
* ` `
|
||||
* `test2`
|
||||
* will return `["test1", "test2"]`
|
||||
* @param path
|
||||
* @return Array<String>
|
||||
*/
|
||||
public static function coolTextFile(path:String):Array<String>
|
||||
{
|
||||
var trim:String;
|
||||
return [for(line in Assets.getText(path).split("\n")) if ((trim = line.trim()) != "" && !trim.startsWith("#")) trim];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of number from min to max. Equivalent of `[for (i in min...max) i]`.
|
||||
* @param max Max value
|
||||
* @param min Minimal value (0)
|
||||
* @return Array<Int> Final array
|
||||
*/
|
||||
public static inline function numberArray(max:Int, ?min:Int = 0):Array<Int>
|
||||
{
|
||||
return [for (i in min...max) i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches frames from 2 FlxAnimations.
|
||||
* @param anim1 First animation
|
||||
* @param anim2 Second animation
|
||||
*/
|
||||
public static function switchAnimFrames(anim1:FlxAnimation, anim2:FlxAnimation) {
|
||||
if (anim1 == null || anim2 == null) return;
|
||||
var old = anim1.frames;
|
||||
@@ -218,6 +299,14 @@ class CoolUtil
|
||||
anim2.frames = old;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows you to set a graphic size (ex: 150x150), with proper hitbox without a stretched sprite.
|
||||
* @param sprite Sprite to apply the new graphic size to
|
||||
* @param width Width
|
||||
* @param height Height
|
||||
* @param fill Whenever the sprite should fill instead of shrinking (true)
|
||||
* @param maxScale Maximum scale (0 / none)
|
||||
*/
|
||||
public static function setUnstretchedGraphicSize(sprite:FlxSprite, width:Int, height:Int, fill:Bool = true, maxScale:Float = 0) {
|
||||
sprite.setGraphicSize(width, height);
|
||||
sprite.updateHitbox();
|
||||
@@ -226,6 +315,11 @@ class CoolUtil
|
||||
sprite.scale.set(nScale, nScale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a simple string representation of a FlxKey. Used in Controls options.
|
||||
* @param key Key
|
||||
* @return Simple representation
|
||||
*/
|
||||
public static inline function keyToString(key:Null<FlxKey>):String {
|
||||
return switch(key) {
|
||||
case null | 0 | NONE: "---";
|
||||
@@ -263,6 +357,12 @@ class CoolUtil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Centers an object in a camera's field, basically `screenCenter()` but `camera.width` and `camera.height` are used instead of `FlxG.width` and `FlxG.height`.
|
||||
* @param obj Sprite to center
|
||||
* @param cam Camera
|
||||
* @param axes Axes (XY)
|
||||
*/
|
||||
public static function cameraCenter(obj:FlxObject, cam:FlxCamera, axes:FlxAxes = XY) {
|
||||
switch(axes) {
|
||||
case XY:
|
||||
@@ -276,6 +376,11 @@ class CoolUtil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a week into PlayState.
|
||||
* @param weekData Week Data
|
||||
* @param difficulty Week Difficulty
|
||||
*/
|
||||
public static function loadWeek(weekData:WeekData, difficulty:String = "normal") {
|
||||
PlayState.storyWeek = weekData;
|
||||
PlayState.storyPlaylist = [for(e in weekData.songs) e.name];
|
||||
@@ -284,6 +389,14 @@ class CoolUtil
|
||||
PlayState.opponentMode = PlayState.coopMode = false;
|
||||
__loadSong(PlayState.storyPlaylist[0], difficulty);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a song into PlayState
|
||||
* @param name Song name
|
||||
* @param difficulty Chart difficulty (if invalid, will load an empty chart)
|
||||
* @param opponentMode Whenever opponent mode is on
|
||||
* @param coopMode Whenever co-op mode is on.
|
||||
*/
|
||||
public static function loadSong(name:String, difficulty:String = "normal", opponentMode:Bool = false, coopMode:Bool = false) {
|
||||
PlayState.campaignScore = 0;
|
||||
PlayState.isStoryMode = false;
|
||||
@@ -291,22 +404,49 @@ class CoolUtil
|
||||
PlayState.coopMode = coopMode;
|
||||
__loadSong(name, difficulty);
|
||||
}
|
||||
|
||||
/**
|
||||
* (INTERNAL) Loads a song without resetting story mode/opponent mode/coop mode values.
|
||||
* @param name Song name
|
||||
* @param difficulty Song difficulty
|
||||
*/
|
||||
public static function __loadSong(name:String, difficulty:String) {
|
||||
PlayState.difficulty = difficulty;
|
||||
|
||||
PlayState.SONG = Chart.parse(name, difficulty);
|
||||
PlayState.fromMods = PlayState.SONG.fromMods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent of `setGraphicSize`, except that it can accept floats and automatically updates the hitbox.
|
||||
* @param sprite Sprite to set the size of
|
||||
* @param width Width
|
||||
* @param height Height
|
||||
*/
|
||||
public static function setSpriteSize(sprite:FlxSprite, width:Float, height:Float) {
|
||||
sprite.scale.set(width / sprite.frameWidth, height / sprite.frameHeight);
|
||||
sprite.updateHitbox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an XML attribute from an `Access` abstract, without throwing an exception if invalid.
|
||||
* Example: `xml.getAtt("test").getDefault("Hello, World!");`
|
||||
* @param xml XML to get the attribute from
|
||||
* @param name Name of the attribute
|
||||
*/
|
||||
public static inline function getAtt(xml:Access, name:String) {
|
||||
if (!xml.has.resolve(name)) return null;
|
||||
return xml.att.resolve(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads frames from a specific image path. Supports Sparrow Atlases, Packer Atlases, and multiple spritesheets.
|
||||
* @param path Path to the image
|
||||
* @param Unique Whenever the image should be unique in the cache
|
||||
* @param Key Key to the image in the cache
|
||||
* @param SkipAtlasCheck Whenever the atlas check should be skipped.
|
||||
* @return FlxFramesCollection Frames
|
||||
*/
|
||||
public static function loadFrames(path:String, Unique:Bool = false, Key:String = null, SkipAtlasCheck:Bool = false):FlxFramesCollection {
|
||||
var noExt = Path.withoutExtension(path);
|
||||
|
||||
@@ -350,6 +490,11 @@ class CoolUtil
|
||||
return graph.imageFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an animated graphic, and automatically animates it.
|
||||
* @param spr Sprite to load the graphic for
|
||||
* @param path Path to the graphic
|
||||
*/
|
||||
public static function loadAnimatedGraphic(spr:FlxSprite, path:String) {
|
||||
spr.frames = loadFrames(path);
|
||||
|
||||
@@ -361,6 +506,11 @@ class CoolUtil
|
||||
return spr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a color transform from color1 to color2
|
||||
* @param color1 Color transform to copy to
|
||||
* @param color2 Color transform to copy from
|
||||
*/
|
||||
public static inline function copyColorTransform(color1:ColorTransform, color2:ColorTransform) {
|
||||
color1.alphaMultiplier = color2.alphaMultiplier;
|
||||
color1.alphaOffset = color2.alphaOffset;
|
||||
@@ -372,6 +522,12 @@ class CoolUtil
|
||||
color1.redOffset = color2.redOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets an FlxSprite
|
||||
* @param spr Sprite to reset
|
||||
* @param x New X position
|
||||
* @param y New Y position
|
||||
*/
|
||||
public static function resetSprite(spr:FlxSprite, x:Float, y:Float) {
|
||||
spr.reset(x, y);
|
||||
spr.alpha = 1;
|
||||
@@ -397,12 +553,22 @@ class CoolUtil
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an entire group into an array.
|
||||
* @param array Array to push the group into
|
||||
* @param ...args Group entries
|
||||
* @return Array<T>
|
||||
*/
|
||||
public static function pushGroup<T>(array:Array<T>, ...args:T):Array<T> {
|
||||
for(a in args)
|
||||
array.push(a);
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an URL in the browser.
|
||||
* @param url
|
||||
*/
|
||||
public static function openURL(url:String) {
|
||||
#if linux
|
||||
Sys.command('/usr/bin/xdg-open', [url, "&"]);
|
||||
@@ -411,23 +577,51 @@ class CoolUtil
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops a sound, set its time to 0 then play it again.
|
||||
* @param sound Sound to replay.
|
||||
*/
|
||||
public static function replay(sound:FlxSound) {
|
||||
sound.stop();
|
||||
sound.time = 0;
|
||||
sound.play();
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent of `Math.max`, except doesn't require a Int -> Float -> Int conversion.
|
||||
* @param p1
|
||||
* @param p2
|
||||
* @return return p1 < p2 ? p2 : p1
|
||||
*/
|
||||
public static inline function maxInt(p1:Int, p2:Int)
|
||||
return p1 < p2 ? p2 : p1;
|
||||
|
||||
/**
|
||||
* Equivalent of `Math.floor`, except doesn't require a Int -> Float -> Int conversion.
|
||||
* @param e Value to get the floor of.
|
||||
*/
|
||||
public static inline function floorInt(e:Float) {
|
||||
var r = Std.int(e);
|
||||
if (e < 0 && r != e)
|
||||
r--;
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a SoundFrontEnd's music to a FlxSound.
|
||||
* Example: `FlxG.sound.setMusic(music);`
|
||||
* @param frontEnd SoundFrontEnd to set the music of
|
||||
* @param music Music
|
||||
*/
|
||||
public static function setMusic(frontEnd:SoundFrontEnd, music:FlxSound) {
|
||||
frontEnd.list.remove(music);
|
||||
frontEnd.music = music;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SFXs to play using `playMenuSFX`.
|
||||
*/
|
||||
enum abstract CoolSfx(Int) from Int {
|
||||
var SCROLL = 0;
|
||||
var CONFIRM = 1;
|
||||
|
||||
@@ -48,7 +48,6 @@ class DiscordUtil {
|
||||
Logs.trace('Couldn\'t load Discord RPC configuration: ${e.toString()}', ERROR);
|
||||
}
|
||||
}
|
||||
trace(data);
|
||||
data.setFieldDefault("clientID", "1027994136193810442");
|
||||
data.setFieldDefault("logoKey", "icon");
|
||||
data.setFieldDefault("logoText", Application.current.meta.get('title'));
|
||||
|
||||