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

Commit

Permalink
Merge pull request #840 from Lucky-56/patch-1
Browse files Browse the repository at this point in the history
REOPENED: #824 replay fix + modchart fix + stage, gf and noteStyle defaults to their corresponding style if none was found in chart
  • Loading branch information
Kade-github authored Jun 15, 2021
2 parents d103f5f + 2acf171 commit 6732276
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 146 deletions.
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
29 changes: 25 additions & 4 deletions source/ModchartState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,18 @@ class ModchartState
function makeAnimatedLuaSprite(spritePath:String,names:Array<String>,prefixes:Array<String>,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);

Expand All @@ -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;
Expand Down Expand Up @@ -345,7 +359,14 @@ class ModchartState

//shaders = new Array<LuaShader>();

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)
{
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
9 changes: 8 additions & 1 deletion source/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading

0 comments on commit 6732276

Please sign in to comment.