diff --git a/assets/shared/images/gfDanceTitle.json b/assets/shared/images/gfDanceTitle.json index 17640ae..3e49bb2 100644 --- a/assets/shared/images/gfDanceTitle.json +++ b/assets/shared/images/gfDanceTitle.json @@ -13,5 +13,9 @@ "versiontext":"Friday Night Funkin': Vs. Foxa 3.0", "friday":"FNF", "night":"Vs", - "funkin":"Foxa" + "funkin":"Foxa", + "ngtext":"newgrounds", + "noAssociate":true, + "logoHover":true, + "showThanks":true } \ No newline at end of file diff --git a/source/Main.hx b/source/Main.hx index 6fe9791..f728a6b 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -44,7 +44,7 @@ class Main extends Sprite width: 1280, // WINDOW width height: 720, // WINDOW height zoom: -1.0, // game state bounds - initialState: () -> new TitleState(), // initial game state + initialState: () -> new StartingState(), // initial game state framerate: 60, // default framerate skipSplash: true, // if the default flixel splash screen should be skipped startFullscreen: false // if the game should start at fullscreen mode @@ -61,8 +61,7 @@ class Main extends Sprite Lib.current.addChild(new Main()); } - public function new() - { + public function new() { super(); // Credits to MAJigsaw77 (he's the og author for this code) @@ -75,35 +74,24 @@ class Main extends Sprite instance = this; - if (stage != null) - { - init(); - } - else - { - addEventListener(Event.ADDED_TO_STAGE, init); - } + if (stage != null) init(); + else addEventListener(Event.ADDED_TO_STAGE, init); } - private function init(?E:Event):Void - { + private function init(?E:Event):Void { if (hasEventListener(Event.ADDED_TO_STAGE)) - { removeEventListener(Event.ADDED_TO_STAGE, init); - } setupGame(); var timer = new haxe.Timer(1); - timer.run = function() - { + timer.run = () -> { coloring(); if (fpsVar.textColor == 0) fpsVar.textColor = -4775566; } // needs to be done because textcolor beco } - private function setupGame():Void - { + private function setupGame():Void { final stageWidth:Int = Lib.current.stage.stageWidth; final stageHeight:Int = Lib.current.stage.stageHeight; @@ -130,8 +118,7 @@ class Main extends Sprite addChild(fpsVar); Lib.current.stage.align = "tl"; Lib.current.stage.scaleMode = StageScaleMode.NO_SCALE; - if(fpsVar != null) - fpsVar.visible = ClientPrefs.data.showFPS; + if (fpsVar != null) fpsVar.visible = ClientPrefs.data.showFPS; #end #if linux @@ -139,29 +126,18 @@ class Main extends Sprite Lib.current.stage.window.setIcon(icon); #end - #if html5 - FlxG.autoPause = false; - FlxG.mouse.visible = false; - #end + #if html5 FlxG.autoPause = FlxG.mouse.visible = false; #end - #if (CRASH_HANDLER && !hl) - Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onCrash); - #end - #if (CRASH_HANDLER && hl) - hl.Api.setErrorHandler(onCrash); - #end - - #if desktop - DiscordClient.start(); - #end + #if (CRASH_HANDLER && !hl) Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onCrash); #end + #if (CRASH_HANDLER && hl) hl.Api.setErrorHandler(onCrash); #end + #if desktop DiscordClient.start(); #end // shader coords fix - FlxG.signals.gameResized.add(function (w, h) { + FlxG.signals.gameResized.add((w, h) -> { if (FlxG.cameras != null) { for (cam in FlxG.cameras.list) { @:privateAccess - if (cam != null && cam.filters != null) - resetSpriteCache(cam.flashSprite); + if (cam != null && cam.filters != null) resetSpriteCache(cam.flashSprite); } } @@ -189,27 +165,23 @@ class Main extends Sprite var currentColor = 0; // Event Handlers - public function coloring():Void - { - // Hippity, Hoppity, your code is now my property (from KadeEngine) - if (ClientPrefs.data.fpsRainbow) - { + public function coloring():Void { + // Hippity, Hoppity, your code is now my property (from Kade Engine) + if (ClientPrefs.data.fpsRainbow) { + fpsVar.isRainbow = true; if (currentColor >= array.length) currentColor = 0; currentColor = Math.round(FlxMath.lerp(0, array.length, skippedFrames / ClientPrefs.data.framerate)); (cast(Lib.current.getChildAt(0), Main)).changeFPSColor(array[currentColor]); currentColor++; skippedFrames++; - if (skippedFrames > ClientPrefs.data.framerate) - skippedFrames = 0; - } - else + if (skippedFrames > ClientPrefs.data.framerate) skippedFrames = 0; + } else { + fpsVar.isRainbow = false; fpsVar.textColor = FlxColor.fromRGB(255, 255, 255); + } } - public function changeFPSColor(color:FlxColor) - { - fpsVar.textColor = color; - } + public function changeFPSColor(color:FlxColor) fpsVar.textColor = color; static function resetSpriteCache(sprite:Sprite):Void { @:privateAccess { diff --git a/source/backend/ClientPrefs.hx b/source/backend/ClientPrefs.hx index 392cb98..ea5ac51 100644 --- a/source/backend/ClientPrefs.hx +++ b/source/backend/ClientPrefs.hx @@ -4,7 +4,7 @@ import flixel.util.FlxSave; import flixel.input.keyboard.FlxKey; import flixel.input.gamepad.FlxGamepadInputID; -import states.TitleState; +import states.StartingState; // Add a variable here and it will get automatically saved @:structInit class SaveVariables { @@ -256,15 +256,15 @@ class ClientPrefs { } public static function reloadVolumeKeys() { - TitleState.muteKeys = keyBinds.get('volume_mute').copy(); - TitleState.volumeDownKeys = keyBinds.get('volume_down').copy(); - TitleState.volumeUpKeys = keyBinds.get('volume_up').copy(); + StartingState.muteKeys = keyBinds.get('volume_mute').copy(); + StartingState.volumeDownKeys = keyBinds.get('volume_down').copy(); + StartingState.volumeUpKeys = keyBinds.get('volume_up').copy(); toggleVolumeKeys(true); } public static function toggleVolumeKeys(?turnOn:Bool = true) { - FlxG.sound.muteKeys = turnOn ? TitleState.muteKeys : []; - FlxG.sound.volumeDownKeys = turnOn ? TitleState.volumeDownKeys : []; - FlxG.sound.volumeUpKeys = turnOn ? TitleState.volumeUpKeys : []; + FlxG.sound.muteKeys = turnOn ? StartingState.muteKeys : []; + FlxG.sound.volumeDownKeys = turnOn ? StartingState.volumeDownKeys : []; + FlxG.sound.volumeUpKeys = turnOn ? StartingState.volumeUpKeys : []; } } diff --git a/source/backend/CoolUtil.hx b/source/backend/CoolUtil.hx index e23fb04..af4e16d 100644 --- a/source/backend/CoolUtil.hx +++ b/source/backend/CoolUtil.hx @@ -1,6 +1,7 @@ package backend; import flixel.FlxBasic; +import flixel.FlxObject; //import flixel.util.FlxSave; //import flixel.math.FlxPoint; @@ -10,6 +11,12 @@ import lime.utils.Assets as LimeAssets; using StringTools; +enum SlideCalcMethod +{ + SIN; + COS; +} + class CoolUtil { public static function makeOutlinedGraphic(Width:Int, Height:Int, Color:Int, LineThickness:Int, OutlineColor:Int){ @@ -87,6 +94,9 @@ class CoolUtil return daList; } + inline public static function removeFromString(remove:String = "", string:String = "") + return string.replace(remove, ""); + public static function removeDuplicates(string:Array):Array { var tempArray:Array = new Array(); var lastSeen:String = null; @@ -120,17 +130,56 @@ class CoolUtil return endResult; } - inline public static function dominantColor(sprite:flixel.FlxSprite):Int + /** + * Pablooooooo + * @param amplitude + * @param calcMethod + * @param slowness + * @param delayIndex + * @param offset + * @return Float + */ + public static function slideEffect(amplitude:Float, calcMethod:SlideCalcMethod, slowness:Float = 1, delayIndex:Float = 0, ?offset:Float):Float { + if (slowness < 0) slowness = 1; + var slider:Float = (FlxG.sound.music.time / 1000) * (Conductor.bpm / 60); + + var slideValue:Float; + + switch (calcMethod) { + case SIN: slideValue = offset + amplitude * Math.sin(((slider + delayIndex) / slowness) * Math.PI); + case COS: slideValue = offset + amplitude * Math.cos(((slider + delayIndex) / slowness) * Math.PI); + } + + return slideValue; + } + + inline public static function GCD(a, b) + return b == 0 ? FlxMath.absInt(a) : GCD(b, a % b); + + inline public static function closest2Multiple(num:Float) + return Math.floor(num/2)*2; + + public static function addZeros(v:String, length:Int, end:Bool = false) { + var r = v; + while(r.length < length) + r = end ? r + '0': '0$r'; + return r; + } + + public static function objectCenter(object:FlxObject, target:FlxObject, axis:FlxAxes = XY) { + if (axis == XY || axis == X) object.x = target.x + target.width / 2 - object.width / 2; + if (axis == XY || axis == Y) object.y = target.y + target.height / 2 - object.height / 2; + } + + inline public static function dominantColor(sprite:flixel.FlxSprite):Int { final countByColor:Map = []; for(col in 0...sprite.frameWidth) { for(row in 0...sprite.frameHeight) { final colorOfThisPixel:Int = sprite.pixels.getPixel32(col, row); if(colorOfThisPixel != 0) { - if(countByColor.exists(colorOfThisPixel)) - countByColor[colorOfThisPixel] = countByColor[colorOfThisPixel] + 1; - else if(countByColor[colorOfThisPixel] != 13520687 - (2*13520687)) - countByColor[colorOfThisPixel] = 1; + if(countByColor.exists(colorOfThisPixel)) countByColor[colorOfThisPixel] = countByColor[colorOfThisPixel] + 1; + else if(countByColor[colorOfThisPixel] != 13520687 - (2*13520687)) countByColor[colorOfThisPixel] = 1; } } } diff --git a/source/cutscenes/DialogueBoxPsych.hx b/source/cutscenes/DialogueBoxPsych.hx index 5ea4742..3a6e9c1 100644 --- a/source/cutscenes/DialogueBoxPsych.hx +++ b/source/cutscenes/DialogueBoxPsych.hx @@ -6,8 +6,6 @@ import objects.TypedAlphabet; import cutscenes.DialogueCharacter; import psychlua.LuaUtils; -// Gonna try to kind of make it compatible to Forever Engine, -// love u Shubs no homo :flushedh4: typedef DialogueFile = { var dialogue:Array; diff --git a/source/import.hx b/source/import.hx index 0307edf..49eca6d 100644 --- a/source/import.hx +++ b/source/import.hx @@ -56,6 +56,12 @@ import objects.Alphabet; import objects.BGSprite; import states.PlayState; import states.LoadingState; +import states.StartingState; +import states.FreeplayState; +import states.SaveFileState; +import states.CreditsState; +import states.MainMenuState; +import states.CharacterSelectionState; // Flixel #if (flixel >= "5.3.0") diff --git a/source/openfl/display/FPS.hx b/source/openfl/display/FPS.hx index a5c43fd..fcbb139 100644 --- a/source/openfl/display/FPS.hx +++ b/source/openfl/display/FPS.hx @@ -39,6 +39,8 @@ class FPS extends TextField public var memoryMegas:Float = 0; public var memoryTotal:Float = 0; + public var isRainbow:Bool= false; + public var borderSize:Int = 1; // border code by @raltyro and @sayofthelor, taken from psike engine mcuz i diff --git a/source/shaders/FunkScop.hx b/source/shaders/FunkScop.hx new file mode 100644 index 0000000..51ed103 --- /dev/null +++ b/source/shaders/FunkScop.hx @@ -0,0 +1,102 @@ +package shaders; + +import flixel.system.FlxAssets.FlxShader; + +class FunkScopShader extends FlxShader { + @:glFragmentSource(" + #pragma header + + // https://www.shadertoy.com/view/tsfXWj + + uniform vec3 iResolution; + + uniform vec4 iMouse; + + uniform sampler2D iChannel0; + + const vec2 maxResLuminance = vec2(333.0, 480.0); + const vec2 maxResChroma = vec2(40.0, 480.0); + + vec2 rotate(vec2 v, float a) + { + float s = sin(a); + float c = cos(a); + mat2 m = mat2(c, -s, s, c); + return m * v; + } + + vec4 cubic(float v){ + vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v; + vec4 s = n * n * n; + float x = s.x; + float y = s.y - 4.0 * s.x; + float z = s.z - 4.0 * s.y + 6.0 * s.x; + float w = 6.0 - x - y - z; + return vec4(x, y, z, w) * (1.0/6.0); + } + + vec4 textureBicubic(sampler2D sampler, vec2 texCoords){ + vec2 textureSize = openfl_TextureSize; + + vec2 texSize = textureSize(sampler, 0); + vec2 invTexSize = 1.0 / texSize; + + texCoords = texCoords * texSize - 0.5; + + vec2 fxy = fract(texCoords); + texCoords -= fxy; + + vec4 xcubic = cubic(fxy.x); + vec4 ycubic = cubic(fxy.y); + + vec4 c = texCoords.xxyy + vec2 (-0.5, +1.5).xyxy; + + vec4 s = vec4(xcubic.xz + xcubic.yw, ycubic.xz + ycubic.yw); + vec4 offset = c + vec4 (xcubic.yw, ycubic.yw) / s; + + offset *= invTexSize.xxyy; + + vec4 sample0 = texture2D(sampler, offset.xz); + vec4 sample1 = texture2D(sampler, offset.yz); + vec4 sample2 = texture2D(sampler, offset.xw); + vec4 sample3 = texture2D(sampler, offset.yw); + + float sx = s.x / (s.x + s.y); + float sy = s.z / (s.z + s.w); + + return mix( + mix(sample3, sample2, sx), mix(sample1, sample0, sx) + , sy); + } + + void main() + { + vec2 uv = openfl_TextureCoordv / iResolution.xy; + vec2 mouseNormalized = iMouse.xy / iResolution.xy; + + vec2 resLuminance = min(maxResLuminance, vec2(iResolution)); + vec2 resChroma = min(maxResChroma, vec2(iResolution)); + + vec2 uvLuminance = uv * (resLuminance / vec2(iResolution)); + vec2 uvChroma = uv * (resChroma / vec2(iResolution)); + + vec3 result; + + if (uv.x > mouseNormalized.x) + { + float luminance = textureBicubic(iChannel1, uvLuminance).x; + vec2 chroma = textureBicubic(iChannel1, uvChroma).yz; + result = vec3(luminance, chroma) * yiq2rgb; + } + else + { + result = texture2D(iChannel0, uv).rgb; + } + + fragColor = vec4(result, 1); + }") + + public function new(){ + super(); + } +} \ No newline at end of file diff --git a/source/shaders/openfl8/MosaicEffect.hx b/source/shaders/openfl8/MosaicEffect.hx new file mode 100644 index 0000000..e716385 --- /dev/null +++ b/source/shaders/openfl8/MosaicEffect.hx @@ -0,0 +1,27 @@ +package shaders.openfl8; + +import flixel.system.FlxAssets.FlxShader; + +/** + * A classic mosaic effect, just like in the old days! + * + * Usage notes: + * - The effect will be applied to the whole screen. + * - Set the x/y-values on the 'uBlocksize' vector to the desired size (setting this to 0 will make the screen go black) + */ +class MosaicShader extends FlxShader +{ + @:glFragmentSource(' + #pragma header + uniform vec2 uBlocksize; + + void main() + { + vec2 blocks = openfl_TextureSize / uBlocksize; + gl_FragColor = flixel_texture2D(bitmap, floor(openfl_TextureCoordv * blocks) / blocks); + }') + public function new() + { + super(); + } +} \ No newline at end of file diff --git a/source/states/FlashingState.hx b/source/states/FlashingState.hx index 053f1c6..005b2a8 100644 --- a/source/states/FlashingState.hx +++ b/source/states/FlashingState.hx @@ -5,16 +5,26 @@ import flixel.FlxSubState; import flixel.effects.FlxFlicker; import lime.app.Application; import flixel.addons.transition.FlxTransitionableState; +import tjson.TJSON as Json; + +/*typedef FlashingData = { + warningText:String, + font:String +}*/ class FlashingState extends MusicBeatState { public static var leftState:Bool = false; var warnText:FlxText; - override function create() - { + // var flashJSON:FlashingData; + + override function create() { super.create(); + // IGNORE THIS!!! + // flashJSON = Json.parse(Paths.getTextFromFile('data/warnText.json')); + var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); add(bg); @@ -24,21 +34,20 @@ class FlashingState extends MusicBeatState Press ENTER to disable them now or go to Options Menu.\n Press ESCAPE to ignore this message.\n You've been warned!", + //flashJSON.warningText, 32); - warnText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, CENTER); + warnText.setFormat(Paths.font(/*flashJSON.font*/"vcr.ttf"), 32, FlxColor.WHITE, CENTER); warnText.screenCenter(Y); add(warnText); } - override function update(elapsed:Float) - { + override function update(elapsed:Float) { if(!leftState) { - var back:Bool = controls.BACK; - if (controls.ACCEPT || back) { + if (controls.ACCEPT || controls.BACK) { leftState = true; FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - if(!back) { + if(!controls.BACK) { ClientPrefs.data.flashing = false; ClientPrefs.saveSettings(); FlxG.sound.play(Paths.sound('confirmMenu')); diff --git a/source/states/SaveFileState.hx b/source/states/SaveFileState.hx index 07d2e1a..3b1f0ed 100644 --- a/source/states/SaveFileState.hx +++ b/source/states/SaveFileState.hx @@ -1,10 +1,11 @@ package states; // taken from vs marcello -import Controls; +import backend.Controls; import openfl.Lib; import flash.text.TextField; import flixel.FlxG; +import backend.Highscore; import flixel.FlxSprite; import flixel.addons.display.FlxGridOverlay; import flixel.group.FlxGroup.FlxTypedGroup; @@ -37,6 +38,8 @@ class SaveFileState extends MusicBeatState { Paths.clearStoredMemory(); Paths.clearUnusedMemory(); + #if desktop DiscordClient.changePresence("Picking a Save File", null); #end + var menuBG:FlxSprite = new FlxSprite().loadGraphic(Paths.image('menuDesat')); for (i in 0...3) { @@ -107,7 +110,13 @@ class SaveFileState extends MusicBeatState { saveFile.bind("VsFoxaSaves" + Std.string(curSelected), "saves"); saveFile.data.init = true; saveFile.flush(); - Highscore.load(); + try { + Highscore.load(); + } + catch (e:Dynamic) { // youre not gonna work + trace('FUCK YOU'); + Highscore.load(); + } FlxG.switchState(() -> new MainMenuState()); }); } diff --git a/source/states/StartingState.hx b/source/states/StartingState.hx new file mode 100644 index 0000000..dd407e7 --- /dev/null +++ b/source/states/StartingState.hx @@ -0,0 +1,69 @@ +package states; + +import cppthing.WindowsData; +import backend.WeekData; +import backend.Highscore; +import backend.ButtplugUtils; +import flixel.input.keyboard.FlxKey; +import flixel.addons.transition.FlxTransitionableState; +import states.StoryMenuState; + +class StartingState extends MusicBeatState { + public static var muteKeys:Array = [FlxKey.ZERO]; + public static var volumeDownKeys:Array = [FlxKey.NUMPADMINUS, FlxKey.MINUS]; + public static var volumeUpKeys:Array = [FlxKey.NUMPADPLUS, FlxKey.PLUS]; + + override public function create():Void { + Paths.clearStoredMemory(); + + _setupButtPlug(100); + + // FlxG.fixedTimestep = false; + FlxG.game.focusLostFramerate = 60; + FlxG.keys.preventDefaultKeys = [TAB]; + + _loadShits(); + + FlxG.mouse.visible = false; + + if(FlxG.save.data.flashing == null && !FlashingState.leftState) { + FlxTransitionableState.skipNextTransIn = true; + FlxTransitionableState.skipNextTransOut = true; + FlxG.switchState(() -> new FlashingState()); + } else { + FlxG.switchState(() -> new TitleState()); + } + } + + public function _loadShits() { + _setupMods(); + + FlxG.save.bind(#if STORY_EDITION 'vsfoxastory' #else 'vsfoxav3' #end, CoolUtil.getSavePath()); + ClientPrefs.loadPrefs(); + + /* + you stupid + no im not + whats 9 + 10 + 21 + you stupid + */ + + // Highscore.load(); + + if (FlxG.save.data != null && ClientPrefs.data.fullscreen) FlxG.fullscreen = ClientPrefs.data.fullscreen; + if (FlxG.save.data.weekCompleted != null) states.StoryMenuState.weekCompleted = FlxG.save.data.weekCompleted; + if (FlxG.save.data.unlockedCharacters == null) FlxG.save.data.unlockedCharacters = ["Boyfriend", "Foxa (Lesson)"]; + if (FlxG.save.data.weekCompleted != null) StoryMenuState.weekCompleted = FlxG.save.data.weekCompleted; + } + + public function _setupMods() { + #if LUA_ALLOWED Mods.pushGlobalMods(); #end + Mods.loadTopMod(); + } + + public function _setupButtPlug(intensity:Int = 100) { + ButtplugUtils.set_intensity(intensity); + ButtplugUtils.initialise(); + } +} diff --git a/source/states/ThanksState.hx b/source/states/ThanksState.hx index 29335df..d3c1bd8 100644 --- a/source/states/ThanksState.hx +++ b/source/states/ThanksState.hx @@ -7,6 +7,7 @@ import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; import flixel.util.FlxColor; import flixel.util.FlxTimer; +import flixel.effects.FlxFlicker; using StringTools; @@ -21,6 +22,8 @@ class ThanksState extends MusicBeatState { '#594465' ]; + var txt:FlxText; + override function create(){ #if desktop DiscordClient.changePresence("Thanks Menu", null); #end @@ -37,13 +40,13 @@ class ThanksState extends MusicBeatState { FlxTween.tween(grid, {alpha: 1}, 0.5, {ease: FlxEase.quadOut}); #if debug - var txt:FlxText = new FlxText(0, 0, FlxG.width, - "Thanks for playing Vs. Foxa 3.0!\nYou are on a Developer Build.\nIf you were given this by someone who isn't a dev/playtester,\nplease contact one of the devs at Foxacord.\n(https://discord.gg/FARpwR9K4k)" + txt = new FlxText(0, 0, FlxG.width, + "Thanks for playing Vs. Foxa SE 3.0!\nYou are on a Developer Build.\nIf you were given this by someone who isn't a dev/playtester,\nplease contact one of the devs at Foxacord.\n(https://discord.gg/FARpwR9K4k)" + "\n\nPress Enter to continue.", 32); #else - var txt:FlxText = new FlxText(0, 0, FlxG.width, - "Thanks for playing Vs. Foxa 3.0!\nWe have worked hard on this for long, \nand we appreciate you playing the mod!" + txt = new FlxText(0, 0, FlxG.width, + "Thanks for playing Vs. Foxa SE 3.0!\nWe have worked hard on this for long, \nand we appreciate you playing the mod!" + "\n\nPress Enter to continue.", 32); #end @@ -72,12 +75,32 @@ class ThanksState extends MusicBeatState { override function update(elapsed:Float){ if(controls.ACCEPT || controls.BACK){ - FlxG.sound.play(Paths.sound('confirmMenu'), 0.4); - try { - FlxG.switchState(() -> new states.SaveFileState()); - } - catch (e:Dynamic) { - FlxG.switchState(() -> new states.MainMenuState()); + if(!controls.BACK) { + FlxG.sound.play(Paths.sound('confirmMenu'), 0.4); + FlxFlicker.flicker(txt, 1, 0.1, false, true, function(flk:FlxFlicker) { + new FlxTimer().start(0.5, function (tmr:FlxTimer) { + try { + FlxG.switchState(() -> new states.SaveFileState()); + } + catch (e:Dynamic) { + trace('nice save file, but unfortunately- ${e}'); + FlxG.switchState(() -> new states.MainMenuState()); + } + }); + }); + } else { + FlxG.sound.play(Paths.sound('cancelMenu'), 0.4); + FlxTween.tween(txt, {alpha: 0}, 1, { + onComplete: function (twn:FlxTween) { + try { + FlxG.switchState(() -> new states.TitleState()); + } + catch (e:Dynamic) { + trace('nice argument, but unfortunately- ${e}'); + FlxG.switchState(() -> new states.MainMenuState()); + } + } + }); } } diff --git a/source/states/TitleState.hx b/source/states/TitleState.hx index 1bcdd26..e61ffc9 100644 --- a/source/states/TitleState.hx +++ b/source/states/TitleState.hx @@ -42,15 +42,15 @@ typedef TitleData = { versiontext:String, friday:String, night:String, - funkin:String + funkin:String, + ngtext:String, + noAssociate:Bool, + logoHover:Bool, + showThanks:Bool } class TitleState extends MusicBeatState { - public static var muteKeys:Array = [FlxKey.ZERO]; - public static var volumeDownKeys:Array = [FlxKey.NUMPADMINUS, FlxKey.MINUS]; - public static var volumeUpKeys:Array = [FlxKey.NUMPADPLUS, FlxKey.PLUS]; - - public static var initialized:Bool = false; + public static var initialized:Bool = false; var blackScreen:FlxSprite; var credGroup:FlxGroup; @@ -81,26 +81,10 @@ class TitleState extends MusicBeatState { { Paths.clearStoredMemory(); - #if LUA_ALLOWED - Mods.pushGlobalMods(); - #end - Mods.loadTopMod(); - - ButtplugUtils.set_intensity(100); - ButtplugUtils.initialise(); - - // FlxG.fixedTimestep = false; - FlxG.game.focusLostFramerate = 60; - FlxG.keys.preventDefaultKeys = [TAB]; - curWacky = FlxG.random.getObject(getIntroTextShit()); super.create(); - FlxG.save.bind('funkin', CoolUtil.getSavePath()); - - ClientPrefs.loadPrefs(); - #if CHECK_FOR_UPDATES if(ClientPrefs.data.checkForUpdates && !closedState) { trace('checking for update'); @@ -125,8 +109,6 @@ class TitleState extends MusicBeatState { } #end - Highscore.load(); - // IGNORE THIS!!! titleJSON = Json.parse(Paths.getTextFromFile('images/gfDanceTitle.json')); @@ -148,34 +130,18 @@ class TitleState extends MusicBeatState { if(!initialized) { - if (FlxG.save.data != null && ClientPrefs.data.fullscreen) FlxG.fullscreen = ClientPrefs.data.fullscreen; - if(FlxG.save.data.weekCompleted != null) states.StoryMenuState.weekCompleted = FlxG.save.data.weekCompleted; - if(FlxG.save.data.unlockedCharacters == null) FlxG.save.data.unlockedCharacters = ["Boyfriend", "Foxa (Lesson)"]; persistentUpdate = true; persistentDraw = true; } - if (FlxG.save.data.weekCompleted != null) + if (initialized) + startIntro(); + else { - StoryMenuState.weekCompleted = FlxG.save.data.weekCompleted; - } - - FlxG.mouse.visible = false; - - if(FlxG.save.data.flashing == null && !FlashingState.leftState) { - FlxTransitionableState.skipNextTransIn = true; - FlxTransitionableState.skipNextTransOut = true; - FlxG.switchState(() -> new FlashingState()); - } else { - if (initialized) - startIntro(); - else + new FlxTimer().start(1, function(tmr:FlxTimer) { - new FlxTimer().start(1, function(tmr:FlxTimer) - { - startIntro(); - }); - } + startIntro(); + }); } } @@ -302,8 +268,11 @@ class TitleState extends MusicBeatState { engineVersionText.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); add(engineVersionText); + if (titleJSON.logoHover) + { 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); @@ -447,7 +416,8 @@ class TitleState extends MusicBeatState { if (mustUpdate) { FlxG.switchState(() -> new OutdatedState()); } else { - FlxG.switchState(() -> new ThanksState()); + if (titleJSON.showThanks) FlxG.switchState(() -> new ThanksState()); + else FlxG.switchState(() -> new MainMenuState()); } closedState = true; }); @@ -595,12 +565,13 @@ class TitleState extends MusicBeatState { deleteCoolText(); case 6: #if ALLEYWAY_WATERMARKS - createCoolText(['Not associated', 'with'], -40); + if (titleJSON.noAssociate) createCoolText(['Not associated', 'with'], -40); + else createCoolText(['In association', 'with'], -40); #else createCoolText(['In association', 'with'], -40); #end case 8: - addMoreText('newgrounds', -40); + addMoreText(titleJSON.ngtext, -40); ngSpr.visible = true; case 9: deleteCoolText();