diff --git a/source/ChartingState.hx b/source/ChartingState.hx index cc024ccff..64a0de8fb 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -1,8 +1,8 @@ package; +import Conductor.BPMChangeEvent; import Section.SwagSection; import Song.SwagSong; -import Conductor.BPMChangeEvent; import flixel.FlxG; import flixel.FlxSprite; import flixel.addons.display.FlxGridOverlay; @@ -447,21 +447,21 @@ class ChartingState extends MusicBeatState var updatedSection:Bool = false; /* this function got owned LOL - function lengthBpmBullshit():Float - { - if (_song.notes[curSection].changeBPM) - return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm); - else - return _song.notes[curSection].lengthInSteps; + function lengthBpmBullshit():Float + { + if (_song.notes[curSection].changeBPM) + return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm); + else + return _song.notes[curSection].lengthInSteps; }*/ - function sectionStartTime():Float { var daBPM:Int = _song.bpm; var daPos:Float = 0; for (i in 0...curSection) { - if (_song.notes[i].changeBPM) { + if (_song.notes[i].changeBPM) + { daBPM = _song.notes[i].bpm; } daPos += 4 * (1000 * 60 / daBPM); @@ -744,11 +744,11 @@ class ChartingState extends MusicBeatState vocals.pause(); /*var daNum:Int = 0; - var daLength:Float = 0; - while (daNum <= sec) - { - daLength += lengthBpmBullshit(); - daNum++; + var daLength:Float = 0; + while (daNum <= sec) + { + daLength += lengthBpmBullshit(); + daNum++; }*/ FlxG.sound.music.time = sectionStartTime(); @@ -830,7 +830,7 @@ class ChartingState extends MusicBeatState } else { - //get last bpm + // get last bpm var daBPM:Int = _song.bpm; for (i in 0...curSection) if (_song.notes[i].changeBPM) @@ -975,29 +975,28 @@ class ChartingState extends MusicBeatState } /* - function calculateSectionLengths(?sec:SwagSection):Int - { - var daLength:Int = 0; - - for (i in _song.notes) + function calculateSectionLengths(?sec:SwagSection):Int { - var swagLength = i.lengthInSteps; + var daLength:Int = 0; - if (i.typeOfSection == Section.COPYCAT) - swagLength * 2; - - daLength += swagLength; - - if (sec != null && sec == i) + for (i in _song.notes) { - trace('swag loop??'); - break; + var swagLength = i.lengthInSteps; + + if (i.typeOfSection == Section.COPYCAT) + swagLength * 2; + + daLength += swagLength; + + if (sec != null && sec == i) + { + trace('swag loop??'); + break; + } } - } - return daLength; + return daLength; }*/ - private var daSpacing:Float = 0.3; function loadLevel():Void diff --git a/source/CoolUtil.hx b/source/CoolUtil.hx index f49eeb071..8c24449bb 100644 --- a/source/CoolUtil.hx +++ b/source/CoolUtil.hx @@ -6,6 +6,13 @@ using StringTools; class CoolUtil { + public static var difficultyArray:Array = ['EASY', "NORMAL", "HARD"]; + + public static function difficultyString():String + { + return difficultyArray[PlayState.storyDifficulty]; + } + public static function coolTextFile(path:String):Array { var daList:Array = Assets.getText(path).trim().split('\n'); diff --git a/source/Paths.hx b/source/Paths.hx index 4bee419c5..dcd1477aa 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -1,123 +1,117 @@ package; -import openfl.utils.Assets as OpenFlAssets; -import openfl.utils.AssetType; - import flixel.FlxG; import flixel.graphics.frames.FlxAtlasFrames; +import openfl.utils.AssetType; +import openfl.utils.Assets as OpenFlAssets; class Paths { inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end; - + static var currentLevel:String; - + static public function setCurrentLevel(name:String) { currentLevel = name.toLowerCase(); } - + static function getPath(file:String, type:AssetType, library:Null) { if (library != null) return getLibraryPath(file, library); - + if (currentLevel != null) { var levelPath = getLibraryPathForce(file, currentLevel); if (OpenFlAssets.exists(levelPath, type)) return levelPath; - + levelPath = getLibraryPathForce(file, "shared"); if (OpenFlAssets.exists(levelPath, type)) return levelPath; } - + return getPreloadPath(file); } - + static public function getLibraryPath(file:String, library = "preload") { - return if (library == "preload" || library == "default") - getPreloadPath(file); - else - getLibraryPathForce(file, library); + return if (library == "preload" || library == "default") getPreloadPath(file); else getLibraryPathForce(file, library); } - + inline static function getLibraryPathForce(file:String, library:String) { - return '$library:assets/$library/$file'; } - + inline static function getPreloadPath(file:String) { - return 'assets/$file'; } - + inline static public function file(file:String, type:AssetType = TEXT, ?library:String) { return getPath(file, type, library); } - + inline static public function txt(key:String, ?library:String) { return getPath('data/$key.txt', TEXT, library); } - + inline static public function xml(key:String, ?library:String) { return getPath('data/$key.xml', TEXT, library); } - + inline static public function json(key:String, ?library:String) { return getPath('data/$key.json', TEXT, library); } - - static public function sound(key:String, ?library:String) + + static public function sound(key:String, ?library:String) { return getPath('sounds/$key.$SOUND_EXT', SOUND, library); } - + inline static public function soundRandom(key:String, min:Int, max:Int, ?library:String) { return sound(key + FlxG.random.int(min, max), library); } - + inline static public function music(key:String, ?library:String) { return getPath('music/$key.$SOUND_EXT', MUSIC, library); } - + inline static public function voices(song:String) { return 'songs:assets/songs/${song.toLowerCase()}/Voices.$SOUND_EXT'; } - + inline static public function inst(song:String) { return 'songs:assets/songs/${song.toLowerCase()}/Inst.$SOUND_EXT'; } - + inline static public function image(key:String, ?library:String) { return getPath('images/$key.png', IMAGE, library); } - + inline static public function font(key:String) { return 'assets/fonts/$key'; } - + inline static public function getSparrowAtlas(key:String, ?library:String) { return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library)); } - + inline static public function getPackerAtlas(key:String, ?library:String) { return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library)); } -} \ No newline at end of file +} diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 69bdf6007..5831ebef1 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -8,6 +8,9 @@ import flixel.addons.transition.FlxTransitionableState; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.input.keyboard.FlxKey; import flixel.system.FlxSound; +import flixel.text.FlxText; +import flixel.tweens.FlxEase; +import flixel.tweens.FlxTween; import flixel.util.FlxColor; class PauseSubState extends MusicBeatSubstate @@ -30,10 +33,24 @@ class PauseSubState extends MusicBeatSubstate FlxG.sound.list.add(pauseMusic); var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); - bg.alpha = 0.6; + bg.alpha = 0; bg.scrollFactor.set(); add(bg); + var levelInfo:FlxText = new FlxText(20, 15, 0, "", 32); + levelInfo.text += PlayState.SONG.song; + levelInfo.text += '\n' + CoolUtil.difficultyString(); + levelInfo.scrollFactor.set(); + levelInfo.setFormat(Paths.font("vcr.ttf"), 32); + levelInfo.updateHitbox(); + add(levelInfo); + levelInfo.alpha = 0; + + levelInfo.x = FlxG.width - (levelInfo.width + 20); + + FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut}); + FlxTween.tween(levelInfo, {alpha: 1, y: 20}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.3}); + grpMenuShit = new FlxTypedGroup(); add(grpMenuShit);