Skip to content

Commit

Permalink
redo some story menu stuff and some other stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Oct 31, 2024
1 parent 182a709 commit 812df20
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 55 deletions.
Binary file added mods/Friday Night Funkin'/music/freakyMenu.ogg
Binary file not shown.
Binary file not shown.
Binary file added mods/Friday Night Funkin'/music/optionsMenu.ogg
Binary file not shown.
4 changes: 3 additions & 1 deletion source/states/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ class MainMenuState extends MusicBeatState {
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;

if (FlxG.sound.music == null || FlxG.sound.music.playing != true)
if (FlxG.sound.music == null || !FlxG.sound.music.playing || OptionsMenu.playing){
OptionsMenu.playing = false;
TitleState.playTitleMusic();
}

persistentUpdate = persistentDraw = true;

Expand Down
9 changes: 7 additions & 2 deletions source/states/OptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class OptionsMenu extends MusicBeatState {

public var menuBG:FlxSprite;

public static var playing:Bool = false;

public override function create():Void {

MusicBeatState.windowNameSuffix = "";
Expand All @@ -186,8 +188,8 @@ class OptionsMenu extends MusicBeatState {

loadPage("Categories");

if (FlxG.sound.music == null)
FlxG.sound.playMusic(MusicUtilities.getOptionsMusic(), 0.7, true);
FlxG.sound.playMusic(MusicUtilities.getOptionsMusic(), 0.7, true);
OptionsMenu.playing = true;
}

public function loadPage(loadedPageName:String):Void {
Expand Down Expand Up @@ -224,6 +226,9 @@ class OptionsMenu extends MusicBeatState {
public override function update(elapsed:Float) {
super.update(elapsed);

if (FlxG.sound.music.volume < 0.8)
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;

if (!inMenu) {
if (-1 * Math.floor(FlxG.mouse.wheel) != 0) {
curSelected -= 1 * Math.floor(FlxG.mouse.wheel);
Expand Down
133 changes: 83 additions & 50 deletions source/states/StoryMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -83,51 +83,54 @@ class StoryMenuState extends MusicBeatState {
}
#end

lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.5));

weekScoreText.text = "WEEK SCORE:" + lerpScore;

weekTitleText.x = FlxG.width - (weekTitleText.width + 10);

if (!movedBack) {
if (!selectedWeek) {
if (-1 * Math.floor(FlxG.mouse.wheel) != 0)
changeWeek(-1 * Math.floor(FlxG.mouse.wheel));

if (controls.UP_P)
changeWeek(-1);
if (controls.DOWN_P)
changeWeek(1);

if (controls.RIGHT)
rightArrow.animation.play('press')
else
rightArrow.animation.play('idle');

if (controls.LEFT)
leftArrow.animation.play('press');
else
leftArrow.animation.play('idle');

if (controls.RIGHT_P)
changeDifficulty(1);
if (controls.LEFT_P)
changeDifficulty(-1);

if (FlxG.keys.justPressed.E)
changeGroup(1);
if (FlxG.keys.justPressed.Q)
changeGroup(-1);

if (controls.RESET) {
openSubState(new ResetScoreSubstate("nonelolthisisweekslmao", curDifficulties[curDifficulty][0], curWeek, currentGroup.pathName + "Week",
true));
changeWeek();
if(currentGroup != null){

lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.5));

weekScoreText.text = "WEEK SCORE:" + lerpScore;

weekTitleText.x = FlxG.width - (weekTitleText.width + 10);

if (!movedBack) {
if (!selectedWeek) {
if (-1 * Math.floor(FlxG.mouse.wheel) != 0)
changeWeek(-1 * Math.floor(FlxG.mouse.wheel));

if (controls.UP_P)
changeWeek(-1);
if (controls.DOWN_P)
changeWeek(1);

if (controls.RIGHT)
rightArrow.animation.play('press')
else
rightArrow.animation.play('idle');

if (controls.LEFT)
leftArrow.animation.play('press');
else
leftArrow.animation.play('idle');

if (controls.RIGHT_P)
changeDifficulty(1);
if (controls.LEFT_P)
changeDifficulty(-1);

if (FlxG.keys.justPressed.E)
changeGroup(1);
if (FlxG.keys.justPressed.Q)
changeGroup(-1);

if (controls.RESET) {
openSubState(new ResetScoreSubstate("nonelolthisisweekslmao", curDifficulties[curDifficulty][0], curWeek, currentGroup.pathName + "Week",
true));
changeWeek();
}
}
}

if (controls.ACCEPT)
selectWeek();
if (controls.ACCEPT)
selectWeek();
}
}

if (controls.BACK && !movedBack && !selectedWeek) {
Expand All @@ -146,6 +149,11 @@ class StoryMenuState extends MusicBeatState {
}

function createStoryUI() {
#if DISCORD_ALLOWED
// Updating Discord Rich Presence
DiscordClient.changePresence("In the Story Menus", null);
#end

weekScoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
weekScoreText.setFormat("VCR OSD Mono", 32);

Expand All @@ -154,15 +162,23 @@ class StoryMenuState extends MusicBeatState {
weekTitleText.alpha = 0.7;

yellowBG = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, FlxColor.WHITE);
if(currentGroup == null){
var text:FlxText = new FlxText();
text.text = "This mod has no weeks!";
text.font = Paths.font("vcr.ttf");
text.alignment = CENTER;
text.borderStyle = OUTLINE;
text.size = 32;
text.antialiasing = Options.getData("antialiasing");
text.screenCenter();
add(text);
return;
}
bgSprite = new FlxSprite(0, 56);
bgSprite.visible = false;

menuCharacters = new FlxTypedGroup<MenuCharacter>();

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

addWeekCharacters();

Expand Down Expand Up @@ -190,6 +206,7 @@ class StoryMenuState extends MusicBeatState {
leftArrow.animation.addByPrefix('idle', "arrow0");
leftArrow.animation.addByPrefix('press', "arrow push", 24, false);
leftArrow.animation.play('idle');
leftArrow.antialiasing = Options.getData("antialiasing");

difficultySprite = new FlxSprite(leftArrow.x + leftArrow.width + 4, leftArrow.y);
difficultySprite.loadGraphic(Paths.image("campaign menu/difficulties/default/normal"));
Expand All @@ -203,6 +220,7 @@ class StoryMenuState extends MusicBeatState {
rightArrow.animation.addByPrefix('press', "arrow push", 24, false);
rightArrow.animation.play('idle');
rightArrow.flipX = true;
rightArrow.antialiasing = Options.getData("antialiasing");

difficultySelectorGroup.add(leftArrow);
difficultySelectorGroup.add(difficultySprite);
Expand Down Expand Up @@ -356,6 +374,9 @@ class StoryMenuState extends MusicBeatState {
var intendedScore:Int = 0;

function changeWeek(change:Int = 0):Void {
if(currentGroup == null){
return;
}
curWeek = FlxMath.wrap(curWeek + change, 0, currentGroup.weeks.length - 1);

var bullShit:Int = 0;
Expand Down Expand Up @@ -462,10 +483,22 @@ class StoryMenuState extends MusicBeatState {
} else
trace('Tried to load json ${Paths.json("week data/" + name)} that doesn\'t exist!', ERROR);
}

public var initWeekList:Array<String>;
function loadGroups():Void {
for (week in CoolUtil.coolTextFile(Paths.txt("storyWeekList")))
loadJSON(week);
#if MODDING_ALLOWED
if(sys.FileSystem.exists("mods/" + Options.getData("curMod") + "/data/storyWeekList.txt")){
initWeekList = CoolUtil.coolTextFileSys("mods/" + Options.getData("curMod") + "/data/storyWeekList.txt");
}
else if(sys.FileSystem.exists("mods/" + Options.getData("curMod") + "/_append/data/storyWeekList.txt")){
initWeekList = CoolUtil.coolTextFileSys("mods/" + Options.getData("curMod") + "/_append/data/storyWeekList.txt");
}
#else
initWeekList = CoolUtil.coolTextFile(Paths.txt('storyWeekList'));
#end
if(initWeekList != null){
for (week in initWeekList)
loadJSON(week);
}

currentGroup = groups[0];
}
Expand Down
6 changes: 4 additions & 2 deletions source/utilities/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,19 @@ class CoolUtil {
return newValue;
}

#if sys
public static function coolTextFileSys(path:String):Array<String> {
#if sys
var daList:Array<String> = File.getContent(path).trim().split('\n');

for (i in 0...daList.length) {
daList[i] = daList[i].trim();
}

return daList;
#else
return coolTextFile(path);
#end
}
#end

public static function coolTextFile(path:String):Array<String> {
if (!Assets.exists(path)) {
Expand Down

0 comments on commit 812df20

Please sign in to comment.