mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-12-25 17:32:35 +00:00
add support for native
This commit is contained in:
parent
23322c66fc
commit
119e689a75
22 changed files with 41 additions and 28 deletions
|
|
@ -102,7 +102,7 @@ class DifBuilder {
|
|||
#if (js || android)
|
||||
path = StringTools.replace(path, "data/", "");
|
||||
#end
|
||||
ResourceLoader.loader.load(path).entry.load(() -> {
|
||||
ResourceLoader.load(path).entry.load(() -> {
|
||||
var difresource = ResourceLoader.loadInterior(path);
|
||||
difresource.acquire();
|
||||
var dif = difresource.resource;
|
||||
|
|
@ -169,7 +169,7 @@ class DifBuilder {
|
|||
colliderSurface.originalIndices = [];
|
||||
colliderSurface.originalSurfaceIndex = surfaceindex;
|
||||
|
||||
for (k in(surface.windingStart + 2)...(surface.windingStart + surface.windingCount)) {
|
||||
for (k in (surface.windingStart + 2)...(surface.windingStart + surface.windingCount)) {
|
||||
var p1, p2, p3;
|
||||
if ((k - (surface.windingStart + 2)) % 2 == 0) {
|
||||
p1 = points[geo.windings[k]];
|
||||
|
|
|
|||
|
|
@ -852,17 +852,17 @@ class MarbleWorld extends Scheduler {
|
|||
var func = this.resourceLoadFuncs.shift();
|
||||
lock = true;
|
||||
#if hl
|
||||
func();
|
||||
lock = false;
|
||||
this._resourcesLoaded++;
|
||||
this.loadingGui.setProgress((1 - resourceLoadFuncs.length / _loadingLength));
|
||||
func(() -> {
|
||||
lock = false;
|
||||
this._resourcesLoaded++;
|
||||
this.loadingGui.setProgress((1 - resourceLoadFuncs.length / _loadingLength));
|
||||
});
|
||||
#end
|
||||
#if js
|
||||
func(() -> {
|
||||
lock = false;
|
||||
this.loadingGui.setProgress((1 - resourceLoadFuncs.length / _loadingLength));
|
||||
this._resourcesLoaded++;
|
||||
js.Browser.console.log('${func} is done');
|
||||
});
|
||||
#end
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class PathedInterior extends InteriorObject {
|
|||
}
|
||||
|
||||
if (this.element.datablock.toLowerCase() == "pathedmovingblock") {
|
||||
ResourceLoader.loader.load("sound/movingblockloop.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/movingblockloop.wav").entry.load(() -> {
|
||||
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/movingblockloop.wav", ResourceLoader.getAudio,
|
||||
this.soundResources), new Vector(), true);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -203,6 +203,14 @@ class ResourceLoader {
|
|||
worker.run();
|
||||
}
|
||||
|
||||
public static function load(path:String) {
|
||||
#if hl
|
||||
if (!StringTools.startsWith(path, "data/"))
|
||||
path = "data/" + path;
|
||||
#end
|
||||
return ResourceLoader.loader.load(path);
|
||||
}
|
||||
|
||||
public static function loadInterior(path:String) {
|
||||
#if (js || android)
|
||||
path = StringTools.replace(path, "data/", "");
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ class ResourceLoaderWorker {
|
|||
}
|
||||
|
||||
public function loadFile(path:String) {
|
||||
addTask(fwd -> ResourceLoader.loader.load(path).entry.load(fwd));
|
||||
addTask(fwd -> ResourceLoader.load(path).entry.load(fwd));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -491,6 +491,11 @@ class PlayMissionGui extends GuiImage {
|
|||
}, 75));
|
||||
}
|
||||
#end
|
||||
#if hl
|
||||
currentMission.getPreviewImage(prevImg -> {
|
||||
pmPreview.bmp.tile = prevImg;
|
||||
}); // Shit be sync
|
||||
#end
|
||||
|
||||
levelBkgnd.text.text = currentCategory.charAt(0).toUpperCase() + currentCategory.substr(1) + ' Level ${currentSelection + 1}';
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class AntiGravity extends PowerUp {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/gravitychange.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/gravitychange.wav").entry.load(() -> {
|
||||
this.pickupSound = ResourceLoader.getResource("data/sound/gravitychange.wav", ResourceLoader.getAudio, this.soundResources);
|
||||
onFinish();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class DuctFan extends ForceObject {
|
|||
|
||||
public override function init(level:src.MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/fan_loop.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/fan_loop.wav").entry.load(() -> {
|
||||
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/fan_loop.wav", ResourceLoader.getAudio,
|
||||
this.soundResources), new Vector(1e8, 1e8, 1e8), true);
|
||||
onFinish();
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class EndPad extends DtsObject {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/firewrks.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/firewrks.wav").entry.load(onFinish);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class Helicopter extends PowerUp {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/pugyrocoptervoice.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/pugyrocoptervoice.wav").entry.load(() -> {
|
||||
this.pickupSound = ResourceLoader.getResource("data/sound/pugyrocoptervoice.wav", ResourceLoader.getAudio, this.soundResources);
|
||||
onFinish();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class LandMine extends DtsObject {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/explode1.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/explode1.wav").entry.load(onFinish);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class ShockAbsorber extends PowerUp {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/pushockabsorbervoice.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/pushockabsorbervoice.wav").entry.load(() -> {
|
||||
this.pickupSound = ResourceLoader.getResource("data/sound/pushockabsorbervoice.wav", ResourceLoader.getAudio, this.soundResources);
|
||||
onFinish();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class SmallDuctFan extends ForceObject {
|
|||
|
||||
public override function init(level:src.MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/fan_loop.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/fan_loop.wav").entry.load(() -> {
|
||||
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/fan_loop.wav", ResourceLoader.getAudio,
|
||||
this.soundResources), new Vector(1e8, 1e8, 1e8), true);
|
||||
onFinish();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class SuperBounce extends PowerUp {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/pusuperbouncevoice.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/pusuperbouncevoice.wav").entry.load(() -> {
|
||||
this.pickupSound = ResourceLoader.getResource("data/sound/pusuperbouncevoice.wav", ResourceLoader.getAudio, this.soundResources);
|
||||
onFinish();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ class SuperJump extends PowerUp {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/pusuperjumpvoice.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/pusuperjumpvoice.wav").entry.load(() -> {
|
||||
this.pickupSound = ResourceLoader.getResource("sound/pusuperjumpvoice.wav", ResourceLoader.getAudio, this.soundResources);
|
||||
ResourceLoader.loader.load("sound/dosuperjump.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/dosuperjump.wav").entry.load(onFinish);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ class SuperSpeed extends PowerUp {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/pusuperspeedvoice.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/pusuperspeedvoice.wav").entry.load(() -> {
|
||||
this.pickupSound = ResourceLoader.getResource("data/sound/pusuperspeedvoice.wav", ResourceLoader.getAudio, this.soundResources);
|
||||
ResourceLoader.loader.load("sound/dosuperspeed.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/dosuperspeed.wav").entry.load(onFinish);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ class TimeTravel extends PowerUp {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/putimetravelvoice.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/putimetravelvoice.wav").entry.load(() -> {
|
||||
this.pickupSound = ResourceLoader.getResource("data/sound/putimetravelvoice.wav", ResourceLoader.getAudio, this.soundResources);
|
||||
ResourceLoader.loader.load("sound/timetravelactive.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/timetravelactive.wav").entry.load(onFinish);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Tornado extends ForceObject {
|
|||
|
||||
public override function init(level:src.MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/tornado.wav").entry.load(() -> {
|
||||
ResourceLoader.load("sound/tornado.wav").entry.load(() -> {
|
||||
this.soundChannel = AudioManager.playSound(ResourceLoader.getResource("data/sound/tornado.wav", ResourceLoader.getAudio, this.soundResources),
|
||||
new Vector(1e8, 1e8, 1e8), true);
|
||||
for (material in this.materials) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Trapdoor extends DtsObject {
|
|||
|
||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||
super.init(level, () -> {
|
||||
ResourceLoader.loader.load("sound/trapdooropen.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/trapdooropen.wav").entry.load(onFinish);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ class HelpTrigger extends Trigger {
|
|||
}
|
||||
|
||||
public override function init(onFinish:Void->Void) {
|
||||
ResourceLoader.loader.load("sound/infotutorial.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/infotutorial.wav").entry.load(onFinish);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ class InBoundsTrigger extends Trigger {
|
|||
}
|
||||
|
||||
public override function init(onFinish:Void->Void) {
|
||||
ResourceLoader.loader.load("sound/whoosh.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/whoosh.wav").entry.load(onFinish);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ class OutOfBoundsTrigger extends Trigger {
|
|||
}
|
||||
|
||||
public override function init(onFinish:Void->Void) {
|
||||
ResourceLoader.loader.load("sound/whoosh.wav").entry.load(onFinish);
|
||||
ResourceLoader.load("sound/whoosh.wav").entry.load(onFinish);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue