@@ -3,7 +3,7 @@ package funkin.data;
33import flixel .util .FlxSort ;
44import funkin .objects .gameplay .strumline .NoteSprite ;
55import funkin .objects .gameplay .strumline .Strumline ;
6- import funkin .util .Controls ;
6+ import funkin .util .FunkinControls ;
77import funkin .util .InputUtil ;
88import haxe .Json ;
99
@@ -44,39 +44,23 @@ class StrumlineData
4444 data = cast Json .parse (dataContent );
4545 }
4646
47- var lastCPUControlled : Null <Bool > = null ;
48-
4947 public function update (): Void
5048 {
51- if (lastCPUControlled != data .computerControlled )
52- {
53- if (Controls .instance .pressed .has (controlPressed ) && data .computerControlled )
54- Controls .instance .pressed .remove (controlPressed );
55-
56- if (! Controls .instance .pressed .has (controlPressed ) && ! data .computerControlled )
57- Controls .instance .pressed .add (controlPressed );
58-
59- if (Controls .instance .released .has (controlReleased ) && data .computerControlled )
60- Controls .instance .released .remove (controlReleased );
61-
62- if (! Controls .instance .released .has (controlReleased ) && ! data .computerControlled )
63- Controls .instance .released .add (controlReleased );
64-
65- lastCPUControlled = data .computerControlled ;
66- }
49+ if (data .computerControlled )
50+ return ;
6751
52+ controlPressed ();
53+ controlReleased ();
6854 handleNoteInput ();
6955 }
7056
71- var lastInputPressed : InputHit = {direction : - 1 , time : - 1 };
72-
7357 private function controlPressed (): Void
7458 {
7559 var controlArray : Array <Bool > = [
76- Controls .instance .NOTE_LEFT_P ,
77- Controls .instance .NOTE_DOWN_P ,
78- Controls .instance .NOTE_UP_P ,
79- Controls .instance .NOTE_RIGHT_P
60+ FunkinControls .instance .justPressed . NOTE_LEFT ,
61+ FunkinControls .instance .justPressed . NOTE_DOWN ,
62+ FunkinControls .instance .justPressed . NOTE_UP ,
63+ FunkinControls .instance .justPressed . NOTE_RIGHT
8064 ];
8165
8266 for (i in 0 ... controlArray .length )
@@ -85,26 +69,22 @@ class StrumlineData
8569 {
8670 var direction : NoteDirection = cast (i , NoteDirection );
8771 @:privateAccess
88- if (strumline != null && ! ( lastInputPressed . direction == direction && lastInputPressed . time == conductorInUse . time ) )
72+ if (strumline != null )
8973 {
9074 strumline .currentlyPressed [direction ] = true ;
9175 notesPressed .push ({direction : direction , time : conductorInUse .time });
92- lastInputPressed .direction = direction ;
93- lastInputPressed .time = conductorInUse .time ;
9476 }
9577 }
9678 }
9779 }
9880
99- var lastInputReleased : InputHit = {direction : - 1 , time : - 1 };
100-
10181 private function controlReleased (): Void
10282 {
10383 var controlArray : Array <Bool > = [
104- Controls .instance .NOTE_LEFT_R ,
105- Controls .instance .NOTE_DOWN_R ,
106- Controls .instance .NOTE_UP_R ,
107- Controls .instance .NOTE_RIGHT_R
84+ FunkinControls .instance .justReleased . NOTE_LEFT ,
85+ FunkinControls .instance .justReleased . NOTE_DOWN ,
86+ FunkinControls .instance .justReleased . NOTE_UP ,
87+ FunkinControls .instance .justReleased . NOTE_RIGHT
10888 ];
10989
11090 for (i in 0 ... controlArray .length )
@@ -114,12 +94,10 @@ class StrumlineData
11494 {
11595 var direction : NoteDirection = cast (i , NoteDirection );
11696 @:privateAccess
117- if (strumline != null && ! ( lastInputReleased . direction == direction && lastInputReleased . time == conductorInUse . time ) )
97+ if (strumline != null )
11898 {
11999 strumline .currentlyPressed [direction ] = false ;
120100 notesReleased .push ({direction : direction , time : conductorInUse .time });
121- lastInputReleased .direction = direction ;
122- lastInputReleased .time = conductorInUse .time ;
123101 }
124102 }
125103 }
0 commit comments