From 17db8031c55b7b42d829c96a726468cae703b8b8 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 08:31:50 +0200 Subject: [PATCH 01/17] if no stage is found in chart, default will be chosen by week --- source/PlayState.hx | 17 ++++++++++++++++- source/Song.hx | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index b5107eb2c1..30cd5aa3b1 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -344,7 +344,22 @@ class PlayState extends MusicBeatState dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); } - switch(SONG.stage) + //defaults if no stage was found in chart + + var stageCheck:String = 'stage'; + //i should check if its stage (but this is when none is found in chart anyway) + if (SONG.stage == null) { + switch(storyWeek) + { + case 2: stageCheck = 'halloween'; + case 3: stageCheck = 'philly'; + case 4: stageCheck = 'limo'; + case 5: if (songLowercase == 'winter-horrorland') {stageCheck = 'mallEvil';} else {stageCheck = 'mall';} + case 6: if (songLowercase == 'thorns') {stageCheck = 'schoolEvil';} else {stageCheck = 'school';} + } + } else {stageCheck = SONG.stage;} + + switch(stageCheck) { case 'halloween': { diff --git a/source/Song.hx b/source/Song.hx index 00d8e94138..872fb74e37 100644 --- a/source/Song.hx +++ b/source/Song.hx @@ -35,7 +35,7 @@ class Song public var player2:String = 'dad'; public var gfVersion:String = 'gf'; public var noteStyle:String = 'normal'; - public var stage:String = 'stage'; + public var stage:String = ''; public function new(song, notes, bpm) { @@ -47,8 +47,8 @@ class Song public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong { trace(jsonInput); - - // pre lowercasing the song name (update) + + // pre lowercasing the folder name var folderLowercase = StringTools.replace(folder, " ", "-").toLowerCase(); switch (folderLowercase) { case 'dad-battle': folderLowercase = 'dadbattle'; From e664da2e36f36e5623677f744fd771c56b8b028f Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 13:18:33 +0200 Subject: [PATCH 02/17] clean up code a bit --- source/FreeplayState.hx | 23 +++++---------- source/PlayState.hx | 64 ++++++++++++++++------------------------ source/StoryMenuState.hx | 18 +++++------ 3 files changed, 42 insertions(+), 63 deletions(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 6f7388d135..4fcc985c6f 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -202,27 +202,20 @@ class FreeplayState extends MusicBeatState if (accepted) { - // pre lowercasing the song name (update) - var songLowercase = StringTools.replace(songs[curSelected].songName, " ", "-").toLowerCase(); - switch (songLowercase) { - case 'dad-battle': songLowercase = 'dadbattle'; - case 'philly-nice': songLowercase = 'philly'; - } - // adjusting the highscore song name to be compatible (update) - // would read original scores if we didn't change packages - var songHighscore = StringTools.replace(songs[curSelected].songName, " ", "-"); - switch (songHighscore) { - case 'Dad-Battle': songHighscore = 'Dadbattle'; - case 'Philly-Nice': songHighscore = 'Philly'; + // adjusting the song name to be compatible + var songFormat = StringTools.replace(songs[curSelected].songName, " ", "-"); + switch (songFormat) { + case 'Dad-Battle': songFormat = 'Dadbattle'; + case 'Philly-Nice': songFormat = 'Philly'; } - trace(songLowercase); + trace(songs[curSelected].songName); - var poop:String = Highscore.formatSong(songHighscore, curDifficulty); + var poop:String = Highscore.formatSong(songFormat, curDifficulty); trace(poop); - PlayState.SONG = Song.loadFromJson(poop, songLowercase); + PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName); PlayState.isStoryMode = false; PlayState.storyDifficulty = curDifficulty; PlayState.storyWeek = songs[curSelected].week; diff --git a/source/PlayState.hx b/source/PlayState.hx index 30cd5aa3b1..27d4d37aa5 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -309,7 +309,7 @@ class PlayState extends MusicBeatState persistentDraw = true; if (SONG == null) - SONG = Song.loadFromJson('tutorial'); + SONG = Song.loadFromJson('tutorial', 'tutorial'); Conductor.mapBPMChanges(SONG); Conductor.changeBPM(SONG.bpm); @@ -345,9 +345,8 @@ class PlayState extends MusicBeatState } //defaults if no stage was found in chart - var stageCheck:String = 'stage'; - //i should check if its stage (but this is when none is found in chart anyway) + if (SONG.stage == null) { switch(storyWeek) { @@ -356,6 +355,7 @@ class PlayState extends MusicBeatState case 4: stageCheck = 'limo'; case 5: if (songLowercase == 'winter-horrorland') {stageCheck = 'mallEvil';} else {stageCheck = 'mall';} case 6: if (songLowercase == 'thorns') {stageCheck = 'schoolEvil';} else {stageCheck = 'school';} + //i should check if its stage (but this is when none is found in chart anyway) } } else {stageCheck = SONG.stage;} @@ -1093,17 +1093,11 @@ class PlayState extends MusicBeatState senpaiEvil.updateHitbox(); senpaiEvil.screenCenter(); - // pre lowercasing the song name (schoolIntro) - var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); - switch (songLowercase) { - case 'dad-battle': songLowercase = 'dadbattle'; - case 'philly-nice': songLowercase = 'philly'; - } - if (songLowercase == 'roses' || songLowercase == 'thorns') + if (PlayState.SONG.song.toLowerCase() == 'roses' || PlayState.SONG.song.toLowerCase() == 'thorns') { remove(black); - if (songLowercase == 'thorns') + if (PlayState.SONG.song.toLowerCase() == 'thorns') { add(red); } @@ -1123,7 +1117,7 @@ class PlayState extends MusicBeatState { inCutscene = true; - if (songLowercase == 'thorns') + if (PlayState.SONG.song.toLowerCase() == 'thorns') { add(senpaiEvil); senpaiEvil.alpha = 0; @@ -1396,14 +1390,15 @@ class PlayState extends MusicBeatState var playerCounter:Int = 0; - // pre lowercasing the song name (generateSong) - var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); - switch (songLowercase) { - case 'dad-battle': songLowercase = 'dadbattle'; - case 'philly-nice': songLowercase = 'philly'; - } // Per song offset check #if windows + // pre lowercasing the song name (generateSong) + var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + switch (songLowercase) { + case 'dad-battle': songLowercase = 'dadbattle'; + case 'philly-nice': songLowercase = 'philly'; + } + var songPath = 'assets/data/' + songLowercase + '/'; for(file in sys.FileSystem.readDirectory(songPath)) @@ -2532,30 +2527,20 @@ class PlayState extends MusicBeatState } else { - var difficulty:String = ""; - - if (storyDifficulty == 0) - difficulty = '-easy'; + + // adjusting the song name to be compatible + var songFormat = StringTools.replace(PlayState.storyPlaylist[0], " ", "-"); + switch (songFormat) { + case 'Dad-Battle': songFormat = 'Dadbattle'; + case 'Philly-Nice': songFormat = 'Philly'; + } - if (storyDifficulty == 2) - difficulty = '-hard'; + var poop:String = Highscore.formatSong(songFormat, storyDifficulty); trace('LOADING NEXT SONG'); - // pre lowercasing the next story song name - var nextSongLowercase = StringTools.replace(PlayState.storyPlaylist[0], " ", "-").toLowerCase(); - switch (nextSongLowercase) { - case 'dad-battle': nextSongLowercase = 'dadbattle'; - case 'philly-nice': nextSongLowercase = 'philly'; - } - trace(nextSongLowercase + difficulty); + trace(poop); - // pre lowercasing the song name (endSong) - var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); - switch (songLowercase) { - case 'dad-battle': songLowercase = 'dadbattle'; - case 'philly-nice': songLowercase = 'philly'; - } - if (songLowercase == 'eggnog') + if (PlayState.storyPlaylist[0].toLowerCase() == 'eggnog') { var blackShit:FlxSprite = new FlxSprite(-FlxG.width * FlxG.camera.zoom, -FlxG.height * FlxG.camera.zoom).makeGraphic(FlxG.width * 3, FlxG.height * 3, FlxColor.BLACK); @@ -2570,7 +2555,8 @@ class PlayState extends MusicBeatState FlxTransitionableState.skipNextTransOut = true; prevCamFollow = camFollow; - PlayState.SONG = Song.loadFromJson(nextSongLowercase + difficulty, PlayState.storyPlaylist[0]); + + PlayState.SONG = Song.loadFromJson(poop, PlayState.storyPlaylist[0]); FlxG.sound.music.stop(); LoadingState.loadAndSwitchState(new PlayState()); diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 501cf2badf..bf80753a61 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -285,19 +285,19 @@ class StoryMenuState extends MusicBeatState PlayState.isStoryMode = true; selectedWeek = true; - var diffic = ""; - switch (curDifficulty) - { - case 0: - diffic = '-easy'; - case 2: - diffic = '-hard'; + PlayState.storyDifficulty = curDifficulty; + + // adjusting the song name to be compatible + var songFormat = StringTools.replace(PlayState.storyPlaylist[0], " ", "-"); + switch (songFormat) { + case 'Dad-Battle': songFormat = 'Dadbattle'; + case 'Philly-Nice': songFormat = 'Philly'; } - PlayState.storyDifficulty = curDifficulty; + var poop:String = Highscore.formatSong(songFormat, curDifficulty); - PlayState.SONG = Song.loadFromJson(StringTools.replace(PlayState.storyPlaylist[0]," ", "-").toLowerCase() + diffic, StringTools.replace(PlayState.storyPlaylist[0]," ", "-").toLowerCase()); + PlayState.SONG = Song.loadFromJson(poop, PlayState.storyPlaylist[0]); PlayState.storyWeek = curWeek; PlayState.campaignScore = 0; new FlxTimer().start(1, function(tmr:FlxTimer) From c31f76e37ae63504b07e8675708e20c54c365d72 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 13:19:29 +0200 Subject: [PATCH 03/17] fixed replay + updated replay to 1.1 replay 1.1 still has 1.0 support --- source/LoadReplayState.hx | 16 +++++++++++++--- source/Replay.hx | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source/LoadReplayState.hx b/source/LoadReplayState.hx index 1be8679e10..a1408261d5 100644 --- a/source/LoadReplayState.hx +++ b/source/LoadReplayState.hx @@ -148,9 +148,19 @@ class LoadReplayState extends MusicBeatState PlayState.loadRep = true; - var poop:String = Highscore.formatSong(PlayState.rep.replay.songName.toLowerCase(), PlayState.rep.replay.songDiff); - - PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName.toLowerCase()); + // adjusting the song name to be compatible + var songFormat = StringTools.replace(PlayState.rep.replay.songName, " ", "-"); + switch (songFormat) { + case 'Dad-Battle': songFormat = 'Dadbattle'; + case 'Philly-Nice': songFormat = 'Philly'; + // Replay v1.0 support + case 'dad-battle': songFormat = 'Dadbattle'; + case 'philly-nice': songFormat = 'Philly'; + } + + var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff); + + PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName); PlayState.isStoryMode = false; PlayState.storyDifficulty = PlayState.rep.replay.songDiff; PlayState.storyWeek = getWeekNumbFromSong(PlayState.rep.replay.songName); diff --git a/source/Replay.hx b/source/Replay.hx index bf43d776ea..c6e91ba848 100644 --- a/source/Replay.hx +++ b/source/Replay.hx @@ -24,7 +24,7 @@ typedef ReplayJSON = class Replay { - public static var version:String = "1.0"; // replay file version + public static var version:String = "1.1"; // replay file version public var path:String = ""; public var replay:ReplayJSON; @@ -56,7 +56,7 @@ class Replay public function SaveReplay(notearray:Array) { var json = { - "songName": PlayState.SONG.song.toLowerCase(), + "songName": PlayState.SONG.song, "songDiff": PlayState.storyDifficulty, "noteSpeed": (FlxG.save.data.scrollSpeed > 1 ? FlxG.save.data.scrollSpeed : PlayState.SONG.speed), "isDownscroll": FlxG.save.data.downscroll, From 10cb42f98c6258bce0088df0bbab76b3661dd7c3 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 13:48:56 +0200 Subject: [PATCH 04/17] made code more 'user friendly' for modders as in for modders to copy paste easily --- source/PlayState.hx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 27d4d37aa5..7166a4cadd 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1093,11 +1093,11 @@ class PlayState extends MusicBeatState senpaiEvil.updateHitbox(); senpaiEvil.screenCenter(); - if (PlayState.SONG.song.toLowerCase() == 'roses' || PlayState.SONG.song.toLowerCase() == 'thorns') + if (StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'roses' || StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'thorns') { remove(black); - if (PlayState.SONG.song.toLowerCase() == 'thorns') + if (StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'thorns') { add(red); } @@ -1117,7 +1117,7 @@ class PlayState extends MusicBeatState { inCutscene = true; - if (PlayState.SONG.song.toLowerCase() == 'thorns') + if (StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'thorns') { add(senpaiEvil); senpaiEvil.alpha = 0; @@ -2540,7 +2540,7 @@ class PlayState extends MusicBeatState trace('LOADING NEXT SONG'); trace(poop); - if (PlayState.storyPlaylist[0].toLowerCase() == 'eggnog') + if (StringTools.replace(PlayState.storyPlaylist[0], " ", "-").toLowerCase() == 'eggnog') { var blackShit:FlxSprite = new FlxSprite(-FlxG.width * FlxG.camera.zoom, -FlxG.height * FlxG.camera.zoom).makeGraphic(FlxG.width * 3, FlxG.height * 3, FlxColor.BLACK); From 4b1fbb40ac55f5e26b0d7ded0a344a3dc49a219d Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 16:39:51 +0200 Subject: [PATCH 05/17] if no gf is found in chart, default will be chosen by week --- source/PlayState.hx | 15 +++++++++++++-- source/Song.hx | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 7166a4cadd..0e72d6b3b6 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -738,9 +738,20 @@ class PlayState extends MusicBeatState add(stageCurtains); } } - var gfVersion:String = 'gf'; - switch (SONG.gfVersion) + //defaults if no gf was found in chart + var gfCheck:String = 'gf'; + + if (SONG.gfVersion == null) { + switch(storyWeek) + { + case 4: gfCheck = 'gf-car'; + case 5: gfCheck = 'gf-christmas'; + case 6: gfCheck = 'gf-pixel'; + } + } else {gfCheck = SONG.gfVersion;} + + switch (gfCheck) { case 'gf-car': gfVersion = 'gf-car'; diff --git a/source/Song.hx b/source/Song.hx index 872fb74e37..e81b397111 100644 --- a/source/Song.hx +++ b/source/Song.hx @@ -33,7 +33,7 @@ class Song public var player1:String = 'bf'; public var player2:String = 'dad'; - public var gfVersion:String = 'gf'; + public var gfVersion:String = ''; public var noteStyle:String = 'normal'; public var stage:String = ''; From 054ef8bf1b4aa0c7702bf4a38feefac9179b88b2 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 16:40:09 +0200 Subject: [PATCH 06/17] if no noteStyle is found in chart, default will be chosen by week --- source/PlayState.hx | 9 ++++++++- source/Song.hx | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 0e72d6b3b6..baa087ae51 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1512,7 +1512,14 @@ class PlayState extends MusicBeatState // FlxG.log.add(i); var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y); - switch (SONG.noteStyle) + //defaults if no noteStyle was found in chart + var noteTypeCheck:String = 'normal'; + + if (SONG.noteStyle == null) { + switch(storyWeek) { case 6: noteTypeCheck = 'pixel'; } + } else {noteTypeCheck = SONG.noteStyle;} + + switch (noteTypeCheck) { case 'pixel': babyArrow.loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels'), true, 17, 17); diff --git a/source/Song.hx b/source/Song.hx index e81b397111..532907906c 100644 --- a/source/Song.hx +++ b/source/Song.hx @@ -34,7 +34,7 @@ class Song public var player1:String = 'bf'; public var player2:String = 'dad'; public var gfVersion:String = ''; - public var noteStyle:String = 'normal'; + public var noteStyle:String = ''; public var stage:String = ''; public function new(song, notes, bpm) From 105ccaf38a2d1d8229ae09373c6bf3fed21369e6 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 17:14:28 +0200 Subject: [PATCH 07/17] I was being dumb and forgot to compile the first time --- source/PlayState.hx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index baa087ae51..fae61e24e2 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -751,19 +751,20 @@ class PlayState extends MusicBeatState } } else {gfCheck = SONG.gfVersion;} + var curGf:String = ''; switch (gfCheck) { case 'gf-car': - gfVersion = 'gf-car'; + curGf = 'gf-car'; case 'gf-christmas': - gfVersion = 'gf-christmas'; + curGf = 'gf-christmas'; case 'gf-pixel': - gfVersion = 'gf-pixel'; + curGf = 'gf-pixel'; default: - gfVersion = 'gf'; + curGf = 'gf'; } - gf = new Character(400, 130, gfVersion); + gf = new Character(400, 130, curGf); gf.scrollFactor.set(0.95, 0.95); dad = new Character(100, 100, SONG.player2); From 9425a742850286a63188afdc2b68a3107052061d Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 17:26:25 +0200 Subject: [PATCH 08/17] right after not compiling, I didn't test gf + notes --- source/Note.hx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/Note.hx b/source/Note.hx index 7e29d7bb42..05c6707516 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -59,7 +59,14 @@ class Note extends FlxSprite var daStage:String = PlayState.curStage; - switch (PlayState.SONG.noteStyle) + //defaults if no noteStyle was found in chart + var noteTypeCheck:String = 'normal'; + + if (PlayState.SONG.noteStyle == null) { + switch(storyWeek) { case 6: noteTypeCheck = 'pixel'; } + } else {noteTypeCheck = SONG.noteStyle;} + + switch (noteTypeCheck) { case 'pixel': loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels','week6'), true, 17, 17); From 0dc5ff5df5b71ba1143e46b6c30aa3433a5a54d6 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 19:08:48 +0200 Subject: [PATCH 09/17] Replay with 'broken' charts now fully fixed --- source/LoadReplayState.hx | 2 +- source/Note.hx | 4 ++-- source/PlayState.hx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/LoadReplayState.hx b/source/LoadReplayState.hx index a1408261d5..f67046eca0 100644 --- a/source/LoadReplayState.hx +++ b/source/LoadReplayState.hx @@ -102,7 +102,7 @@ class LoadReplayState extends MusicBeatState for (i in 0...songs.length) { var pog:FreeplayState.SongMetadata = songs[i]; - if (pog.songName.toLowerCase() == songName) + if (pog.songName == songName) week = pog.week; } return week; diff --git a/source/Note.hx b/source/Note.hx index 05c6707516..1eb3977409 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -63,8 +63,8 @@ class Note extends FlxSprite var noteTypeCheck:String = 'normal'; if (PlayState.SONG.noteStyle == null) { - switch(storyWeek) { case 6: noteTypeCheck = 'pixel'; } - } else {noteTypeCheck = SONG.noteStyle;} + switch(PlayState.storyWeek) {case 6: noteTypeCheck = 'pixel';} + } else {noteTypeCheck = PlayState.SONG.noteStyle;} switch (noteTypeCheck) { diff --git a/source/PlayState.hx b/source/PlayState.hx index fae61e24e2..fdcd588fdd 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1517,7 +1517,7 @@ class PlayState extends MusicBeatState var noteTypeCheck:String = 'normal'; if (SONG.noteStyle == null) { - switch(storyWeek) { case 6: noteTypeCheck = 'pixel'; } + switch(storyWeek) {case 6: noteTypeCheck = 'pixel';} } else {noteTypeCheck = SONG.noteStyle;} switch (noteTypeCheck) From a0b01af0ce897697130f835ff48ba7654685105f Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Fri, 11 Jun 2021 19:12:05 +0200 Subject: [PATCH 10/17] fix Replay Details not showing just took an extra \n at the end for some reason --- source/LoadReplayState.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/LoadReplayState.hx b/source/LoadReplayState.hx index f67046eca0..afcdfd4900 100644 --- a/source/LoadReplayState.hx +++ b/source/LoadReplayState.hx @@ -80,7 +80,7 @@ class LoadReplayState extends MusicBeatState } - versionShit = new FlxText(5, FlxG.height - 34, 0, "Replay Loader (ESCAPE TO GO BACK)\nNOTICE!!!! Replays are in a beta stage, and they are probably not 100% correct. expect misses and other stuff that isn't there!", 12); + versionShit = new FlxText(5, FlxG.height - 34, 0, "Replay Loader (ESCAPE TO GO BACK)\nNOTICE!!!! Replays are in a beta stage, and they are probably not 100% correct. expect misses and other stuff that isn't there!\n", 12); versionShit.scrollFactor.set(); versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); add(versionShit); @@ -187,7 +187,7 @@ class LoadReplayState extends MusicBeatState var rep:Replay = Replay.LoadReplay(actualNames[curSelected]); - poggerDetails.text = "Replay Details - \nDate Created: " + rep.replay.timestamp + "\nSong: " + rep.replay.songName + "\nReplay Version: " + (rep.replay.replayGameVer != Replay.version ? "OUTDATED" : "Latest"); + poggerDetails.text = "Replay Details - \nDate Created: " + rep.replay.timestamp + "\nSong: " + rep.replay.songName + "\nReplay Version: " + rep.replay.replayGameVer + ' (' + (rep.replay.replayGameVer != Replay.version ? "OUTDATED but still usable" : "Latest") + ')\n'; // selector.y = (70 * curSelected) + 30; From a9b7959f1bdbd5cdb94a609ec899c721599998f9 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Sat, 12 Jun 2021 10:53:42 +0200 Subject: [PATCH 11/17] when no song is found in replay menu it now says no song found instead of tutorial --- source/Replay.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Replay.hx b/source/Replay.hx index c6e91ba848..fd7e851aa3 100644 --- a/source/Replay.hx +++ b/source/Replay.hx @@ -32,7 +32,7 @@ class Replay { this.path = path; replay = { - songName: "Tutorial", + songName: "No Song Found", songDiff: 1, noteSpeed: 1.5, isDownscroll: false, From ecbd82668e1b20a126a000153165239d275544ab Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Sat, 12 Jun 2021 19:05:33 +0200 Subject: [PATCH 12/17] no replay? then don't tell me the time --- source/Replay.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Replay.hx b/source/Replay.hx index fd7e851aa3..f57e1abded 100644 --- a/source/Replay.hx +++ b/source/Replay.hx @@ -38,7 +38,7 @@ class Replay isDownscroll: false, songNotes: [], replayGameVer: version, - timestamp: Date.now() + timestamp: "-" }; } From c226c62d5242f6733bb1c85f0b980ceb8d12efb5 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Sat, 12 Jun 2021 19:38:53 +0200 Subject: [PATCH 13/17] apparently I can't do that --- source/Replay.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Replay.hx b/source/Replay.hx index f57e1abded..954130bf47 100644 --- a/source/Replay.hx +++ b/source/Replay.hx @@ -38,7 +38,7 @@ class Replay isDownscroll: false, songNotes: [], replayGameVer: version, - timestamp: "-" + timestamp: Date.now() }; } From c628766fc0749047fa3deac0dc0bd0e664e68618 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Sat, 12 Jun 2021 19:45:58 +0200 Subject: [PATCH 14/17] formatting --- source/Replay.hx | 102 +++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/source/Replay.hx b/source/Replay.hx index 954130bf47..3eb77a7e48 100644 --- a/source/Replay.hx +++ b/source/Replay.hx @@ -13,79 +13,79 @@ import openfl.utils.Dictionary; typedef ReplayJSON = { - public var replayGameVer:String; - public var timestamp:Date; - public var songName:String; - public var songDiff:Int; - public var songNotes:Array; + public var replayGameVer:String; + public var timestamp:Date; + public var songName:String; + public var songDiff:Int; + public var songNotes:Array; public var noteSpeed:Float; public var isDownscroll:Bool; } class Replay { - public static var version:String = "1.1"; // replay file version + public static var version:String = "1.1"; // replay file version - public var path:String = ""; - public var replay:ReplayJSON; - public function new(path:String) - { - this.path = path; - replay = { - songName: "No Song Found", - songDiff: 1, + public var path:String = ""; + public var replay:ReplayJSON; + public function new(path:String) + { + this.path = path; + replay = { + songName: "No Song Found", + songDiff: 1, noteSpeed: 1.5, isDownscroll: false, songNotes: [], - replayGameVer: version, + replayGameVer: version, timestamp: Date.now() - }; - } + }; + } - public static function LoadReplay(path:String):Replay + public static function LoadReplay(path:String):Replay { - var rep:Replay = new Replay(path); + var rep:Replay = new Replay(path); - rep.LoadFromJSON(); + rep.LoadFromJSON(); - trace('basic replay data:\nSong Name: ' + rep.replay.songName + '\nSong Diff: ' + rep.replay.songDiff + '\nNotes Length: ' + rep.replay.songNotes.length); + trace('basic replay data:\nSong Name: ' + rep.replay.songName + '\nSong Diff: ' + rep.replay.songDiff + '\nNotes Length: ' + rep.replay.songNotes.length); - return rep; - } + return rep; + } - public function SaveReplay(notearray:Array) - { - var json = { - "songName": PlayState.SONG.song, - "songDiff": PlayState.storyDifficulty, + public function SaveReplay(notearray:Array) + { + var json = { + "songName": PlayState.SONG.song, + "songDiff": PlayState.storyDifficulty, "noteSpeed": (FlxG.save.data.scrollSpeed > 1 ? FlxG.save.data.scrollSpeed : PlayState.SONG.speed), "isDownscroll": FlxG.save.data.downscroll, "songNotes": notearray, - "timestamp": Date.now(), - "replayGameVer": version - }; + "timestamp": Date.now(), + "replayGameVer": version + }; - var data:String = Json.stringify(json); + var data:String = Json.stringify(json); - #if sys - File.saveContent("assets/replays/replay-" + PlayState.SONG.song + "-time" + Date.now().getTime() + ".kadeReplay", data); - #end - } + #if sys + File.saveContent("assets/replays/replay-" + PlayState.SONG.song + "-time" + Date.now().getTime() + ".kadeReplay", data); + #end + } - public function LoadFromJSON() - { - #if sys - trace('loading ' + Sys.getCwd() + 'assets/replays/' + path + ' replay...'); - try - { - var repl:ReplayJSON = cast Json.parse(File.getContent(Sys.getCwd() + "assets/replays/" + path)); - replay = repl; - } - catch(e) - { - trace('failed!\n' + e.message); - } - #end - } + public function LoadFromJSON() + { + if sys + trace('loading ' + Sys.getCwd() + 'assets/replays/' + path + ' replay...'); + try + { + var repl:ReplayJSON = cast Json.parse(File.getContent(Sys.getCwd() + "assets/replays/" + path)); + replay = repl; + } + catch(e) + { + trace('failed!\n' + e.message); + } + #end + } } From d6dbdbf21089f734f8e880d469ebe13f6ca926e6 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Sun, 13 Jun 2021 11:36:16 +0200 Subject: [PATCH 15/17] big oopsie --- source/Replay.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Replay.hx b/source/Replay.hx index 3eb77a7e48..c1a89faa81 100644 --- a/source/Replay.hx +++ b/source/Replay.hx @@ -74,7 +74,7 @@ class Replay public function LoadFromJSON() { - if sys + #if sys trace('loading ' + Sys.getCwd() + 'assets/replays/' + path + ' replay...'); try { From 5d7e6811b092f008378560739768cb65848e57d1 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Tue, 15 Jun 2021 00:00:14 +0200 Subject: [PATCH 16/17] if I find ONE more issue with Spaces... --- source/ModchartState.hx | 29 +++++++++++++++++++++++++---- source/PauseSubState.hx | 9 ++++++++- source/PlayState.hx | 24 ++++++++++++++++-------- 3 files changed, 49 insertions(+), 13 deletions(-) diff --git a/source/ModchartState.hx b/source/ModchartState.hx index 1203ea52e3..dd00e06845 100644 --- a/source/ModchartState.hx +++ b/source/ModchartState.hx @@ -255,11 +255,18 @@ class ModchartState function makeAnimatedLuaSprite(spritePath:String,names:Array,prefixes:Array,startAnim:String, id:String) { #if sys - var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + PlayState.SONG.song.toLowerCase() + '/' + spritePath + ".png"); + // pre lowercasing the song name (makeAnimatedLuaSprite) + var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + switch (songLowercase) { + case 'dad-battle': songLowercase = 'dadbattle'; + case 'philly-nice': songLowercase = 'philly'; + } + + var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + songLowercase + '/' + spritePath + ".png"); var sprite:FlxSprite = new FlxSprite(0,0); - sprite.frames = FlxAtlasFrames.fromSparrow(FlxGraphic.fromBitmapData(data), Sys.getCwd() + "assets/data/" + PlayState.SONG.song.toLowerCase() + "/" + spritePath + ".xml"); + sprite.frames = FlxAtlasFrames.fromSparrow(FlxGraphic.fromBitmapData(data), Sys.getCwd() + "assets/data/" + songLowercase + "/" + spritePath + ".xml"); trace(sprite.frames.frames.length); @@ -282,7 +289,14 @@ class ModchartState function makeLuaSprite(spritePath:String,toBeCalled:String, drawBehind:Bool) { #if sys - var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + PlayState.SONG.song.toLowerCase() + '/' + spritePath + ".png"); + // pre lowercasing the song name (makeLuaSprite) + var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + switch (songLowercase) { + case 'dad-battle': songLowercase = 'dadbattle'; + case 'philly-nice': songLowercase = 'philly'; + } + + var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + songLowercase + '/' + spritePath + ".png"); var sprite:FlxSprite = new FlxSprite(0,0); var imgWidth:Float = FlxG.width / data.width; @@ -345,7 +359,14 @@ class ModchartState //shaders = new Array(); - var result = LuaL.dofile(lua, Paths.lua(PlayState.SONG.song.toLowerCase() + "/modchart")); // execute le file + // pre lowercasing the song name (new) + var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + switch (songLowercase) { + case 'dad-battle': songLowercase = 'dadbattle'; + case 'philly-nice': songLowercase = 'philly'; + } + + var result = LuaL.dofile(lua, Paths.lua(songLowercase + "/modchart")); // execute le file if (result != 0) { diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index e59e72b39f..ab9b1a2a12 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -104,7 +104,14 @@ class PauseSubState extends MusicBeatSubstate var rightP = controls.RIGHT_P; var accepted = controls.ACCEPT; var oldOffset:Float = 0; - var songPath = 'assets/data/' + PlayState.SONG.song.toLowerCase() + '/'; + + // pre lowercasing the song name (update) + var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + switch (songLowercase) { + case 'dad-battle': songLowercase = 'dadbattle'; + case 'philly-nice': songLowercase = 'philly'; + } + var songPath = 'assets/data/' + songLowercase + '/'; if (upP) { diff --git a/source/PlayState.hx b/source/PlayState.hx index fdcd588fdd..726854cf3d 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -238,10 +238,10 @@ class PlayState extends MusicBeatState // pre lowercasing the song name (create) var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); - switch (songLowercase) { - case 'dad-battle': songLowercase = 'dadbattle'; - case 'philly-nice': songLowercase = 'philly'; - } + switch (songLowercase) { + case 'dad-battle': songLowercase = 'dadbattle'; + case 'philly-nice': songLowercase = 'philly'; + } #if windows executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart")); @@ -975,6 +975,8 @@ class PlayState extends MusicBeatState scoreTxt = new FlxText(FlxG.width / 2 - 235, healthBarBG.y + 50, 0, "", 20); if (!FlxG.save.data.accuracyDisplay) scoreTxt.x = healthBarBG.x + healthBarBG.width / 2; + if (FlxG.save.data.healthDisplay) + scoreTxt.x += -120; scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); scoreTxt.scrollFactor.set(); if (offsetTesting) @@ -1190,10 +1192,16 @@ class PlayState extends MusicBeatState #if windows + // pre lowercasing the song name (startCountdown) + var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + switch (songLowercase) { + case 'dad-battle': songLowercase = 'dadbattle'; + case 'philly-nice': songLowercase = 'philly'; + } if (executeModchart) { luaModchart = ModchartState.createModchartState(); - luaModchart.executeState('start',[PlayState.SONG.song]); + luaModchart.executeState('start',[songLowercase]); } #end @@ -1845,9 +1853,9 @@ class PlayState extends MusicBeatState super.update(elapsed); - scoreTxt.text = Ratings.CalculateRanking(songScore,songScoreDef,nps,maxNPS,accuracy); - if (!FlxG.save.data.accuracyDisplay) - scoreTxt.text = "Score: " + songScore; + var healthInt:Int = Std.int(health * 50); + + scoreTxt.text = Ratings.CalculateRanking(songScore,songScoreDef,nps,maxNPS,healthInt,accuracy); if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause) { From 2acf1719c262dfa6a951df1a3aaf26c73f6c4043 Mon Sep 17 00:00:00 2001 From: Lucky56 <55949451+Lucky-56@users.noreply.github.com> Date: Tue, 15 Jun 2021 01:22:20 +0200 Subject: [PATCH 17/17] how tf did they get here --- source/PlayState.hx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 726854cf3d..a59c10e2a5 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -975,8 +975,6 @@ class PlayState extends MusicBeatState scoreTxt = new FlxText(FlxG.width / 2 - 235, healthBarBG.y + 50, 0, "", 20); if (!FlxG.save.data.accuracyDisplay) scoreTxt.x = healthBarBG.x + healthBarBG.width / 2; - if (FlxG.save.data.healthDisplay) - scoreTxt.x += -120; scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); scoreTxt.scrollFactor.set(); if (offsetTesting) @@ -1853,9 +1851,9 @@ class PlayState extends MusicBeatState super.update(elapsed); - var healthInt:Int = Std.int(health * 50); - - scoreTxt.text = Ratings.CalculateRanking(songScore,songScoreDef,nps,maxNPS,healthInt,accuracy); + scoreTxt.text = Ratings.CalculateRanking(songScore,songScoreDef,nps,maxNPS,accuracy); + if (!FlxG.save.data.accuracyDisplay) + scoreTxt.text = "Score: " + songScore; if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause) {