Skip to content

Commit

Permalink
You can parameter your note types
Browse files Browse the repository at this point in the history
  • Loading branch information
poec987 committed Jun 26, 2024
1 parent d3acf35 commit ddb45eb
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
41 changes: 39 additions & 2 deletions source/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,9 @@ class ChartingState extends MusicBeatState
];

var noteTypeDropDown:FlxUIDropDownMenu;

var noteTypeParamTextBox:FlxUIInputText;
var selectedNoteType:String;
var selectedNoteTypeParam:String;

function addNoteUI():Void
{
Expand All @@ -376,9 +377,18 @@ class ChartingState extends MusicBeatState
updateGrid();
});

noteTypeParamTextBox = new FlxUIInputText(140, 100, 100);
noteTypeParamTextBox.name = "note_param";

if (curSelectedNote != null) {
noteTypeParamTextBox.text = curSelectedNote[4];
selectedNoteTypeParam = curSelectedNote[4];
}

tab_group_note.add(stepperSusLength);
tab_group_note.add(applyLength);
tab_group_note.add(noteTypeDropDown);
tab_group_note.add(noteTypeParamTextBox);

UI_box.addGroup(tab_group_note);
}
Expand Down Expand Up @@ -496,6 +506,17 @@ class ChartingState extends MusicBeatState
updateGrid();
}
}
else if (id == FlxUIInputText.CHANGE_EVENT && (sender is FlxUIInputText))
{
var texts:FlxUIInputText = cast sender;
var tname = texts.name;

switch (tname) {
case ('note_param'):
curSelectedNote[4] = texts.text;
updateGrid();
}
}

// FlxG.log.add(id + " WEED " + sender + " WEED " + data + " WEED " + params);
}
Expand Down Expand Up @@ -908,6 +929,17 @@ class ChartingState extends MusicBeatState
noteTypeDropDown.selectedLabel = "Normal";
selectedNoteType = "Normal";
}

if (curSelectedNote[4] != null)
{
noteTypeParamTextBox.text = curSelectedNote[4];
selectedNoteTypeParam = curSelectedNote[4];
}
else
{
noteTypeParamTextBox.text = "";
selectedNoteTypeParam = "";
}
}
}

Expand Down Expand Up @@ -1057,12 +1089,17 @@ class ChartingState extends MusicBeatState
var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE);
var noteSus = 0;
var noteType = "Normal";
var noteTypeParam = "";

if (selectedNoteType != null) {
noteType = selectedNoteType;
}

_song.notes[curSection].sectionNotes.push([noteStrum, noteData, noteSus, noteType]);
if (selectedNoteTypeParam != null) {
noteTypeParam = selectedNoteTypeParam;
}

_song.notes[curSection].sectionNotes.push([noteStrum, noteData, noteSus, noteType, noteTypeParam]);

curSelectedNote = _song.notes[curSection].sectionNotes[_song.notes[curSection].sectionNotes.length - 1];

Expand Down
4 changes: 3 additions & 1 deletion source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Note extends FlxSprite
public var sustainLength:Float = 0;
public var isSustainNote:Bool = false;
public var noteType:String;
public var noteTypeParam:String;

public var noteScore:Float = 1;

Expand All @@ -33,7 +34,7 @@ class Note extends FlxSprite
public static var BLUE_NOTE:Int = 1;
public static var RED_NOTE:Int = 3;

public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?noteType:String)
public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?noteType:String, ?noteTypeParam:String)
{
super();

Expand All @@ -43,6 +44,7 @@ class Note extends FlxSprite
this.prevNote = prevNote;
isSustainNote = sustainNote;
this.noteType = noteType;
this.noteTypeParam = noteTypeParam;

x += 50;
// MAKE SURE ITS DEFINITELY OFF SCREEN?
Expand Down
2 changes: 2 additions & 0 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2478,6 +2478,8 @@ class PlayState extends MusicBeatState

function noteTypeCheck(notezzz:Note, ?precheck:Bool = false, ?dadHit:Bool = false, ?miss:Bool = false) {
var zeNoteType:String = notezzz.noteType;
var noteTypeParam:String = notezzz.noteTypeParam; // Funny little silly parameter in chart editor :P

if (zeNoteType == null)
zeNoteType = "Normal";

Expand Down
2 changes: 1 addition & 1 deletion vscode-project.hxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#automatically generated do not edit
#@date Tue Jun 25 2024 08:30:06 GMT-0500 (Central Daylight Time)
#@date Wed Jun 26 2024 11:07:44 GMT-0500 (Central Daylight Time)
-cp c:\users\cam\appdata\local\temp\8e05707c7e067ab4e2ebd5dea47d22f51847e1bb

0 comments on commit ddb45eb

Please sign in to comment.