mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix few more parsing bugs
This commit is contained in:
parent
db7f7c0cf6
commit
c93eb1db6b
4 changed files with 17 additions and 7 deletions
|
|
@ -182,6 +182,7 @@ class MarbleWorld extends Scheduler {
|
|||
public var _ready:Bool = false;
|
||||
|
||||
var _loadBegin:Bool = false;
|
||||
var _loaded:Bool = false;
|
||||
|
||||
var _loadingLength:Int = 0;
|
||||
|
||||
|
|
@ -1315,12 +1316,12 @@ class MarbleWorld extends Scheduler {
|
|||
});
|
||||
#end
|
||||
} else {
|
||||
if (this._resourcesLoaded < _loadingLength || !this._loadBegin)
|
||||
if (!this._loadBegin)
|
||||
return;
|
||||
if (!_ready && !postInited) {
|
||||
postInited = true;
|
||||
Console.log("Finished loading, starting mission");
|
||||
postInit();
|
||||
haxe.Timer.delay(() -> postInit(), 5); // delay this a bit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Marbleland {
|
|||
mission.title = missionData.name;
|
||||
mission.artist = missionData.artist != null ? missionData.artist : "Unknown Author";
|
||||
mission.description = missionData.desc != null ? missionData.desc : "";
|
||||
mission.qualifyTime = missionData.qualifyingTime != null ? missionData.qualifyingTime / 1000 : Math.POSITIVE_INFINITY;
|
||||
mission.qualifyTime = (missionData.qualifyingTime != null && missionData.qualifyingTime != 0) ? missionData.qualifyingTime / 1000 : Math.POSITIVE_INFINITY;
|
||||
mission.goldTime = missionData.goldTime != null ? missionData.goldTime / 1000 : 0;
|
||||
mission.game = missionData.modification;
|
||||
if (missionData.modification == 'platinum')
|
||||
|
|
@ -97,7 +97,7 @@ class Marbleland {
|
|||
}
|
||||
|
||||
public static function download(id:Int, cb:Array<haxe.zip.Entry>->Void) {
|
||||
Http.get('https://marbleblast.vani.ga/api/custom/${id}.zip?assuming=none', (zipData -> {
|
||||
Http.get('https://marbleland.vani.ga/api/level/${id}/zip?assuming=none', (zipData -> {
|
||||
var reader = new Reader(new BytesInput(zipData));
|
||||
var entries:Array<haxe.zip.Entry> = null;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -437,6 +437,15 @@ class ResourceLoader {
|
|||
#if (js || android)
|
||||
path = StringTools.replace(path, "data/", "");
|
||||
#end
|
||||
if (zipFilesystem.exists(path.toLowerCase() + ".jpg")) {
|
||||
return [path + ".jpg"];
|
||||
}
|
||||
if (zipFilesystem.exists(path.toLowerCase() + ".png")) {
|
||||
return [path + ".png"];
|
||||
}
|
||||
if (zipFilesystem.exists(path.toLowerCase() + ".bmp")) {
|
||||
return [path + ".bmp"];
|
||||
}
|
||||
var files = fileSystem.dir(Path.directory(path)); // FileSystem.readDirectory(Path.directory(path));
|
||||
var names = [];
|
||||
var fname = Path.withoutDirectory(path).toLowerCase();
|
||||
|
|
@ -452,7 +461,7 @@ class ResourceLoader {
|
|||
zipFilesystem.clear(); // We are only allowed to load one zip
|
||||
for (entry in entries) {
|
||||
var fname = entry.fileName.toLowerCase();
|
||||
// fname = "data/" + fname;
|
||||
fname = "data/" + fname;
|
||||
if (exists(fname))
|
||||
continue;
|
||||
Console.log("Loaded zip entry: " + fname);
|
||||
|
|
|
|||
|
|
@ -298,9 +298,9 @@ class MisParser {
|
|||
|
||||
/** Resolves a TorqueScript rvalue expression. Currently only supports the concatenation @ operator. */
|
||||
function resolveExpression(expr:String) {
|
||||
var parts = Util.splitIgnoreStringLiterals(expr, ' @ ').map(x -> {
|
||||
var parts = Util.splitIgnoreStringLiterals(expr, '@').map(x -> {
|
||||
x = StringTools.trim(x);
|
||||
if (StringTools.startsWith(x, '$ ') && this.variables[x] != null) {
|
||||
if (StringTools.startsWith(x, '$') && this.variables[x] != null) {
|
||||
// Replace the variable with its value
|
||||
x = this.resolveExpression(this.variables[x]);
|
||||
} else if (StringTools.startsWith(x, '"') && StringTools.endsWith(x, '"')) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue