mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-03-30 07:31:56 +00:00
fix texture paths for difs and fix endgame softlock for custom missions
This commit is contained in:
parent
2ef28aae5f
commit
4bddb5bd0a
2 changed files with 61 additions and 2 deletions
|
|
@ -714,17 +714,40 @@ class DifBuilder {
|
|||
tex = spl[spl.length - 1];
|
||||
}
|
||||
|
||||
// search with extension first
|
||||
if (ResourceLoader.exists(Path.directory(path) + "/" + tex)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var prevDir = Path.directory(Path.directory(path));
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
prevDir = Path.directory(prevDir);
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex))
|
||||
return true;
|
||||
|
||||
// remove extension from it
|
||||
if (tex.lastIndexOf(".") != -1) {
|
||||
tex = tex.substring(0, tex.lastIndexOf("."));
|
||||
}
|
||||
|
||||
#if (js || android)
|
||||
path = StringTools.replace(path, "data/", "");
|
||||
#end
|
||||
|
||||
// search jpg, png and bmp
|
||||
if (ResourceLoader.exists(Path.directory(path) + "/" + tex + ".jpg")) {
|
||||
return true;
|
||||
}
|
||||
if (ResourceLoader.exists(Path.directory(path) + "/" + tex + ".png")) {
|
||||
return true;
|
||||
}
|
||||
var prevDir = Path.directory(Path.directory(path));
|
||||
if (ResourceLoader.exists(Path.directory(path) + "/" + tex + ".bmp")) {
|
||||
return true;
|
||||
}
|
||||
prevDir = Path.directory(Path.directory(path));
|
||||
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex + ".jpg")) {
|
||||
return true;
|
||||
|
|
@ -732,6 +755,9 @@ class DifBuilder {
|
|||
if (ResourceLoader.exists(prevDir + "/" + tex + ".png")) {
|
||||
return true;
|
||||
}
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex + ".bmp")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
prevDir = Path.directory(prevDir);
|
||||
|
||||
|
|
@ -741,6 +767,9 @@ class DifBuilder {
|
|||
if (ResourceLoader.exists(prevDir + "/" + tex + ".png")) {
|
||||
return true;
|
||||
}
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex + ".bmp")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -750,12 +779,36 @@ class DifBuilder {
|
|||
tex = spl[spl.length - 1];
|
||||
}
|
||||
|
||||
// search with extension first
|
||||
if (ResourceLoader.exists(Path.directory(path) + "/" + tex)) {
|
||||
return Path.directory(path) + "/" + tex;
|
||||
}
|
||||
|
||||
var prevDir = Path.directory(Path.directory(path));
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex)) {
|
||||
return prevDir + "/" + tex;
|
||||
}
|
||||
|
||||
prevDir = Path.directory(prevDir);
|
||||
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex)) {
|
||||
return prevDir + "/" + tex;
|
||||
}
|
||||
|
||||
// remove extension from it
|
||||
if (tex.lastIndexOf(".") != -1) {
|
||||
tex = tex.substring(0, tex.lastIndexOf("."));
|
||||
}
|
||||
|
||||
if (ResourceLoader.exists(Path.directory(path) + "/" + tex + ".jpg")) {
|
||||
return Path.directory(path) + "/" + tex + ".jpg";
|
||||
}
|
||||
if (ResourceLoader.exists(Path.directory(path) + "/" + tex + ".png")) {
|
||||
return Path.directory(path) + "/" + tex + ".png";
|
||||
}
|
||||
if (ResourceLoader.exists(Path.directory(path) + "/" + tex + ".bmp")) {
|
||||
return Path.directory(path) + "/" + tex + ".bmp";
|
||||
}
|
||||
|
||||
var prevDir = Path.directory(Path.directory(path));
|
||||
|
||||
|
|
@ -765,6 +818,9 @@ class DifBuilder {
|
|||
if (ResourceLoader.exists(prevDir + "/" + tex + ".png")) {
|
||||
return prevDir + "/" + tex + ".png";
|
||||
}
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex + ".bmp")) {
|
||||
return prevDir + "/" + tex + ".bmp";
|
||||
}
|
||||
|
||||
var prevDir = Path.directory(prevDir);
|
||||
|
||||
|
|
@ -774,6 +830,9 @@ class DifBuilder {
|
|||
if (ResourceLoader.exists(prevDir + "/" + tex + ".png")) {
|
||||
return prevDir + "/" + tex + ".png";
|
||||
}
|
||||
if (ResourceLoader.exists(prevDir + "/" + tex + ".bmp")) {
|
||||
return prevDir + "/" + tex + ".bmp";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class EndGameGui extends GuiControl {
|
|||
nextLevelPreview.extent = new Vector(160, 110);
|
||||
nextLevel.addChild(nextLevelPreview);
|
||||
|
||||
mission.getNextMission().getPreviewImage(t -> {
|
||||
mission.getNextMission()?.getPreviewImage(t -> {
|
||||
nextLevelPreview.bmp.tile = t;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue