Skip to content

Commit

Permalink
5.6.0 fixes and whatever
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline committed Feb 15, 2024
1 parent 179fc61 commit bbe805a
Show file tree
Hide file tree
Showing 31 changed files with 123 additions and 154 deletions.
24 changes: 11 additions & 13 deletions hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,32 @@
{
"name": "lime",
"type": "haxelib",
"version": "8.1.1"
"version": null
},
{
"name": "openfl",
"type": "haxelib",
"version": "9.3.2"
"version": null
},
{
"name": "flixel",
"type": "haxelib",
"version": "5.5.0"
"version": null
},
{
"name": "flixel-addons",
"type": "git",
"dir": null,
"ref": 19c2816,
"url": "https://github.com/HaxeFlixel/flixel-addons/"
"type": "haxelib",
"version": null
},
{
"name": "flixel-tools",
"type": "haxelib",
"version": "1.5.1"
"version": null
},
{
"name": "flixel-ui",
"type": "haxelib",
"version": "2.5.0"
"version": null
},
{
"name": "hxcpp",
Expand All @@ -40,7 +38,7 @@
{
"name": "hxdiscord_rpc",
"type": "haxelib",
"version": "1.1.1"
"version": null
},
{
"name": "tjson",
Expand All @@ -50,7 +48,7 @@
{
"name": "hxvlc",
"type": "haxelib",
"version": "1.0.2"
"version": null
},
{
"name": "SScript",
Expand All @@ -60,12 +58,12 @@
{
"name": "yaml",
"type": "haxelib",
"version": "2.0.1"
"version": null
},
{
"name": "away3d",
"type": "haxelib",
"version": "5.0.9"
"version": null
},
{
"name": "hxcpp-debug-server",
Expand Down
5 changes: 2 additions & 3 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ class Main extends Sprite
width: 1280, // WINDOW width
height: 720, // WINDOW height
zoom: -1.0, // game state bounds
initialState: () -> new TitleState(), // initial game state
framerate: 60, // default framerate
skipSplash: true, // if the default flixel splash screen should be skipped
startFullscreen: false // if the game should start at fullscreen mode
};

public static var fpsVar:FPS;

public static var initialState:Class<FlxState> = TitleState; // so the fps can get the state properly :)

// You can pretty much ignore everything from here on - your code should go in your states.

public static function main():Void
Expand Down Expand Up @@ -117,7 +116,7 @@ class Main extends Sprite
ClientPrefs.loadDefaultKeys();
#if ACHIEVEMENTS_ALLOWED Achievements.load(); #end
#if (cpp && windows) CppAPI.darkMode(); #end
addChild(new FlxGame(game.width, game.height, initialState /*cppthing.SpecsDetector*/, #if (flixel < "5.0.0") game.zoom, #end game.framerate, game.framerate, game.skipSplash, game.startFullscreen));
addChild(new FlxGame(game.width, game.height, game.initialState, game.framerate, game.framerate, game.skipSplash, game.startFullscreen));

#if !mobile
fpsVar = new FPS(10, 3, 0xFFFFFF);
Expand Down
35 changes: 7 additions & 28 deletions source/backend/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -198,39 +198,18 @@ class MusicBeatState extends FlxUIState
curStep = lastChange.stepTime + Math.floor(shit);
}

public static function switchState(nextState:FlxState = null) {
if(nextState == null) nextState = FlxG.state;
if(nextState == FlxG.state)
override function startOutro(onOutroComplete:()->Void):Void
{
if (!FlxTransitionableState.skipNextTransIn)
{
resetState();
FlxG.state.openSubState(new CustomFadeTransition(0.6, false));
CustomFadeTransition.finishCallback = onOutroComplete;

return;
}

if(FlxTransitionableState.skipNextTransIn) FlxG.switchState(nextState);
else startTransition(nextState);
FlxTransitionableState.skipNextTransIn = false;
}

public static function resetState() {
if(FlxTransitionableState.skipNextTransIn) FlxG.resetState();
else startTransition();
FlxTransitionableState.skipNextTransIn = false;
}

// Custom made Trans in
public static function startTransition(nextState:FlxState = null)
{
if(nextState == null)
nextState = FlxG.state;

FlxG.state.openSubState(new CustomFadeTransition(0.6, false));

Main.initialState = Type.getClass(nextState);

if(nextState == FlxG.state)
CustomFadeTransition.finishCallback = function() FlxG.resetState();
else
CustomFadeTransition.finishCallback = function() FlxG.switchState(nextState);
onOutroComplete();
}

public static function getState():MusicBeatState {
Expand Down
2 changes: 1 addition & 1 deletion source/options/NoteOffsetState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class NoteOffsetState extends MusicBeatState

persistentUpdate = false;
CustomFadeTransition.nextCamera = camOther;
MusicBeatState.switchState(new options.OptionsState());
FlxG.switchState(() -> new options.OptionsState());
if(OptionsState.onPlayState)
{
if(ClientPrefs.data.pauseMusic != 'None')
Expand Down
8 changes: 4 additions & 4 deletions source/options/OptionsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class OptionsState extends MusicBeatState
case 'Controls':
openSubState(new options.ControlsSubState());
case 'Preferences':
MusicBeatState.switchState(new options.PrefsMenu());
FlxG.switchState(() -> new options.PrefsMenu());
case 'Offseting':
MusicBeatState.switchState(new options.NoteOffsetState());
FlxG.switchState(() -> new options.NoteOffsetState());
}
}

Expand Down Expand Up @@ -88,10 +88,10 @@ class OptionsState extends MusicBeatState
if(onPlayState)
{
StageData.loadDirectory(PlayState.SONG);
LoadingState.loadAndSwitchState(new PlayState());
LoadingState.loadAndSwitchState(() ->new PlayState());
FlxG.sound.music.volume = 0;
}
else MusicBeatState.switchState(new MainMenuState());
else FlxG.switchState(() -> new MainMenuState());
}
else if (controls.ACCEPT) openSelectedSubstate(options[curSelected]);
}
Expand Down
2 changes: 1 addition & 1 deletion source/options/PrefsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class PrefsMenu extends MusicBeatState
}
if (controls.BACK) {
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new OptionsState());
FlxG.switchState(() -> new OptionsState());
}
else if (controls.ACCEPT) openSelectedSubstate(options[curSelected]);
}
Expand Down
8 changes: 4 additions & 4 deletions source/psychlua/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class FunkinLua {
});

Lua_helper.add_callback(lua, "loadCredits", function(?musicos:String = null, ?funni:Bool) {
LoadingState.loadAndSwitchState(new states.CreditsState()); // wowzers!
LoadingState.loadAndSwitchState(() ->new states.CreditsState()); // wowzers!
FlxG.sound.playMusic(Paths.music(musicos));
if(musicos == '') funni = true;
if(funni == true) FlxG.sound.playMusic(Paths.music('freakyMenu'));
Expand All @@ -473,7 +473,7 @@ class FunkinLua {
PlayState.SONG = Song.loadFromJson(poop, name);
PlayState.storyDifficulty = difficultyNum;
game.persistentUpdate = false;
LoadingState.loadAndSwitchState(new PlayState());
LoadingState.loadAndSwitchState(() ->new PlayState());

FlxG.sound.music.pause();
FlxG.sound.music.volume = 0;
Expand Down Expand Up @@ -942,9 +942,9 @@ class FunkinLua {
CustomFadeTransition.nextCamera = null;

if(PlayState.isStoryMode)
MusicBeatState.switchState(new StoryMenuState());
FlxG.switchState(() -> new StoryMenuState());
else
MusicBeatState.switchState(new FreeplayState());
FlxG.switchState(() -> new FreeplayState());

#if desktop DiscordClient.resetClientID(); #end

Expand Down
2 changes: 1 addition & 1 deletion source/states/AchievementsMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class AchievementsMenuState extends MusicBeatState {

if (controls.BACK) {
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new MainMenuState());
FlxG.switchState(() -> new MainMenuState());
goingBack = true;
}
super.update(elapsed);
Expand Down
33 changes: 12 additions & 21 deletions source/states/CharacterSelectionState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class CharacterSelectionState extends MusicBeatState {
FlxG.sound.music.stop();
FlxTween.tween(camHUD, {alpha: 0}, 0.25, {ease: FlxEase.circOut});

LoadingState.loadAndSwitchState(new PlayState());
LoadingState.loadAndSwitchState(() -> new PlayState());
case 1:
curSelected = 0;
spawnSelection();
Expand All @@ -167,7 +167,7 @@ class CharacterSelectionState extends MusicBeatState {

if (controls.BACK) {
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new FreeplayState());
FlxG.switchState(() -> new FreeplayState());
FlxG.sound.playMusic(Paths.music('freakyMenu'));
}
super.update(elapsed);
Expand Down Expand Up @@ -197,24 +197,15 @@ class CharacterSelectionState extends MusicBeatState {
}

function changeForm(change:Int) {
if (!entering) {
if (characterData[curSelected][1].length >= 2) {
FlxG.sound.play(Paths.sound('scrollMenu'));
curSelectedForm += change;

if (curSelectedForm < 0) {
curSelectedForm = characterData[curSelected][1].length;
curSelectedForm -= 1;
}
if (curSelectedForm >= characterData[curSelected][1].length) curSelectedForm = 0;

curText.text = characterData[curSelected][1][curSelectedForm][0];
characterFile = characterData[curSelected][1][curSelectedForm][1];

reloadCharacter();

curText.screenCenter(X);
}
var chrData:Array<Array<String>> = characterData[curSelected][1];
if (!entering && chrData.length >= 2) {
FlxG.sound.play(Paths.sound('scrollMenu'));
curSelectedForm = FlxMath.wrap(curSelectedForm + change, 0, chrData.length - 1);

curText.text = chrData[curSelectedForm][0];
characterFile = chrData[curSelectedForm][1];
reloadCharacter();
curText.screenCenter(X);
}
}

Expand Down Expand Up @@ -254,7 +245,7 @@ class CharacterSelectionState extends MusicBeatState {
case 'execution' | 'firestorm': PlayState.SONG.player1 = 'BF execution';
default: PlayState.SONG.player1 = characterFile;
}
LoadingState.loadAndSwitchState(new PlayState());
LoadingState.loadAndSwitchState(() -> new PlayState());
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/states/CreditsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class CreditsState extends MusicBeatState {
if(controls.BACK){
if(colorTween != null) colorTween.cancel();
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new MainMenuState());
FlxG.switchState(() -> new MainMenuState());
quitting = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/states/FlashingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ class FlashingState extends MusicBeatState
FlxG.sound.play(Paths.sound('confirmMenu'));
FlxFlicker.flicker(warnText, 1, 0.1, false, true, function(flk:FlxFlicker) {
new FlxTimer().start(0.5, function (tmr:FlxTimer) {
MusicBeatState.switchState(new TitleState());
FlxG.switchState(() -> new TitleState());
});
});
} else {
FlxG.sound.play(Paths.sound('cancelMenu'));
FlxTween.tween(warnText, {alpha: 0}, 1, {
onComplete: function (twn:FlxTween) {
MusicBeatState.switchState(new TitleState());
FlxG.switchState(() -> new TitleState());
}
});
}
Expand Down
10 changes: 5 additions & 5 deletions source/states/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class FreeplayState extends MusicBeatState {
persistentUpdate = false;
if(colorTween != null) colorTween.cancel();
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new MainMenuState());
FlxG.switchState(() -> new MainMenuState());
}
}

Expand Down Expand Up @@ -363,15 +363,15 @@ class FreeplayState extends MusicBeatState {
return;
}
if (FlxG.keys.pressed.SHIFT){
LoadingState.loadAndSwitchState(new ChartingState());
LoadingState.loadAndSwitchState(() -> new ChartingState());
}else{
if (FlxG.keys.pressed.C) {
states.CharacterSelectionState.characterFile = 'bf';
MusicBeatState.switchState(new states.CharacterSelectionState());
LoadingState.loadAndSwitchState(new states.CharacterSelectionState());
}
else LoadingState.loadAndSwitchState(new PlayState());
else LoadingState.loadAndSwitchState(() -> new PlayState());
}

FlxG.sound.music.volume = 0;

destroyFreeplayVocals();
Expand Down
Loading

0 comments on commit bbe805a

Please sign in to comment.