Skip to content

Commit 455642d

Browse files
committed
e
1 parent 5f67733 commit 455642d

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

source/backend/MusicBeatState.hx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,38 @@ class MusicBeatState extends FlxState
311311
}
312312
}
313313

314+
var preloadFunction:()->Void = null;
315+
316+
public function preloadState(switchState:Bool = false):Void
317+
{
318+
var preloader = function()
319+
{
320+
if (preloadFunction != null)
321+
{
322+
preloadFunction();
323+
preloadFunction = null;
324+
}
325+
if (switchState)
326+
return MusicBeatState.switchState(this);
327+
}
328+
329+
yutautil.Threader.runInThread(preloader(), 1, 'State Preloader - ${Type.getClassName(Type.getClass(this))}');
330+
}
331+
332+
333+
public static function preloadAndSwitchState(state:MusicBeatState)
334+
{
335+
if (state == null)
336+
state = cast(FlxG.state, MusicBeatState);
337+
if (state == FlxG.state)
338+
{
339+
resetState();
340+
return;
341+
}
342+
343+
state.preloadState(true);
344+
}
345+
314346
public static function switchState(nextState:FlxState = null)
315347
{
316348
if (nextState == null)

source/objects/Note.hx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class Note extends NoteObject
8484
mustPress: this.mustPress,
8585
canBeHit: this.canBeHit,
8686
tooLate: this.tooLate,
87+
botNote: this.botNote,
8788
wasGoodHit: this.wasGoodHit,
8889
missed: this.missed,
8990
ignoreNote: this.ignoreNote,
@@ -457,6 +458,8 @@ class Note extends NoteObject
457458
],
458459
];
459460

461+
public var botNote:Bool = false;
462+
460463
public static var pixelScales:Array<Float> = [
461464
1.2, //1k
462465
1.15, //2k
@@ -488,7 +491,8 @@ class Note extends NoteObject
488491
'Hey!',
489492
'Hurt Note',
490493
'GF Sing',
491-
'No Animation'
494+
'No Animation',
495+
'Botplay Note'
492496
];
493497
public var strumTime:Float = 0;
494498

@@ -762,6 +766,9 @@ class Note extends NoteObject
762766
noMissAnimation = true;
763767
case 'GF Sing':
764768
gfNote = true;
769+
case 'Botplay Note':
770+
botNote = true;
771+
hitsoundChartEditor = false;
765772
}
766773
if (value != null && value.length > 1) NoteTypesConfig.applyNoteTypeData(this, value);
767774
if (hitsound != 'hitsound' && hitsoundVolume > 0) Paths.sound(hitsound); //precache new sound for being idiot-proof

source/objects/playfields/PlayField.hx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ class PlayField extends FlxTypedGroup<FlxBasic>
938938
if(daNote.holdingTime < daNote.sustainLength && inControl && !daNote.blockHit){
939939
if(!daNote.tooLate && daNote.wasGoodHit){
940940
trace("hitting tail hold");
941-
var isHeld:Bool = autoPlayed || keysPressed[daNote.column];
941+
var isHeld:Bool = autoPlayed || keysPressed[daNote.column] || daNote.botNote;
942942
var wasHeld:Bool = daNote.isHeld;
943943
daNote.isHeld = isHeld;
944944
isHolding[daNote.column] = true;
@@ -1068,6 +1068,19 @@ class PlayField extends FlxTypedGroup<FlxBasic>
10681068
}
10691069
}
10701070
}else{
1071+
1072+
// Check for Bot Notes.
1073+
for(i in 0...keyCount){
1074+
for (daNote in getNotes(i, (note:Note) -> !note.tooLate && !note.wasGoodHit && !note.ignoreNote && !note.hitCausesMiss && note.botNote)){
1075+
var hitDiff = Conductor.songPosition - daNote.strumTime;
1076+
if (!daNote.isSustainNote && hitDiff >= 0 || daNote.isSustainNote && hitDiff + 80 >= 0){
1077+
noteHitCallback(daNote, this);
1078+
}
1079+
}
1080+
}
1081+
1082+
1083+
10711084
for(data in 0...keyCount){
10721085
if (keysPressed[data]){
10731086
var noteList = getNotesWithEnd(data, Conductor.songPosition, (note:Note) -> (note.isSustainNote || note.istail) && (note.prevNote != null || note.unhitTail.length > -1));

source/states/editors/ChartingStateOG.hx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ class ChartingStateOG extends backend.MusicBeatChartingState
6464
}
6565
}
6666

67-
public static var noteTypeList:Array<String> = // Used for backwards compatibility with 0.1 - 0.3.2 charts, though, you should add your hardcoded custom note types here too.
68-
[
67+
public static var noteTypeList:Array<String> = getNoteTypeList();
68+
69+
private static function getNoteTypeList():Array<String> {
70+
var notes = [
6971
'',
7072
'Alt Animation',
7173
'Hey!',
@@ -78,6 +80,8 @@ class ChartingStateOG extends backend.MusicBeatChartingState
7880
'Both Note',
7981
'Both Alt Note'
8082
];
83+
return notes.concat(Note.defaultNoteTypes.filter(type -> !notes.contains(type)));
84+
}
8185

8286
private var didAThing = false;
8387

0 commit comments

Comments
 (0)