diff --git a/source/funkin/backend/system/CommandLineHandler.hx b/source/funkin/backend/system/CommandLineHandler.hx index 2a8b08e1..5b2f05ee 100644 --- a/source/funkin/backend/system/CommandLineHandler.hx +++ b/source/funkin/backend/system/CommandLineHandler.hx @@ -16,6 +16,7 @@ class CommandLineHandler { Sys.println("-mod [mod name] | Load a specific mod"); Sys.println("-modfolder [path] | Sets the mod folder path"); #end + Sys.println("-nocolor | Disables colors in the terminal"); Sys.println("-nogpubitmap | Forces GPU only bitmaps off"); Sys.exit(0); #if MOD_SUPPORT @@ -28,8 +29,6 @@ class CommandLineHandler { } else { Main.modToLoad = arg.trim(); } - case "-nogpubitmap": - Main.forceGPUOnlyBitmapsOff = true; case "-modfolder": i++; var arg = cmd[i]; @@ -43,6 +42,10 @@ class CommandLineHandler { Sys.exit(0); } #end + case "-nocolor": + Main.noTerminalColor = true; + case "-nogpubitmap": + Main.forceGPUOnlyBitmapsOff = true; case "-livereload": // do nothing default: diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index e0a56ce2..673d28aa 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -39,6 +39,7 @@ class Main extends Sprite public static var modToLoad:String = null; public static var forceGPUOnlyBitmapsOff:Bool = false; + public static var noTerminalColor:Bool = false; public static var scaleMode:FunkinRatioScaleMode; #if !mobile diff --git a/source/funkin/backend/utils/NativeAPI.hx b/source/funkin/backend/utils/NativeAPI.hx index 6ee2df50..d2ff0d12 100644 --- a/source/funkin/backend/utils/NativeAPI.hx +++ b/source/funkin/backend/utils/NativeAPI.hx @@ -50,6 +50,8 @@ class NativeAPI { * Sets the console colors */ public static function setConsoleColors(foregroundColor:ConsoleColor = NONE, ?backgroundColor:ConsoleColor = NONE) { + if(Main.noTerminalColor) return; + #if (windows && !hl) if(foregroundColor == NONE) foregroundColor = LIGHTGRAY; diff --git a/source/funkin/editors/character/CharacterSelection.hx b/source/funkin/editors/character/CharacterSelection.hx index 8c2000ea..c7e897b2 100644 --- a/source/funkin/editors/character/CharacterSelection.hx +++ b/source/funkin/editors/character/CharacterSelection.hx @@ -37,7 +37,6 @@ class CharacterSelection extends EditorTreeMenu override function createPost() { super.createPost(); - var idk:OptionsScreen = optionsTree.members.last(); - if (idk.members.length > 0) idk.changeSelection(1); + main.changeSelection(1); } } \ No newline at end of file diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 90c7c1b7..1b2ad184 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -496,9 +496,10 @@ class Charter extends UIState { public function refreshBPMSensitive() { // refreshes everything dependant on BPM, and BPM changes - scrollBar.length = Conductor.getStepForTime(FlxG.sound.music.getDefault(vocals).length); + var length = FlxG.sound.music.getDefault(vocals).length; + scrollBar.length = Conductor.getStepForTime(length); - bottomLimit.y = Conductor.getStepForTime(FlxG.sound.music.getDefault(vocals).length) * 40; + bottomLimit.y = Conductor.getStepForTime(length) * 40; bottomSeparator.y = bottomLimit.y-2; } @@ -761,10 +762,12 @@ class Charter extends UIState { note.updatePos(note.step, note.id + 4, note.susLength, note.type); } + var noteOffset = (strumLines.members.indexOf(cStr)) * 4; + for(note in strL.notes) { var n = new CharterNote(); var t = Conductor.getStepForTime(note.time); - n.updatePos(t, ((strumLines.members.indexOf(cStr)) * 4) + note.id, Conductor.getStepForTime(note.time + note.sLen) - t, note.type); + n.updatePos(t, noteOffset + note.id, Conductor.getStepForTime(note.time + note.sLen) - t, note.type); notesGroup.add(n); } sortNotes(); @@ -908,14 +911,15 @@ class Charter extends UIState { } } - Conductor.songPosition = FlxMath.bound(Conductor.songPosition, 0, FlxG.sound.music.getDefault(vocals).length); + var songLength = FlxG.sound.music.getDefault(vocals).length; + Conductor.songPosition = FlxMath.bound(Conductor.songPosition, 0, songLength); - if (Conductor.songPosition >= FlxG.sound.music.getDefault(vocals).length) { + if (Conductor.songPosition >= songLength) { FlxG.sound.music.pause(); vocals.pause(); } - songPosInfo.text = '${CoolUtil.timeToStr(Conductor.songPosition)} / ${CoolUtil.timeToStr(FlxG.sound.music.length)}' + songPosInfo.text = '${CoolUtil.timeToStr(Conductor.songPosition)} / ${CoolUtil.timeToStr(songLength)}' + '\nStep: ${curStep}' + '\nBeat: ${curBeat}' + '\nMeasure: ${curMeasure}' diff --git a/source/funkin/editors/charter/CharterSelection.hx b/source/funkin/editors/charter/CharterSelection.hx index df83eb40..b671a914 100644 --- a/source/funkin/editors/charter/CharterSelection.hx +++ b/source/funkin/editors/charter/CharterSelection.hx @@ -43,7 +43,34 @@ class CharterSelection extends EditorTreeMenu { override function createPost() { super.createPost(); - var idk:OptionsScreen = optionsTree.members.last(); - if (idk.members.length > 0) idk.changeSelection(1); + main.changeSelection(1); + } + + public override function update(elapsed:Float) { + super.update(elapsed); + + bg.colorTransform.redOffset = lerp(bg.colorTransform.redOffset, 0, 0.0625); + bg.colorTransform.greenOffset = lerp(bg.colorTransform.greenOffset, 0, 0.0625); + bg.colorTransform.blueOffset = lerp(bg.colorTransform.blueOffset, 0, 0.0625); + bg.colorTransform.redMultiplier = lerp(bg.colorTransform.redMultiplier, 1, 0.0625); + bg.colorTransform.greenMultiplier = lerp(bg.colorTransform.greenMultiplier, 1, 0.0625); + bg.colorTransform.blueMultiplier = lerp(bg.colorTransform.blueMultiplier, 1, 0.0625); + } + + public override function onMenuChange() { + super.onMenuChange(); + if (optionsTree.members.length > 1) { // selected a song + // small flashbang + if(freeplayList.songs.length <= main.curSelected-1) return; + + var color:FlxColor = freeplayList.songs[main.curSelected-1].parsedColor.getDefault(0xFFFFFFFF); + + bg.colorTransform.redOffset = 0.25 * color.red; + bg.colorTransform.greenOffset = 0.25 * color.green; + bg.colorTransform.blueOffset = 0.25 * color.blue; + bg.colorTransform.redMultiplier = FlxMath.lerp(1, color.redFloat, 0.25); + bg.colorTransform.greenMultiplier = FlxMath.lerp(1, color.greenFloat, 0.25); + bg.colorTransform.blueMultiplier = FlxMath.lerp(1, color.blueFloat, 0.25); + } } } \ No newline at end of file diff --git a/source/funkin/editors/ui/UIButtonList.hx b/source/funkin/editors/ui/UIButtonList.hx index c8fa79bd..d40ac1b5 100644 --- a/source/funkin/editors/ui/UIButtonList.hx +++ b/source/funkin/editors/ui/UIButtonList.hx @@ -131,7 +131,8 @@ class UIButtonList extends UIWindow { super.destroy(); if(buttonCameras != null) { - FlxG.cameras.remove(buttonCameras); + if (FlxG.cameras.list.contains(buttonCameras)) + FlxG.cameras.remove(buttonCameras); buttonCameras = null; } } diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index e495269d..7568c27a 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -1,5 +1,6 @@ package funkin.menus; +import funkin.backend.scripting.events.MenuChangeEvent; import funkin.options.OptionsMenu; import funkin.backend.scripting.events.PauseCreationEvent; import funkin.backend.scripting.events.NameEvent; @@ -170,12 +171,11 @@ class PauseSubState extends MusicBeatSubstate function changeSelection(change:Int = 0):Void { - curSelected += change; + var event = EventManager.get(MenuChangeEvent).recycle(curSelected, FlxMath.wrap(curSelected + change, 0, menuItems.length-1), change, change != 0); + pauseScript.call("onChangeItem", [event]); + if (event.cancelled) return; - if (curSelected < 0) - curSelected = menuItems.length - 1; - if (curSelected >= menuItems.length) - curSelected = 0; + curSelected = event.value; var bullShit:Int = 0;