mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
more console support
This commit is contained in:
parent
eb08a1e18a
commit
de20dbf0b8
20 changed files with 88 additions and 72 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
|
import src.Settings;
|
||||||
|
|
||||||
@:publicFields
|
@:publicFields
|
||||||
class ConsoleEntry {
|
class ConsoleEntry {
|
||||||
var time:Float;
|
var time:Float;
|
||||||
|
|
@ -21,6 +23,10 @@ class Console {
|
||||||
var consumers:Array<ConsoleEntry->Void>;
|
var consumers:Array<ConsoleEntry->Void>;
|
||||||
var timeSinceStart:Float;
|
var timeSinceStart:Float;
|
||||||
|
|
||||||
|
#if hl
|
||||||
|
var consoleFileHandle:sys.io.FileOutput;
|
||||||
|
#end
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
@ -28,6 +34,9 @@ class Console {
|
||||||
entries = [];
|
entries = [];
|
||||||
consumers = [];
|
consumers = [];
|
||||||
timeSinceStart = haxe.Timer.stamp();
|
timeSinceStart = haxe.Timer.stamp();
|
||||||
|
#if hl
|
||||||
|
consoleFileHandle = sys.io.File.write(haxe.io.Path.join([Settings.settingsDir, "console.log"]), false);
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clear() {
|
public function clear() {
|
||||||
|
|
@ -41,6 +50,9 @@ class Console {
|
||||||
function addEntry(type:String, msg:String) {
|
function addEntry(type:String, msg:String) {
|
||||||
var e = new ConsoleEntry(getTime(), type, msg);
|
var e = new ConsoleEntry(getTime(), type, msg);
|
||||||
entries.push(e);
|
entries.push(e);
|
||||||
|
#if hl
|
||||||
|
consoleFileHandle.writeString('[${e.time}] ${e.text}\n');
|
||||||
|
#end
|
||||||
for (c in consumers) {
|
for (c in consumers) {
|
||||||
c(e);
|
c(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import dif.Dif;
|
||||||
import src.InteriorObject;
|
import src.InteriorObject;
|
||||||
import src.MarbleGame;
|
import src.MarbleGame;
|
||||||
import src.ResourceLoaderWorker;
|
import src.ResourceLoaderWorker;
|
||||||
|
import src.Console;
|
||||||
|
|
||||||
class DifBuilderTriangle {
|
class DifBuilderTriangle {
|
||||||
public var texture:String;
|
public var texture:String;
|
||||||
|
|
@ -746,6 +747,7 @@ class DifBuilder {
|
||||||
material.receiveShadows = true;
|
material.receiveShadows = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Console.warn('Unable to load ${grp} texture for dif ${path}');
|
||||||
material = Material.create();
|
material = Material.create();
|
||||||
material.shadows = false;
|
material.shadows = false;
|
||||||
material.receiveShadows = true;
|
material.receiveShadows = true;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import dts.DtsFile;
|
||||||
import h3d.Matrix;
|
import h3d.Matrix;
|
||||||
import src.Util;
|
import src.Util;
|
||||||
import src.Resource;
|
import src.Resource;
|
||||||
|
import src.Console;
|
||||||
|
|
||||||
var DROP_TEXTURE_FOR_ENV_MAP = ['shapes/items/superjump.dts', 'shapes/items/antigravity.dts'];
|
var DROP_TEXTURE_FOR_ENV_MAP = ['shapes/items/superjump.dts', 'shapes/items/antigravity.dts'];
|
||||||
|
|
||||||
|
|
@ -373,6 +374,7 @@ class DtsObject extends GameObject {
|
||||||
|
|
||||||
if (fullName == null || (this.isTSStatic && ((flags & (1 << 31) > 0)))) {
|
if (fullName == null || (this.isTSStatic && ((flags & (1 << 31) > 0)))) {
|
||||||
if (this.isTSStatic) {
|
if (this.isTSStatic) {
|
||||||
|
Console.warn('Unsupported material type for ${fullName}, dts: ${this.dtsPath}');
|
||||||
// TODO USE PBR???
|
// TODO USE PBR???
|
||||||
}
|
}
|
||||||
} else if (Path.extension(fullName) == "ifl") {
|
} else if (Path.extension(fullName) == "ifl") {
|
||||||
|
|
@ -417,6 +419,7 @@ class DtsObject extends GameObject {
|
||||||
var texture:Texture = ResourceLoader.getResource("data/shapes/pads/white.jpg", ResourceLoader.getTexture, this.textureResources);
|
var texture:Texture = ResourceLoader.getResource("data/shapes/pads/white.jpg", ResourceLoader.getTexture, this.textureResources);
|
||||||
texture.wrap = Wrap.Repeat;
|
texture.wrap = Wrap.Repeat;
|
||||||
#end
|
#end
|
||||||
|
Console.warn('Unable to load ${matName}');
|
||||||
material.texture = texture;
|
material.texture = texture;
|
||||||
dtsshader.texture = texture;
|
dtsshader.texture = texture;
|
||||||
material.mainPass.addShader(dtsshader);
|
material.mainPass.addShader(dtsshader);
|
||||||
|
|
@ -461,6 +464,7 @@ class DtsObject extends GameObject {
|
||||||
if (this.materials.length == 0) {
|
if (this.materials.length == 0) {
|
||||||
var mat = Material.create();
|
var mat = Material.create();
|
||||||
this.materials.push(mat);
|
this.materials.push(mat);
|
||||||
|
Console.warn('No materials found for ${this.dtsPath}}');
|
||||||
// TODO THIS
|
// TODO THIS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -655,41 +659,6 @@ class DtsObject extends GameObject {
|
||||||
return materialGeometry;
|
return materialGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeMaterialGeometries(materialGeometries:Array<Array<MaterialGeometry>>) {
|
|
||||||
var merged = materialGeometries[0].map(x -> {
|
|
||||||
vertices: [],
|
|
||||||
normals: [],
|
|
||||||
uvs: [],
|
|
||||||
indices: []
|
|
||||||
});
|
|
||||||
|
|
||||||
for (matGeom in materialGeometries) {
|
|
||||||
for (i in 0...matGeom.length) {
|
|
||||||
merged[i].vertices = merged[i].vertices.concat(matGeom[i].vertices);
|
|
||||||
merged[i].normals = merged[i].normals.concat(matGeom[i].normals);
|
|
||||||
merged[i].uvs = merged[i].uvs.concat(matGeom[i].uvs);
|
|
||||||
merged[i].indices = merged[i].indices.concat(matGeom[i].indices);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return merged;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createGeometryFromMaterialGeometry(materialGeometry:Array<MaterialGeometry>) {
|
|
||||||
var geo = new Object();
|
|
||||||
for (i in 0...materialGeometry.length) {
|
|
||||||
if (materialGeometry[i].vertices.length == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var poly = new Polygon(materialGeometry[i].vertices.map(x -> x.toPoint()));
|
|
||||||
poly.normals = materialGeometry[i].normals.map(x -> x.toPoint());
|
|
||||||
poly.uvs = materialGeometry[i].uvs;
|
|
||||||
|
|
||||||
var obj = new Mesh(poly, materials[i], geo);
|
|
||||||
}
|
|
||||||
return geo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override function setTransform(mat:Matrix) {
|
public override function setTransform(mat:Matrix) {
|
||||||
super.setTransform(mat);
|
super.setTransform(mat);
|
||||||
if (this.isBoundingBoxCollideable) {
|
if (this.isBoundingBoxCollideable) {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class InstanceManager {
|
||||||
minfo.meshbatch.shadersChanged = true;
|
minfo.meshbatch.shadersChanged = true;
|
||||||
minfo.meshbatch.material.mainPass.setPassName(minfo.mesh.material.mainPass.name);
|
minfo.meshbatch.material.mainPass.setPassName(minfo.mesh.material.mainPass.name);
|
||||||
minfo.meshbatch.material.mainPass.enableLights = minfo.mesh.material.mainPass.enableLights;
|
minfo.meshbatch.material.mainPass.enableLights = minfo.mesh.material.mainPass.enableLights;
|
||||||
minfo.meshbatch.setTransform(transform);
|
minfo.meshbatch.worldPosition = transform;
|
||||||
minfo.meshbatch.emitInstance();
|
minfo.meshbatch.emitInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +98,7 @@ class InstanceManager {
|
||||||
// minfo.transparencymeshbatch.shadersChanged = true;
|
// minfo.transparencymeshbatch.shadersChanged = true;
|
||||||
// }
|
// }
|
||||||
var transform = instance.emptyObj.getAbsPos();
|
var transform = instance.emptyObj.getAbsPos();
|
||||||
minfo.transparencymeshbatch.setTransform(transform);
|
minfo.transparencymeshbatch.worldPosition = transform;
|
||||||
minfo.transparencymeshbatch.emitInstance();
|
minfo.transparencymeshbatch.emitInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
src/Main.hx
12
src/Main.hx
|
|
@ -65,6 +65,7 @@ class Main extends hxd.App {
|
||||||
Console.log("System: " + Sys.systemName());
|
Console.log("System: " + Sys.systemName());
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
try {
|
||||||
Settings.init();
|
Settings.init();
|
||||||
ResourceLoader.init(s2d, () -> {
|
ResourceLoader.init(s2d, () -> {
|
||||||
AudioManager.init();
|
AudioManager.init();
|
||||||
|
|
@ -76,6 +77,11 @@ class Main extends hxd.App {
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
Console.error(e.message);
|
||||||
|
Console.error(e.stack.toString());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
// ResourceLoader.init(s2d, () -> {
|
// ResourceLoader.init(s2d, () -> {
|
||||||
// Settings.init();
|
// Settings.init();
|
||||||
|
|
@ -103,7 +109,13 @@ class Main extends hxd.App {
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
ProfilerUI.begin();
|
ProfilerUI.begin();
|
||||||
ProfilerUI.measure("updateBegin");
|
ProfilerUI.measure("updateBegin");
|
||||||
|
try {
|
||||||
marbleGame.update(dt);
|
marbleGame.update(dt);
|
||||||
|
} catch (e) {
|
||||||
|
Console.error(e.message);
|
||||||
|
Console.error(e.stack.toString());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
// world.update(dt);
|
// world.update(dt);
|
||||||
ProfilerUI.update(this.engine.fps);
|
ProfilerUI.update(this.engine.fps);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ class MarbleGame {
|
||||||
if (Key.isPressed(Key.QWERTY_TILDE)) {
|
if (Key.isPressed(Key.QWERTY_TILDE)) {
|
||||||
consoleShown = !consoleShown;
|
consoleShown = !consoleShown;
|
||||||
if (consoleShown) {
|
if (consoleShown) {
|
||||||
if (console == null)
|
if (console == null || @:privateAccess console._disposed)
|
||||||
console = new ConsoleDlg();
|
console = new ConsoleDlg();
|
||||||
@:privateAccess console.isShowing = true;
|
@:privateAccess console.isShowing = true;
|
||||||
canvas.pushDialog(console);
|
canvas.pushDialog(console);
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,7 @@ class MarbleWorld extends Scheduler {
|
||||||
MarbleGame.canvas.clearContent();
|
MarbleGame.canvas.clearContent();
|
||||||
this.endPad.generateCollider();
|
this.endPad.generateCollider();
|
||||||
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
||||||
|
Console.log("MISSION LOADED");
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -403,6 +404,7 @@ class MarbleWorld extends Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function restart(full:Bool = false) {
|
public function restart(full:Bool = false) {
|
||||||
|
Console.log("LEVEL RESTART");
|
||||||
if (!full && this.currentCheckpoint != null) {
|
if (!full && this.currentCheckpoint != null) {
|
||||||
this.loadCheckpointState();
|
this.loadCheckpointState();
|
||||||
return 0; // Load checkpoint
|
return 0; // Load checkpoint
|
||||||
|
|
@ -917,6 +919,7 @@ class MarbleWorld extends Scheduler {
|
||||||
} else if (datablockLowercase == "checkpointtrigger") {
|
} else if (datablockLowercase == "checkpointtrigger") {
|
||||||
trigger = new CheckpointTrigger(element, cast this);
|
trigger = new CheckpointTrigger(element, cast this);
|
||||||
} else {
|
} else {
|
||||||
|
Console.error("Unknown trigger: " + element.datablock);
|
||||||
onFinish();
|
onFinish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1699,6 +1702,7 @@ class MarbleWorld extends Scheduler {
|
||||||
if (this.marble.heldPowerup != null)
|
if (this.marble.heldPowerup != null)
|
||||||
if (this.marble.heldPowerup.identifier == powerUp.identifier)
|
if (this.marble.heldPowerup.identifier == powerUp.identifier)
|
||||||
return false;
|
return false;
|
||||||
|
Console.log("PowerUp pickup: " + powerUp.identifier);
|
||||||
this.marble.heldPowerup = powerUp;
|
this.marble.heldPowerup = powerUp;
|
||||||
this.playGui.setPowerupImage(powerUp.identifier);
|
this.playGui.setPowerupImage(powerUp.identifier);
|
||||||
MarbleGame.instance.touchInput.powerupButton.setEnabled(true);
|
MarbleGame.instance.touchInput.powerupButton.setEnabled(true);
|
||||||
|
|
@ -1880,6 +1884,10 @@ class MarbleWorld extends Scheduler {
|
||||||
this.marble.setPosition(mpos.x, mpos.y, mpos.z);
|
this.marble.setPosition(mpos.x, mpos.y, mpos.z);
|
||||||
marble.velocity.load(new Vector(0, 0, 0));
|
marble.velocity.load(new Vector(0, 0, 0));
|
||||||
marble.omega.load(new Vector(0, 0, 0));
|
marble.omega.load(new Vector(0, 0, 0));
|
||||||
|
Console.log('Respawn:');
|
||||||
|
Console.log('Marble Position: ${mpos.x} ${mpos.y} ${mpos.z}');
|
||||||
|
Console.log('Marble Velocity: ${marble.velocity.x} ${marble.velocity.y} ${marble.velocity.z}');
|
||||||
|
Console.log('Marble Angular: ${marble.omega.x} ${marble.omega.y} ${marble.omega.z}');
|
||||||
// Set camera orientation
|
// Set camera orientation
|
||||||
var euler = this.currentCheckpoint.obj.getRotationQuat().toEuler();
|
var euler = this.currentCheckpoint.obj.getRotationQuat().toEuler();
|
||||||
this.marble.camera.CameraYaw = euler.z + Math.PI / 2;
|
this.marble.camera.CameraYaw = euler.z + Math.PI / 2;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import haxe.Json;
|
||||||
import mis.MisParser;
|
import mis.MisParser;
|
||||||
import src.ResourceLoader;
|
import src.ResourceLoader;
|
||||||
import src.Mission;
|
import src.Mission;
|
||||||
|
import src.Console;
|
||||||
|
|
||||||
@:publicFields
|
@:publicFields
|
||||||
class MissionList {
|
class MissionList {
|
||||||
|
|
@ -92,6 +93,19 @@ class MissionList {
|
||||||
missionList.set("platinum", platinumMissions);
|
missionList.set("platinum", platinumMissions);
|
||||||
missionList.set("ultra", ultraMissions);
|
missionList.set("ultra", ultraMissions);
|
||||||
|
|
||||||
|
Console.log("Loaded MissionList");
|
||||||
|
Console.log("Gold Beginner: " + goldMissions["beginner"].length);
|
||||||
|
Console.log("Gold Intermediate: " + goldMissions["intermediate"].length);
|
||||||
|
Console.log("Gold Advanced: " + goldMissions["advanced"].length);
|
||||||
|
Console.log("Platinum Beginner: " + platinumMissions["beginner"].length);
|
||||||
|
Console.log("Platinum Intermediate: " + platinumMissions["intermediate"].length);
|
||||||
|
Console.log("Platinum Advanced: " + platinumMissions["advanced"].length);
|
||||||
|
Console.log("Platinum Expert: " + platinumMissions["expert"].length);
|
||||||
|
Console.log("Ultra Beginner: " + ultraMissions["beginner"].length);
|
||||||
|
Console.log("Ultra Intermediate: " + ultraMissions["intermediate"].length);
|
||||||
|
Console.log("Ultra Advanced: " + ultraMissions["advanced"].length);
|
||||||
|
Console.log("Custom: " + customMissions.length);
|
||||||
|
|
||||||
// parseCLAList();
|
// parseCLAList();
|
||||||
|
|
||||||
_build = true;
|
_build = true;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import h3d.Vector;
|
||||||
import h3d.scene.MeshBatch;
|
import h3d.scene.MeshBatch;
|
||||||
import h3d.scene.Mesh;
|
import h3d.scene.Mesh;
|
||||||
import src.ResourceLoader;
|
import src.ResourceLoader;
|
||||||
|
import src.Console;
|
||||||
|
|
||||||
@:publicFields
|
@:publicFields
|
||||||
class ParticleData {
|
class ParticleData {
|
||||||
|
|
@ -303,6 +304,7 @@ class ParticleManager {
|
||||||
var emitters:Array<ParticleEmitter> = [];
|
var emitters:Array<ParticleEmitter> = [];
|
||||||
|
|
||||||
public function new(level:MarbleWorld) {
|
public function new(level:MarbleWorld) {
|
||||||
|
Console.log("Initializing Particle Manager");
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.scene = level.scene;
|
this.scene = level.scene;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,6 @@ class PathedInterior extends InteriorObject {
|
||||||
pathedInterior.simGroup = simGroup;
|
pathedInterior.simGroup = simGroup;
|
||||||
pathedInterior.element = interiorElement;
|
pathedInterior.element = interiorElement;
|
||||||
level.interiors.push(pathedInterior);
|
level.interiors.push(pathedInterior);
|
||||||
// await
|
|
||||||
// Util.wait(10); // See shapes for the meaning of this hack
|
|
||||||
// await
|
|
||||||
pathedInterior.init(level, () -> {
|
pathedInterior.init(level, () -> {
|
||||||
onFinish(pathedInterior);
|
onFinish(pathedInterior);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import haxe.EnumFlags;
|
||||||
import h3d.Quat;
|
import h3d.Quat;
|
||||||
import h3d.Vector;
|
import h3d.Vector;
|
||||||
import src.Util;
|
import src.Util;
|
||||||
|
import src.Console;
|
||||||
|
|
||||||
enum ReplayMarbleState {
|
enum ReplayMarbleState {
|
||||||
UsedPowerup;
|
UsedPowerup;
|
||||||
|
|
@ -429,8 +430,10 @@ class Replay {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function read(data:Bytes) {
|
public function read(data:Bytes) {
|
||||||
|
Console.log("Loading replay");
|
||||||
var replayVersion = data.get(0);
|
var replayVersion = data.get(0);
|
||||||
if (replayVersion > version) {
|
if (replayVersion > version) {
|
||||||
|
Console.log("Replay loading failed: unknown version");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var uncompressedLength = data.getInt32(1);
|
var uncompressedLength = data.getInt32(1);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ class Resource<T> {
|
||||||
public function release() {
|
public function release() {
|
||||||
this.referenceCount--;
|
this.referenceCount--;
|
||||||
if (this.referenceCount == 0) {
|
if (this.referenceCount == 0) {
|
||||||
Console.log("Freeing: " + identifier);
|
|
||||||
disposeFunc(this.resource);
|
disposeFunc(this.resource);
|
||||||
this.resourceMap.remove(this.identifier);
|
this.resourceMap.remove(this.identifier);
|
||||||
// trace('Releasing Resource ${this.identifier}');
|
// trace('Releasing Resource ${this.identifier}');
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,6 @@ class ResourceLoader {
|
||||||
if (interiorResources.exists(path))
|
if (interiorResources.exists(path))
|
||||||
return interiorResources.get(path);
|
return interiorResources.get(path);
|
||||||
else {
|
else {
|
||||||
Console.log("Load Interior: " + path);
|
|
||||||
var itr:Dif;
|
var itr:Dif;
|
||||||
// var lock = new Lock();
|
// var lock = new Lock();
|
||||||
// threadPool.run(() -> {
|
// threadPool.run(() -> {
|
||||||
|
|
@ -299,7 +298,6 @@ class ResourceLoader {
|
||||||
if (dtsResources.exists(path))
|
if (dtsResources.exists(path))
|
||||||
return dtsResources.get(path);
|
return dtsResources.get(path);
|
||||||
else {
|
else {
|
||||||
Console.log("Load DTS: " + path);
|
|
||||||
var dts = new DtsFile();
|
var dts = new DtsFile();
|
||||||
// var lock = new Lock();
|
// var lock = new Lock();
|
||||||
// threadPool.run(() -> {
|
// threadPool.run(() -> {
|
||||||
|
|
@ -318,7 +316,6 @@ class ResourceLoader {
|
||||||
if (textureCache.exists(path))
|
if (textureCache.exists(path))
|
||||||
return textureCache.get(path);
|
return textureCache.get(path);
|
||||||
if (fileSystem.exists(path)) {
|
if (fileSystem.exists(path)) {
|
||||||
Console.log("Load Texture: " + path);
|
|
||||||
var img = loader.load(path).toImage();
|
var img = loader.load(path).toImage();
|
||||||
Image.setupTextureFlags = (texObj) -> {
|
Image.setupTextureFlags = (texObj) -> {
|
||||||
texObj.flags.set(MipMapped);
|
texObj.flags.set(MipMapped);
|
||||||
|
|
@ -341,7 +338,6 @@ class ResourceLoader {
|
||||||
if (imageCache.exists(path))
|
if (imageCache.exists(path))
|
||||||
return imageCache.get(path);
|
return imageCache.get(path);
|
||||||
if (fileSystem.exists(path)) {
|
if (fileSystem.exists(path)) {
|
||||||
Console.log("Load Image: " + path);
|
|
||||||
var tex = loader.load(path).toImage();
|
var tex = loader.load(path).toImage();
|
||||||
var imageresource = new Resource(tex, path, imageCache, img -> {});
|
var imageresource = new Resource(tex, path, imageCache, img -> {});
|
||||||
imageCache.set(path, imageresource);
|
imageCache.set(path, imageresource);
|
||||||
|
|
@ -357,7 +353,6 @@ class ResourceLoader {
|
||||||
if (audioCache.exists(path))
|
if (audioCache.exists(path))
|
||||||
return audioCache.get(path);
|
return audioCache.get(path);
|
||||||
if (fileSystem.exists(path)) {
|
if (fileSystem.exists(path)) {
|
||||||
Console.log("Load Audio: " + path);
|
|
||||||
var snd = loader.load(path).toSound();
|
var snd = loader.load(path).toSound();
|
||||||
// @:privateAccess snd.watchCallb();
|
// @:privateAccess snd.watchCallb();
|
||||||
var audioresource = new Resource(snd, path, audioCache, snd -> snd.dispose());
|
var audioresource = new Resource(snd, path, audioCache, snd -> snd.dispose());
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,7 @@ class Settings {
|
||||||
FileSystem.createDirectory(settingsDir);
|
FileSystem.createDirectory(settingsDir);
|
||||||
}
|
}
|
||||||
File.saveContent(Path.join([settingsDir, "settings.json"]), json);
|
File.saveContent(Path.join([settingsDir, "settings.json"]), json);
|
||||||
|
Console.log("Saved settings to " + Path.join([settingsDir, "settings.json"]));
|
||||||
#end
|
#end
|
||||||
#if js
|
#if js
|
||||||
var localStorage = js.Browser.getLocalStorage();
|
var localStorage = js.Browser.getLocalStorage();
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import h3d.scene.Object;
|
||||||
import src.Resource;
|
import src.Resource;
|
||||||
import hxd.res.Image;
|
import hxd.res.Image;
|
||||||
import src.ResourceLoaderWorker;
|
import src.ResourceLoaderWorker;
|
||||||
|
import src.Console;
|
||||||
|
|
||||||
class Sky extends Object {
|
class Sky extends Object {
|
||||||
public var dmlPath:String;
|
public var dmlPath:String;
|
||||||
|
|
@ -101,6 +102,7 @@ class Sky extends Object {
|
||||||
skyboxImages.push(pixels);
|
skyboxImages.push(pixels);
|
||||||
// var tex = new h3d.mat.Texture();
|
// var tex = new h3d.mat.Texture();
|
||||||
// skyboxImages.push(new BitmapData(128, 128));
|
// skyboxImages.push(new BitmapData(128, 128));
|
||||||
|
Console.error("Skybox image " + filenames[0] + " does not exist");
|
||||||
} else {
|
} else {
|
||||||
var image = ResourceLoader.getResource(filenames[0], ResourceLoader.getImage, this.imageResources).toBitmap();
|
var image = ResourceLoader.getResource(filenames[0], ResourceLoader.getImage, this.imageResources).toBitmap();
|
||||||
var pixels = image.getPixels();
|
var pixels = image.getPixels();
|
||||||
|
|
|
||||||
|
|
@ -152,18 +152,6 @@ class CollisionEntity implements IOctreeObject implements IBVHObject {
|
||||||
var tform = transform.clone();
|
var tform = transform.clone();
|
||||||
// tform.setPosition(tform.getPosition().add(this.velocity.multiply(timeState.dt)));
|
// tform.setPosition(tform.getPosition().add(this.velocity.multiply(timeState.dt)));
|
||||||
|
|
||||||
function toDifPoint(pt:Vector) {
|
|
||||||
return new Point3F(pt.x, pt.y, pt.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
function fromDifPoint(pt:Point3F) {
|
|
||||||
return new Vector(pt.x, pt.y, pt.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
function hashEdge(i1:Int, i2:Int) {
|
|
||||||
return i1 >= i2 ? i1 * i1 + i1 + i2 : i1 + i2 * i2;
|
|
||||||
}
|
|
||||||
|
|
||||||
var contacts = [];
|
var contacts = [];
|
||||||
|
|
||||||
for (obj in surfaces) {
|
for (obj in surfaces) {
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@ class ConsoleDlg extends GuiControl {
|
||||||
consoleContent.text.text += txt;
|
consoleContent.text.text += txt;
|
||||||
if (isShowing) {
|
if (isShowing) {
|
||||||
scroll.setScrollMax(consoleContent.text.textHeight);
|
scroll.setScrollMax(consoleContent.text.textHeight);
|
||||||
haxe.Timer.delay(() -> scroll.setScrollPercentage(1), 1);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class GuiConsoleScrollCtrl extends GuiControl {
|
||||||
|
|
||||||
this.scrollBarY = new Graphics();
|
this.scrollBarY = new Graphics();
|
||||||
this.scrollBarY.scale(Settings.uiScale);
|
this.scrollBarY.scale(Settings.uiScale);
|
||||||
this.clickInteractive = new Interactive(10 * Settings.uiScale, 1);
|
this.clickInteractive = new Interactive(18 * Settings.uiScale, 1);
|
||||||
this.clickInteractive.onPush = (e) -> {
|
this.clickInteractive.onPush = (e) -> {
|
||||||
if (!this.pressed) {
|
if (!this.pressed) {
|
||||||
this.pressed = true;
|
this.pressed = true;
|
||||||
|
|
@ -111,7 +111,10 @@ class GuiConsoleScrollCtrl extends GuiControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setScrollMax(max:Float) {
|
public function setScrollMax(max:Float) {
|
||||||
this.scrollY = 0;
|
var renderRect = this.getRenderRectangle();
|
||||||
|
var scrollExtentY = renderRect.extent.y - 34 * Settings.uiScale;
|
||||||
|
var scrollBarYSize = (scrollExtentY * scrollExtentY / (maxScrollY * Settings.uiScale - 34 * Settings.uiScale));
|
||||||
|
this.scrollY = scrollExtentY - scrollBarYSize * Settings.uiScale;
|
||||||
this.maxScrollY = max;
|
this.maxScrollY = max;
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
this.updateScrollVisual();
|
this.updateScrollVisual();
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ class GuiControl {
|
||||||
var textureResources:Array<Resource<Texture>> = [];
|
var textureResources:Array<Resource<Texture>> = [];
|
||||||
var soundResources:Array<Resource<Sound>> = [];
|
var soundResources:Array<Resource<Sound>> = [];
|
||||||
|
|
||||||
|
var _disposed = false;
|
||||||
|
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
public function render(scene2d:Scene) {
|
public function render(scene2d:Scene) {
|
||||||
|
|
@ -240,6 +242,8 @@ class GuiControl {
|
||||||
for (audioResource in soundResources) {
|
for (audioResource in soundResources) {
|
||||||
audioResource.release();
|
audioResource.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onMouseDown(mouseState:MouseState) {}
|
public function onMouseDown(mouseState:MouseState) {}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import src.AudioManager;
|
||||||
import mis.MisParser;
|
import mis.MisParser;
|
||||||
import src.MarbleWorld;
|
import src.MarbleWorld;
|
||||||
import mis.MissionElement.MissionElementTrigger;
|
import mis.MissionElement.MissionElementTrigger;
|
||||||
|
import src.Console;
|
||||||
|
|
||||||
class TeleportTrigger extends Trigger {
|
class TeleportTrigger extends Trigger {
|
||||||
var delay:Float = 2;
|
var delay:Float = 2;
|
||||||
|
|
@ -103,6 +104,11 @@ class TeleportTrigger extends Trigger {
|
||||||
if (!MisParser.parseBoolean(chooseNonNull(this.element.keepangular, destination.element.keepangular)))
|
if (!MisParser.parseBoolean(chooseNonNull(this.element.keepangular, destination.element.keepangular)))
|
||||||
this.level.marble.omega.set(0, 0, 0);
|
this.level.marble.omega.set(0, 0, 0);
|
||||||
|
|
||||||
|
Console.log('Teleport:');
|
||||||
|
Console.log('Marble Position: ${position.x} ${position.y} ${position.z}');
|
||||||
|
Console.log('Marble Velocity: ${this.level.marble.velocity.x} ${this.level.marble.velocity.y} ${this.level.marble.velocity.z}');
|
||||||
|
Console.log('Marble Angular: ${this.level.marble.omega.x} ${this.level.marble.omega.y} ${this.level.marble.omega.z}');
|
||||||
|
|
||||||
// Determine camera orientation
|
// Determine camera orientation
|
||||||
if (!MisParser.parseBoolean(chooseNonNull(this.element.keepcamera, destination.element.keepcamera))) {
|
if (!MisParser.parseBoolean(chooseNonNull(this.element.keepcamera, destination.element.keepcamera))) {
|
||||||
var yaw:Float;
|
var yaw:Float;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue