@@ -2420,15 +2420,20 @@ class PlayState extends MusicBeatState
24202420 if (section .changeBPM != null && section .changeBPM && section .bpm != null && daBpm != section .bpm )
24212421 daBpm = section .bpm ;
24222422
2423- for (i in 0 ... section .sectionNotes .length ) {
2424- var swagNote : APNote = new APNote (spawnTime , noteColumn , oldNote );
2425- swagNote .mustPress = gottaHitNote ;
2426- swagNote .gfNote = (section .gfSection && gottaHitNote == section .mustHitSection );
2427- swagNote .animSuffix = isAlt ? " -alt" : " " ;
2428- swagNote .sustainLength = songNotes [2 ];
2429- swagNote .noteType = noteType ;
2423+ // Function to get random mappings from available indexes and a list of special integers
2424+ function getAPLocations (max : Int , loc : Array <Int >, gottaHit : Array <Bool >): Array <{index : Int , loc : Int }> {
2425+ var mappings : Array <{index : Int , loc : Int }> = [];
2426+ var indexes : Array <Int > = [for (i in 0 ... max ) if (gottaHit [i ]) i ];
2427+
2428+ for (i in 0 ... Std .int (Math .min (indexes .length , loc .length ))) {
2429+ mappings .push ({index : indexes [i ], loc : loc [i ]});
2430+ }
2431+ return mappings ;
24302432 }
24312433
2434+ var gottaHit : Array <Bool > = [for (note in section .sectionNotes ) note [1 ] < (SONG .mania != null ? totalColumns : Note .ammo [3 ])];
2435+ var APNotes : Array <{index : Int , loc : Int }> = (this is archipelago. APPlayState ) ? getAPLocations (section .sectionNotes .length , archipelago. APGameState .instance .noteData (PlayState .SONG .song , archipelago. APPlayState .currentMod ), gottaHit ) : [];
2436+
24322437 for (i in 0 ... section .sectionNotes .length )
24332438 {
24342439 final songNotes : Array <Dynamic > = section .sectionNotes [i ];
@@ -2437,6 +2442,15 @@ class PlayState extends MusicBeatState
24372442 var noteStartColumn : Int = Std .int (songNotes [1 ] % Note .ammo [SONG .mania != null ? SONG .mania : 3 ]);
24382443 var holdLength : Float = songNotes [2 ];
24392444 var noteType : String = ! Std .isOfType (songNotes [3 ], String ) ? Note .defaultNoteTypes [songNotes [3 ]] : songNotes [3 ];
2445+ var apNote : Bool = (function () {
2446+ for (apNoteData in APNotes ) {
2447+ if (apNoteData .index == i ) {
2448+ return true ;
2449+ }
2450+ }
2451+ return false ;
2452+ })();
2453+ var apLoc = APNotes .filter (function (apNoteData ) return apNoteData .index == i )[0 ].loc ;
24402454 if (Math .isNaN (holdLength )) holdLength = 0.0 ;
24412455
24422456 if (chartModifier != " 4K Only" && chartModifier != " ManiaConverter" ) {
@@ -2842,6 +2856,8 @@ class PlayState extends MusicBeatState
28422856 oldNote = null ;
28432857
28442858 var swagNote : Note = new Note (spawnTime , noteColumn , oldNote );
2859+ if (apNote )
2860+ swagNote = new archipelago. APNote (swagNote , apLoc );
28452861 swagNote .mustPress = gottaHitNote ;
28462862 if (! swagNote .mustPress )
28472863 {
0 commit comments