diff --git a/.github/workflows/build-shit.yml b/.github/workflows/build-shit.yml
index 11cecd138..7115f2f6d 100644
--- a/.github/workflows/build-shit.yml
+++ b/.github/workflows/build-shit.yml
@@ -27,6 +27,7 @@ jobs:
- uses: ./.github/actions/setup-haxeshit
- name: Build game?
run: |
+ sudo apt-get install -y libx11-dev libxinerama-dev libxrandr-dev libgl1-mesa-dev libgl-dev libxi-dev libxext-dev libasound2-dev
haxelib run lime build html5 -debug --times
ls
- uses: ./.github/actions/upload-itch
diff --git a/.vscode/settings.json b/.vscode/settings.json
index d7433698d..dd4cd7aef 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,84 +1,120 @@
{
- "[haxe]": {
- // Automatically keep Haxe files formatted.
- "editor.formatOnSave": true,
- "editor.formatOnPaste": true,
- "editor.codeActionsOnSave": {
- // Compilation server issues can cause auto-cleanup to remove valid imports.
- "source.organizeImports": false
- },
- "editor.defaultFormatter": "nadako.vshaxe",
- "editor.tabSize": 2
+ "[haxe]": {
+ // Automatically keep Haxe files formatted.
+ "editor.formatOnSave": true,
+ "editor.formatOnPaste": true,
+ "editor.codeActionsOnSave": {
+ // Compilation server issues can cause auto-cleanup to remove valid imports.
+ "source.organizeImports": false
},
-
- "[json]": {
- // Automatically keep JSON files formatted.
- "editor.formatOnSave": true,
- "editor.formatOnPaste": true,
- "editor.defaultFormatter": "esbenp.prettier-vscode"
+ "editor.defaultFormatter": "nadako.vshaxe",
+ "editor.tabSize": 2
+ },
+
+ "[json]": {
+ // Automatically keep JSON files formatted.
+ "editor.formatOnSave": true,
+ "editor.formatOnPaste": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+
+ "[jsonc]": {
+ // Automatically keep JSONC files formatted.
+ "editor.formatOnSave": true,
+ "editor.formatOnPaste": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "prettier.tabWidth": 2,
+
+ // XML formatting style configuration
+ "xml.format.enabled": true,
+ "xml.format.legacy": false,
+ "xml.format.emptyElements": "collapse",
+ "xml.preferences.quoteStyle": "double",
+ "xml.format.enforceQuoteStyle": "preferred",
+ "xml.format.preserveAttributeLineBreaks": false,
+ "xml.format.preservedNewlines": 0,
+ "xml.format.splitAttributes": false,
+ "xml.format.joinCDATALines": true,
+ "xml.format.preserveEmptyContent": false,
+ "xml.format.joinCommentLines": false,
+ "xml.format.joinContentLines": false,
+ "xml.format.spaceBeforeEmptyCloseTag": true,
+ "xml.format.xsiSchemaLocationSplit": "onPair",
+ "xml.format.splitAttributesIndentSize": 2,
+ "xml.format.closingBracketNewLine": false,
+ "xml.format.preserveSpace": [
+ "xsl:text",
+ "xsl:comment",
+ "xsl:processing-instruction",
+ "literallayout",
+ "programlisting",
+ "screen",
+ "synopsis",
+ "pre",
+ "xd:pre"
+ ],
+ "xml.format.maxLineWidth": 0,
+ "xml.format.grammarAwareFormatting": true,
+
+ // Generic file formatting style configuration
+ "files.insertFinalNewline": true,
+ "files.trimFinalNewlines": false,
+ "files.trimTrailingWhitespace": true,
+
+ // Automatically detect indentation.
+ "editor.detectIndentation": true,
+ "editor.insertSpaces": true,
+ "editor.tabSize": 2,
+
+ // Automatically enforce Linux style line endings.
+ "files.eol": "\n",
+
+ "haxe.displayPort": "auto",
+ "haxe.enableCompilationServer": true,
+ "haxe.displayServer": {
+ "arguments": ["-v"]
+ },
+ // Fix file associations for HScript.
+ "files.associations": {
+ "*.hxp": "haxe",
+ "*.hscript": "haxe",
+ "*.haxe": "haxe",
+ "*.hxs": "haxe",
+ "*.hxc": "haxe"
+ },
+ "projectManager.git.baseFolders": ["./"],
+
+ "haxecheckstyle.sourceFolders": ["src", "Source"],
+ "haxecheckstyle.externalSourceRoots": [],
+ "haxecheckstyle.configurationFile": "checkstyle.json",
+ "haxecheckstyle.codeSimilarityBufferSize": 100,
+
+ "lime.targetConfigurations": [
+ {
+ "label": "Windows / Debug",
+ "target": "windows",
+ "args": ["-debug"]
},
-
- "[jsonc]": {
- // Automatically keep JSONC files formatted.
- "editor.formatOnSave": true,
- "editor.formatOnPaste": true,
- "editor.defaultFormatter": "esbenp.prettier-vscode"
+ {
+ "label": "Windows / Debug (DEBUG ASSETS)",
+ "target": "windows",
+ "args": ["-debug", "-DDEBUG_ASSETS"]
},
- "prettier.tabWidth": 2,
-
- // Automatically detect indentation.
- "editor.detectIndentation": true,
- "editor.insertSpaces": true,
- "editor.tabSize": 2,
-
- // Automatically enforce Linux style line endings.
- "files.eol": "\n",
-
- "haxe.displayPort": "auto",
- "haxe.enableCompilationServer": true,
- "haxe.displayServer": {
- "arguments": ["-v"]
+ {
+ "label": "Windows / Debug (ANIMATE)",
+ "target": "windows",
+ "args": ["-debug", "-DANIMATE"]
},
- // Fix file associations for HScript.
- "files.associations": {
- "*.hxp": "haxe",
- "*.hscript": "haxe",
- "*.haxe": "haxe",
- "*.hxs": "haxe",
- "*.hxc": "haxe"
+ {
+ "label": "HTML5 / Debug",
+ "target": "html5",
+ "args": ["-debug"]
},
- "projectManager.git.baseFolders": ["./"],
-
- "haxecheckstyle.sourceFolders": ["src", "Source"],
- "haxecheckstyle.externalSourceRoots": [],
- "haxecheckstyle.configurationFile": "checkstyle.json",
- "haxecheckstyle.codeSimilarityBufferSize": 100,
-
- "lime.targetConfigurations": [
- {
- "label": "Windows / Debug",
- "target": "windows",
- "args": ["-debug"]
- },
- {
- "label": "Windows / Debug (DEBUG ASSETS)",
- "target": "windows",
- "args": ["-debug", "-DDEBUG_ASSETS"]
- },
- {
- "label": "Windows / Debug (ANIMATE)",
- "target": "windows",
- "args": ["-debug", "-DANIMATE"]
- },
- {
- "label": "HTML5 / Debug",
- "target": "html5",
- "args": ["-debug"]
- },
- {
- "label": "HTML5 / Debug (Watch)",
- "target": "html5",
- "args": ["-debug", "-watch"]
- }
- ]
- }
\ No newline at end of file
+ {
+ "label": "HTML5 / Debug (Watch)",
+ "target": "html5",
+ "args": ["-debug", "-watch"]
+ }
+ ]
+}
diff --git a/Project.xml b/Project.xml
index 972749939..2d9dd802b 100644
--- a/Project.xml
+++ b/Project.xml
@@ -1,48 +1,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -93,9 +76,7 @@
-
-
-
-
-
-
-
-
+
-
-
-
+
-
-
-
+
+
-
+
-
-
-
-
-
-
+
-
+
+
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
diff --git a/example_mods/introMod/_polymod_meta.json b/example_mods/introMod/_polymod_meta.json
index 4c7fd742e..e0b03f1cd 100644
--- a/example_mods/introMod/_polymod_meta.json
+++ b/example_mods/introMod/_polymod_meta.json
@@ -1,9 +1,11 @@
{
"title": "Intro Mod",
"description": "An introductory mod.",
- "contributors": [{
- "name": "MasterEric"
- }],
+ "contributors": [
+ {
+ "name": "MasterEric"
+ }
+ ],
"api_version": "0.1.0",
"mod_version": "1.0.0",
"license": "Apache-2.0"
diff --git a/example_mods/testing123/_polymod_meta.json b/example_mods/testing123/_polymod_meta.json
index 1a7766820..4c0f177f9 100644
--- a/example_mods/testing123/_polymod_meta.json
+++ b/example_mods/testing123/_polymod_meta.json
@@ -1,9 +1,11 @@
{
"title": "Testing123",
"description": "Newgrounds? More like OLDGROUNDS lol.",
- "contributors": [{
- "name": "MasterEric"
- }],
+ "contributors": [
+ {
+ "name": "MasterEric"
+ }
+ ],
"api_version": "0.1.0",
"mod_version": "1.0.0",
"license": "Apache-2.0"
diff --git a/hmm.json b/hmm.json
index e92868545..f45a94b08 100644
--- a/hmm.json
+++ b/hmm.json
@@ -65,10 +65,10 @@
"version": "2.5.0"
},
{
- "name": "hxcodec",
+ "name": "hxCodec",
"type": "git",
"dir": null,
- "ref": "91adeec",
+ "ref": "c42ab99",
"url": "https://github.com/polybiusproxy/hxCodec"
},
{
@@ -95,7 +95,7 @@
"name": "lime",
"type": "git",
"dir": null,
- "ref": "deecd6c",
+ "ref": "5634ad7",
"url": "https://github.com/openfl/lime"
},
{
@@ -118,4 +118,4 @@
"version": "0.2.2"
}
]
-}
\ No newline at end of file
+}
diff --git a/source/funkin/Alphabet.hx b/source/funkin/Alphabet.hx
index adf97933a..a501707be 100644
--- a/source/funkin/Alphabet.hx
+++ b/source/funkin/Alphabet.hx
@@ -125,8 +125,7 @@ class Alphabet extends FlxSpriteGroup
var xPos:Float = 0;
var curRow:Int = 0;
- new FlxTimer().start(0.05, function(tmr:FlxTimer)
- {
+ new FlxTimer().start(0.05, function(tmr:FlxTimer) {
// trace(_finalText.fastCodeAt(loopNum) + " " + _finalText.charAt(loopNum));
if (_finalText.fastCodeAt(loopNum) == "\n".code)
{
diff --git a/source/funkin/ButtonRemapSubstate.hx b/source/funkin/ButtonRemapSubstate.hx
index 376cc4d54..8905ec8ba 100644
--- a/source/funkin/ButtonRemapSubstate.hx
+++ b/source/funkin/ButtonRemapSubstate.hx
@@ -2,7 +2,7 @@ package funkin;
import flixel.FlxSubState;
-class ButtonRemapSubstate extends FlxSubState
+class ButtonRemapSubState extends FlxSubState
{
public function new()
{
diff --git a/source/funkin/ComboCounter.hx b/source/funkin/ComboCounter.hx
index ac8606691..28aed4560 100644
--- a/source/funkin/ComboCounter.hx
+++ b/source/funkin/ComboCounter.hx
@@ -27,8 +27,7 @@ class ComboCounter extends FlxTypedSpriteGroup
effectStuff.animation.addByPrefix('funny', 'NOTE COMBO animation', 24, false);
effectStuff.animation.play('funny');
effectStuff.antialiasing = true;
- effectStuff.animation.finishCallback = function(nameThing)
- {
+ effectStuff.animation.finishCallback = function(nameThing) {
kill();
};
effectStuff.setGraphicSize(Std.int(effectStuff.width * 0.7));
@@ -42,8 +41,7 @@ class ComboCounter extends FlxTypedSpriteGroup
{
if (onScreenTime < 0.9)
{
- new FlxTimer().start((Conductor.crochet / 1000) * 0.25, function(tmr)
- {
+ new FlxTimer().start((Conductor.crochet / 1000) * 0.25, function(tmr) {
forceFinish();
});
}
@@ -64,16 +62,14 @@ class ComboCounter extends FlxTypedSpriteGroup
if (effectStuff.animation.curAnim.curFrame == 18)
{
- grpNumbers.forEach(function(spr:ComboNumber)
- {
+ grpNumbers.forEach(function(spr:ComboNumber) {
spr.animation.reset();
});
}
if (effectStuff.animation.curAnim.curFrame == 20)
{
- grpNumbers.forEach(function(spr:ComboNumber)
- {
+ grpNumbers.forEach(function(spr:ComboNumber) {
spr.kill();
});
}
diff --git a/source/funkin/Conductor.hx b/source/funkin/Conductor.hx
index a0493869b..e31b6d501 100644
--- a/source/funkin/Conductor.hx
+++ b/source/funkin/Conductor.hx
@@ -50,6 +50,16 @@ class Conductor
// OLD, replaced with timeChanges.
public static var bpmChangeMap:Array = [];
+ /**
+ * Duration of a measure in milliseconds. Calculated based on bpm.
+ */
+ public static var measureLengthMs(get, null):Float;
+
+ static function get_measureLengthMs():Float
+ {
+ return crochet * timeSignatureNumerator;
+ }
+
/**
* Duration of a beat in millisecond. Calculated based on bpm.
*/
@@ -149,9 +159,9 @@ class Conductor
/**
* Forcibly defines the current BPM of the song.
* Useful for things like the chart editor that need to manipulate BPM in real time.
- *
+ *
* Set to null to reset to the BPM defined by the timeChanges.
- *
+ *
* WARNING: Avoid this for things like setting the BPM of the title screen music,
* you should have a metadata file for it instead.
*/
@@ -166,7 +176,7 @@ class Conductor
/**
* Update the conductor with the current song position.
* BPM, current step, etc. will be re-calculated based on the song position.
- *
+ *
* @param songPosition The current position in the song in milliseconds.
* Leave blank to use the FlxG.sound.music position.
*/
diff --git a/source/funkin/CoolUtil.hx b/source/funkin/CoolUtil.hx
index c7d3f7dab..93fa937da 100644
--- a/source/funkin/CoolUtil.hx
+++ b/source/funkin/CoolUtil.hx
@@ -20,13 +20,6 @@ import openfl.filters.ShaderFilter;
class CoolUtil
{
- public static var difficultyArray:Array = ['EASY', "NORMAL", "HARD"];
-
- public static function difficultyString():String
- {
- return difficultyArray[PlayState.storyDifficulty];
- }
-
public static function coolBaseLog(base:Float, fin:Float):Float
{
return Math.log(fin) / Math.log(base);
@@ -119,8 +112,7 @@ class CoolUtil
FlxTween.tween(screenWipeShit, {daAlphaShit: 1}, time,
{
ease: FlxEase.quadInOut,
- onComplete: function(twn)
- {
+ onComplete: function(twn) {
screenShit.destroy();
FlxG.switchState(new MainMenuState());
}
@@ -130,7 +122,7 @@ class CoolUtil
/**
* Just saves the json with some default values hehe
- * @param json
+ * @param json
* @return String
*/
public static inline function jsonStringify(data:Dynamic):String
diff --git a/source/funkin/CutsceneAnimTestState.hx b/source/funkin/CutsceneAnimTestState.hx
deleted file mode 100644
index 7d6369c12..000000000
--- a/source/funkin/CutsceneAnimTestState.hx
+++ /dev/null
@@ -1,80 +0,0 @@
-package funkin;
-
-import flixel.FlxSprite;
-import flixel.FlxState;
-import flixel.addons.display.FlxGridOverlay;
-import flixel.group.FlxGroup.FlxTypedGroup;
-import flixel.math.FlxPoint;
-import flixel.text.FlxText;
-import flixel.util.FlxColor;
-import openfl.Assets;
-import openfl.display.BitmapData;
-import openfl.display.MovieClip;
-import openfl.display.Timeline;
-import openfl.geom.Matrix;
-import openfl.geom.Rectangle;
-
-class CutsceneAnimTestState extends FlxState
-{
- var cutsceneGroup:CutsceneCharacter;
-
- var curSelected:Int = 0;
- var debugTxt:FlxText;
-
- var funnySprite:FlxSprite = new FlxSprite();
- var clip:MovieClip;
-
- public function new()
- {
- super();
-
- var gridBG:FlxSprite = FlxGridOverlay.create(10, 10);
- gridBG.scrollFactor.set(0.5, 0.5);
- add(gridBG);
-
- debugTxt = new FlxText(900, 20, 0, "", 20);
- debugTxt.color = FlxColor.BLUE;
- add(debugTxt);
-
- clip = Assets.getMovieClip("tanky:");
- // clip.x = FlxG.width/2;
- // clip.y = FlxG.height/2;
- FlxG.stage.addChild(clip);
-
- var swagShit:MovieClip = Assets.getMovieClip('tankBG:');
- // swagShit.scaleX = 5;
-
- FlxG.stage.addChild(swagShit);
- swagShit.gotoAndStop(13);
-
- var swfMountain = new BitmapData(FlxG.width, FlxG.height, true, 0x00000000);
- swfMountain.draw(swagShit, swagShit.transform.matrix);
-
- var mountains:FlxSprite = new FlxSprite().loadGraphic(swfMountain);
- // add(mountains);
-
- FlxG.stage.removeChild(swagShit);
-
- funnySprite.x = FlxG.width / 2;
- funnySprite.y = FlxG.height / 2;
- add(funnySprite);
- }
-
- override function update(elapsed:Float)
- {
- super.update(elapsed);
-
- // jam sprite into top left corner
- var drawMatrix:Matrix = clip.transform.matrix;
- var bounds:Rectangle = clip.getBounds(null);
- drawMatrix.tx = -bounds.x;
- drawMatrix.ty = -bounds.y;
- // make bitmapdata only as big as it needs to be
- var funnyBmp:BitmapData = new BitmapData(Math.ceil(bounds.width), Math.ceil(bounds.height), true, 0x00000000);
- funnyBmp.draw(clip, drawMatrix, true);
- funnySprite.loadGraphic(funnyBmp);
- // jam sprite back into place lol
- funnySprite.offset.x = -bounds.x;
- funnySprite.offset.y = -bounds.y;
- }
-}
diff --git a/source/funkin/CutsceneCharacter.hx b/source/funkin/CutsceneCharacter.hx
deleted file mode 100644
index 67810bc30..000000000
--- a/source/funkin/CutsceneCharacter.hx
+++ /dev/null
@@ -1,75 +0,0 @@
-package funkin;
-
-import flixel.FlxSprite;
-import flixel.group.FlxGroup.FlxTypedGroup;
-import flixel.math.FlxPoint;
-
-class CutsceneCharacter extends FlxTypedGroup
-{
- public var coolPos:FlxPoint = FlxPoint.get();
- public var animShit:Map = new Map();
-
- var imageShit:String;
-
- public function new(x:Float, y:Float, imageShit:String)
- {
- super();
-
- coolPos.set(x, y);
-
- this.imageShit = imageShit;
- parseOffsets();
- createCutscene(0);
- }
-
- // shitshow, oh well
- var arrayLMFAOOOO:Array = [];
-
- function parseOffsets()
- {
- var splitShit:Array = CoolUtil.coolTextFile(Paths.file('images/cutsceneStuff/' + imageShit + "CutsceneOffsets.txt"));
-
- for (i in splitShit)
- {
- var xAndY:FlxPoint = FlxPoint.get();
- var dumbSplit:Array = i.split('---')[1].trim().split(' ');
- trace('cool split: ' + i.split('---')[1]);
- trace(dumbSplit);
- xAndY.set(Std.parseFloat(dumbSplit[0]), Std.parseFloat(dumbSplit[1]));
-
- animShit.set(i.split('---')[0].trim(), xAndY);
- arrayLMFAOOOO.push(i.split('---')[0].trim());
- }
-
- trace(animShit);
- }
-
- public function createCutscene(daNum:Int = 0)
- {
- var cutScene:FlxSprite = new FlxSprite(coolPos.x + animShit.get(arrayLMFAOOOO[daNum]).x, coolPos.y + animShit.get(arrayLMFAOOOO[daNum]).y);
- cutScene.frames = Paths.getSparrowAtlas('cutsceneStuff/' + imageShit + "-" + daNum);
- cutScene.animation.addByPrefix('weed', arrayLMFAOOOO[daNum], 24, false);
- cutScene.animation.play('weed');
- cutScene.antialiasing = true;
-
- cutScene.animation.finishCallback = function(anim:String)
- {
- cutScene.kill();
- cutScene.destroy();
- cutScene = null;
-
- if (daNum + 1 < arrayLMFAOOOO.length) createCutscene(daNum + 1);
- else
- ended();
- };
-
- add(cutScene);
- }
-
- public var onFinish:Void->Void;
-
- public function ended():Void
- {
- if (onFinish != null) onFinish();
- }
-}
diff --git a/source/funkin/DialogueBox.hx b/source/funkin/DialogueBox.hx
index e9c3587ad..4258f71ce 100644
--- a/source/funkin/DialogueBox.hx
+++ b/source/funkin/DialogueBox.hx
@@ -38,7 +38,7 @@ class DialogueBox extends FlxSpriteGroup
{
super();
- switch (PlayState.currentSong.song.toLowerCase())
+ switch (PlayState.instance.currentSong.songId.toLowerCase())
{
case 'senpai':
FlxG.sound.playMusic(Paths.music('Lunchbox'), 0);
@@ -53,8 +53,7 @@ class DialogueBox extends FlxSpriteGroup
bgFade.alpha = 0;
add(bgFade);
- new FlxTimer().start(0.83, function(tmr:FlxTimer)
- {
+ new FlxTimer().start(0.83, function(tmr:FlxTimer) {
bgFade.alpha += (1 / 5) * 0.7;
if (bgFade.alpha > 0.7) bgFade.alpha = 0.7;
}, 5);
@@ -80,7 +79,7 @@ class DialogueBox extends FlxSpriteGroup
box = new FlxSprite(-20, 45);
var hasDialog:Bool = false;
- switch (PlayState.currentSong.song.toLowerCase())
+ switch (PlayState.instance.currentSong.songId.toLowerCase())
{
case 'senpai':
hasDialog = true;
@@ -152,8 +151,8 @@ class DialogueBox extends FlxSpriteGroup
override function update(elapsed:Float):Void
{
// HARD CODING CUZ IM STUPDI
- if (PlayState.currentSong.song.toLowerCase() == 'roses') portraitLeft.visible = false;
- if (PlayState.currentSong.song.toLowerCase() == 'thorns')
+ if (PlayState.instance.currentSong.songId.toLowerCase() == 'roses') portraitLeft.visible = false;
+ if (PlayState.instance.currentSong.songId.toLowerCase() == 'thorns')
{
portraitLeft.color = FlxColor.BLACK;
swagDialogue.color = FlxColor.WHITE;
@@ -189,11 +188,10 @@ class DialogueBox extends FlxSpriteGroup
{
isEnding = true;
- if (PlayState.currentSong.song.toLowerCase() == 'senpai'
- || PlayState.currentSong.song.toLowerCase() == 'thorns') FlxG.sound.music.fadeOut(2.2, 0);
+ if (PlayState.instance.currentSong.songId.toLowerCase() == 'senpai'
+ || PlayState.instance.currentSong.songId.toLowerCase() == 'thorns') FlxG.sound.music.fadeOut(2.2, 0);
- new FlxTimer().start(0.2, function(tmr:FlxTimer)
- {
+ new FlxTimer().start(0.2, function(tmr:FlxTimer) {
box.alpha -= 1 / 5;
bgFade.alpha -= 1 / 5 * 0.7;
portraitLeft.visible = false;
@@ -203,8 +201,7 @@ class DialogueBox extends FlxSpriteGroup
dropText.alpha = swagDialogue.alpha;
}, 5);
- new FlxTimer().start(1.2, function(tmr:FlxTimer)
- {
+ new FlxTimer().start(1.2, function(tmr:FlxTimer) {
finishThing();
kill();
});
@@ -233,8 +230,7 @@ class DialogueBox extends FlxSpriteGroup
// swagDialogue.text = ;
swagDialogue.resetText(dialogueList[0]);
swagDialogue.start(0.04);
- swagDialogue.completeCallback = function()
- {
+ swagDialogue.completeCallback = function() {
trace('dialogue finish');
handSelect.visible = true;
dialogueEnded = true;
diff --git a/source/funkin/Discord.hx b/source/funkin/Discord.hx
index 26a96ab52..4fb6e9dcf 100644
--- a/source/funkin/Discord.hx
+++ b/source/funkin/Discord.hx
@@ -58,8 +58,7 @@ class DiscordClient
public static function initialize()
{
- var DiscordDaemon = sys.thread.Thread.create(() ->
- {
+ var DiscordDaemon = sys.thread.Thread.create(() -> {
new DiscordClient();
});
trace("Discord Client initialized");
diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx
index fb2119c55..322e79e31 100644
--- a/source/funkin/FreeplayState.hx
+++ b/source/funkin/FreeplayState.hx
@@ -34,12 +34,14 @@ import funkin.play.song.SongData.SongDataParser;
import funkin.shaderslmfao.AngleMask;
import funkin.shaderslmfao.PureColor;
import funkin.shaderslmfao.StrokeShader;
+import funkin.play.PlayStatePlaylist;
+import funkin.play.song.Song;
import lime.app.Future;
import lime.utils.Assets;
-class FreeplayState extends MusicBeatSubstate
+class FreeplayState extends MusicBeatSubState
{
- var songs:Array = [];
+ var songs:Array = [];
// var selector:FlxText;
var curSelected:Int = 0;
@@ -112,15 +114,15 @@ class FreeplayState extends MusicBeatSubstate
#if debug
isDebug = true;
- addSong('Test', 1, 'bf-pixel');
- addSong('Pyro', 8, 'darnell');
+ addSong('Test', 'tutorial', 'bf-pixel');
+ addSong('Pyro', 'weekend1', 'darnell');
#end
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
for (i in 0...initSonglist.length)
{
- songs.push(new SongMetadata(initSonglist[i], 1, 'gf'));
+ songs.push(new FreeplaySongData(initSonglist[i], 'tutorial', 'gf'));
}
if (FlxG.sound.music != null)
@@ -128,22 +130,28 @@ class FreeplayState extends MusicBeatSubstate
if (!FlxG.sound.music.playing) FlxG.sound.playMusic(Paths.music('freakyMenu'));
}
- if (StoryMenuState.weekUnlocked[2] || isDebug) addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
+ // if (StoryMenuState.weekUnlocked[2] || isDebug)
+ addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 'week1', ['dad']);
- if (StoryMenuState.weekUnlocked[2] || isDebug) addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky', 'spooky', 'monster']);
+ // if (StoryMenuState.weekUnlocked[2] || isDebug)
+ addWeek(['Spookeez', 'South', 'Monster'], 'week2', ['spooky', 'spooky', 'monster']);
- if (StoryMenuState.weekUnlocked[3] || isDebug) addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);
+ // if (StoryMenuState.weekUnlocked[3] || isDebug)
+ addWeek(['Pico', 'Philly-Nice', 'Blammed'], 'week3', ['pico']);
- if (StoryMenuState.weekUnlocked[4] || isDebug) addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);
+ // if (StoryMenuState.weekUnlocked[4] || isDebug)
+ addWeek(['Satin-Panties', 'High', 'MILF'], 'week4', ['mom']);
- if (StoryMenuState.weekUnlocked[5] || isDebug) addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5,
- ['parents-christmas', 'parents-christmas', 'monster-christmas']);
+ // if (StoryMenuState.weekUnlocked[5] || isDebug)
+ addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 'week5', ['parents-christmas', 'parents-christmas', 'monster-christmas']);
- if (StoryMenuState.weekUnlocked[6] || isDebug) addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);
+ // if (StoryMenuState.weekUnlocked[6] || isDebug)
+ addWeek(['Senpai', 'Roses', 'Thorns'], 'week6', ['senpai', 'senpai', 'spirit']);
- if (StoryMenuState.weekUnlocked[7] || isDebug) addWeek(['Ugh', 'Guns', 'Stress'], 7, ['tankman']);
+ // if (StoryMenuState.weekUnlocked[7] || isDebug)
+ addWeek(['Ugh', 'Guns', 'Stress'], 'week7', ['tankman']);
- addWeek(["Darnell", "lit-up", "2hot", "blazin"], 8, ['darnell']);
+ addWeek(["Darnell", "lit-up", "2hot", "blazin"], 'weekend1', ['darnell']);
// LOAD MUSIC
@@ -426,7 +434,7 @@ class FreeplayState extends MusicBeatSubstate
var swag:Alphabet = new Alphabet(1, 0, "swag");
// JUST DOIN THIS SHIT FOR TESTING!!!
- /*
+ /*
var md:String = Markdown.markdownToHtml(Assets.getText('CHANGELOG.md'));
var texFel:TextField = new TextField();
@@ -464,7 +472,7 @@ class FreeplayState extends MusicBeatSubstate
grpCapsules.clear();
// var regexp:EReg = regexp;
- var tempSongs:Array = songs;
+ var tempSongs:Array = songs;
if (filterStuff != null)
{
@@ -553,19 +561,19 @@ class FreeplayState extends MusicBeatSubstate
changeDiff();
}
- public function addSong(songName:String, weekNum:Int, songCharacter:String)
+ public function addSong(songName:String, levelId:String, songCharacter:String)
{
- songs.push(new SongMetadata(songName, weekNum, songCharacter));
+ songs.push(new FreeplaySongData(songName, levelId, songCharacter));
}
- public function addWeek(songs:Array, weekNum:Int, ?songCharacters:Array)
+ public function addWeek(songs:Array, levelId:String, ?songCharacters:Array)
{
if (songCharacters == null) songCharacters = ['bf'];
var num:Int = 0;
for (song in songs)
{
- addSong(song, weekNum, songCharacters[num]);
+ addSong(song, levelId, songCharacters[num]);
if (songCharacters.length != 1) num++;
}
@@ -851,11 +859,9 @@ class FreeplayState extends MusicBeatSubstate
curDifficulty = 1;
}*/
- PlayState.currentSong = SongLoad.loadFromJson(poop, songs[curSelected].songName.toLowerCase());
- PlayState.currentSong_NEW = SongDataParser.fetchSong(songs[curSelected].songName.toLowerCase());
- PlayState.isStoryMode = false;
- PlayState.storyDifficulty = curDifficulty;
- PlayState.storyDifficulty_NEW = switch (curDifficulty)
+ PlayStatePlaylist.isStoryMode = false;
+ var targetSong:Song = SongDataParser.fetchSong(songs[curSelected].songName.toLowerCase());
+ var targetDifficulty:String = switch (curDifficulty)
{
case 0:
'easy';
@@ -865,27 +871,41 @@ class FreeplayState extends MusicBeatSubstate
'hard';
default: 'normal';
};
- // SongLoad.curDiff = Highscore.formatSong()
- SongLoad.curDiff = PlayState.storyDifficulty_NEW;
+ // TODO: Implement additional difficulties into the interface properly.
+ if (FlxG.keys.pressed.E)
+ {
+ targetDifficulty = 'erect';
+ }
- PlayState.storyWeek = songs[curSelected].week;
- // trace(' CUR WEEK ' + PlayState.storyWeek);
+ // TODO: Implement Pico into the interface properly.
+ var targetCharacter:String = 'bf';
+ if (FlxG.keys.pressed.P)
+ {
+ targetCharacter = 'pico';
+ }
+
+ PlayStatePlaylist.campaignId = songs[curSelected].levelId;
// Visual and audio effects.
FlxG.sound.play(Paths.sound('confirmMenu'));
dj.confirm();
new FlxTimer().start(1, function(tmr:FlxTimer) {
- LoadingState.loadAndSwitchState(new PlayState(), true);
+ LoadingState.loadAndSwitchState(new PlayState(
+ {
+ targetSong: targetSong,
+ targetDifficulty: targetDifficulty,
+ targetCharacter: targetCharacter,
+ }), true);
});
}
}
- override function startOutro(onComplete:() -> Void):Void
+ override function switchTo(nextState:FlxState):Bool
{
clearDaCache(songs[curSelected].songName);
- super.startOutro(onComplete);
+ return super.switchTo(nextState);
}
function changeDiff(change:Int = 0)
@@ -901,19 +921,6 @@ class FreeplayState extends MusicBeatSubstate
intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
intendedCompletion = Highscore.getCompletion(songs[curSelected].songName, curDifficulty);
- PlayState.storyDifficulty = curDifficulty;
- PlayState.storyDifficulty_NEW = switch (curDifficulty)
- {
- case 0:
- 'easy';
- case 1:
- 'normal';
- case 2:
- 'hard';
- default:
- 'normal';
- };
-
grpDifficulties.group.forEach(function(spr) {
spr.visible = false;
});
@@ -1040,17 +1047,17 @@ enum abstract FilterType(String)
var ALL;
}
-class SongMetadata
+class FreeplaySongData
{
public var songName:String = "";
- public var week:Int = 0;
+ public var levelId:String = "";
public var songCharacter:String = "";
public var isFav:Bool = false;
- public function new(song:String, week:Int, songCharacter:String, ?isFav:Bool = false)
+ public function new(song:String, levelId:String, songCharacter:String, ?isFav:Bool = false)
{
this.songName = song;
- this.week = week;
+ this.levelId = levelId;
this.songCharacter = songCharacter;
this.isFav = isFav;
}
diff --git a/source/funkin/GitarooPause.hx b/source/funkin/GitarooPause.hx
index fda809548..5747de5e5 100644
--- a/source/funkin/GitarooPause.hx
+++ b/source/funkin/GitarooPause.hx
@@ -11,12 +11,16 @@ class GitarooPause extends MusicBeatState
var replaySelect:Bool = false;
- public function new():Void
+ var previousParams:PlayStateParams;
+
+ public function new(previousParams:PlayStateParams):Void
{
super();
+
+ this.previousParams = previousParams;
}
- override function create()
+ override function create():Void
{
if (FlxG.sound.music != null) FlxG.sound.music.stop();
@@ -49,7 +53,7 @@ class GitarooPause extends MusicBeatState
super.create();
}
- override function update(elapsed:Float)
+ override function update(elapsed:Float):Void
{
if (controls.UI_LEFT_P || controls.UI_RIGHT_P) changeThing();
@@ -57,7 +61,7 @@ class GitarooPause extends MusicBeatState
{
if (replaySelect)
{
- FlxG.switchState(new PlayState());
+ FlxG.switchState(new PlayState(previousParams));
}
else
{
diff --git a/source/funkin/Highscore.hx b/source/funkin/Highscore.hx
index 08ad7dcba..904d2cb45 100644
--- a/source/funkin/Highscore.hx
+++ b/source/funkin/Highscore.hx
@@ -39,7 +39,17 @@ class Highscore
return false;
}
- public static function saveCompletion(song:String, completion:Float, ?diff:Int = 0):Bool
+ public static function saveScoreForDifficulty(song:String, score:Int = 0, diff:String = 'normal'):Bool
+ {
+ var diffInt:Int = 1;
+
+ if (diff == 'easy') diffInt = 0;
+ else if (diff == 'hard') diffInt = 2;
+
+ return saveScore(song, score, diffInt);
+ }
+
+ public static function saveCompletion(song:String, completion:Float, diff:Int = 0):Bool
{
var formattedSong:String = formatSong(song, diff);
@@ -57,20 +67,42 @@ class Highscore
return false;
}
- public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void
+ public static function saveCompletionForDifficulty(song:String, completion:Float, diff:String = 'normal'):Bool
+ {
+ var diffInt:Int = 1;
+
+ if (diff == 'easy') diffInt = 0;
+ else if (diff == 'hard') diffInt = 2;
+
+ return saveCompletion(song, completion, diffInt);
+ }
+
+ public static function saveWeekScore(week:String, score:Int = 0, diff:Int = 0):Void
{
#if newgrounds
- NGio.postScore(score, "Week " + week);
+ NGio.postScore(score, 'Campaign ID $week');
#end
- var formattedSong:String = formatSong('week' + week, diff);
+ var formattedSong:String = formatSong(week, diff);
if (songScores.exists(formattedSong))
{
if (songScores.get(formattedSong) < score) setScore(formattedSong, score);
}
else
+ {
setScore(formattedSong, score);
+ }
+ }
+
+ public static function saveWeekScoreForDifficulty(week:String, score:Int = 0, diff:String = 'normal'):Void
+ {
+ var diffInt:Int = 1;
+
+ if (diff == 'easy') diffInt = 0;
+ else if (diff == 'hard') diffInt = 2;
+
+ saveWeekScore(week, score, diffInt);
}
static function setCompletion(formattedSong:String, completion:Float):Void
@@ -122,7 +154,7 @@ class Highscore
return songCompletion.get(formatSong(song, diff));
}
- public static function getAllScores()
+ public static function getAllScores():Void
{
trace(songScores.toString());
}
diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx
index 45c2645df..8d7d2d550 100644
--- a/source/funkin/InitState.hx
+++ b/source/funkin/InitState.hx
@@ -12,7 +12,7 @@ import flixel.util.FlxColor;
import funkin.modding.module.ModuleHandler;
import funkin.play.PlayState;
import funkin.play.character.CharacterData.CharacterDataParser;
-import funkin.play.event.SongEvent.SongEventParser;
+import funkin.play.event.SongEventData.SongEventParser;
import funkin.play.song.SongData.SongDataParser;
import funkin.ui.PreferencesMenu;
import funkin.util.WindowUtil;
@@ -140,10 +140,10 @@ class InitState extends FlxTransitionableState
// WEEK UNLOCK PROGRESSION!!
// StoryMenuState.weekUnlocked = FlxG.save.data.weekUnlocked;
- if (StoryMenuState.weekUnlocked.length < 4) StoryMenuState.weekUnlocked.insert(0, true);
+ // if (StoryMenuState.weekUnlocked.length < 4) StoryMenuState.weekUnlocked.insert(0, true);
// QUICK PATCH OOPS!
- if (!StoryMenuState.weekUnlocked[0]) StoryMenuState.weekUnlocked[0] = true;
+ // if (!StoryMenuState.weekUnlocked[0]) StoryMenuState.weekUnlocked[0] = true;
}
if (FlxG.save.data.seenVideo != null) VideoState.seenVideo = FlxG.save.data.seenVideo;
@@ -237,20 +237,18 @@ class InitState extends FlxTransitionableState
{
var dif:Int = getDif();
- PlayState.currentSong = SongLoad.loadFromJson(song, song);
- PlayState.currentSong_NEW = SongDataParser.fetchSong(song);
- PlayState.isStoryMode = isStoryMode;
- PlayState.storyDifficulty = dif;
- PlayState.storyDifficulty_NEW = switch (dif)
+ var targetDifficulty = switch (dif)
{
case 0: 'easy';
case 1: 'normal';
case 2: 'hard';
default: 'normal';
};
- SongLoad.curDiff = PlayState.storyDifficulty_NEW;
- PlayState.storyWeek = week;
- LoadingState.loadAndSwitchState(new PlayState());
+ LoadingState.loadAndSwitchState(new PlayState(
+ {
+ targetSong: SongDataParser.fetchSong(song),
+ targetDifficulty: targetDifficulty,
+ }));
}
}
diff --git a/source/funkin/LatencyState.hx b/source/funkin/LatencyState.hx
index ad803b963..694e9c3e5 100644
--- a/source/funkin/LatencyState.hx
+++ b/source/funkin/LatencyState.hx
@@ -14,7 +14,7 @@ import funkin.ui.CoolStatsGraph;
import haxe.Timer;
import openfl.events.KeyboardEvent;
-class LatencyState extends MusicBeatSubstate
+class LatencyState extends MusicBeatSubState
{
var offsetText:FlxText;
var noteGrp:FlxTypedGroup;
diff --git a/source/funkin/LoadingState.hx b/source/funkin/LoadingState.hx
index 316041fd4..604e78f79 100644
--- a/source/funkin/LoadingState.hx
+++ b/source/funkin/LoadingState.hx
@@ -1,5 +1,6 @@
package funkin;
+import funkin.play.PlayStatePlaylist;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.math.FlxMath;
@@ -32,7 +33,7 @@ class LoadingState extends MusicBeatState
this.stopMusic = stopMusic;
}
- override function create()
+ override function create():Void
{
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, 0xFFcaff4d);
add(bg);
@@ -50,63 +51,59 @@ class LoadingState extends MusicBeatState
loadBar.screenCenter(X);
add(loadBar);
- initSongsManifest().onComplete(function(lib)
- {
+ initSongsManifest().onComplete(function(lib) {
callbacks = new MultiCallback(onLoad);
- var introComplete = callbacks.add("introComplete");
- checkLoadSong(getSongPath());
- if (PlayState.currentSong.needsVoices)
- {
- var files = PlayState.currentSong.voiceList;
+ var introComplete = callbacks.add('introComplete');
+ // checkLoadSong(getSongPath());
+ // if (PlayState.currentSong.needsVoices)
+ // {
+ // var files = PlayState.currentSong.voiceList;
+ //
+ // if (files == null) files = ['']; // loads with no file name assumption, to load 'Voices.ogg' or whatev normally
+ //
+ // for (sndFile in files)
+ // {
+ // checkLoadSong(getVocalPath(sndFile));
+ // }
+ // }
- if (files == null) files = [""]; // loads with no file name assumption, to load "Voices.ogg" or whatev normally
+ checkLibrary('shared');
+ checkLibrary(PlayStatePlaylist.campaignId);
+ checkLibrary('tutorial');
- for (sndFile in files)
- {
- checkLoadSong(getVocalPath(sndFile));
- }
- }
-
- checkLibrary("shared");
- if (PlayState.storyWeek > 0) checkLibrary("week" + PlayState.storyWeek);
- else
- checkLibrary("tutorial");
-
- var fadeTime = 0.5;
+ var fadeTime:Float = 0.5;
FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true);
new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete());
});
}
- function checkLoadSong(path:String)
+ function checkLoadSong(path:String):Void
{
if (!Assets.cache.hasSound(path))
{
- var library = Assets.getLibrary("songs");
- var symbolPath = path.split(":").pop();
+ var library = Assets.getLibrary('songs');
+ var symbolPath = path.split(':').pop();
// @:privateAccess
// library.types.set(symbolPath, SOUND);
// @:privateAccess
// library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]);
- var callback = callbacks.add("song:" + path);
- Assets.loadSound(path).onComplete(function(_)
- {
+ var callback = callbacks.add('song:' + path);
+ Assets.loadSound(path).onComplete(function(_) {
callback();
});
}
}
- function checkLibrary(library:String)
+ function checkLibrary(library:String):Void
{
trace(Assets.hasLibrary(library));
if (Assets.getLibrary(library) == null)
{
@:privateAccess
- if (!LimeAssets.libraryPaths.exists(library)) throw "Missing library: " + library;
+ if (!LimeAssets.libraryPaths.exists(library)) throw 'Missing library: ' + library;
- var callback = callbacks.add("library:" + library);
- Assets.loadLibrary(library).onComplete(function(_)
- {
+ var callback = callbacks.add('library:' + library);
+ Assets.loadLibrary(library).onComplete(function(_) {
callback();
});
}
@@ -124,7 +121,7 @@ class LoadingState extends MusicBeatState
var targetShit:Float = 0;
- override function update(elapsed:Float)
+ override function update(elapsed:Float):Void
{
super.update(elapsed);
@@ -150,57 +147,41 @@ class LoadingState extends MusicBeatState
}
#if debug
- if (FlxG.keys.justPressed.SPACE) trace('fired: ' + callbacks.getFired() + " unfired:" + callbacks.getUnfired());
+ if (FlxG.keys.justPressed.SPACE) trace('fired: ' + callbacks.getFired() + ' unfired:' + callbacks.getUnfired());
#end
}
- function onLoad()
+ function onLoad():Void
{
if (stopMusic && FlxG.sound.music != null) FlxG.sound.music.stop();
FlxG.switchState(target);
}
- static function getSongPath()
+ static function getSongPath():String
{
- return Paths.inst(PlayState.currentSong.song);
+ return Paths.inst(PlayState.instance.currentSong.songId);
}
- static function getVocalPath(?suffix:String)
+ inline static public function loadAndSwitchState(nextState:FlxState, shouldStopMusic = false):Void
{
- return Paths.voices(PlayState.currentSong.song, suffix);
+ FlxG.switchState(getNextState(nextState, shouldStopMusic));
}
- inline static public function loadAndSwitchState(target:FlxState, stopMusic = false)
+ static function getNextState(nextState:FlxState, shouldStopMusic = false):FlxState
{
- FlxG.switchState(getNextState(target, stopMusic));
- }
+ Paths.setCurrentLevel(PlayStatePlaylist.campaignId);
- static function getNextState(target:FlxState, stopMusic = false):FlxState
- {
- if (PlayState.storyWeek == 0)
- {
- Paths.setCurrentLevel('tutorial');
- }
- else if (PlayState.storyWeek == 8)
- {
- // TODO: Refactor this code.
- Paths.setCurrentLevel("weekend1");
- }
- else
- {
- Paths.setCurrentLevel("week" + PlayState.storyWeek);
- }
#if NO_PRELOAD_ALL
- var loaded = isSoundLoaded(getSongPath())
- && (!PlayState.currentSong.needsVoices || isSoundLoaded(getVocalPath()))
- && isLibraryLoaded("shared");
-
- if (!loaded) return new LoadingState(target, stopMusic);
+ // var loaded = isSoundLoaded(getSongPath())
+ // && (!PlayState.currentSong.needsVoices || isSoundLoaded(getVocalPath()))
+ // && isLibraryLoaded('shared');
+ //
+ if (true) return new LoadingState(nextState, shouldStopMusic);
#end
- if (stopMusic && FlxG.sound.music != null) FlxG.sound.music.stop();
+ if (shouldStopMusic && FlxG.sound.music != null) FlxG.sound.music.stop();
- return target;
+ return nextState;
}
#if NO_PRELOAD_ALL
@@ -215,16 +196,16 @@ class LoadingState extends MusicBeatState
}
#end
- override function destroy()
+ override function destroy():Void
{
super.destroy();
callbacks = null;
}
- static function initSongsManifest()
+ static function initSongsManifest():Future
{
- var id = "songs";
+ var id = 'songs';
var promise = new Promise();
var library = LimeAssets.getLibrary(id);
@@ -246,10 +227,10 @@ class LoadingState extends MusicBeatState
}
else
{
- if (path.endsWith(".bundle"))
+ if (path.endsWith('.bundle'))
{
rootPath = path;
- path += "/library.json";
+ path += '/library.json';
}
else
{
@@ -259,11 +240,10 @@ class LoadingState extends MusicBeatState
path = LimeAssets.__cacheBreak(path);
}
- AssetManifest.loadFromFile(path, rootPath).onComplete(function(manifest)
- {
+ AssetManifest.loadFromFile(path, rootPath).onComplete(function(manifest) {
if (manifest == null)
{
- promise.error("Cannot parse asset manifest for library \"" + id + "\"");
+ promise.error('Cannot parse asset manifest for library \'' + id + '\'');
return;
}
@@ -271,7 +251,7 @@ class LoadingState extends MusicBeatState
if (library == null)
{
- promise.error("Cannot open library \"" + id + "\"");
+ promise.error('Cannot open library \'' + id + '\'');
}
else
{
@@ -280,9 +260,8 @@ class LoadingState extends MusicBeatState
library.onChange.add(LimeAssets.onChange.dispatch);
promise.completeWith(Future.withValue(library));
}
- }).onError(function(_)
- {
- promise.error("There is no asset library with an ID of \"" + id + "\"");
+ }).onError(function(_) {
+ promise.error('There is no asset library with an ID of \'' + id + '\'');
});
return promise.future;
@@ -305,14 +284,13 @@ class MultiCallback
this.logId = logId;
}
- public function add(id = "untitled")
+ public function add(id = 'untitled'):Void->Void
{
id = '$length:$id';
length++;
numRemaining++;
var func:Void->Void = null;
- func = function()
- {
+ func = function() {
if (unfired.exists(id))
{
unfired.remove(id);
@@ -339,9 +317,9 @@ class MultiCallback
if (logId != null) trace('$logId: $msg');
}
- public function getFired()
+ public function getFired():Array
return fired.copy();
- public function getUnfired()
+ public function getUnfired():ArrayVoid>
return unfired.array();
}
diff --git a/source/funkin/MainMenuState.hx b/source/funkin/MainMenuState.hx
index e4bdfbe35..57640bffa 100644
--- a/source/funkin/MainMenuState.hx
+++ b/source/funkin/MainMenuState.hx
@@ -223,8 +223,8 @@ class MainMenuState extends MusicBeatState
/**
* Calls openPrompt and redraws the login/logout button
- * @param prompt
- * @param onClose
+ * @param prompt
+ * @param onClose
*/
public function openNgPrompt(prompt:Prompt, ?onClose:Void->Void)
{
diff --git a/source/funkin/MemoryCounter.hx b/source/funkin/MemoryCounter.hx
index 5ef09b332..658febe59 100644
--- a/source/funkin/MemoryCounter.hx
+++ b/source/funkin/MemoryCounter.hx
@@ -24,8 +24,7 @@ class MemoryCounter extends TextField
text = "RAM: ";
#if flash
- addEventListener(Event.ENTER_FRAME, function(e)
- {
+ addEventListener(Event.ENTER_FRAME, function(e) {
var time = Lib.getTimer();
__enterFrame(time - currentTime);
});
diff --git a/source/funkin/MusicBeatState.hx b/source/funkin/MusicBeatState.hx
index 3614695c0..6c6591c62 100644
--- a/source/funkin/MusicBeatState.hx
+++ b/source/funkin/MusicBeatState.hx
@@ -35,8 +35,8 @@ class MusicBeatState extends FlxUIState
function initCallbacks()
{
- subStateOpened.add(onOpenSubstateComplete);
- subStateClosed.add(onCloseSubstateComplete);
+ subStateOpened.add(onOpenSubStateComplete);
+ subStateClosed.add(onCloseSubStateComplete);
}
override function create()
@@ -162,18 +162,18 @@ class MusicBeatState extends FlxUIState
}
}
- public override function openSubState(targetSubstate:FlxSubState):Void
+ public override function openSubState(targetSubState:FlxSubState):Void
{
- var event = new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_BEGIN, targetSubstate, true);
+ var event = new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_BEGIN, targetSubState, true);
dispatchEvent(event);
if (event.eventCanceled) return;
- super.openSubState(targetSubstate);
+ super.openSubState(targetSubState);
}
- function onOpenSubstateComplete(targetState:FlxSubState):Void
+ function onOpenSubStateComplete(targetState:FlxSubState):Void
{
dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_END, targetState, true));
}
@@ -189,7 +189,7 @@ class MusicBeatState extends FlxUIState
super.closeSubState();
}
- function onCloseSubstateComplete(targetState:FlxSubState):Void
+ function onCloseSubStateComplete(targetState:FlxSubState):Void
{
dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_CLOSE_END, targetState, true));
}
diff --git a/source/funkin/MusicBeatSubstate.hx b/source/funkin/MusicBeatSubState.hx
similarity index 94%
rename from source/funkin/MusicBeatSubstate.hx
rename to source/funkin/MusicBeatSubState.hx
index 802022a67..440e25c96 100644
--- a/source/funkin/MusicBeatSubstate.hx
+++ b/source/funkin/MusicBeatSubState.hx
@@ -7,9 +7,9 @@ import funkin.modding.events.ScriptEvent;
import funkin.modding.module.ModuleHandler;
/**
- * MusicBeatSubstate reincorporates the functionality of MusicBeatState into an FlxSubState.
+ * MusicBeatSubState reincorporates the functionality of MusicBeatState into an FlxSubState.
*/
-class MusicBeatSubstate extends FlxSubState
+class MusicBeatSubState extends FlxSubState
{
public function new(bgColor:FlxColor = FlxColor.TRANSPARENT)
{
diff --git a/source/funkin/NGio.hx b/source/funkin/NGio.hx
index f538c9656..f2afe84db 100644
--- a/source/funkin/NGio.hx
+++ b/source/funkin/NGio.hx
@@ -49,8 +49,7 @@ class NGio
trace('checking NG.io version');
GAME_VER = "v" + Application.current.meta.get('version');
- NG.core.calls.app.getCurrentVersion(GAME_VER).addDataHandler(function(response)
- {
+ NG.core.calls.app.getCurrentVersion(GAME_VER).addDataHandler(function(response) {
GAME_VER = response.result.data.currentVersion;
trace('CURRENT NG VERSION: ' + GAME_VER);
callback(GAME_VER);
@@ -141,8 +140,7 @@ class NGio
var onCancel:Void->Void = null;
if (onComplete != null)
{
- onSuccess = function()
- {
+ onSuccess = function() {
onNGLogin();
onComplete(Success);
}
@@ -228,7 +226,7 @@ class NGio
scoreboardsLoaded = true;
ngScoresLoaded.dispatch();
- /*
+ /*
for (score in NG.core.scoreBoards.get(8737).scores)
{
trace('score loaded user:${score.user.name}, score:${score.formatted_value}');
diff --git a/source/funkin/Note.hx b/source/funkin/Note.hx
index 7fc49717e..71c63a94e 100644
--- a/source/funkin/Note.hx
+++ b/source/funkin/Note.hx
@@ -1,5 +1,6 @@
package funkin;
+import funkin.play.Strumline.StrumlineArrow;
import flixel.FlxSprite;
import flixel.math.FlxMath;
import funkin.noteStuff.NoteBasic.NoteData;
@@ -15,9 +16,9 @@ class Note extends FlxSprite
public var data = new NoteData();
/**
- * code colors for.... code....
+ * code colors for.... code....
* i think goes in order of left to right
- *
+ *
* left 0
* down 1
* up 2
@@ -215,6 +216,24 @@ class Note extends FlxSprite
}
}
+ public function alignToSturmlineArrow(arrow:StrumlineArrow):Void
+ {
+ x = arrow.x;
+
+ if (isSustainNote && prevNote != null)
+ {
+ if (prevNote.isSustainNote)
+ {
+ x = prevNote.x;
+ }
+ else
+ {
+ x += prevNote.width / 2;
+ x -= width / 2;
+ }
+ }
+ }
+
override function destroy()
{
prevNote = null;
diff --git a/source/funkin/NoteSplash.hx b/source/funkin/NoteSplash.hx
index ea4242679..7f3a8c5e4 100644
--- a/source/funkin/NoteSplash.hx
+++ b/source/funkin/NoteSplash.hx
@@ -34,8 +34,7 @@ class NoteSplash extends FlxSprite
animation.play('note' + noteData + '-' + FlxG.random.int(0, 1), true);
animation.curAnim.frameRate = 24 + FlxG.random.int(-2, 2);
- animation.finishCallback = function(name)
- {
+ animation.finishCallback = function(name) {
kill();
};
updateHitbox();
diff --git a/source/funkin/PauseSubState.hx b/source/funkin/PauseSubState.hx
index 67b58f41d..77fdfabf1 100644
--- a/source/funkin/PauseSubState.hx
+++ b/source/funkin/PauseSubState.hx
@@ -1,9 +1,10 @@
package funkin;
+import funkin.play.PlayStatePlaylist;
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState;
import flixel.group.FlxGroup.FlxTypedGroup;
-import flixel.sound.FlxSound;
+import flixel.system.FlxSound;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
@@ -11,7 +12,7 @@ import flixel.util.FlxColor;
import funkin.play.PlayState;
import funkin.play.song.SongData.SongDataParser;
-class PauseSubState extends MusicBeatSubstate
+class PauseSubState extends MusicBeatSubState
{
var grpMenuShit:FlxTypedGroup;
@@ -20,9 +21,9 @@ class PauseSubState extends MusicBeatSubstate
'Restart Song',
'Change Difficulty',
'Toggle Practice Mode',
- 'Exit to menu'
+ 'Exit to Menu'
];
- var difficultyChoices:Array = ['EASY', 'NORMAL', 'HARD', 'BACK'];
+ var difficultyChoices:Array = ['EASY', 'NORMAL', 'HARD', 'ERECT', 'BACK'];
var menuItems:Array = [];
var curSelected:Int = 0;
@@ -41,10 +42,14 @@ class PauseSubState extends MusicBeatSubstate
menuItems = pauseOG;
- if (PlayState.storyWeek == 6) // consistent with logic that decides asset lib!!
+ if (PlayStatePlaylist.campaignId == 'week6')
+ {
pauseMusic = new FlxSound().loadEmbedded(Paths.music('breakfast-pixel'), true, true);
+ }
else
+ {
pauseMusic = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true);
+ }
pauseMusic.volume = 0;
pauseMusic.play(false, FlxG.random.int(0, Std.int(pauseMusic.length / 2)));
@@ -58,43 +63,38 @@ class PauseSubState extends MusicBeatSubstate
metaDataGrp = new FlxTypedGroup();
add(metaDataGrp);
- var levelInfo:FlxText = new FlxText(20, 15, 0, "", 32);
+ var levelInfo:FlxText = new FlxText(20, 15, 0, '', 32);
if (PlayState.instance.currentChart != null)
{
levelInfo.text += '${PlayState.instance.currentChart.songName} - ${PlayState.instance.currentChart.songArtist}';
}
- else
- {
- levelInfo.text += PlayState.currentSong.song;
- }
levelInfo.scrollFactor.set();
- levelInfo.setFormat(Paths.font("vcr.ttf"), 32);
+ levelInfo.setFormat(Paths.font('vcr.ttf'), 32);
levelInfo.updateHitbox();
metaDataGrp.add(levelInfo);
- var levelDifficulty:FlxText = new FlxText(20, 15 + 32, 0, "", 32);
- levelDifficulty.text += CoolUtil.difficultyString();
+ var levelDifficulty:FlxText = new FlxText(20, 15 + 32, 0, '', 32);
+ levelDifficulty.text += PlayState.instance.currentDifficulty.toTitleCase();
levelDifficulty.scrollFactor.set();
levelDifficulty.setFormat(Paths.font('vcr.ttf'), 32);
levelDifficulty.updateHitbox();
metaDataGrp.add(levelDifficulty);
- var deathCounter:FlxText = new FlxText(20, 15 + 64, 0, "", 32);
- deathCounter.text = "Blue balled: " + PlayState.deathCounter;
- deathCounter.text += "\n" + Highscore.tallies.totalNotesHit;
- deathCounter.text += "\n" + Highscore.tallies.totalNotes;
- deathCounter.text += "\n" + Std.string(Highscore.tallies.totalNotesHit / Highscore.tallies.totalNotes);
+ var deathCounter:FlxText = new FlxText(20, 15 + 64, 0, '', 32);
+ deathCounter.text = 'Blue balled: ${PlayState.instance.deathCounter}';
+ FlxG.watch.addQuick('totalNotesHit', Highscore.tallies.totalNotesHit);
+ FlxG.watch.addQuick('totalNotes', Highscore.tallies.totalNotes);
deathCounter.scrollFactor.set();
deathCounter.setFormat(Paths.font('vcr.ttf'), 32);
deathCounter.updateHitbox();
metaDataGrp.add(deathCounter);
- practiceText = new FlxText(20, 15 + 64 + 32, 0, "PRACTICE MODE", 32);
+ practiceText = new FlxText(20, 15 + 64 + 32, 0, 'PRACTICE MODE', 32);
practiceText.scrollFactor.set();
practiceText.setFormat(Paths.font('vcr.ttf'), 32);
practiceText.updateHitbox();
practiceText.x = FlxG.width - (practiceText.width + 20);
- practiceText.visible = PlayState.isPracticeMode;
+ practiceText.visible = PlayState.instance.isPracticeMode;
metaDataGrp.add(practiceText);
levelDifficulty.alpha = 0;
@@ -137,7 +137,7 @@ class PauseSubState extends MusicBeatSubstate
changeSelection();
}
- override function update(elapsed:Float)
+ override function update(elapsed:Float):Void
{
if (pauseMusic.volume < 0.5) pauseMusic.volume += 0.01 * elapsed;
@@ -180,41 +180,39 @@ class PauseSubState extends MusicBeatSubstate
{
var daSelected:String = menuItems[curSelected];
+ // TODO: Why is this based on the menu item's name? Make this an enum or something.
switch (daSelected)
{
- case "Resume":
+ case 'Resume':
close();
- case "EASY" | 'NORMAL' | "HARD":
- PlayState.currentSong = SongLoad.loadFromJson(PlayState.currentSong.song.toLowerCase(), PlayState.currentSong.song.toLowerCase());
- PlayState.currentSong_NEW = SongDataParser.fetchSong(PlayState.currentSong.song.toLowerCase());
- SongLoad.curDiff = daSelected.toLowerCase();
-
- PlayState.storyDifficulty = curSelected;
- PlayState.storyDifficulty_NEW = daSelected.toLowerCase();
-
- PlayState.needsReset = true;
-
- close();
-
- case 'Toggle Practice Mode':
- PlayState.isPracticeMode = !PlayState.isPracticeMode;
- practiceText.visible = PlayState.isPracticeMode;
case 'Change Difficulty':
menuItems = difficultyChoices;
regenMenu();
+
+ case 'EASY' | 'NORMAL' | 'HARD' | 'ERECT':
+ PlayState.instance.currentSong = SongDataParser.fetchSong(PlayState.instance.currentSong.songId.toLowerCase());
+
+ PlayState.instance.currentDifficulty = daSelected.toLowerCase();
+
+ PlayState.instance.needsReset = true;
+
+ close();
case 'BACK':
menuItems = pauseOG;
regenMenu();
- case "Restart Song":
- PlayState.needsReset = true;
+ case 'Toggle Practice Mode':
+ PlayState.instance.isPracticeMode = true;
+ practiceText.visible = PlayState.instance.isPracticeMode;
+
+ case 'Restart Song':
+ PlayState.instance.needsReset = true;
close();
- // FlxG.resetState();
- case "Exit to menu":
+
+ case 'Exit to Menu':
exitingToMenu = true;
- PlayState.seenCutscene = false;
- PlayState.deathCounter = 0;
+ PlayState.instance.deathCounter = 0;
for (item in grpMenuShit.members)
{
@@ -225,9 +223,9 @@ class PauseSubState extends MusicBeatSubstate
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
- if (PlayState.isStoryMode) openSubState(new funkin.ui.StickerSubState(null, STORY));
+ if (PlayStatePlaylist.isStoryMode) openSubState(new funkin.ui.StickerSubState(null, STORY));
else
- openSubState(new funkin.ui.StickerSubState());
+ openSubState(new funkin.ui.StickerSubState(null, FREEPLAY));
}
}
@@ -239,7 +237,7 @@ class PauseSubState extends MusicBeatSubstate
}
}
- override function destroy()
+ override function destroy():Void
{
pauseMusic.destroy();
@@ -260,12 +258,10 @@ class PauseSubState extends MusicBeatSubstate
item.targetY = index - curSelected;
item.alpha = 0.6;
- // item.setGraphicSize(Std.int(item.width * 0.8));
if (item.targetY == 0)
{
item.alpha = 1;
- // item.setGraphicSize(Std.int(item.width));
}
}
}
diff --git a/source/funkin/SongLoad.hx b/source/funkin/SongLoad.hx
index d4ad0023e..ca3bc72d0 100644
--- a/source/funkin/SongLoad.hx
+++ b/source/funkin/SongLoad.hx
@@ -281,7 +281,7 @@ class SongLoad
// castNoteDataToNoteData(swagShit.noteMap[diff]);
- /*
+ /*
switch (diff)
{
case "easy":
diff --git a/source/funkin/StoryMenuState.hx b/source/funkin/StoryMenuState.hx
deleted file mode 100644
index 89d59de1f..000000000
--- a/source/funkin/StoryMenuState.hx
+++ /dev/null
@@ -1,497 +0,0 @@
-package funkin;
-
-import flixel.FlxSprite;
-import flixel.addons.transition.FlxTransitionableState;
-import flixel.graphics.frames.FlxAtlasFrames;
-import flixel.group.FlxGroup.FlxTypedGroup;
-import flixel.group.FlxGroup;
-import flixel.math.FlxMath;
-import flixel.text.FlxText;
-import flixel.tweens.FlxTween;
-import flixel.util.FlxColor;
-import flixel.util.FlxTimer;
-import funkin.MenuItem.WeekType;
-import funkin.play.PlayState;
-import funkin.play.song.SongData.SongDataParser;
-import lime.net.curl.CURLCode;
-import openfl.Assets;
-import funkin.ui.StickerSubState;
-#if discord_rpc
-import Discord.DiscordClient;
-#end
-
-class StoryMenuState extends MusicBeatState
-{
- var scoreText:FlxText;
-
- var weekData:Array> = [
- ['Tutorial'],
- ['Bopeebo', 'Fresh', 'Dadbattle'],
- ['Spookeez', 'South', "Monster"],
- ['Pico', 'Philly', "Blammed"],
- ['Satin-Panties', "High", "Milf"],
- ['Cocoa', 'Eggnog', 'Winter-Horrorland'],
- ['Senpai', 'Roses', 'Thorns'],
- ['Ugh', 'Guns', 'Stress'],
- ['Darnell', "lit-up", "2hot", "blazin"]
- ];
- var curDifficulty:Int = 1;
-
- // TODO: This info is just hardcoded right now.
- // We should probably make it so that weeks must be completed in order to unlock the next week.
- public static var weekUnlocked:Array = [true, true, true, true, true, true, true, true, true];
-
- var weekCharacters:Array = [
- ['dad', 'bf', 'gf'],
- ['dad', 'bf', 'gf'],
- ['spooky', 'bf', 'gf'],
- ['pico', 'bf', 'gf'],
- ['mom', 'bf', 'gf'],
- ['parents-christmas', 'bf', 'gf'],
- ['senpai', 'bf', 'gf'],
- ['tankman', 'bf', 'gf'],
- ['darnell', 'pico', 'nene']
- ];
-
- var weekNames:Array = [
- "",
- "Daddy Dearest",
- "Spooky Month",
- "PICO",
- "MOMMY MUST MURDER",
- "RED SNOW",
- "hating simulator ft. moawling",
- "TANKMAN",
- "Due Debts"
- ];
-
- var weekType:Array = [WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEKEND];
- var weekTypeInc:Map = new Map();
-
- var txtWeekTitle:FlxText;
-
- var curWeek:Int = 0;
-
- var txtTracklist:FlxText;
-
- var grpWeekText:FlxTypedGroup