mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 05:01:38 +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;
|
public var _ready:Bool = false;
|
||||||
|
|
||||||
var _loadBegin:Bool = false;
|
var _loadBegin:Bool = false;
|
||||||
|
var _loaded:Bool = false;
|
||||||
|
|
||||||
var _loadingLength:Int = 0;
|
var _loadingLength:Int = 0;
|
||||||
|
|
||||||
|
|
@ -1315,12 +1316,12 @@ class MarbleWorld extends Scheduler {
|
||||||
});
|
});
|
||||||
#end
|
#end
|
||||||
} else {
|
} else {
|
||||||
if (this._resourcesLoaded < _loadingLength || !this._loadBegin)
|
if (!this._loadBegin)
|
||||||
return;
|
return;
|
||||||
if (!_ready && !postInited) {
|
if (!_ready && !postInited) {
|
||||||
postInited = true;
|
postInited = true;
|
||||||
Console.log("Finished loading, starting mission");
|
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.title = missionData.name;
|
||||||
mission.artist = missionData.artist != null ? missionData.artist : "Unknown Author";
|
mission.artist = missionData.artist != null ? missionData.artist : "Unknown Author";
|
||||||
mission.description = missionData.desc != null ? missionData.desc : "";
|
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.goldTime = missionData.goldTime != null ? missionData.goldTime / 1000 : 0;
|
||||||
mission.game = missionData.modification;
|
mission.game = missionData.modification;
|
||||||
if (missionData.modification == 'platinum')
|
if (missionData.modification == 'platinum')
|
||||||
|
|
@ -97,7 +97,7 @@ class Marbleland {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function download(id:Int, cb:Array<haxe.zip.Entry>->Void) {
|
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 reader = new Reader(new BytesInput(zipData));
|
||||||
var entries:Array<haxe.zip.Entry> = null;
|
var entries:Array<haxe.zip.Entry> = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -437,6 +437,15 @@ class ResourceLoader {
|
||||||
#if (js || android)
|
#if (js || android)
|
||||||
path = StringTools.replace(path, "data/", "");
|
path = StringTools.replace(path, "data/", "");
|
||||||
#end
|
#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 files = fileSystem.dir(Path.directory(path)); // FileSystem.readDirectory(Path.directory(path));
|
||||||
var names = [];
|
var names = [];
|
||||||
var fname = Path.withoutDirectory(path).toLowerCase();
|
var fname = Path.withoutDirectory(path).toLowerCase();
|
||||||
|
|
@ -452,7 +461,7 @@ class ResourceLoader {
|
||||||
zipFilesystem.clear(); // We are only allowed to load one zip
|
zipFilesystem.clear(); // We are only allowed to load one zip
|
||||||
for (entry in entries) {
|
for (entry in entries) {
|
||||||
var fname = entry.fileName.toLowerCase();
|
var fname = entry.fileName.toLowerCase();
|
||||||
// fname = "data/" + fname;
|
fname = "data/" + fname;
|
||||||
if (exists(fname))
|
if (exists(fname))
|
||||||
continue;
|
continue;
|
||||||
Console.log("Loaded zip entry: " + fname);
|
Console.log("Loaded zip entry: " + fname);
|
||||||
|
|
|
||||||
|
|
@ -298,9 +298,9 @@ class MisParser {
|
||||||
|
|
||||||
/** Resolves a TorqueScript rvalue expression. Currently only supports the concatenation @ operator. */
|
/** Resolves a TorqueScript rvalue expression. Currently only supports the concatenation @ operator. */
|
||||||
function resolveExpression(expr:String) {
|
function resolveExpression(expr:String) {
|
||||||
var parts = Util.splitIgnoreStringLiterals(expr, ' @ ').map(x -> {
|
var parts = Util.splitIgnoreStringLiterals(expr, '@').map(x -> {
|
||||||
x = StringTools.trim(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
|
// Replace the variable with its value
|
||||||
x = this.resolveExpression(this.variables[x]);
|
x = this.resolveExpression(this.variables[x]);
|
||||||
} else if (StringTools.startsWith(x, '"') && StringTools.endsWith(x, '"')) {
|
} else if (StringTools.startsWith(x, '"') && StringTools.endsWith(x, '"')) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue