diff --git a/source/funkin/Note.hx b/source/funkin/Note.hx index 566b4ea49..c93858693 100644 --- a/source/funkin/Note.hx +++ b/source/funkin/Note.hx @@ -2,6 +2,9 @@ package funkin; import flixel.FlxSprite; import flixel.math.FlxMath; +import funkin.noteStuff.NoteBasic.NoteColor; +import funkin.noteStuff.NoteBasic.NoteData; +import funkin.noteStuff.NoteBasic.NoteType; import funkin.play.PlayState; import funkin.play.Strumline.StrumlineStyle; import funkin.shaderslmfao.ColorSwap; @@ -286,195 +289,3 @@ class Note extends FlxSprite return new Note(data.strumTime, data.noteData, prevNote, isSustainNote); } } - -typedef RawNoteData = -{ - var strumTime:Float; - var noteData:NoteType; - var sustainLength:Float; - var altNote:String; - var noteKind:NoteKind; -} - -@:forward -abstract NoteData(RawNoteData) -{ - public function new(strumTime = 0.0, noteData:NoteType = 0, sustainLength = 0.0, altNote = "", noteKind = NORMAL) - { - this = { - strumTime: strumTime, - noteData: noteData, - sustainLength: sustainLength, - altNote: altNote, - noteKind: noteKind - } - } - - public var note(get, never):NoteType; - - inline function get_note() - return this.noteData.value; - - public var int(get, never):Int; - - inline function get_int() - return this.noteData.int; - - public var dir(get, never):NoteDir; - - inline function get_dir() - return this.noteData.value; - - public var dirName(get, never):String; - - inline function get_dirName() - return dir.name; - - public var dirNameUpper(get, never):String; - - inline function get_dirNameUpper() - return dir.nameUpper; - - public var color(get, never):NoteColor; - - inline function get_color() - return this.noteData.value; - - public var colorName(get, never):String; - - inline function get_colorName() - return color.name; - - public var colorNameUpper(get, never):String; - - inline function get_colorNameUpper() - return color.nameUpper; - - public var highStakes(get, never):Bool; - - inline function get_highStakes() - return this.noteData.highStakes; - - public var lowStakes(get, never):Bool; - - inline function get_lowStakes() - return this.noteData.lowStakes; -} - -enum abstract NoteType(Int) from Int to Int -{ - // public var raw(get, never):Int; - // inline function get_raw() return this; - public var int(get, never):Int; - - inline function get_int() - return this < 0 ? -this : this % 4; - - public var value(get, never):NoteType; - - inline function get_value() - return int; - - public var highStakes(get, never):Bool; - - inline function get_highStakes() - return this > 3; - - public var lowStakes(get, never):Bool; - - inline function get_lowStakes() - return this < 0; -} - -@:forward -enum abstract NoteDir(NoteType) from Int to Int from NoteType -{ - var LEFT = 0; - var DOWN = 1; - var UP = 2; - var RIGHT = 3; - var value(get, never):NoteDir; - - inline function get_value() - return this.value; - - public var name(get, never):String; - - function get_name() - { - return switch (value) - { - case LEFT: "left"; - case DOWN: "down"; - case UP: "up"; - case RIGHT: "right"; - } - } - - public var nameUpper(get, never):String; - - function get_nameUpper() - { - return switch (value) - { - case LEFT: "LEFT"; - case DOWN: "DOWN"; - case UP: "UP"; - case RIGHT: "RIGHT"; - } - } -} - -@:forward -enum abstract NoteColor(NoteType) from Int to Int from NoteType -{ - var PURPLE = 0; - var BLUE = 1; - var GREEN = 2; - var RED = 3; - var value(get, never):NoteColor; - - inline function get_value() - return this.value; - - public var name(get, never):String; - - function get_name() - { - return switch (value) - { - case PURPLE: "purple"; - case BLUE: "blue"; - case GREEN: "green"; - case RED: "red"; - } - } - - public var nameUpper(get, never):String; - - function get_nameUpper() - { - return switch (value) - { - case PURPLE: "PURPLE"; - case BLUE: "BLUE"; - case GREEN: "GREEN"; - case RED: "RED"; - } - } -} - -enum abstract NoteKind(String) from String to String -{ - /** - * The default note type. - */ - var NORMAL = "normal"; - - // Testing shiz - var PYRO_LIGHT = "pyro_light"; - var PYRO_KICK = "pyro_kick"; - var PYRO_TOSS = "pyro_toss"; - var PYRO_COCK = "pyro_cock"; // lol - var PYRO_SHOOT = "pyro_shoot"; -} diff --git a/source/funkin/Section.hx b/source/funkin/Section.hx index cc0931acb..57fed7d9f 100644 --- a/source/funkin/Section.hx +++ b/source/funkin/Section.hx @@ -1,6 +1,6 @@ package funkin; -import funkin.Note.NoteData; +import funkin.noteStuff.NoteBasic.NoteData; typedef SwagSection = { diff --git a/source/funkin/SongLoad.hx b/source/funkin/SongLoad.hx index f786d96f5..2922086cd 100644 --- a/source/funkin/SongLoad.hx +++ b/source/funkin/SongLoad.hx @@ -1,7 +1,7 @@ package funkin; -import funkin.Note.NoteData; import funkin.Section.SwagSection; +import funkin.noteStuff.NoteBasic.NoteData; import haxe.Json; import haxe.format.JsonParser; import lime.utils.Assets; diff --git a/source/funkin/charting/ChartingState.hx b/source/funkin/charting/ChartingState.hx index 3f19edc07..8dd7d667b 100644 --- a/source/funkin/charting/ChartingState.hx +++ b/source/funkin/charting/ChartingState.hx @@ -17,12 +17,12 @@ import flixel.text.FlxText; import flixel.ui.FlxButton; import flixel.util.FlxColor; import funkin.Conductor.BPMChangeEvent; -import funkin.Note.NoteData; import funkin.Section.SwagSection; import funkin.SongLoad.SwagSong; import funkin.audiovis.ABotVis; import funkin.audiovis.PolygonSpectogram; import funkin.audiovis.SpectogramSprite; +import funkin.noteStuff.NoteBasic.NoteData; import funkin.play.HealthIcon; import funkin.play.PlayState; import funkin.rendering.MeshRender; diff --git a/source/funkin/modding/events/ScriptEvent.hx b/source/funkin/modding/events/ScriptEvent.hx index ef8fc3a06..86f96e3cb 100644 --- a/source/funkin/modding/events/ScriptEvent.hx +++ b/source/funkin/modding/events/ScriptEvent.hx @@ -2,7 +2,7 @@ package funkin.modding.events; import flixel.FlxState; import flixel.FlxSubState; -import funkin.Note.NoteDir; +import funkin.noteStuff.NoteBasic.NoteDir; import funkin.play.Countdown.CountdownStep; import openfl.events.EventType; import openfl.events.KeyboardEvent; diff --git a/source/funkin/noteStuff/NoteBasic.hx b/source/funkin/noteStuff/NoteBasic.hx new file mode 100644 index 000000000..c264df52a --- /dev/null +++ b/source/funkin/noteStuff/NoteBasic.hx @@ -0,0 +1,196 @@ +package funkin.noteStuff; + +import flixel.FlxSprite; +import flixel.text.FlxText; + +typedef RawNoteData = +{ + var strumTime:Float; + var noteData:NoteType; + var sustainLength:Float; + var altNote:String; + var noteKind:NoteKind; +} + +@:forward +abstract NoteData(RawNoteData) +{ + public function new(strumTime = 0.0, noteData:NoteType = 0, sustainLength = 0.0, altNote = "", noteKind = NORMAL) + { + this = { + strumTime: strumTime, + noteData: noteData, + sustainLength: sustainLength, + altNote: altNote, + noteKind: noteKind + } + } + + public var note(get, never):NoteType; + + inline function get_note() + return this.noteData.value; + + public var int(get, never):Int; + + inline function get_int() + return this.noteData.int; + + public var dir(get, never):NoteDir; + + inline function get_dir() + return this.noteData.value; + + public var dirName(get, never):String; + + inline function get_dirName() + return dir.name; + + public var dirNameUpper(get, never):String; + + inline function get_dirNameUpper() + return dir.nameUpper; + + public var color(get, never):NoteColor; + + inline function get_color() + return this.noteData.value; + + public var colorName(get, never):String; + + inline function get_colorName() + return color.name; + + public var colorNameUpper(get, never):String; + + inline function get_colorNameUpper() + return color.nameUpper; + + public var highStakes(get, never):Bool; + + inline function get_highStakes() + return this.noteData.highStakes; + + public var lowStakes(get, never):Bool; + + inline function get_lowStakes() + return this.noteData.lowStakes; +} + +enum abstract NoteType(Int) from Int to Int +{ + // public var raw(get, never):Int; + // inline function get_raw() return this; + public var int(get, never):Int; + + inline function get_int() + return this < 0 ? -this : this % 4; + + public var value(get, never):NoteType; + + inline function get_value() + return int; + + public var highStakes(get, never):Bool; + + inline function get_highStakes() + return this > 3; + + public var lowStakes(get, never):Bool; + + inline function get_lowStakes() + return this < 0; +} + +@:forward +enum abstract NoteDir(NoteType) from Int to Int from NoteType +{ + var LEFT = 0; + var DOWN = 1; + var UP = 2; + var RIGHT = 3; + var value(get, never):NoteDir; + + inline function get_value() + return this.value; + + public var name(get, never):String; + + function get_name() + { + return switch (value) + { + case LEFT: "left"; + case DOWN: "down"; + case UP: "up"; + case RIGHT: "right"; + } + } + + public var nameUpper(get, never):String; + + function get_nameUpper() + { + return switch (value) + { + case LEFT: "LEFT"; + case DOWN: "DOWN"; + case UP: "UP"; + case RIGHT: "RIGHT"; + } + } +} + +@:forward +enum abstract NoteColor(NoteType) from Int to Int from NoteType +{ + var PURPLE = 0; + var BLUE = 1; + var GREEN = 2; + var RED = 3; + var value(get, never):NoteColor; + + inline function get_value() + return this.value; + + public var name(get, never):String; + + function get_name() + { + return switch (value) + { + case PURPLE: "purple"; + case BLUE: "blue"; + case GREEN: "green"; + case RED: "red"; + } + } + + public var nameUpper(get, never):String; + + function get_nameUpper() + { + return switch (value) + { + case PURPLE: "PURPLE"; + case BLUE: "BLUE"; + case GREEN: "GREEN"; + case RED: "RED"; + } + } +} + +enum abstract NoteKind(String) from String to String +{ + /** + * The default note type. + */ + var NORMAL = "normal"; + + // Testing shiz + var PYRO_LIGHT = "pyro_light"; + var PYRO_KICK = "pyro_kick"; + var PYRO_TOSS = "pyro_toss"; + var PYRO_COCK = "pyro_cock"; // lol + var PYRO_SHOOT = "pyro_shoot"; +} diff --git a/source/funkin/noteStuff/NoteEvent.hx b/source/funkin/noteStuff/NoteEvent.hx new file mode 100644 index 000000000..1446f2b2d --- /dev/null +++ b/source/funkin/noteStuff/NoteEvent.hx @@ -0,0 +1,12 @@ +package funkin.noteStuff; + +import funkin.noteStuff.NoteBasic.NoteType; +import funkin.play.Strumline.StrumlineStyle; + +class NoteEvent extends Note +{ + public function new(strumTime:Float = 0, noteData:NoteType, ?prevNote:Note, ?sustainNote:Bool = false, ?style:StrumlineStyle = NORMAL) + { + super(strumTime, noteData, prevNote, sustainNote, style); + } +} diff --git a/source/funkin/play/PicoFight.hx b/source/funkin/play/PicoFight.hx index a5dddac3a..05e62cc7e 100644 --- a/source/funkin/play/PicoFight.hx +++ b/source/funkin/play/PicoFight.hx @@ -6,8 +6,8 @@ import flixel.addons.effects.FlxTrail; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.math.FlxMath; import flixel.util.FlxColor; -import funkin.Note.NoteData; import funkin.audiovis.PolygonSpectogram; +import funkin.noteStuff.NoteBasic.NoteData; class PicoFight extends MusicBeatState { diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index a2e1ee9ff..d804bb298 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -18,8 +18,6 @@ import flixel.ui.FlxBar; import flixel.util.FlxColor; import flixel.util.FlxSort; import flixel.util.FlxTimer; -import funkin.Note; -import funkin.Note; import funkin.Section.SwagSection; import funkin.Section.SwagSection; import funkin.SongLoad.SwagSong; @@ -1631,6 +1629,7 @@ class PlayState extends MusicBeatState implements IHook else { // HNGGG I really want to add an option for ghost tapping + // L + ratio for (shit in 0...pressArray.length) if (pressArray[shit]) PlayState.instance.ghostNoteMiss(shit, false); @@ -1665,7 +1664,7 @@ class PlayState extends MusicBeatState implements IHook * @param direction * @param hasPossibleNotes */ - function ghostNoteMiss(direction:NoteType = 1, hasPossibleNotes:Bool = true):Void + function ghostNoteMiss(direction:funkin.noteStuff.NoteBasic.NoteType = 1, hasPossibleNotes:Bool = true):Void { var event:GhostMissNoteScriptEvent = new GhostMissNoteScriptEvent(direction, // Direction missed in. hasPossibleNotes, // Whether there was a note you could have hit. diff --git a/source/funkin/play/Strumline.hx b/source/funkin/play/Strumline.hx index 1bdbde374..5efe21863 100644 --- a/source/funkin/play/Strumline.hx +++ b/source/funkin/play/Strumline.hx @@ -1,13 +1,13 @@ package funkin.play; -import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.FlxSprite; +import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.math.FlxPoint; import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; -import funkin.Note.NoteColor; -import funkin.Note.NoteDir; -import funkin.Note.NoteType; +import funkin.noteStuff.NoteBasic.NoteColor; +import funkin.noteStuff.NoteBasic.NoteDir; +import funkin.noteStuff.NoteBasic.NoteType; import funkin.ui.PreferencesMenu; import funkin.util.Constants; @@ -115,7 +115,7 @@ class Strumline extends FlxTypedSpriteGroup return getArrow(value.int); } - public inline function getArrowByNoteColor(value:NoteColor):StrumlineArrow + public inline function getArrowByNoteColor(value:funkin.noteStuff.NoteBasic.NoteColor):StrumlineArrow { return getArrow(value.int); } diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 22b95bc06..e01d3e0b4 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -1,8 +1,8 @@ package funkin.play.character; import flixel.math.FlxPoint; -import funkin.Note.NoteDir; import funkin.modding.events.ScriptEvent; +import funkin.noteStuff.NoteBasic.NoteDir; import funkin.play.character.CharacterData.CharacterDataParser; import funkin.play.stage.Bopper;