From d80dd0ca8891c6b42789da90533ad17659870a89 Mon Sep 17 00:00:00 2001 From: MaybeMaru <97055307+MaybeMaru@users.noreply.github.com> Date: Sun, 28 Apr 2024 01:50:29 +0200 Subject: [PATCH] fortnite balls im gay i like boys --- project.xml | 2 ++ source/funkin/Controls.hx | 35 ++++++++-------------- source/funkin/Preferences.hx | 4 +-- source/funkin/graphics/FlxSpriteExt.hx | 2 +- source/funkin/graphics/TypedGroup.hx | 3 +- source/funkin/objects/NotesGroup.hx | 8 ++--- source/funkin/util/backend/AssetManager.hx | 2 +- source/funkin/util/song/Conductor.hx | 4 +++ source/import.hx | 9 ++---- 9 files changed, 29 insertions(+), 40 deletions(-) diff --git a/project.xml b/project.xml index 7fb3ac26..50682453 100644 --- a/project.xml +++ b/project.xml @@ -91,6 +91,8 @@ + + diff --git a/source/funkin/Controls.hx b/source/funkin/Controls.hx index 48c3b20f..c021796c 100644 --- a/source/funkin/Controls.hx +++ b/source/funkin/Controls.hx @@ -8,24 +8,16 @@ class Controls public static var keyboardBinds:Map>; public static var gamepadBinds:Map>; public static var controlArray:Array = []; - public static var gamepad:FlxGamepad = null; + public static var gamepad:FlxGamepad; // Returns if the controler is being used inline public static function inGamepad():Bool { return gamepad != null ? gamepad.connected : false; } - public static function connectGamepad(deviceConnected:FlxGamepad):Void { - gamepad = deviceConnected; - } - - public static function disconnectGamepad(deviceDisconnected:FlxGamepad):Void { - gamepad = null; - } - inline public static function initGamepad():Void { - FlxG.gamepads.deviceConnected.add(connectGamepad); - FlxG.gamepads.deviceDisconnected.add(disconnectGamepad); + FlxG.gamepads.deviceConnected.add((device) -> gamepad = device); + FlxG.gamepads.deviceDisconnected.add((device) -> gamepad = null); if (FlxG.gamepads.lastActive != null) gamepad = FlxG.gamepads.lastActive; } @@ -46,8 +38,8 @@ class Controls var keyboard:Array = [-1, -1]; var gamepad:Array = [-1, -1]; - binds.fastForEach((bind, i) -> {keyboard[i] = fromString(bind, false);}); - gamepadSave.get(key).fastForEach((bind, i) -> {gamepad[i] = fromString(bind, true);}); + binds.fastForEach((bind, i) -> keyboard.unsafeSet(i, fromString(bind, false))); + gamepadSave.get(key).fastForEach((bind, i) -> gamepad.unsafeSet(i, fromString(bind, true))); keyboardBinds.set(key, keyboard); gamepadBinds.set(key, gamepad); @@ -136,31 +128,28 @@ class Controls public static function getBindNames(bind:String):Array { bind = bind.toUpperCase().trim(); - var names:Array = ["", ""]; + var names:Array = []; if (inGamepad()) { var gamepadKeys = gamepadBinds.get(bind); - gamepadKeys.fastForEach((key, i) -> { - names[i] = FlxGamepadInputID.toStringMap.get(key); - }); + gamepadKeys.fastForEach((key, i) -> names.push(FlxGamepadInputID.toStringMap.get(key))); } else { var keyboardKeys = keyboardBinds.get(bind); - keyboardKeys.fastForEach((key, i) -> { - names[i] = FlxKey.toStringMap.get(key); - }); + keyboardKeys.fastForEach((key, i) -> names.push(FlxKey.toStringMap.get(key))); } return names; } - public static function setBind(bind:String, key:String, index:Int):Void { + public static function setBind(bind:String, key:String, index:Int):Void + { bind = bind.toUpperCase().trim(); key = key.toUpperCase().trim(); - final gamepad:Bool = inGamepad(); + var binds:Array = gamepad ? gamepadBinds.get(bind) : keyboardBinds.get(bind); - binds[index] = fromString(key, gamepad); + binds.unsafeSet(index, fromString(key, gamepad)); gamepad ? gamepadBinds.set(bind, binds) : keyboardBinds.set(bind, binds); SaveData.flushData(); diff --git a/source/funkin/Preferences.hx b/source/funkin/Preferences.hx index 5381d23b..60746fea 100644 --- a/source/funkin/Preferences.hx +++ b/source/funkin/Preferences.hx @@ -57,7 +57,7 @@ class Preferences #end addPref('antialiasing', 'antialiasing', true); addPref('quality', 'quality', {array:["rudy", "low", "medium", "high"], value:"high"}); - #if !(hl || web) + #if !TEXTURES_OFF addPref('gpu-textures', 'gpu textures', true); #end #if desktop @@ -105,7 +105,7 @@ class Preferences #if desktop Main.resizeGame(getPref('resolution')); #else {} #end public static inline function updateGpuTextures():Void - #if !(hl || web) AssetManager.gpuTextures = getPref('gpu-textures'); #else {} #end + #if TEXTURES_OFF {} #else AssetManager.gpuTextures = getPref('gpu-textures'); #end public static inline function updateAntialiasing():Void { var anti:Bool = getPref('antialiasing'); diff --git a/source/funkin/graphics/FlxSpriteExt.hx b/source/funkin/graphics/FlxSpriteExt.hx index 128fbaf6..2e949d25 100644 --- a/source/funkin/graphics/FlxSpriteExt.hx +++ b/source/funkin/graphics/FlxSpriteExt.hx @@ -500,6 +500,6 @@ class FlxSpriteExt extends FlxSkewedSprite } inline public function uploadGpu():FlxGraphic { - return AssetManager.uploadGraphicTexture(graphic); + return #if TEXTURES_OFF graphic; #else AssetManager.uploadGraphicTexture(graphic); #end } } \ No newline at end of file diff --git a/source/funkin/graphics/TypedGroup.hx b/source/funkin/graphics/TypedGroup.hx index ae471fc0..fa025e94 100644 --- a/source/funkin/graphics/TypedGroup.hx +++ b/source/funkin/graphics/TypedGroup.hx @@ -9,6 +9,7 @@ import flixel.group.FlxContainer.FlxTypedContainer; typedef Group = TypedGroup; +@:access(flixel.FlxCamera) class TypedGroup extends #if (flixel >= "5.7.0") FlxTypedContainer #else FlxTypedGroup #end { public inline function setNull(object:T) { @@ -51,7 +52,7 @@ class TypedGroup extends #if (flixel >= "5.7.0") FlxTypedContainer { - note.noteSpeed = value; - }); + unspawnNotes.fastForEach((note, i) -> note.noteSpeed = value); notes.members.fastForEach((note, i) -> { if (note != null) @@ -362,7 +360,7 @@ class NotesGroup extends Group final inStart:Bool = game.startingSong; if (!game.inCutscene) if ((Conductor.playing || inStart || Conductor.songPosition < game.songLength)) { - Conductor.songPosition = Conductor.songPosition + (elapsed * 1000); + Conductor.update(elapsed); if (game.startedCountdown) if (inStart) { if (Conductor.songPosition >= 0) game.startSong(); @@ -376,7 +374,7 @@ class NotesGroup extends Group } else { - Conductor.songPosition = Conductor.songPosition + (elapsed * 1000); + Conductor.update(elapsed); if (!Conductor.inst.playing) Conductor.play(); if (Conductor.songPosition % Conductor.stepCrochet <= 5) Conductor.autoSync(); diff --git a/source/funkin/util/backend/AssetManager.hx b/source/funkin/util/backend/AssetManager.hx index 22dbdd70..6d3388c1 100644 --- a/source/funkin/util/backend/AssetManager.hx +++ b/source/funkin/util/backend/AssetManager.hx @@ -336,7 +336,7 @@ class AssetManager * GRAPHIC CACHE */ - public static var gpuTextures:Bool = #if (hl || web) false; #else true; #end + public static var gpuTextures:Bool = #if TEXTURES_OFF false; #else true; #end public static var lodQuality:LodLevel = HIGH; public static function setLodQuality(level:String):LodLevel { return lodQuality = LodLevel.fromString(level); diff --git a/source/funkin/util/song/Conductor.hx b/source/funkin/util/song/Conductor.hx index 2cc1f351..b0c9d12f 100644 --- a/source/funkin/util/song/Conductor.hx +++ b/source/funkin/util/song/Conductor.hx @@ -147,6 +147,10 @@ class Conductor return lastChange; } + public static inline function update(elapsed:Float) { + songPosition = songPosition + (elapsed * 1000); + } + public static var volume(default, set):Float = 1.0; static inline function set_volume(value:Float) { if (inst != null) diff --git a/source/import.hx b/source/import.hx index 5579b0f9..3b493678 100644 --- a/source/import.hx +++ b/source/import.hx @@ -48,17 +48,12 @@ import funkin.objects.note.Event; //PlayState Others import funkin.objects.RatingGroup; -import funkin.objects.dialogue.DialogueBoxBase; -import funkin.objects.dialogue.PixelDialogueBox; -import funkin.objects.dialogue.NormalDialogueBox; +import funkin.objects.dialogue.*; import funkin.objects.Character; import funkin.objects.HealthIcon; //Alphabet -import funkin.objects.alphabet.AlphabetFont; -import funkin.objects.alphabet.Alphabet; -import funkin.objects.alphabet.MenuAlphabet; -import funkin.objects.alphabet.TypedAlphabet; +import funkin.objects.alphabet.*; // Sound import funkin.sound.FlxFunkSound;