diff --git a/assets/secrets/images/PessyBump.png b/assets/secrets/images/PessyBump.png new file mode 100644 index 00000000000..64b3dac7926 Binary files /dev/null and b/assets/secrets/images/PessyBump.png differ diff --git a/assets/secrets/images/PessyBump.xml b/assets/secrets/images/PessyBump.xml new file mode 100644 index 00000000000..ba69843ead3 --- /dev/null +++ b/assets/secrets/images/PessyBump.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/secrets/images/RiverBump.png b/assets/secrets/images/RiverBump.png deleted file mode 100644 index 44f978fd22b..00000000000 Binary files a/assets/secrets/images/RiverBump.png and /dev/null differ diff --git a/assets/secrets/images/RiverBump.xml b/assets/secrets/images/RiverBump.xml deleted file mode 100644 index 38c73e44bc5..00000000000 --- a/assets/secrets/images/RiverBump.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/secrets/images/ShadowBump.xml b/assets/secrets/images/ShadowBump.xml index b3d6293377a..16b32cba941 100644 --- a/assets/secrets/images/ShadowBump.xml +++ b/assets/secrets/images/ShadowBump.xml @@ -8,4 +8,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/secrets/images/ZRiverBump.png b/assets/secrets/images/ZRiverBump.png new file mode 100644 index 00000000000..19f096b36fc Binary files /dev/null and b/assets/secrets/images/ZRiverBump.png differ diff --git a/assets/secrets/images/ZRiverBump.xml b/assets/secrets/images/ZRiverBump.xml new file mode 100644 index 00000000000..6394744e5e2 --- /dev/null +++ b/assets/secrets/images/ZRiverBump.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/assets/secrets/sounds/JinglePessy.mp3 b/assets/secrets/sounds/JinglePessy.mp3 new file mode 100644 index 00000000000..81d0b9b3419 Binary files /dev/null and b/assets/secrets/sounds/JinglePessy.mp3 differ diff --git a/assets/secrets/sounds/JinglePessy.ogg b/assets/secrets/sounds/JinglePessy.ogg new file mode 100644 index 00000000000..3e3e7bdd5dc Binary files /dev/null and b/assets/secrets/sounds/JinglePessy.ogg differ diff --git a/assets/secrets/sounds/JingleRiver.mp3 b/assets/secrets/sounds/JingleRiver.mp3 index adeffde4e3b..385ebca73d5 100644 Binary files a/assets/secrets/sounds/JingleRiver.mp3 and b/assets/secrets/sounds/JingleRiver.mp3 differ diff --git a/assets/secrets/sounds/JingleRiver.ogg b/assets/secrets/sounds/JingleRiver.ogg index d679905e2ff..52a565a3580 100644 Binary files a/assets/secrets/sounds/JingleRiver.ogg and b/assets/secrets/sounds/JingleRiver.ogg differ diff --git a/assets/shared/images/gfDanceTitle.json b/assets/shared/images/gfDanceTitle.json index b3a304adf2b..d52701f5d68 100644 --- a/assets/shared/images/gfDanceTitle.json +++ b/assets/shared/images/gfDanceTitle.json @@ -1,10 +1,10 @@ { - "titlex":-150, - "titley":-100, - "startx":100, - "starty":576, - "gfx":512, - "gfy":40, - "backgroundSprite":"", - "bpm":102 + "titlex": -150, + "titley": -100, + "startx": 100, + "starty": 576, + "gfx": 512, + "gfy": 40, + "backgroundSprite": "", + "bpm": 102 } \ No newline at end of file diff --git a/source/states/TitleState.hx b/source/states/TitleState.hx index a2d7690c236..a56e1cc0f1d 100644 --- a/source/states/TitleState.hx +++ b/source/states/TitleState.hx @@ -21,14 +21,19 @@ import states.MainMenuState; typedef TitleData = { - titlex:Float, - titley:Float, - startx:Float, - starty:Float, - gfx:Float, - gfy:Float, - backgroundSprite:String, - bpm:Float + var titlex:Float; + var titley:Float; + var startx:Float; + var starty:Float; + var gfx:Float; + var gfy:Float; + var backgroundSprite:String; + var bpm:Float; + + @:optional var animation:String; + @:optional var dance_left:Array; + @:optional var dance_right:Array; + @:optional var idle:Bool; } class TitleState extends MusicBeatState @@ -39,10 +44,10 @@ class TitleState extends MusicBeatState public static var initialized:Bool = false; + var credGroup:FlxGroup = new FlxGroup(); + var textGroup:FlxGroup = new FlxGroup(); var blackScreen:FlxSprite; - var credGroup:FlxGroup; var credTextShit:Alphabet; - var textGroup:FlxGroup; var ngSpr:FlxSprite; var titleTextColors:Array = [0xFF33FFFF, 0xFF3333CC]; @@ -53,22 +58,21 @@ class TitleState extends MusicBeatState var wackyImage:FlxSprite; #if TITLE_SCREEN_EASTER_EGG - var easterEggKeys:Array = [ - 'SHADOW', 'RIVEREN', 'BBPANZU' + final easterEggKeys:Array = [ + 'SHADOW', 'RIVEREN', 'BBPANZU', 'PESSY' ]; - var allowedKeys:String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + final allowedKeys:String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; var easterEggKeysBuffer:String = ''; #end var mustUpdate:Bool = false; - var titleJSON:TitleData; - public static var updateVersion:String = ''; override public function create():Void { Paths.clearStoredMemory(); + Paths.clearUnusedMemory(); ClientPrefs.loadPrefs(); Language.reloadPhrases(); @@ -100,26 +104,6 @@ class TitleState extends MusicBeatState } #end - - // IGNORE THIS!!! - titleJSON = tjson.TJSON.parse(Paths.getTextFromFile('images/gfDanceTitle.json')); - - #if TITLE_SCREEN_EASTER_EGG - if (FlxG.save.data.psychDevsEasterEgg == null) FlxG.save.data.psychDevsEasterEgg = ''; //Crash prevention - switch(FlxG.save.data.psychDevsEasterEgg.toUpperCase()) - { - case 'SHADOW': - titleJSON.gfx += 210; - titleJSON.gfy += 40; - case 'RIVEREN': - titleJSON.gfx += 180; - titleJSON.gfy += 40; - case 'BBPANZU': - titleJSON.gfx += 45; - titleJSON.gfy += 100; - } - #end - if(!initialized) { if(FlxG.save.data != null && FlxG.save.data.fullscreen) @@ -142,11 +126,14 @@ class TitleState extends MusicBeatState #elseif CHARTING MusicBeatState.switchState(new ChartingState()); #else - if(FlxG.save.data.flashing == null && !FlashingState.leftState) { + if(FlxG.save.data.flashing == null && !FlashingState.leftState) + { FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; MusicBeatState.switchState(new FlashingState()); - } else { + } + else + { if (initialized) startIntro(); else @@ -168,142 +155,186 @@ class TitleState extends MusicBeatState function startIntro() { + persistentUpdate = true; if (!initialized && FlxG.sound.music == null) FlxG.sound.playMusic(Paths.music('freakyMenu'), 0); - Conductor.bpm = titleJSON.bpm; - persistentUpdate = true; - - var bg:FlxSprite = new FlxSprite(); - bg.antialiasing = ClientPrefs.data.antialiasing; + loadJsonData(); + #if TITLE_SCREEN_EASTER_EGG easterEggData(); #end + Conductor.bpm = musicBPM; - if (titleJSON.backgroundSprite != null && titleJSON.backgroundSprite.length > 0 && titleJSON.backgroundSprite != "none"){ - bg.loadGraphic(Paths.image(titleJSON.backgroundSprite)); - }else{ - bg.makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); - } - - // bg.setGraphicSize(Std.int(bg.width * 0.6)); - // bg.updateHitbox(); - add(bg); - - logoBl = new FlxSprite(titleJSON.titlex, titleJSON.titley); + logoBl = new FlxSprite(logoPosition.x, logoPosition.y); logoBl.frames = Paths.getSparrowAtlas('logoBumpin'); logoBl.antialiasing = ClientPrefs.data.antialiasing; logoBl.animation.addByPrefix('bump', 'logo bumpin', 24, false); logoBl.animation.play('bump'); logoBl.updateHitbox(); - // logoBl.screenCenter(); - // logoBl.color = FlxColor.BLACK; - if(ClientPrefs.data.shaders) swagShader = new ColorSwap(); - gfDance = new FlxSprite(titleJSON.gfx, titleJSON.gfy); + gfDance = new FlxSprite(gfPosition.x, gfPosition.y); gfDance.antialiasing = ClientPrefs.data.antialiasing; - - var easterEgg:String = FlxG.save.data.psychDevsEasterEgg; - if(easterEgg == null) easterEgg = ''; //html5 fix - - switch(easterEgg.toUpperCase()) - { - // IGNORE THESE, GO DOWN A BIT - #if TITLE_SCREEN_EASTER_EGG - case 'SHADOW': - gfDance.frames = Paths.getSparrowAtlas('ShadowBump'); - gfDance.animation.addByPrefix('danceLeft', 'Shadow Title Bump', 24); - gfDance.animation.addByPrefix('danceRight', 'Shadow Title Bump', 24); - case 'RIVEREN': - gfDance.frames = Paths.getSparrowAtlas('RiverBump'); - gfDance.animation.addByIndices('danceLeft', 'River Title Bump', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); - gfDance.animation.addByIndices('danceRight', 'River Title Bump', [29, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); - case 'BBPANZU': - gfDance.frames = Paths.getSparrowAtlas('BBBump'); - gfDance.animation.addByIndices('danceLeft', 'BB Title Bump', [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27], "", 24, false); - gfDance.animation.addByIndices('danceRight', 'BB Title Bump', [27, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], "", 24, false); - #end - - default: - //EDIT THIS ONE IF YOU'RE MAKING A SOURCE CODE MOD!!!! - //EDIT THIS ONE IF YOU'RE MAKING A SOURCE CODE MOD!!!! - //EDIT THIS ONE IF YOU'RE MAKING A SOURCE CODE MOD!!!! - gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); - gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); - gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); - } - - add(gfDance); - add(logoBl); - if(swagShader != null) + + if(ClientPrefs.data.shaders) { + swagShader = new ColorSwap(); gfDance.shader = swagShader.shader; logoBl.shader = swagShader.shader; } + + gfDance.frames = Paths.getSparrowAtlas(characterImage); + if(!useIdle) + { + gfDance.animation.addByIndices('danceLeft', animationName, [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); + gfDance.animation.addByIndices('danceRight', animationName, [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); + gfDance.animation.play('danceRight'); + } + else + { + gfDance.animation.addByPrefix('idle', animationName, 24, false); + gfDance.animation.play('idle'); + } + - titleText = new FlxSprite(titleJSON.startx, titleJSON.starty); - titleText.frames = Paths.getSparrowAtlas('titleEnter'); var animFrames:Array = []; - @:privateAccess { + titleText = new FlxSprite(enterPosition.x, enterPosition.y); + titleText.frames = Paths.getSparrowAtlas('titleEnter'); + @:privateAccess + { titleText.animation.findByPrefix(animFrames, "ENTER IDLE"); titleText.animation.findByPrefix(animFrames, "ENTER FREEZE"); } - if (animFrames.length > 0) { - newTitle = true; - + if (newTitle = animFrames.length > 0) + { titleText.animation.addByPrefix('idle', "ENTER IDLE", 24); titleText.animation.addByPrefix('press', ClientPrefs.data.flashing ? "ENTER PRESSED" : "ENTER FREEZE", 24); } - else { - newTitle = false; - + else + { titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24); titleText.animation.addByPrefix('press', "ENTER PRESSED", 24); } - titleText.animation.play('idle'); titleText.updateHitbox(); - // titleText.screenCenter(X); - add(titleText); var logo:FlxSprite = new FlxSprite().loadGraphic(Paths.image('logo')); logo.antialiasing = ClientPrefs.data.antialiasing; logo.screenCenter(); - // add(logo); - - // FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG}); - // FlxTween.tween(logo, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.1}); - credGroup = new FlxGroup(); - add(credGroup); - textGroup = new FlxGroup(); - - blackScreen = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); + blackScreen = new FlxSprite().makeGraphic(1, 1, FlxColor.BLACK); + blackScreen.scale.set(FlxG.width, FlxG.height); + blackScreen.updateHitbox(); credGroup.add(blackScreen); credTextShit = new Alphabet(0, 0, "", true); credTextShit.screenCenter(); - - // credTextShit.alignment = CENTER; - credTextShit.visible = false; ngSpr = new FlxSprite(0, FlxG.height * 0.52).loadGraphic(Paths.image('newgrounds_logo')); - add(ngSpr); ngSpr.visible = false; ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.8)); ngSpr.updateHitbox(); ngSpr.screenCenter(X); ngSpr.antialiasing = ClientPrefs.data.antialiasing; + add(gfDance); + add(logoBl); //FNF Logo + add(titleText); //"Press Enter to Begin" text + add(credGroup); + add(ngSpr); + if (initialized) skipIntro(); else initialized = true; - Paths.clearUnusedMemory(); // credGroup.add(credTextShit); } + // JSON data + var characterImage:String = 'gfDanceTitle'; + var animationName:String = 'gfDance'; + + var gfPosition:FlxPoint = FlxPoint.get(512, 40); + var logoPosition:FlxPoint = FlxPoint.get(-150, -100); + var enterPosition:FlxPoint = FlxPoint.get(100, 576); + + var useIdle:Bool = false; + var musicBPM:Float = 102; + var danceLeftFrames:Array = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]; + var danceRightFrames:Array = [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + + function loadJsonData() + { + if(Paths.fileExists('images/gfDanceTitle.json', TEXT)) + { + var titleRaw:String = Paths.getTextFromFile('images/gfDanceTitle.json'); + if(titleRaw != null && titleRaw.length > 0) + { + try + { + var titleJSON:TitleData = tjson.TJSON.parse(titleRaw); + gfPosition.set(titleJSON.gfx, titleJSON.gfy); + logoPosition.set(titleJSON.titlex, titleJSON.titley); + enterPosition.set(titleJSON.startx, titleJSON.starty); + musicBPM = titleJSON.bpm; + + if(titleJSON.dance_left != null && titleJSON.dance_left.length > 0) danceLeftFrames = titleJSON.dance_left; + if(titleJSON.dance_right != null && titleJSON.dance_right.length > 0) danceRightFrames = titleJSON.dance_right; + useIdle = (titleJSON.idle == true); + + if (titleJSON.backgroundSprite != null && titleJSON.backgroundSprite.trim().length > 0) + { + var bg:FlxSprite = new FlxSprite().loadGraphic(Paths.image(titleJSON.backgroundSprite)); + bg.antialiasing = ClientPrefs.data.antialiasing; + add(bg); + } + } + catch(e:haxe.Exception) + { + trace('[WARN] Title JSON might broken, ignoring issue...\n${e.details()}'); + } + } + else trace('[WARN] No Title JSON detected, using default values.'); + } + //else trace('[WARN] No Title JSON detected, using default values.'); + } + + function easterEggData() + { + if (FlxG.save.data.psychDevsEasterEgg == null) FlxG.save.data.psychDevsEasterEgg = ''; //Crash prevention + var easterEgg:String = FlxG.save.data.psychDevsEasterEgg; + switch(easterEgg.toUpperCase()) + { + case 'SHADOW': + characterImage = 'ShadowBump'; + animationName = 'Shadow Title Bump'; + gfPosition.x += 210; + gfPosition.y += 40; + useIdle = true; + case 'RIVEREN': + characterImage = 'ZRiverBump'; + animationName = 'River Title Bump'; + gfPosition.x += 180; + gfPosition.y += 40; + useIdle = true; + case 'BBPANZU': + characterImage = 'BBBump'; + animationName = 'BB Title Bump'; + danceLeftFrames = [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; + danceRightFrames = [27, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]; + gfPosition.x += 45; + gfPosition.y += 100; + case 'PESSY': + characterImage = 'PessyBump'; + animationName = 'Pessy Title Bump'; + gfPosition.x += 192; + gfPosition.y += 70; + danceLeftFrames = [29, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + danceRightFrames = [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]; + } + } + function getIntroTextShit():Array> { #if MODS_ALLOWED @@ -395,11 +426,11 @@ class TitleState extends MusicBeatState new FlxTimer().start(1, function(tmr:FlxTimer) { - if (mustUpdate) { + if (mustUpdate) MusicBeatState.switchState(new OutdatedState()); - } else { + else MusicBeatState.switchState(new MainMenuState()); - } + closedState = true; }); // FlxG.sound.play(Paths.music('titleShoot'), 0.7); @@ -428,7 +459,9 @@ class TitleState extends MusicBeatState FlxG.sound.play(Paths.sound('secret')); - var black:FlxSprite = new FlxSprite(0, 0).makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); + var black:FlxSprite = new FlxSprite(0, 0).makeGraphic(1, 1, FlxColor.BLACK); + black.scale.set(FlxG.width, FlxG.height); + black.updateHitbox(); black.alpha = 0; add(black); @@ -477,7 +510,8 @@ class TitleState extends MusicBeatState var money:Alphabet = new Alphabet(0, 0, textArray[i], true); money.screenCenter(X); money.y += (i * 60) + 200 + offset; - if(credGroup != null && textGroup != null) { + if(credGroup != null && textGroup != null) + { credGroup.add(money); textGroup.add(money); } @@ -513,15 +547,21 @@ class TitleState extends MusicBeatState if(logoBl != null) logoBl.animation.play('bump', true); - if(gfDance != null) { + if(gfDance != null) + { danceLeft = !danceLeft; - if (danceLeft) - gfDance.animation.play('danceRight'); - else - gfDance.animation.play('danceLeft'); + if(!useIdle) + { + if (danceLeft) + gfDance.animation.play('danceRight'); + else + gfDance.animation.play('danceLeft'); + } + else if(curBeat % 2 == 0) gfDance.animation.play('idle', true); } - if(!closedState) { + if(!closedState) + { sickBeats++; switch (sickBeats) { @@ -585,6 +625,8 @@ class TitleState extends MusicBeatState FlxG.sound.play(Paths.sound('JingleShadow')); case 'BBPANZU': sound = FlxG.sound.play(Paths.sound('JingleBB')); + case 'PESSY': + sound = FlxG.sound.play(Paths.sound('JinglePessy')); default: //Go back to normal ugly ass boring GF remove(ngSpr);