From 32bdef492a6927cb00ecc240adc739ecde30f86b Mon Sep 17 00:00:00 2001 From: Vortex <73261680+Vortex2Oblivion@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:42:43 -0500 Subject: [PATCH] fix bg color on state reset --- .../data/stage data/evil-school.json | 4 + .../images/icons/bf-pixel-icons.png | Bin 509 -> 426 bytes .../images/icons/senpai-angry-icons.png | Bin 615 -> 467 bytes .../images/icons/senpai-icons.png | Bin 582 -> 443 bytes source/states/OptionsMenu.hx | 29 +- source/states/PlayState.hx | 332 +++++++-------- source/states/StoryMenuState.hx | 1 + source/substates/GameOverSubstate.hx | 1 + source/ui/StickerSubState.hx | 382 ------------------ 9 files changed, 177 insertions(+), 572 deletions(-) delete mode 100644 source/ui/StickerSubState.hx diff --git a/mods/Friday Night Funkin'/data/stage data/evil-school.json b/mods/Friday Night Funkin'/data/stage data/evil-school.json index 6fa22ede81..786933578a 100644 --- a/mods/Friday Night Funkin'/data/stage data/evil-school.json +++ b/mods/Friday Night Funkin'/data/stage data/evil-school.json @@ -25,5 +25,9 @@ [325, 918], [645, 834] ], + "camera_Offsets": [ + [0, -150], + [0, 0] + ], "camera_Zoom": 1 } diff --git a/mods/Friday Night Funkin'/images/icons/bf-pixel-icons.png b/mods/Friday Night Funkin'/images/icons/bf-pixel-icons.png index 6b24228d63fccdd46c1670b183245af9aea2664e..13275075b36bbe33f8ba5d55fca8e0ec7419c1b2 100644 GIT binary patch delta 394 zcmV;50d@ZU1F8cVIEAuE3;Nklcpqj#B$vj6}907*qoM6N<$g80Lhk~DuXqfnFY%Q3et+V>ZR87?AMzqb9kM|EFp$xq zn`gLOW66i9+|}B0mdj_B7t%`IPh z>ZcUQoY{J7*fc{=@A$m*s&48TO)kwP26v`ZPd1C5TJm8|(W#@$MZmW4#NL>ln;+?} zJ!!Juzvb}<+U6{p;Kb$ZxA*7fsbBW(YcP%8U-v{uwLZNJ?A*1Y-_kBk=_>r)_m#Q4 zzW#n_gsSg8(JYX=d!lw&ZQh?>s~7X<{-2maZVQm_+H~fWUMQCRf6rj6C((t=K>lIl4*h9-y6^rDkc$qPOxLve tefjjpbF8yL?)zWaCBKIW7PbfEf3qE{*}|G@F5U_f^K|udS?83{1ONpH$KC({ diff --git a/mods/Friday Night Funkin'/images/icons/senpai-angry-icons.png b/mods/Friday Night Funkin'/images/icons/senpai-angry-icons.png index 6a753dd7a7d37701dfc34fe4b1cabb51ec5b979d..d85a02fa36060992a3da78f8aaaec14593c61c80 100644 GIT binary patch delta 423 zcmV;Y0a*U$1k(dUiBL{Q4GJ0x0000DNk~Le0001%0001%2m=5B01MxN&;S4c0drDE zLIAGL9O(c6010qNS#tmY4#NNd4#NS*Z>VIEAvb?SNkl7OW*%=H(3OkYWWEtkqd!(Oxb4Z#4YFf;BHor|MkPitD(0B@Gs=*;v&Jk+oi4 z#}JlU_h>L>!-91q%d$&YTgUa(mWyD)f~BQXi?BYx>AN~CSU0kEsd~z?=*QEu(`DUh z^I*ZcnUyoU&5CD|jz{To`V;~S)@&@bblY1-MM_sJt9r0t-OW;wvVNtK70aVvxUgW& z!Lmpy*Rl}7f;Ay)+<99Ef(2_amex((gSQD-uoh?KLT&S4!Gc9ZL`3ww{s1k^pt~)0 R4n_a~002ovPDHLkV1mfZzP?pm=?BahxVu#3|iPIYSelV0(H@~}PkR@lGHtTiD(S1EOAtkPIA;gEM=<$lxM{EmUHimf7XUWpv;&&4j9 z@;;Y=C_LQya;t%V{bHYBki6NFSrz-a=kJ-d)9GSs!G(}O51^pdichxBPFZ%ZxpRKW z!y1U-t5u!fn-_FEOWRr@7+a;qrMYB7C(B;IXnd4Ww?Z76V=^H(s zP6_}SbXIhl^2J@&7r)nbgjAP!infXb-EepqdrxnFYW>Av`Io!)&ip=m^TDMn7EN&C z+RAEY8qPCUC^ck?oku^}P6%jMs1f0_~U`GxXT^XFj8Cmi~(p<}(e z^6je9-G7uV13_kMteEw~Ln@+K+a)e-^TQ|NN}F$nUVr=9_4LFQAag{5ubwNpd1~i` z!ii73>SZoJKU{Jd?B83h$(y%`+fREg9lLB#WQ%Z`w=dYZ)n1pg3S!gmbl(2)ZCTVz zZ&2tu-8}R`G>>1L+`9wanWwwizlbLEPvN(LbH-5WAOr kSReZ5z92Zt4&;AeOc9>LxXoo(m<340)78&qol`;+04OK_fB*mh diff --git a/mods/Friday Night Funkin'/images/icons/senpai-icons.png b/mods/Friday Night Funkin'/images/icons/senpai-icons.png index cf701374d4ea5f19bb7391a4a44f15f1cb165349..91ebcfd4d10b416257a8de0e911b996d34293a6c 100644 GIT binary patch delta 405 zcmX@cvYXktGr-TCmrII^fq{Y7)59eQNKXS{4rU<9eZTPnkYX$ja(7}_cTVOdki%Kv z5n0T@z;_sg8IR|$NSUZ;Sa0O%;uunK>+KCkzQYPUtQWVa?E61aJ3aZ!(-XbBIHt^$ zby{_w&2)nx2;4nw6R{yI;ijZcg!Tr$eEVkBY}RR&Z*?NVSh%nK-;gx-+T6&94bKu~ z)79R_{a&`=U=!=>>*x2)*dV^>P}+us-orr?nM!o8aq)0pJFq6n>0AqIcD>iMN=xTm z_u5&rv%+ix-z#2yDlfJsF!JjW<*tVtbEI@47H@pCr&M8Y6!+>)S%qqe2dgHe-c%HE z3(O1_)QQ-zB_v=&-UFRmK!?et$OiqA&$xK{^39jq{#|-@u<0wq>a=HTG*Vqpy}Aap z{@5!Wr5(SQWJm61=e~AXM^y8*?pDt=H`dK7NIWRjoH~7Lb!11vL8%F$-}kO%KG3uo+``67HIuXK~vKDTu+>mfk2?(Or^S?=L&QG<{+XW0&22WQ%mvv4FO#pA&t-SyM delta 545 zcmdnZe2hi0Gr-TCmrII^fq{Y7)59f*fr0T5kUfos8A$Gro2op~*|7e;r;B4q#jUq< z4YLj#NVwTvx#^o9P}OwmqfEz(7>_BIs*d07oj%InT=iy}p6*|fd(uKaADXvwJl*aj z1vCW&GRzFKR%tAmaOhTOq{*TcizYa6y>}Hobn*9f3DHoIAdiQ8MUGVz=1IiPjwreo z66m4WDk^@fdfE1+KEbYv^{padOR}6Tj!K8Wk5zk}WRndt%8AP~B^#O!wSTSC*d4CNDB3C#6ft*|M8Z#(!q{CQ zAwY{0=eGV$vKMjcP(E$BYgv~Qm*$!U1=*LM>fCD++-=+9ysN=g0s;>yK=AP;FoOV~d)T0Qv+#IW$MpFh6p>2v{w zYGSU|;;osVA1#=;0_?NEshr07yq!+!q8#&Vl?7j2aBm$?uPAaDW6nUHx3v IIVCg!068Y@RsaA1 diff --git a/source/states/OptionsMenu.hx b/source/states/OptionsMenu.hx index 68a0456016..785d1b0cfc 100644 --- a/source/states/OptionsMenu.hx +++ b/source/states/OptionsMenu.hx @@ -1,32 +1,11 @@ package states; -import utilities.Options; -import substates.UISkinSelect; -import substates.ControlMenuSubstate; import utilities.MusicUtilities; import ui.Option; -import ui.Checkbox; -import flixel.group.FlxGroup; -import toolbox.ChartingState; -import toolbox.StageMakingState; -import flixel.sound.FlxSound; -import toolbox.CharacterCreator; -import utilities.Controls.Control; -import openfl.text.TextField; import flixel.FlxG; import flixel.FlxSprite; -import flixel.addons.display.FlxGridOverlay; import flixel.group.FlxGroup.FlxTypedGroup; -import flixel.input.keyboard.FlxKey; -import flixel.math.FlxMath; -import flixel.text.FlxText; -import flixel.util.FlxColor; -import lime.utils.Assets; -import ui.Alphabet; -import game.SongLoader; -import toolbox.StageMakingState; -import game.Highscore; -import openfl.utils.Assets as OpenFLAssets; +import openfl.utils.Assets; using utilities.BackgroundUtil; @@ -35,7 +14,7 @@ class OptionsMenu extends MusicBeatState { public var inMenu = false; - public var pages:Map> = [ + public var pages:Map> = [ "Categories" => [ new PageOption("Gameplay", "Gameplay", "Test Description"), new PageOption("Graphics", "Graphics"), @@ -111,8 +90,8 @@ class OptionsMenu extends MusicBeatState { new PageOption("Back", "Graphics"), new DisplayFontOption("Display Font", [ "_sans", - OpenFLAssets.getFont(Paths.font("vcr.ttf")).fontName, - OpenFLAssets.getFont(Paths.font("pixel.otf")).fontName + Assets.getFont(Paths.font("vcr.ttf")).fontName, + Assets.getFont(Paths.font("pixel.otf")).fontName ], "infoDisplayFont"), new BoolOption("FPS Counter", "fpsCounter"), diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 1f7b7b8d51..4f5e0e7981 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -73,159 +73,160 @@ import modcharting.PlayfieldRenderer; /** The main gameplay state. **/ +@:publicFields class PlayState extends MusicBeatState { /** Current instance of `PlayState`. **/ - public static var instance:PlayState = null; + static var instance:PlayState = null; /** The current stage in `PlayState`. **/ - public static var curStage:String = ''; + static var curStage:String = ''; /** Current song data in `PlayState`. **/ - public static var SONG:SongData; + static var SONG:SongData; /** `Bool` for whether we are currently in Story Mode. **/ - public static var isStoryMode:Bool = false; + static var isStoryMode:Bool = false; /** Current Story Mode week as an `Int`. (Generally unused / deprecated). **/ - public static var storyWeek:Int = 0; + static var storyWeek:Int = 0; /** `Array` of all the songs that you are going to play next in Story Mode as `String`. **/ - public static var storyPlaylist:Array = []; + static var storyPlaylist:Array = []; /** `String` representation of the current Story Mode difficulty. **/ - public static var storyDifficultyStr:String = "NORMAL"; + static var storyDifficultyStr:String = "NORMAL"; /** Total score over your current run in Story Mode. **/ - public static var campaignScore:Int = 0; + static var campaignScore:Int = 0; /** Title of current week in Story Mode. **/ - public static var campaignTitle:String; + static var campaignTitle:String; /** Vocal tracks for the current song as a `SoundGroup`. **/ - public var vocals:SoundGroup = new SoundGroup(2); + var vocals:SoundGroup = new SoundGroup(2); /** Your current opponent. **/ - public static var dad:Character; + static var dad:Character; /** The current character in the middle of the 3 main characters. **/ - public static var gf:Character; + static var gf:Character; /** The current player character. **/ - public static var boyfriend:Boyfriend; + static var boyfriend:Boyfriend; /** The current stage. **/ - public var stage:StageGroup; + var stage:StageGroup; /** `FlxTypedGroup` of all currently active notes in the game. **/ - public var notes:FlxTypedGroup; + var notes:FlxTypedGroup; /** `Array` of all the notes waiting to be spawned into the game (when their time comes to prevent lag). **/ - public var unspawnNotes:Array = []; + var unspawnNotes:Array = []; /** Simple `FlxSprite` to help represent the strum line the strums initially spawn at. **/ - public var strumLine:FlxSprite; + var strumLine:FlxSprite; /** `FlxTypedGroup` of all current strums (enemy strums are first). **/ - public static var strumLineNotes:FlxTypedGroup; + static var strumLineNotes:FlxTypedGroup; /** `FlxTypedGroup` of all current player strums. **/ - public static var playerStrums:FlxTypedGroup; + static var playerStrums:FlxTypedGroup; /** `FlxTypedGroup` of all current enemy strums. **/ - public static var enemyStrums:FlxTypedGroup; + static var enemyStrums:FlxTypedGroup; /** Simple `FlxObject` to store the camera's current position that it's following. **/ - public var camFollow:FlxObject; + var camFollow:FlxObject; /** * Should the camera be centered? */ - public var centerCamera:Bool = false; + var centerCamera:Bool = false; /** Copy of `camFollow` used for transitioning between songs smoother. **/ - public static var prevCamFollow:FlxObject; + static var prevCamFollow:FlxObject; /** `Bool` for whether or not the camera is currently zooming in and out to the song's beat. **/ - public var camZooming:Bool = false; + var camZooming:Bool = false; /** * `Bool` for if the camera is allowed to zoom in. */ - public var cameraZooms:Bool = Options.getData("cameraZooms"); + var cameraZooms:Bool = Options.getData("cameraZooms"); /** Speed of camera. **/ - public var cameraSpeed:Float = 1; + var cameraSpeed:Float = 1; /** Speed of camera zooming. **/ - public var cameraZoomSpeed:Float = 1; + var cameraZoomSpeed:Float = 1; /** * Multiplier for strength of camera bops. */ - public var cameraZoomStrength:Float = 1; + var cameraZoomStrength:Float = 1; /** * Multiplier for speed of camera bops. */ - public var cameraZoomRate:Float = 1; + var cameraZoomRate:Float = 1; /** Shortner for `SONG.song`. **/ - public var curSong:String = ""; + var curSong:String = ""; /** The interval of beats the current `gf` waits till their `dance` function gets called. (as an `Int`) @@ -235,241 +236,241 @@ class PlayState extends MusicBeatState { 2 = Every Other Beat, etc. **/ - public var gfSpeed:Int = 1; + var gfSpeed:Int = 1; /** Current `health` of the player (stored as a range from `minHealth` to `maxHealth`, which is by default 0 to 2). **/ - public var health:Float = 1; + var health:Float = 1; /** Current `health` being shown on the `healthBar`. (Is inverted from normal when playing as opponent) **/ - public var healthShown:Float = 1; + var healthShown:Float = 1; /** Minimum `health` value. (Defaults to 0) **/ - public var minHealth:Float = 0; + var minHealth:Float = 0; /** Maximum `health` value. (Defaults to 2) **/ - public var maxHealth:Float = 2; + var maxHealth:Float = 2; /** Current combo (or amount of notes hit in a row without a combo break). **/ - public var combo:Int = 0; + var combo:Int = 0; /** Current combo (or amount of notes hit in a row without a combo break). **/ - public var maxCombo:Int = 0; + var maxCombo:Int = 0; /** Current score for the player. **/ - public var songScore:Int = 0; + var songScore:Int = 0; /** Current miss count for the player. **/ - public var misses:Int = 0; + var misses:Int = 0; /** Current accuracy for the player (0 - 100). **/ - public var accuracy:Float = 100.0; + var accuracy:Float = 100.0; /** Background sprite for the health bar. **/ - public var healthBarBG:FlxSprite; + var healthBarBG:FlxSprite; /** The health bar. **/ - public var healthBar:FlxBar; + var healthBar:FlxBar; /** The progress bar. **/ - public var timeBar:TimeBar; + var timeBar:TimeBar; /** Variable for if `generateSong` has been called successfully yet. **/ - public var generatedMusic:Bool = false; + var generatedMusic:Bool = false; /** Whether or not the player has started the song yet. **/ - public var startingSong:Bool = false; + var startingSong:Bool = false; /** The icon for the player character (`bf`). **/ - public var iconP1:HealthIcon; + var iconP1:HealthIcon; /** The icon for the opponent character (`dad`). **/ - public var iconP2:HealthIcon; + var iconP2:HealthIcon; /** `FlxCamera` for all HUD/UI elements. **/ - public var camHUD:FlxCamera; + var camHUD:FlxCamera; /** `FlxCamera` for all elements part of the main scene. **/ - public var camGame:FlxCamera; + var camGame:FlxCamera; /** Current text under the health bar (displays score and other stats). **/ - public var scoreTxt:FlxText; + var scoreTxt:FlxText; /** Total notes interacted with. (Includes missing and hitting) **/ - public var totalNotes:Int = 0; + var totalNotes:Int = 0; /** Total notes hit (is a `Float` because it's used for accuracy calculations). **/ - public var hitNotes:Float = 0.0; + var hitNotes:Float = 0.0; /** `FlxGroup` for all the sprites that should go above the characters in a stage. **/ - public var foregroundSprites:FlxGroup = new FlxGroup(); + var foregroundSprites:FlxGroup = new FlxGroup(); /** The default camera zoom (used for camera zooming properly). **/ - public var defaultCamZoom:Float = 1.05; + var defaultCamZoom:Float = 1.05; /** The default hud camera zoom (used for zoom the hud properly). **/ - public var defaultHudCamZoom:Float = 1.0; + var defaultHudCamZoom:Float = 1.0; /** Current alt animation for any characters that may be using it (should just be `dad`). **/ - public var altAnim:String = ""; + var altAnim:String = ""; /** Whether or not you are currently in a cutscene. **/ - public var inCutscene:Bool = false; + var inCutscene:Bool = false; /** Current group of weeks you are playing from. **/ - public static var groupWeek:String = ""; + static var groupWeek:String = ""; /** Small Icon to use in RPC. **/ - public var iconRPC:String = ""; + var iconRPC:String = ""; /** Details to use in RPC. **/ - public var detailsText:String = "Freeplay"; + var detailsText:String = "Freeplay"; /** Paused Details to use in RPC. **/ - public var detailsPausedText:String = ""; + var detailsPausedText:String = ""; /** Length of the current song's instrumental track in milliseconds. **/ - public var songLength:Float = 0; + var songLength:Float = 0; /** Your current key bindings stored as `Strings`. **/ - public var binds:Array; + var binds:Array; // wack ass ui shit i need to fucking change like oh god i hate this shit mate - public var ui_settings:Array; - public var mania_size:Array; - public var mania_offset:Array; - public var mania_gap:Array; - public var types:Array; + var ui_settings:Array; + var mania_size:Array; + var mania_offset:Array; + var mania_gap:Array; + var types:Array; // this sucks too, sorry i'm not documentating this bullshit that ima replace at some point with nice clean yummy jsons // - leather128 - public var arrow_Configs:Map> = new Map>(); - public var type_Configs:Map> = new Map>(); + var arrow_Configs:Map> = new Map>(); + var type_Configs:Map> = new Map>(); /** `Array` of cached miss sounds. **/ - public var missSounds:Array = []; + var missSounds:Array = []; /** Current song multiplier. (Should be minimum 0.25) **/ - public static var songMultiplier:Float = 1; + static var songMultiplier:Float = 1; /** Variable that stores the original scroll speed before being divided by `songMultiplier`. Usage: ChartingState **/ - public static var previousScrollSpeedLmao:Float = 0; + static var previousScrollSpeedLmao:Float = 0; /** Current `Cutscene` data. **/ - public var cutscene:Cutscene; + var cutscene:Cutscene; /** Current time of the song in milliseconds used for the progress bar. **/ - public var time:Float = 0.0; + var time:Float = 0.0; /** A `Map` of the `String` names of the ratings to the amount of times you got them. **/ - public var ratings:Map = ["marvelous" => 0, "sick" => 0, "good" => 0, "bad" => 0, "shit" => 0]; + var ratings:Map = ["marvelous" => 0, "sick" => 0, "good" => 0, "bad" => 0, "shit" => 0]; /** Current text that displays your ratings (plus misses and MA/PA). **/ - public var ratingText:FlxText; + var ratingText:FlxText; /** Variable used by Lua Modcharts to stop the song midway. **/ - public var stopSong:Bool = false; + var stopSong:Bool = false; /** `Array` of current events used by the song. **/ - public var events:Array> = []; + var events:Array> = []; /** Original `Array` of the current song's events. **/ - public var baseEvents:Array> = []; + var baseEvents:Array> = []; /** * Used lua cameras? */ - public var usedLuaCameras:Bool = false; + var usedLuaCameras:Bool = false; /** * Is the player charting? */ - public static var chartingMode:Bool = false; + static var chartingMode:Bool = false; /** Current character you are playing as stored as an `Int`. @@ -482,93 +483,93 @@ class PlayState extends MusicBeatState { -1 = both **/ - public static var characterPlayingAs:Int = 0; + static var characterPlayingAs:Int = 0; /** The current hitsound the player is using. (By default is 'none') **/ - public var hitSoundString:String = Options.getData("hitsound"); + var hitSoundString:String = Options.getData("hitsound"); /** `Map` of `String` to `Boyfriend` for changing `bf`'s character. **/ - public var bfMap:Map = []; + var bfMap:Map = []; /** `Map` of `String` to `Character` for changing `gf`'s character. **/ - public var gfMap:Map = []; + var gfMap:Map = []; /** `Map` of `String` to `Character` for changing `dad`'s character. **/ - public var dadMap:Map = []; + var dadMap:Map = []; /** `Map` of `String` to `StageGroup` for changing the `stage`. **/ - public var stageMap:Map = []; + var stageMap:Map = []; /** Whether the game will or will not load events from the chart's `events.json` file. (Disabled while charting as the events are already loaded) **/ - public static var loadChartEvents:Bool = true; + static var loadChartEvents:Bool = true; /** Current time bar style selected by the player. **/ - public var funnyTimeBarStyle:String = Options.getData("timeBarStyle"); + var funnyTimeBarStyle:String = Options.getData("timeBarStyle"); /** Keeps track of the original player key count. (Used when playing as opponent). **/ - public var ogPlayerKeyCount:Int = 4; + var ogPlayerKeyCount:Int = 4; /** Keeps track of the original opponent (or both if not specified for player) key count. (Used when playing as opponent). **/ - public var ogKeyCount:Int = 4; + var ogKeyCount:Int = 4; /** `Map` of `String` to `LuaScript` used for custom events. **/ - public var scripts:Map = []; + var scripts:Map = []; /** `FlxTypedGroup` of `NoteSplash`s used to contain all note splashes and make performance better as a result by using `.recycle`. **/ - public var splash_group:FlxTypedSpriteGroup = new FlxTypedSpriteGroup(); + var splash_group:FlxTypedSpriteGroup = new FlxTypedSpriteGroup(); /** * Should the player spawn a notesplash on a sick or marvelous rating? */ - public var playerNoteSplashes:Bool = Options.getData("playerNoteSplashes"); + var playerNoteSplashes:Bool = Options.getData("playerNoteSplashes"); /** * Should the opponent spawn a notesplash on a sick or marvelous rating? */ - public var opponentNoteSplashes:Bool = Options.getData("opponentNoteSplashes"); + var opponentNoteSplashes:Bool = Options.getData("opponentNoteSplashes"); - public var enemyStrumsGlow:Bool = Options.getData("enemyStrumsGlow"); + var enemyStrumsGlow:Bool = Options.getData("enemyStrumsGlow"); - public var ratingsGroup:FlxSpriteGroup = new FlxSpriteGroup(); + var ratingsGroup:FlxSpriteGroup = new FlxSpriteGroup(); - public var marvelousRatings:Bool = Options.getData("marvelousRatings"); + var marvelousRatings:Bool = Options.getData("marvelousRatings"); - public static var playCutscenes:Bool = false; + static var playCutscenes:Bool = false; /** * Manages tweens in lua scripts to pause when game is */ - public var tweenManager:FlxTweenManager; + var tweenManager:FlxTweenManager; - override public function create() { + override function create() { tweenManager = new FlxTweenManager(); // set instance because duh instance = this; @@ -1126,7 +1127,7 @@ class PlayState extends MusicBeatState { updateSongInfoText(); } - public function reorderCameras(?newCam:FlxCamera = null) { + function reorderCameras(?newCam:FlxCamera = null) { var cameras = FlxG.cameras.list.copy(); for (c in cameras) { FlxG.cameras.remove(c, false); @@ -1140,8 +1141,8 @@ class PlayState extends MusicBeatState { FlxG.cameras.setDefaultDrawTarget(camGame, true); } - public static var playCutsceneLmao:Bool = false; - public static var playCutsceneOnPauseLmao:Bool = false; + static var playCutsceneLmao:Bool = false; + static var playCutsceneOnPauseLmao:Bool = false; function startDialogue(?dialogueBox:DialogueBox, ?endSongVar:Bool = false):Void { if (endSongVar) { @@ -1196,10 +1197,10 @@ class PlayState extends MusicBeatState { } #if VIDEOS_ALLOWED - public var videoHandler:FlxVideo = new FlxVideo(); + var videoHandler:FlxVideo = new FlxVideo(); #end - public function startVideo(name:String, ?ext:String, ?endSongVar:Bool = false):Void { + function startVideo(name:String, ?ext:String, ?endSongVar:Bool = false):Void { inCutscene = true; if (endSongVar) { @@ -1267,7 +1268,7 @@ class PlayState extends MusicBeatState { var startTimer:FlxTimer = new FlxTimer(); - public static var startOnTime:Float = 0; + static var startOnTime:Float = 0; function startCountdown():Void { call("startCountdown", []); @@ -1433,9 +1434,9 @@ class PlayState extends MusicBeatState { }, 5); } - public var invincible:Bool = false; + var invincible:Bool = false; - public function clearNotesBefore(time:Float) { + function clearNotesBefore(time:Float) { var i:Int = unspawnNotes.length - 1; while (i >= 0) { var note:Note = unspawnNotes[i]; @@ -1462,13 +1463,13 @@ class PlayState extends MusicBeatState { } } - public inline function invalidateNote(note:Note):Void { + inline function invalidateNote(note:Note):Void { note.kill(); notes.remove(note, true); note.destroy(); } - public function setSongTime(time:Float) { + function setSongTime(time:Float) { invincible = true; set("bot", true); if (time < 0) @@ -1523,15 +1524,15 @@ class PlayState extends MusicBeatState { resyncVocals(); } - public var maniaChanges:Array = []; + var maniaChanges:Array = []; // https://github.com/TheZoroForce240/LeatherEngine/blob/main/source/states/PlayState.hx#L1432 - public var currentParsingKeyCount:Int = SONG.keyCount; - public var currentParsingPlayerKeyCount:Int = SONG.playerKeyCount; + var currentParsingKeyCount:Int = SONG.keyCount; + var currentParsingPlayerKeyCount:Int = SONG.playerKeyCount; - public var addedVocals:Array = []; + var addedVocals:Array = []; - public function generateSong(dataPath:String):Void { + function generateSong(dataPath:String):Void { Conductor.changeBPM(SONG.bpm, songMultiplier); if (SONG.needsVoices) { @@ -1672,7 +1673,7 @@ class PlayState extends MusicBeatState { SONG.validScore = SONG.validScore == true ? songMultiplier >= 1 : false; } - public inline function sortNotes(Obj1:Note, Obj2:Note):Int { + inline function sortNotes(Obj1:Note, Obj2:Note):Int { return FlxSort.byValues(FlxSort.ASCENDING, Obj1.strumTime, Obj2.strumTime); } @@ -1680,9 +1681,9 @@ class PlayState extends MusicBeatState { * The note underlay colored black. * Turned off by default. */ - public var noteBG:FlxSprite; + var noteBG:FlxSprite; - public function generateStaticArrows(pos:Float, ?isPlayer:Bool = false, ?showReminders:Bool = true):Void { + function generateStaticArrows(pos:Float, ?isPlayer:Bool = false, ?showReminders:Bool = true):Void { call("generateStaticArrows", [pos, isPlayer, showReminders]); var usedKeyCount:Int = SONG.keyCount; @@ -1806,7 +1807,7 @@ class PlayState extends MusicBeatState { super.closeSubState(); } - override public function onFocus():Void { + override function onFocus():Void { #if DISCORD_ALLOWED if (health > minHealth && !paused) { if (Conductor.songPosition > 0.0) { @@ -1821,7 +1822,7 @@ class PlayState extends MusicBeatState { super.onFocus(); } - override public function onFocusLost():Void { + override function onFocusLost():Void { #if DISCORD_ALLOWED if (health > minHealth && !paused) { DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyStr + ")", iconRPC); @@ -1831,7 +1832,7 @@ class PlayState extends MusicBeatState { super.onFocusLost(); } - public function resyncVocals():Void { + function resyncVocals():Void { FlxG.sound.music.pitch = songMultiplier; if (vocals.active && vocals.playing) @@ -1873,25 +1874,25 @@ class PlayState extends MusicBeatState { } } - public var paused:Bool = false; + var paused:Bool = false; - public var startedCountdown:Bool = false; - public var canPause:Bool = true; + var startedCountdown:Bool = false; + var canPause:Bool = true; - public var canFullscreen:Bool = true; + var canFullscreen:Bool = true; - public var switchedStates:Bool = false; + var switchedStates:Bool = false; // give: [noteDataThingy, noteType] // get : [xOffsetToUse] - public var prevPlayerXVals:Map = []; - public var prevEnemyXVals:Map = []; + var prevPlayerXVals:Map = []; + var prevEnemyXVals:Map = []; - public var speed(default, set):Float = 1.0; + var speed(default, set):Float = 1.0; - public var ratingStr:String = ""; + var ratingStr:String = ""; - public var song_info_timer:Float = 0.0; + var song_info_timer:Float = 0.0; inline function fixedUpdate() { call("fixedUpdate", [1 / 120]); @@ -1899,7 +1900,7 @@ class PlayState extends MusicBeatState { var fixedUpdateTime:Float = 0.0; - override public function update(elapsed:Float) { + override function update(elapsed:Float) { super.update(elapsed); tweenManager.update(elapsed); @@ -2525,10 +2526,11 @@ class PlayState extends MusicBeatState { override function destroy() { call("onDestroy", []); closeScripts(); + FlxG.camera.bgColor = FlxColor.BLACK; super.destroy(); } - public function turnChange(char:String) { + function turnChange(char:String) { call("turnChange", [char]); switch (char) { case 'dad': @@ -2651,7 +2653,7 @@ class PlayState extends MusicBeatState { } } - public function finishSongStuffs() { + function finishSongStuffs() { if (isStoryMode) { campaignScore += songScore; @@ -2722,20 +2724,20 @@ class PlayState extends MusicBeatState { } } - public var endingSong:Bool = false; + var endingSong:Bool = false; - public var rating:FlxSprite = new FlxSprite(); - public var ratingTween:VarTween; + var rating:FlxSprite = new FlxSprite(); + var ratingTween:VarTween; - public var accuracyText:FlxText = new FlxText(0, 0, 0, "bruh", 24); - public var accuracyTween:VarTween; + var accuracyText:FlxText = new FlxText(0, 0, 0, "bruh", 24); + var accuracyTween:VarTween; - public var numbers:Array = []; - public var number_Tweens:Array = []; + var numbers:Array = []; + var number_Tweens:Array = []; - public var uiMap:Map = []; + var uiMap:Map = []; - public function popUpScore(strumtime:Float, noteData:Int, ?setNoteDiff:Float):Void { + function popUpScore(strumtime:Float, noteData:Int, ?setNoteDiff:Float):Void { var noteDiff:Float = (strumtime - Conductor.songPosition); if (Options.getData("botplay")) @@ -2930,7 +2932,7 @@ class PlayState extends MusicBeatState { } } - public function updateScoreText() { + function updateScoreText() { scoreTxt.text = '< ${Options.getData('showScore') ? 'Score:${songScore} ~ ' : ''}Misses:${misses} ~ Accuracy:${accuracy}% ~ ${ratingStr} >'; scoreTxt.screenCenter(X); } @@ -2941,7 +2943,7 @@ class PlayState extends MusicBeatState { var heldArray:Array = []; var previousReleased:Array = []; - public function keyShit() { + function keyShit() { if (generatedMusic && startedCountdown) { if (!Options.getData("botplay")) { var bruhBinds:Array = ["LEFT", "DOWN", "UP", "RIGHT"]; @@ -3601,7 +3603,7 @@ class PlayState extends MusicBeatState { call("beatHit", [curBeat]); } - public function updateRatingText() { + function updateRatingText() { if (Options.getData("sideRatings")) { ratingText.text = getRatingText(); ratingText.screenCenter(Y); @@ -3648,7 +3650,7 @@ class PlayState extends MusicBeatState { openSubState(res); } - public function getRatingText():String { + function getRatingText():String { var ratingArray:Array = [ ratings.get("marvelous"), ratings.get("sick"), @@ -3683,7 +3685,7 @@ class PlayState extends MusicBeatState { && PA > 0 ? "PA: " + Std.string(FlxMath.roundDecimal((ratingArray[1] + ratingArray[0]) / PA, 2)) + "\n" : "")); } - public static function getCharFromEvent(eventVal:String):Character { + static function getCharFromEvent(eventVal:String):Character { switch (eventVal.toLowerCase()) { case "girlfriend" | "gf" | "player3" | "2": return PlayState.gf.getMainCharacter(); @@ -3694,7 +3696,7 @@ class PlayState extends MusicBeatState { return PlayState.boyfriend.getMainCharacter(); } - public function removeBgStuff() { + function removeBgStuff() { remove(stage); remove(stage.foregroundSprites); remove(stage.infrontOfGFSprites); @@ -3742,7 +3744,7 @@ class PlayState extends MusicBeatState { } } - public function addBgStuff() { + function addBgStuff() { stage.setCharOffsets(); add(stage); @@ -3822,7 +3824,7 @@ class PlayState extends MusicBeatState { add(stage.foregroundSprites); } - public function eventCharacterShit(event:Array) { + function eventCharacterShit(event:Array) { removeBgStuff(); if (gfMap.exists(event[3]) || bfMap.exists(event[3]) || dadMap.exists(event[3])) // prevent game crash @@ -3931,7 +3933,7 @@ class PlayState extends MusicBeatState { addBgStuff(); } - public function updateSongInfoText() { + function updateSongInfoText() { var songThingy:Float = songLength - FlxG.sound.music.time; var seconds:Int = Math.floor(songThingy / 1000); @@ -3954,7 +3956,7 @@ class PlayState extends MusicBeatState { } } - public inline function set(name:String, data:Any, ?executeOn:ExecuteOn = BOTH) { + inline function set(name:String, data:Any, ?executeOn:ExecuteOn = BOTH) { for (script in scripts) { if (script.executeOn == executeOn || executeOn == BOTH) { script.set(name, data); @@ -3962,7 +3964,7 @@ class PlayState extends MusicBeatState { } } - public function call(name:String, ?args:Array, ?executeOn:ExecuteOn = BOTH) { + function call(name:String, ?args:Array, ?executeOn:ExecuteOn = BOTH) { for (script in scripts) { if((script.executeOn == executeOn || executeOn == BOTH)){ script.call(name, args); @@ -3990,7 +3992,7 @@ class PlayState extends MusicBeatState { return null; } - public inline function closeScripts() { + inline function closeScripts() { for (script in scripts) { script?.destroy(); } @@ -4012,7 +4014,7 @@ class PlayState extends MusicBeatState { scripts.clear(); } - public function processEvent(event:Array) { + function processEvent(event:Array) { #if LUA_ALLOWED if (scripts.exists(event[0].toLowerCase())) { for (i in 0...strumLineNotes.length) { @@ -4037,7 +4039,7 @@ class PlayState extends MusicBeatState { call("onEvent", [event[0], event[1], event[2], event[3]]); } - public function calculateAccuracy() { + function calculateAccuracy() { if (totalNotes != 0 && !switchedStates) accuracy = FlxMath.roundDecimal(100.0 / (totalNotes / hitNotes), 2); @@ -4049,7 +4051,7 @@ class PlayState extends MusicBeatState { updateScoreText(); } - public inline function updateRating() + inline function updateRating() ratingStr = Ratings.getRank(accuracy, misses); function generareNoteChangeEvents():Void { @@ -4174,7 +4176,7 @@ class PlayState extends MusicBeatState { } } - public function setupNoteTypeScript(noteType:String) { + function setupNoteTypeScript(noteType:String) { #if LUA_ALLOWED if (!scripts.exists(noteType.toLowerCase()) && Assets.exists(Paths.lua("arrow types/" + noteType))) { scripts.set(noteType.toLowerCase(), new LuaScript(PolymodAssets.getPath(Paths.lua("arrow types/" + noteType)))); @@ -4206,19 +4208,19 @@ class PlayState extends MusicBeatState { * @param behind The object to add behind * @param obj The object that will be in front */ - public function addBehind(behind:FlxBasic, obj:FlxBasic) { + function addBehind(behind:FlxBasic, obj:FlxBasic) { insert(members.indexOf(obj), behind); } - public function addBehindGF(behind:FlxBasic) { + function addBehindGF(behind:FlxBasic) { insert(members.indexOf(gf), behind); } - public function addBehindDad(behind:FlxBasic) { + function addBehindDad(behind:FlxBasic) { insert(members.indexOf(dad), behind); } - public function addBehindBF(behind:FlxBasic) { + function addBehindBF(behind:FlxBasic) { insert(members.indexOf(boyfriend), behind); } diff --git a/source/states/StoryMenuState.hx b/source/states/StoryMenuState.hx index 370d0ab622..e869b9eb15 100644 --- a/source/states/StoryMenuState.hx +++ b/source/states/StoryMenuState.hx @@ -23,6 +23,7 @@ import game.Highscore; using StringTools; +@:publicFields class StoryMenuState extends MusicBeatState { /* WEEK GROUPS */ static var groupIndex:Int = 0; diff --git a/source/substates/GameOverSubstate.hx b/source/substates/GameOverSubstate.hx index d984f532e6..6e73ba0fec 100644 --- a/source/substates/GameOverSubstate.hx +++ b/source/substates/GameOverSubstate.hx @@ -27,6 +27,7 @@ class GameOverSubstate extends MusicBeatSubstate { instance = this; super(); PlayState.playCutscenes = true; + FlxG.camera.bgColor = FlxColor.BLACK; FlxG.camera.scroll.set(); FlxG.camera.target = null; diff --git a/source/ui/StickerSubState.hx b/source/ui/StickerSubState.hx deleted file mode 100644 index 92584ca4da..0000000000 --- a/source/ui/StickerSubState.hx +++ /dev/null @@ -1,382 +0,0 @@ -package ui; - -import flixel.FlxSprite; -import haxe.Json; -import lime.utils.Assets; -import substates.MusicBeatSubstate; -import states.StoryMenuState; -import flixel.group.FlxGroup.FlxTypedGroup; -import flixel.util.FlxTimer; -import flixel.FlxG; -import flixel.math.FlxMath; -import flixel.util.FlxSort; -import flixel.util.FlxSignal; -import states.MainMenuState; -import flixel.addons.transition.FlxTransitionableState; -import openfl.display.BitmapData; -import states.FreeplayState; -import openfl.geom.Matrix; -import openfl.display.Sprite; -import openfl.display.Bitmap; -import flixel.FlxState; - -using Lambda; -using StringTools; -using utilities.MapTools; - -class StickerSubState extends MusicBeatSubstate -{ - public var grpStickers:FlxTypedGroup; - - // yes... a damn OpenFL sprite!!! - public var dipshit:Sprite; - - /** - * The state to switch to after the stickers are done. - * This is a FUNCTION so we can pass it directly to `FlxG.switchState()`, - * and we can add constructor parameters in the caller. - */ - var targetState:StickerSubState->FlxState; - - // what "folders" to potentially load from (as of writing only "keys" exist) - var soundSelections:Array = []; - // what "folder" was randomly selected - var soundSelection:String = ""; - var sounds:Array = []; - - public function new(?oldStickers:Array, ?targetState:StickerSubState->FlxState):Void - { - super(); - - this.targetState = (targetState == null) ? ((sticker) -> new MainMenuState()) : targetState; - - // todo still - // make sure that ONLY plays mp3/ogg files - // if there's no mp3/ogg file, then it regenerates/reloads the random folder - - var assetsInList = openfl.utils.Assets.list(); - - var soundFilterFunc = function(a:String) { - return a.startsWith('assets/shared/sounds/stickersounds/'); - }; - - soundSelections = assetsInList.filter(soundFilterFunc); - soundSelections = soundSelections.map(function(a:String) { - return a.replace('assets/shared/sounds/stickersounds/', '').split('/')[0]; - }); - - // cracked cleanup... yuchh... - for (i in soundSelections) - { - while (soundSelections.contains(i)) - { - soundSelections.remove(i); - } - soundSelections.push(i); - } - - trace(soundSelections); - - soundSelection = FlxG.random.getObject(soundSelections); - - var filterFunc = function(a:String) { - return a.startsWith('assets/shared/sounds/stickersounds/' + soundSelection + '/'); - }; - var assetsInList3 = openfl.utils.Assets.list(); - sounds = assetsInList3.filter(filterFunc); - for (i in 0...sounds.length) - { - sounds[i] = sounds[i].replace('assets/shared/sounds/', ''); - sounds[i] = sounds[i].substring(0, sounds[i].lastIndexOf('.')); - } - - trace(sounds); - - grpStickers = new FlxTypedGroup(); - add(grpStickers); - - // makes the stickers on the most recent camera, which is more often than not... a UI camera!! - // grpStickers.cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]]; - grpStickers.cameras = FlxG.cameras.list; - - if (oldStickers != null) - { - for (sticker in oldStickers) - { - grpStickers.add(sticker); - } - - degenStickers(); - } - else - regenStickers(); - } - - public function degenStickers():Void - { - grpStickers.cameras = FlxG.cameras.list; - - /* - if (dipshit != null) - { - FlxG.removeChild(dipshit); - dipshit = null; - } - */ - - if (grpStickers.members == null || grpStickers.members.length == 0) - { - switchingState = false; - close(); - return; - } - - for (ind => sticker in grpStickers.members) - { - new FlxTimer().start(sticker.timing, _ -> { - sticker.visible = false; - var daSound:String = FlxG.random.getObject(sounds); - FlxG.sound.play(Paths.sound(daSound)); - - if (grpStickers == null || ind == grpStickers.members.length - 1) - { - switchingState = false; - close(); - } - }); - } - } - - function regenStickers():Void - { - if (grpStickers.members.length > 0) - { - grpStickers.clear(); - } - - var stickerInfo:StickerInfo = new StickerInfo('stickers-set-1'); - var stickers:Map> = new Map>(); - for (stickerSets in stickerInfo.getPack("all")) - { - stickers.set(stickerSets, stickerInfo.getStickers(stickerSets)); - } - - var xPos:Float = -100; - var yPos:Float = -100; - while (xPos <= FlxG.width) - { - var stickerSet:String = FlxG.random.getObject(stickers.keyValues()); - var sticker:String = FlxG.random.getObject(stickers.get(stickerSet)); - var sticky:StickerSprite = new StickerSprite(0, 0, stickerInfo.name, sticker); - sticky.visible = false; - - sticky.x = xPos; - sticky.y = yPos; - xPos += sticky.frameWidth * 0.5; - - if (xPos >= FlxG.width) - { - if (yPos <= FlxG.height) - { - xPos = -100; - yPos += FlxG.random.float(70, 120); - } - } - - sticky.angle = FlxG.random.int(-60, 70); - grpStickers.add(sticky); - } - - FlxG.random.shuffle(grpStickers.members); - - // var stickerCount:Int = 0; - - // for (w in 0...6) - // { - // var xPos:Float = FlxG.width * (w / 6); - // for (h in 0...6) - // { - // var yPos:Float = FlxG.height * (h / 6); - // var sticker = grpStickers.members[stickerCount]; - // xPos -= sticker.width / 2; - // yPos -= sticker.height * 0.9; - // sticker.x = xPos; - // sticker.y = yPos; - - // stickerCount++; - // } - // } - - // for (ind => sticker in grpStickers.members) - // { - // sticker.x = (ind % 8) * sticker.width; - // var yShit:Int = Math.floor(ind / 8); - // sticker.y += yShit * sticker.height; - // // scales it juuuust a smidge - // sticker.y += 20 * yShit; - // } - - // another damn for loop... apologies!!! - for (ind => sticker in grpStickers.members) - { - sticker.timing = FlxMath.remapToRange(ind, 0, grpStickers.members.length, 0, 0.9); - - new FlxTimer().start(sticker.timing, _ -> { - if (grpStickers == null) return; - - sticker.visible = true; - var daSound:String = FlxG.random.getObject(sounds); - FlxG.sound.play(Paths.sound(daSound)); - - var frameTimer:Int = FlxG.random.int(0, 2); - - // always make the last one POP - if (ind == grpStickers.members.length - 1) frameTimer = 2; - - new FlxTimer().start((1 / 24) * frameTimer, _ -> { - if (sticker == null) return; - - sticker.scale.x = sticker.scale.y = FlxG.random.float(0.97, 1.02); - - if (ind == grpStickers.members.length - 1) - { - switchingState = true; - - FlxTransitionableState.skipNextTransIn = true; - FlxTransitionableState.skipNextTransOut = true; - - // I think this grabs the screen and puts it under the stickers? - // Leaving this commented out rather than stripping it out because it's cool... - /* - dipshit = new Sprite(); - var scrn:BitmapData = new BitmapData(FlxG.width, FlxG.height, true, 0x00000000); - var mat:Matrix = new Matrix(); - scrn.draw(grpStickers.cameras[0].canvas, mat); - - var bitmap:Bitmap = new Bitmap(scrn); - - dipshit.addChild(bitmap); - // FlxG.addChildBelowMouse(dipshit); - */ - - FlxG.switchState(() -> { - // TODO: Rework this asset caching stuff - // NOTE: This has to come AFTER the state switch, - // otherwise the game tries to render destroyed sprites! - - return targetState(this); - }); - } - }); - }); - } - - grpStickers.sort((ord, a, b) -> { - return FlxSort.byValues(ord, a.timing, b.timing); - }); - - // centers the very last sticker - var lastOne:StickerSprite = grpStickers.members[grpStickers.members.length - 1]; - lastOne.updateHitbox(); - lastOne.angle = 0; - lastOne.screenCenter(); - } - - override public function update(elapsed:Float):Void - { - super.update(elapsed); - - // if (FlxG.keys.justPressed.ANY) - // { - // regenStickers(); - // } - } - - var switchingState:Bool = false; - - override public function close():Void - { - if (switchingState) return; - super.close(); - } - - override public function destroy():Void - { - if (switchingState) return; - super.destroy(); - } -} - -class StickerSprite extends FlxSprite -{ - public var timing:Float = 0; - - public function new(x:Float, y:Float, stickerSet:String, stickerName:String):Void - { - super(x, y); - loadGraphic('assets/shared/images/transitionSwag/' + stickerSet + '/' + stickerName + ".png"); - updateHitbox(); - scrollFactor.set(); - } -} - -class StickerInfo -{ - public var name:String; - public var artist:String; - public var stickers:Map>; - public var stickerPacks:Map>; - - public function new(stickerSet:String):Void - { - var path = Paths.file('images/transitionSwag/' + stickerSet + '/stickers.json'); - var json = Json.parse(Assets.getText(path)); - - // doin this dipshit nonsense cuz i dunno how to deal with casting a json object with - // a dash in its name (sticker-packs) - var jsonInfo:StickerShit = cast json; - - this.name = jsonInfo.name; - this.artist = jsonInfo.artist; - - stickerPacks = new Map>(); - - for (field in Reflect.fields(json.stickerPacks)) - { - var stickerFunny = json.stickerPacks; - var stickerStuff = Reflect.field(stickerFunny, field); - - stickerPacks.set(field, cast stickerStuff); - } - - // creates a similar for loop as before but for the stickers - stickers = new Map>(); - - for (field in Reflect.fields(json.stickers)) - { - var stickerFunny = json.stickers; - var stickerStuff = Reflect.field(stickerFunny, field); - - stickers.set(field, cast stickerStuff); - } - } - - public function getStickers(stickerName:String):Array - { - return this.stickers[stickerName]; - } - - public function getPack(packName:String):Array - { - return this.stickerPacks[packName]; - } -} - -// somethin damn cute just for the json to cast to! -typedef StickerShit = -{ - name:String, - artist:String, - stickers:Map>, - stickerPacks:Map> -} \ No newline at end of file