diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 53d68fe62..f600d1c16 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -97,8 +97,6 @@ class Charter extends UIState { public static var clipboard:Array = []; public static var waveformHandler:CharterWaveformHandler; - public static var keyCount = 4; - public function new(song:String, diff:String, reload:Bool = true) { super(); if (song != null) { @@ -297,17 +295,6 @@ class Charter extends UIState { label: 'Low Detail Waveforms', onSelect: _view_switchWaveformDetail, icon: Options.charterLowDetailWaveforms ? 1 : 0 - }, - null, - { - label: "Decrease grid width", - keybind: [CONTROL, LBRACKET], - onSelect: _view_decrease_keycount - }, - { - label: "Increase grid width", - keybind: [CONTROL, RBRACKET], - onSelect: _view_increase_keycount } ] }, @@ -795,7 +782,7 @@ class Charter extends UIState { n.snappedToStrumline = false; n.setPosition(n.fullID * 40 + (mousePos.x - dragStartPos.x), n.step * 40 + (mousePos.y - dragStartPos.y)); n.y = FlxMath.bound(n.y, 0, (__endStep*40) - n.height); - n.x = FlxMath.bound(n.x, 0, ((strumLines.members.length * Charter.keyCount)-1) * 40); + n.x = FlxMath.bound(n.x, 0, ((strumLines.members.length * 4)-1) * 40); n.cursor = HAND; }, function (e:CharterEvent) { e.y = e.step * 40 + (mousePos.y - dragStartPos.y) - 17; @@ -824,7 +811,7 @@ class Charter extends UIState { if (s is CharterNote) { var note:CharterNote = cast s; if (note.fullID + changePoint.y < 0) boundedChange.y += Math.abs(note.fullID + changePoint.y); - if (note.fullID + changePoint.y > (strumLines.members.length*Charter.keyCount)-1) boundedChange.y -= (note.fullID + changePoint.y) - ((strumLines.members.length*Charter.keyCount)-1); + if (note.fullID + changePoint.y > (strumLines.members.length*4)-1) boundedChange.y -= (note.fullID + changePoint.y) - ((strumLines.members.length*4)-1); } s.handleDrag(boundedChange); @@ -857,7 +844,7 @@ class Charter extends UIState { gridActionType = BOX_SELECTION; var id = Math.floor(mousePos.x / 40); - var mouseOnGrid = id >= 0 && id < Charter.keyCount * gridBackdrops.strumlinesAmount && mousePos.y >= 0; + var mouseOnGrid = id >= 0 && id < 4 * gridBackdrops.strumlinesAmount && mousePos.y >= 0; if (FlxG.mouse.justReleased) { for (n in selection) n.selected = false; @@ -867,7 +854,7 @@ class Charter extends UIState { var note = new CharterNote(); note.updatePos( FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((mousePos.y-20) / 40) : quantStep(mousePos.y/40), 0, __endStep-1), - id % Charter.keyCount, 0, noteType, strumLines.members[Std.int(id/Charter.keyCount)] + id % 4, 0, noteType, strumLines.members[Std.int(id/4)] ); notesGroup.add(note); selection = [note]; @@ -1170,7 +1157,7 @@ class Charter extends UIState { gridBackdrops.conductorSprY = lerp(gridBackdrops.conductorSprY, curStepFloat * 40, __firstFrame ? 1 : 1/3); } charterCamera.scroll.set( - ((((40*Charter.keyCount) * gridBackdrops.strumlinesAmount) - FlxG.width) / 2), + ((((40*4) * gridBackdrops.strumlinesAmount) - FlxG.width) / 2), gridBackdrops.conductorSprY - (FlxG.height * 0.5) ); @@ -1624,11 +1611,6 @@ class Charter extends UIState { t.icon = (Options.charterLowDetailWaveforms = !Options.charterLowDetailWaveforms) ? 1 : 0; for (shader in waveformHandler.waveShaders) shader.data.lowDetail.value = [Options.charterLowDetailWaveforms]; } - - inline function _view_increase_keycount(_) - changeKeyCount(keyCount+1); - inline function _view_decrease_keycount(_) - changeKeyCount(keyCount-1); inline function _snap_increasesnap(_) changequant(1); inline function _snap_decreasesnap(_) changequant(-1); @@ -1683,33 +1665,8 @@ class Charter extends UIState { if (note.step > Conductor.curMeasure*Conductor.getMeasureLength() && note.step < (Conductor.curMeasure+1)*Conductor.getMeasureLength()) note ]; } - #end - function changeKeyCount(newKeyCount:Int = 4) { - if (newKeyCount < 1) newKeyCount = 1; - - if (keyCount != newKeyCount) { - - keyCount = newKeyCount; - - var gridBackdropIndex = members.indexOf(gridBackdrops); - - remove(gridBackdrops); - gridBackdrops.destroy(); - - gridBackdrops = new CharterBackdropGroup(strumLines); - gridBackdrops.notesGroup = notesGroup; - insert(gridBackdropIndex, gridBackdrops); - - @:privateAccess - gridBackdropDummy.parent = gridBackdrops; - gridBackdrops.cameras = [Charter.instance.charterCamera]; - gridBackdrops.createGrids(PlayState.SONG.strumLines.length); - refreshBPMSensitive(); - } - } - function changeNoteSustain(change:Float) { if (selection.length <= 0 || change == 0 || gridActionType != NONE) return; diff --git a/source/funkin/editors/charter/CharterBackdropGroup.hx b/source/funkin/editors/charter/CharterBackdropGroup.hx index 13b4423e7..e9240ad1a 100644 --- a/source/funkin/editors/charter/CharterBackdropGroup.hx +++ b/source/funkin/editors/charter/CharterBackdropGroup.hx @@ -22,16 +22,16 @@ class CharterBackdropGroup extends FlxTypedGroup { super(); this.strumLineGroup = strumLineGroup; - __gridGraphic = FlxG.bitmap.create(40*Charter.keyCount, 160, 0xFF272727, true); + __gridGraphic = FlxG.bitmap.create(160, 160, 0xFF272727, true); __gridGraphic.bitmap.lock(); // Checkerboard for(y in 0...4) - for(x in 0...Math.ceil(Charter.keyCount/2)) __gridGraphic.bitmap.fillRect(new Rectangle(40*((x*2)+(y%2)), 40*y, 40, 40), 0xFF545454); + for(x in 0...2) __gridGraphic.bitmap.fillRect(new Rectangle(40*((x*2)+(y%2)), 40*y, 40, 40), 0xFF545454); // Edges __gridGraphic.bitmap.fillRect(new Rectangle(0, 0, 1, 160), 0xFFDDDDDD); - __gridGraphic.bitmap.fillRect(new Rectangle((40*Charter.keyCount)-1, 0, 1, 160), 0xFFDDDDDD); + __gridGraphic.bitmap.fillRect(new Rectangle(159, 0, 1, 160), 0xFFDDDDDD); __gridGraphic.bitmap.unlock(); } @@ -68,7 +68,7 @@ class CharterBackdropGroup extends FlxTypedGroup { grid.notesGroup.clear(); notesGroup.forEach((n) -> { - var onStr:Bool = (n.snappedToStrumline ? n.strumLineID : Std.int(FlxMath.bound((n.x+n.width)/(40*Charter.keyCount), 0, strumLineGroup.members.length-1))) == i; + var onStr:Bool = (n.snappedToStrumline ? n.strumLineID : Std.int(FlxMath.bound((n.x+n.width)/(40*4), 0, strumLineGroup.members.length-1))) == i; if(n.exists && n.visible && onStr) grid.notesGroup.add(n); }); @@ -148,7 +148,7 @@ class CharterBackdrop extends FlxTypedGroup { sep.makeSolid(1, 1, -1); sep.alpha = 0.5; sep.scrollFactor.set(1, 1); - sep.scale.set((Charter.keyCount * 40), sep == sectionSeparator ? 4 : 2); + sep.scale.set((4 * 40), sep == sectionSeparator ? 4 : 2); sep.updateHitbox(); } add(beatSeparator); @@ -159,7 +159,7 @@ class CharterBackdrop extends FlxTypedGroup { bottomSeparator.makeSolid(1, 1, -1); bottomSeparator.alpha = 0.5; bottomSeparator.scrollFactor.set(1, 1); - bottomSeparator.scale.set(Charter.keyCount * 40, 4); + bottomSeparator.scale.set(4 * 40, 4); bottomSeparator.updateHitbox(); add(bottomSeparator); @@ -167,7 +167,7 @@ class CharterBackdrop extends FlxTypedGroup { topSeparator.makeSolid(1, 1, -1); topSeparator.alpha = 0.5; topSeparator.scrollFactor.set(1, 1); - topSeparator.scale.set(Charter.keyCount * 40, 4); + topSeparator.scale.set(4 * 40, 4); topSeparator.updateHitbox(); add(topSeparator); @@ -186,7 +186,7 @@ class CharterBackdrop extends FlxTypedGroup { // Follower conductorFollowerSpr = new FlxSprite(0, 0).makeSolid(1, 1, -1); - conductorFollowerSpr.scale.set(Charter.keyCount * 40, 4); + conductorFollowerSpr.scale.set(4 * 40, 4); conductorFollowerSpr.updateHitbox(); add(conductorFollowerSpr); } @@ -209,17 +209,17 @@ class CharterBackdrop extends FlxTypedGroup { sectionSeparator.spacing.y = (10 * Conductor.beatsPerMeasure * Conductor.stepsPerBeat) - 1; beatSeparator.spacing.y = (20 * Conductor.stepsPerBeat) - 1; - topLimit.scale.set(Charter.keyCount * 40, Math.ceil(FlxG.height / cameras[0].zoom)); + topLimit.scale.set(4 * 40, Math.ceil(FlxG.height / cameras[0].zoom)); topLimit.updateHitbox(); topLimit.y = -topLimit.height; - bottomLimit.scale.set(Charter.keyCount * 40, Math.ceil(FlxG.height / cameras[0].zoom)); + bottomLimit.scale.set(4 * 40, Math.ceil(FlxG.height / cameras[0].zoom)); bottomLimit.updateHitbox(); waveformSprite.visible = waveformSprite.shader != null; if (waveformSprite.shader == null) return; - waveformSprite.scale.set(Charter.keyCount * 40, FlxG.height * (1/cameras[0].zoom)); + waveformSprite.scale.set(160, FlxG.height * (1/cameras[0].zoom)); waveformSprite.updateHitbox(); waveformSprite.y = (cameras[0].scroll.y+FlxG.height/2)-(waveformSprite.height/2); diff --git a/source/funkin/editors/charter/CharterNote.hx b/source/funkin/editors/charter/CharterNote.hx index 6c37d1e78..1d1308420 100644 --- a/source/funkin/editors/charter/CharterNote.hx +++ b/source/funkin/editors/charter/CharterNote.hx @@ -71,7 +71,7 @@ class CharterNote extends UISprite implements ICharterSelectable { public var fullID(get, never):Int; // instead of %4 get fullID (for mousepos stuff) public function get_fullID():Int - return (strumLineID * Charter.keyCount) + id; + return (strumLineID * 4) + id; public function updatePos(step:Float, id:Int, susLength:Float = 0, ?type:Int = 0, ?strumLine:CharterStrumline = null) { this.step = step; @@ -175,14 +175,14 @@ class CharterNote extends UISprite implements ICharterSelectable { public function handleDrag(change:FlxPoint) { var newStep = FlxMath.bound(step + change.x, 0, Charter.instance.__endStep-1); - var newID:Int = Std.int(FlxMath.bound(fullID + Std.int(change.y), 0, (Charter.instance.strumLines.members.length*Charter.keyCount)-1)); + var newID:Int = Std.int(FlxMath.bound(fullID + Std.int(change.y), 0, (Charter.instance.strumLines.members.length*4)-1)); - updatePos(newStep, newID % Charter.keyCount, susLength, type, Charter.instance.strumLines.members[Std.int(newID/Charter.keyCount)]); + updatePos(newStep, newID % 4, susLength, type, Charter.instance.strumLines.members[Std.int(newID/4)]); } public override function draw() { if (snappedToStrumline) - x = (strumLine != null ? strumLine.x : 0) + (id % Charter.keyCount) * 40; + x = (strumLine != null ? strumLine.x : 0) + (id % 4) * 40; drawMembers(); drawSuper(); diff --git a/source/funkin/editors/charter/CharterNoteHoverer.hx b/source/funkin/editors/charter/CharterNoteHoverer.hx index 47cd84955..e20000a2e 100644 --- a/source/funkin/editors/charter/CharterNoteHoverer.hx +++ b/source/funkin/editors/charter/CharterNoteHoverer.hx @@ -17,7 +17,7 @@ class CharterNoteHoverer extends CharterNote { switch (Charter.instance.gridActionType) { case NONE: var inBoundsY:Bool = (__mousePos.y > 0 && __mousePos.y < (Charter.instance.__endStep)*40); - if ((__mousePos.x > 0 && __mousePos.x < Charter.instance.gridBackdrops.strumlinesAmount * 40 * Charter.keyCount && inBoundsY) && showHoverer) { + if ((__mousePos.x > 0 && __mousePos.x < Charter.instance.gridBackdrops.strumlinesAmount * 160 && inBoundsY) && showHoverer) { step = FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((__mousePos.y-20) / 40) : Charter.instance.quantStep(__mousePos.y/40), 0, Charter.instance.__endStep-1); id = Math.floor(__mousePos.x / 40); y = step * 40; x = id * 40; visible = true; sustainSpr.visible = typeText.visible = false; angle = switch(animation.curAnim.curFrame = (id % 4)) { @@ -53,7 +53,7 @@ class CharterNoteHoverer extends CharterNote { y -= ((draggingNote.step + verticalChange) - Charter.instance.quantStepRounded(draggingNote.step+verticalChange, verticalChange > 0 ? 0.35 : 0.65)); y *= 40; - var newID:Int = Std.int(FlxMath.bound(draggingNote.fullID + horizontalChange, 0, (Charter.instance.strumLines.members.length*Charter.keyCount)-1)); + var newID:Int = Std.int(FlxMath.bound(draggingNote.fullID + horizontalChange, 0, (Charter.instance.strumLines.members.length*4)-1)); x = (id=newID) * 40; y = FlxMath.bound(y, 0, (Charter.instance.__endStep*40) - height); angle = switch(animation.curAnim.curFrame = (draggingNote.id % 4)) { diff --git a/source/funkin/editors/charter/CharterStrumLineGroup.hx b/source/funkin/editors/charter/CharterStrumLineGroup.hx index 6cf89eab9..483b62ce9 100644 --- a/source/funkin/editors/charter/CharterStrumLineGroup.hx +++ b/source/funkin/editors/charter/CharterStrumLineGroup.hx @@ -34,14 +34,14 @@ class CharterStrumLineGroup extends FlxTypedGroup { } for (i=>strum in members) - if (strum != null && !strum.dragging) strum.x = CoolUtil.fpsLerp(strum.x, 40*Charter.keyCount * i, 0.225); + if (strum != null && !strum.dragging) strum.x = CoolUtil.fpsLerp(strum.x, 160 * i, 0.225); if (Charter.instance.eventsBackdrop != null && members[0] != null) Charter.instance.eventsBackdrop.x = members[0].button.x - Charter.instance.eventsBackdrop.width; if (Charter.instance.strumlineLockButton != null && members[0] != null) - Charter.instance.strumlineLockButton.x = members[0].x - (40*Charter.keyCount); + Charter.instance.strumlineLockButton.x = members[0].x - (40*4); if (Charter.instance.strumlineAddButton != null && members[Std.int(Math.max(0, members.length-1))] != null) - Charter.instance.strumlineAddButton.x = members[members.length-1].x + (40*Charter.keyCount); + Charter.instance.strumlineAddButton.x = members[members.length-1].x + (40*4); if ((FlxG.mouse.justReleased || !draggable) && isDragging) finishDrag(); @@ -52,7 +52,7 @@ class CharterStrumLineGroup extends FlxTypedGroup { public function snapStrums() { for (i=>strum in members) - if (strum != null && !strum.dragging) strum.x = (40*Charter.keyCount) * i; + if (strum != null && !strum.dragging) strum.x = 160 * i; } public function orderStrumline(strumLine:CharterStrumline, newID:Int) { diff --git a/source/funkin/editors/charter/CharterStrumline.hx b/source/funkin/editors/charter/CharterStrumline.hx index 29e2324e7..3850c2fa0 100644 --- a/source/funkin/editors/charter/CharterStrumline.hx +++ b/source/funkin/editors/charter/CharterStrumline.hx @@ -82,7 +82,7 @@ class CharterStrumline extends UISprite { public override function update(elapsed:Float) { if (FlxG.keys.justPressed.K) draggable = !draggable; - healthIcons.follow(this, ((40 * Charter.keyCount) - healthIcons.width) / 2, 7 + (__healthYOffset = FlxMath.lerp(__healthYOffset, draggable ? 8 : 0, 1/20))); + healthIcons.follow(this, ((40 * 4) - healthIcons.width) / 2, 7 + (__healthYOffset = FlxMath.lerp(__healthYOffset, draggable ? 8 : 0, 1/20))); draggingSprite.selectable = draggable; UIState.state.updateSpriteRect(draggingSprite); @@ -91,7 +91,7 @@ class CharterStrumline extends UISprite { draggingSprite.scale.set(dragScale, dragScale); draggingSprite.updateHitbox(); - draggingSprite.follow(this, ((Charter.keyCount*40)/2) - (draggingSprite.width/2), 6 + (__draggingYOffset = FlxMath.lerp(__draggingYOffset, draggable ? 3 : 0, 1/12))); + draggingSprite.follow(this, (160/2) - (draggingSprite.width/2), 6 + (__draggingYOffset = FlxMath.lerp(__draggingYOffset, draggable ? 3 : 0, 1/12))); var fullAlpha:Float = UIState.state.isOverlapping(draggingSprite, @:privateAccess draggingSprite.__rect) || dragging ? 0.9 : 0.35; draggingSprite.alpha = FlxMath.lerp(draggingSprite.alpha, draggable ? fullAlpha : 0, 1/12); button.follow(this, 0, 95); @@ -125,13 +125,13 @@ class CharterStrumlineOptions extends UITopMenuButton { public function new(parent:CharterStrumline) { super(0, 95, null, "Options ↓", []); strLine = parent; + bWidth = 40 * 4; + this.label.fieldWidth = bWidth; } public override function update(elapsed:Float) { super.update(elapsed); alpha = FlxMath.lerp(1/20, 1, alpha); // so that instead of 0% it is 33% visible - bWidth = 40 * Charter.keyCount; - this.label.fieldWidth = bWidth; } public override function openContextMenu() { diff --git a/source/funkin/editors/charter/CharterStrumlineButton.hx b/source/funkin/editors/charter/CharterStrumlineButton.hx index cb5b6dafd..c56193304 100644 --- a/source/funkin/editors/charter/CharterStrumlineButton.hx +++ b/source/funkin/editors/charter/CharterStrumlineButton.hx @@ -48,9 +48,8 @@ class CharterStrumlineButton extends UISprite { public var textColorLerp:Float = 1; public override function update(elapsed:Float) { - button.follow(this, ((40 * Charter.keyCount) - button.width) / 2, 20+buttonYOffset); + button.follow(this, ((40 * 4) - button.width) / 2, 20+buttonYOffset); text.follow(this, 0, 84); - text.fieldWidth = (40 * Charter.keyCount); shakeTimer -= elapsed; if (shakeTimer > 0)