Merge branch 'fps-setting' of https://github.com/lemz1/Funkin into fps-setting

This commit is contained in:
lemz 2024-05-30 00:22:18 +02:00
commit 26b357df72
9 changed files with 47 additions and 14 deletions

View file

@ -65,7 +65,7 @@ class FNFLegacyImporter
songMetadata.timeChanges = rebuildTimeChanges(songData); songMetadata.timeChanges = rebuildTimeChanges(songData);
songMetadata.playData.characters = new SongCharacterData(songData?.song?.player1 ?? 'bf', 'gf', songData?.song?.player2 ?? 'dad', 'mom'); songMetadata.playData.characters = new SongCharacterData(songData?.song?.player1 ?? 'bf', 'gf', songData?.song?.player2 ?? 'dad');
return songMetadata; return songMetadata;
} }

View file

@ -406,7 +406,7 @@ class Strumline extends FlxSpriteGroup
if (Preferences.downscroll) if (Preferences.downscroll)
{ {
holdNote.y = this.y + calculateNoteYPos(holdNote.strumTime, vwoosh) - holdNote.height + STRUMLINE_SIZE / 2; holdNote.y = this.y - INITIAL_OFFSET + calculateNoteYPos(holdNote.strumTime, vwoosh) - holdNote.height + STRUMLINE_SIZE / 2;
} }
else else
{ {
@ -435,7 +435,7 @@ class Strumline extends FlxSpriteGroup
if (Preferences.downscroll) if (Preferences.downscroll)
{ {
holdNote.y = this.y - holdNote.height + STRUMLINE_SIZE / 2; holdNote.y = this.y - INITIAL_OFFSET - holdNote.height + STRUMLINE_SIZE / 2;
} }
else else
{ {
@ -450,7 +450,7 @@ class Strumline extends FlxSpriteGroup
if (Preferences.downscroll) if (Preferences.downscroll)
{ {
holdNote.y = this.y + calculateNoteYPos(holdNote.strumTime, vwoosh) - holdNote.height + STRUMLINE_SIZE / 2; holdNote.y = this.y - INITIAL_OFFSET + calculateNoteYPos(holdNote.strumTime, vwoosh) - holdNote.height + STRUMLINE_SIZE / 2;
} }
else else
{ {

View file

@ -852,6 +852,11 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
} }
} }
public override function toString():String
{
return 'Stage($id)';
}
static function _fetchData(id:String):Null<StageData> static function _fetchData(id:String):Null<StageData>
{ {
return StageRegistry.instance.parseEntryDataWithMigration(id, StageRegistry.instance.fetchEntryVersion(id)); return StageRegistry.instance.parseEntryDataWithMigration(id, StageRegistry.instance.fetchEntryVersion(id));

View file

@ -62,7 +62,6 @@ class DebugMenuSubState extends MusicBeatSubState
#if sys #if sys
createItem("OPEN CRASH LOG FOLDER", openLogFolder); createItem("OPEN CRASH LOG FOLDER", openLogFolder);
#end #end
FlxG.camera.focusOn(new FlxPoint(camFocusPoint.x, camFocusPoint.y));
FlxG.camera.focusOn(new FlxPoint(camFocusPoint.x, camFocusPoint.y + 500)); FlxG.camera.focusOn(new FlxPoint(camFocusPoint.x, camFocusPoint.y + 500));
} }

View file

@ -29,6 +29,7 @@ import funkin.graphics.shaders.StrokeShader;
import funkin.input.Controls; import funkin.input.Controls;
import funkin.play.PlayStatePlaylist; import funkin.play.PlayStatePlaylist;
import funkin.play.song.Song; import funkin.play.song.Song;
import funkin.ui.story.Level;
import funkin.save.Save; import funkin.save.Save;
import funkin.save.Save.SaveScoreData; import funkin.save.Save.SaveScoreData;
import funkin.ui.AtlasText; import funkin.ui.AtlasText;
@ -191,10 +192,24 @@ class FreeplayState extends MusicBeatSubState
// programmatically adds the songs via LevelRegistry and SongRegistry // programmatically adds the songs via LevelRegistry and SongRegistry
for (levelId in LevelRegistry.instance.listSortedLevelIds()) for (levelId in LevelRegistry.instance.listSortedLevelIds())
{ {
for (songId in LevelRegistry.instance.parseEntryData(levelId).songs) var level:Level = LevelRegistry.instance.fetchEntry(levelId);
if (level == null)
{
trace('[WARN] Could not find level with id (${levelId})');
continue;
}
for (songId in level.getSongs())
{ {
var song:Song = SongRegistry.instance.fetchEntry(songId); var song:Song = SongRegistry.instance.fetchEntry(songId);
if (song == null)
{
trace('[WARN] Could not find song with id (${songId})');
continue;
}
// Only display songs which actually have available charts for the current character. // Only display songs which actually have available charts for the current character.
var availableDifficultiesForSong:Array<String> = song.listDifficulties(displayedVariations, false); var availableDifficultiesForSong:Array<String> = song.listDifficulties(displayedVariations, false);
if (availableDifficultiesForSong.length == 0) continue; if (availableDifficultiesForSong.length == 0) continue;

View file

@ -49,6 +49,8 @@ class MainMenuState extends MusicBeatState
DiscordClient.changePresence("In the Menus", null); DiscordClient.changePresence("In the Menus", null);
#end #end
FlxG.cameras.reset(new FunkinCamera('mainMenu'));
transIn = FlxTransitionableState.defaultTransIn; transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut; transOut = FlxTransitionableState.defaultTransOut;
@ -170,7 +172,6 @@ class MainMenuState extends MusicBeatState
function resetCamStuff():Void function resetCamStuff():Void
{ {
FlxG.cameras.reset(new FunkinCamera('mainMenu'));
FlxG.camera.follow(camFollow, null, 0.06); FlxG.camera.follow(camFollow, null, 0.06);
FlxG.camera.snapToTarget(); FlxG.camera.snapToTarget();
} }
@ -329,6 +330,8 @@ class MainMenuState extends MusicBeatState
persistentUpdate = false; persistentUpdate = false;
FlxG.state.openSubState(new DebugMenuSubState()); FlxG.state.openSubState(new DebugMenuSubState());
// reset camera when debug menu is closed
subStateClosed.addOnce(_ -> resetCamStuff());
} }
#end #end

View file

@ -466,6 +466,9 @@ class StoryMenuState extends MusicBeatState
// Disable the funny music thing for now. // Disable the funny music thing for now.
// funnyMusicThing(); // funnyMusicThing();
} }
updateText();
refresh();
} }
final FADE_OUT_TIME:Float = 1.5; final FADE_OUT_TIME:Float = 1.5;

View file

@ -67,9 +67,11 @@ class TitleState extends MusicBeatState
// DEBUG BULLSHIT // DEBUG BULLSHIT
// netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown); // netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
new FlxTimer().start(1, function(tmr:FlxTimer) { if (!initialized) new FlxTimer().start(1, function(tmr:FlxTimer) {
startIntro(); startIntro();
}); });
else
startIntro();
} }
function client_onMetaData(metaData:Dynamic) function client_onMetaData(metaData:Dynamic)
@ -118,7 +120,7 @@ class TitleState extends MusicBeatState
function startIntro():Void function startIntro():Void
{ {
playMenuMusic(); if (!initialized || FlxG.sound.music == null) playMenuMusic();
persistentUpdate = true; persistentUpdate = true;
@ -231,7 +233,7 @@ class TitleState extends MusicBeatState
overrideExisting: true, overrideExisting: true,
restartTrack: true restartTrack: true
}); });
// Fade from 0.0 to 0.7 over 4 seconds // Fade from 0.0 to 1 over 4 seconds
if (shouldFadeIn) FlxG.sound.music.fadeIn(4.0, 0.0, 1.0); if (shouldFadeIn) FlxG.sound.music.fadeIn(4.0, 0.0, 1.0);
} }

View file

@ -57,8 +57,7 @@ class LoadingState extends MusicBeatSubState
funkay.scrollFactor.set(); funkay.scrollFactor.set();
funkay.screenCenter(); funkay.screenCenter();
loadBar = new FunkinSprite(0, FlxG.height - 20).makeSolidColor(FlxG.width, 10, 0xFFff16d2); loadBar = new FunkinSprite(0, FlxG.height - 20).makeSolidColor(0, 10, 0xFFff16d2);
loadBar.screenCenter(X);
add(loadBar); add(loadBar);
initSongsManifest().onComplete(function(lib) { initSongsManifest().onComplete(function(lib) {
@ -163,8 +162,15 @@ class LoadingState extends MusicBeatSubState
targetShit = FlxMath.remapToRange(callbacks.numRemaining / callbacks.length, 1, 0, 0, 1); targetShit = FlxMath.remapToRange(callbacks.numRemaining / callbacks.length, 1, 0, 0, 1);
var lerpWidth:Int = Std.int(FlxMath.lerp(loadBar.width, FlxG.width * targetShit, 0.2)); var lerpWidth:Int = Std.int(FlxMath.lerp(loadBar.width, FlxG.width * targetShit, 0.2));
// this if-check prevents the setGraphicSize function
// from setting the width of the loadBar to the height of the loadBar
// this is a behaviour that is implemented in the setGraphicSize function
// if the width parameter is equal to 0
if (lerpWidth > 0)
{
loadBar.setGraphicSize(lerpWidth, loadBar.height); loadBar.setGraphicSize(lerpWidth, loadBar.height);
loadBar.updateHitbox(); loadBar.updateHitbox();
}
FlxG.watch.addQuick('percentage?', callbacks.numRemaining / callbacks.length); FlxG.watch.addQuick('percentage?', callbacks.numRemaining / callbacks.length);
} }