various reported bugfixes

This commit is contained in:
RandomityGuy 2024-07-15 22:29:29 +05:30
parent 8f3177a885
commit f41b169dca
11 changed files with 216 additions and 156 deletions

View file

@ -270,12 +270,14 @@ class CameraController extends Object {
cameraYawDelta = -cameraYawDelta; cameraYawDelta = -cameraYawDelta;
nextCameraYaw += 0.75 * 5 * cameraYawDelta * dt * Settings.gamepadSettings.cameraSensitivity; nextCameraYaw += 0.75 * 5 * cameraYawDelta * dt * Settings.gamepadSettings.cameraSensitivity;
nextCameraPitch = Math.max(-Math.PI / 2 + Math.PI / 4, Math.min(Math.PI / 2 - 0.0001, nextCameraPitch)); var limits = spectateMarbleIndex == -1 ? 0.0001 : Math.PI / 4;
nextCameraPitch = Math.max(-Math.PI / 2 + limits, Math.min(Math.PI / 2 - 0.0001, nextCameraPitch));
CameraYaw = nextCameraYaw; // Util.lerp(CameraYaw, nextCameraYaw, lerpt); CameraYaw = nextCameraYaw; // Util.lerp(CameraYaw, nextCameraYaw, lerpt);
CameraPitch = nextCameraPitch; // Util.lerp(CameraPitch, nextCameraPitch, lerpt); CameraPitch = nextCameraPitch; // Util.lerp(CameraPitch, nextCameraPitch, lerpt);
CameraPitch = Math.max(-Math.PI / 2 + Math.PI / 4, Math.min(Math.PI / 2 - 0.0001, CameraPitch)); // Util.clamp(CameraPitch, -Math.PI / 12, Math.PI / 2); CameraPitch = Math.max(-Math.PI / 2 + limits, Math.min(Math.PI / 2 - 0.0001, CameraPitch)); // Util.clamp(CameraPitch, -Math.PI / 12, Math.PI / 2);
function getRotQuat(v1:Vector, v2:Vector) { function getRotQuat(v1:Vector, v2:Vector) {
function orthogonal(v:Vector) { function orthogonal(v:Vector) {
@ -381,7 +383,8 @@ class CameraController extends Object {
|| (Util.isTouchDevice() || (Util.isTouchDevice()
&& MarbleGame.instance.touchInput.leftButton.pressed && MarbleGame.instance.touchInput.leftButton.pressed
&& MarbleGame.instance.touchInput.leftButton.didPressIt)) { && MarbleGame.instance.touchInput.leftButton.didPressIt)) {
MarbleGame.instance.touchInput.leftButton.didPressIt = false; if (Util.isTouchDevice())
MarbleGame.instance.touchInput.leftButton.didPressIt = false;
spectateMarbleIndex = (spectateMarbleIndex - 1 + level.marbles.length) % level.marbles.length; spectateMarbleIndex = (spectateMarbleIndex - 1 + level.marbles.length) % level.marbles.length;
@:privateAccess while (level.marbles[spectateMarbleIndex].connection == null @:privateAccess while (level.marbles[spectateMarbleIndex].connection == null
|| level.marbles[spectateMarbleIndex].connection.spectator) { || level.marbles[spectateMarbleIndex].connection.spectator) {
@ -393,7 +396,8 @@ class CameraController extends Object {
|| (Util.isTouchDevice() || (Util.isTouchDevice()
&& MarbleGame.instance.touchInput.rightButton.pressed && MarbleGame.instance.touchInput.rightButton.pressed
&& MarbleGame.instance.touchInput.rightButton.didPressIt)) { && MarbleGame.instance.touchInput.rightButton.didPressIt)) {
MarbleGame.instance.touchInput.rightButton.didPressIt = false; if (Util.isTouchDevice())
MarbleGame.instance.touchInput.rightButton.didPressIt = false;
spectateMarbleIndex = (spectateMarbleIndex + 1 + level.marbles.length) % level.marbles.length; spectateMarbleIndex = (spectateMarbleIndex + 1 + level.marbles.length) % level.marbles.length;
@:privateAccess while (level.marbles[spectateMarbleIndex].connection == null @:privateAccess while (level.marbles[spectateMarbleIndex].connection == null
|| level.marbles[spectateMarbleIndex].connection.spectator) { || level.marbles[spectateMarbleIndex].connection.spectator) {
@ -404,7 +408,8 @@ class CameraController extends Object {
if (Key.isPressed(Settings.controlsSettings.blast) if (Key.isPressed(Settings.controlsSettings.blast)
|| (MarbleGame.instance.touchInput.blastbutton.pressed && MarbleGame.instance.touchInput.blastbutton.didPressIt) || (MarbleGame.instance.touchInput.blastbutton.pressed && MarbleGame.instance.touchInput.blastbutton.didPressIt)
|| Gamepad.isPressed(Settings.gamepadSettings.blast)) { || Gamepad.isPressed(Settings.gamepadSettings.blast)) {
MarbleGame.instance.touchInput.blastbutton.didPressIt = false; if (Util.isTouchDevice())
MarbleGame.instance.touchInput.blastbutton.didPressIt = false;
spectateMarbleIndex = -1; spectateMarbleIndex = -1;
MarbleGame.instance.touchInput.setSpectatorControlsVisibility(false); MarbleGame.instance.touchInput.setSpectatorControlsVisibility(false);
return; return;

View file

@ -1,5 +1,6 @@
package src; package src;
import triggers.Trigger;
import net.Net; import net.Net;
import gui.MarbleSelectGui; import gui.MarbleSelectGui;
import net.NetPacket.MarbleNetFlags; import net.NetPacket.MarbleNetFlags;
@ -333,6 +334,9 @@ class Marble extends GameObject {
var lastRespawnTick:Int = -100000; var lastRespawnTick:Int = -100000;
var trapdoorContacts:Map<Int, Int> = []; var trapdoorContacts:Map<Int, Int> = [];
var shapeImmunity:Array<DtsObject> = [];
var shapeOrTriggerInside:Array<GameObject> = [];
public function new() { public function new() {
super(); super();
@ -1130,7 +1134,7 @@ class Marble extends GameObject {
// else // else
// gain = (contactVel - minVelocityBounceSoft) / (hardBounceSpeed - minVelocityBounceSoft) * (1.0 - gain) + gain; // gain = (contactVel - minVelocityBounceSoft) / (hardBounceSpeed - minVelocityBounceSoft) * (1.0 - gain) + gain;
if (!this.controllable) if (this.connection != null)
AudioManager.playSound(snd, this.getAbsPos().getPosition()); AudioManager.playSound(snd, this.getAbsPos().getPosition());
else else
snd.play(false, Settings.optionsSettings.soundVolume * gain); snd.play(false, Settings.optionsSettings.soundVolume * gain);
@ -1670,6 +1674,7 @@ class Marble extends GameObject {
if (Net.clientSpectate && this.connection == null) { if (Net.clientSpectate && this.connection == null) {
this.camera.enableSpectate(); this.camera.enableSpectate();
} }
this.blastTicks = 0;
return; return;
} }
@ -1866,7 +1871,7 @@ class Marble extends GameObject {
if (this.prevPos != null && this.level != null) { if (this.prevPos != null && this.level != null) {
var tempTimeState = timeState.clone(); var tempTimeState = timeState.clone();
tempTimeState.currentAttemptTime = passedTime; tempTimeState.currentAttemptTime = passedTime;
this.level.callCollisionHandlers(cast this, tempTimeState, oldPos, newPos); this.callCollisionHandlers(tempTimeState, oldPos, newPos);
} }
this.updateRollSound(timeState, contactTime / timeState.dt, this._slipAmount); this.updateRollSound(timeState, contactTime / timeState.dt, this._slipAmount);
@ -1917,6 +1922,128 @@ class Marble extends GameObject {
} }
} }
public function callCollisionHandlers(timeState:TimeState, start:Vector, end:Vector) {
var expansion = this._radius + 0.2;
var minP = new Vector(Math.min(start.x, end.x) - expansion, Math.min(start.y, end.y) - expansion, Math.min(start.z, end.z) - expansion);
var maxP = new Vector(Math.max(start.x, end.x) + expansion, Math.max(start.y, end.y) + expansion, Math.max(start.z, end.z) + expansion);
var box = Bounds.fromPoints(minP.toPoint(), maxP.toPoint());
// var marbleHitbox = new Bounds();
// marbleHitbox.addSpherePos(0, 0, 0, marble._radius);
// marbleHitbox.transform(startQuat.toMatrix());
// marbleHitbox.transform(endQuat.toMatrix());
// marbleHitbox.offset(end.x, end.y, end.z);
// spherebounds.addSpherePos(gjkCapsule.p2.x, gjkCapsule.p2.y, gjkCapsule.p2.z, gjkCapsule.radius);
var contacts = this.collisionWorld.boundingSearch(box);
// var contacts = marble.contactEntities;
var inside = [];
for (contact in contacts) {
if (contact.go != this) {
if (contact.go is DtsObject) {
var shape:DtsObject = cast contact.go;
if (contact.boundingBox.collide(box)) {
shape.onMarbleInside(cast this, timeState);
if (!this.shapeOrTriggerInside.contains(contact.go)) {
this.shapeOrTriggerInside.push(contact.go);
shape.onMarbleEnter(cast this, timeState);
}
inside.push(contact.go);
}
}
if (contact.go is Trigger) {
var trigger:Trigger = cast contact.go;
var triggeraabb = trigger.collider.boundingBox;
if (triggeraabb.collide(box)) {
trigger.onMarbleInside(cast this, timeState);
if (!this.shapeOrTriggerInside.contains(contact.go)) {
this.shapeOrTriggerInside.push(contact.go);
trigger.onMarbleEnter(cast this, timeState);
}
inside.push(contact.go);
}
}
}
}
for (object in shapeOrTriggerInside) {
if (!inside.contains(object)) {
this.shapeOrTriggerInside.remove(object);
object.onMarbleLeave(cast this, timeState);
}
}
if (this.level.finishTime == null && @:privateAccess this.level.endPad != null) {
if (box.collide(@:privateAccess this.level.endPad.finishBounds)) {
var padUp = @:privateAccess this.level.endPad.getAbsPos().up();
padUp = padUp.multiply(10);
var checkBounds = box.clone();
checkBounds.zMin -= 10;
checkBounds.zMax += 10;
var checkBoundsCenter = checkBounds.getCenter();
var checkSphereRadius = checkBounds.getMax().sub(checkBoundsCenter).length();
var checkSphere = new Bounds();
checkSphere.addSpherePos(checkBoundsCenter.x, checkBoundsCenter.y, checkBoundsCenter.z, checkSphereRadius);
var endpadBB = this.collisionWorld.boundingSearch(checkSphere, false);
var found = false;
for (collider in endpadBB) {
if (collider.go == @:privateAccess this.level.endPad) {
var chull = cast(collider, collision.CollisionEntity);
var chullinvT = @:privateAccess chull.invTransform.clone();
chullinvT.clone();
chullinvT.transpose();
for (surface in chull.surfaces) {
var i = 0;
while (i < surface.indices.length) {
var surfaceN = surface.getNormal(surface.indices[i]).transformed3x3(chullinvT);
var v1 = surface.getPoint(surface.indices[i]).transformed(chull.transform);
var surfaceD = -surfaceN.dot(v1);
if (surfaceN.dot(padUp.multiply(-10)) < 0) {
var dist = surfaceN.dot(checkBoundsCenter.toVector()) + surfaceD;
if (dist >= 0 && dist < 5) {
var intersectT = -(checkBoundsCenter.dot(surfaceN.toPoint()) + surfaceD) / (padUp.dot(surfaceN));
var intersectP = checkBoundsCenter.add(padUp.multiply(intersectT).toPoint()).toVector();
if (Collision.PointInTriangle(intersectP, v1, surface.getPoint(surface.indices[i + 1]).transformed(chull.transform),
surface.getPoint(surface.indices[i + 2]).transformed(chull.transform))) {
found = true;
break;
}
}
}
i += 3;
}
if (found) {
break;
}
}
if (found) {
break;
}
}
}
if (found) {
if (@:privateAccess !this.level.endPad.inFinish) {
@:privateAccess this.level.touchFinish();
@:privateAccess this.level.endPad.inFinish = true;
}
} else {
if (@:privateAccess this.level.endPad.inFinish)
@:privateAccess this.level.endPad.inFinish = false;
}
} else {
if (@:privateAccess this.level.endPad.inFinish)
@:privateAccess this.level.endPad.inFinish = false;
}
}
}
// MP Only Functions // MP Only Functions
public inline function clearNetFlags() { public inline function clearNetFlags() {
this.netFlags = 0; this.netFlags = 0;
@ -2438,7 +2565,7 @@ class Marble extends GameObject {
if (marble != cast this) { if (marble != cast this) {
var theirPos = marble.collider.transform.getPosition(); var theirPos = marble.collider.transform.getPosition();
var posDiff = ourPos.distance(theirPos); var posDiff = ourPos.distance(theirPos);
if (posDiff < strength) { if (posDiff < 5) {
var myMod = isMegaMarbleEnabled(timeState) ? 0.7 : 1.0; var myMod = isMegaMarbleEnabled(timeState) ? 0.7 : 1.0;
var theirMod = @:privateAccess marble.isMegaMarbleEnabled(timeState) ? 0.7 : 1.0; var theirMod = @:privateAccess marble.isMegaMarbleEnabled(timeState) ? 0.7 : 1.0;
var impulse = theirPos.sub(ourPos).normalized().multiply(strength * (theirMod / myMod)); var impulse = theirPos.sub(ourPos).normalized().multiply(strength * (theirMod / myMod));

View file

@ -156,9 +156,6 @@ class MarbleWorld extends Scheduler {
public var gems:Array<Gem> = []; public var gems:Array<Gem> = [];
public var namedObjects:Map<String, {obj:DtsObject, elem:MissionElementBase}> = []; public var namedObjects:Map<String, {obj:DtsObject, elem:MissionElementBase}> = [];
var shapeImmunity:Array<DtsObject> = [];
var shapeOrTriggerInside:Array<GameObject> = [];
public var timeState:TimeState = new TimeState(); public var timeState:TimeState = new TimeState();
public var bonusTime:Float = 0; public var bonusTime:Float = 0;
public var sky:Sky; public var sky:Sky;
@ -1893,8 +1890,6 @@ class MarbleWorld extends Scheduler {
} }
} }
if (radar != null)
radar.update(dt);
this.updateGameState(); this.updateGameState();
if (!this.isMultiplayer) if (!this.isMultiplayer)
this.updateBlast(this.marble, timeState); this.updateBlast(this.marble, timeState);
@ -2003,6 +1998,9 @@ class MarbleWorld extends Scheduler {
marble.camera.update(timeState.currentAttemptTime, realDt); marble.camera.update(timeState.currentAttemptTime, realDt);
} }
if (radar != null)
radar.update(dt);
ProfilerUI.measure("updateParticles"); ProfilerUI.measure("updateParticles");
if (this.rewinding) { if (this.rewinding) {
this.particleManager.update(1000 * timeState.timeSinceLoad, -realDt * rewindManager.timeScale); this.particleManager.update(1000 * timeState.timeSinceLoad, -realDt * rewindManager.timeScale);
@ -2052,7 +2050,7 @@ class MarbleWorld extends Scheduler {
} }
if (_instancesNeedsUpdate) { if (_instancesNeedsUpdate) {
if (this.radar != null) if (this.radar != null)
this.radar.render(this.serverStartTicks != 0); this.radar.render(this.serverStartTicks != 0 || !Net.isMP);
_instancesNeedsUpdate = false; _instancesNeedsUpdate = false;
this.instanceManager.render(); this.instanceManager.render();
} }
@ -2374,128 +2372,6 @@ class MarbleWorld extends Scheduler {
this.gameMode.onGemPickup(marble, gem); this.gameMode.onGemPickup(marble, gem);
} }
public function callCollisionHandlers(marble:Marble, timeState:TimeState, start:Vector, end:Vector) {
var expansion = marble._radius + 0.2;
var minP = new Vector(Math.min(start.x, end.x) - expansion, Math.min(start.y, end.y) - expansion, Math.min(start.z, end.z) - expansion);
var maxP = new Vector(Math.max(start.x, end.x) + expansion, Math.max(start.y, end.y) + expansion, Math.max(start.z, end.z) + expansion);
var box = Bounds.fromPoints(minP.toPoint(), maxP.toPoint());
// var marbleHitbox = new Bounds();
// marbleHitbox.addSpherePos(0, 0, 0, marble._radius);
// marbleHitbox.transform(startQuat.toMatrix());
// marbleHitbox.transform(endQuat.toMatrix());
// marbleHitbox.offset(end.x, end.y, end.z);
// spherebounds.addSpherePos(gjkCapsule.p2.x, gjkCapsule.p2.y, gjkCapsule.p2.z, gjkCapsule.radius);
var contacts = this.collisionWorld.boundingSearch(box);
// var contacts = marble.contactEntities;
var inside = [];
for (contact in contacts) {
if (contact.go != marble) {
if (contact.go is DtsObject) {
var shape:DtsObject = cast contact.go;
if (contact.boundingBox.collide(box)) {
shape.onMarbleInside(marble, timeState);
if (!this.shapeOrTriggerInside.contains(contact.go)) {
this.shapeOrTriggerInside.push(contact.go);
shape.onMarbleEnter(marble, timeState);
}
inside.push(contact.go);
}
}
if (contact.go is Trigger) {
var trigger:Trigger = cast contact.go;
var triggeraabb = trigger.collider.boundingBox;
if (triggeraabb.collide(box)) {
trigger.onMarbleInside(marble, timeState);
if (!this.shapeOrTriggerInside.contains(contact.go)) {
this.shapeOrTriggerInside.push(contact.go);
trigger.onMarbleEnter(marble, timeState);
}
inside.push(contact.go);
}
}
}
}
for (object in shapeOrTriggerInside) {
if (!inside.contains(object)) {
this.shapeOrTriggerInside.remove(object);
object.onMarbleLeave(marble, timeState);
}
}
if (this.finishTime == null && this.endPad != null) {
if (box.collide(this.endPad.finishBounds)) {
var padUp = this.endPad.getAbsPos().up();
padUp = padUp.multiply(10);
var checkBounds = box.clone();
checkBounds.zMin -= 10;
checkBounds.zMax += 10;
var checkBoundsCenter = checkBounds.getCenter();
var checkSphereRadius = checkBounds.getMax().sub(checkBoundsCenter).length();
var checkSphere = new Bounds();
checkSphere.addSpherePos(checkBoundsCenter.x, checkBoundsCenter.y, checkBoundsCenter.z, checkSphereRadius);
var endpadBB = this.collisionWorld.boundingSearch(checkSphere, false);
var found = false;
for (collider in endpadBB) {
if (collider.go == this.endPad) {
var chull = cast(collider, collision.CollisionEntity);
var chullinvT = @:privateAccess chull.invTransform.clone();
chullinvT.clone();
chullinvT.transpose();
for (surface in chull.surfaces) {
var i = 0;
while (i < surface.indices.length) {
var surfaceN = surface.getNormal(surface.indices[i]).transformed3x3(chullinvT);
var v1 = surface.getPoint(surface.indices[i]).transformed(chull.transform);
var surfaceD = -surfaceN.dot(v1);
if (surfaceN.dot(padUp.multiply(-10)) < 0) {
var dist = surfaceN.dot(checkBoundsCenter.toVector()) + surfaceD;
if (dist >= 0 && dist < 5) {
var intersectT = -(checkBoundsCenter.dot(surfaceN.toPoint()) + surfaceD) / (padUp.dot(surfaceN));
var intersectP = checkBoundsCenter.add(padUp.multiply(intersectT).toPoint()).toVector();
if (Collision.PointInTriangle(intersectP, v1, surface.getPoint(surface.indices[i + 1]).transformed(chull.transform),
surface.getPoint(surface.indices[i + 2]).transformed(chull.transform))) {
found = true;
break;
}
}
}
i += 3;
}
if (found) {
break;
}
}
if (found) {
break;
}
}
}
if (found) {
if (!endPad.inFinish) {
touchFinish();
endPad.inFinish = true;
}
} else {
if (endPad.inFinish)
endPad.inFinish = false;
}
} else {
if (endPad.inFinish)
endPad.inFinish = false;
}
}
}
function touchFinish() { function touchFinish() {
if (this.finishTime != null if (this.finishTime != null
|| (this.marble.outOfBounds && this.timeState.currentAttemptTime - this.marble.outOfBoundsTime.currentAttemptTime >= 0.5)) || (this.marble.outOfBounds && this.timeState.currentAttemptTime - this.marble.outOfBoundsTime.currentAttemptTime >= 0.5))
@ -3032,8 +2908,6 @@ class MarbleWorld extends Scheduler {
collisionWorld = null; collisionWorld = null;
particleManager = null; particleManager = null;
namedObjects = null; namedObjects = null;
shapeOrTriggerInside = null;
shapeImmunity = null;
currentCheckpoint = null; currentCheckpoint = null;
checkpointCollectedGems = null; checkpointCollectedGems = null;
marble = null; marble = null;

View file

@ -95,7 +95,7 @@ class Radar {
} }
for (marble in level.marbles) { for (marble in level.marbles) {
if (marble != level.marble) { if (marble != level.marble) {
var shapePos = marble.getAbsPos().getPosition(); var shapePos = @:privateAccess marble.lastRenderPos.clone();
var shapeDir = shapePos.sub(level.scene.camera.pos); var shapeDir = shapePos.sub(level.scene.camera.pos);
var shapeDist = shapeDir.lengthSq(); var shapeDist = shapeDir.lengthSq();
if (shapeDist == 0 || shapeDist > level.scene.camera.zFar * level.scene.camera.zFar) { if (shapeDist == 0 || shapeDist > level.scene.camera.zFar * level.scene.camera.zFar) {
@ -166,7 +166,9 @@ class Radar {
if (validProjection && tile != null) { if (validProjection && tile != null) {
g.lineStyle(0, 0, 0); g.lineStyle(0, 0, 0);
g.drawTile(projectedPos.x - tile.width / 2, projectedPos.y - tile.height / 2, tile); g.beginTileFill(projectedPos.x - tile.width / 2, projectedPos.y - tile.height / 2, Settings.uiScale, Settings.uiScale, tile);
g.drawRect(projectedPos.x - tile.width / 2, projectedPos.y - tile.height / 2, tile.width, tile.height);
g.endFill();
} else if (!validProjection) { } else if (!validProjection) {
var centerDiff = projectedPos.sub(new Vector(scene2d.width / 2, scene2d.height / 2)); var centerDiff = projectedPos.sub(new Vector(scene2d.width / 2, scene2d.height / 2));

View file

@ -32,8 +32,9 @@ class Canvas extends GuiControl {
} }
public function pushDialog(content:GuiControl) { public function pushDialog(content:GuiControl) {
this.content.onDormant(scene2d);
this.addChild(content); this.addChild(content);
this.render(scene2d); content.render(scene2d, this._flow);
} }
public function popDialog(content:GuiControl, dispose:Bool = true) { public function popDialog(content:GuiControl, dispose:Bool = true) {

View file

@ -368,6 +368,12 @@ class GuiControl {
public function onMouseMove(mouseState:MouseState) {} public function onMouseMove(mouseState:MouseState) {}
public function onDormant(scene2d:h2d.Scene) {
for (ch in this.children) {
ch.onDormant(scene2d);
}
}
public function onScroll(scrollX:Float, scrollY:Float) {} public function onScroll(scrollX:Float, scrollY:Float) {}
public function onRemove() { public function onRemove() {

View file

@ -128,6 +128,14 @@ class GuiScrollCtrl extends GuiControl {
scene2d.addChild(scrollBarY); scene2d.addChild(scrollBarY);
scene2d.addChild(clickInteractive); scene2d.addChild(clickInteractive);
var renderRect = this.getRenderRectangle();
if (scrollToBottom) {
var scrollBarYSize = renderRect.extent.y * renderRect.extent.y / (this.maxScrollY * Settings.uiScale);
this.scrollY = renderRect.extent.y - scrollBarYSize * Settings.uiScale;
} else {
this.scrollY = 0;
}
updateScrollVisual(); updateScrollVisual();
super.render(scene2d, parent); super.render(scene2d, parent);
@ -135,6 +143,19 @@ class GuiScrollCtrl extends GuiControl {
var ch = this._flow.getChildAt(i); var ch = this._flow.getChildAt(i);
_contentYPositions.set(ch, ch.y); _contentYPositions.set(ch, ch.y);
} }
if (scrollToBottom) {
updateScrollVisual();
}
}
public override function onDormant(scene2d:h2d.Scene) {
super.onDormant(scene2d);
if (scene2d.contains(scrollBarY))
scene2d.removeChild(scrollBarY);
if (scene2d.contains(clickInteractive))
scene2d.removeChild(clickInteractive);
} }
public function updateScrollVisual() { public function updateScrollVisual() {

View file

@ -159,23 +159,25 @@ class MPPlayMissionGui extends GuiImage {
} }
window.addChild(leaveBtn); window.addChild(leaveBtn);
var searchBtn = new GuiButton(loadButtonImages("data/ui/mp/play/search")); var searchBtn = new GuiButton(loadButtonImagesExt("data/ui/mp/play/search"));
searchBtn.position = new Vector(255, 514); searchBtn.position = new Vector(255, 514);
searchBtn.extent = new Vector(44, 44); searchBtn.extent = new Vector(44, 44);
searchBtn.pressedAction = (e) -> { searchBtn.pressedAction = (e) -> {
MarbleGame.canvas.pushDialog(new MPSearchGui(currentCategory == "custom")); MarbleGame.canvas.pushDialog(new MPSearchGui(currentCategory == "custom"));
} }
if (Net.isHost) window.addChild(searchBtn);
window.addChild(searchBtn); if (Net.isClient)
searchBtn.disabled = true;
var kickBtn = new GuiButton(loadButtonImages("data/ui/mp/play/kick")); var kickBtn = new GuiButton(loadButtonImagesExt("data/ui/mp/play/kick"));
kickBtn.position = new Vector(304, 514); kickBtn.position = new Vector(304, 514);
kickBtn.extent = new Vector(44, 44); kickBtn.extent = new Vector(44, 44);
kickBtn.pressedAction = (e) -> { kickBtn.pressedAction = (e) -> {
MarbleGame.canvas.pushDialog(new MPKickBanDlg()); MarbleGame.canvas.pushDialog(new MPKickBanDlg());
} }
if (Net.isHost) window.addChild(kickBtn);
window.addChild(kickBtn); if (Net.isClient)
kickBtn.disabled = true;
var serverSettingsBtn = new GuiButton(loadButtonImagesExt("data/ui/mp/play/settings")); var serverSettingsBtn = new GuiButton(loadButtonImagesExt("data/ui/mp/play/settings"));
serverSettingsBtn.position = new Vector(157, 514); serverSettingsBtn.position = new Vector(157, 514);
@ -183,8 +185,9 @@ class MPPlayMissionGui extends GuiImage {
serverSettingsBtn.pressedAction = (e) -> { serverSettingsBtn.pressedAction = (e) -> {
MarbleGame.canvas.pushDialog(new MPServerDlg()); MarbleGame.canvas.pushDialog(new MPServerDlg());
} }
if (Net.isHost) window.addChild(serverSettingsBtn);
window.addChild(serverSettingsBtn); if (Net.isClient)
serverSettingsBtn.disabled = true;
var marbleSelectBtn = new GuiButton(loadButtonImages("data/ui/mp/play/marble")); var marbleSelectBtn = new GuiButton(loadButtonImages("data/ui/mp/play/marble"));
marbleSelectBtn.position = new Vector(206, 514); marbleSelectBtn.position = new Vector(206, 514);
@ -219,7 +222,7 @@ class MPPlayMissionGui extends GuiImage {
} }
difficultyPopover.addChild(difficultyPopoverInner); difficultyPopover.addChild(difficultyPopoverInner);
var difficultySelector = new GuiButton(loadButtonImages("data/ui/mp/play/difficulty_beginner")); var difficultySelector = new GuiButton(loadButtonImagesExt("data/ui/mp/play/difficulty_beginner"));
difficultySelector.position = new Vector(161, 47); difficultySelector.position = new Vector(161, 47);
difficultySelector.extent = new Vector(204, 44); difficultySelector.extent = new Vector(204, 44);
if (isHost) if (isHost)
@ -472,7 +475,7 @@ class MPPlayMissionGui extends GuiImage {
} else } else
currentList = MissionList.missionList["multiplayer"][category]; currentList = MissionList.missionList["multiplayer"][category];
@:privateAccess difficultySelector.anim.frames = loadButtonImages('data/ui/mp/play/difficulty_${category}'); @:privateAccess difficultySelector.anim.frames = loadButtonImagesExt('data/ui/mp/play/difficulty_${category}');
if (category == "beginner") { if (category == "beginner") {
difficulty0.txtCtrl.text.text = "Intermediate"; difficulty0.txtCtrl.text.text = "Intermediate";

View file

@ -439,6 +439,9 @@ class PlayGui {
var GEM_COLORS = ["blue", "red", "yellow", "purple", "green", "turquoise", "orange", "black"]; var GEM_COLORS = ["blue", "red", "yellow", "purple", "green", "turquoise", "orange", "black"];
var gemColor = GEM_COLORS[Math.floor(Math.random() * GEM_COLORS.length)]; var gemColor = GEM_COLORS[Math.floor(Math.random() * GEM_COLORS.length)];
if (MarbleGame.instance.world.mission.missionInfo.game == "PlatinumQuest")
gemColor = "platinum";
gemImageObject = new DtsObject(); gemImageObject = new DtsObject();
gemImageObject.dtsPath = "data/shapes/items/gem.dts"; gemImageObject.dtsPath = "data/shapes/items/gem.dts";
gemImageObject.ambientRotate = true; gemImageObject.ambientRotate = true;
@ -702,6 +705,7 @@ class PlayGui {
var col1 = "#CDCDCD"; var col1 = "#CDCDCD";
var col2 = "#D19275"; var col2 = "#D19275";
var col3 = "#FFEE99"; var col3 = "#FFEE99";
var prevLead = playerList[0].us;
playerList.sort((a, b) -> a.score > b.score ? -1 : (a.score < b.score ? 1 : 0)); playerList.sort((a, b) -> a.score > b.score ? -1 : (a.score < b.score ? 1 : 0));
for (i in 0...playerList.length) { for (i in 0...playerList.length) {
var item = playerList[i]; var item = playerList[i];
@ -739,6 +743,17 @@ class PlayGui {
} }
playerListCtrl.setTexts(pl); playerListCtrl.setTexts(pl);
playerListScoresCtrl.setTexts(plScores); playerListScoresCtrl.setTexts(plScores);
if ((playerList[0].us && !prevLead)) {
gemCountNumbers[0].anim.currentFrame += 10;
gemCountNumbers[1].anim.currentFrame += 10;
gemCountNumbers[2].anim.currentFrame += 10;
}
if (prevLead && !playerList[0].us) {
gemCountNumbers[0].anim.currentFrame -= 10;
gemCountNumbers[1].anim.currentFrame -= 10;
gemCountNumbers[2].anim.currentFrame -= 10;
}
} }
public function addPlayer(id:Int, name:String, us:Bool) { public function addPlayer(id:Int, name:String, us:Bool) {
@ -1045,9 +1060,11 @@ class PlayGui {
gemCountNumbers[4].anim.visible = false; gemCountNumbers[4].anim.visible = false;
gemCountNumbers[5].anim.visible = false; gemCountNumbers[5].anim.visible = false;
gemCountNumbers[0].anim.currentFrame = 10 + collectedHundredths; var off = playerList[0].us ? 10 : 0;
gemCountNumbers[1].anim.currentFrame = 10 + collectedTenths;
gemCountNumbers[2].anim.currentFrame = 10 + collectedOnes; gemCountNumbers[0].anim.currentFrame = off + collectedHundredths;
gemCountNumbers[1].anim.currentFrame = off + collectedTenths;
gemCountNumbers[2].anim.currentFrame = off + collectedOnes;
gemCountSlash.bmp.visible = false; gemCountSlash.bmp.visible = false;
gemImageSceneTargetBitmap.visible = true; gemImageSceneTargetBitmap.visible = true;
} }

View file

@ -26,7 +26,7 @@ class ExplodablePredictionStore {
predictions[packet.explodableId] = packet.serverTicks; predictions[packet.explodableId] = packet.serverTicks;
if (!world.explodablesToTick.contains(packet.explodableId)) if (!world.explodablesToTick.contains(packet.explodableId))
world.explodablesToTick.push(packet.explodableId); world.explodablesToTick.push(packet.explodableId);
world.explodables[packet.explodableId].playExplosionSound(); world.explodables[packet.explodableId].playExplosion();
} }
public inline function reset() { public inline function reset() {

View file

@ -79,9 +79,13 @@ abstract class Explodable extends DtsObject {
}); });
} }
public inline function playExplosionSound() { public inline function playExplosion() {
if (!this.level.rewinding && !Net.isClient) if (!this.level.rewinding && !Net.isClient)
AudioManager.playSound(ResourceLoader.getResource(explodeSoundFile, ResourceLoader.getAudio, this.soundResources)); AudioManager.playSound(ResourceLoader.getResource(explodeSoundFile, ResourceLoader.getAudio, this.soundResources));
emitter1 = this.level.particleManager.createEmitter(particle, particleData, this.getAbsPos().getPosition());
emitter2 = this.level.particleManager.createEmitter(smokeParticle, smokeParticleData, this.getAbsPos().getPosition());
emitter3 = this.level.particleManager.createEmitter(sparksParticle, sparkParticleData, this.getAbsPos().getPosition());
} }
override function onMarbleContact(marble:src.Marble, timeState:TimeState, ?contact:CollisionInfo) { override function onMarbleContact(marble:src.Marble, timeState:TimeState, ?contact:CollisionInfo) {