diff --git a/Project.xml b/Project.xml
index f729f5bf7..d7c38fa32 100644
--- a/Project.xml
+++ b/Project.xml
@@ -2,7 +2,7 @@
-
+
@@ -25,6 +25,9 @@
+
+
+
@@ -93,7 +96,10 @@
-
-
-
+
+
+
+
+
+
diff --git a/source/Alphabet.hx b/source/Alphabet.hx
index 9824e2f35..a5e1d9396 100644
--- a/source/Alphabet.hx
+++ b/source/Alphabet.hx
@@ -48,6 +48,7 @@ class Alphabet extends FlxSpriteGroup
this.text = text;
isBold = bold;
+
if (text != "")
{
if (typed)
@@ -77,7 +78,8 @@ class Alphabet extends FlxSpriteGroup
lastWasSpace = true;
}
- if (AlphaCharacter.alphabet.contains(character.toLowerCase()))
+ if (AlphaCharacter.alphabet.indexOf(character.toLowerCase()) != -1)
+ //if (AlphaCharacter.alphabet.contains(character.toLowerCase()))
{
if (lastSprite != null)
{
@@ -121,6 +123,7 @@ class Alphabet extends FlxSpriteGroup
_finalText = text;
doSplitWords();
+
// trace(arrayShit);
var loopNum:Int = 0;
@@ -137,6 +140,7 @@ class Alphabet extends FlxSpriteGroup
xPosResetted = true;
xPos = 0;
curRow += 1;
+
}
if (splitWords[loopNum] == " ")
@@ -144,9 +148,17 @@ class Alphabet extends FlxSpriteGroup
lastWasSpace = true;
}
+ #if (haxe >= "4.0.0")
var isNumber:Bool = AlphaCharacter.numbers.contains(splitWords[loopNum]);
var isSymbol:Bool = AlphaCharacter.symbols.contains(splitWords[loopNum]);
- if (AlphaCharacter.alphabet.contains(splitWords[loopNum].toLowerCase()) || isNumber || isSymbol)
+ #else
+ var isNumber:Bool = AlphaCharacter.numbers.indexOf(splitWords[loopNum]) != -1;
+ var isSymbol:Bool = AlphaCharacter.symbols.indexOf(splitWords[loopNum]) != -1;
+ #end
+
+ if (AlphaCharacter.alphabet.indexOf(splitWords[loopNum].toLowerCase()) != -1 || isNumber || isSymbol)
+ //if (AlphaCharacter.alphabet.contains(splitWords[loopNum].toLowerCase()) || isNumber || isSymbol)
+
{
if (lastSprite != null && !xPosResetted)
{
diff --git a/source/Controls.hx b/source/Controls.hx
index b5715a614..b251ac61d 100644
--- a/source/Controls.hx
+++ b/source/Controls.hx
@@ -108,7 +108,11 @@ class Controls extends FlxActionSet
var _pause = new FlxActionDigital(Action.PAUSE);
var _reset = new FlxActionDigital(Action.RESET);
+ #if (haxe >= "4.0.0")
var byName:Map = [];
+ #else
+ var byName:Map = new Map();
+ #end
public var gamepadsAdded:Array = [];
public var keyboardScheme = KeyboardScheme.None;
@@ -193,6 +197,7 @@ class Controls extends FlxActionSet
inline function get_RESET()
return _reset.check();
+ #if (haxe >= "4.0.0")
public function new(name, scheme = None)
{
super(name);
@@ -219,6 +224,36 @@ class Controls extends FlxActionSet
setKeyboardScheme(scheme, false);
}
+ #else
+ public function new(name, scheme:KeyboardScheme = null)
+ {
+ super(name);
+
+ add(_up);
+ add(_left);
+ add(_right);
+ add(_down);
+ add(_upP);
+ add(_leftP);
+ add(_rightP);
+ add(_downP);
+ add(_upR);
+ add(_leftR);
+ add(_rightR);
+ add(_downR);
+ add(_accept);
+ add(_back);
+ add(_pause);
+ add(_reset);
+
+ for (action in digitalActions)
+ byName[action.name] = action;
+
+ if (scheme == null)
+ scheme = None;
+ setKeyboardScheme(scheme, false);
+ }
+ #end
override function update()
{
@@ -278,7 +313,7 @@ class Controls extends FlxActionSet
* @param func
* @return ->Void)
*/
- function forEachBound(control:Control, func:(FlxActionDigital, FlxInputState) -> Void)
+ function forEachBound(control:Control, func:FlxActionDigital->FlxInputState->Void)
{
switch (control)
{
@@ -332,6 +367,7 @@ class Controls extends FlxActionSet
public function copyFrom(controls:Controls, ?device:Device)
{
+ #if (haxe >= "4.0.0")
for (name => action in controls.byName)
{
for (input in action.inputs)
@@ -340,14 +376,31 @@ class Controls extends FlxActionSet
byName[name].add(cast input);
}
}
+ #else
+ for (name in controls.byName.keys())
+ {
+ var action = controls.byName[name];
+ for (input in action.inputs)
+ {
+ if (device == null || isDevice(input, device))
+ byName[name].add(cast input);
+ }
+ }
+ #end
switch (device)
{
case null:
// add all
+ #if (haxe >= "4.0.0")
for (gamepad in controls.gamepadsAdded)
if (!gamepadsAdded.contains(gamepad))
gamepadsAdded.push(gamepad);
+ #else
+ for (gamepad in controls.gamepadsAdded)
+ if (gamepadsAdded.indexOf(gamepad) == -1)
+ gamepadsAdded.push(gamepad);
+ #end
mergeKeyboardScheme(controls.keyboardScheme);
@@ -383,7 +436,11 @@ class Controls extends FlxActionSet
*/
public function bindKeys(control:Control, keys:Array)
{
+ #if (haxe >= "4.0.0")
inline forEachBound(control, (action, state) -> addKeys(action, keys, state));
+ #else
+ forEachBound(control, function(action, state) addKeys(action, keys, state));
+ #end
}
/**
@@ -392,7 +449,11 @@ class Controls extends FlxActionSet
*/
public function unbindKeys(control:Control, keys:Array)
{
+ #if (haxe >= "4.0.0")
inline forEachBound(control, (action, _) -> removeKeys(action, keys));
+ #else
+ forEachBound(control, function(action, _) removeKeys(action, keys));
+ #end
}
inline static function addKeys(action:FlxActionDigital, keys:Array, state:FlxInputState)
@@ -418,6 +479,8 @@ class Controls extends FlxActionSet
removeKeyboard();
keyboardScheme = scheme;
+
+ #if (haxe >= "4.0.0")
switch (scheme)
{
case Solo:
@@ -450,6 +513,40 @@ class Controls extends FlxActionSet
case None: // nothing
case Custom: // nothing
}
+ #else
+ switch (scheme)
+ {
+ case Solo:
+ bindKeys(Control.UP, [W, FlxKey.UP]);
+ bindKeys(Control.DOWN, [S, FlxKey.DOWN]);
+ bindKeys(Control.LEFT, [A, FlxKey.LEFT]);
+ bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]);
+ bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]);
+ bindKeys(Control.BACK, [BACKSPACE, ESCAPE]);
+ bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]);
+ bindKeys(Control.RESET, [R]);
+ case Duo(true):
+ bindKeys(Control.UP, [W]);
+ bindKeys(Control.DOWN, [S]);
+ bindKeys(Control.LEFT, [A]);
+ bindKeys(Control.RIGHT, [D]);
+ bindKeys(Control.ACCEPT, [G, Z]);
+ bindKeys(Control.BACK, [H, X]);
+ bindKeys(Control.PAUSE, [ONE]);
+ bindKeys(Control.RESET, [R]);
+ case Duo(false):
+ bindKeys(Control.UP, [FlxKey.UP]);
+ bindKeys(Control.DOWN, [FlxKey.DOWN]);
+ bindKeys(Control.LEFT, [FlxKey.LEFT]);
+ bindKeys(Control.RIGHT, [FlxKey.RIGHT]);
+ bindKeys(Control.ACCEPT, [O]);
+ bindKeys(Control.BACK, [P]);
+ bindKeys(Control.PAUSE, [ENTER]);
+ bindKeys(Control.RESET, [BACKSPACE]);
+ case None: // nothing
+ case Custom: // nothing
+ }
+ #end
}
function removeKeyboard()
@@ -469,15 +566,27 @@ class Controls extends FlxActionSet
public function addGamepad(id:Int, ?buttonMap:Map>):Void
{
gamepadsAdded.push(id);
+
+ #if (haxe >= "4.0.0")
for (control => buttons in buttonMap)
- bindButtons(control, id, buttons);
+ inline bindButtons(control, id, buttons);
+ #else
+ for (control in buttonMap.keys())
+ bindButtons(control, id, buttonMap[control]);
+ #end
}
inline function addGamepadLiteral(id:Int, ?buttonMap:Map>):Void
{
gamepadsAdded.push(id);
+
+ #if (haxe >= "4.0.0")
for (control => buttons in buttonMap)
inline bindButtons(control, id, buttons);
+ #else
+ for (control in buttonMap.keys())
+ bindButtons(control, id, buttonMap[control]);
+ #end
}
public function removeGamepad(deviceID:Int = FlxInputDeviceID.ALL):Void
@@ -498,6 +607,7 @@ class Controls extends FlxActionSet
public function addDefaultGamepad(id):Void
{
+ #if !switch
addGamepadLiteral(id, [
Control.ACCEPT => [A],
Control.BACK => [B],
@@ -508,6 +618,19 @@ class Controls extends FlxActionSet
Control.PAUSE => [START],
Control.RESET => [Y]
]);
+ #else
+ addGamepadLiteral(id, [
+ //Swap A and B for switch
+ Control.ACCEPT => [B],
+ Control.BACK => [A],
+ Control.UP => [DPAD_UP, LEFT_STICK_DIGITAL_UP],
+ Control.DOWN => [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN],
+ Control.LEFT => [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT],
+ Control.RIGHT => [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT],
+ Control.PAUSE => [START],
+ Control.RESET => [Y]
+ ]);
+ #end
}
/**
@@ -516,7 +639,11 @@ class Controls extends FlxActionSet
*/
public function bindButtons(control:Control, id, buttons)
{
+ #if (haxe >= "4.0.0")
inline forEachBound(control, (action, state) -> addButtons(action, buttons, state, id));
+ #else
+ forEachBound(control, function(action, state) addButtons(action, buttons, state, id));
+ #end
}
/**
@@ -525,7 +652,11 @@ class Controls extends FlxActionSet
*/
public function unbindButtons(control:Control, gamepadID:Int, buttons)
{
+ #if (haxe >= "4.0.0")
inline forEachBound(control, (action, _) -> removeButtons(action, gamepadID, buttons));
+ #else
+ forEachBound(control, function(action, _) removeButtons(action, gamepadID, buttons));
+ #end
}
inline static function addButtons(action:FlxActionDigital, buttons:Array, state, id)
diff --git a/source/PlayState.hx b/source/PlayState.hx
index 9bc96a88d..0163efc84 100644
--- a/source/PlayState.hx
+++ b/source/PlayState.hx
@@ -820,7 +820,11 @@ class PlayState extends MusicBeatState
{
trace('SONG DONE' + isStoryMode);
+
+ #if !switch
NGio.postScore(songScore, SONG.song);
+ #end
+
if (isStoryMode)
{
@@ -834,7 +838,10 @@ class PlayState extends MusicBeatState
StoryMenuState.weekUnlocked[1] = true;
+ #if !switch
NGio.unlockMedal(60961);
+ #end
+
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
FlxG.save.flush();
diff --git a/source/PlayerSettings.hx b/source/PlayerSettings.hx
index fa034581d..b275b9b51 100644
--- a/source/PlayerSettings.hx
+++ b/source/PlayerSettings.hx
@@ -14,12 +14,21 @@ class PlayerSettings
static public var player1(default, null):PlayerSettings;
static public var player2(default, null):PlayerSettings;
+ #if (haxe >= "4.0.0")
static public final onAvatarAdd = new FlxTypedSignalVoid>();
static public final onAvatarRemove = new FlxTypedSignalVoid>();
+ #else
+ static public var onAvatarAdd = new FlxTypedSignalVoid>();
+ static public var onAvatarRemove = new FlxTypedSignalVoid>();
+ #end
public var id(default, null):Int;
+ #if (haxe >= "4.0.0")
public final controls:Controls;
+ #else
+ public var controls:Controls;
+ #end
// public var avatar:Player;
// public var camera(get, never):PlayCamera;
diff --git a/source/Song.hx b/source/Song.hx
index 08eae4921..8af708367 100644
--- a/source/Song.hx
+++ b/source/Song.hx
@@ -49,7 +49,7 @@ class Song
public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
{
- // var rawJson = Assets.getText('assets/data/ridge/ridge.json').trim();
+
var rawJson = Assets.getText('assets/data/' + folder.toLowerCase() + '/' + jsonInput.toLowerCase() + '.json').trim();
while (!rawJson.endsWith("}"))
diff --git a/source/TitleState.hx b/source/TitleState.hx
index aa7c2ffc2..172e8fed4 100644
--- a/source/TitleState.hx
+++ b/source/TitleState.hx
@@ -42,6 +42,7 @@ class TitleState extends MusicBeatState
var wackyImage:FlxSprite;
+
override public function create():Void
{
#if (!web)
@@ -56,12 +57,16 @@ class TitleState extends MusicBeatState
super.create();
- #if (!debug && NG_LOGIN)
+
+ #if (!switch && !debug && NG_LOGIN)
+
var ng:NGio = new NGio(APIStuff.API, APIStuff.EncKey);
#end
#if SKIP_TO_PLAYSTATE
- FlxG.switchState(new ChartingState());
+
+ FlxG.switchState(new StoryMenuState());
+
#else
startIntro();
#end
@@ -199,7 +204,11 @@ class TitleState extends MusicBeatState
if (pressedEnter && !transitioning && skippedIntro)
{
+
+ #if !switch
NGio.unlockMedal(60960);
+ #end
+
titleText.animation.play('press');
FlxG.camera.flash(FlxColor.WHITE, 1);