mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-25 22:47:52 +00:00
data stuff moved OUT of Note.hx!
This commit is contained in:
parent
43b952b321
commit
f07d172219
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package funkin;
|
||||
|
||||
import funkin.Note.NoteData;
|
||||
import funkin.noteStuff.NoteBasic.NoteData;
|
||||
|
||||
typedef SwagSection =
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
196
source/funkin/noteStuff/NoteBasic.hx
Normal file
196
source/funkin/noteStuff/NoteBasic.hx
Normal file
|
@ -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";
|
||||
}
|
12
source/funkin/noteStuff/NoteEvent.hx
Normal file
12
source/funkin/noteStuff/NoteEvent.hx
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<StrumlineArrow>
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue