beta offset calculations

This commit is contained in:
Yoshman29
2022-10-05 13:46:34 +02:00
parent 661d292290
commit 69127af6f7
250 changed files with 754 additions and 575 deletions
+1 -1
View File
@@ -1018,7 +1018,7 @@ class ChartingState extends MusicBeatState
function loadJson(song:String):Void
{
PlayState.SONG = Song.loadFromJson(song.toLowerCase(), song.toLowerCase());
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase(), CoolUtil.difficultyString());
FlxG.resetState();
}
+8
View File
@@ -1,6 +1,7 @@
package;
import lime.utils.Assets;
import flixel.animation.FlxAnimation;
using StringTools;
@@ -22,4 +23,11 @@ class CoolUtil
{
return [for (i in min...max) i];
}
public static function switchAnimFrames(anim1:FlxAnimation, anim2:FlxAnimation) {
if (anim1 == null || anim2 == null) return;
var old = anim1.frames;
anim1.frames = anim2.frames;
anim2.frames = old;
}
}
+43 -2
View File
@@ -23,12 +23,12 @@ class Paths
currentLevel = name.toLowerCase();
}
static function getPath(file:String, type:AssetType, library:Null<String>)
static function getPath(file:String, type:AssetType, library:Null<String>, skipModsVerification:Bool = false)
{
if (library != null && library.startsWith("mods/")) {
file = file.toLowerCase();
library = library.toLowerCase();
} else if (ModsFolder.currentModFolder != null) {
} else if (!skipModsVerification && ModsFolder.currentModFolder != null) {
var modPath = getPath(file, type, 'mods/${ModsFolder.currentModFolder}');
if (OpenFlAssets.exists(modPath)) return modPath;
}
@@ -115,6 +115,27 @@ class Paths
return getPath('images/$key.png', IMAGE, library);
}
static public function chart(song:String, ?difficulty:String = "normal"):String {
difficulty = difficulty.toLowerCase();
song = song.toLowerCase();
var difficultyEnd = (difficulty == "normal") ? "" : '-$difficulty';
// charts/your-song/hard.json
var p = getPath('charts/$song/$difficulty.json', TEXT, null);
if (OpenFlAssets.exists(p)) return p;
// charts/your-song/your-song-hard.json
var p2 = getPath('charts/$song/$song$difficultyEnd.json', TEXT, null);
if (OpenFlAssets.exists(p2)) return p2;
// data/your-song/your-song-hard.json (default old format)
p2 = json('$song/$song$difficultyEnd');
if (OpenFlAssets.exists(p2)) return p2;
return p; // returns the normal one so that it shows the correct path in the error message.
}
inline static public function font(key:String)
{
return 'assets/fonts/$key';
@@ -129,4 +150,24 @@ class Paths
{
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library));
}
inline static public function getFolderContent(key:String, includeSource:Bool = false, ?library:String):Array<String> {
// designed to work both on windows and web
while(key.charAt(key.length-1) == "/") key.substr(0, key.length-1);
var path = getPath('$key/.foldercontent', TEXT, library);
var content:Array<String> = [];
if (OpenFlAssets.exists(path)) {
var text = OpenFlAssets.getText(path);
for(e in text.split("\n")) content.push(e.trim());
}
if (includeSource) {
var path = getPath('$key/.foldercontent', TEXT, library, true);
if (OpenFlAssets.exists(path)) {
var text = OpenFlAssets.getText(path);
for(e in text.split("\n")) content.push(e.trim());
}
}
return content;
}
}
+4 -18
View File
@@ -38,9 +38,11 @@ class Song
this.bpm = bpm;
}
public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
public static function loadFromJson(songName:String, ?difficulty:String = "normal"):SwagSong
{
var rawJson = Assets.getText(Paths.json(folder.toLowerCase() + '/' + jsonInput.toLowerCase())).trim();
var assetPath = Paths.chart(songName, difficulty);
PlayState.fromMods = !assetPath.startsWith("mods");
var rawJson = Assets.getText(assetPath).trim();
while (!rawJson.endsWith("}"))
{
@@ -48,22 +50,6 @@ class Song
// LOL GOING THROUGH THE BULLSHIT TO CLEAN IDK WHATS STRANGE
}
// FIX THE CASTING ON WINDOWS/NATIVE
// Windows???
// trace(songData);
// trace('LOADED FROM JSON: ' + songData.notes);
/*
for (i in 0...songData.notes.length)
{
trace('LOADED FROM JSON: ' + songData.notes[i].sectionNotes);
// songData.notes[i].sectionNotes = songData.notes[i].sectionNotes
}
daNotes = songData.notes;
daSong = songData.song;
daBpm = songData.bpm; */
return parseJSONshit(rawJson);
}
File diff suppressed because it is too large Load Diff
+10 -14
View File
@@ -48,12 +48,16 @@ using StringTools;
class PlayState extends MusicBeatState
{
/**
* SONG METADATA
*/
public static var curStage:String = '';
public static var SONG:SwagSong;
public static var isStoryMode:Bool = false;
public static var storyWeek:Int = 0;
public static var storyPlaylist:Array<String> = [];
public static var storyDifficulty:Int = 1;
public static var fromMods:Bool = false;
var halloweenLevel:Bool = false;
@@ -133,7 +137,7 @@ class PlayState extends MusicBeatState
persistentDraw = true;
if (SONG == null)
SONG = Song.loadFromJson('tutorial');
SONG = Song.loadFromJson('tutorial', 'normal');
Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm);
@@ -920,12 +924,9 @@ class PlayState extends MusicBeatState
#end
}
var addedNote:Bool = false;
while(unspawnNotes[0] != null && unspawnNotes[0].strumTime - Conductor.songPosition < 1500) {
addedNote = true;
while(unspawnNotes[0] != null && unspawnNotes[0].strumTime - Conductor.songPosition < 1500)
notes.add(unspawnNotes.shift());
}
if (addedNote) notes.sort(function(i, p1, p2) {return sortByShit(p1, p2);});
if (generatedMusic)
{
@@ -1001,13 +1002,8 @@ class PlayState extends MusicBeatState
}
else
{
var difficulty:String = "";
if (storyDifficulty == 0)
difficulty = '-easy';
if (storyDifficulty == 2)
difficulty = '-hard';
// TODO: NOT INT DIFFICULTIES
var difficulty:String = CoolUtil.difficultyString();
trace('LOADING NEXT SONG');
trace(PlayState.storyPlaylist[0].toLowerCase() + difficulty);
@@ -1027,7 +1023,7 @@ class PlayState extends MusicBeatState
FlxTransitionableState.skipNextTransOut = true;
prevCamFollow = camFollow;
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]);
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase(), difficulty);
FlxG.sound.music.stop();
LoadingState.loadAndSwitchState(new PlayState());
+2 -6
View File
@@ -217,13 +217,9 @@ class FreeplayState extends MusicBeatState
if (accepted)
{
var poop:String = Highscore.formatSong(songs[curSelected].songName.toLowerCase(), curDifficulty);
trace(poop);
PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase());
PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty;
PlayState.SONG = Song.loadFromJson(songs[curSelected].songName, CoolUtil.difficultyString());
PlayState.isStoryMode = false;
PlayState.storyWeek = songs[curSelected].week;
trace('CUR WEEK' + PlayState.storyWeek);