From 8cf346c3b0f5eb2813cf00b4913e17590c90090b Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 22 Oct 2024 20:36:10 -0400 Subject: [PATCH 1/9] Update CHANGELOG.md --- CHANGELOG.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c550557c97f..42c30c00e48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.5.3] - 2024-10-18 - -### Changed -- `optionsStageEditor.theme` converted from an Enum to a String to fix save data compatibility issues. -- In the future, Enum values should not be used in order to prevent incompatibilities caused by introducing new types to the save data that older versions cannot parse. -- `optionsChartEditor.theme` converted from an Enum to a String to fix save data compatibility issues. -- `optionsChartEditor.chartEditorLiveInputStyle` converted from an Enum to a String to fix save data compatibility issues. +This patch resolves a critical issue which could cause user's save data to become corrupted. It is recommended that users switch to this version immediately and avoid using version 0.5.2. +### Fixed +- Fixed a critical issue in which the Stage Editor theme value could not be parsed by older versions of the game, resulting in all save data being destroyed. + - Added a check which prevents save data from being loaded if it is corrupted rather than overriding it. +- `optionsStageEditor.theme` in the save data converted from an Enum to a String to fix save data compatibility issues. + - In the future, Enum values should not be used in order to prevent incompatibilities caused by introducing new types to the save data that older versions cannot parse. +- `optionsChartEditor.theme` in the save data converted from an Enum to a String to fix save data compatibility issues. +- `optionsChartEditor.chartEditorLiveInputStyle` in the save data converted from an Enum to a String to fix save data compatibility issues. +- Fixed an issue where some publicly distributed release builds of the game were not ## [0.5.2] - 2024-10-11 From 62de2a0345d929cf8932a8ea8a0e9e0385c009ec Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 23 Oct 2024 13:40:35 -0400 Subject: [PATCH 2/9] ...sandwiches. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42c30c00e48..2fb4f02d481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ This patch resolves a critical issue which could cause user's save data to becom - In the future, Enum values should not be used in order to prevent incompatibilities caused by introducing new types to the save data that older versions cannot parse. - `optionsChartEditor.theme` in the save data converted from an Enum to a String to fix save data compatibility issues. - `optionsChartEditor.chartEditorLiveInputStyle` in the save data converted from an Enum to a String to fix save data compatibility issues. -- Fixed an issue where some publicly distributed release builds of the game were not +- Fixed an issue where some publicly distributed builds of the game were debug builds instead of release builds. ## [0.5.2] - 2024-10-11 From 7159cad2c17e61193c0cd6e79364e91583870248 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 26 Oct 2024 15:51:38 -0400 Subject: [PATCH 3/9] style: remove a buncho unused imports from PlayState.hx --- source/funkin/play/PlayState.hx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index dbacf3fa967..9f32e724543 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1,17 +1,13 @@ package funkin.play; -import flixel.addons.display.FlxPieDial; import flixel.addons.transition.FlxTransitionableState; import flixel.addons.transition.Transition; import flixel.FlxCamera; import flixel.FlxObject; -import flixel.FlxState; import flixel.FlxSubState; import flixel.math.FlxMath; import flixel.math.FlxPoint; -import flixel.math.FlxRect; import flixel.text.FlxText; -import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; import flixel.ui.FlxBar; import flixel.util.FlxColor; @@ -22,7 +18,6 @@ import funkin.audio.FunkinSound; import funkin.audio.VoicesGroup; import funkin.data.dialogue.conversation.ConversationRegistry; import funkin.data.event.SongEventRegistry; -import funkin.data.notestyle.NoteStyleData; import funkin.data.notestyle.NoteStyleRegistry; import funkin.data.song.SongData.SongCharacterData; import funkin.data.song.SongData.SongEventData; @@ -45,7 +40,6 @@ import funkin.play.cutscene.VanillaCutscenes; import funkin.play.cutscene.VideoCutscene; import funkin.play.notes.NoteDirection; import funkin.play.notes.notekind.NoteKindManager; -import funkin.play.notes.NoteSplash; import funkin.play.notes.NoteSprite; import funkin.play.notes.notestyle.NoteStyle; import funkin.play.notes.Strumline; @@ -58,15 +52,9 @@ import funkin.ui.debug.charting.ChartEditorState; import funkin.ui.debug.stage.StageOffsetSubState; import funkin.ui.mainmenu.MainMenuState; import funkin.ui.MusicBeatSubState; -import funkin.ui.options.PreferencesMenu; -import funkin.ui.story.StoryMenuState; import funkin.ui.transition.LoadingState; import funkin.util.SerializerUtil; import haxe.Int64; -import lime.ui.Haptic; -import openfl.display.BitmapData; -import openfl.geom.Rectangle; -import openfl.Lib; #if FEATURE_DISCORD_RPC import funkin.api.discord.DiscordClient; #end From 144ba003773cd15f07680898fc380c70293ac1ef Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 26 Oct 2024 15:53:22 -0400 Subject: [PATCH 4/9] refactor: remove commented out code from draw() in PlayState.hx --- source/funkin/play/PlayState.hx | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 9f32e724543..c662f99186b 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -748,24 +748,6 @@ class PlayState extends MusicBeatSubState refresh(); } - public override function draw():Void - { - // if (FlxG.renderBlit) - // { - // camGame.fill(BACKGROUND_COLOR); - // } - // else if (FlxG.renderTile) - // { - // FlxG.log.warn("PlayState background not displayed properly on tile renderer!"); - // } - // else - // { - // FlxG.log.warn("PlayState background not displayed properly, unknown renderer!"); - // } - - super.draw(); - } - function assertChartExists():Bool { // Returns null if the song failed to load or doesn't have the selected difficulty. From 20d90169845f1e50f849e39f4c5f818359756c78 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 23 Oct 2024 19:19:06 -0400 Subject: [PATCH 5/9] feat: Added smoother scrolling when using the Chart Editor smoother drag / movement in chart editor playbarHead movement fixie --- .../ui/debug/charting/ChartEditorState.hx | 109 +++++------------- 1 file changed, 31 insertions(+), 78 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index c11f133429e..0358846934f 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -94,6 +94,7 @@ import funkin.ui.mainmenu.MainMenuState; import funkin.ui.transition.LoadingState; import funkin.util.Constants; import funkin.util.FileUtil; +import funkin.util.MathUtil; import funkin.util.logging.CrashHandler; import funkin.util.SortUtil; import funkin.util.WindowUtil; @@ -244,7 +245,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState /** * Duration, in seconds, for the scroll easing animation. */ - public static final SCROLL_EASE_DURATION:Float = 0.2; + public static final SCROLL_EASE_DURATION:Float = 0.4; // Other @@ -773,9 +774,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState /** * The current process that is lerping the scroll position. - * Used to cancel the previous lerp if the user scrolls again. */ - var currentScrollEase:Null; + var currentScrollEase:Null; /** * The position where the user middle clicked to place a scroll anchor. @@ -2707,6 +2707,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState playbarHeadLayout.playbarHead.width = FlxG.width; playbarHeadLayout.playbarHead.height = 10; playbarHeadLayout.playbarHead.styleString = 'padding-left: 0px; padding-right: 0px; border-left: 0px; border-right: 0px;'; + playbarHeadLayout.playbarHead.min = 0; playbarHeadLayout.playbarHead.onDragStart = function(_:DragEvent) { playbarHeadDragging = true; @@ -2723,13 +2724,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } } - playbarHeadLayout.playbarHead.onDrag = function(_:DragEvent) { + playbarHeadLayout.playbarHead.onDrag = function(d:DragEvent) { if (playbarHeadDragging) { - // Set the song position to where the playhead was moved to. - scrollPositionInPixels = (songLengthInPixels) * playbarHeadLayout.playbarHead.value / 100; // Update the conductor and audio tracks to match. - moveSongToScrollPosition(); + currentScrollEase = d.value; } } @@ -2740,6 +2739,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (playbarHeadDraggingWasPlaying) { playbarHeadDraggingWasPlaying = false; + // Disabled code to resume song playback on drag. // startAudioPlayback(); } @@ -3417,10 +3417,14 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState audioInstTrack.time = -Conductor.instance.instrumentalOffset; } } + + if (!audioInstTrack.isPlaying && currentScrollEase != scrollPositionInPixels) easeSongToScrollPosition(currentScrollEase); } if (audioInstTrack != null && audioInstTrack.isPlaying) { + currentScrollEase = scrollPositionInPixels; + if (FlxG.keys.pressed.ALT) { // If middle mouse panning during song playback, we move ONLY the playhead, without scrolling. Neat! @@ -4057,27 +4061,13 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState shouldPause = true; } - if (Math.abs(scrollAmount) > GRID_SIZE * 8) - { - shouldEase = true; - } + shouldEase = true; + if (shouldPause) stopAudioPlayback(); // Resync the conductor and audio tracks. - if (scrollAmount != 0 || playheadAmount != 0) - { - this.playheadPositionInPixels += playheadAmount; - if (shouldEase) - { - easeSongToScrollPosition(this.scrollPositionInPixels + scrollAmount); - } - else - { - // Apply the scroll amount. - this.scrollPositionInPixels += scrollAmount; - moveSongToScrollPosition(); - } - } - if (shouldPause) stopAudioPlayback(); + if (playheadAmount != 0) this.playheadPositionInPixels += playheadAmount; + + if (scrollAmount != 0) currentScrollEase += scrollAmount; } /** @@ -4333,15 +4323,13 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { // Scroll up. var diff:Float = MENU_BAR_HEIGHT - FlxG.mouse.viewY; - scrollPositionInPixels -= diff * 0.5; // Too fast! - moveSongToScrollPosition(); + currentScrollEase -= diff * 0.5; // Too fast! } else if (FlxG.mouse.viewY > (playbarHeadLayout?.y ?? 0.0)) { // Scroll down. var diff:Float = FlxG.mouse.viewY - (playbarHeadLayout?.y ?? 0.0); - scrollPositionInPixels += diff * 0.5; // Too fast! - moveSongToScrollPosition(); + currentScrollEase += (diff * 0.5); // Too fast! } // Render the selection box. @@ -4480,8 +4468,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var clickedPosInPixels:Float = FlxMath.remapToRange(FlxG.mouse.viewY, (notePreview?.y ?? 0.0), (notePreview?.y ?? 0.0) + (notePreview?.height ?? 0.0), 0, songLengthInPixels); - scrollPositionInPixels = clickedPosInPixels; - moveSongToScrollPosition(); + currentScrollEase = clickedPosInPixels; } else if (scrollAnchorScreenPos != null) { @@ -4540,15 +4527,13 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { // Scroll up. var diff:Float = MENU_BAR_HEIGHT - FlxG.mouse.viewY; - scrollPositionInPixels -= diff * 0.5; // Too fast! - moveSongToScrollPosition(); + currentScrollEase -= (diff * 0.5); } else if (FlxG.mouse.viewY > (playbarHeadLayout?.y ?? 0.0)) { // Scroll down. var diff:Float = FlxG.mouse.viewY - (playbarHeadLayout?.y ?? 0.0); - scrollPositionInPixels += diff * 0.5; // Too fast! - moveSongToScrollPosition(); + currentScrollEase += (diff * 0.5); } // Calculate distance between the position dragged to and the original position. @@ -5142,18 +5127,15 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { if (playbarHeadLayout == null) throw "ERROR: Tried to handle playbar, but playbarHeadLayout is null!"; + // Move the playhead to match the song position, if we aren't dragging it. + playbarHeadLayout.playbarHead.pos = currentScrollEase; + + playbarHeadLayout.playbarHead.max = songLengthInPixels; + // Make sure the playbar is never nudged out of the correct spot. playbarHeadLayout.x = 4; playbarHeadLayout.y = FlxG.height - 48 - 8; - // Move the playhead to match the song position, if we aren't dragging it. - if (!playbarHeadDragging) - { - var songPosPercent = scrollPositionInPixels / (songLengthInPixels) * 100; - - if (playbarHeadLayout.playbarHead.value != songPosPercent) playbarHeadLayout.playbarHead.value = songPosPercent; - } - var songPos:Float = Conductor.instance.songPosition + Conductor.instance.instrumentalOffset; var songPosMilliseconds:String = Std.string(Math.floor(Math.abs(songPos) % 1000)).lpad('0', 2).substr(0, 2); var songPosSeconds:String = Std.string(Math.floor((Math.abs(songPos) / 1000) % 60)).lpad('0', 2); @@ -6134,43 +6116,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ function easeSongToScrollPosition(targetScrollPosition:Float):Void { - if (currentScrollEase != null) cancelScrollEase(currentScrollEase); - - currentScrollEase = FlxTween.tween(this, {scrollPositionInPixels: targetScrollPosition}, SCROLL_EASE_DURATION, - { - ease: FlxEase.quintInOut, - onUpdate: this.onScrollEaseUpdate, - onComplete: this.cancelScrollEase, - type: ONESHOT - }); - } - - /** - * Callback function executed every frame that the scroll position is being eased. - * @param _ - */ - function onScrollEaseUpdate(_:FlxTween):Void - { + currentScrollEase = Math.max(0, targetScrollPosition); + currentScrollEase = Math.min(currentScrollEase, songLengthInPixels); + scrollPositionInPixels = MathUtil.smoothLerp(scrollPositionInPixels, currentScrollEase, FlxG.elapsed, SCROLL_EASE_DURATION, 1 / 1000); moveSongToScrollPosition(); } - /** - * Callback function executed when cancelling an existing scroll position ease. - * Ensures that the ease is immediately cancelled and the scroll position is set to the target value. - */ - function cancelScrollEase(_:FlxTween):Void - { - if (currentScrollEase != null) - { - @:privateAccess - var targetScrollPosition:Float = currentScrollEase._properties.scrollPositionInPixels; - - currentScrollEase.cancel(); - currentScrollEase = null; - this.scrollPositionInPixels = targetScrollPosition; - } - } - /** * Fix the current scroll position after exiting the PlayState used when testing. */ @@ -6351,6 +6302,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { if (audioInstTrack == null) return; + currentScrollEase = this.scrollPositionInPixels; + if (audioInstTrack.isPlaying) { // Pause From 76c8c8b520c137cfc658ea629cd269026a118552 Mon Sep 17 00:00:00 2001 From: Abnormal <86753001+AbnormalPoof@users.noreply.github.com> Date: Sat, 26 Oct 2024 19:58:12 +0000 Subject: [PATCH 6/9] docs: Fix a 'ludem' -> 'ludum' typo in `CHANGELOG.md` --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fb4f02d481..faf1e7560f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -382,7 +382,7 @@ which would remove their rank if they had a lower one. - Improvements to video cutscenes and dialogue, allowing them to be easily skipped or restarted. - Updated Polymod by several major versions, allowing for fully dynamic asset replacement and support for scripted classes. - Completely refactored almost every part of the game's code for performance, stability, and extensibility. - - This is not the Ludem Dare game held together with sticks and glue you played three years ago. + - This is not the Ludum Dare game held together with sticks and glue you played three years ago. - Characters, stages, songs, story levels, and dialogue are now built from JSON data registries rather than being hardcoded. - All of these also support attaching scripts for custom behavior, more documentation on this soon. - You can forcibly reload the game's JSON data and scripts by pressing F5. From 090ddd1f1c2aa48fdb83127b2235041643c99af5 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 25 Oct 2024 13:54:27 -0400 Subject: [PATCH 7/9] fix: fixes the initial camera position on the debug menu --- source/funkin/ui/debug/DebugMenuSubState.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/funkin/ui/debug/DebugMenuSubState.hx b/source/funkin/ui/debug/DebugMenuSubState.hx index 45652095b0a..73c24912e6a 100644 --- a/source/funkin/ui/debug/DebugMenuSubState.hx +++ b/source/funkin/ui/debug/DebugMenuSubState.hx @@ -67,6 +67,7 @@ class DebugMenuSubState extends MusicBeatSubState #if sys createItem("OPEN CRASH LOG FOLDER", openLogFolder); #end + onMenuChange(items.members[0]); FlxG.camera.focusOn(new FlxPoint(camFocusPoint.x, camFocusPoint.y + 500)); } From e6b6b41766deb2e8655a8c2ddac3265f10dd82ab Mon Sep 17 00:00:00 2001 From: Hyper_ <40342021+NotHyper-474@users.noreply.github.com> Date: Sat, 26 Oct 2024 17:03:42 -0300 Subject: [PATCH 8/9] revert: "[BUGFIX?] Reset CWD before Preloader" (#3538) --- source/funkin/ui/transition/preload/FunkinPreloader.hx | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/funkin/ui/transition/preload/FunkinPreloader.hx b/source/funkin/ui/transition/preload/FunkinPreloader.hx index 1b39a348271..e81bfbc4b7b 100644 --- a/source/funkin/ui/transition/preload/FunkinPreloader.hx +++ b/source/funkin/ui/transition/preload/FunkinPreloader.hx @@ -136,8 +136,6 @@ class FunkinPreloader extends FlxBasePreloader // We can't even call trace() yet, until Flixel loads. trace('Initializing custom preloader...'); - funkin.util.CLIUtil.resetWorkingDir(); - this.siteLockTitleText = Constants.SITE_LOCK_TITLE; this.siteLockBodyText = Constants.SITE_LOCK_DESC; } From e570dfb8e754f9cb29ac2d8fff6e8513bc68b630 Mon Sep 17 00:00:00 2001 From: Keoiki <55053690+Keoiki@users.noreply.github.com> Date: Sat, 26 Oct 2024 23:11:49 +0300 Subject: [PATCH 9/9] fix: Fix beat/step ticks sometimes not appearing on non-4/4 time signatures in chart editor (#2860) Beat and step ticks now appear fully on 5/4, 6/4 and 9/8 time signatures. --- .../handlers/ChartEditorThemeHandler.hx | 80 +++++++------------ 1 file changed, 27 insertions(+), 53 deletions(-) diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorThemeHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorThemeHandler.hx index e42102a529c..ac8985dc15d 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorThemeHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorThemeHandler.hx @@ -253,42 +253,23 @@ class ChartEditorThemeHandler var bottomTickY:Float = state.measureTickBitmap.height - (measureTickWidth / 2); state.measureTickBitmap.fillRect(new Rectangle(0, bottomTickY, state.measureTickBitmap.width, measureTickWidth / 2), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - // Draw the beat ticks. - var beatTick2Y:Float = state.measureTickBitmap.height * 1 / Conductor.instance.beatsPerMeasure - (beatTickWidth / 2); - var beatTick3Y:Float = state.measureTickBitmap.height * 2 / Conductor.instance.beatsPerMeasure - (beatTickWidth / 2); - var beatTick4Y:Float = state.measureTickBitmap.height * 3 / Conductor.instance.beatsPerMeasure - (beatTickWidth / 2); - var beatTickLength:Float = state.measureTickBitmap.width * 2 / 3; - state.measureTickBitmap.fillRect(new Rectangle(0, beatTick2Y, beatTickLength, beatTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, beatTick3Y, beatTickLength, beatTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, beatTick4Y, beatTickLength, beatTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - - // Draw the step ticks. - // TODO: Make this a loop or something. - var stepTick2Y:Float = state.measureTickBitmap.height * 1 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick3Y:Float = state.measureTickBitmap.height * 2 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick4Y:Float = state.measureTickBitmap.height * 3 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick6Y:Float = state.measureTickBitmap.height * 5 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick7Y:Float = state.measureTickBitmap.height * 6 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick8Y:Float = state.measureTickBitmap.height * 7 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick10Y:Float = state.measureTickBitmap.height * 9 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick11Y:Float = state.measureTickBitmap.height * 10 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick12Y:Float = state.measureTickBitmap.height * 11 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick14Y:Float = state.measureTickBitmap.height * 13 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick15Y:Float = state.measureTickBitmap.height * 14 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTick16Y:Float = state.measureTickBitmap.height * 15 / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); - var stepTickLength:Float = state.measureTickBitmap.width * 1 / 3; - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick2Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick3Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick4Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick6Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick7Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick8Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick10Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick11Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick12Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick14Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick15Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.measureTickBitmap.fillRect(new Rectangle(0, stepTick16Y, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); + // Draw the beat and step ticks. No need for two seperate loops thankfully. + // This'll be fun to update when beat tuplets become functional. + for (i in 1...(Conductor.instance.stepsPerMeasure)) + { + if ((i % Constants.STEPS_PER_BEAT) == 0) // If we're on a beat, draw a beat tick. + { + var beatTickY:Float = state.measureTickBitmap.height * i / Conductor.instance.stepsPerMeasure - (beatTickWidth / 2); + var beatTickLength:Float = state.measureTickBitmap.width * 2 / 3; + state.measureTickBitmap.fillRect(new Rectangle(0, beatTickY, beatTickLength, beatTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); + } + else // Else, draw a step tick. + { + var stepTickY:Float = state.measureTickBitmap.height * i / Conductor.instance.stepsPerMeasure - (stepTickWidth / 2); + var stepTickLength:Float = state.measureTickBitmap.width * 1 / 3; + state.measureTickBitmap.fillRect(new Rectangle(0, stepTickY, stepTickLength, stepTickWidth), GRID_MEASURE_DIVIDER_COLOR_LIGHT); + } + } } /** @@ -314,23 +295,16 @@ class ChartEditorThemeHandler state.offsetTickBitmap.fillRect(new Rectangle(rightTickX, 0, majorTickWidth / 2, majorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); // Draw the minor ticks. - var minorTick2X:Float = state.offsetTickBitmap.width * 1 / 10 - (minorTickWidth / 2); - var minorTick3X:Float = state.offsetTickBitmap.width * 2 / 10 - (minorTickWidth / 2); - var minorTick4X:Float = state.offsetTickBitmap.width * 3 / 10 - (minorTickWidth / 2); - var minorTick5X:Float = state.offsetTickBitmap.width * 4 / 10 - (minorTickWidth / 2); - var minorTick7X:Float = state.offsetTickBitmap.width * 6 / 10 - (minorTickWidth / 2); - var minorTick8X:Float = state.offsetTickBitmap.width * 7 / 10 - (minorTickWidth / 2); - var minorTick9X:Float = state.offsetTickBitmap.width * 8 / 10 - (minorTickWidth / 2); - var minorTick10X:Float = state.offsetTickBitmap.width * 9 / 10 - (minorTickWidth / 2); - var minorTickLength:Float = state.offsetTickBitmap.height * 1 / 3; - state.offsetTickBitmap.fillRect(new Rectangle(minorTick2X, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.offsetTickBitmap.fillRect(new Rectangle(minorTick3X, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.offsetTickBitmap.fillRect(new Rectangle(minorTick4X, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.offsetTickBitmap.fillRect(new Rectangle(minorTick5X, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.offsetTickBitmap.fillRect(new Rectangle(minorTick7X, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.offsetTickBitmap.fillRect(new Rectangle(minorTick8X, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.offsetTickBitmap.fillRect(new Rectangle(minorTick9X, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); - state.offsetTickBitmap.fillRect(new Rectangle(minorTick10X, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); + for (i in 1...11) + { + if (i % 5 == 0) + { + continue; + } + var minorTickX:Float = state.offsetTickBitmap.width * i / 10 - (minorTickWidth / 2); + var minorTickLength:Float = state.offsetTickBitmap.height * 1 / 3; + state.offsetTickBitmap.fillRect(new Rectangle(minorTickX, 0, minorTickWidth, minorTickLength), GRID_MEASURE_DIVIDER_COLOR_LIGHT); + } // Draw the offset ticks. // var ticksWidth:Int = Std.int(ChartEditorState.GRID_SIZE * TOTAL_COLUMN_COUNT); // 1 grid squares wide.