diff --git a/Project.xml b/Project.xml
index 192a2dc7d..c6eb34e14 100644
--- a/Project.xml
+++ b/Project.xml
@@ -126,7 +126,7 @@
-
+
diff --git a/source/Character.hx b/source/Character.hx
index e48f2b84e..860fc7317 100644
--- a/source/Character.hx
+++ b/source/Character.hx
@@ -1,5 +1,6 @@
package;
+import Section.SwagSection;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.animation.FlxBaseAnimation;
@@ -18,6 +19,8 @@ class Character extends FlxSprite
public var holdTimer:Float = 0;
+ public var animationNotes:Array = [];
+
public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false)
{
super(x, y);
@@ -291,6 +294,8 @@ class Character extends FlxSprite
loadOffsetFile(curCharacter);
playAnim('shoot1');
+ loadMappedAnims();
+
case 'bf':
var tex = Paths.getSparrowAtlas('characters/BOYFRIEND');
frames = tex;
@@ -575,6 +580,23 @@ class Character extends FlxSprite
}
}
+ public function loadMappedAnims()
+ {
+ var swagshit = Song.loadFromJson('picospeaker', 'stress');
+
+ var notes = swagshit.notes;
+
+ for (section in notes)
+ {
+ for (idk in section.sectionNotes)
+ {
+ animationNotes.push(idk);
+ }
+ }
+
+ trace(animationNotes);
+ }
+
function quickAnimAdd(name:String, prefix:String)
{
animation.addByPrefix(name, prefix, 24, false);
@@ -623,6 +645,25 @@ class Character extends FlxSprite
case 'gf':
if (animation.curAnim.name == 'hairFall' && animation.curAnim.finished)
playAnim('danceRight');
+ case "pico-speaker":
+ // for pico??
+ if (animationNotes.length > 0)
+ {
+ if (Conductor.songPosition > animationNotes[0][0])
+ {
+ trace('played shoot anim' + animationNotes[0][1]);
+
+ var shootAnim:Int = 1;
+
+ if (animationNotes[0][1] >= 2)
+ shootAnim = 3;
+
+ shootAnim += FlxG.random.int(0, 1);
+
+ playAnim('shoot' + shootAnim, true);
+ animationNotes.shift();
+ }
+ }
}
super.update(elapsed);
@@ -651,7 +692,8 @@ class Character extends FlxSprite
}
case 'pico-speaker':
- playAnim('shoot' + FlxG.random.int(1, 4), true);
+ // lol weed
+ // playAnim('shoot' + FlxG.random.int(1, 4), true);
case 'spooky':
danced = !danced;
diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx
index 4c3e492e3..2297439e3 100644
--- a/source/FreeplayState.hx
+++ b/source/FreeplayState.hx
@@ -1,6 +1,5 @@
package;
-
-#if desktop
+#if discord_rpc
import Discord.DiscordClient;
#end
import flash.text.TextField;
@@ -52,7 +51,7 @@ class FreeplayState extends MusicBeatState
FlxG.sound.playMusic(Paths.music('freakyMenu'));
}
- #if desktop
+ #if discord_rpc
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null);
#end
diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx
index 75fab2853..bdcbd277c 100644
--- a/source/MainMenuState.hx
+++ b/source/MainMenuState.hx
@@ -41,7 +41,7 @@ class MainMenuState extends MusicBeatState
override function create()
{
- #if desktop
+ #if discord_rpc
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null);
#end
diff --git a/source/PlayState.hx b/source/PlayState.hx
index 1b6063625..725154eb4 100644
--- a/source/PlayState.hx
+++ b/source/PlayState.hx
@@ -43,7 +43,7 @@ import ui.PreferencesMenu;
using StringTools;
-#if desktop
+#if discord_rpc
import Discord.DiscordClient;
#end
@@ -134,7 +134,7 @@ class PlayState extends MusicBeatState
var inCutscene:Bool = false;
- #if desktop
+ #if discord_rpc
// Discord RPC variables
var storyDifficultyText:String = "";
var iconRPC:String = "";
@@ -710,7 +710,7 @@ class PlayState extends MusicBeatState
// startCountdown();
- generateSong(SONG.song);
+ generateSong();
// add(strumLine);
@@ -833,7 +833,7 @@ class PlayState extends MusicBeatState
function initDiscord():Void
{
- #if desktop
+ #if discord_rpc
storyDifficultyText = CoolUtil.difficultyString();
iconRPC = SONG.player2;
@@ -1072,7 +1072,7 @@ class PlayState extends MusicBeatState
FlxG.sound.music.onComplete = endSong;
vocals.play();
- #if desktop
+ #if discord_rpc
// Song duration in a float, useful for the time left feature
songLength = FlxG.sound.music.length;
@@ -1083,7 +1083,7 @@ class PlayState extends MusicBeatState
var debugNum:Int = 0;
- private function generateSong(dataPath:String):Void
+ private function generateSong():Void
{
// FlxG.log.add(ChartParser.parse());
@@ -1323,7 +1323,7 @@ class PlayState extends MusicBeatState
startTimer.active = true;
paused = false;
- #if desktop
+ #if discord_rpc
if (startTimer.finished)
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition);
@@ -1338,9 +1338,9 @@ class PlayState extends MusicBeatState
super.closeSubState();
}
+ #if discord_rpc
override public function onFocus():Void
{
- #if desktop
if (health > 0 && !paused)
{
if (Conductor.songPosition > 0.0)
@@ -1352,22 +1352,20 @@ class PlayState extends MusicBeatState
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
}
- #end
super.onFocus();
}
override public function onFocusLost():Void
{
- #if desktop
if (health > 0 && !paused)
{
DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
- #end
super.onFocusLost();
}
+ #end
function resyncVocals():Void
{
@@ -1469,7 +1467,7 @@ class PlayState extends MusicBeatState
boyfriendPos.put();
}
- #if desktop
+ #if discord_rpc
DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
}
@@ -1478,7 +1476,7 @@ class PlayState extends MusicBeatState
{
FlxG.switchState(new ChartingState());
- #if desktop
+ #if discord_rpc
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
}
@@ -1597,7 +1595,7 @@ class PlayState extends MusicBeatState
// FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
- #if desktop
+ #if discord_rpc
// Game Over doesn't get his own variable because it's only used here
DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx
index 23bbee0bb..4e9444075 100644
--- a/source/StoryMenuState.hx
+++ b/source/StoryMenuState.hx
@@ -1,6 +1,6 @@
package;
-#if desktop
+#if discord_rpc
import Discord.DiscordClient;
#end
import flixel.FlxG;
@@ -113,7 +113,7 @@ class StoryMenuState extends MusicBeatState
trace("Line 70");
- #if desktop
+ #if discord_rpc
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null);
#end
diff --git a/source/TitleState.hx b/source/TitleState.hx
index 2f9c3a7f1..bdb394bcf 100644
--- a/source/TitleState.hx
+++ b/source/TitleState.hx
@@ -1,5 +1,6 @@
package;
+import animate.AnimationAtlas;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
@@ -21,8 +22,10 @@ import ui.PreferencesMenu;
using StringTools;
-#if desktop
+#if discord_rpc
import Discord.DiscordClient;
+#end
+#if desktop
import sys.thread.Thread;
#end
@@ -50,6 +53,8 @@ class TitleState extends MusicBeatState
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL});
#end
+ AnimationAtlas.fromAnimate(Paths.image('money'), Paths.file('images/money.json'));
+
swagShader = new ColorSwap();
FlxG.sound.muteKeys = [ZERO];
@@ -95,7 +100,7 @@ class TitleState extends MusicBeatState
});
#end
- #if desktop
+ #if discord_rpc
DiscordClient.initialize();
#end
}
diff --git a/source/animate/Animation.hx b/source/animate/Animation.hx
new file mode 100644
index 000000000..eec2c6c60
--- /dev/null
+++ b/source/animate/Animation.hx
@@ -0,0 +1,11 @@
+package animate;
+
+import flixel.group.FlxGroup;
+
+class Aniamtion extends FlxGroup
+{
+ public function new(symbolName:String, atlas:AnimationAtlas):Void
+ {
+ super();
+ }
+}
diff --git a/source/animate/AnimationAtlas.hx b/source/animate/AnimationAtlas.hx
new file mode 100644
index 000000000..cd87c39d0
--- /dev/null
+++ b/source/animate/AnimationAtlas.hx
@@ -0,0 +1,78 @@
+package animate;
+
+import flixel.FlxG;
+import flixel.addons.ui.FlxUIColorSwatchSelecter.SwatchGraphic;
+import flixel.graphics.FlxGraphic;
+import flixel.graphics.frames.FlxAtlasFrames;
+import flixel.math.FlxPoint;
+import flixel.math.FlxRect;
+import flixel.system.FlxAssets.FlxGraphicAsset;
+import haxe.Json;
+import openfl.Assets;
+import openfl.geom.Rectangle;
+
+class AnimationAtlas
+{
+ public function new(data:Dynamic, atlas:FlxAtlasFrames):Void {}
+
+ public static function fromAnimate(Source:FlxGraphicAsset, Description:String):FlxAtlasFrames
+ {
+ var graphic:FlxGraphic = FlxG.bitmap.add(Source);
+ if (graphic == null)
+ return null;
+
+ var frames:FlxAtlasFrames = FlxAtlasFrames.findFrame(graphic);
+ if (frames != null)
+ return frames;
+
+ if (graphic == null || Description == null)
+ return null;
+
+ frames = new FlxAtlasFrames(graphic);
+
+ var data:AnimateObject;
+
+ var json:String = Description;
+
+ trace(json);
+
+ if (Assets.exists(json))
+ json = Assets.getText(json);
+
+ trace(json);
+
+ data = cast Json.parse(json).ATLAS;
+
+ for (sprite in data.SPRITES)
+ {
+ // probably nicer way to do this? Oh well
+ var swagSprite:AnimateSprite = sprite.SPRITE;
+
+ var rect = FlxRect.get(swagSprite.x, swagSprite.y, swagSprite.w, swagSprite.h);
+
+ var size = new Rectangle(0, 0, rect.width, rect.height);
+
+ var offset = FlxPoint.get(-size.left, -size.top);
+ var sourceSize = FlxPoint.get(size.width, size.height);
+
+ frames.addAtlasFrame(rect, sourceSize, offset, swagSprite.name);
+ }
+
+ return frames;
+ }
+}
+
+typedef AnimateObject =
+{
+ SPRITES:Array
+}
+
+typedef AnimateSprite =
+{
+ var name:String;
+ var x:Int;
+ var y:Int;
+ var w:Int;
+ var h:Int;
+ var rotated:Bool;
+}