Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

REOPENED: #824 replay fix + modchart fix + stage, gf and noteStyle defaults to their corresponding style if none was found in chart #840

Merged
merged 19 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 15 additions & 5 deletions source/LoadReplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
// 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';
}

PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName.toLowerCase());
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);
Expand All @@ -177,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;

Expand Down
9 changes: 8 additions & 1 deletion source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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(PlayState.storyWeek) {case 6: noteTypeCheck = 'pixel';}
} else {noteTypeCheck = PlayState.SONG.noteStyle;}

switch (noteTypeCheck)
{
case 'pixel':
loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels','week6'), true, 17, 17);
Expand Down
112 changes: 66 additions & 46 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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';

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';}
//i should check if its stage (but this is when none is found in chart anyway)
}
} else {stageCheck = SONG.stage;}

switch(stageCheck)
{
case 'halloween':
{
Expand Down Expand Up @@ -723,21 +738,33 @@ 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;}

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);
Expand Down Expand Up @@ -1078,17 +1105,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 (StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'roses' || StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'thorns')
{
remove(black);

if (songLowercase == 'thorns')
if (StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'thorns')
{
add(red);
}
Expand All @@ -1108,7 +1129,7 @@ class PlayState extends MusicBeatState
{
inCutscene = true;

if (songLowercase == 'thorns')
if (StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'thorns')
{
add(senpaiEvil);
senpaiEvil.alpha = 0;
Expand Down Expand Up @@ -1381,14 +1402,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))
Expand Down Expand Up @@ -1491,7 +1513,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);
Expand Down Expand Up @@ -2517,30 +2546,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 (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);
Expand All @@ -2555,7 +2574,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());
Expand Down
Loading