From a189218300dbf8f60db2b25a5e0dce049e4e1e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=92=9C=20Rodney=2C=20An=20Imaginative=20Furball=20?= =?UTF-8?q?=F0=9F=92=99?= Date: Wed, 25 Mar 2026 21:47:28 -0400 Subject: [PATCH 1/3] IT COMPILES --- source/BackgroundDancer.hx | 29 - source/ButtonRemapSubstate.hx | 11 - source/ControlsSubState.hx | 12 - source/GameDimensions.hx | 7 - source/GameOverState.hx | 82 -- source/Main.hx | 12 +- source/Snd.hx | 1288 ----------------- source/SndTV.hx | 332 ----- source/import.hx | 17 +- source/{ => kitty/backend}/ChartParser.hx | 2 +- source/{ => kitty/backend}/Conductor.hx | 5 +- source/{ => kitty/backend}/Controls.hx | 8 +- source/{ => kitty/backend}/ConvertScore.hx | 2 + source/{ => kitty/backend}/CoolUtil.hx | 8 +- .../{ => kitty/backend}/EtternaFunctions.hx | 14 +- source/{ => kitty/backend}/HelperFunctions.hx | 2 + source/{ => kitty/backend}/Highscore.hx | 2 +- source/{ => kitty/backend}/KadeEngineData.hx | 14 +- source/{ => kitty/backend}/KeyBinds.hx | 4 +- source/{ => kitty/backend}/MusicBeatState.hx | 11 +- .../{ => kitty/backend}/MusicBeatSubstate.hx | 4 +- source/{ => kitty/backend}/Paths.hx | 2 +- .../backend}/PlayStateChangeables.hx | 2 + source/{ => kitty/backend}/PlayerSettings.hx | 4 +- source/{ => kitty/backend}/Ratings.hx | 10 +- source/{ => kitty/backend}/Replay.hx | 9 +- source/{ => kitty/backend}/Section.hx | 2 +- source/{ => kitty/backend}/Song.hx | 8 +- .../{ => kitty/backend/objects}/HitGraph.hx | 11 +- .../{ => kitty/backend/objects}/OFLSprite.hx | 2 + source/{ => kitty/objects}/Alphabet.hx | 9 +- source/{ => kitty/objects}/BackgroundGirls.hx | 2 +- source/{ => kitty/objects}/Boyfriend.hx | 2 +- source/{ => kitty/objects}/Character.hx | 4 +- source/{ => kitty/objects}/DialogueBox.hx | 21 +- source/{ => kitty/objects}/HealthIcon.hx | 4 +- source/{ => kitty/objects}/MenuCharacter.hx | 2 +- source/{ => kitty/objects}/MenuItem.hx | 4 +- source/{ => kitty/objects}/Note.hx | 10 +- source/{ => kitty/objects}/NoteSplash.hx | 2 +- source/{ => kitty/objects}/Options.hx | 42 +- source/{ => kitty/scripting}/HScript.hx | 4 +- source/{ => kitty/scripting}/ModchartState.hx | 171 +-- source/{ => kitty/shaders}/BlendModeEffect.hx | 2 +- source/{ => kitty/shaders}/OverlayShader.hx | 2 +- source/{ => kitty/shaders}/WiggleEffect.hx | 20 +- source/{ => kitty/states}/LoadReplayState.hx | 25 +- source/{ => kitty/states}/OutdatedSubState.hx | 18 +- source/{ => kitty/states}/PlayState.hx | 49 +- source/{ => kitty/states}/ResultsScreen.hx | 31 +- .../states/debug}/AnimationDebug.hx | 9 +- .../states/editors}/ChartingState.hx | 61 +- .../{ => kitty/states/menus}/FreeplayState.hx | 14 +- .../states/menus}/GameOverSubstate.hx | 7 +- .../{ => kitty/states/menus}/GitarooPause.hx | 2 +- .../{ => kitty/states/menus}/MainMenuState.hx | 24 +- .../{ => kitty/states/menus}/ModsMenuState.hx | 8 +- .../{ => kitty/states/menus}/PauseSubState.hx | 21 +- .../states/menus}/StoryMenuState.hx | 14 +- source/{ => kitty/states/menus}/TitleState.hx | 19 +- .../menus/options}/GameplayCustomizeState.hx | 32 +- .../states/menus/options}/KeyBindMenu.hx | 26 +- .../states/menus/options}/OptionsMenu.hx | 36 +- .../states/menus/options}/OptionsSubState.hx | 2 +- 64 files changed, 415 insertions(+), 2200 deletions(-) delete mode 100644 source/BackgroundDancer.hx delete mode 100644 source/ButtonRemapSubstate.hx delete mode 100644 source/ControlsSubState.hx delete mode 100644 source/GameDimensions.hx delete mode 100644 source/GameOverState.hx delete mode 100644 source/Snd.hx delete mode 100644 source/SndTV.hx rename source/{ => kitty/backend}/ChartParser.hx (98%) rename source/{ => kitty/backend}/Conductor.hx (97%) rename source/{ => kitty/backend}/Controls.hx (99%) rename source/{ => kitty/backend}/ConvertScore.hx (93%) rename source/{ => kitty/backend}/CoolUtil.hx (97%) rename source/{ => kitty/backend}/EtternaFunctions.hx (93%) rename source/{ => kitty/backend}/HelperFunctions.hx (93%) rename source/{ => kitty/backend}/Highscore.hx (99%) rename source/{ => kitty/backend}/KadeEngineData.hx (99%) rename source/{ => kitty/backend}/KeyBinds.hx (99%) rename source/{ => kitty/backend}/MusicBeatState.hx (91%) rename source/{ => kitty/backend}/MusicBeatSubstate.hx (94%) rename source/{ => kitty/backend}/Paths.hx (99%) rename source/{ => kitty/backend}/PlayStateChangeables.hx (90%) rename source/{ => kitty/backend}/PlayerSettings.hx (97%) rename source/{ => kitty/backend}/Ratings.hx (98%) rename source/{ => kitty/backend}/Replay.hx (96%) rename source/{ => kitty/backend}/Section.hx (96%) rename source/{ => kitty/backend}/Song.hx (97%) rename source/{ => kitty/backend/objects}/HitGraph.hx (98%) rename source/{ => kitty/backend/objects}/OFLSprite.hx (96%) rename source/{ => kitty/objects}/Alphabet.hx (98%) rename source/{ => kitty/objects}/BackgroundGirls.hx (97%) rename source/{ => kitty/objects}/Boyfriend.hx (97%) rename source/{ => kitty/objects}/Character.hx (99%) rename source/{ => kitty/objects}/DialogueBox.hx (97%) rename source/{ => kitty/objects}/HealthIcon.hx (97%) rename source/{ => kitty/objects}/MenuCharacter.hx (98%) rename source/{ => kitty/objects}/MenuItem.hx (98%) rename source/{ => kitty/objects}/Note.hx (97%) rename source/{ => kitty/objects}/NoteSplash.hx (97%) rename source/{ => kitty/objects}/Options.hx (97%) rename source/{ => kitty/scripting}/HScript.hx (97%) rename source/{ => kitty/scripting}/ModchartState.hx (98%) rename source/{ => kitty/shaders}/BlendModeEffect.hx (96%) rename source/{ => kitty/shaders}/OverlayShader.hx (96%) rename source/{ => kitty/shaders}/WiggleEffect.hx (96%) rename source/{ => kitty/states}/LoadReplayState.hx (92%) rename source/{ => kitty/states}/OutdatedSubState.hx (98%) rename source/{ => kitty/states}/PlayState.hx (99%) rename source/{ => kitty/states}/ResultsScreen.hx (96%) rename source/{ => kitty/states/debug}/AnimationDebug.hx (96%) rename source/{ => kitty/states/editors}/ChartingState.hx (99%) rename source/{ => kitty/states/menus}/FreeplayState.hx (97%) rename source/{ => kitty/states/menus}/GameOverSubstate.hx (95%) rename source/{ => kitty/states/menus}/GitarooPause.hx (98%) rename source/{ => kitty/states/menus}/MainMenuState.hx (94%) rename source/{ => kitty/states/menus}/ModsMenuState.hx (93%) rename source/{ => kitty/states/menus}/PauseSubState.hx (95%) rename source/{ => kitty/states/menus}/StoryMenuState.hx (98%) rename source/{ => kitty/states/menus}/TitleState.hx (96%) rename source/{ => kitty/states/menus/options}/GameplayCustomizeState.hx (96%) rename source/{ => kitty/states/menus/options}/KeyBindMenu.hx (97%) rename source/{ => kitty/states/menus/options}/OptionsMenu.hx (97%) rename source/{ => kitty/states/menus/options}/OptionsSubState.hx (97%) diff --git a/source/BackgroundDancer.hx b/source/BackgroundDancer.hx deleted file mode 100644 index 78355d4..0000000 --- a/source/BackgroundDancer.hx +++ /dev/null @@ -1,29 +0,0 @@ -package; - -import flixel.FlxSprite; - -class BackgroundDancer extends FlxSprite -{ - public function new(x:Float, y:Float) - { - super(x, y); - - frames = Paths.getSparrowAtlas("stages/limo/limoDancer"); - animation.addByIndices('danceLeft', 'bg dancer sketch PINK', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); - animation.addByIndices('danceRight', 'bg dancer sketch PINK', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); - animation.play('danceLeft'); - antialiasing = true; - } - - var danceDir:Bool = false; - - public function dance():Void - { - danceDir = !danceDir; - - if (danceDir) - animation.play('danceRight', true); - else - animation.play('danceLeft', true); - } -} diff --git a/source/ButtonRemapSubstate.hx b/source/ButtonRemapSubstate.hx deleted file mode 100644 index 64ff079..0000000 --- a/source/ButtonRemapSubstate.hx +++ /dev/null @@ -1,11 +0,0 @@ -package; - -import flixel.FlxSubState; - -class ButtonRemapSubstate extends FlxSubState -{ - public function new() - { - super(); - } -} diff --git a/source/ControlsSubState.hx b/source/ControlsSubState.hx deleted file mode 100644 index f35d74c..0000000 --- a/source/ControlsSubState.hx +++ /dev/null @@ -1,12 +0,0 @@ -package; - -import flixel.FlxSprite; -import flixel.FlxSubState; - -class ControlsSubState extends FlxSubState -{ - public function new() - { - super(); - } -} diff --git a/source/GameDimensions.hx b/source/GameDimensions.hx deleted file mode 100644 index db4a62a..0000000 --- a/source/GameDimensions.hx +++ /dev/null @@ -1,7 +0,0 @@ -package; - -class GameDimensions -{ - public static var width:Int = 1280; - public static var height:Int = 720; -} \ No newline at end of file diff --git a/source/GameOverState.hx b/source/GameOverState.hx deleted file mode 100644 index 66f45e0..0000000 --- a/source/GameOverState.hx +++ /dev/null @@ -1,82 +0,0 @@ -package; - -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.addons.transition.FlxTransitionableState; -import flixel.graphics.frames.FlxAtlasFrames; -import flixel.input.gamepad.FlxGamepad; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; - -class GameOverState extends FlxTransitionableState -{ - var bfX:Float = 0; - var bfY:Float = 0; - - public function new(x:Float, y:Float) - { - super(); - - bfX = x; - bfY = y; - } - - override function create() - { - var loser:FlxSprite = new FlxSprite(100, 100); - var loseTex = Paths.getSparrowAtlas('lose'); - loser.frames = loseTex; - loser.animation.addByPrefix('lose', 'lose', 24, false); - loser.animation.play('lose'); - add(loser); - - var bf:Boyfriend = new Boyfriend(bfX, bfY); - // bf.scrollFactor.set(); - add(bf); - bf.playAnim('firstDeath'); - - FlxG.camera.follow(bf, LOCKON, 0.001); - - var restart:FlxSprite = new FlxSprite(500, 50).loadGraphic(Paths.image('restart')); - restart.setGraphicSize(Std.int(restart.width * 0.6)); - restart.updateHitbox(); - restart.alpha = 0; - restart.antialiasing = true; - add(restart); - - FlxG.sound.music.fadeOut(2, FlxG.sound.music.volume * 0.6); - - FlxTween.tween(restart, {alpha: 1}, 1, {ease: FlxEase.quartInOut}); - FlxTween.tween(restart, {y: restart.y + 40}, 7, {ease: FlxEase.quartInOut, type: PINGPONG}); - - super.create(); - } - - private var fading:Bool = false; - - override function update(elapsed:Float) - { - var pressed:Bool = FlxG.keys.justPressed.ANY; - - var gamepad:FlxGamepad = FlxG.gamepads.lastActive; - - if (gamepad != null) - { - if (gamepad.justPressed.ANY) - pressed = true; - } - - pressed = false; - - if (pressed && !fading) - { - fading = true; - FlxG.sound.music.fadeOut(0.5, 0, function(twn:FlxTween) - { - FlxG.sound.music.stop(); - FlxG.switchState(new PlayState()); - }); - } - super.update(elapsed); - } -} diff --git a/source/Main.hx b/source/Main.hx index 8fad627..994405a 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -1,29 +1,25 @@ package; -import openfl.display.BlendMode; -import openfl.text.TextFormat; -import openfl.display.Application; import flixel.util.FlxColor; -import flixel.FlxG; import flixel.FlxGame; import flixel.FlxState; -import openfl.Assets; import openfl.Lib; import openfl.display.FPS; import openfl.display.Sprite; import openfl.events.Event; +import kitty.scripting.HScript; class Main extends Sprite { var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom). var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom). - var initialState:Class = TitleState; // The FlxState the game starts with. + var initialState:Class = kitty.states.menus.TitleState; // The FlxState the game starts with. var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions. var framerate:Int = 120; // How many frames per second the game should run at. var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode. var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets - public static var watermarks:Bool = true; // Whether to put Kade Engine liteartly anywhere + public static var watermarks:Bool = true; // Whether to put Kade Engine literally anywhere // You can pretty much ignore everything from here on - your code should go in your states. @@ -84,7 +80,7 @@ class Main extends Sprite game = new FlxGame(gameWidth, gameHeight, initialState, framerate, framerate, skipSplash, startFullscreen); addChild(game); - + #if !mobile fpsCounter = new FPS(10, 3, 0xFFFFFF); addChild(fpsCounter); diff --git a/source/Snd.hx b/source/Snd.hx deleted file mode 100644 index 33aedae..0000000 --- a/source/Snd.hx +++ /dev/null @@ -1,1288 +0,0 @@ -import faxe.Faxe; - -import SndTV; -using StringTools; - -//praise delahee, i'll figure out what this shit means later! - -class Channel { - public var name:String; - public var onEnd : Void -> Void = null; - public var isDebug = false; - - var started = true; - var paused = false; - var disposed = false; - var completed = false; - - inline function new( ?name:String = null ){ - if ( name == null ) - this.name = C.EMPTY_STRING; - else - this.name = name; - } - - public function poolBack(){ - #if false - //trace("pool back"); - #end - started = false; - paused = false; - disposed = true; - completed = true; - isDebug = false; - } - - public function reset(){ - started = false; - paused = false; - disposed = false; - completed = false; - isDebug = false; - } - - public function stop(){ - started = false; - } - - public function pause(){ - paused = false; - started = true; - } - - public function resume(){ - paused = true; - started = true; - } - - public function dispose(){ - setVolume(0);//prevent any further listen - disposed = true; - onEnd = null; - } - - public function onComplete() { - completed = true; - #if !prod - //trace("onComplete " + haxe.Timer.stamp() ); - #end - //stop(); - if( onEnd!=null ) { - var cb = onEnd; - onEnd = null; - cb(); - } - } - - public function isComplete(){ - #if !prod - if ( completed ){ - //trace("already completed"); - } - - if ( started ){ - //trace("started ok"); - } - #end - - return completed || (started && !isPlaying()); - } - - //returns in secs - public function getPlayCursorSec() : Float { - throw "override me"; - return 0.0; - } - - //returns in secs - public function getPlayCursorMs() : Float { - throw "override me"; - return 0.0; - } - - public function setPlayCursorSec(posSec:Float) { - setPlayCursorMs( posSec * 1000.0 ); - } - - public function setPlayCursorMs(posMs:Float) { - throw "override me"; - } - - public function isPlaying(){ - throw "override me"; - return false; - } - - public function getVolume():Float{ - throw "override me"; - return 0.0; - } - - public function setVolume(v:Float){ - throw "override me"; - } - - public function setNbLoops(nb:Int){ - - } -} - -class ChannelEventInstance extends Channel {//basically a sound instance - public static var EMPTY_STRING = ""; - public var data : FmodStudioEventInstanceRef = null; - - function new(?name:String){ - super(name); - started = false; - //instance does not start playing - } - - public static var pool = { - var p = new hxd.Pool(ChannelEventInstance); - //p.actives = null; - p; - } - - public static function alloc(data : FmodStudioEventInstanceRef, ?name:String=null ){ - var s = pool.alloc(); - - s.reset(); - - s.data = data; - s.name = name == null ? EMPTY_STRING : name; - return s; - } - - public static function delete( c : ChannelEventInstance){ - c.dispose(); - pool.delete(c); - } - - public function getData() return data; - - public override function dispose(){ - super.dispose(); - if ( data != null){ - data.release(); - data = null; - } - } - - public override function poolBack(){ - super.poolBack(); - ChannelEventInstance.delete(this); - } - - public override function stop(){ - if (data != null) data.stop(FmodStudioStopMode.StopAllowFadeout()); - super.stop(); - } - - public override function pause(){ - super.pause(); - if(data!=null) data.setPaused(true); - } - - public override function resume(){ - super.resume(); - if(data!=null) data.setPaused(false); - } - - public override function isPlaying(){ - if ( completed ) return false; - - if ( data == null ) { - //#if !prod - //trace("[CEI]no data " + name); - //#end - return false; - } - - var b : Bool = false; - data.getPaused( Cpp.addr(b)); - #if !prod - //trace("getPaused:"+b); - #end - return !b; - } - - //returns in secs - public override function getPlayCursorSec() : Float { - if ( data == null ) return 0.0; - - var pos : Int = 0; - var res = data.getTimelinePosition( Cpp.addr(pos) ); - var posF : Float = 1.0 * pos / 1000.0; - return posF; - } - - //returns in secs - public override function getPlayCursorMs() : Float { - if ( data == null ) return 0.0; - - var pos : Int = 0; - var res = data.getTimelinePosition( Cpp.addr(pos) ); - return 1.0 * pos; - } - - public override function setPlayCursorMs(posMs:Float) { - if ( data == null ) return; - - if ( posMs < 0.0) posMs = 0.0; - var pos : Int = 0; - pos = Math.round( posMs ); - var res = data.setTimelinePosition( pos ); - if ( res != FMOD_OK){ - #if debug - //trace("[SND][Channel]{"+name+"} Repositionning S err " + FaxeRef.fmodResultToString(res)+" to :"+pos+" ("+posMs+")"); - #end - } - - #if debug - //trace("setPlayCursorMs "+posMs); - #end - } - - public override function setNbLoops(nb:Int){ - - } - - public override function getVolume() : Float{ - if (data == null ) return 0.0; - - var vol : cpp.Float32 = 0.0; - var fvol : cpp.Float32 = 0.0; - var res = data.getVolume( Cpp.addr(vol),Cpp.addr(fvol) ); - if ( res != FMOD_OK){ - #if debug - //trace("[SND][Channel]{"+name+"} getVolume err " + FaxeRef.fmodResultToString(res)); - #end - } - return vol; - } - - public override function setVolume(v:Float){ - if (data == null ){ - //#if debug - //trace("no data for "+name); - //#end - return; - } - - var res = data.setVolume( hxd.Math.clamp(v,0,1) ); - if ( res != FMOD_OK){ - //#if debug - //trace("[SND][Channel]{"+name+"} setVolume err " + FaxeRef.fmodResultToString(res)); - //#end - } - else { - //if ( isDebug ){ - //#if !prod - //trace("[SND][Channel]{"+name+"} setVolume ok " + v); - //#end - //} - } - } -} - -class ChannelLowLevel extends Channel{ - - public static var EMPTY_STRING = ""; - public var data : FmodChannelRef = null; - - function new( data : FmodChannelRef, ?name:String ){ - super(name); - this.data = data; - started = true; - } - - public static var pool = { - var p = new hxd.Pool(ChannelLowLevel); - //p.actives = null; - p; - } - - public static function alloc(data : FmodChannelRef, ?name ){ - var s = pool.alloc(); - - s.reset(); - - s.data = data; - s.name = name == null?EMPTY_STRING:name; - - return s; - } - - public static function delete( c : ChannelLowLevel){ - c.dispose(); - pool.delete(c); - } - - public function getData(){ - return data; - } - - public override function poolBack(){ - super.poolBack(); - ChannelLowLevel.delete(this); - } - - public override function stop(){ - if (data != null) data.stop(); - super.stop(); - } - - public override function pause(){ - super.pause(); - if(data!=null) data.setPaused(true); - } - - public override function resume(){ - super.resume(); - if(data!=null) data.setPaused(false); - } - - public override function dispose(){ - super.dispose(); - data = null; - } - - public override function isPlaying(){ - if ( completed ) return false; - - if (data == null) { - //#if !prod - //trace("no data no playing! "+name); - //#end - return false; - } - var b : Bool = false; - var res = data.isPlaying( Cpp.addr(b)); - if ( res != FMOD_OK ){ - //#if debug - //trace("[SND][ChannelLowLevel]{"+name+"} isPlaying err " + FaxeRef.fmodResultToString(res)); - //#end - return false; - } - return b; - } - - //returns in secs - public override function getPlayCursorSec() : Float { - if (data == null) return 0.0; - - var pos : cpp.UInt32 = 0; - var res = data.getPosition( Cpp.addr(pos), faxe.Faxe.FmodTimeUnit.FTM_MS ); - var posF : Float = 1.0 * pos * 1000.0; - return posF; - } - - //returns in secs - public override function getPlayCursorMs() : Float { - if (data == null) return 0.0; - - var pos : cpp.UInt32 = 0; - var res = data.getPosition( Cpp.addr(pos), faxe.Faxe.FmodTimeUnit.FTM_MS ); - return 1.0 * pos; - } - - - public override function setPlayCursorMs(posMs:Float) { - if (data == null) return; - - if ( posMs < 0.0) posMs = 0.0; - var posU : cpp.UInt32 = 0; - posU = Math.round( posMs ); - var res = data.setPosition( posU, FmodTimeUnit.FTM_MS ); - if ( res != FMOD_OK){ - //#if debug - //trace("[SND][Channel]{"+name+"} Repositionning S err " + FaxeRef.fmodResultToString(res)+" to :"+posU+" ("+posMs+")"); - //#end - } - } - - public override function setNbLoops(nb:Int){ - if (data == null) return; - data.setMode(FmodMode.FMOD_LOOP_NORMAL); - data.setLoopCount(nb); - } - - public override function getVolume():Float{ - if (data == null) return 0.0; - - var vol : cpp.Float32 = 0.0; - var res = data.getVolume( Cpp.addr(vol) ); - if ( res != FMOD_OK){ - //#if debug - //trace("[SND][Channel]{"+name+"} getVolume err " + FaxeRef.fmodResultToString(res)); - //#end - } - return vol; - } - - public override function setVolume(v:Float){ - if (data == null) { - //if ( isDebug ){ - //#if !prod - //trace("[SND][Channel]{"+name+"} setVolume no data"); - //#end - //} - return; - } - - var vcl = hxd.Math.clamp(v, 0, 1); - var res = data.setVolume( vcl ); - if ( res != FMOD_OK){ - //#if !prod - //trace("[SND][Channel]{"+name+"} setVolume err " + FaxeRef.fmodResultToString(res)); - //#end - } - else { - if ( isDebug ){ - //#if !prod - //trace("[SND][Channel]{"+name+"} setVolume ok " + v+" corrected:"+vcl); - //#end - } - } - } - - -} - -class Sound { - /** - * length is in seconds - */ - public var name = ""; - public var length(get, null) : Float; - public var id3 : Dynamic = null; - public var isDebug = false; - - var disposed = false; - - function new( ?name:String=null ){ - disposed = false; - } - - function get_length() : Float{ - return 0.0; - } - - //returns in msec - public function getDuration(): Float{ - return getDurationMs(); - } - - public function getDurationSec() : Float{ - return length; - } - - public function getDurationMs() : Float{ - return length * 1000.0; - } - - public function dispose(){ - if (disposed) return; - disposed = true; - } - - public function play( ?offsetMs : Float = 0.0, ?nbLoops:Int = 1, ?volume:Float = 1.0 ) : Channel { - return null; - } -} - -class SoundLowLevel extends Sound{ - - public var data : FmodSoundRef = null; - - public function new( data : cpp.Pointer, ?name:String = null ){ - super(name); - this.data = Cpp.ref(data); - } - - public function getData(){ - return data; - } - - public override function dispose(){ - super.dispose(); - - if ( Snd.released ) { - data = null; - return; - } - - if(data!=null) - data.release(); - data = null; - } - - //returns in secs - override function get_length() : Float{ - if (disposed) return 0.0; - - var pos : cpp.UInt32 = 0; - var res = data.getLength( Cpp.addr(pos), FmodTimeUnit.FTM_MS ); - if ( res != FMOD_OK ){ - #if debug - //trace("impossible to retrieve sound len"); - #end - } - var posF = 1.0 * pos / 1000.0; - return posF; - } - - public override function play( ?offsetMs : Float = 0.0, ?nbLoops:Int = 1, ?volume:Float = 1.0) : Channel { - var nativeChan : FmodChannelRef = FaxeRef.playSoundWithHandle( data , false); - var chan = ChannelLowLevel.alloc( nativeChan, name ); - - #if debug - //trace("[Sound] offset " + offsetMs); - //trace("play " + haxe.Timer.stamp() ); - #end - - @:privateAccess chan.started = true; - @:privateAccess chan.completed = false; - @:privateAccess chan.disposed = false; - @:privateAccess chan.paused = false; - - - if( offsetMs != 0.0 ) chan.setPlayCursorMs( offsetMs ); - if( volume != 1.0 ) chan.setVolume( volume ); - if( nbLoops > 1 ) chan.setNbLoops( nbLoops ); - - return chan; - } -} - - -class SoundEvent extends Sound{ - - public var data : FmodStudioEventDescriptionRef = null; - - public function new( data : FmodStudioEventDescriptionRef, ?name:String = null ){ - super(name); - this.data = data; - } - - public override function dispose(){ - super.dispose(); - - if ( Snd.released ) { - data = null; - return; - } - - if ( data != null){ - data.releaseAllInstances(); - data = null; - } - } - public function getData(){ - return data; - } - - //returns in secs - override function get_length() : Float{ - if (disposed) return 0.0; - - var pos : Int = 0; - var res = data.getLength( Cpp.addr(pos) ); - if ( res != FMOD_OK ){ - //#if !prod - //trace("impossible to retrieve sound len"); - //#end - } - var posF = 1.0 * pos / 1000.0; - return posF; - } - - public override function play( ?offsetMs : Float = 0.0, ?nbLoops:Int = 1, ?volume:Float = 1.0) : Channel{ - var nativeInstance : FmodStudioEventInstanceRef = data.createInstance(); - var chan = ChannelEventInstance.alloc( nativeInstance, name ); - - //#if !prod - //trace("play " + haxe.Timer.stamp() ); - //#end - nativeInstance.start(); - - @:privateAccess chan.started = true; - @:privateAccess chan.completed = false; - @:privateAccess chan.disposed = false; - @:privateAccess chan.paused = false; - - if( offsetMs != 0.0 ) chan.setPlayCursorMs( offsetMs ); - if( volume != 1.0 ) chan.setVolume( volume ); - - return chan; - } -} - -class Snd { - public static var EMPTY_STRING = ""; - public static var PLAYING : hxd.Stack = new hxd.Stack(); - static var MUTED = false; - static var DISABLED = false; - static var GLOBAL_VOLUME = 1.0; - static var TW = new SndTV(); - - public var name : String ; - public var pan : Float = 0.0; - public var volume(default,set) : Float = 1.0; - public var curPlay : Null = null; - public var bus = otherBus; - public var isDebug = true; - /** - * for when stop is called explicitly - * allows disposal - */ - public var onStop = new hxd.Signal(); - public var sound : Sound = null; - - var onEnd : NullVoid> = null; - static var fmodSystem : FmodSystemRef = null; - - public static var otherBus = new SndBus(); - public static var sfxBus = new SndBus(); - public static var musicBus = new SndBus(); - - public function new( snd : Sound, ?name:String ) { - volume = 1; - pan = 0; - sound = snd; - muted = false; - this.name = name==null?EMPTY_STRING:name; - } - - public function isLoaded() { - return sound!=null; - } - - //does not dispose sound, only instanced - public function stop(){ - - TW.terminate(this);//prevent reentrancy of fadeStop() stop() not cutting any sound - - PLAYING.remove(this); - - if ( isPlaying() && !onStop.isTriggering ) - onStop.trigger(); - - if ( curPlay != null){ - curPlay.dispose(); - curPlay.poolBack(); - curPlay = null; - #if !prod - //trace(name+" stopped"); - //Lib.showStack(); - #end - } - - //bus = otherBus; - } - - public function dispose(){ - //#if !prod - //trace(name+" disposing"); - //#end - - if ( isPlaying() ){ - stop(); - } - - if ( curPlay != null){ - curPlay.dispose(); - curPlay.poolBack(); - curPlay = null; - //#if !prod - //trace(name+" disposed"); - //#end - } - - if ( sound != null) { - sound.dispose(); - sound = null; - } - - onStop.dispose(); - - onEnd = null; - curPlay = null; - } - - /** - * - * @return in ms - */ - public inline function getPlayCursor() : Float { - if ( curPlay == null) return 0.0; - return curPlay.getPlayCursorMs(); - } - - - public function play(?vol:Float, ?pan:Float) : Snd { - if( vol == null ) vol = volume; - if( pan == null ) pan = this.pan; - - start(0, vol, 0.0); - - return this; - } - - /** - * launches the sound, stops previous and rewrite the cur play dropping it into oblivion for the gc - */ - public function start(loops:Int=0, vol:Float=1.0, ?startOffsetMs:Float=0.0) { - if ( DISABLED ) { - //#if debug - //trace("[SND] Disabled"); - //#end - return; - } - if ( sound == null ){ - //#if debug - //trace("[SND] no inner sound"); - //#end - return; - } - - if ( isPlaying() ){ - //#if !prod - //trace(name+" interrupting "); - //#end - - stop(); - } - - TW.terminate(this); - - this.volume = vol; - this.pan = normalizePanning(pan); - - PLAYING.push(this); - curPlay = sound.play( startOffsetMs, loops, getRealVolume()); - - if ( curPlay == null){ - //#if !prod - //trace(" play missed?"); - //#end - } - else { - //#if !prod - //trace("started"); - //#end - } - } - - /** - * launches the sound and rewrite the cur play dropping it into oblivion for the gc - */ - public function startNoStop(?loops:Int=0, ?vol:Float=1.0, ?startOffsetMs:Float=0.0) : Null{ - if ( DISABLED ) { - //#if debug - //trace("[SND] Disabled"); - //#end - return null; - } - if ( sound == null ){ - //#if debug - //trace("[SND] no inner sound"); - //#end - return null; - } - - this.volume = vol; - this.pan = normalizePanning(pan); - - curPlay = sound.play( startOffsetMs, loops, getRealVolume()); - - return curPlay; - } - - public inline function getDuration() { - return getDurationMs(); - } - - public inline function getDurationSec() { - return sound.length; - } - - /** - * returns in ms - */ - public inline function getDurationMs() { - return sound.length * 1000.0; - } - - public static inline - function trunk(v:Float, digit:Int) : Float{ - var hl = Math.pow( 10.0 , digit ); - return Std.int( v * hl ) / hl; - } - - public static function dumpMemory(){ - var v0 : Int = 0; - var v1 : Int = 0; - var v2 : Int = 0; - - var v0p : cpp.Pointer = Cpp.addr(v0); - var v1p : cpp.Pointer = Cpp.addr(v1); - var v2p : cpp.Pointer = Cpp.addr(v2); - var str = ""; - var res = fmodSystem.getSoundRAM( v0p, v1p, v2p ); - if ( res != FMOD_OK){ - //#if debug - //trace("[SND] cannot fetch snd ram dump "); - //#end - } - - inline function f( val :Float) : Float{ - return trunk(val, 2); - } - - if( v2 > 0 ){ - str+="fmod Sound chip RAM all:" + f(v0 / 1024.0) + "KB \t max:" + f(v1 / 1024.0) + "KB \t total: " + f(v2 / 1024.0) + " KB\r\n"; - } - - v0 = 0; - v1 = 0; - - var res = FaxeRef.Memory_GetStats( v0p, v1p, false ); - str += "fmod Motherboard chip RAM all:" + f(v0 / 1024.0) + "KB \t max:" + f(v1 / 1024.0) + "KB \t total: " + f(v2 / 1024.0) + " KB"; - return str; - } - - public function playLoop(?loops = 9999, ?vol:Float=1.0, ?startOffset = 0.0) : Snd { - if( vol==null ) - vol = volume; - - start(loops, vol, startOffset); - return this; - } - - function set_volume(v:Float) { - volume = v; - refresh(); - return volume; - } - - public function setVolume(v:Float) { - set_volume(v); - } - - public inline function getRealPanning() { - return pan; - } - - public function setPanning(p:Float) { - pan = p; - refresh(); - } - - public function onEndOnce(cb:Void->Void) { - onEnd = cb; - } - - public function fadePlay(?fadeDuration = 100, ?endVolume:Float=1.0 ) { - var p = play(0.0001); - if ( p == null ){ - //trace("nothing ret"); - } - else { - if ( p.curPlay == null){ - //trace("no curplay wtf?"); - } - else - { - //trace("curplay ok"); - } - } - tweenVolume(endVolume, fadeDuration); - return p; - } - - public function fadePlayLoop(?fadeDuration = 100, ?endVolume:Float=1.0 , ?loops=9999) { - var p = playLoop(loops,0); - tweenVolume(endVolume, fadeDuration); - return p; - } - - public function fadeStop( ?fadeDuration = 100 ) { - if ( !isPlaying()){ - //#if !prod - //trace("not playing " + name+" winn not unfade");//can cause reentrancy issues - //#end - return null; - } - - isDebug = true; - var t = tweenVolume(0, fadeDuration); - t.onEnd = _stop; - return t; - } - - public var muted : Bool = false; - - public function toggleMute() { - muted = !muted;//todo - setVolume(volume); - } - public function mute() { - muted = true; - setVolume(volume); - } - public function unmute() { - muted = false; - setVolume(volume); - } - - public function isPlaying(){ - if ( curPlay == null ){ - #if !prod - //trace("no curplay"); - #end - return false; - } - return curPlay.isPlaying(); - } - - public static function init(){ - #if debug - trace("[Snd] fmod init"); - #end - Faxe.fmod_init( 256 ); - fmodSystem = FaxeRef.getSystem(); - released = false; - } - - public static var released = true; - - public static function release(){ - TW.terminateAll(); - for (s in PLAYING) - s.dispose(); - PLAYING.hardReset(); - released = true; - //trace("releasing fmod"); - Faxe.fmod_release(); - #if !prod - trace("fmod released"); - #end - } - - public static function setGlobalVolume(vol:Float) { - GLOBAL_VOLUME = normalizeVolume(vol); - refreshAll(); - } - - function refresh() { - if ( curPlay != null ) { - var vol = getRealVolume(); - //trace("r:"+vol); - curPlay.setVolume( vol ); - } - else { - //#if debug - //trace("[Snd] no playin no refresh "+name); - //#end - } - } - - public function setPlayCursorSec( pos:Float ) { - if (curPlay != null) { - curPlay.setPlayCursorSec(pos); - } - else { - //#if debug - //trace("setPlayCursorSec/no current instance"); - //#end - } - } - - public function setPlayCursorMs( pos:Float ){ - if (curPlay != null) - curPlay.setPlayCursorMs(pos); - else { - //#if debug - //trace("setPlayCursorMs/no current instance"); - //#end - } - } - - public function tweenVolume(v:Float, ?easing:h2d.Tweenie.TType, ?milliseconds:Float=100) : TweenV { - if ( easing == null ) easing = h2d.Tweenie.TType.TEase; - var t = TW.create(this, TVVVolume, v, easing, milliseconds); - //#if !prod - //trace("tweening " + name+" to " + v); - //#end - return t; - } - - public function tweenPan(v:Float, ?easing:h2d.Tweenie.TType, ?milliseconds:Float=100) : TweenV { - if ( easing == null ) easing = h2d.Tweenie.TType.TEase; - var t = TW.create(this, TVVPan, v, easing, milliseconds); - return t; - } - - public inline function getRealVolume() { - var v = volume * GLOBAL_VOLUME * (DISABLED?0:1) * (MUTED?0:1) * (muted?0:1) * bus.volume; - if ( v <= 0.001) - v = 0.0; - return normalizeVolume(v); - } - - static inline function normalizeVolume(f:Float) { - return hxd.Math.clamp(f, 0,1); - } - - static inline function normalizePanning(f:Float) { - return hxd.Math.clamp(f, -1,1); - } - - static var _stop = function(t:TweenV){ - #if !prod - //if( t.parent != null ) - //trace(t.parent.name+" cbk stopped"); - //else - //trace(" unbound stop called"); - #end - t.parent.stop(); - } - - static var _refresh = function(t:TweenV) { - - //avoid unwanted crash - if ( released ){ - //#if !prod - //trace("sorry released"); - //#end - return; - } - - t.parent.refresh(); - } - - static function refreshAll() { - for(s in PLAYING) - s.refresh(); - } - - function onComplete(){ - //#if debug - //trace("onComplete " + haxe.Timer.stamp()); - //#end - - if (curPlay != null) { - curPlay.onComplete(); - } - - stop(); - } - - public function isComplete(){ - if ( curPlay == null ) { - //#if!prod - //trace("comp: no cur play"); - //#end - return true; - } - return curPlay.isComplete(); - } - - ////////////////////////////////////// - /////////////////////STATICS////////// - ////////////////////////////////////// - - public static var DEBUG_TRACK = false; - - //@:noDebug - public static function loadSound( path:String, streaming : Bool, blocking : Bool ) : Sound { - - if ( released ) { - //#if(!prod) - //trace("FMOD not active "+path); - //#end - return null; - } - - var mode = FMOD_DEFAULT; - - if ( streaming ) mode |= FMOD_CREATESTREAM; - if ( !blocking ) mode |= FMOD_NONBLOCKING; - - mode |= FmodMode.FMOD_2D; - - - if( DEBUG_TRACK) trace("Snd:loading " + path); - - var snd : cpp.RawPointer = cast null; - var sndR : cpp.RawPointer> = cpp.RawPointer.addressOf(snd); - - #if switch - if ( !path.startsWith("rom:")) - path = "rom://" + path; - #end - - var res : FmodResult = fmodSystem.createSound( - Cpp.cstring(path), - mode, - Cpp.nullptr(), - sndR - ); - - if ( res != FMOD_OK){ - #if(!prod) - trace("unable to load " + path + " code:" + res+" msg:"+FaxeRef.fmodResultToString(res)); - #end - return null; - } - - var n:String = null; - - #if debug - n = new bm.Path(path).getFilename(); - #end - - return new SoundLowLevel(cpp.Pointer.fromRaw(snd),n); - } - - public static function loadEvent( path:String ) : Sound { - if ( released ) { - //#if (!prod) - //trace("FMOD not active "+path); - //#end - return null; - } - - - if( DEBUG_TRACK) trace("Snd:loadingEvent " + path); - - if ( !path.startsWith("event:/")) - path = "event:/" + path; - - var fss : FmodStudioSystemRef = faxe.FaxeRef.getStudioSystem(); - var ev = fss.getEvent( path); - - if ( ev == null ) return null; - - if ( !ev.isLoaded() ){ - var t0 = haxe.Timer.stamp(); - ev.loadSampleData(); - var t1 = haxe.Timer.stamp(); - #if debug - //trace("time to preload:" + (t1 - t0)); - #end - } - - return new SoundEvent( ev, path); - } - - public static function fromFaxe( path:String ) : Snd { - if ( released ) { - //#if (!prod) - //trace("FMOD not active "+path); - //#end - return null; - } - - var s : cpp.Pointer = faxe.Faxe.fmod_get_sound(path ); - if ( s == null){ - #if (!prod) - trace("unable to find " + path); - #end - return null; - } - - var n:String = null; - - #if debug - n = new bm.Path(path).getFilename(); - #end - - return new Snd( new SoundLowLevel(s,n), path); - } - - public static function loadSfx( path:String ) : Snd { - var s : Sound = loadSound(path, false, false); - if ( s == null) return null; - return new Snd( s, s.name); - } - - public static function loadSong( path:String ) : Snd { - var s : Sound = loadSound(path, true, true); - if ( s == null) return null; - return new Snd( s, s.name); - } - - public static function load( path:String, streaming=false,blocking=true ) : Snd { - var s : Sound = loadSound(path, streaming, blocking); - if ( s == null) { - #if !prod - trace("no such file " + path); - #end - return null; - } - return new Snd( s, s.name); - } - - public static function terminateTweens() { - TW.terminateAll(); - } - - public static function update() { - for ( p in PLAYING.backWardIterator()) - if ( p.isComplete()){ - #if !prod - //trace("[Snd] isComplete " + p); - #end - p.onComplete(); - } - TW.update();//let tweens complete - - if(!released ) Faxe.fmod_update(); - } - - public static function loadSingleBank( filename : String ) : Null{ - if ( released ) { - #if debug - trace("FMOD not active "+filename); - #end - return null; - } - - if ( filename.endsWith(".fsb")) { - #if debug - trace("fsb files not supported"); - #end - return null;//old fmod format is not supported - } - - var t0 = haxe.Timer.stamp(); - var fsys = FaxeRef.getStudioSystem(); - var fbank : cpp.RawPointer < FmodStudioBank > = null; - - //trace("trying to load " + filename); - - Lib.loadMode(); - var result = fsys.loadBankFile( - cpp.ConstCharStar.fromString( filename ), - FmodStudioLoadBank.FMOD_STUDIO_LOAD_BANK_NONBLOCKING, - cpp.RawPointer.addressOf(fbank)); - Lib.playMode(); - - if (result != FMOD_OK) { - #if debug - trace("FMOD failed to LOAD sound bank with errcode:" + result + " errmsg:" + FaxeRef.fmodResultToString(result) + "\n"); - #end - return null; - } - //else - // trace("loading..."); - - var t1 = haxe.Timer.stamp(); - #if debug - //trace("time to load bank:" + (t1 - t0)+"s"); - #end - return cast fbank; - } -} \ No newline at end of file diff --git a/source/SndTV.hx b/source/SndTV.hx deleted file mode 100644 index 62e69f4..0000000 --- a/source/SndTV.hx +++ /dev/null @@ -1,332 +0,0 @@ -import h2d.Tweenie.TType; - -//praise delahee, i'll figure out what this shit means later! - -enum TVVar{ - TVVVolume; - TVVPan; -} - -@:publicFields -class TweenV { - static var GUID = 0; - var uid = 0; - - var man : SndTV; - var parent : Snd; - var n : Float; - var ln : Float; - var speed : Float; - var from : Float; - var to : Float; - var type : TType; - var plays : Int; // -1 = infini, 1 et plus = nombre d'exécutions (1 par défaut) - var varType : TVVar; - var onUpdate : NullVoid>; - var onEnd : NullVoid>; - var isDebug = false; - - public inline function new ( - parent:Snd , - n:Float , - ln:Float , - varType:TVVar, - speed:Float , - from:Float , - to:Float , - type:h2d.Tweenie.TType , - plays , - onUpdate , - onEnd - ) { - this.parent = parent ; - this.n = n ; - this.ln = ln ; - this.varType = varType ; - this.speed = speed ; - this.from = from ; - this.to = to ; - this.type = type ; - this.plays = plays ; - this.onUpdate = onUpdate ; - this.onEnd = onEnd ; - } - - public inline function reset( - parent:Snd , - n:Float , - ln:Float , - varType:TVVar, - speed:Float , - from:Float , - to:Float , - type:TType , - plays:Int , - onUpdate , - onEnd - ) { - this.parent = parent ; - this.n = n ; - this.ln = ln ; - this.speed = speed ; - this.from = from ; - this.to = to ; - this.type = type ; - this.plays = plays ; - this.onUpdate = onUpdate ; - this.onEnd = onEnd ; - this.varType = varType ; - isDebug = false; - uid = GUID++; - } - - public function clear(){ - n = 0.0; - ln = 0.0; - speed = 0.0; - plays = 0; - from = 0.0; - to = 0.0; - parent = null; - onEnd = null; - onUpdate = null; - isDebug = false; - uid = GUID++; - } - - - public - inline - function apply( val ) { - switch(varType){ - case TVVVolume: { - parent.volume = val; - #if debug - if( isDebug ) - trace("tv:" + val); - #end - } - case TVVPan: parent.pan = val; - } - - } - - public inline function kill( withCbk = true ) { - if ( withCbk ) - man.terminateTween( this ); - else - man.forceTerminateTween( this) ; - } - -} - -/** - * tween order is not respected - */ -class SndTV { - static var DEFAULT_DURATION = DateTools.seconds(1); - public var fps = 60.0; - public var isDebug = false; - - var tlist : hxd.Stack; - - public function new() { - tlist = new hxd.Stack(); - tlist.reserve(8); - } - - function onError(e) { - trace(e); - } - - public function count() { - return tlist.length; - } - - public inline function create(parent:Snd, vartype:TVVar, to:Float, ?tp:h2d.Tweenie.TType, ?duration_ms:Float) : TweenV{ - return create_(parent, vartype, to, tp, duration_ms); - } - - public function exists(p:Snd) { - for (t in tlist) - if (t.parent == p ) - return true; - return false; - } - - public var pool : hxd.Stack = new hxd.Stack(); - - function create_(p:Snd, vartype:TVVar,to:Float, ?tp:h2d.Tweenie.TType, ?duration_ms:Float) : TweenV{ - if ( duration_ms==null ) - duration_ms = DEFAULT_DURATION; - - #if debug - if ( p == null ) trace("tween2 creation failed to:"+to+" tp:"+tp); - #end - - if ( tp==null ) tp = TEase; - - { - // on supprime les tweens précédents appliqués à la même variable - for(t in tlist.backWardIterator()) - if(t.parent==p && t.varType == vartype) { - forceTerminateTween(t); - } - } - - var from = switch( vartype ){ - case TVVVolume : p.volume; - case TVVPan : p.pan; - } - var t : TweenV; - if (pool.length == 0){ - t = new TweenV( - p, - 0.0, - 0.0, - vartype, - 1 / ( duration_ms*fps/1000 ), // une seconde - from, - to, - tp, - 1, - null, - null - ); - } - else { - t = pool.pop(); - t.reset( - p, - 0.0, - 0.0, - vartype, - 1 / ( duration_ms*fps/1000 ), // une seconde - from, - to, - tp, - 1, - null, - null - ); - - } - - if( t.from==t.to ) - t.ln = 1; // tweening inutile : mais on s'assure ainsi qu'un update() et un end() seront bien appelés - - t.man = this; - tlist.push(t); - - return t; - } - - public static inline - function fastPow2(n:Float):Float { - return n*n; - } - - public static inline - function fastPow3(n:Float):Float { - return n*n*n; - } - - public static inline - function bezier(t:Float, p0:Float, p1:Float,p2:Float, p3:Float) { - return - fastPow3(1-t)*p0 + - 3*( t*fastPow2(1-t)*p1 + fastPow2(t)*(1-t)*p2 ) + - fastPow3(t)*p3; - } - - // suppression du tween sans aucun appel aux callbacks onUpdate, onUpdateT et onEnd (!) - public function killWithoutCallbacks(parent:Snd) { - for (t in tlist.backWardIterator()) - if (t.parent==parent ){ - forceTerminateTween(t); - return true; - } - return false; - } - - public function terminate(parent:Snd) { - for (t in tlist.backWardIterator()) - if (t.parent==parent){ - forceTerminateTween(t); - } - } - - public function forceTerminateTween(t:TweenV) { - var tOk = tlist.remove(t); - if( tOk ){ - t.clear(); - pool.push(t); - } - } - - public function terminateTween(t:TweenV, ?fl_allowLoop=false) { - var v = t.from + (t.to - t.from) * h2d.Tweenie.interp(t.type, 1); - t.apply(v); - onUpdate(t, 1); - - var ouid = t.uid; - - onEnd(t); - - if( ouid == t.uid ){ - if( fl_allowLoop && (t.plays==-1 || t.plays>1) ) { - if( t.plays!=-1 ) - t.plays--; - t.n = t.ln = 0; - } - else { - forceTerminateTween(t); - } - } - } - - public function terminateAll() { - for(t in tlist) - t.ln = 1; - update(); - } - - inline - function onUpdate(t:TweenV, n:Float) { - if ( t.onUpdate!=null ) - t.onUpdate(t); - } - - inline - function onEnd(t:TweenV) { - if ( t.onEnd!=null ) - t.onEnd(t); - } - - public function update(?tmod = 1.0) { - if ( tlist.length > 0 ) { - for (t in tlist.backWardIterator() ) { - var dist = t.to-t.from; - if (t.type==TRand) - t.ln+=if(Std.random(100)<33) t.speed * tmod else 0; - else - t.ln += t.speed * tmod; - - t.n = h2d.Tweenie.interp(t.type, t.ln); - - if ( t.ln<1 ) { - // en cours... - var val = t.from + t.n*dist; - - t.apply(val); - - onUpdate(t, t.ln); - } - else // fini ! - { - terminateTween(t, true); - } - } - } - } -} \ No newline at end of file diff --git a/source/import.hx b/source/import.hx index e0a4198..3119e39 100644 --- a/source/import.hx +++ b/source/import.hx @@ -1 +1,16 @@ -import Paths; \ No newline at end of file +import flixel.FlxG; +import flixel.FlxSprite; +import flixel.tweens.FlxEase; +import flixel.tweens.FlxTween; +import flixel.util.FlxColor; +import flixel.util.FlxTimer; +import kitty.backend.MusicBeatState; +import kitty.backend.Conductor; +import kitty.backend.Paths; +import kitty.backend.PlayerSettings; +import kitty.backend.Controls; +import kitty.backend.CoolUtil; +import kitty.backend.KadeEngineData; +import kitty.backend.Highscore; + +using StringTools; \ No newline at end of file diff --git a/source/ChartParser.hx b/source/kitty/backend/ChartParser.hx similarity index 98% rename from source/ChartParser.hx rename to source/kitty/backend/ChartParser.hx index 3884c0e..7a0ddd4 100644 --- a/source/ChartParser.hx +++ b/source/kitty/backend/ChartParser.hx @@ -1,4 +1,4 @@ -package; +package kitty.backend; import flixel.util.FlxStringUtil; diff --git a/source/Conductor.hx b/source/kitty/backend/Conductor.hx similarity index 97% rename from source/Conductor.hx rename to source/kitty/backend/Conductor.hx index 1787ce5..103295d 100644 --- a/source/Conductor.hx +++ b/source/kitty/backend/Conductor.hx @@ -1,7 +1,6 @@ -package; +package kitty.backend; -import Song.SwagSong; -import flixel.FlxG; +import kitty.backend.Song; /** * ... diff --git a/source/Controls.hx b/source/kitty/backend/Controls.hx similarity index 99% rename from source/Controls.hx rename to source/kitty/backend/Controls.hx index 8e02e21..d37e31e 100644 --- a/source/Controls.hx +++ b/source/kitty/backend/Controls.hx @@ -1,4 +1,4 @@ -package; +package kitty.backend; import flixel.input.gamepad.FlxGamepad; import flixel.FlxG; @@ -260,7 +260,7 @@ class Controls extends FlxActionSet for (action in digitalActions) byName[action.name] = action; - + if (scheme == null) scheme = None; setKeyboardScheme(scheme, false); @@ -491,7 +491,7 @@ class Controls extends FlxActionSet removeKeyboard(); keyboardScheme = scheme; - + #if (haxe >= "4.0.0") switch (scheme) { @@ -613,7 +613,7 @@ class Controls extends FlxActionSet gamepadsAdded.remove(id); gamepadsAdded.push(id); - + #if (haxe >= "4.0.0") for (control => buttons in buttonMap) inline bindButtons(control, id, buttons); diff --git a/source/ConvertScore.hx b/source/kitty/backend/ConvertScore.hx similarity index 93% rename from source/ConvertScore.hx rename to source/kitty/backend/ConvertScore.hx index 9eba969..d2a56ea 100644 --- a/source/ConvertScore.hx +++ b/source/kitty/backend/ConvertScore.hx @@ -1,3 +1,5 @@ +package kitty.backend; + class ConvertScore { public static function convertScore(noteDiff:Float):Int diff --git a/source/CoolUtil.hx b/source/kitty/backend/CoolUtil.hx similarity index 97% rename from source/CoolUtil.hx rename to source/kitty/backend/CoolUtil.hx index a1d2c29..46c09c8 100644 --- a/source/CoolUtil.hx +++ b/source/kitty/backend/CoolUtil.hx @@ -1,4 +1,4 @@ -package; +package kitty.backend; import flixel.FlxG; import flixel.math.FlxMath; @@ -19,16 +19,16 @@ class CoolUtil return daList; } - + public static function coolStringFile(path:String):Array { var daList:Array = path.trim().split('\n'); - + for (i in 0...daList.length) { daList[i] = daList[i].trim(); } - + return daList; } diff --git a/source/EtternaFunctions.hx b/source/kitty/backend/EtternaFunctions.hx similarity index 93% rename from source/EtternaFunctions.hx rename to source/kitty/backend/EtternaFunctions.hx index 9fcfbae..f675959 100644 --- a/source/EtternaFunctions.hx +++ b/source/kitty/backend/EtternaFunctions.hx @@ -1,3 +1,7 @@ +package kitty.backend; + +import kitty.states.PlayState; + class EtternaFunctions { // erf constants @@ -15,18 +19,18 @@ class EtternaFunctions if (x < 0) sign = -1; x = Math.abs(x); - + // A&S formula 7.1.26 var t = 1.0/(1.0 + p*x); var y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*Math.exp(-x*x); - + return sign*y; } public static function getNotes():Int { var notes:Int = 0; - for (i in 0...PlayState.SONG.notes.length) + for (i in 0...PlayState.SONG.notes.length) { for (ii in 0...PlayState.SONG.notes[i].sectionNotes.length) { @@ -41,7 +45,7 @@ class EtternaFunctions public static function getHolds():Int { var notes:Int = 0; - for (i in 0...PlayState.SONG.notes.length) + for (i in 0...PlayState.SONG.notes.length) { trace(PlayState.SONG.notes[i]); for (ii in 0...PlayState.SONG.notes[i].sectionNotes.length) @@ -70,7 +74,7 @@ class EtternaFunctions var zero = 65 * (Math.pow(ts,ts_pow)); var power = 2.5; var dev = 22.7 * (Math.pow(ts,ts_pow)); - + if (maxms <= ridic) // anything below this (judge scaled) threshold is counted as full pts return max_points; else if (maxms <= zero) // ma/pa region, exponential diff --git a/source/HelperFunctions.hx b/source/kitty/backend/HelperFunctions.hx similarity index 93% rename from source/HelperFunctions.hx rename to source/kitty/backend/HelperFunctions.hx index b17dc6a..38e8d8b 100644 --- a/source/HelperFunctions.hx +++ b/source/kitty/backend/HelperFunctions.hx @@ -1,3 +1,5 @@ +package kitty.backend; + import flixel.math.FlxMath; class HelperFunctions diff --git a/source/Highscore.hx b/source/kitty/backend/Highscore.hx similarity index 99% rename from source/Highscore.hx rename to source/kitty/backend/Highscore.hx index e94aec8..01f6c97 100644 --- a/source/Highscore.hx +++ b/source/kitty/backend/Highscore.hx @@ -1,4 +1,4 @@ -package; +package kitty.backend; import flixel.FlxG; diff --git a/source/KadeEngineData.hx b/source/kitty/backend/KadeEngineData.hx similarity index 99% rename from source/KadeEngineData.hx rename to source/kitty/backend/KadeEngineData.hx index e7095fc..70cde9b 100644 --- a/source/KadeEngineData.hx +++ b/source/kitty/backend/KadeEngineData.hx @@ -1,3 +1,5 @@ +package kitty.backend; + import flixel.input.gamepad.FlxGamepad; import openfl.Lib; import flixel.FlxG; @@ -14,7 +16,7 @@ class KadeEngineData if (FlxG.save.data.dfjk == null) FlxG.save.data.dfjk = false; - + if (FlxG.save.data.accuracyDisplay == null) FlxG.save.data.accuracyDisplay = true; @@ -42,7 +44,7 @@ class KadeEngineData if (FlxG.save.data.fpsCap > 285 || FlxG.save.data.fpsCap < 60) FlxG.save.data.fpsCap = 120; // baby proof so you can't hard lock ur copy of kade engine - + if (FlxG.save.data.scrollSpeed == null) FlxG.save.data.scrollSpeed = 1; @@ -69,7 +71,7 @@ class KadeEngineData if (FlxG.save.data.resetButton == null) FlxG.save.data.resetButton = false; - + if (FlxG.save.data.botplay == null) FlxG.save.data.botplay = false; @@ -81,7 +83,7 @@ class KadeEngineData if (FlxG.save.data.strumline == null) FlxG.save.data.strumline = false; - + if (FlxG.save.data.customStrumLine == null) FlxG.save.data.customStrumLine = 0; @@ -96,9 +98,9 @@ class KadeEngineData if (FlxG.save.data.optimize == null) FlxG.save.data.optimize = false; - + var gamepad:FlxGamepad = FlxG.gamepads.lastActive; - + KeyBinds.gamepad = gamepad != null; Conductor.recalculateTimings(); diff --git a/source/KeyBinds.hx b/source/kitty/backend/KeyBinds.hx similarity index 99% rename from source/KeyBinds.hx rename to source/kitty/backend/KeyBinds.hx index 809ff6b..8a157af 100644 --- a/source/KeyBinds.hx +++ b/source/kitty/backend/KeyBinds.hx @@ -1,3 +1,5 @@ +package kitty.backend; + import flixel.FlxG; import flixel.input.FlxInput; import flixel.input.actions.FlxAction; @@ -55,7 +57,7 @@ class KeyBinds } if (StringTools.contains(FlxG.save.data.rightBind,"NUMPAD")) FlxG.save.data.rightBind = "D"; - + if(FlxG.save.data.gpupBind == null){ FlxG.save.data.gpupBind = "DPAD_UP"; trace("No GUP"); diff --git a/source/MusicBeatState.hx b/source/kitty/backend/MusicBeatState.hx similarity index 91% rename from source/MusicBeatState.hx rename to source/kitty/backend/MusicBeatState.hx index 67e7277..82a867c 100644 --- a/source/MusicBeatState.hx +++ b/source/kitty/backend/MusicBeatState.hx @@ -1,15 +1,8 @@ -package; +package kitty.backend; - -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; import openfl.Lib; -import Conductor.BPMChangeEvent; -import flixel.FlxG; -import flixel.addons.transition.FlxTransitionableState; import flixel.addons.ui.FlxUIState; import flixel.math.FlxRect; -import flixel.util.FlxTimer; class MusicBeatState extends FlxUIState { @@ -106,7 +99,7 @@ class MusicBeatState extends FlxUIState { //do literally nothing dumbass } - + public function fancyOpenURL(schmancy:String) { #if linux diff --git a/source/MusicBeatSubstate.hx b/source/kitty/backend/MusicBeatSubstate.hx similarity index 94% rename from source/MusicBeatSubstate.hx rename to source/kitty/backend/MusicBeatSubstate.hx index c6da0fb..924def8 100644 --- a/source/MusicBeatSubstate.hx +++ b/source/kitty/backend/MusicBeatSubstate.hx @@ -1,7 +1,5 @@ -package; +package kitty.backend; -import Conductor.BPMChangeEvent; -import flixel.FlxG; import flixel.FlxSubState; class MusicBeatSubstate extends FlxSubState diff --git a/source/Paths.hx b/source/kitty/backend/Paths.hx similarity index 99% rename from source/Paths.hx rename to source/kitty/backend/Paths.hx index 7bb90d4..671f610 100644 --- a/source/Paths.hx +++ b/source/kitty/backend/Paths.hx @@ -1,4 +1,4 @@ -package; +package kitty.backend; import flixel.graphics.FlxGraphic; import flixel.FlxG; diff --git a/source/PlayStateChangeables.hx b/source/kitty/backend/PlayStateChangeables.hx similarity index 90% rename from source/PlayStateChangeables.hx rename to source/kitty/backend/PlayStateChangeables.hx index 17a430a..277e793 100644 --- a/source/PlayStateChangeables.hx +++ b/source/kitty/backend/PlayStateChangeables.hx @@ -1,3 +1,5 @@ +package kitty.backend; + class PlayStateChangeables { public static var useDownscroll:Bool; diff --git a/source/PlayerSettings.hx b/source/kitty/backend/PlayerSettings.hx similarity index 97% rename from source/PlayerSettings.hx rename to source/kitty/backend/PlayerSettings.hx index 44cddc5..1a3d4ba 100644 --- a/source/PlayerSettings.hx +++ b/source/kitty/backend/PlayerSettings.hx @@ -1,8 +1,6 @@ -package; +package kitty.backend; -import Controls; import flixel.FlxCamera; -import flixel.FlxG; import flixel.util.FlxSignal; // import ui.DeviceManager; diff --git a/source/Ratings.hx b/source/kitty/backend/Ratings.hx similarity index 98% rename from source/Ratings.hx rename to source/kitty/backend/Ratings.hx index 758f8bf..2964db9 100644 --- a/source/Ratings.hx +++ b/source/kitty/backend/Ratings.hx @@ -1,4 +1,6 @@ -import flixel.FlxG; +package kitty.backend; + +import kitty.states.PlayState; class Ratings { @@ -91,7 +93,7 @@ class Ratings return ranking; } - + public static function CalculateRating(noteDiff:Float, ?customSafeZone:Float):String // Generate a judgement through some timing shit { @@ -109,7 +111,7 @@ class Ratings if (FlxG.save.data.botplay && !PlayState.loadRep) return "sick"; // FUNNY - + var rating = checkRating(noteDiff,customTimeScale); @@ -122,7 +124,7 @@ class Ratings var rating = "sick"; if (ms <= 166 * ts && ms >= 135 * ts) rating = "shit"; - if (ms < 135 * ts && ms >= 90 * ts) + if (ms < 135 * ts && ms >= 90 * ts) rating = "bad"; if (ms < 90 * ts && ms >= 45 * ts) rating = "good"; diff --git a/source/Replay.hx b/source/kitty/backend/Replay.hx similarity index 96% rename from source/Replay.hx rename to source/kitty/backend/Replay.hx index 49a8f69..6fc0543 100644 --- a/source/Replay.hx +++ b/source/kitty/backend/Replay.hx @@ -1,8 +1,8 @@ +package kitty.backend; + #if sys import sys.io.File; #end -import Controls.Control; -import flixel.FlxG; import openfl.events.IOErrorEvent; import openfl.events.Event; import openfl.net.FileReference; @@ -10,6 +10,7 @@ import lime.utils.Assets; import haxe.Json; import flixel.input.keyboard.FlxKey; import openfl.utils.Dictionary; +import kitty.states.PlayState; class Ana { @@ -60,7 +61,7 @@ class Replay { this.path = path; replay = { - songName: "No Song Found", + songName: "No Song Found", songDiff: "normal", noteSpeed: 1.5, isDownscroll: false, @@ -96,7 +97,7 @@ class Replay }; var data:String = Json.stringify(json); - + var time = Date.now().getTime(); #if sys diff --git a/source/Section.hx b/source/kitty/backend/Section.hx similarity index 96% rename from source/Section.hx rename to source/kitty/backend/Section.hx index f153da5..23ee070 100644 --- a/source/Section.hx +++ b/source/kitty/backend/Section.hx @@ -1,4 +1,4 @@ -package; +package kitty.backend; typedef SwagSection = { diff --git a/source/Song.hx b/source/kitty/backend/Song.hx similarity index 97% rename from source/Song.hx rename to source/kitty/backend/Song.hx index 69d852c..c00785a 100644 --- a/source/Song.hx +++ b/source/kitty/backend/Song.hx @@ -1,9 +1,9 @@ -package; +package kitty.backend; import moonchart.formats.fnf.legacy.FNFPsych; import moonchart.backend.FormatDetector; -import Section.SwagSection; +import kitty.backend.Section; import haxe.Json; using StringTools; @@ -49,7 +49,7 @@ class Song public static function loadFromJson(jsonInput:String, ?diff:String = "normal", ?variant:String = null):SwagSong { - var folderLowercase = StringTools.replace(jsonInput, " ", "-").toLowerCase(); + var folderLowercase = StringTools.replace(jsonInput, " ", "-").toLowerCase(); trace('loading ' + folderLowercase); if (Paths.exists("data/songs/" + folderLowercase + '/chart-${variant.toLowerCase()}.json') || Paths.exists("data/songs/" + folderLowercase + '/' + diff.toLowerCase() + '-${variant.toLowerCase()}' + ".json")) @@ -73,7 +73,7 @@ class Song var epicSong:SwagSong = cast new FNFPsych().fromFormat(fromFormat, diff.toLowerCase()).data.song; epicSong.stage = fromFormat.data.song.stage; //why the fuck does this happen what...? epicSong.events = fromFormat.data.song.events; - + return epicSong; } } diff --git a/source/HitGraph.hx b/source/kitty/backend/objects/HitGraph.hx similarity index 98% rename from source/HitGraph.hx rename to source/kitty/backend/objects/HitGraph.hx index dc22582..eefddb3 100644 --- a/source/HitGraph.hx +++ b/source/kitty/backend/objects/HitGraph.hx @@ -1,4 +1,5 @@ -import flixel.FlxG; +package kitty.backend.objects; + import openfl.display.Bitmap; import openfl.display.BitmapData; import openfl.text.TextFieldAutoSize; @@ -10,8 +11,8 @@ import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFormatAlign; import flixel.math.FlxMath; -import flixel.util.FlxColor; import flixel.util.FlxDestroyUtil; +import kitty.states.PlayState; /** * stolen from https://github.com/HaxeFlixel/flixel/blob/master/flixel/system/debug/stats/StatsGraph.hx @@ -95,7 +96,7 @@ class HitGraph extends Sprite gfx.moveTo(0, _height / 2); gfx.lineTo(_width, _height / 2); - + } public static function createTextField(X:Float = 0, Y:Float = 0, Color:FlxColor = FlxColor.WHITE, Size:Int = 12):TextField @@ -201,7 +202,7 @@ class HitGraph extends Sprite if (ana.hit) gfx.beginFill(0xFFFF00); - else + else gfx.beginFill(0xC2B280); if (ana.hitTime < 0) @@ -252,7 +253,7 @@ class HitGraph extends Sprite { return (x / FlxG.sound.music.length) * width; } - + public function addToHistory(diff:Float, judge:String, time:Float) { history.push([diff,judge, time]); diff --git a/source/OFLSprite.hx b/source/kitty/backend/objects/OFLSprite.hx similarity index 96% rename from source/OFLSprite.hx rename to source/kitty/backend/objects/OFLSprite.hx index abea3a0..f1de6bf 100644 --- a/source/OFLSprite.hx +++ b/source/kitty/backend/objects/OFLSprite.hx @@ -1,3 +1,5 @@ +package kitty.backend.objects; + import flixel.util.FlxColor; import openfl.display.Sprite; import flixel.FlxSprite; diff --git a/source/Alphabet.hx b/source/kitty/objects/Alphabet.hx similarity index 98% rename from source/Alphabet.hx rename to source/kitty/objects/Alphabet.hx index 2ee11e6..1bf6a4d 100644 --- a/source/Alphabet.hx +++ b/source/kitty/objects/Alphabet.hx @@ -1,12 +1,7 @@ -package; +package kitty.objects; -import flixel.FlxG; -import flixel.FlxSprite; import flixel.group.FlxSpriteGroup; import flixel.math.FlxMath; -import flixel.util.FlxTimer; - -using StringTools; /** * Loosley based on FlxTypeText lolol @@ -83,7 +78,7 @@ class Alphabet extends FlxSpriteGroup listOAlphabets.clear(); x = pastX; y = pastY; - + addText(); } diff --git a/source/BackgroundGirls.hx b/source/kitty/objects/BackgroundGirls.hx similarity index 97% rename from source/BackgroundGirls.hx rename to source/kitty/objects/BackgroundGirls.hx index c37b16f..505ef4e 100644 --- a/source/BackgroundGirls.hx +++ b/source/kitty/objects/BackgroundGirls.hx @@ -1,4 +1,4 @@ -package; +package kitty.objects; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; diff --git a/source/Boyfriend.hx b/source/kitty/objects/Boyfriend.hx similarity index 97% rename from source/Boyfriend.hx rename to source/kitty/objects/Boyfriend.hx index 52c1aca..8183410 100644 --- a/source/Boyfriend.hx +++ b/source/kitty/objects/Boyfriend.hx @@ -1,4 +1,4 @@ -package; +package kitty.objects; using StringTools; diff --git a/source/Character.hx b/source/kitty/objects/Character.hx similarity index 99% rename from source/Character.hx rename to source/kitty/objects/Character.hx index c5bd589..1a7bb8c 100644 --- a/source/Character.hx +++ b/source/kitty/objects/Character.hx @@ -1,4 +1,4 @@ -package; +package kitty.objects; import flixel.util.FlxColor; import flixel.FlxSprite; @@ -45,7 +45,7 @@ class Character extends FlxSprite var charAnims:Array = []; charAnims = charJson.animations; - + for (anim in charAnims) { if (anim.indices.length == 0 || anim.indices == null) animation.addByPrefix(anim.anim, anim.name, anim.fps, anim.loop); diff --git a/source/DialogueBox.hx b/source/kitty/objects/DialogueBox.hx similarity index 97% rename from source/DialogueBox.hx rename to source/kitty/objects/DialogueBox.hx index d52358c..e945f51 100644 --- a/source/DialogueBox.hx +++ b/source/kitty/objects/DialogueBox.hx @@ -1,16 +1,11 @@ -package; +package kitty.objects; -import flixel.FlxG; -import flixel.FlxSprite; import flixel.addons.text.FlxTypeText; import flixel.graphics.frames.FlxAtlasFrames; import flixel.group.FlxSpriteGroup; import flixel.input.FlxKeyManager; import flixel.text.FlxText; -import flixel.util.FlxColor; -import flixel.util.FlxTimer; - -using StringTools; +import kitty.states.PlayState; class DialogueBox extends FlxSpriteGroup { @@ -61,7 +56,7 @@ class DialogueBox extends FlxSpriteGroup }, 5); box = new FlxSprite(-20, 45); - + var hasDialog = false; switch (PlayState.SONG.song.toLowerCase()) { @@ -90,10 +85,10 @@ class DialogueBox extends FlxSpriteGroup } this.dialogueList = dialogueList; - + if (!hasDialog) return; - + portraitLeft = new FlxSprite(-20, 40); portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait'); portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false); @@ -111,7 +106,7 @@ class DialogueBox extends FlxSpriteGroup portraitRight.scrollFactor.set(); add(portraitRight); portraitRight.visible = false; - + box.animation.play('normalOpen'); box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9)); box.updateHitbox(); @@ -180,7 +175,7 @@ class DialogueBox extends FlxSpriteGroup if (PlayerSettings.player1.controls.ACCEPT && dialogueStarted == true) { remove(dialogue); - + FlxG.sound.play(Paths.sound('clickText'), 0.8); if (dialogueList[1] == null && dialogueList[0] != null) @@ -215,7 +210,7 @@ class DialogueBox extends FlxSpriteGroup startDialogue(); } } - + super.update(elapsed); } diff --git a/source/HealthIcon.hx b/source/kitty/objects/HealthIcon.hx similarity index 97% rename from source/HealthIcon.hx rename to source/kitty/objects/HealthIcon.hx index 553068c..b49cfaf 100644 --- a/source/HealthIcon.hx +++ b/source/kitty/objects/HealthIcon.hx @@ -1,4 +1,4 @@ -package; +package kitty.objects; import flixel.FlxSprite; @@ -12,7 +12,7 @@ class HealthIcon extends FlxSprite public function new(char:String = 'bf', isPlayer:Bool = false) { super(); - + loadGraphic(Paths.image('icons/icon-$char') == null ? Paths.image('icons/icon-face') : Paths.image('icons/icon-$char'), true, 150, 150); antialiasing = true; animation.add('icon', [0, 1], 0, false, isPlayer); diff --git a/source/MenuCharacter.hx b/source/kitty/objects/MenuCharacter.hx similarity index 98% rename from source/MenuCharacter.hx rename to source/kitty/objects/MenuCharacter.hx index 1cf3e5b..83e6e93 100644 --- a/source/MenuCharacter.hx +++ b/source/kitty/objects/MenuCharacter.hx @@ -1,4 +1,4 @@ -package; +package kitty.objects; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; diff --git a/source/MenuItem.hx b/source/kitty/objects/MenuItem.hx similarity index 98% rename from source/MenuItem.hx rename to source/kitty/objects/MenuItem.hx index 5f8304b..64d575b 100644 --- a/source/MenuItem.hx +++ b/source/kitty/objects/MenuItem.hx @@ -1,4 +1,4 @@ -package; +package kitty.objects; import flixel.FlxG; import flixel.FlxSprite; @@ -40,7 +40,7 @@ class MenuItem extends FlxSpriteGroup if (isFlashing) flashingInt += 1; - + if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) week.color = 0xFF33ffff; else if (FlxG.save.data.flashing) diff --git a/source/Note.hx b/source/kitty/objects/Note.hx similarity index 97% rename from source/Note.hx rename to source/kitty/objects/Note.hx index 5ff1e06..7a0af9b 100644 --- a/source/Note.hx +++ b/source/kitty/objects/Note.hx @@ -1,10 +1,6 @@ -package; +package kitty.objects; -import flixel.FlxG; -import flixel.FlxSprite; -import PlayState; - -using StringTools; +import kitty.states.PlayState; class Note extends FlxSprite { @@ -126,7 +122,7 @@ class Note extends FlxSprite // we make sure its downscroll and its a SUSTAIN NOTE (aka a trail, not a note) // and flip it so it doesn't look weird. // THIS DOESN'T FUCKING FLIP THE NOTE, CONTRIBUTERS DON'T JUST COMMENT THIS OUT JESUS - if (FlxG.save.data.downscroll && sustainNote) + if (FlxG.save.data.downscroll && sustainNote) flipY = true; if (isSustainNote && prevNote != null && prevNote != this) diff --git a/source/NoteSplash.hx b/source/kitty/objects/NoteSplash.hx similarity index 97% rename from source/NoteSplash.hx rename to source/kitty/objects/NoteSplash.hx index d6ef2d9..b015916 100644 --- a/source/NoteSplash.hx +++ b/source/kitty/objects/NoteSplash.hx @@ -1,4 +1,4 @@ -package; +package kitty.objects; import flixel.FlxG; import flixel.FlxSprite; diff --git a/source/Options.hx b/source/kitty/objects/Options.hx similarity index 97% rename from source/Options.hx rename to source/kitty/objects/Options.hx index b6c3386..1ccad08 100644 --- a/source/Options.hx +++ b/source/kitty/objects/Options.hx @@ -1,12 +1,16 @@ -package; +package kitty.objects; import lime.app.Application; import lime.system.DisplayMode; -import flixel.util.FlxColor; -import Controls.KeyboardScheme; -import flixel.FlxG; import openfl.display.FPS; import openfl.Lib; +import kitty.states.menus.options.OptionsMenu; +import kitty.backend.HelperFunctions; +import kitty.states.menus.options.KeyBindMenu; +import kitty.states.LoadReplayState; +import kitty.states.menus.options.GameplayCustomizeState; +import kitty.states.PlayState; +import kitty.backend.Song; class OptionCategory { @@ -21,7 +25,7 @@ class OptionCategory _options.push(opt); } - + public final function removeOption(opt:Option) { _options.remove(opt); @@ -64,7 +68,7 @@ class Option } public function getValue():String { return throw "stub!"; }; - + // Returns whether the label is to be updated. public function press():Bool { return throw "stub!"; } private function updateDisplay():String { return throw "stub!"; } @@ -107,7 +111,7 @@ class CpuStrums extends Option public override function press():Bool { FlxG.save.data.cpuStrums = !FlxG.save.data.cpuStrums; - + display = updateDisplay(); return true; } @@ -130,7 +134,7 @@ class IconColor extends Option public override function press():Bool { FlxG.save.data.iconColor = !FlxG.save.data.iconColor; - + display = updateDisplay(); return true; } @@ -307,7 +311,7 @@ class ShowInput extends Option class Judgement extends Option { - + public function new(desc:String) { @@ -315,7 +319,7 @@ class Judgement extends Option description = desc; acceptValues = true; } - + public override function press():Bool { return true; @@ -342,7 +346,7 @@ class Judgement extends Option return "Safe Frames: " + Conductor.safeFrames + " - SIK: " + HelperFunctions.truncateFloat(45 * Conductor.timeScale, 0) + "ms GD: " + HelperFunctions.truncateFloat(90 * Conductor.timeScale, 0) + - "ms BD: " + HelperFunctions.truncateFloat(135 * Conductor.timeScale, 0) + + "ms BD: " + HelperFunctions.truncateFloat(135 * Conductor.timeScale, 0) + "ms SHT: " + HelperFunctions.truncateFloat(166 * Conductor.timeScale, 0) + "ms TOTAL: " + HelperFunctions.truncateFloat(Conductor.safeZoneOffset,0) + "ms"; } @@ -424,7 +428,7 @@ class FPSCapOption extends Option { return "FPS Cap"; } - + override function right():Bool { if (FlxG.save.data.fpsCap >= 290) { @@ -451,7 +455,7 @@ class FPSCapOption extends Option override function getValue():String { - return "Current FPS Cap: " + FlxG.save.data.fpsCap + + return "Current FPS Cap: " + FlxG.save.data.fpsCap + (FlxG.save.data.fpsCap == Application.current.window.displayMode.refreshRate ? "Hz (Refresh Rate)" : ""); } } @@ -534,14 +538,14 @@ class Optimization extends Option super(); description = desc; } - + public override function press():Bool { FlxG.save.data.optimize = !FlxG.save.data.optimize; display = updateDisplay(); return true; } - + private override function updateDisplay():String { return "Optimization " + (FlxG.save.data.optimize ? "ON" : "OFF"); @@ -576,7 +580,7 @@ class ReplayOption extends Option super(); description = desc; } - + public override function press():Bool { trace("switch"); @@ -597,7 +601,7 @@ class AccuracyDOption extends Option super(); description = desc; } - + public override function press():Bool { FlxG.save.data.accuracyMod = FlxG.save.data.accuracyMod == 1 ? 0 : 1; @@ -688,7 +692,7 @@ class BotPlay extends Option super(); description = desc; } - + public override function press():Bool { FlxG.save.data.botplay = !FlxG.save.data.botplay; @@ -696,7 +700,7 @@ class BotPlay extends Option display = updateDisplay(); return true; } - + private override function updateDisplay():String return "BotPlay " + (FlxG.save.data.botplay ? "on" : "off"); } diff --git a/source/HScript.hx b/source/kitty/scripting/HScript.hx similarity index 97% rename from source/HScript.hx rename to source/kitty/scripting/HScript.hx index ae9b6bf..2630004 100644 --- a/source/HScript.hx +++ b/source/kitty/scripting/HScript.hx @@ -1,7 +1,9 @@ -package; +package kitty.scripting; import sys.FileSystem; import flixel.FlxG; +import kitty.states.PlayState; +import kitty.backend.PlayStateChangeables; #if sys import openfl.Assets; import hscript.*; diff --git a/source/ModchartState.hx b/source/kitty/scripting/ModchartState.hx similarity index 98% rename from source/ModchartState.hx rename to source/kitty/scripting/ModchartState.hx index a9c196f..0845adb 100644 --- a/source/ModchartState.hx +++ b/source/kitty/scripting/ModchartState.hx @@ -1,3 +1,5 @@ +package kitty.scripting; + // this file is for modchart things, this is to declutter playstate.hx // Lua @@ -5,23 +7,22 @@ import openfl.display3D.textures.VideoTexture; import flixel.graphics.FlxGraphic; import flixel.graphics.frames.FlxAtlasFrames; #if windows -import flixel.tweens.FlxEase; import openfl.filters.ShaderFilter; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; import openfl.geom.Matrix; import openfl.display.BitmapData; import lime.app.Application; -import flixel.FlxSprite; import llua.Convert; import llua.Lua; import llua.State; import llua.LuaL; import flixel.FlxBasic; import flixel.FlxCamera; -import flixel.FlxG; +import kitty.states.menus.MainMenuState; +import kitty.states.PlayState; +import kitty.objects.Character; +import kitty.objects.Boyfriend; -class ModchartState +class ModchartState { //public static var shaders:Array = null; @@ -223,7 +224,7 @@ class ModchartState { if (Std.parseInt(id) == null) return Reflect.getProperty(PlayState.instance,id); - return PlayState.PlayState.instance.strumLineNotes.members[Std.parseInt(id)]; + return PlayState.instance.strumLineNotes.members[Std.parseInt(id)]; } return luaSprites.get(id); } @@ -309,7 +310,7 @@ class ModchartState data2.fillRect(data2.rect, FlxColor.TRANSPARENT); data2.draw(data, matrix, null, null, null, true); sprite.pixels = data2; - + luaSprites.set(toBeCalled,sprite); // and I quote: // shitty layering but it works! @@ -349,14 +350,14 @@ class ModchartState trace("Lua version: " + Lua.version()); trace("LuaJIT version: " + Lua.versionJIT()); Lua.init_callbacks(lua); - + //shaders = new Array(); // pre lowercasing the song name (new) var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); var result = LuaL.dofile(lua, Paths.lua(songLowercase + "/modchart")); // execute le file - + if (result != 0) { Application.current.window.alert("LUA COMPILE ERROR:\n" + Lua.tostring(lua,result),"Kade Engine Modcharts"); @@ -365,7 +366,7 @@ class ModchartState } // get some fukin globals up in here bois - + setVar("difficulty", PlayState.storyDifficulty); setVar("bpm", Conductor.bpm); setVar("scrollspeed", FlxG.save.data.scrollSpeed != 1 ? FlxG.save.data.scrollSpeed : PlayState.SONG.speed); @@ -373,48 +374,48 @@ class ModchartState setVar("downscroll", FlxG.save.data.downscroll); setVar("flashing", FlxG.save.data.flashing); setVar("distractions", FlxG.save.data.distractions); - + setVar("curStep", 0); setVar("curBeat", 0); setVar("crochet", Conductor.stepCrochet); setVar("safeZoneOffset", Conductor.safeZoneOffset); - + setVar("hudZoom", PlayState.instance.camHUD.zoom); setVar("cameraZoom", FlxG.camera.zoom); - + setVar("cameraAngle", FlxG.camera.angle); setVar("camHudAngle", PlayState.instance.camHUD.angle); - + setVar("followXOffset",0); setVar("followYOffset",0); - + setVar("showOnlyStrums", false); setVar("strumLine1Visible", true); setVar("strumLine2Visible", true); - + setVar("screenWidth",FlxG.width); setVar("screenHeight",FlxG.height); setVar("windowWidth",FlxG.width); setVar("windowHeight",FlxG.height); setVar("hudWidth", PlayState.instance.camHUD.width); setVar("hudHeight", PlayState.instance.camHUD.height); - + setVar("mustHit", false); setVar("strumLineY", PlayState.instance.strumLine.y); - + // callbacks - + // sprites - + Lua_helper.add_callback(lua,"makeSprite", makeLuaSprite); - + Lua_helper.add_callback(lua,"changeDadCharacter", changeDadCharacter); Lua_helper.add_callback(lua,"changeBoyfriendCharacter", changeBoyfriendCharacter); - + Lua_helper.add_callback(lua,"getProperty", getPropertyByName); - + // Lua_helper.add_callback(lua,"makeAnimatedSprite", makeAnimatedLuaSprite); // this one is still in development @@ -425,13 +426,13 @@ class ModchartState PlayState.instance.removeObject(sprite); return true; }); - + // hud/camera - + Lua_helper.add_callback(lua,"setHudAngle", function (x:Float) { PlayState.instance.camHUD.angle = x; }); - + Lua_helper.add_callback(lua,"setHealth", function (heal:Float) { PlayState.instance.health = heal; }); @@ -440,53 +441,53 @@ class ModchartState PlayState.instance.camHUD.x = x; PlayState.instance.camHUD.y = y; }); - + Lua_helper.add_callback(lua,"getHudX", function () { return PlayState.instance.camHUD.x; }); - + Lua_helper.add_callback(lua,"getHudY", function () { return PlayState.instance.camHUD.y; }); - + Lua_helper.add_callback(lua,"setCamPosition", function (x:Int, y:Int) { FlxG.camera.x = x; FlxG.camera.y = y; }); - + Lua_helper.add_callback(lua,"getCameraX", function () { return FlxG.camera.x; }); - + Lua_helper.add_callback(lua,"getCameraY", function () { return FlxG.camera.y; }); - + Lua_helper.add_callback(lua,"setCamZoom", function(zoomAmount:Float) { FlxG.camera.zoom = zoomAmount; }); - + Lua_helper.add_callback(lua,"setHudZoom", function(zoomAmount:Float) { PlayState.instance.camHUD.zoom = zoomAmount; }); - + // strumline Lua_helper.add_callback(lua, "setStrumlineY", function(y:Float) { PlayState.instance.strumLine.y = y; }); - + // actors - + Lua_helper.add_callback(lua,"getRenderedNotes", function() { return PlayState.instance.notes.length; }); - + Lua_helper.add_callback(lua,"getRenderedNoteX", function(id:Int) { return PlayState.instance.notes.members[id].x; }); - + Lua_helper.add_callback(lua,"getRenderedNoteY", function(id:Int) { return PlayState.instance.notes.members[id].y; }); @@ -503,7 +504,7 @@ class ModchartState return PlayState.instance.notes.members[id].prevNote.isSustainNote; }); - + Lua_helper.add_callback(lua,"getRenderedNoteParentX", function(id:Int) { return PlayState.instance.notes.members[id].prevNote.x; }); @@ -529,11 +530,11 @@ class ModchartState Lua_helper.add_callback(lua,"getRenderedNoteStrumtime", function(id:Int) { return PlayState.instance.notes.members[id].strumTime; }); - + Lua_helper.add_callback(lua,"getRenderedNoteScaleX", function(id:Int) { return PlayState.instance.notes.members[id].scale.x; }); - + Lua_helper.add_callback(lua,"setRenderedNotePos", function(x:Float,y:Float, id:Int) { if (PlayState.instance.notes.members[id] == null) throw('error! you cannot set a rendered notes position when it doesnt exist! ID: ' + id); @@ -544,12 +545,12 @@ class ModchartState PlayState.instance.notes.members[id].y = y; } }); - + Lua_helper.add_callback(lua,"setRenderedNoteAlpha", function(alpha:Float, id:Int) { PlayState.instance.notes.members[id].modifiedByLua = true; PlayState.instance.notes.members[id].alpha = alpha; }); - + Lua_helper.add_callback(lua,"setRenderedNoteScale", function(scale:Float, id:Int) { PlayState.instance.notes.members[id].modifiedByLua = true; PlayState.instance.notes.members[id].setGraphicSize(Std.int(PlayState.instance.notes.members[id].width * scale)); @@ -569,31 +570,31 @@ class ModchartState PlayState.instance.notes.members[id].modifiedByLua = true; PlayState.instance.notes.members[id].angle = angle; }); - + Lua_helper.add_callback(lua,"setActorX", function(x:Int,id:String) { getActorByName(id).x = x; }); - + Lua_helper.add_callback(lua,"setActorAccelerationX", function(x:Int,id:String) { getActorByName(id).acceleration.x = x; }); - + Lua_helper.add_callback(lua,"setActorDragX", function(x:Int,id:String) { getActorByName(id).drag.x = x; }); - + Lua_helper.add_callback(lua,"setActorVelocityX", function(x:Int,id:String) { getActorByName(id).velocity.x = x; }); - + Lua_helper.add_callback(lua,"playActorAnimation", function(id:String,anim:String,force:Bool = false,reverse:Bool = false) { getActorByName(id).playAnim(anim, force, reverse); }); - + Lua_helper.add_callback(lua,"setActorAlpha", function(alpha:Float,id:String) { getActorByName(id).alpha = alpha; }); - + Lua_helper.add_callback(lua,"setActorY", function(y:Int,id:String) { getActorByName(id).y = y; }); @@ -601,28 +602,28 @@ class ModchartState Lua_helper.add_callback(lua,"setActorAccelerationY", function(y:Int,id:String) { getActorByName(id).acceleration.y = y; }); - + Lua_helper.add_callback(lua,"setActorDragY", function(y:Int,id:String) { getActorByName(id).drag.y = y; }); - + Lua_helper.add_callback(lua,"setActorVelocityY", function(y:Int,id:String) { getActorByName(id).velocity.y = y; }); - + Lua_helper.add_callback(lua,"setActorAngle", function(angle:Int,id:String) { getActorByName(id).angle = angle; }); - + Lua_helper.add_callback(lua,"setActorScale", function(scale:Float,id:String) { getActorByName(id).setGraphicSize(Std.int(getActorByName(id).width * scale)); }); - + Lua_helper.add_callback(lua, "setActorScaleXY", function(scaleX:Float, scaleY:Float, id:String) { getActorByName(id).setGraphicSize(Std.int(getActorByName(id).width * scaleX), Std.int(getActorByName(id).height * scaleY)); }); - + Lua_helper.add_callback(lua, "setActorFlipX", function(flip:Bool, id:String) { getActorByName(id).flipX = flip; @@ -632,27 +633,27 @@ class ModchartState { getActorByName(id).flipY = flip; }); - + Lua_helper.add_callback(lua,"getActorWidth", function (id:String) { return getActorByName(id).width; }); - + Lua_helper.add_callback(lua,"getActorHeight", function (id:String) { return getActorByName(id).height; }); - + Lua_helper.add_callback(lua,"getActorAlpha", function(id:String) { return getActorByName(id).alpha; }); - + Lua_helper.add_callback(lua,"getActorAngle", function(id:String) { return getActorByName(id).angle; }); - + Lua_helper.add_callback(lua,"getActorX", function (id:String) { return getActorByName(id).x; }); - + Lua_helper.add_callback(lua,"getActorY", function (id:String) { return getActorByName(id).y; }); @@ -673,7 +674,7 @@ class ModchartState Lua_helper.add_callback(lua,"resizeWindow",function(Width:Int,Height:Int) { Application.current.window.resize(Width,Height); }); - + Lua_helper.add_callback(lua,"getScreenWidth",function() { return Application.current.window.display.currentMode.width; }); @@ -690,13 +691,13 @@ class ModchartState return Application.current.window.height; }); - + // tweens - + Lua_helper.add_callback(lua,"tweenCameraPos", function(toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(FlxG.camera, {x: toX, y: toY}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); - + Lua_helper.add_callback(lua,"tweenCameraAngle", function(toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(FlxG.camera, {angle:toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); @@ -708,7 +709,7 @@ class ModchartState Lua_helper.add_callback(lua,"tweenHudPos", function(toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(PlayState.instance.camHUD, {x: toX, y: toY}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); - + Lua_helper.add_callback(lua,"tweenHudAngle", function(toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(PlayState.instance.camHUD, {angle:toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); @@ -720,15 +721,15 @@ class ModchartState Lua_helper.add_callback(lua,"tweenPos", function(id:String, toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {x: toX, y: toY}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenPosXAngle", function(id:String, toX:Int, toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {x: toX, angle: toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenPosYAngle", function(id:String, toY:Int, toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {y: toY, angle: toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenAngle", function(id:String, toAngle:Int, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {angle: toAngle}, time, {ease: FlxEase.linear, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); @@ -736,7 +737,7 @@ class ModchartState Lua_helper.add_callback(lua,"tweenCameraPosOut", function(toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(FlxG.camera, {x: toX, y: toY}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); - + Lua_helper.add_callback(lua,"tweenCameraAngleOut", function(toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(FlxG.camera, {angle:toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); @@ -748,7 +749,7 @@ class ModchartState Lua_helper.add_callback(lua,"tweenHudPosOut", function(toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(PlayState.instance.camHUD, {x: toX, y: toY}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); - + Lua_helper.add_callback(lua,"tweenHudAngleOut", function(toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(PlayState.instance.camHUD, {angle:toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); @@ -760,15 +761,15 @@ class ModchartState Lua_helper.add_callback(lua,"tweenPosOut", function(id:String, toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {x: toX, y: toY}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenPosXAngleOut", function(id:String, toX:Int, toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {x: toX, angle: toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenPosYAngleOut", function(id:String, toY:Int, toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {y: toY, angle: toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenAngleOut", function(id:String, toAngle:Int, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {angle: toAngle}, time, {ease: FlxEase.cubeOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); @@ -776,7 +777,7 @@ class ModchartState Lua_helper.add_callback(lua,"tweenCameraPosIn", function(toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(FlxG.camera, {x: toX, y: toY}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); - + Lua_helper.add_callback(lua,"tweenCameraAngleIn", function(toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(FlxG.camera, {angle:toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); @@ -788,7 +789,7 @@ class ModchartState Lua_helper.add_callback(lua,"tweenHudPosIn", function(toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(PlayState.instance.camHUD, {x: toX, y: toY}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); - + Lua_helper.add_callback(lua,"tweenHudAngleIn", function(toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(PlayState.instance.camHUD, {angle:toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,["camera"]);}}}); }); @@ -800,30 +801,30 @@ class ModchartState Lua_helper.add_callback(lua,"tweenPosIn", function(id:String, toX:Int, toY:Int, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {x: toX, y: toY}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenPosXAngleIn", function(id:String, toX:Int, toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {x: toX, angle: toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenPosYAngleIn", function(id:String, toY:Int, toAngle:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {y: toY, angle: toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenAngleIn", function(id:String, toAngle:Int, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {angle: toAngle}, time, {ease: FlxEase.cubeIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenFadeIn", function(id:String, toAlpha:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {alpha: toAlpha}, time, {ease: FlxEase.circIn, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); - + Lua_helper.add_callback(lua,"tweenFadeOut", function(id:String, toAlpha:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {alpha: toAlpha}, time, {ease: FlxEase.circOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); //forgot and accidentally commit to master branch // shader - + /*Lua_helper.add_callback(lua,"createShader", function(frag:String,vert:String) { var shader:LuaShader = new LuaShader(frag,vert); @@ -834,7 +835,7 @@ class ModchartState return shaders.length == 1 ? 0 : shaders.length; }); - + Lua_helper.add_callback(lua,"setFilterHud", function(shaderIndex:Int) { PlayState.instance.camHUD.setFilters([new ShaderFilter(shaders[shaderIndex])]); }); diff --git a/source/BlendModeEffect.hx b/source/kitty/shaders/BlendModeEffect.hx similarity index 96% rename from source/BlendModeEffect.hx rename to source/kitty/shaders/BlendModeEffect.hx index 1c9038b..3dacfd4 100644 --- a/source/BlendModeEffect.hx +++ b/source/kitty/shaders/BlendModeEffect.hx @@ -1,4 +1,4 @@ -package; +package kitty.shaders; import flixel.util.FlxColor; import openfl.display.ShaderParameter; diff --git a/source/OverlayShader.hx b/source/kitty/shaders/OverlayShader.hx similarity index 96% rename from source/OverlayShader.hx rename to source/kitty/shaders/OverlayShader.hx index 4de9a55..a62830e 100644 --- a/source/OverlayShader.hx +++ b/source/kitty/shaders/OverlayShader.hx @@ -1,4 +1,4 @@ -package; +package kitty.shaders; import flixel.system.FlxAssets.FlxShader; diff --git a/source/WiggleEffect.hx b/source/kitty/shaders/WiggleEffect.hx similarity index 96% rename from source/WiggleEffect.hx rename to source/kitty/shaders/WiggleEffect.hx index ac2bd3b..de44cb4 100644 --- a/source/WiggleEffect.hx +++ b/source/kitty/shaders/WiggleEffect.hx @@ -1,4 +1,4 @@ -package; +package kitty.shaders; // STOLEN FROM HAXEFLIXEL DEMO LOL import flixel.system.FlxAssets.FlxShader; @@ -65,25 +65,25 @@ class WiggleShader extends FlxShader #pragma header //uniform float tx, ty; // x,y waves phase uniform float uTime; - + const int EFFECT_TYPE_DREAMY = 0; const int EFFECT_TYPE_WAVY = 1; const int EFFECT_TYPE_HEAT_WAVE_HORIZONTAL = 2; const int EFFECT_TYPE_HEAT_WAVE_VERTICAL = 3; const int EFFECT_TYPE_FLAG = 4; - + uniform int effectType; - + /** * How fast the waves move over time */ uniform float uSpeed; - + /** * Number of waves over time */ uniform float uFrequency; - + /** * How much the pixels are going to stretch over the waves */ @@ -93,13 +93,13 @@ class WiggleShader extends FlxShader { float x = 0.0; float y = 0.0; - - if (effectType == EFFECT_TYPE_DREAMY) + + if (effectType == EFFECT_TYPE_DREAMY) { float offsetX = sin(pt.y * uFrequency + uTime * uSpeed) * uWaveAmplitude; pt.x += offsetX; // * (pt.y - 1.0); // <- Uncomment to stop bottom part of the screen from moving } - else if (effectType == EFFECT_TYPE_WAVY) + else if (effectType == EFFECT_TYPE_WAVY) { float offsetY = sin(pt.x * uFrequency + uTime * uSpeed) * uWaveAmplitude; pt.y += offsetY; // * (pt.y - 1.0); // <- Uncomment to stop bottom part of the screen from moving @@ -117,7 +117,7 @@ class WiggleShader extends FlxShader y = sin(pt.y * uFrequency + 10.0 * pt.x + uTime * uSpeed) * uWaveAmplitude; x = sin(pt.x * uFrequency + 5.0 * pt.y + uTime * uSpeed) * uWaveAmplitude; } - + return vec2(pt.x + x, pt.y + y); } diff --git a/source/LoadReplayState.hx b/source/kitty/states/LoadReplayState.hx similarity index 92% rename from source/LoadReplayState.hx rename to source/kitty/states/LoadReplayState.hx index 67bb5fa..a9d47ca 100644 --- a/source/LoadReplayState.hx +++ b/source/kitty/states/LoadReplayState.hx @@ -1,27 +1,28 @@ -package; +package kitty.states; -import Controls.KeyboardScheme; -import Controls.Control; import flash.text.TextField; -import flixel.FlxG; -import flixel.FlxSprite; import flixel.addons.display.FlxGridOverlay; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.input.keyboard.FlxKey; import flixel.math.FlxMath; import flixel.text.FlxText; -import flixel.util.FlxColor; import lime.utils.Assets; #if sys import sys.io.File; #end +import kitty.states.menus.FreeplayState; +import kitty.objects.Alphabet; +import kitty.backend.Replay; +import kitty.states.menus.FreeplayState; +import kitty.states.menus.options.OptionsMenu; +import kitty.backend.Song; class LoadReplayState extends MusicBeatState { var selector:FlxText; var curSelected:Int = 0; - var songs:Array = []; + var songs:Array = []; var controlsStrings:Array = []; var actualNames:Array = []; @@ -75,7 +76,7 @@ class LoadReplayState extends MusicBeatState versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); add(versionShit); - + poggerDetails = new FlxText(5, 34, 0, "Replay Details - \nnone", 12); poggerDetails.scrollFactor.set(); poggerDetails.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); @@ -91,12 +92,12 @@ class LoadReplayState extends MusicBeatState var week:Int = 0; for (i in 0...songs.length) { - var pog:FreeplayState.SongMetadata = songs[i]; + var pog:SongMetadata = songs[i]; if (pog.songName == songName) week = pog.week; } return week; - } + } override function update(elapsed:Float) { @@ -108,7 +109,7 @@ class LoadReplayState extends MusicBeatState changeSelection(-1); if (controls.DOWN_P) changeSelection(1); - + if (controls.ACCEPT && grpControls.members[curSelected].text != "No Replays...") { diff --git a/source/OutdatedSubState.hx b/source/kitty/states/OutdatedSubState.hx similarity index 98% rename from source/OutdatedSubState.hx rename to source/kitty/states/OutdatedSubState.hx index 2802f31..592282b 100644 --- a/source/OutdatedSubState.hx +++ b/source/kitty/states/OutdatedSubState.hx @@ -1,4 +1,4 @@ -package; +package kitty.states; import flixel.FlxG; import flixel.FlxSprite; @@ -16,7 +16,7 @@ class OutdatedSubState extends MusicBeatState public static var needVer:String = "IDFK LOL"; public static var currChanges:String = "dk"; - + private var bgColors:Array = [ '#314d7f', '#4e7093', @@ -33,7 +33,7 @@ class OutdatedSubState extends MusicBeatState bg.scale.y *= 1.55; bg.screenCenter(); add(bg); - + var kadeLogo:FlxSprite = new FlxSprite(FlxG.width, 0).loadGraphic(Paths.image('KadeEngineLogo')); kadeLogo.scale.y = 0.3; kadeLogo.scale.x = 0.3; @@ -41,7 +41,7 @@ class OutdatedSubState extends MusicBeatState kadeLogo.y -= 180; kadeLogo.alpha = 0.8; add(kadeLogo); - + var txt:FlxText = new FlxText(0, 0, FlxG.width, "Your Kade Engine is outdated!\nYou are on " + MainMenuState.kadeEngineVer @@ -51,30 +51,30 @@ class OutdatedSubState extends MusicBeatState + "\n& more changes and bugfixes in the full changelog" + "\n\nPress Space to view the full changelog and update\nor ESCAPE to ignore this", 32); - + txt.setFormat("VCR OSD Mono", 32, FlxColor.fromRGB(200, 200, 200), CENTER); txt.borderColor = FlxColor.BLACK; txt.borderSize = 3; txt.borderStyle = FlxTextBorderStyle.OUTLINE; txt.screenCenter(); add(txt); - + FlxTween.color(bg, 2, bg.color, FlxColor.fromString(bgColors[colorRotation])); FlxTween.angle(kadeLogo, kadeLogo.angle, -10, 2, {ease: FlxEase.quartInOut}); - + new FlxTimer().start(2, function(tmr:FlxTimer) { FlxTween.color(bg, 2, bg.color, FlxColor.fromString(bgColors[colorRotation])); if(colorRotation < (bgColors.length - 1)) colorRotation++; else colorRotation = 0; }, 0); - + new FlxTimer().start(2, function(tmr:FlxTimer) { if(kadeLogo.angle == -10) FlxTween.angle(kadeLogo, kadeLogo.angle, 10, 2, {ease: FlxEase.quartInOut}); else FlxTween.angle(kadeLogo, kadeLogo.angle, -10, 2, {ease: FlxEase.quartInOut}); }, 0); - + new FlxTimer().start(0.8, function(tmr:FlxTimer) { if(kadeLogo.alpha == 0.8) FlxTween.tween(kadeLogo, {alpha: 1}, 0.8, {ease: FlxEase.quartInOut}); diff --git a/source/PlayState.hx b/source/kitty/states/PlayState.hx similarity index 99% rename from source/PlayState.hx rename to source/kitty/states/PlayState.hx index f01dab6..0fea2f3 100644 --- a/source/PlayState.hx +++ b/source/kitty/states/PlayState.hx @@ -1,39 +1,50 @@ -package; +package kitty.states; +import kitty.backend.PlayStateChangeables; import openfl.ui.Keyboard; import openfl.events.KeyboardEvent; -import Replay.Ana; -import Replay.Analysis; +import kitty.backend.Replay; import flixel.input.keyboard.FlxKey; import openfl.Lib; -import Section.SwagSection; -import Song.SwagSong; +import kitty.backend.Section; +import kitty.backend.Song; import flixel.FlxBasic; import flixel.FlxCamera; -import flixel.FlxG; import flixel.FlxObject; -import flixel.FlxSprite; import flixel.FlxSubState; import flixel.addons.effects.FlxTrail; import flixel.addons.transition.FlxTransitionableState; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.math.FlxMath; import flixel.math.FlxPoint; import flixel.math.FlxRect; import flixel.sound.FlxSound; import flixel.text.FlxText; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; import flixel.ui.FlxBar; -import flixel.util.FlxColor; import flixel.util.FlxSort; -import flixel.util.FlxTimer; +import kitty.objects.Boyfriend; +import kitty.objects.Character; +import kitty.objects.DialogueBox; +import kitty.objects.Note; +import kitty.objects.NoteSplash; +import kitty.objects.HealthIcon; +import kitty.objects.BackgroundGirls; +import kitty.shaders.WiggleEffect; +import kitty.scripting.HScript; +import kitty.scripting.ModchartState; +import kitty.backend.Ratings; +import kitty.backend.EtternaFunctions; +import kitty.backend.ConvertScore; +import kitty.backend.HelperFunctions; +import kitty.states.menus.options.OptionsMenu; +import kitty.states.menus.*; +import kitty.states.debug.AnimationDebug; +import kitty.states.editors.ChartingState; +import kitty.backend.KeyBinds; #if windows import sys.FileSystem; #end -using StringTools; - class PlayState extends MusicBeatState { public static var instance:PlayState = null; @@ -324,7 +335,7 @@ class PlayState extends MusicBeatState stageScript.interp.execute(stageScript.expr); } scripts.push(stageScript); - + for (epicSongScript in Paths.readDirectory('data/songs/$songLowercase/scripts')) { var songScript = new HScript('data/songs/$songLowercase/scripts/$epicSongScript'); @@ -1861,8 +1872,6 @@ class PlayState extends MusicBeatState sound.stop(); openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - - // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); } if (FlxG.save.data.resetButton) { @@ -2130,7 +2139,7 @@ class PlayState extends MusicBeatState notes.remove(daNote, true); } }); - + for (event in events) { if (Conductor.songPosition > event[0]) { events.remove(event); @@ -2192,13 +2201,13 @@ class PlayState extends MusicBeatState #end canPause = false; - + if (FlxG.sound.music != null) FlxG.sound.music.pause(); for (sound in FlxG.sound.list) sound.pause(); - + if (SONG.validScore) { // adjusting the highscore song name to be compatible diff --git a/source/ResultsScreen.hx b/source/kitty/states/ResultsScreen.hx similarity index 96% rename from source/ResultsScreen.hx rename to source/kitty/states/ResultsScreen.hx index 05d57db..5cd5792 100644 --- a/source/ResultsScreen.hx +++ b/source/kitty/states/ResultsScreen.hx @@ -1,31 +1,30 @@ -package; +package kitty.states; import openfl.geom.Matrix; import openfl.display.BitmapData; import flixel.sound.FlxSound; import flixel.util.FlxAxes; import flixel.FlxSubState; -import Options.Option; import flixel.input.FlxInput; import flixel.input.keyboard.FlxKey; -import flixel.FlxG; import flixel.FlxObject; -import flixel.FlxSprite; import flixel.effects.FlxFlicker; import flixel.graphics.frames.FlxAtlasFrames; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.text.FlxText; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; import lime.app.Application; import lime.utils.Assets; import flixel.math.FlxMath; import flixel.text.FlxText; import flixel.input.FlxKeyManager; - - -using StringTools; +import kitty.backend.objects.HitGraph; +import kitty.backend.objects.OFLSprite; +import kitty.backend.HelperFunctions; +import kitty.backend.KeyBinds; +import kitty.backend.Ratings; +import kitty.backend.Replay; +import kitty.backend.Song; +import kitty.states.menus.*; class ResultsScreen extends FlxSubState { @@ -48,7 +47,7 @@ class ResultsScreen extends FlxSubState public var accuracy:String; override function create() - { + { background = new FlxSprite(0,0).makeGraphic(FlxG.width,FlxG.height,FlxColor.BLACK); background.scrollFactor.set(); add(background); @@ -92,7 +91,7 @@ class ResultsScreen extends FlxSubState anotherBackground.scrollFactor.set(); anotherBackground.alpha = 0; add(anotherBackground); - + graph = new HitGraph(FlxG.width - 500,45,495,240); graph.alpha = 0; @@ -100,7 +99,7 @@ class ResultsScreen extends FlxSubState graphSprite.scrollFactor.set(); graphSprite.alpha = 0; - + add(graphSprite); @@ -174,7 +173,7 @@ class ResultsScreen extends FlxSubState if (PlayerSettings.player1.controls.ACCEPT) { music.fadeOut(0.3); - + PlayState.loadRep = false; PlayState.rep = null; @@ -243,6 +242,6 @@ class ResultsScreen extends FlxSubState } super.update(elapsed); - + } } diff --git a/source/AnimationDebug.hx b/source/kitty/states/debug/AnimationDebug.hx similarity index 96% rename from source/AnimationDebug.hx rename to source/kitty/states/debug/AnimationDebug.hx index 05b40d6..8669469 100644 --- a/source/AnimationDebug.hx +++ b/source/kitty/states/debug/AnimationDebug.hx @@ -1,13 +1,12 @@ -package; +package kitty.states.debug; -import flixel.FlxG; import flixel.FlxObject; -import flixel.FlxSprite; import flixel.FlxState; import flixel.addons.display.FlxGridOverlay; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.text.FlxText; -import flixel.util.FlxColor; +import kitty.objects.Character; +import kitty.objects.Boyfriend; /** *DEBUG MODE diff --git a/source/ChartingState.hx b/source/kitty/states/editors/ChartingState.hx similarity index 99% rename from source/ChartingState.hx rename to source/kitty/states/editors/ChartingState.hx index 69b95a3..2f63923 100644 --- a/source/ChartingState.hx +++ b/source/kitty/states/editors/ChartingState.hx @@ -1,13 +1,11 @@ -package; +package kitty.states.editors; import flixel.FlxCamera; import flixel.addons.ui.FlxUIText; import haxe.zip.Writer; -import Conductor.BPMChangeEvent; -import Section.SwagSection; -import Song.SwagSong; -import flixel.FlxG; -import flixel.FlxSprite; +import kitty.backend.Section; +import kitty.backend.Song; +import kitty.objects.Note; import flixel.addons.display.FlxGridOverlay; import flixel.addons.ui.FlxInputText; import flixel.addons.ui.FlxUI9SliceSprite; @@ -18,7 +16,6 @@ import flixel.addons.ui.FlxUIInputText; import flixel.addons.ui.FlxUINumericStepper; import flixel.addons.ui.FlxUITabMenu; import flixel.addons.ui.FlxUITooltip.FlxUITooltipStyle; -import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup; import flixel.math.FlxMath; import flixel.math.FlxPoint; @@ -26,7 +23,6 @@ import flixel.sound.FlxSound; import flixel.text.FlxText; import flixel.ui.FlxButton; import flixel.ui.FlxSpriteButton; -import flixel.util.FlxColor; import haxe.Json; import lime.utils.Assets; import openfl.events.Event; @@ -36,8 +32,9 @@ import openfl.events.IOErrorEvent; import openfl.media.Sound; import openfl.net.FileReference; import openfl.utils.ByteArray; - -using StringTools; +import kitty.objects.Character; +import kitty.objects.Boyfriend; +import kitty.objects.HealthIcon; class ChartingState extends MusicBeatState { @@ -248,7 +245,7 @@ class ChartingState extends MusicBeatState loadJson(_song.song.toLowerCase()); }); - + var restart = new FlxButton(10,140,"Reset Chart", function() { for (ii in 0..._song.notes.length) @@ -267,19 +264,19 @@ class ChartingState extends MusicBeatState stepperBPM.name = 'song_bpm'; var stepperBPMLabel = new FlxText(74,65,'BPM'); - + var stepperSpeed:FlxUINumericStepper = new FlxUINumericStepper(10, 80, 0.1, 1, 0.1, 10, 1); stepperSpeed.value = _song.speed; stepperSpeed.name = 'song_speed'; var stepperSpeedLabel = new FlxText(74,80,'Scroll Speed'); - + var stepperVocalVol:FlxUINumericStepper = new FlxUINumericStepper(10, 95, 0.1, 1, 0.1, 10, 1); stepperVocalVol.value = vocals.volume; stepperVocalVol.name = 'song_vocalvol'; var stepperVocalVolLabel = new FlxText(74, 95, 'Vocal Volume'); - + var stepperSongVol:FlxUINumericStepper = new FlxUINumericStepper(10, 110, 0.1, 1, 0.1, 10, 1); stepperSongVol.value = FlxG.sound.music.volume; stepperSongVol.name = 'song_instvol'; @@ -294,7 +291,7 @@ class ChartingState extends MusicBeatState var stepperSongVolLabel = new FlxText(74, 110, 'Instrumental Volume'); - + var shiftNoteDialLabel = new FlxText(10, 245, 'Shift Note FWD by (Section)'); var stepperShiftNoteDial:FlxUINumericStepper = new FlxUINumericStepper(10, 260, 1, 0, -1000, 1000, 0); stepperShiftNoteDial.name = 'song_shiftnote'; @@ -344,7 +341,7 @@ class ChartingState extends MusicBeatState _song.stage = stages[Std.parseInt(stage)]; }); stageDropDown.selectedLabel = _song.stage; - + var stageLabel = new FlxText(140,180,64,'Stage'); var noteStyleDropDown = new FlxUIDropDownMenu(10, 300, FlxUIDropDownMenu.makeStrIdLabelArray(noteStyles, true), function(noteStyle:String) @@ -472,7 +469,7 @@ class ChartingState extends MusicBeatState var stepperSusLength:FlxUINumericStepper; var tab_group_note:FlxUI; - + function addNoteUI():Void { tab_group_note = new FlxUI(null, UI_box); @@ -545,7 +542,7 @@ class ChartingState extends MusicBeatState // general shit var title:FlxText = new FlxText(UI_box.x + 20, UI_box.y + 20, 0); bullshitUI.add(title); - /* + /* var loopCheck = new FlxUICheckBox(UI_box.x + 10, UI_box.y + 50, null, null, "Loops", 100, ['loop check']); loopCheck.checked = curNoteSelected.doesLoop; tooltips.add(loopCheck, {title: 'Section looping', body: "Whether or not it's a simon says style section", style: tooltipType}); @@ -716,7 +713,7 @@ class ChartingState extends MusicBeatState } strumLine.y = getYfromStrum((Conductor.songPosition - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps)); - + if (playClaps) @@ -912,7 +909,7 @@ class ChartingState extends MusicBeatState trace(curRenderedNotes.members.contains(lastNote) ? "delete note" : "add note"); if (curRenderedNotes.members.contains(lastNote)) deleteNote(lastNote); - else + else addNote(lastNote); } } @@ -926,7 +923,7 @@ class ChartingState extends MusicBeatState changeSection(curSection + shiftThing); if (FlxG.keys.justPressed.LEFT || FlxG.keys.justPressed.A) changeSection(curSection - shiftThing); - } + } if (FlxG.keys.justPressed.SPACE) { if (FlxG.sound.music.playing) @@ -950,7 +947,7 @@ class ChartingState extends MusicBeatState resetSection(); } - + if (FlxG.sound.music.time < 0 || curStep < 0) FlxG.sound.music.time = 0; @@ -1026,8 +1023,8 @@ class ChartingState extends MusicBeatState + " / " + Std.string(FlxMath.roundDecimal(FlxG.sound.music.length / 1000, 2)) + "\nSection: " - + curSection - + "\nCurStep: " + + curSection + + "\nCurStep: " + curStep; super.update(elapsed); } @@ -1047,7 +1044,7 @@ class ChartingState extends MusicBeatState updateGrid(); } - override function beatHit() + override function beatHit() { trace('beat'); @@ -1192,7 +1189,7 @@ class ChartingState extends MusicBeatState remove(gridBlackLine); gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); add(gridBlackLine); - + while (curRenderedNotes.members.length > 0) { curRenderedNotes.remove(curRenderedNotes.members[0], true); @@ -1306,7 +1303,7 @@ class ChartingState extends MusicBeatState _song.notes[curSection].sectionNotes.remove(i); } } - + updateGrid(); } @@ -1345,7 +1342,7 @@ class ChartingState extends MusicBeatState function shiftNotes(measure:Int=0,step:Int=0,ms:Int = 0):Void { var newSong = []; - + var millisecadd = (((measure*4)+step/4)*(60000/_song.bpm))+ms; var totaladdsection = Std.int((millisecadd/(60000/_song.bpm)/4)); trace(millisecadd,totaladdsection); @@ -1360,7 +1357,7 @@ class ChartingState extends MusicBeatState { newSong.push(newSection(16,_song.notes[daSection1].mustHitSection,_song.notes[daSection1].altAnim)); } - + for (daSection in 0...(_song.notes.length)) { var aimtosetsection = daSection+Std.int((totaladdsection)); @@ -1369,7 +1366,7 @@ class ChartingState extends MusicBeatState newSong[aimtosetsection].altAnim = _song.notes[daSection].altAnim; //trace("section "+daSection); for(daNote in 0...(_song.notes[daSection].sectionNotes.length)) - { + { var newtiming = _song.notes[daSection].sectionNotes[daNote][0]+millisecadd; if(newtiming<0) { @@ -1378,10 +1375,10 @@ class ChartingState extends MusicBeatState var futureSection = Math.floor(newtiming/4/(60000/_song.bpm)); _song.notes[daSection].sectionNotes[daNote][0] = newtiming; newSong[futureSection].sectionNotes.push(_song.notes[daSection].sectionNotes[daNote]); - + //newSong.notes[daSection].sectionNotes.remove(_song.notes[daSection].sectionNotes[daNote]); } - + } //trace("DONE BITCH"); _song.notes = newSong; diff --git a/source/FreeplayState.hx b/source/kitty/states/menus/FreeplayState.hx similarity index 97% rename from source/FreeplayState.hx rename to source/kitty/states/menus/FreeplayState.hx index bc61dd1..343b90c 100644 --- a/source/FreeplayState.hx +++ b/source/kitty/states/menus/FreeplayState.hx @@ -1,14 +1,12 @@ -package; +package kitty.states.menus; import flixel.input.gamepad.FlxGamepad; -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.math.FlxMath; import flixel.text.FlxText; -import flixel.util.FlxColor; - -using StringTools; +import kitty.objects.Alphabet; +import kitty.objects.HealthIcon; +import kitty.backend.Song; class FreeplayState extends MusicBeatState { @@ -157,7 +155,7 @@ class FreeplayState extends MusicBeatState trace(songs[curSelected].songDifficulties[curDifficulty], songs[curSelected].songDifficulties[curDifficulty].chartName); var songHighscore = StringTools.replace(songs[curSelected].songName, " ", "-"); - + #if !switch intendedScore = Highscore.getScore(songHighscore, songs[curSelected].songDifficulties[curDifficulty].chartName); combo = Highscore.getCombo(songHighscore, songs[curSelected].songDifficulties[curDifficulty].chartName); diff --git a/source/GameOverSubstate.hx b/source/kitty/states/menus/GameOverSubstate.hx similarity index 95% rename from source/GameOverSubstate.hx rename to source/kitty/states/menus/GameOverSubstate.hx index 1f4c466..1774f52 100644 --- a/source/GameOverSubstate.hx +++ b/source/kitty/states/menus/GameOverSubstate.hx @@ -1,11 +1,10 @@ -package; +package kitty.states.menus; -import flixel.FlxG; import flixel.FlxObject; import flixel.FlxSubState; import flixel.math.FlxPoint; -import flixel.util.FlxColor; -import flixel.util.FlxTimer; +import kitty.backend.MusicBeatSubstate; +import kitty.objects.Boyfriend; class GameOverSubstate extends MusicBeatSubstate { diff --git a/source/GitarooPause.hx b/source/kitty/states/menus/GitarooPause.hx similarity index 98% rename from source/GitarooPause.hx rename to source/kitty/states/menus/GitarooPause.hx index f048fbf..9fb2dec 100644 --- a/source/GitarooPause.hx +++ b/source/kitty/states/menus/GitarooPause.hx @@ -1,4 +1,4 @@ -package; +package kitty.states.menus; import flixel.FlxG; import flixel.FlxSprite; diff --git a/source/MainMenuState.hx b/source/kitty/states/menus/MainMenuState.hx similarity index 94% rename from source/MainMenuState.hx rename to source/kitty/states/menus/MainMenuState.hx index 8912de0..4c463ed 100644 --- a/source/MainMenuState.hx +++ b/source/kitty/states/menus/MainMenuState.hx @@ -1,19 +1,11 @@ -package; +package kitty.states.menus; import flixel.input.gamepad.FlxGamepad; -import Controls.KeyboardScheme; -import flixel.FlxG; import flixel.FlxObject; -import flixel.FlxSprite; import flixel.effects.FlxFlicker; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.text.FlxText; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; -import flixel.util.FlxTimer; - -using StringTools; +import kitty.states.menus.options.OptionsMenu; class MainMenuState extends MusicBeatState { @@ -86,9 +78,9 @@ class MainMenuState extends MusicBeatState menuItem.scrollFactor.set(); menuItem.antialiasing = true; if (firstStart) - FlxTween.tween(menuItem,{y: 60 + (i * 160)},1 + (i * 0.25) ,{ease: FlxEase.expoInOut, onComplete: function(flxTween:FlxTween) - { - finishedFunnyMove = true; + FlxTween.tween(menuItem,{y: 60 + (i * 160)},1 + (i * 0.25) ,{ease: FlxEase.expoInOut, onComplete: function(flxTween:FlxTween) + { + finishedFunnyMove = true; changeItem(); }}); else @@ -163,7 +155,7 @@ class MainMenuState extends MusicBeatState { selectedSomethin = true; FlxG.sound.play(Paths.sound('confirmMenu')); - + if (FlxG.save.data.flashing) FlxFlicker.flicker(magenta, 1.1, 0.15, false); @@ -207,7 +199,7 @@ class MainMenuState extends MusicBeatState spr.screenCenter(X); }); } - + function goToState() { var daChoice:String = optionShit[curSelected]; diff --git a/source/ModsMenuState.hx b/source/kitty/states/menus/ModsMenuState.hx similarity index 93% rename from source/ModsMenuState.hx rename to source/kitty/states/menus/ModsMenuState.hx index 67bda65..216d442 100644 --- a/source/ModsMenuState.hx +++ b/source/kitty/states/menus/ModsMenuState.hx @@ -1,11 +1,9 @@ -package; +package kitty.states.menus; -import flixel.util.FlxColor; import sys.FileSystem; -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.math.FlxMath; +import kitty.objects.Alphabet; using StringTools; diff --git a/source/PauseSubState.hx b/source/kitty/states/menus/PauseSubState.hx similarity index 95% rename from source/PauseSubState.hx rename to source/kitty/states/menus/PauseSubState.hx index c3c6a75..927b088 100644 --- a/source/PauseSubState.hx +++ b/source/kitty/states/menus/PauseSubState.hx @@ -1,22 +1,19 @@ -package; +package kitty.states.menus; import flixel.input.gamepad.FlxGamepad; import openfl.Lib; #if windows import llua.Lua; #end -import Controls.Control; -import flixel.FlxG; -import flixel.FlxSprite; import flixel.FlxSubState; import flixel.addons.transition.FlxTransitionableState; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.input.keyboard.FlxKey; import flixel.sound.FlxSound; import flixel.text.FlxText; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; +import kitty.backend.MusicBeatSubstate; +import kitty.objects.Alphabet; +import kitty.backend.KeyBinds; class PauseSubState extends MusicBeatSubstate { @@ -26,7 +23,7 @@ class PauseSubState extends MusicBeatSubstate var curSelected:Int = 0; var pauseMusic:FlxSound; - + public function new(x:Float, y:Float) { super(); @@ -111,12 +108,12 @@ class PauseSubState extends MusicBeatSubstate if (upP) { changeSelection(-1); - + }else if (downP) { changeSelection(1); } - + if (accepted) { var daSelected:String = menuItems[curSelected]; @@ -142,7 +139,7 @@ class PauseSubState extends MusicBeatSubstate PlayState.luaModchart = null; } #end - + FlxG.switchState(() -> new MainMenuState()); } } diff --git a/source/StoryMenuState.hx b/source/kitty/states/menus/StoryMenuState.hx similarity index 98% rename from source/StoryMenuState.hx rename to source/kitty/states/menus/StoryMenuState.hx index 2032512..67f151a 100644 --- a/source/StoryMenuState.hx +++ b/source/kitty/states/menus/StoryMenuState.hx @@ -1,17 +1,13 @@ -package; +package kitty.states.menus; import flixel.input.gamepad.FlxGamepad; -import flixel.FlxG; -import flixel.FlxSprite; import flixel.addons.transition.FlxTransitionableState; import flixel.group.FlxGroup; import flixel.math.FlxMath; import flixel.text.FlxText; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; -import flixel.util.FlxTimer; - -using StringTools; +import kitty.objects.MenuItem; +import kitty.objects.MenuCharacter; +import kitty.backend.Song; class StoryMenuState extends MusicBeatState { @@ -27,7 +23,7 @@ class StoryMenuState extends MusicBeatState ['Senpai', 'Roses', 'Thorns'] ]; var curDifficulty:Int = 1; - var epicDifficulties:Array = ["easy", "normal", "hard"]; //TODO: softcode this.., + var epicDifficulties:Array = ["easy", "normal", "hard"]; //TODO: softcode this.., public static var weekUnlocked:Array = [true, true, true, true, true, true, true]; diff --git a/source/TitleState.hx b/source/kitty/states/menus/TitleState.hx similarity index 96% rename from source/TitleState.hx rename to source/kitty/states/menus/TitleState.hx index aa09d48..b72fe4b 100644 --- a/source/TitleState.hx +++ b/source/kitty/states/menus/TitleState.hx @@ -1,22 +1,13 @@ -package; +package kitty.states.menus; -import openfl.utils.AssetLibrary; -import flixel.FlxG; -import flixel.FlxSprite; -import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond; +import flixel.addons.transition.FlxTransitionSprite; import flixel.addons.transition.FlxTransitionableState; import flixel.addons.transition.TransitionData; import flixel.graphics.FlxGraphic; import flixel.group.FlxGroup; import flixel.math.FlxPoint; import flixel.math.FlxRect; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; -import flixel.util.FlxTimer; -import openfl.Assets; - -using StringTools; +import kitty.objects.Alphabet; class TitleState extends MusicBeatState { @@ -38,7 +29,7 @@ class TitleState extends MusicBeatState if (!sys.FileSystem.exists(Sys.getCwd() + "/assets/replays")) sys.FileSystem.createDirectory(Sys.getCwd() + "/assets/replays"); #end - + PlayerSettings.init(); curWacky = FlxG.random.getObject(getIntroTextShit()); @@ -50,7 +41,7 @@ class TitleState extends MusicBeatState FlxG.save.bind('funkin', 'ninjamuffin99'); KadeEngineData.initSave(); - + Highscore.load(); if (FlxG.save.data.weekUnlocked != null) diff --git a/source/GameplayCustomizeState.hx b/source/kitty/states/menus/options/GameplayCustomizeState.hx similarity index 96% rename from source/GameplayCustomizeState.hx rename to source/kitty/states/menus/options/GameplayCustomizeState.hx index c7bf3dc..905e504 100644 --- a/source/GameplayCustomizeState.hx +++ b/source/kitty/states/menus/options/GameplayCustomizeState.hx @@ -1,6 +1,5 @@ -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; +package kitty.states.menus.options; + import flixel.text.FlxText; import flixel.math.FlxMath; import flixel.FlxCamera; @@ -10,10 +9,11 @@ import flixel.FlxObject; import sys.thread.Thread; #end -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import openfl.ui.Keyboard; -import flixel.FlxSprite; -import flixel.FlxG; +import kitty.objects.Boyfriend; +import kitty.objects.Character; +import kitty.objects.Note; class GameplayCustomizeState extends MusicBeatState { @@ -37,7 +37,7 @@ class GameplayCustomizeState extends MusicBeatState var strumLineNotes:FlxTypedGroup; var playerStrums:FlxTypedGroup; private var camHUD:FlxCamera; - + public override function create() { sick = new FlxSprite().loadGraphic(Paths.image('sick')); sick.scrollFactor.set(); @@ -89,7 +89,7 @@ class GameplayCustomizeState extends MusicBeatState strumLine.alpha = 0.4; add(strumLine); - + if (FlxG.save.data.downscroll) strumLine.y = FlxG.height - 165; @@ -101,14 +101,14 @@ class GameplayCustomizeState extends MusicBeatState sick.cameras = [camHUD]; strumLine.cameras = [camHUD]; playerStrums.cameras = [camHUD]; - + generateStaticArrows(0); generateStaticArrows(1); text = new FlxText(5, FlxG.height + 40, 0, "Drag around gameplay elements, R to reset, Escape to go back.", 12); text.scrollFactor.set(); text.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); - + blackBorder = new FlxSprite(-30,FlxG.height + 40).makeGraphic((Std.int(text.width + 900)),Std.int(text.height + 600),FlxColor.BLACK); blackBorder.alpha = 0.5; @@ -178,7 +178,7 @@ class GameplayCustomizeState extends MusicBeatState } - override function beatHit() + override function beatHit() { super.beatHit(); @@ -194,7 +194,7 @@ class GameplayCustomizeState extends MusicBeatState // ripped from play state cuz im lazy - + private function generateStaticArrows(player:Int):Void { for (i in 0...4) @@ -233,16 +233,16 @@ class GameplayCustomizeState extends MusicBeatState } babyArrow.updateHitbox(); babyArrow.scrollFactor.set(); - + babyArrow.ID = i; - + if (player == 1) playerStrums.add(babyArrow); - + babyArrow.animation.play('static'); babyArrow.x += 50; babyArrow.x += ((FlxG.width / 2) * player); - + strumLineNotes.add(babyArrow); } } diff --git a/source/KeyBindMenu.hx b/source/kitty/states/menus/options/KeyBindMenu.hx similarity index 97% rename from source/KeyBindMenu.hx rename to source/kitty/states/menus/options/KeyBindMenu.hx index df23225..1072bc3 100644 --- a/source/KeyBindMenu.hx +++ b/source/kitty/states/menus/options/KeyBindMenu.hx @@ -1,4 +1,4 @@ -package; +package kitty.states.menus.options; /// Code created by Rozebud for FPS Plus (thanks rozebud) // modified by KadeDev for use in Kade Engine/Tricky @@ -6,27 +6,19 @@ package; import flixel.input.gamepad.FlxGamepad; import flixel.util.FlxAxes; import flixel.FlxSubState; -import Options.Option; import flixel.input.FlxInput; import flixel.input.keyboard.FlxKey; -import flixel.FlxG; import flixel.FlxObject; -import flixel.FlxSprite; import flixel.effects.FlxFlicker; import flixel.graphics.frames.FlxAtlasFrames; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.text.FlxText; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; -import flixel.util.FlxColor; import lime.app.Application; import lime.utils.Assets; import flixel.math.FlxMath; import flixel.text.FlxText; import flixel.input.FlxKeyManager; - - -using StringTools; +import kitty.backend.KeyBinds; class KeyBindMenu extends FlxSubState { @@ -56,7 +48,7 @@ class KeyBindMenu extends FlxSubState var state:String = "select"; override function create() - { + { for (i in 0...keys.length) { @@ -71,7 +63,7 @@ class KeyBindMenu extends FlxSubState if (k == null) gpKeys[i] = defaultGpKeys[i]; } - + //FlxG.sound.playMusic('assets/music/configurator' + TitleState.soundExt); persistentUpdate = true; @@ -243,7 +235,7 @@ class KeyBindMenu extends FlxSubState textUpdate(); super.update(elapsed); - + } function textUpdate(){ @@ -257,7 +249,7 @@ class KeyBindMenu extends FlxSubState var textStart = (i == curSelected) ? "> " : " "; trace(gpKeys[i]); keyTextDisplay.text += textStart + keyText[i] + ": " + gpKeys[i] + "\n"; - + } } else @@ -280,7 +272,7 @@ class KeyBindMenu extends FlxSubState FlxG.save.data.downBind = keys[1]; FlxG.save.data.leftBind = keys[0]; FlxG.save.data.rightBind = keys[3]; - + FlxG.save.data.gpupBind = gpKeys[2]; FlxG.save.data.gpdownBind = gpKeys[1]; FlxG.save.data.gpleftBind = gpKeys[0]; @@ -392,7 +384,7 @@ class KeyBindMenu extends FlxSubState function changeItem(_amount:Int = 0) { curSelected += _amount; - + if (curSelected > 3) curSelected = 0; if (curSelected < 0) diff --git a/source/OptionsMenu.hx b/source/kitty/states/menus/options/OptionsMenu.hx similarity index 97% rename from source/OptionsMenu.hx rename to source/kitty/states/menus/options/OptionsMenu.hx index bb2ed4b..8ee9478 100644 --- a/source/OptionsMenu.hx +++ b/source/kitty/states/menus/options/OptionsMenu.hx @@ -1,21 +1,17 @@ -package; +package kitty.states.menus.options; import flixel.input.gamepad.FlxGamepad; -import flixel.tweens.FlxEase; -import flixel.tweens.FlxTween; import openfl.Lib; -import Options; -import Controls.Control; import flash.text.TextField; -import flixel.FlxG; -import flixel.FlxSprite; import flixel.addons.display.FlxGridOverlay; -import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.group.FlxGroup; import flixel.input.keyboard.FlxKey; import flixel.math.FlxMath; import flixel.text.FlxText; -import flixel.util.FlxColor; import lime.utils.Assets; +import kitty.objects.Options; +import kitty.objects.Alphabet; +import kitty.backend.HelperFunctions; class OptionsMenu extends MusicBeatState { @@ -50,7 +46,7 @@ class OptionsMenu extends MusicBeatState new IconColor("Make the Health Bar match the Icon's colors."), #end ]), - + new OptionCategory("Misc", [ #if desktop new FPSOption("Toggle the FPS Counter"), @@ -102,7 +98,7 @@ class OptionsMenu extends MusicBeatState versionShit = new FlxText(5, FlxG.height + 40, 0, "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription, 12); versionShit.scrollFactor.set(); versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); - + blackBorder = new FlxSprite(-30,FlxG.height + 40).makeGraphic((Std.int(versionShit.width + 900)),Std.int(versionShit.height + 600),FlxColor.BLACK); blackBorder.alpha = 0.5; @@ -117,7 +113,7 @@ class OptionsMenu extends MusicBeatState } var isCat:Bool = false; - + override function update(elapsed:Float) { @@ -139,9 +135,9 @@ class OptionsMenu extends MusicBeatState grpControls.add(controlLabel); // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! } - + curSelected = 0; - + changeSelection(curSelected); } @@ -160,12 +156,12 @@ class OptionsMenu extends MusicBeatState changeSelection(1); } } - + if (FlxG.keys.justPressed.UP) changeSelection(-1); if (FlxG.keys.justPressed.DOWN) changeSelection(1); - + if (isCat) { if (currentSelectedCat.getOptions()[curSelected].getAccept()) @@ -198,7 +194,7 @@ class OptionsMenu extends MusicBeatState FlxG.save.data.offset += 0.1; else if (FlxG.keys.pressed.LEFT) FlxG.save.data.offset -= 0.1; - + versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; } if (currentSelectedCat.getOptions()[curSelected].getAccept()) @@ -219,10 +215,10 @@ class OptionsMenu extends MusicBeatState FlxG.save.data.offset += 0.1; else if (FlxG.keys.pressed.LEFT) FlxG.save.data.offset -= 0.1; - + versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; } - + if (controls.RESET) FlxG.save.data.offset = 0; @@ -250,7 +246,7 @@ class OptionsMenu extends MusicBeatState } curSelected = 0; } - + changeSelection(); } } diff --git a/source/OptionsSubState.hx b/source/kitty/states/menus/options/OptionsSubState.hx similarity index 97% rename from source/OptionsSubState.hx rename to source/kitty/states/menus/options/OptionsSubState.hx index 2b63e0c..97d2a55 100644 --- a/source/OptionsSubState.hx +++ b/source/kitty/states/menus/options/OptionsSubState.hx @@ -1,4 +1,4 @@ -package; +package kitty.states.menus.options; import flixel.FlxG; import flixel.FlxSprite; From 2b561fd51bbf692e2ddca6e0b0c9311f1086ab38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=92=9C=20Rodney=2C=20An=20Imaginative=20Furball=20?= =?UTF-8?q?=F0=9F=92=99?= Date: Sat, 28 Mar 2026 20:30:55 -0400 Subject: [PATCH 2/3] it complie again --- source/kitty/scripting/HScript.hx | 18 +++++++++--------- source/kitty/scripting/ModchartState.hx | 1 - source/kitty/states/PlayState.hx | 1 - source/kitty/states/debug/AnimationDebug.hx | 1 - source/kitty/states/editors/ChartingState.hx | 1 - source/kitty/states/menus/GameOverSubstate.hx | 2 +- .../menus/options/GameplayCustomizeState.hx | 1 - 7 files changed, 10 insertions(+), 15 deletions(-) diff --git a/source/kitty/scripting/HScript.hx b/source/kitty/scripting/HScript.hx index d1cb177..ed3c192 100644 --- a/source/kitty/scripting/HScript.hx +++ b/source/kitty/scripting/HScript.hx @@ -72,24 +72,24 @@ class HScript "Math" => Math, "Std" => Std, - "FlxG" => flixel.FlxG, + "FlxG" => FlxG, "Http" => haxe.Http, - "FlxSprite" => flixel.FlxSprite, + "FlxSprite" => FlxSprite, "FlxText" => flixel.text.FlxText, "FlxSound" => flixel.sound.FlxSound, - "FlxTween" => flixel.tweens.FlxTween, - "FlxEase" => flixel.tweens.FlxEase, + "FlxTween" => FlxTween, + "FlxEase" => FlxEase, "FlxBackdrop" => flixel.addons.display.FlxBackdrop, "Assets" => Assets, - "PlayState" => PlayState, - "PlayStateChangeables" => PlayStateChangeables, - "Character" => Character, - "Paths" => Paths, - "Conductor" => Conductor, + "PlayState" => kitty.states.PlayState, + "PlayStateChangeables" => kitty.backend.PlayStateChangeables, + "Character" => kitty.objects.Character, + "Paths" => kitty.backend.Paths, + "Conductor" => kitty.backend.Conductor, "HScript" => HScript, ]; diff --git a/source/kitty/scripting/ModchartState.hx b/source/kitty/scripting/ModchartState.hx index 56312cb..a604179 100644 --- a/source/kitty/scripting/ModchartState.hx +++ b/source/kitty/scripting/ModchartState.hx @@ -20,7 +20,6 @@ import flixel.FlxCamera; import kitty.states.menus.MainMenuState; import kitty.states.PlayState; import kitty.objects.Character; -import kitty.objects.Boyfriend; class ModchartState { diff --git a/source/kitty/states/PlayState.hx b/source/kitty/states/PlayState.hx index 564b3ac..6264e39 100644 --- a/source/kitty/states/PlayState.hx +++ b/source/kitty/states/PlayState.hx @@ -22,7 +22,6 @@ import flixel.sound.FlxSound; import flixel.text.FlxText; import flixel.ui.FlxBar; import flixel.util.FlxSort; -import kitty.objects.Boyfriend; import kitty.objects.Character; import kitty.objects.DialogueBox; import kitty.objects.Note; diff --git a/source/kitty/states/debug/AnimationDebug.hx b/source/kitty/states/debug/AnimationDebug.hx index 1943af1..37da670 100644 --- a/source/kitty/states/debug/AnimationDebug.hx +++ b/source/kitty/states/debug/AnimationDebug.hx @@ -6,7 +6,6 @@ import flixel.addons.display.FlxGridOverlay; import flixel.group.FlxGroup; import flixel.text.FlxText; import kitty.objects.Character; -import kitty.objects.Boyfriend; /** *DEBUG MODE diff --git a/source/kitty/states/editors/ChartingState.hx b/source/kitty/states/editors/ChartingState.hx index f452a10..a904a67 100644 --- a/source/kitty/states/editors/ChartingState.hx +++ b/source/kitty/states/editors/ChartingState.hx @@ -33,7 +33,6 @@ import openfl.media.Sound; import openfl.net.FileReference; import openfl.utils.ByteArray; import kitty.objects.Character; -import kitty.objects.Boyfriend; import kitty.objects.HealthIcon; class ChartingState extends MusicBeatState diff --git a/source/kitty/states/menus/GameOverSubstate.hx b/source/kitty/states/menus/GameOverSubstate.hx index 8111c9c..dff3c1d 100644 --- a/source/kitty/states/menus/GameOverSubstate.hx +++ b/source/kitty/states/menus/GameOverSubstate.hx @@ -4,7 +4,7 @@ import flixel.FlxObject; import flixel.FlxSubState; import flixel.math.FlxPoint; import kitty.backend.MusicBeatSubstate; -import kitty.objects.Boyfriend; +import kitty.objects.Character; class GameOverSubstate extends MusicBeatSubstate { diff --git a/source/kitty/states/menus/options/GameplayCustomizeState.hx b/source/kitty/states/menus/options/GameplayCustomizeState.hx index 354edd8..6e2b76f 100644 --- a/source/kitty/states/menus/options/GameplayCustomizeState.hx +++ b/source/kitty/states/menus/options/GameplayCustomizeState.hx @@ -11,7 +11,6 @@ import sys.thread.Thread; import flixel.group.FlxGroup; import openfl.ui.Keyboard; -import kitty.objects.Boyfriend; import kitty.objects.Character; import kitty.objects.Note; From ac0dd4706a305731de8beaf52d8c152344f4bab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=92=9C=20Rodney=2C=20An=20Imaginative=20Furball=20?= =?UTF-8?q?=F0=9F=92=99?= Date: Sat, 28 Mar 2026 20:31:13 -0400 Subject: [PATCH 3/3] actions should work now --- .github/workflows/debug.yml | 18 +++++++++++++ .github/workflows/test.yml | 54 ++++++++++++++++++++++++------------- 2 files changed, 54 insertions(+), 18 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index f7b6eed..f2dfa7a 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -41,6 +41,12 @@ jobs: haxelib install hmm haxelib run hmm install + - name: Building HXCPP + run: | + cd ./.haxelib/hxcpp/git/tools/hxcpp + haxe compile.hxml + cd ../../../../../ + - name: Compile Engine run: haxelib run lime build windows -debug @@ -115,6 +121,12 @@ jobs: # haxelib install hmm # haxelib run hmm install + # - name: Building HXCPP + # run: | + # cd ./.haxelib/hxcpp/git/tools/hxcpp + # haxe compile.hxml + # cd ../../../../../ + # - name: Building the game # run: haxelib run lime build mac -debug @@ -192,6 +204,12 @@ jobs: # haxelib install hmm # haxelib run hmm install + # - name: Building HXCPP + # run: | + # cd ./.haxelib/hxcpp/git/tools/hxcpp + # haxe compile.hxml + # cd ../../../../../ + # - name: Building the game # run: haxelib run lime build linux -debug diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7abef4b..aa2bf88 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,8 +32,8 @@ jobs: key: windows-build-cache path: | .haxelib/ - export/build/windows/haxe/ - export/build/windows/obj/ + export/release/windows/haxe/ + export/release/windows/obj/ restore-keys: windows-build-cache - name: Install Libraries @@ -41,14 +41,20 @@ jobs: haxelib install hmm haxelib run hmm install + - name: Building HXCPP + run: | + cd ./.haxelib/hxcpp/git/tools/hxcpp + haxe compile.hxml + cd ../../../../../ + - name: Compile Engine - run: haxelib run lime build windows -final + run: haxelib run lime build windows - name: Upload Artifact uses: actions/upload-artifact@main with: name: Kitty Windows Build - path: export/build/windows/bin + path: export/release/windows/bin overwrite: true include-hidden-files: true if-no-files-found: error @@ -80,8 +86,8 @@ jobs: key: windows-build-cache path: | .haxelib/ - export/build/windows/haxe/ - export/build/windows/obj/ + export/release/windows/haxe/ + export/release/windows/obj/ restore-keys: windows-build-cache # mac: @@ -106,8 +112,8 @@ jobs: # key: mac-build-cache # path: | # .haxelib/ - # export/build/mac/haxe/ - # export/build/mac/obj/ + # export/release/mac/haxe/ + # export/release/mac/obj/ # restore-keys: mac-build-cache # - name: Install Libraries @@ -115,14 +121,20 @@ jobs: # haxelib install hmm # haxelib run hmm install + # - name: Building HXCPP + # run: | + # cd ./.haxelib/hxcpp/git/tools/hxcpp + # haxe compile.hxml + # cd ../../../../../ + # - name: Building the game - # run: haxelib run lime build mac -final + # run: haxelib run lime build mac # - name: Upload Artifact # uses: actions/upload-artifact@main # with: # name: Kitty Mac Build - # path: export/build/macos/bin + # path: export/release/macos/bin # overwrite: true # include-hidden-files: true # if-no-files-found: error @@ -154,8 +166,8 @@ jobs: # key: mac-build-cache # path: | # .haxelib/ - # export/build/mac/haxe/ - # export/build/mac/obj/ + # export/release/mac/haxe/ + # export/release/mac/obj/ # restore-keys: mac-build-cache # linux: @@ -180,8 +192,8 @@ jobs: # key: linux-build-cache # path: | # .haxelib/ - # export/build/linux/haxe/ - # export/build/linux/obj/ + # export/release/linux/haxe/ + # export/release/linux/obj/ # restore-keys: linux-build-cache # - name: Installing Dependencies @@ -192,14 +204,20 @@ jobs: # haxelib install hmm # haxelib run hmm install + # - name: Building HXCPP + # run: | + # cd ./.haxelib/hxcpp/git/tools/hxcpp + # haxe compile.hxml + # cd ../../../../../ + # - name: Building the game - # run: haxelib run lime build linux -final + # run: haxelib run lime build linux # - name: Upload Artifact # uses: actions/upload-artifact@main # with: # name: Kitty Linux Build - # path: export/build/linux/bin + # path: export/release/linux/bin # overwrite: true # include-hidden-files: true # if-no-files-found: error @@ -230,6 +248,6 @@ jobs: # key: linux-build-cache # path: | # .haxelib/ - # export/build/linux/haxe/ - # export/build/linux/obj/ + # export/release/linux/haxe/ + # export/release/linux/obj/ # restore-keys: linux-build-cache \ No newline at end of file