diff --git a/assets/preload/data/roses/rosesDialogue.txt b/assets/preload/data/roses/dialogue.txt similarity index 98% rename from assets/preload/data/roses/rosesDialogue.txt rename to assets/preload/data/roses/dialogue.txt index c519763..63a60f8 100644 --- a/assets/preload/data/roses/rosesDialogue.txt +++ b/assets/preload/data/roses/dialogue.txt @@ -1,3 +1,3 @@ -:dad:Not bad for an ugly worm. -:dad:But this time I'll rip your nuts off right after your girlfriend finishes gargling mine. +:dad:Not bad for an ugly worm. +:dad:But this time I'll rip your nuts off right after your girlfriend finishes gargling mine. :bf:Bop beep be be skdoo bep \ No newline at end of file diff --git a/assets/preload/data/senpai/senpaiDialogue.txt b/assets/preload/data/senpai/dialogue.txt similarity index 98% rename from assets/preload/data/senpai/senpaiDialogue.txt rename to assets/preload/data/senpai/dialogue.txt index aa30163..af03e37 100644 --- a/assets/preload/data/senpai/senpaiDialogue.txt +++ b/assets/preload/data/senpai/dialogue.txt @@ -1,3 +1,3 @@ -:dad:Ah, a new fair maiden has come in search of true love! -:dad:A serenade between gentlemen shall decide where her beautiful heart shall reside. +:dad:Ah, a new fair maiden has come in search of true love! +:dad:A serenade between gentlemen shall decide where her beautiful heart shall reside. :bf:Beep bo bop \ No newline at end of file diff --git a/assets/preload/data/thorns/thornsDialogue.txt b/assets/preload/data/thorns/dialogue.txt similarity index 98% rename from assets/preload/data/thorns/thornsDialogue.txt rename to assets/preload/data/thorns/dialogue.txt index 82a7ae9..b430202 100644 --- a/assets/preload/data/thorns/thornsDialogue.txt +++ b/assets/preload/data/thorns/dialogue.txt @@ -1,5 +1,5 @@ -:dad:Direct contact with real humans, after being trapped in here for so long... -:dad:and HER of all people. -:dad:I'll make her father pay for what he's done to me and all the others,,,, -:dad:I'll beat you and make you take my place. +:dad:Direct contact with real humans, after being trapped in here for so long... +:dad:and HER of all people. +:dad:I'll make her father pay for what he's done to me and all the others,,,, +:dad:I'll beat you and make you take my place. :dad:You don't mind your bodies being borrowed right? It's only fair... \ No newline at end of file diff --git a/source/Alphabet.hx b/source/Alphabet.hx index dc3484a..b1f75cd 100644 --- a/source/Alphabet.hx +++ b/source/Alphabet.hx @@ -1,5 +1,6 @@ package; +import flixel.math.FlxPoint; import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; import flixel.FlxG; @@ -285,32 +286,31 @@ class Alphabet extends FlxSpriteGroup // ThatGuy: Ooga booga function for resizing text, with the option of wanting it to have the same midPoint // Side note: Do not, EVER, do updateHitbox() unless you are retyping the whole thing. Don't know why, but the position gets retarded if you do that public function resizeText(xScale:Float, yScale:Float, xStaysCentered:Bool = true, yStaysCentered:Bool = false):Void { - var oldWidth:Float = this.width; - var oldHeight:Float = this.height; - //trace('old x before scaling: ' + this.x); - //trace('old midpoint before scaling: ' + this.getMidpoint().x); + var oldMidpoint:FlxPoint = this.getMidpoint(); reType(text, xScale, yScale); - //trace('old x after scaling: ' + this.x); - //trace('old midpoint after scaling: ' + this.getMidpoint().x); - //This works, commenting out all the tracing - if(xStaysCentered) { - /* - If oldX is the old position, that is the same for both sizes of text, e.g. oldX = 50 - And oldWidth is the old width of the text, e.g. oldWidth = 100 - And newWidth is the current width of the text, e.g. newWidth= 150 - And the midpoint, is always the same, e.g. midpoint = oldX + oldWidth/2 = 50 + 100/2 = 100 - and the newMidpoint, which is equal to midpoint, is newX + newWidth/2, then - newX = midpoint - newWidth/2 <=> newX = oldX + oldWidth/2 - newWidth/2, e.g., <=> newX = 50 + 100/2 - 150/2 <=> newX = 25 - */ - //Since this.x doesnt change with text scaling, in this equation, this.x can be used as both the old and the new x - this.x = this.x + oldWidth/2 - this.width/2; - //trace('new x after scaling: ' + this.x); - //trace('new midpoint after scaling: ' + this.getMidpoint().x); - } - if(yStaysCentered) { - // Same logic applies here - this.y = this.y + oldHeight/2 - this.height/2; + if(!(xStaysCentered && yStaysCentered)){ + if(xStaysCentered) { + //I can just use this juicy new function i made + moveTextToMidpoint(new FlxPoint(oldMidpoint.x, getMidpoint().y)); + } + if(yStaysCentered) { + moveTextToMidpoint(new FlxPoint(getMidpoint().x, oldMidpoint.y)); + } + } else { + moveTextToMidpoint(new FlxPoint(oldMidpoint.x, oldMidpoint.y)); } + + } + + // ThatGuy: Function used to keep text centered on one point instead of manually having to come up with offsets for each sentence + public function moveTextToMidpoint(midpoint:FlxPoint):Void { + /* + e.g. You want your midpoint at (100, 100) + and your text is 200 wide, 50 tall + then, x = 100 - 200/2, y = 100 - 50/2 + */ + this.x = midpoint.x - this.width / 2; + this.y = midpoint.y - this.height / 2; } } diff --git a/source/GameOverState.hx b/source/GameOverState.hx index 905500d..373fc5c 100644 --- a/source/GameOverState.hx +++ b/source/GameOverState.hx @@ -61,6 +61,16 @@ class GameOverState extends FlxTransitionableState var gamepad:FlxGamepad = FlxG.gamepads.lastActive; + if(FlxG.save.data.InstantRespawn) + { + fading = true; + FlxG.sound.music.fadeOut(0.5, 0, function(twn:FlxTween) + { + FlxG.sound.music.stop(); + LoadingState.loadAndSwitchState(new PlayState()); + }); + } + if (gamepad != null) { if (gamepad.justPressed.ANY) diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx index 5cef652..182ce8c 100644 --- a/source/GameOverSubstate.hx +++ b/source/GameOverSubstate.hx @@ -59,6 +59,11 @@ class GameOverSubstate extends MusicBeatSubstate endBullshit(); } + if(FlxG.save.data.InstantRespawn) + { + LoadingState.loadAndSwitchState(new PlayState()); + } + if (controls.BACK) { FlxG.sound.music.stop(); diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index b6edf9d..9131199 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -81,6 +81,9 @@ class KadeEngineData if (FlxG.save.data.resetButton == null) FlxG.save.data.resetButton = false; + + if (FlxG.save.data.InstantRespawn == null) + FlxG.save.data.InstantRespawn = false; if (FlxG.save.data.botplay == null) FlxG.save.data.botplay = false; diff --git a/source/Options.hx b/source/Options.hx index 0a7f8ef..4994443 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -307,6 +307,27 @@ class ResetButtonOption extends Option } } +class InstantRespawn extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + + public override function press():Bool + { + FlxG.save.data.InstantRespawn = !FlxG.save.data.InstantRespawn; + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return "Instant Respawn " + (!FlxG.save.data.InstantRespawn ? "off" : "on"); + } +} + class FlashingLightsOption extends Option { public function new(desc:String) diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index cf5199e..95454c8 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -36,6 +36,7 @@ class OptionsMenu extends MusicBeatState new ScrollSpeedOption("Change your scroll speed. (1 = Chart dependent)"), new AccuracyDOption("Change how accuracy is calculated. (Accurate = Simple, Complex = Milisecond Based)"), new ResetButtonOption("Toggle pressing R to gameover."), + new InstantRespawn("Toggle if you instantly respawn after dying."), // new OffsetMenu("Get a note offset based off of your inputs!"), new CustomizeGameplay("Drag and drop gameplay modules to your prefered positions!") ]), diff --git a/source/PlayState.hx b/source/PlayState.hx index 6bf0b37..435688b 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -456,32 +456,11 @@ class PlayState extends MusicBeatState trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay); - // dialogue shit - switch (songLowercase) + switch(songLowercase) { - case 'tutorial': - dialogue = ["Hey you're pretty cute.", 'Use the arrow keys to keep up \nwith me singing.']; - case 'bopeebo': - dialogue = [ - 'HEY!', - "You think you can just sing\nwith my daughter like that?", - "If you want to date her...", - "You're going to have to go \nthrough ME first!" - ]; - case 'fresh': - dialogue = ["Not too shabby boy.", ""]; - case 'dadbattle': - dialogue = [ - "gah you think you're hot stuff?", - "If you can beat me here...", - "Only then I will even CONSIDER letting you\ndate my daughter!" - ]; - case 'senpai': - dialogue = CoolUtil.coolTextFile(Paths.txt('data/senpai/senpaiDialogue')); - case 'roses': - dialogue = CoolUtil.coolTextFile(Paths.txt('data/roses/rosesDialogue')); - case 'thorns': - dialogue = CoolUtil.coolTextFile(Paths.txt('data/thorns/thornsDialogue')); + //if the song has dialogue, so we don't accidentally try to load a nonexistant file and crash the game + case 'senpai' | 'roses' | 'thorns': + dialogue = CoolUtil.coolTextFile(Paths.txt('data/' + songLowercase + '/dialogue')); } // defaults if no stage was found in chart