Skip to content

Commit

Permalink
YES
Browse files Browse the repository at this point in the history
added another window name suffix that updates based on if your JSE version is outdated, i'll fix the outdated state tomorrow (when JSE 1.13.0 releases!)
made the windownamesuffix update based on which state you're in
FINALLY fixed the Machine Gun Options bug on Android builds (turns out Stefan/MaysLastPlay forgot to make it remove the current virtualpad when you opened one of the menus)
Gave different exit choices
fixed a null object reference with Showcase Mode & scoreTxt Size
temporarily disabled the results screen in story mode, as it appears to popup after the first song
  • Loading branch information
JordanSantiagoYT committed Oct 26, 2023
1 parent f3c7b54 commit b32c4a7
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 13 deletions.
4 changes: 3 additions & 1 deletion source/CreditsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ class CreditsState extends MusicBeatState
Paths.clearStoredMemory();
Paths.clearUnusedMemory();

MusicBeatState.windowNameSuffix = " - Credits";

#if desktop
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Menus", null);
DiscordClient.changePresence("Viewing the Credits", null);
#end

persistentUpdate = true;
Expand Down
2 changes: 2 additions & 0 deletions source/FlashingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class FlashingState extends MusicBeatState
Paths.clearStoredMemory();
Paths.clearUnusedMemory();

MusicBeatState.windowNameSuffix = " - Flashing Lights Warning Screen";

super.create();

var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
Expand Down
2 changes: 2 additions & 0 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class FreeplayState extends MusicBeatState
changeSelection();
changeDiff();

MusicBeatState.windowNameSuffix = " - Freeplay Menu";

var swag:Alphabet = new Alphabet(1, 0, "swag");

// JUST DOIN THIS SHIT FOR TESTING!!!
Expand Down
3 changes: 2 additions & 1 deletion source/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using StringTools;

class MainMenuState extends MusicBeatState
{
public static var psychEngineJSVersion:String = '1.12.0'; //This is also used for Discord RPC
public static var psychEngineJSVersion:String = '1.13.0'; //This is also used for Discord RPC
public static var psychEngineVersion:String = '0.6.3'; //This is also used for Discord RPC
public static var curSelected:Int = 0;

Expand All @@ -50,6 +50,7 @@ class MainMenuState extends MusicBeatState

override function create()
{
MusicBeatState.windowNameSuffix = " - Main Menu";
Paths.clearStoredMemory();
Paths.clearUnusedMemory();

Expand Down
3 changes: 2 additions & 1 deletion source/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class MusicBeatState extends FlxUIState
}

public static var windowNameSuffix:String = "";
public static var windowNameSuffix2:String = ""; //changes to "Outdated!" if the version of the engine is outdated
public static var windowNamePrefix:String = "Friday Night Funkin': JS Engine";

override public function new() {
Expand Down Expand Up @@ -185,7 +186,7 @@ class MusicBeatState extends FlxUIState
FlxG.autoPause = ClientPrefs.autoPause;

super.update(elapsed);
Application.current.window.title = windowNamePrefix + windowNameSuffix;
Application.current.window.title = windowNamePrefix + windowNameSuffix + windowNameSuffix2;
}

private function updateSection():Void
Expand Down
2 changes: 2 additions & 0 deletions source/OutdatedState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class OutdatedState extends MusicBeatState
Paths.clearStoredMemory();
Paths.clearUnusedMemory();

MusicBeatState.windowNameSuffix2 = " (Outdated!)";

super.create();

var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
Expand Down
57 changes: 54 additions & 3 deletions source/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class PauseSubState extends MusicBeatSubstate
var grpMenuShit:FlxTypedGroup<Alphabet>;

var menuItems:Array<String> = [];
var menuItemsOG:Array<String> = ['Resume', 'Restart Song', 'Change Gameplay Settings', 'Change Difficulty', 'Options', 'Exit to menu'];
var menuItemsOG:Array<String> = ['Resume', 'Restart Song', 'Change Gameplay Settings', 'Change Difficulty', 'Options', 'Exit'];
var menuItemsExit:Array<String> = [(PlayState.isStoryMode ? 'Exit to Story Menu' : 'Exit to Freeplay'), 'Exit to Main Menu', 'Exit Game', 'Back'];
var difficultyChoices = [];
var curSelected:Int = 0;

Expand Down Expand Up @@ -233,7 +234,25 @@ class PauseSubState extends MusicBeatSubstate
menuItems = menuItemsOG;
regenMenu();
}
if (menuItems == difficultyChoices)
{
if(menuItems.length - 1 != curSelected && difficultyChoices.contains(daSelected)) {
var name:String = PlayState.SONG.song;
var poop = Highscore.formatSong(name, curSelected);
PlayState.SONG = Song.loadFromJson(poop, name);
PlayState.storyDifficulty = curSelected;
MusicBeatState.resetState();
FlxG.sound.music.volume = 0;
PlayState.changedDifficulty = true;
PlayState.chartingMode = false;
return;
}

menuItems = menuItemsOG;
regenMenu();
}

if (menuItems == menuItemsOG) {
switch (daSelected)
{
case "Resume":
Expand Down Expand Up @@ -291,20 +310,51 @@ class PauseSubState extends MusicBeatSubstate
FlxTween.tween(FlxG.sound.music, {volume: 1}, 0.8);
FlxG.sound.music.time = pauseMusic.time;
}
case "Exit to menu":
case "Exit":
menuItems = menuItemsExit;
if (FlxG.random.bool(0.1)) menuItemsExit[0] = 'Exit To Your Mother';
regenMenu();
}
}
if (menuItems == menuItemsExit) {
switch(daSelected) {
case "Exit to Story Menu", "Exit to Freeplay":
PlayState.deathCounter = 0;
PlayState.seenCutscene = false;

WeekData.loadTheFirstEnabledMod();
if(PlayState.isStoryMode) {
MusicBeatState.switchState(new StoryMenuState());
} else {
} else if (!PlayState.isStoryMode) {
MusicBeatState.switchState(new FreeplayState());
}
PlayState.cancelMusicFadeTween();
FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic));
PlayState.changedDifficulty = false;
PlayState.chartingMode = false;
case "Exit to Main Menu":
PlayState.deathCounter = 0;
PlayState.seenCutscene = false;

WeekData.loadTheFirstEnabledMod();
if(PlayState.isStoryMode) {
MusicBeatState.switchState(new MainMenuState());
}
PlayState.cancelMusicFadeTween();
FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic));
PlayState.changedDifficulty = false;
PlayState.chartingMode = false;
case "Exit Game":
trace ("Exiting game...");
openfl.system.System.exit(0);
case "Back":
menuItems = menuItemsOG;
regenMenu();
case "Exit to your Mother":
trace ("YO MAMA");
var aLittleCrashing:FlxSprite = null;
aLittleCrashing.destroy();
}
}
}
}
Expand Down Expand Up @@ -341,6 +391,7 @@ class PauseSubState extends MusicBeatSubstate
override function destroy()
{
pauseMusic.destroy();
if (PlayState != null) MusicBeatState.windowNameSuffix = " - " + PlayState.SONG.song + " " + (PlayState.isStoryMode ? "(Story Mode)" : "(Freeplay)");

super.destroy();
}
Expand Down
10 changes: 4 additions & 6 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2188,7 +2188,7 @@ class PlayState extends MusicBeatState
dadGroup.destroy();
boyfriendGroup.destroy();
}
if (ClientPrefs.scoreTxtSize > 0 && scoreTxt != null) scoreTxt.size = ClientPrefs.scoreTxtSize;
if (ClientPrefs.scoreTxtSize > 0 && scoreTxt != null && !ClientPrefs.showcaseMode && !ClientPrefs.hideScore) scoreTxt.size = ClientPrefs.scoreTxtSize;
if (!ClientPrefs.hideScore) updateScore();

judgementCounter = new FlxText(0, FlxG.height / 2 - (ClientPrefs.hudType != 'Box Funkin' || ClientPrefs.hudType != "Mic'd Up" ? 80 : 350), 0, "", 20);
Expand Down Expand Up @@ -7209,11 +7209,7 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi
if(FlxTransitionableState.skipNextTransIn) {
CustomFadeTransition.nextCamera = null;
}
if (ClientPrefs.resultsScreen)
openSubState(new ResultsScreenSubState([marvs, sicks, goods, bads, shits], Std.int(campaignScore), songMisses,
Highscore.floorDecimal(ratingPercent * 100, 2), ratingName + (' [' + ratingFC + '] ')));
else
MusicBeatState.switchState(new StoryMenuState());
MusicBeatState.switchState(new StoryMenuState()); //removed results screen from story mode because for some reason it opens the screen after the first song even if the story playlist's length is greater than 0??

// if ()
if(!ClientPrefs.getGameplaySetting('practice', false) && !ClientPrefs.getGameplaySetting('botplay', false)) {
Expand Down Expand Up @@ -8297,6 +8293,7 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT
}

callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]);
if (!ClientPrefs.hideScore && scoreTxtUpdateFrame == 0 && scoreTxt != null) updateScore();
}

function noteMissPress(direction:Int = 1):Void //You pressed a key when there was no notes to press for this key
Expand Down Expand Up @@ -8347,6 +8344,7 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT
vocals.volume = 0;
}
callOnLuas('noteMissPress', [direction]);
if (!ClientPrefs.hideScore && scoreTxtUpdateFrame == 0 && scoreTxt != null) updateScore();
}

var hitsound:FlxSound;
Expand Down
2 changes: 2 additions & 0 deletions source/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class TitleState extends MusicBeatState
Paths.clearStoredMemory();
Paths.clearUnusedMemory();

MusicBeatState.windowNameSuffix = " - Title Screen";

#if android
FlxG.android.preventDefaultKeys = [BACK];
#end
Expand Down
2 changes: 1 addition & 1 deletion source/options/BaseOptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class BaseOptionsMenu extends MusicBeatSubstate

if(usesCheckbox)
{
if(controls.ACCEPT)
if(controls.ACCEPT #if android || virtualPad.buttonA.justPressed #end)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
curOption.setValue((curOption.getValue() == true) ? false : true);
Expand Down
21 changes: 21 additions & 0 deletions source/options/OptionsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,39 @@ class OptionsState extends MusicBeatState
function openSelectedSubstate(label:String) {
switch(label) {
case 'Note Colors':
#if android
removeVirtualPad();
#end
openSubState(new options.NotesSubState());
case 'Controls':
#if android
removeVirtualPad();
#end
openSubState(new options.ControlsSubState());
case 'Graphics':
#if android
removeVirtualPad();
#end
openSubState(new options.GraphicsSettingsSubState());
case 'Visuals and UI':
#if android
removeVirtualPad();
#end
openSubState(new options.VisualsUISubState());
case 'Gameplay':
#if android
removeVirtualPad();
#end
openSubState(new options.GameplaySettingsSubState());
case 'Optimization':
#if android
removeVirtualPad();
#end
openSubState(new options.OptimizationSubState());
case 'Adjust Delay and Combo':
#if android
removeVirtualPad();
#end
LoadingState.loadAndSwitchState(new options.NoteOffsetState());
}
}
Expand Down

0 comments on commit b32c4a7

Please sign in to comment.