mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-22 18:09:33 +00:00
Add theme music toggle and extend fade in
This commit is contained in:
parent
761940b5c0
commit
9fe0c68256
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit f1e42601b6ea2026c6e2f4627c5738bfb8b7b524
|
Subproject commit 9d305889f2e310afeddcda6a4be775eb630fb9ac
|
|
@ -14,8 +14,8 @@ import thx.semver.Version;
|
||||||
@:forward(volume, mute)
|
@:forward(volume, mute)
|
||||||
abstract Save(RawSaveData)
|
abstract Save(RawSaveData)
|
||||||
{
|
{
|
||||||
// Version 2.0.1 adds attributes to `optionsChartEditor`, that should return default values if they are null.
|
// Version 2.0.2 adds attributes to `optionsChartEditor`, that should return default values if they are null.
|
||||||
public static final SAVE_DATA_VERSION:thx.semver.Version = "2.0.1";
|
public static final SAVE_DATA_VERSION:thx.semver.Version = "2.0.2";
|
||||||
public static final SAVE_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x";
|
public static final SAVE_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x";
|
||||||
|
|
||||||
// We load this version's saves from a new save path, to maintain SOME level of backwards compatibility.
|
// We load this version's saves from a new save path, to maintain SOME level of backwards compatibility.
|
||||||
|
@ -108,6 +108,7 @@ abstract Save(RawSaveData)
|
||||||
metronomeVolume: 1.0,
|
metronomeVolume: 1.0,
|
||||||
hitsoundsEnabledPlayer: true,
|
hitsoundsEnabledPlayer: true,
|
||||||
hitsoundsEnabledOpponent: true,
|
hitsoundsEnabledOpponent: true,
|
||||||
|
themeMusic: true,
|
||||||
instVolume: 1.0,
|
instVolume: 1.0,
|
||||||
voicesVolume: 1.0,
|
voicesVolume: 1.0,
|
||||||
playbackSpeed: 1.0,
|
playbackSpeed: 1.0,
|
||||||
|
@ -347,6 +348,23 @@ abstract Save(RawSaveData)
|
||||||
return this.optionsChartEditor.hitsoundsEnabledOpponent;
|
return this.optionsChartEditor.hitsoundsEnabledOpponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var chartEditorThemeMusic(get, set):Bool;
|
||||||
|
|
||||||
|
function get_chartEditorThemeMusic():Bool
|
||||||
|
{
|
||||||
|
if (this.optionsChartEditor.themeMusic == null) this.optionsChartEditor.themeMusic = true;
|
||||||
|
|
||||||
|
return this.optionsChartEditor.themeMusic;
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_chartEditorThemeMusic(value:Bool):Bool
|
||||||
|
{
|
||||||
|
// Set and apply.
|
||||||
|
this.optionsChartEditor.themeMusic = value;
|
||||||
|
flush();
|
||||||
|
return this.optionsChartEditor.themeMusic;
|
||||||
|
}
|
||||||
|
|
||||||
public var chartEditorInstVolume(get, set):Float;
|
public var chartEditorInstVolume(get, set):Float;
|
||||||
|
|
||||||
function get_chartEditorInstVolume():Float
|
function get_chartEditorInstVolume():Float
|
||||||
|
@ -1027,6 +1045,12 @@ typedef SaveDataChartEditorOptions =
|
||||||
*/
|
*/
|
||||||
var ?hitsoundsEnabledOpponent:Bool;
|
var ?hitsoundsEnabledOpponent:Bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Theme music in the Chart Editor.
|
||||||
|
* @default `true`
|
||||||
|
*/
|
||||||
|
var ?themeMusic:Bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instrumental volume in the Chart Editor.
|
* Instrumental volume in the Chart Editor.
|
||||||
* @default `1.0`
|
* @default `1.0`
|
||||||
|
|
|
@ -272,6 +272,16 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
*/
|
*/
|
||||||
public static final BASE_QUANT_INDEX:Int = 3;
|
public static final BASE_QUANT_INDEX:Int = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The duration before the welcome music starts to fade back in after the user stops playing music in the chart editor.
|
||||||
|
*/
|
||||||
|
public static final WELCOME_MUSIC_FADE_IN_DELAY:Float = 30.0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The duration of the welcome music fade in.
|
||||||
|
*/
|
||||||
|
public static final WELCOME_MUSIC_FADE_IN_DURATION:Float = 10.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INSTANCE DATA
|
* INSTANCE DATA
|
||||||
*/
|
*/
|
||||||
|
@ -1636,6 +1646,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
*/
|
*/
|
||||||
var menubarItemOpponentHitsounds:MenuCheckBox;
|
var menubarItemOpponentHitsounds:MenuCheckBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `Audio -> Play Theme Music` menu checkbox.
|
||||||
|
*/
|
||||||
|
var menubarItemThemeMusic:MenuCheckBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `Audio -> Hitsound Volume` label.
|
* The `Audio -> Hitsound Volume` label.
|
||||||
*/
|
*/
|
||||||
|
@ -1921,6 +1936,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
// Set the z-index of the HaxeUI.
|
// Set the z-index of the HaxeUI.
|
||||||
this.root.zIndex = 100;
|
this.root.zIndex = 100;
|
||||||
|
|
||||||
|
// Get rid of any music from the previous state.
|
||||||
|
if (FlxG.sound.music != null) FlxG.sound.music.stop();
|
||||||
|
|
||||||
|
// Play the welcome music.
|
||||||
|
setupWelcomeMusic();
|
||||||
|
|
||||||
// Show the mouse cursor.
|
// Show the mouse cursor.
|
||||||
Cursor.show();
|
Cursor.show();
|
||||||
|
|
||||||
|
@ -1928,12 +1949,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
|
|
||||||
fixCamera();
|
fixCamera();
|
||||||
|
|
||||||
// Get rid of any music from the previous state.
|
|
||||||
if (FlxG.sound.music != null) FlxG.sound.music.stop();
|
|
||||||
|
|
||||||
// Play the welcome music.
|
|
||||||
setupWelcomeMusic();
|
|
||||||
|
|
||||||
buildDefaultSongData();
|
buildDefaultSongData();
|
||||||
|
|
||||||
buildBackground();
|
buildBackground();
|
||||||
|
@ -2027,6 +2042,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
hitsoundVolume = save.chartEditorHitsoundVolume;
|
hitsoundVolume = save.chartEditorHitsoundVolume;
|
||||||
hitsoundsEnabledPlayer = save.chartEditorHitsoundsEnabledPlayer;
|
hitsoundsEnabledPlayer = save.chartEditorHitsoundsEnabledPlayer;
|
||||||
hitsoundsEnabledOpponent = save.chartEditorHitsoundsEnabledOpponent;
|
hitsoundsEnabledOpponent = save.chartEditorHitsoundsEnabledOpponent;
|
||||||
|
this.welcomeMusic.active = save.chartEditorThemeMusic;
|
||||||
|
|
||||||
// audioInstTrack.volume = save.chartEditorInstVolume;
|
// audioInstTrack.volume = save.chartEditorInstVolume;
|
||||||
// audioInstTrack.pitch = save.chartEditorPlaybackSpeed;
|
// audioInstTrack.pitch = save.chartEditorPlaybackSpeed;
|
||||||
|
@ -2056,6 +2072,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
save.chartEditorHitsoundVolume = hitsoundVolume;
|
save.chartEditorHitsoundVolume = hitsoundVolume;
|
||||||
save.chartEditorHitsoundsEnabledPlayer = hitsoundsEnabledPlayer;
|
save.chartEditorHitsoundsEnabledPlayer = hitsoundsEnabledPlayer;
|
||||||
save.chartEditorHitsoundsEnabledOpponent = hitsoundsEnabledOpponent;
|
save.chartEditorHitsoundsEnabledOpponent = hitsoundsEnabledOpponent;
|
||||||
|
save.chartEditorThemeMusic = this.welcomeMusic.active;
|
||||||
|
|
||||||
// save.chartEditorInstVolume = audioInstTrack.volume;
|
// save.chartEditorInstVolume = audioInstTrack.volume;
|
||||||
// save.chartEditorVoicesVolume = audioVocalTrackGroup.volume;
|
// save.chartEditorVoicesVolume = audioVocalTrackGroup.volume;
|
||||||
|
@ -2116,10 +2133,19 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
|
|
||||||
function fadeInWelcomeMusic(?extraWait:Float = 0, ?fadeInTime:Float = 5):Void
|
function fadeInWelcomeMusic(?extraWait:Float = 0, ?fadeInTime:Float = 5):Void
|
||||||
{
|
{
|
||||||
|
if (!this.welcomeMusic.active)
|
||||||
|
{
|
||||||
|
stopWelcomeMusic();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bgMusicTimer = new FlxTimer().start(extraWait, (_) -> {
|
bgMusicTimer = new FlxTimer().start(extraWait, (_) -> {
|
||||||
this.welcomeMusic.volume = 0;
|
this.welcomeMusic.volume = 0;
|
||||||
this.welcomeMusic.play();
|
if (this.welcomeMusic.active)
|
||||||
this.welcomeMusic.fadeIn(fadeInTime, 0, 1.0);
|
{
|
||||||
|
this.welcomeMusic.play();
|
||||||
|
this.welcomeMusic.fadeIn(fadeInTime, 0, 1.0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2750,6 +2776,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
menubarItemOpponentHitsounds.onChange = event -> hitsoundsEnabledOpponent = event.value;
|
menubarItemOpponentHitsounds.onChange = event -> hitsoundsEnabledOpponent = event.value;
|
||||||
menubarItemOpponentHitsounds.selected = hitsoundsEnabledOpponent;
|
menubarItemOpponentHitsounds.selected = hitsoundsEnabledOpponent;
|
||||||
|
|
||||||
|
menubarItemThemeMusic.onChange = event -> {
|
||||||
|
this.welcomeMusic.active = event.value;
|
||||||
|
fadeInWelcomeMusic(WELCOME_MUSIC_FADE_IN_DELAY, WELCOME_MUSIC_FADE_IN_DURATION);
|
||||||
|
};
|
||||||
|
menubarItemThemeMusic.selected = this.welcomeMusic.active;
|
||||||
|
|
||||||
menubarItemVolumeHitsound.onChange = event -> {
|
menubarItemVolumeHitsound.onChange = event -> {
|
||||||
var volume:Float = event.value.toFloat() / 100.0;
|
var volume:Float = event.value.toFloat() / 100.0;
|
||||||
hitsoundVolume = volume;
|
hitsoundVolume = volume;
|
||||||
|
@ -5619,7 +5651,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
|
|
||||||
moveSongToScrollPosition();
|
moveSongToScrollPosition();
|
||||||
|
|
||||||
fadeInWelcomeMusic(7, 10);
|
fadeInWelcomeMusic(WELCOME_MUSIC_FADE_IN_DELAY, WELCOME_MUSIC_FADE_IN_DURATION);
|
||||||
|
|
||||||
// Reapply the volume.
|
// Reapply the volume.
|
||||||
var instTargetVolume:Float = menubarItemVolumeInstrumental.value ?? 1.0;
|
var instTargetVolume:Float = menubarItemVolumeInstrumental.value ?? 1.0;
|
||||||
|
@ -5855,7 +5887,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
{
|
{
|
||||||
// Pause
|
// Pause
|
||||||
stopAudioPlayback();
|
stopAudioPlayback();
|
||||||
fadeInWelcomeMusic(7, 10);
|
fadeInWelcomeMusic(WELCOME_MUSIC_FADE_IN_DELAY, WELCOME_MUSIC_FADE_IN_DURATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue