diff --git a/src/DifBuilder.hx b/src/DifBuilder.hx index 3f14041f..52a149f3 100644 --- a/src/DifBuilder.hx +++ b/src/DifBuilder.hx @@ -691,7 +691,8 @@ class DifBuilder { return false; } if (tex.indexOf('/') != -1) { - tex = tex.split('/')[1]; + var spl = tex.split('/'); + tex = spl[spl.length - 1]; } #if (js || android) @@ -726,7 +727,8 @@ class DifBuilder { } function tex(tex:String):String { if (tex.indexOf('/') != -1) { - tex = tex.split('/')[1]; + var spl = tex.split('/'); + tex = spl[spl.length - 1]; } if (ResourceLoader.exists(Path.directory(path) + "/" + tex + ".jpg")) { @@ -822,6 +824,12 @@ class DifBuilder { if (!shaderMaterialDict.exists(matDictName)) { matDictName = StringTools.replace(exactName, "multiplayer/interiors/mbu", "interiors_mbu"); } + if (!shaderMaterialDict.exists(matDictName)) { + matDictName = StringTools.replace(exactName, "multiplayer/interiors/custom/mbu", "interiors_mbu"); + } + if (!shaderMaterialDict.exists(matDictName)) { + matDictName = StringTools.replace(exactName, "multiplayer/interiors_mbg/custom/mbu", "interiors_mbu"); + } if (shaderMaterialDict.exists(matDictName)) { var retrievefunc = shaderMaterialDict[matDictName]; shaderWorker.addTask(fwd -> { diff --git a/src/DtsObject.hx b/src/DtsObject.hx index f4c2257b..d85266ab 100644 --- a/src/DtsObject.hx +++ b/src/DtsObject.hx @@ -854,7 +854,8 @@ class DtsObject extends GameObject { quat.slerp(q1, q2, t); quat.normalize(); - this.graphNodes[i].setRotationQuat(quat); + this.graphNodes[i].getRotationQuat().load(quat); + this.graphNodes[i].posChanged = true; this.dirtyTransforms[i] = true; affectedCount++; // quaternions.push(quat); @@ -863,7 +864,8 @@ class DtsObject extends GameObject { var quat = new Quat(-rotation.x, rotation.y, rotation.z, -rotation.w); quat.normalize(); quat.conjugate(); - this.graphNodes[i].setRotationQuat(quat); + this.graphNodes[i].getRotationQuat().load(quat); + this.graphNodes[i].posChanged = true; // quaternions.push(quat); } } @@ -929,8 +931,8 @@ class DtsObject extends GameObject { var mesh = this.dts.meshes[info.meshIndex]; for (i in 0...info.vertices.length) { - info.vertices[i] = new Vector(); - info.normals[i] = new Vector(); + info.vertices[i].set(0, 0, 0); + info.normals[i].set(0, 0, 0); } var boneTransformations = []; @@ -959,13 +961,13 @@ class DtsObject extends GameObject { var mat = boneTransformations[mesh.boneIndices[i]]; vec.transform(mat); - vec = vec.multiply(mesh.weights[i]); + vec.load(vec.multiply(mesh.weights[i])); Util.m_matF_x_vectorF(mat, vec2); - vec2 = vec2.multiply(mesh.weights[i]); + vec2.load(vec2.multiply(mesh.weights[i])); - info.vertices[vIndex] = info.vertices[vIndex].add(vec); - info.normals[vIndex] = info.normals[vIndex].add(vec2); + info.vertices[vIndex].load(info.vertices[vIndex].add(vec)); + info.normals[vIndex].load(info.normals[vIndex].add(vec2)); } for (i in 0...info.normals.length) { @@ -979,10 +981,6 @@ class DtsObject extends GameObject { var meshIndex = 0; var mesh:Mesh = cast info.geometry.children[meshIndex]; var prim:DynamicPolygon = cast mesh.primitive; - var vbuffer:FloatBuffer = null; - if (prim.buffer != null) { - vbuffer = prim.getDrawBuffer(prim.points.length); - } var pos = 0; for (i in info.indices) { if (pos >= prim.points.length) { @@ -991,14 +989,11 @@ class DtsObject extends GameObject { mesh = cast info.geometry.children[meshIndex]; prim = cast mesh.primitive; pos = 0; - if (prim.buffer != null) { - vbuffer = prim.getDrawBuffer(prim.points.length); - } } var vertex = info.vertices[i]; var normal = info.normals[i]; - prim.points[pos] = vertex.toPoint(); - prim.normals[pos] = normal.toPoint(); // .normalized(); + prim.points[pos].load(vertex.toPoint()); + prim.normals[pos].load(normal.toPoint()); // .normalized(); if (prim.buffer != null) { prim.dirtyFlags[pos] = true; } @@ -1042,15 +1037,17 @@ class DtsObject extends GameObject { var spinAnimation = new Quat(); spinAnimation.initRotateAxis(0, 0, -1, timeState.timeSinceLoad * this.ambientSpinFactor); - var orientation = this.getRotationQuat(); + // var orientation = this.getRotationQuat(); // spinAnimation.multiply(orientation, spinAnimation); - this.rootObject.setRotationQuat(spinAnimation); + this.rootObject.getRotationQuat().load(spinAnimation); + this.rootObject.posChanged = true; + // setRotationQuat(spinAnimation); } for (i in 0...this.colliders.length) { if (this.dirtyTransforms[this.colliders[i].userData]) { - var absTform = this.graphNodes[this.colliders[i].userData].getAbsPos().clone(); + var absTform = this.graphNodes[this.colliders[i].userData].getAbsPos(); if (this.colliders[i] != null) { this.colliders[i].setTransform(absTform); this.level.collisionWorld.updateTransform(this.colliders[i]); diff --git a/src/Marble.hx b/src/Marble.hx index 2e2de86d..316e92eb 100644 --- a/src/Marble.hx +++ b/src/Marble.hx @@ -503,7 +503,7 @@ class Marble extends GameObject { this._prevRadius = this._radius; - if (isUltra) { + if (isUltra || level.isMultiplayer) { this.rollMegaSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/mega_roll.wav", ResourceLoader.getAudio, this.soundResources), this.getAbsPos().getPosition(), true); this.rollMegaSound.volume = 0; @@ -2153,6 +2153,7 @@ class Marble extends GameObject { } updatePowerupStates(timeState); + updateTeleporterState(timeState); if (isMegaMarbleEnabled(timeState)) { marbleDts.setScale(0.6666 / _dtsRadius); diff --git a/src/MarbleWorld.hx b/src/MarbleWorld.hx index e968e5db..9f420d33 100644 --- a/src/MarbleWorld.hx +++ b/src/MarbleWorld.hx @@ -355,7 +355,10 @@ class MarbleWorld extends Scheduler { public function loadMusic(onFinish:Void->Void) { if (this.mission.missionInfo.music != null) { var musicFileName = 'sound/music/' + this.mission.missionInfo.music; - ResourceLoader.load(musicFileName).entry.load(onFinish); + if (ResourceLoader.exists(musicFileName)) + ResourceLoader.load(musicFileName).entry.load(onFinish); + else + onFinish(); } else { onFinish(); } @@ -380,7 +383,10 @@ class MarbleWorld extends Scheduler { this._ready = true; var musicFileName = 'data/sound/music/' + this.mission.missionInfo.music; - AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources), this.mission.missionInfo.music); + if (ResourceLoader.exists(musicFileName)) + AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources), this.mission.missionInfo.music); + else + AudioManager.playShell(); MarbleGame.canvas.clearContent(); if (this.endPad != null) this.endPad.generateCollider(); @@ -893,6 +899,7 @@ class MarbleWorld extends Scheduler { if ((Net.isHost && (this.timeState.timeSinceLoad < startTime - 3.0)) // 3.5 == 109 ticks || (Net.isClient && this.serverStartTicks != 0 && @:privateAccess this.marble.serverTicks < this.serverStartTicks + 16)) { this.playGui.setCenterText('none'); + this.playGui.doStateChangeSound('none'); } if ((Net.isHost && (this.timeState.timeSinceLoad > startTime - 3.0) @@ -902,6 +909,7 @@ class MarbleWorld extends Scheduler { && @:privateAccess this.marble.serverTicks > this.serverStartTicks + 16 && @:privateAccess this.marble.serverTicks < this.serverStartTicks + 63)) { this.playGui.setCenterText('ready'); + this.playGui.doStateChangeSound('ready'); } if ((Net.isHost && (this.timeState.timeSinceLoad > startTime - 1.5) @@ -911,6 +919,7 @@ class MarbleWorld extends Scheduler { && @:privateAccess this.marble.serverTicks > this.serverStartTicks + 63 && @:privateAccess this.marble.serverTicks < this.serverStartTicks + 109)) { this.playGui.setCenterText('set'); + this.playGui.doStateChangeSound('set'); } if ((Net.isHost && (this.timeState.timeSinceLoad >= startTime)) // 3.5 == 109 ticks || (Net.isClient && this.serverStartTicks != 0 && @:privateAccess this.marble.serverTicks >= this.serverStartTicks + 109)) { @@ -922,6 +931,7 @@ class MarbleWorld extends Scheduler { this.playGui.redrawPlayerList(); // Update spectators display this.playGui.setCenterText('go'); + this.playGui.doStateChangeSound('go'); var huntMode = cast(this.gameMode, HuntMode); diff --git a/src/gui/PlayGui.hx b/src/gui/PlayGui.hx index 710046a2..ac7e4352 100644 --- a/src/gui/PlayGui.hx +++ b/src/gui/PlayGui.hx @@ -374,6 +374,23 @@ class PlayGui { } } + public function doStateChangeSound(state:String) { + static var curState = "none"; + if (curState != state) { + if (state == "ready") { + AudioManager.playSound(ResourceLoader.getResource('data/sound/ready.wav', ResourceLoader.getAudio, @:privateAccess this.soundResources)); + } + if (state == "set") { + AudioManager.playSound(ResourceLoader.getResource('data/sound/set.wav', ResourceLoader.getAudio, @:privateAccess this.soundResources)); + } + if (state == "go") { + AudioManager.playSound(ResourceLoader.getResource('data/sound/go.wav', ResourceLoader.getAudio, @:privateAccess this.soundResources)); + } + } + + curState = state; + } + public function initGemCounter(onFinish:Void->Void) { gemCountNumbers[0].position = new Vector(30, 0); gemCountNumbers[0].extent = new Vector(43, 55);