Merge remote-tracking branch 'origin/rewrite/master' into feature/2hot-death-animation

This commit is contained in:
EliteMasterEric 2024-02-20 18:44:51 -05:00
commit 36c0c61946
8 changed files with 107 additions and 115 deletions

2
assets

@ -1 +1 @@
Subproject commit 573ccf59f3ab5d2333d395810ef82195e8456467
Subproject commit 03f544a7b42fed43c521cb596e487ad4ae129576

View file

@ -8,6 +8,9 @@ import flash.display.Sprite;
import flixel.system.FlxBasePreloader;
import openfl.display.Sprite;
import funkin.util.CLIUtil;
import openfl.text.TextField;
import openfl.text.TextFormat;
import flixel.system.FlxAssets;
@:bitmap("art/preloaderArt.png") class LogoImage extends BitmapData {}
@ -21,12 +24,26 @@ class Preloader extends FlxBasePreloader
}
var logo:Sprite;
var _text:TextField;
override function create():Void
{
this._width = Lib.current.stage.stageWidth;
this._height = Lib.current.stage.stageHeight;
_text = new TextField();
_text.width = 500;
_text.text = "Loading FNF";
_text.defaultTextFormat = new TextFormat(FlxAssets.FONT_DEFAULT, 16, 0xFFFFFFFF);
_text.embedFonts = true;
_text.selectable = false;
_text.multiline = false;
_text.wordWrap = false;
_text.autoSize = LEFT;
_text.x = 2;
_text.y = 2;
addChild(_text);
var ratio:Float = this._width / 2560; // This allows us to scale assets depending on the size of the screen.
logo = new Sprite();
@ -34,27 +51,14 @@ class Preloader extends FlxBasePreloader
logo.scaleX = logo.scaleY = ratio;
logo.x = ((this._width) / 2) - ((logo.width) / 2);
logo.y = (this._height / 2) - ((logo.height) / 2);
addChild(logo); // Adds the graphic to the NMEPreloader's buffer.
// addChild(logo); // Adds the graphic to the NMEPreloader's buffer.
super.create();
}
override function update(Percent:Float):Void
{
if (Percent < 69)
{
logo.scaleX += Percent / 1920;
logo.scaleY += Percent / 1920;
logo.x -= Percent * 0.6;
logo.y -= Percent / 2;
}
else
{
logo.scaleX = this._width / 1280;
logo.scaleY = this._width / 1280;
logo.x = ((this._width) / 2) - ((logo.width) / 2);
logo.y = (this._height / 2) - ((logo.height) / 2);
}
_text.text = "FNF: " + Math.round(Percent * 100) + "%";
super.update(Percent);
}

View file

@ -106,8 +106,8 @@ abstract Save(RawSaveData)
playtestStartTime: false,
downscroll: false,
metronomeVolume: 1.0,
hitsoundsEnabledPlayer: true,
hitsoundsEnabledOpponent: true,
hitsoundVolumePlayer: 1.0,
hitsoundVolumeOpponent: 1.0,
themeMusic: true
},
};
@ -300,55 +300,38 @@ abstract Save(RawSaveData)
return this.optionsChartEditor.metronomeVolume;
}
public var chartEditorHitsoundVolume(get, set):Float;
public var chartEditorHitsoundVolumePlayer(get, set):Float;
function get_chartEditorHitsoundVolume():Float
function get_chartEditorHitsoundVolumePlayer():Float
{
if (this.optionsChartEditor.hitsoundVolume == null) this.optionsChartEditor.hitsoundVolume = 1.0;
if (this.optionsChartEditor.hitsoundVolumePlayer == null) this.optionsChartEditor.hitsoundVolumePlayer = 1.0;
return this.optionsChartEditor.hitsoundVolume;
return this.optionsChartEditor.hitsoundVolumePlayer;
}
function set_chartEditorHitsoundVolume(value:Float):Float
function set_chartEditorHitsoundVolumePlayer(value:Float):Float
{
// Set and apply.
this.optionsChartEditor.hitsoundVolume = value;
this.optionsChartEditor.hitsoundVolumePlayer = value;
flush();
return this.optionsChartEditor.hitsoundVolume;
return this.optionsChartEditor.hitsoundVolumePlayer;
}
public var chartEditorHitsoundsEnabledPlayer(get, set):Bool;
public var chartEditorHitsoundVolumeOpponent(get, set):Float;
function get_chartEditorHitsoundsEnabledPlayer():Bool
function get_chartEditorHitsoundVolumeOpponent():Float
{
if (this.optionsChartEditor.hitsoundsEnabledPlayer == null) this.optionsChartEditor.hitsoundsEnabledPlayer = true;
if (this.optionsChartEditor.hitsoundVolumeOpponent == null) this.optionsChartEditor.hitsoundVolumeOpponent = 1.0;
return this.optionsChartEditor.hitsoundsEnabledPlayer;
return this.optionsChartEditor.hitsoundVolumeOpponent;
}
function set_chartEditorHitsoundsEnabledPlayer(value:Bool):Bool
function set_chartEditorHitsoundVolumeOpponent(value:Float):Float
{
// Set and apply.
this.optionsChartEditor.hitsoundsEnabledPlayer = value;
this.optionsChartEditor.hitsoundVolumeOpponent = value;
flush();
return this.optionsChartEditor.hitsoundsEnabledPlayer;
}
public var chartEditorHitsoundsEnabledOpponent(get, set):Bool;
function get_chartEditorHitsoundsEnabledOpponent():Bool
{
if (this.optionsChartEditor.hitsoundsEnabledOpponent == null) this.optionsChartEditor.hitsoundsEnabledOpponent = true;
return this.optionsChartEditor.hitsoundsEnabledOpponent;
}
function set_chartEditorHitsoundsEnabledOpponent(value:Bool):Bool
{
// Set and apply.
this.optionsChartEditor.hitsoundsEnabledOpponent = value;
flush();
return this.optionsChartEditor.hitsoundsEnabledOpponent;
return this.optionsChartEditor.hitsoundVolumeOpponent;
}
public var chartEditorThemeMusic(get, set):Bool;
@ -990,10 +973,16 @@ typedef SaveDataChartEditorOptions =
var ?metronomeVolume:Float;
/**
* Hitsound volume in the Chart Editor.
* Hitsound volume (player) in the Chart Editor.
* @default `1.0`
*/
var ?hitsoundVolume:Float;
var ?hitsoundVolumePlayer:Float;
/**
* Hitsound volume (opponent) in the Chart Editor.
* @default `1.0`
*/
var ?hitsoundVolumeOpponent:Float;
/**
* If true, playtest songs from the current position in the Chart Editor.
@ -1001,18 +990,6 @@ typedef SaveDataChartEditorOptions =
*/
var ?playtestStartTime:Bool;
/**
* Player note hit sounds in the Chart Editor.
* @default `true`
*/
var ?hitsoundsEnabledPlayer:Bool;
/**
* Opponent note hit sounds in the Chart Editor.
* @default `true`
*/
var ?hitsoundsEnabledOpponent:Bool;
/**
* Theme music in the Chart Editor.
* @default `true`

View file

@ -310,10 +310,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
{
this.songLengthInMs = value;
// Make sure playhead doesn't go outside the song.
if (playheadPositionInMs > songLengthInMs) playheadPositionInMs = songLengthInMs;
onSongLengthChanged();
updateGridHeight();
return this.songLengthInMs;
}
@ -704,19 +701,14 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
var metronomeVolume:Float = 1.0;
/**
* The volume to play hitsounds at.
* The volume to play the player's hitsounds at.
*/
var hitsoundVolume:Float = 1.0;
var hitsoundVolumePlayer:Float = 1.0;
/**
* Whether hitsounds are enabled for the player.
* The volume to play the opponent's hitsounds at.
*/
var hitsoundsEnabledPlayer:Bool = true;
/**
* Whether hitsounds are enabled for the opponent.
*/
var hitsoundsEnabledOpponent:Bool = true;
var hitsoundVolumeOpponent:Float = 1.0;
/**
* Whether hitsounds are enabled for at least one character.
@ -725,7 +717,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
function get_hitsoundsEnabled():Bool
{
return hitsoundsEnabledPlayer || hitsoundsEnabledOpponent;
return hitsoundVolumePlayer + hitsoundVolumeOpponent > 0;
}
// Auto-save
@ -1757,30 +1749,30 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
*/
var menubarItemVolumeMetronome:Slider;
/**
* The `Audio -> Enable Player Hitsounds` menu checkbox.
*/
var menubarItemPlayerHitsounds:MenuCheckBox;
/**
* The `Audio -> Enable Opponent Hitsounds` menu checkbox.
*/
var menubarItemOpponentHitsounds:MenuCheckBox;
/**
* The `Audio -> Play Theme Music` menu checkbox.
*/
var menubarItemThemeMusic:MenuCheckBox;
/**
* The `Audio -> Hitsound Volume` label.
* The `Audio -> Player Hitsound Volume` label.
*/
var menubarLabelVolumeHitsounds:Label;
var menubarLabelVolumeHitsoundPlayer:Label;
/**
* The `Audio -> Hitsound Volume` slider.
* The `Audio -> Enemy Hitsound Volume` label.
*/
var menubarItemVolumeHitsounds:Slider;
var menubarLabelVolumeHitsoundOpponent:Label;
/**
* The `Audio -> Player Hitsound Volume` slider.
*/
var menubarItemVolumeHitsoundPlayer:Slider;
/**
* The `Audio -> Enemy Hitsound Volume` slider.
*/
var menubarItemVolumeHitsoundOpponent:Slider;
/**
* The `Audio -> Instrumental Volume` label.
@ -2187,9 +2179,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
playtestStartTime = save.chartEditorPlaytestStartTime;
currentTheme = save.chartEditorTheme;
metronomeVolume = save.chartEditorMetronomeVolume;
hitsoundVolume = save.chartEditorHitsoundVolume;
hitsoundsEnabledPlayer = save.chartEditorHitsoundsEnabledPlayer;
hitsoundsEnabledOpponent = save.chartEditorHitsoundsEnabledOpponent;
hitsoundVolumePlayer = save.chartEditorHitsoundVolumePlayer;
hitsoundVolumePlayer = save.chartEditorHitsoundVolumeOpponent;
this.welcomeMusic.active = save.chartEditorThemeMusic;
// audioInstTrack.volume = save.chartEditorInstVolume;
@ -2217,9 +2208,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
save.chartEditorPlaytestStartTime = playtestStartTime;
save.chartEditorTheme = currentTheme;
save.chartEditorMetronomeVolume = metronomeVolume;
save.chartEditorHitsoundVolume = hitsoundVolume;
save.chartEditorHitsoundsEnabledPlayer = hitsoundsEnabledPlayer;
save.chartEditorHitsoundsEnabledOpponent = hitsoundsEnabledOpponent;
save.chartEditorHitsoundVolumePlayer = hitsoundVolumePlayer;
save.chartEditorHitsoundVolumeOpponent = hitsoundVolumeOpponent;
save.chartEditorThemeMusic = this.welcomeMusic.active;
// save.chartEditorInstVolume = audioInstTrack.volume;
@ -2912,24 +2902,25 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
};
menubarItemVolumeMetronome.value = Std.int(metronomeVolume * 100);
menubarItemPlayerHitsounds.onChange = event -> hitsoundsEnabledPlayer = event.value;
menubarItemPlayerHitsounds.selected = hitsoundsEnabledPlayer;
menubarItemOpponentHitsounds.onChange = event -> hitsoundsEnabledOpponent = event.value;
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 -> {
menubarItemVolumeHitsoundPlayer.onChange = event -> {
var volume:Float = event.value.toFloat() / 100.0;
hitsoundVolume = volume;
menubarLabelVolumeHitsound.text = 'Hitsound - ${Std.int(event.value)}%';
hitsoundVolumePlayer = volume;
menubarLabelVolumeHitsoundPlayer.text = 'Player - ${Std.int(event.value)}%';
};
menubarItemVolumeHitsound.value = Std.int(hitsoundVolume * 100);
menubarItemVolumeHitsoundPlayer.value = Std.int(hitsoundVolumePlayer * 100);
menubarItemVolumeHitsoundOpponent.onChange = event -> {
var volume:Float = event.value.toFloat() / 100.0;
hitsoundVolumeOpponent = volume;
menubarLabelVolumeHitsoundOpponent.text = 'Enemy - ${Std.int(event.value)}%';
};
menubarItemVolumeHitsoundOpponent.value = Std.int(hitsoundVolumeOpponent * 100);
menubarItemVolumeInstrumental.onChange = event -> {
var volume:Float = event.value.toFloat() / 100.0;
@ -5511,8 +5502,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
this.switchToInstrumental(currentInstrumentalId, currentSongMetadata.playData.characters.player, currentSongMetadata.playData.characters.opponent);
}
function onSongLengthChanged():Void
public function updateGridHeight():Void
{
// Make sure playhead doesn't go outside the song after we update the grid height.
if (playheadPositionInMs > songLengthInMs) playheadPositionInMs = songLengthInMs;
if (gridTiledSprite != null)
{
gridTiledSprite.height = songLengthInPixels;
@ -5939,9 +5933,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 (hitsoundVolumePlayer > 0) this.playSound(Paths.sound('chartingSounds/hitNotePlayer'), hitsoundVolumePlayer);
case 1: // Opponent
if (hitsoundsEnabledOpponent) this.playSound(Paths.sound('chartingSounds/hitNoteOpponent'), hitsoundVolume);
if (hitsoundVolumeOpponent > 0) this.playSound(Paths.sound('chartingSounds/hitNoteOpponent'), hitsoundVolumeOpponent);
}
}
}

View file

@ -40,6 +40,8 @@ class ChangeStartingBPMCommand implements ChartEditorCommand
state.scrollPositionInPixels = 0;
Conductor.instance.mapTimeChanges(state.currentSongMetadata.timeChanges);
state.updateGridHeight();
}
public function undo(state:ChartEditorState):Void
@ -62,6 +64,8 @@ class ChangeStartingBPMCommand implements ChartEditorCommand
state.scrollPositionInPixels = 0;
Conductor.instance.mapTimeChanges(state.currentSongMetadata.timeChanges);
state.updateGridHeight();
}
public function shouldAddToHistory(state:ChartEditorState):Bool

View file

@ -58,9 +58,15 @@ class ChartEditorMeasureTicks extends FlxTypedSpriteGroup<FlxSprite>
var measureNumberInViewport = Math.floor(viewTopPosition / ChartEditorState.GRID_SIZE / Conductor.instance.stepsPerMeasure) + 1;
var measureNumberPosition = measureNumberInViewport * ChartEditorState.GRID_SIZE * Conductor.instance.stepsPerMeasure;
measureNumber.text = '${measureNumberInViewport + 1}';
measureNumber.y = measureNumberPosition + this.y;
// Show the measure number only if it isn't beneath the end of the note grid.
// Using measureNumber + 1 because the cut-off bar at the bottom is technically a bar, but it looks bad if a measure number shows up there.
if ((measureNumberInViewport + 1) < chartEditorState.songLengthInSteps / Conductor.instance.stepsPerMeasure)
measureNumber.text = '${measureNumberInViewport + 1}';
else
measureNumber.text = '';
// trace(measureNumber.text + ' at ' + measureNumber.y);
}

View file

@ -187,6 +187,10 @@ class Level implements IRegistryEntry<LevelData>
if (_data.props.length == 0) return props;
var hiddenProps:Array<LevelProp> = props.splice(_data.props.length - 1, props.length - 1);
for (hiddenProp in hiddenProps)
hiddenProp.visible = false;
for (propIndex in 0..._data.props.length)
{
var propData = _data.props[propIndex];
@ -198,6 +202,7 @@ class Level implements IRegistryEntry<LevelData>
{
existingProp.propData = propData;
existingProp.x = propData.offsets[0] + FlxG.width * 0.25 * propIndex;
existingProp.visible = true;
}
else
{

View file

@ -433,7 +433,7 @@ class StoryMenuState extends MusicBeatState
{
var item:LevelTitle = levelTitles.members[index];
item.targetY = (index - currentIndex) * 120 + 480;
item.targetY = (index - currentIndex) * 125 + 480;
if (index == currentIndex)
{
@ -590,7 +590,9 @@ class StoryMenuState extends MusicBeatState
{
// Both the previous and current level were simple backgrounds.
// Fade between colors directly, rather than fading one background out and another in.
FlxTween.color(levelBackground, 0.4, previousColor, currentColor);
// cancels potential tween in progress, and tweens from there
FlxTween.cancelTweensOf(levelBackground);
FlxTween.color(levelBackground, 0.9, levelBackground.color, currentColor, {ease: FlxEase.quartOut});
}
else
{
@ -630,10 +632,10 @@ class StoryMenuState extends MusicBeatState
function updateProps():Void
{
for (prop in currentLevel.buildProps(levelProps.members))
for (ind => prop in currentLevel.buildProps(levelProps.members))
{
prop.zIndex = 1000;
levelProps.add(prop);
if (levelProps.members[ind] != prop) levelProps.replace(levelProps.members[ind], prop) ?? levelProps.add(prop);
}
refresh();