diff --git a/Project.xml b/Project.xml
index f8495d3a..ebb1404e 100644
--- a/Project.xml
+++ b/Project.xml
@@ -164,4 +164,7 @@
+
+
+
diff --git a/buildnumber.txt b/buildnumber.txt
index 4db8f571..5e94329c 100644
--- a/buildnumber.txt
+++ b/buildnumber.txt
@@ -1 +1 @@
-1327
\ No newline at end of file
+1333
\ No newline at end of file
diff --git a/source/funkin/editors/CharacterEditor.hx b/source/funkin/editors/CharacterEditor.hx
new file mode 100644
index 00000000..faa5d8d2
--- /dev/null
+++ b/source/funkin/editors/CharacterEditor.hx
@@ -0,0 +1,37 @@
+package funkin.editors;
+
+import funkin.desktop.DesktopMain;
+import flixel.FlxG;
+import flixel.FlxState;
+import funkin.game.*;
+
+class CharacterEditor extends MusicBeatState {
+ public var character:Character;
+ public var characterName:String;
+
+ private var oldState:Class = null;
+ public function new(char:String) {
+ super();
+ this.characterName = char;
+ if (!(FlxG.state is DesktopMain))
+ oldState = Type.getClass(FlxG.state);
+ }
+
+ public override function create() {
+ super.create();
+
+ add(new Stage("default"));
+
+ character = new Character(770, 100, characterName, true);
+ characterName = character.curCharacter;
+ add(character);
+
+ trace(members);
+ }
+
+ public override function update(elapsed:Float) {
+ super.update(elapsed);
+ if (controls.BACK && oldState != null)
+ FlxG.switchState(Type.createInstance(oldState, []));
+ }
+}
\ No newline at end of file
diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx
index 273df4ac..8bef4b92 100644
--- a/source/funkin/game/PlayState.hx
+++ b/source/funkin/game/PlayState.hx
@@ -1,5 +1,6 @@
package funkin.game;
+import funkin.editors.CharacterEditor;
import funkin.scripting.DummyScript;
import funkin.menus.StoryMenuState.WeekData;
import funkin.ui.FunkinText;
@@ -128,7 +129,6 @@ class PlayState extends MusicBeatState
public var iconP2:HealthIcon;
public var camHUD:HudCamera;
public var camGame:FlxCamera;
-
public var songScore:Int = 0;
public var misses:Int = 0;
@@ -278,7 +278,7 @@ class PlayState extends MusicBeatState
if (SONG.stage == null || SONG.stage.trim() == "") SONG.stage = "stage";
- add(new Stage(SONG.stage));
+ add(stage = new Stage(SONG.stage));
switch(SONG.song) {
@@ -937,7 +937,9 @@ class PlayState extends MusicBeatState
FlxG.switchState(new Charting()); */
if (FlxG.keys.justPressed.EIGHT)
- FlxG.switchState(new AnimationDebug(SONG.player2));
+ FlxG.switchState(new CharacterEditor(SONG.player2));
+ if (FlxG.keys.justPressed.NINE)
+ FlxG.switchState(new CharacterEditor(SONG.player1));
if (startingSong)
{
diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx
index fd12faf7..0d883612 100644
--- a/source/funkin/game/Stage.hx
+++ b/source/funkin/game/Stage.hx
@@ -1,5 +1,7 @@
package funkin.game;
+import flixel.FlxG;
+import flixel.FlxState;
import funkin.system.XMLUtil;
import flixel.FlxSprite;
import openfl.utils.Assets;
@@ -22,9 +24,12 @@ class Stage extends FlxBasic implements IBeatReceiver {
return stageSprites[name];
}
- public function new(stage:String) {
+ public function new(stage:String, ?state:FlxState) {
super();
- if (PlayState.instance == null) return;
+
+ if (state == null) state = PlayState.instance;
+ if (state == null) state = FlxG.state;
+
stagePath = Paths.xml('stages/$stage');
try {
if (Assets.exists(stagePath)) stageXML = new Access(Xml.parse(Assets.getText(stagePath)).firstElement());
@@ -35,24 +40,26 @@ class Stage extends FlxBasic implements IBeatReceiver {
if (stageXML != null) {
var spritesParentFolder = "";
- if (stageXML.has.zoom) {
- var parsed:Null = Std.parseFloat(stageXML.att.zoom);
- if (parsed != null) PlayState.instance.defaultCamZoom = parsed;
+ if (PlayState.instance != null) {
+ if (stageXML.has.zoom) {
+ var parsed:Null = Std.parseFloat(stageXML.att.zoom);
+ if (parsed != null && PlayState.instance != null) PlayState.instance.defaultCamZoom = parsed;
+ }
+ PlayState.instance.curStage = stageXML.has.name ? stageXML.att.name : stage;
}
if (stageXML.has.folder) {
spritesParentFolder = stageXML.att.folder;
if (spritesParentFolder.charAt(spritesParentFolder.length-1) != "/") spritesParentFolder = spritesParentFolder + "/";
}
- if (stageXML.has.name) PlayState.instance.curStage = stageXML.att.name;
for(node in stageXML.elements) {
var sprite:Dynamic = switch(node.name) {
case "sprite" | "spr" | "sparrow":
- var spr = new StageSprite();
- spr.antialiasing = true;
-
if (!node.has.sprite || !node.has.name || !node.has.x || !node.has.y) continue;
+ var spr = new StageSprite(node.att.name);
+ spr.antialiasing = true;
+
spr.loadAnimatedGraphic(Paths.image('$spritesParentFolder${node.att.sprite}', null, true));
var x:Null = Std.parseFloat(node.att.x);
@@ -92,17 +99,20 @@ class Stage extends FlxBasic implements IBeatReceiver {
}
stageSprites.set(node.att.name, spr);
- PlayState.instance.add(spr);
+ state.add(spr);
spr;
case "boyfriend" | "bf":
+ if (PlayState.instance == null) continue;
doCharNodeShit(PlayState.instance.boyfriend, node);
PlayState.instance.add(PlayState.instance.boyfriend);
PlayState.instance.boyfriend;
case "girlfriend" | "gf":
+ if (PlayState.instance == null) continue;
doCharNodeShit(PlayState.instance.gf, node);
PlayState.instance.add(PlayState.instance.gf);
PlayState.instance.gf;
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)
@@ -110,19 +120,20 @@ class Stage extends FlxBasic implements IBeatReceiver {
PlayState.instance.add(PlayState.instance.comboGroup);
PlayState.instance.comboGroup;
case "dad" | "opponent":
- if (PlayState.instance.dad == null || PlayState.instance.dad.isGF) continue;
+ if (PlayState.instance == null || PlayState.instance.dad == null || PlayState.instance.dad.isGF) continue;
doCharNodeShit(PlayState.instance.dad, node);
PlayState.instance.add(PlayState.instance.dad);
PlayState.instance.dad;
default: null;
}
if (sprite != null) {
- for(e in node.nodes.property) {
+ for(e in node.nodes.property)
XMLUtil.applyXMLProperty(sprite, e);
- }
}
}
}
+
+ if (PlayState.instance == null) return;
stageScript = Script.create(Paths.script('data/stages/$stage'));
for(k=>e in stageSprites) {
stageScript.set(k, e);
@@ -157,7 +168,12 @@ class Stage extends FlxBasic implements IBeatReceiver {
class StageSprite extends FlxSprite implements IBeatReceiver {
public var beatAnims:Array = [];
+ public var name:String;
+ public function new(name:String) {
+ super();
+ this.name = name;
+ }
public override function update(elapsed:Float) {
super.update(elapsed);
}
diff --git a/source/funkin/scripting/ScriptedState.hx b/source/funkin/scripting/ScriptedState.hx
deleted file mode 100644
index a1ae6f42..00000000
--- a/source/funkin/scripting/ScriptedState.hx
+++ /dev/null
@@ -1,34 +0,0 @@
-package funkin.scripting;
-
-class ScriptedState extends MusicBeatState {
- var script:Script;
-
- public override function new(scriptName:String) {
- super();
-
- script = Script.create(Paths.script('data/states/${scriptName}'));
- script.setParent(this);
- script.load();
- }
-
- public override function create() {
- super.create();
- script.call("create");
- }
-
- public override function update(elapsed:Float) {
- script.call("preUpdate", [elapsed]);
- super.update(elapsed);
- script.call("update", [elapsed]);
- }
-
- public override function beatHit(curBeat:Int) {
- super.beatHit(curBeat);
- script.call("beatHit", [curBeat]);
- }
-
- public override function stepHit(curStep:Int) {
- super.stepHit(curStep);
- script.call("stepHit", [curStep]);
- }
-}
\ No newline at end of file
diff --git a/source/funkin/system/MusicBeatState.hx b/source/funkin/system/MusicBeatState.hx
index 83491fc3..59bb15e7 100644
--- a/source/funkin/system/MusicBeatState.hx
+++ b/source/funkin/system/MusicBeatState.hx
@@ -77,7 +77,7 @@ class MusicBeatState extends FlxUIState implements IBeatReceiver
public function new(scriptsAllowed:Bool = true, ?scriptName:String) {
super();
- this.scriptsAllowed = scriptsAllowed;
+ this.scriptsAllowed = #if SOFTCODED_STATES scriptsAllowed #else false #end;
this.scriptName = scriptName;
loadScript();
}