Change how notes are rendered in charter
This commit is contained in:
@@ -340,6 +340,7 @@ class Charter extends UIState {
|
||||
add(charterBG);
|
||||
|
||||
gridBackdrop = new CharterBackdrop();
|
||||
gridBackdrop.notesGroup = this.notesGroup;
|
||||
|
||||
eventsBackdrop = new EventBackdrop();
|
||||
eventsBackdrop.x = -eventsBackdrop.width;
|
||||
@@ -430,11 +431,9 @@ class Charter extends UIState {
|
||||
vocals = FlxG.sound.load(Paths.voices(__song, __diff));
|
||||
vocals.group = FlxG.sound.defaultMusicGroup;
|
||||
|
||||
trace("generating notes...");
|
||||
for(strL in PlayState.SONG.strumLines)
|
||||
createStrumline(strumLines.members.length, strL, false);
|
||||
|
||||
trace("generating events...");
|
||||
var __last:CharterEvent = null;
|
||||
var __lastTime:Float = Math.NaN;
|
||||
for(e in PlayState.SONG.events) {
|
||||
|
||||
@@ -16,6 +16,8 @@ class CharterBackdrop extends FlxBackdrop {
|
||||
public var beatSeparator:FlxBackdrop;
|
||||
public var sectionSeparator:FlxBackdrop;
|
||||
|
||||
public var notesGroup:CharterNoteGroup;
|
||||
|
||||
public function new() {
|
||||
super(null, Y, 0, 0);
|
||||
|
||||
@@ -102,6 +104,12 @@ class CharterBackdrop extends FlxBackdrop {
|
||||
topLimit.x = this.x;
|
||||
topLimit.cameras = this.cameras;
|
||||
|
||||
// Draw notes
|
||||
notesGroup.forEach((n) -> {
|
||||
if(n.exists && n.visible && (Math.floor(n.id/4) == _))
|
||||
n.draw();
|
||||
});
|
||||
|
||||
topLimit.scale.set(4 * 40, Math.ceil(FlxG.height / cameras[0].zoom));
|
||||
topLimit.updateHitbox();
|
||||
topLimit.y = -topLimit.height;
|
||||
|
||||
@@ -53,17 +53,20 @@ class CharterNote extends UISprite implements ICharterSelectable {
|
||||
|
||||
|
||||
public var step:Float;
|
||||
public var realId:Int;
|
||||
@:isVar public var id(get, set):Int;
|
||||
public var susLength:Float;
|
||||
public var type:Int;
|
||||
|
||||
public var realId:Int;
|
||||
@:isVar public var id(get, set):Int;
|
||||
function set_id(d:Int) {
|
||||
strumLine = Charter.instance.strumLines.members[Math.floor(d / 4)];
|
||||
id = d % 4;
|
||||
realId = d;
|
||||
return id;
|
||||
return id = d % 4;
|
||||
}
|
||||
function get_id() return id + 4 * Charter.instance.strumLines.members.indexOf(strumLine);
|
||||
|
||||
function get_id():Int
|
||||
return id + 4 * Charter.instance.strumLines.members.indexOf(strumLine);
|
||||
|
||||
public function updatePos(step:Float, id:Int, susLength:Float = 0, type:Int = 0) {
|
||||
this.step = step;
|
||||
this.id = id;
|
||||
|
||||
@@ -7,6 +7,7 @@ class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
var i:Int = 0;
|
||||
var max:Float = 0;
|
||||
var __currentlyLooping:Bool = false;
|
||||
var __autoDraw:Bool = false;
|
||||
|
||||
public override function forEach(noteFunc:CharterNote->Void, recursive:Bool = false) {
|
||||
__loopSprite = null;
|
||||
@@ -54,10 +55,13 @@ class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
@:privateAccess var oldDefaultCameras = FlxCamera._defaultCameras;
|
||||
@:privateAccess if (cameras != null) FlxCamera._defaultCameras = cameras;
|
||||
|
||||
forEach((n) -> {
|
||||
if(n.exists && n.visible)
|
||||
n.draw();
|
||||
});
|
||||
if (__autoDraw) {
|
||||
forEach((n) -> {
|
||||
if(n.exists && n.visible)
|
||||
n.draw();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@:privateAccess FlxCamera._defaultCameras = oldDefaultCameras;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user