1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 23:46:45 +00:00

Merge branch 'rewrite/master' into bugfix/pico-death-anim-fix

This commit is contained in:
Cameron Taylor 2024-01-18 00:57:25 -05:00
commit 2fa5b1a9db
2 changed files with 103 additions and 16 deletions

View file

@ -105,6 +105,7 @@ import haxe.ui.components.Label;
import haxe.ui.components.Button;
import haxe.ui.components.NumberStepper;
import haxe.ui.components.Slider;
import haxe.ui.components.VerticalSlider;
import haxe.ui.components.TextField;
import haxe.ui.containers.dialogs.CollapsibleDialog;
import haxe.ui.containers.Frame;
@ -721,6 +722,34 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return hitsoundsEnabledPlayer || hitsoundsEnabledOpponent;
}
/**
* Sound multiplier for vocals and hitsounds on the player's side.
*/
var soundMultiplierPlayer(default, set):Float = 1.0;
function set_soundMultiplierPlayer(value:Float):Float
{
soundMultiplierPlayer = value;
var vocalTargetVolume:Float = (menubarItemVolumeVocals.value ?? 100.0) / 100.0;
if (audioVocalTrackGroup != null) audioVocalTrackGroup.playerVolume = vocalTargetVolume * soundMultiplierPlayer;
return soundMultiplierPlayer;
}
/**
* Sound multiplier for vocals and hitsounds on the opponent's side.
*/
var soundMultiplierOpponent(default, set):Float = 1.0;
function set_soundMultiplierOpponent(value:Float):Float
{
soundMultiplierOpponent = value;
var vocalTargetVolume:Float = (menubarItemVolumeVocals.value ?? 100.0) / 100.0;
if (audioVocalTrackGroup != null) audioVocalTrackGroup.opponentVolume = vocalTargetVolume * soundMultiplierOpponent;
return soundMultiplierOpponent;
}
// Auto-save
/**
@ -1750,6 +1779,18 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
*/
var buttonSelectEvent:Button;
/**
* The slider above the grid that sets the volume of the player's sounds.
* Constructed manually and added to the layout so we can control its position.
*/
var sliderVolumePlayer:Slider;
/**
* The slider above the grid that sets the volume of the opponent's sounds.
* Constructed manually and added to the layout so we can control its position.
*/
var sliderVolumeOpponent:Slider;
/**
* RENDER OBJECTS
*/
@ -1959,7 +2000,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
buildGrid();
buildMeasureTicks();
buildNotePreview();
buildSelectionBox();
buildAdditionalUI();
populateOpenRecentMenu();
@ -2288,17 +2328,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
setNotePreviewViewportBounds(calculateNotePreviewViewportBounds());
}
function buildSelectionBox():Void
{
if (selectionBoxSprite == null) throw 'ERROR: Tried to build selection box, but selectionBoxSprite is null! Check ChartEditorThemeHandler.updateTheme().';
selectionBoxSprite.scrollFactor.set(0, 0);
add(selectionBoxSprite);
selectionBoxSprite.zIndex = 30;
setSelectionBoxBounds();
}
function setSelectionBoxBounds(bounds:FlxRect = null):Void
{
if (selectionBoxSprite == null)
@ -2320,6 +2349,19 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
}
}
/**
* Automatically goes through and calls render on everything you added.
*/
override public function draw():Void
{
if (selectionBoxStartPos != null)
{
trace('selectionBoxSprite: ${selectionBoxSprite.visible} ${selectionBoxSprite.exists} ${this.members.contains(selectionBoxSprite)}');
}
super.draw();
}
function calculateNotePreviewViewportBounds():FlxRect
{
var bounds:FlxRect = new FlxRect();
@ -2558,6 +2600,37 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
performCommand(new SetItemSelectionCommand([], currentSongChartEventData));
}
}
function setupSideSlider(x, y):VerticalSlider
{
var slider = new VerticalSlider();
slider.allowFocus = false;
slider.x = x;
slider.y = y;
slider.width = NOTE_SELECT_BUTTON_HEIGHT;
slider.height = GRID_SIZE * 4;
slider.pos = slider.max;
slider.tooltip = "Slide to set the volume of sounds on this side.";
slider.zIndex = 110;
slider.styleNames = "sideSlider";
add(slider);
return slider;
}
var sliderY = GRID_INITIAL_Y_POS + 34;
sliderVolumeOpponent = setupSideSlider(GRID_X_POS - 64, sliderY);
sliderVolumePlayer = setupSideSlider(buttonSelectEvent.x + buttonSelectEvent.width, sliderY);
sliderVolumePlayer.onChange = event -> {
var volume:Float = event.value.toFloat() / 100.0;
soundMultiplierPlayer = volume;
}
sliderVolumeOpponent.onChange = event -> {
var volume:Float = event.value.toFloat() / 100.0;
soundMultiplierOpponent = volume;
}
}
/**
@ -2798,7 +2871,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
menubarItemVolumeVocals.onChange = event -> {
var volume:Float = event.value.toFloat() / 100.0;
if (audioVocalTrackGroup != null) audioVocalTrackGroup.volume = volume;
if (audioVocalTrackGroup != null)
{
audioVocalTrackGroup.playerVolume = volume * soundMultiplierPlayer;
audioVocalTrackGroup.opponentVolume = volume * soundMultiplierOpponent;
}
menubarLabelVolumeVocals.text = 'Voices - ${Std.int(event.value)}%';
}
@ -5663,7 +5740,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
audioInstTrack.volume = instTargetVolume;
audioInstTrack.onComplete = null;
}
if (audioVocalTrackGroup != null) audioVocalTrackGroup.volume = vocalTargetVolume;
if (audioVocalTrackGroup != null)
{
audioVocalTrackGroup.playerVolume = vocalTargetVolume * soundMultiplierPlayer;
audioVocalTrackGroup.opponentVolume = vocalTargetVolume * soundMultiplierOpponent;
}
}
function updateTimeSignature():Void
@ -5865,9 +5946,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
switch (noteData.getStrumlineIndex())
{
case 0: // Player
if (hitsoundsEnabledPlayer) this.playSound(Paths.sound('chartingSounds/hitNotePlayer'), hitsoundVolume);
if (hitsoundsEnabledPlayer) this.playSound(Paths.sound('chartingSounds/hitNotePlayer'), hitsoundVolume * soundMultiplierPlayer);
case 1: // Opponent
if (hitsoundsEnabledOpponent) this.playSound(Paths.sound('chartingSounds/hitNoteOpponent'), hitsoundVolume);
if (hitsoundsEnabledOpponent) this.playSound(Paths.sound('chartingSounds/hitNoteOpponent'), hitsoundVolume * soundMultiplierOpponent);
}
}
}

View file

@ -317,6 +317,12 @@ class ChartEditorThemeHandler
ChartEditorState.GRID_SIZE
- (2 * SELECTION_SQUARE_BORDER_WIDTH + 8)),
32, 32);
state.selectionBoxSprite.scrollFactor.set(0, 0);
state.selectionBoxSprite.zIndex = 30;
state.add(state.selectionBoxSprite);
state.setSelectionBoxBounds();
}
static function updateNotePreview(state:ChartEditorState):Void