Skip to content

Commit 857a3d6

Browse files
StarexifyHundrec
authored andcommitted
Align x positions of Chart Editor waveforms to the center of the health icons
1 parent af35608 commit 857a3d6

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

source/funkin/ui/debug/charting/ChartEditorState.hx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,15 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
963963
var noteTooltipsDirty:Bool = true;
964964

965965
/**
966-
* Whether the selected charactesr have been modified and the health icons need to be updated.
966+
* Whether the selected characters have been modified and the health icons need to be updated.
967967
*/
968968
var healthIconsDirty:Bool = true;
969969

970+
/**
971+
* Whether the waveforms were modified and need to be updated.
972+
*/
973+
var waveformsDirty:Bool = false;
974+
970975
/**
971976
* Whether the note preview graphic needs to be FULLY rebuilt.
972977
*/
@@ -2702,6 +2707,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
27022707
healthIconBF.zIndex = 30;
27032708

27042709
add(audioWaveforms);
2710+
2711+
if (healthIconDad.frames == null || healthIconBF.frames == null) waveformsDirty = true;
27052712
}
27062713

27072714
function createSubtitles():Void
@@ -5770,7 +5777,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
57705777
{
57715778
buttonSelectOpponent.text = charDataDad?.name ?? 'Opponent';
57725779
}
5773-
healthIconsDirty = false;
5780+
5781+
healthIconsDirty = !waveformsDirty;
57745782
}
57755783

57765784
// Right align, and visibly center, the BF health icon.
@@ -5791,6 +5799,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
57915799
var yOffset = 30 - (healthIconDad.height / 2);
57925800
healthIconDad.y = (gridTiledSprite == null) ? (0) : (GRID_INITIAL_Y_POS - NOTE_SELECT_BUTTON_HEIGHT + 8) + yOffset;
57935801
}
5802+
5803+
if (healthIconsDirty && waveformsDirty) {
5804+
switchToCurrentInstrumental();
5805+
healthIconsDirty = waveformsDirty = false;
5806+
}
57945807
}
57955808

57965809
/**

source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import funkin.play.character.BaseCharacter.CharacterType;
88
import funkin.util.FileUtil;
99
import funkin.util.assets.SoundUtil;
1010
import funkin.audio.waveform.WaveformData;
11-
import funkin.audio.waveform.WaveformDataParser;
1211
import funkin.audio.waveform.WaveformSprite;
1312
import flixel.util.FlxColor;
1413
import haxe.io.Bytes;
@@ -201,7 +200,7 @@ class ChartEditorAudioHandler
201200
{
202201
var duration:Float = Conductor.instance.getStepTimeInMs(16) * 0.001;
203202
var waveformSprite:WaveformSprite = new WaveformSprite(waveformData, VERTICAL, FlxColor.WHITE);
204-
waveformSprite.x = 840;
203+
waveformSprite.x = state.healthIconBF != null ? state.healthIconBF.x : 840 + FullScreenScaleMode.gameCutoutSize.x * 0.5;
205204
waveformSprite.y = Math.max(state.gridTiledSprite?.y ?? 0.0, ChartEditorState.GRID_INITIAL_Y_POS - ChartEditorState.GRID_TOP_PAD);
206205
waveformSprite.height = (ChartEditorState.GRID_SIZE) * 16;
207206
waveformSprite.width = (ChartEditorState.GRID_SIZE) * 2;
@@ -225,7 +224,7 @@ class ChartEditorAudioHandler
225224
{
226225
var duration:Float = Conductor.instance.getStepTimeInMs(16) * 0.001;
227226
var waveformSprite:WaveformSprite = new WaveformSprite(waveformData, VERTICAL, FlxColor.WHITE);
228-
waveformSprite.x = 360;
227+
waveformSprite.x = state.healthIconDad != null ? state.healthIconDad.x : 360 + FullScreenScaleMode.gameCutoutSize.x * 0.5;
229228
waveformSprite.y = Math.max(state.gridTiledSprite?.y ?? 0.0, ChartEditorState.GRID_INITIAL_Y_POS - ChartEditorState.GRID_TOP_PAD);
230229
waveformSprite.height = (ChartEditorState.GRID_SIZE) * 16;
231230
waveformSprite.width = (ChartEditorState.GRID_SIZE) * 2;

0 commit comments

Comments
 (0)