various bugfixes from testing

This commit is contained in:
RandomityGuy 2024-07-06 01:47:49 +05:30
parent 85ce3b5507
commit 26ed1cb820
10 changed files with 44 additions and 14 deletions

View file

@ -111,7 +111,9 @@ class InstanceManager {
var renderFrustum = scene.camera.frustum; var renderFrustum = scene.camera.frustum;
var doFrustumCheck = true; var doFrustumCheck = true;
// This sucks holy shit // This sucks holy shit
doFrustumCheck = MarbleGame.instance.world != null && MarbleGame.instance.world.marble.cubemapRenderer != null; doFrustumCheck = MarbleGame.instance.world != null
&& MarbleGame.instance.world.marble.cubemapRenderer != null
&& @:privateAccess !MarbleGame.instance.world.marble.camera.spectate;
var cameraFrustrums = doFrustumCheck ? MarbleGame.instance.world.marble.cubemapRenderer.getCameraFrustums() : null; var cameraFrustrums = doFrustumCheck ? MarbleGame.instance.world.marble.cubemapRenderer.getCameraFrustums() : null;
for (meshes in objects) { for (meshes in objects) {

View file

@ -387,6 +387,7 @@ class Marble extends GameObject {
this.lastRenderPos = new Vector(); this.lastRenderPos = new Vector();
this.netSmoothOffset = new Vector(); this.netSmoothOffset = new Vector();
this.netCorrected = false; this.netCorrected = false;
this.currentUp = new Vector(0, 0, 1);
var marbleDts = new DtsObject(); var marbleDts = new DtsObject();
var marbleShader = ""; var marbleShader = "";
@ -772,8 +773,6 @@ class Marble extends GameObject {
} }
function computeMoveForces(m:Move, aControl:Vector, desiredOmega:Vector) { function computeMoveForces(m:Move, aControl:Vector, desiredOmega:Vector) {
if (this.currentUp == null)
this.currentUp = new Vector(0, 0, 1);
var currentGravityDir = this.currentUp.multiply(-1); var currentGravityDir = this.currentUp.multiply(-1);
var R = currentGravityDir.multiply(-this._radius); var R = currentGravityDir.multiply(-this._radius);
var rollVelocity = this.omega.cross(R); var rollVelocity = this.omega.cross(R);
@ -1971,7 +1970,8 @@ class Marble extends GameObject {
this.shockAbsorberUseTick = p.shockAbsorberTick; this.shockAbsorberUseTick = p.shockAbsorberTick;
this.serverUsePowerup = p.netFlags & MarbleNetFlags.UsePowerup > 0; this.serverUsePowerup = p.netFlags & MarbleNetFlags.UsePowerup > 0;
// this.currentUp = p.gravityDirection; // this.currentUp = p.gravityDirection;
this.level.setUp(cast this, p.gravityDirection, this.level.timeState); if (p.gravityDirection != null)
this.level.setUp(cast this, p.gravityDirection, this.level.timeState);
if (this.outOfBounds && !p.oob && this.controllable) if (this.outOfBounds && !p.oob && this.controllable)
@:privateAccess this.level.playGui.setCenterText(''); @:privateAccess this.level.playGui.setCenterText('');
this.outOfBounds = p.oob; this.outOfBounds = p.oob;
@ -1993,6 +1993,14 @@ class Marble extends GameObject {
@:privateAccess level.trapdoorPredictions.acknowledgeTrapdoorUpdate(tId, tTime); @:privateAccess level.trapdoorPredictions.acknowledgeTrapdoorUpdate(tId, tTime);
} }
} }
if (p.netFlags & MarbleNetFlags.DoBlast > 0 && blastUseTick != 0 && !this.controllable) {
var ublast = p.netFlags & MarbleNetFlags.DoUltraBlast > 0;
this.level.particleManager.createEmitter(ublast ? blastMaxParticleOptions : blastParticleOptions, ublast ? blastMaxEmitterData : blastEmitterData,
this.getAbsPos().getPosition(), () -> {
this.getAbsPos().getPosition().add(this.currentUp.multiply(-this._radius * 0.4));
},
new Vector(1, 1, 1).add(new Vector(Math.abs(this.currentUp.x), Math.abs(this.currentUp.y), Math.abs(this.currentUp.z)).multiply(-0.8)));
}
// if (Net.isClient && !this.controllable && (this.serverTicks - this.blastUseTick) < 12) { // if (Net.isClient && !this.controllable && (this.serverTicks - this.blastUseTick) < 12) {
// var ticksSince = (this.serverTicks - this.blastUseTick); // var ticksSince = (this.serverTicks - this.blastUseTick);
// if (ticksSince >= 0) { // if (ticksSince >= 0) {
@ -2424,6 +2432,12 @@ class Marble extends GameObject {
} }
} }
} }
if (Net.isHost) {
this.blastUseTick = timeState.ticks;
this.netFlags |= MarbleNetFlags.DoBlast;
if (blastAmt > 1)
this.netFlags |= MarbleNetFlags.DoUltraBlast;
}
} else { } else {
if (this.blastAmount < 0.2 || this.level.game != "ultra") if (this.blastAmount < 0.2 || this.level.game != "ultra")
return; return;

View file

@ -1,5 +1,6 @@
package src; package src;
import gui.JoinServerGui;
import gui.MPPreGameDlg; import gui.MPPreGameDlg;
import gui.MPExitGameDlg; import gui.MPExitGameDlg;
import gui.GuiControl; import gui.GuiControl;
@ -253,6 +254,7 @@ class MarbleGame {
quitMission(Net.isClient); quitMission(Net.isClient);
if (Net.isMP && Net.isClient) { if (Net.isMP && Net.isClient) {
Net.disconnect(); Net.disconnect();
canvas.setContent(new JoinServerGui());
} }
}); });
} else { } else {

View file

@ -786,11 +786,10 @@ class MarbleWorld extends Scheduler {
for (interior in this.interiors) for (interior in this.interiors)
interior.reset(); interior.reset();
this.setUp(this.marble, startquat.up, this.timeState, true);
this.deselectPowerUp(this.marble);
this.orientationChangeTime = -1e8;
this.oldOrientationQuat = new Quat(); this.oldOrientationQuat = new Quat();
this.newOrientationQuat = new Quat(); this.newOrientationQuat = new Quat();
this.orientationChangeTime = -1e8;
this.setUp(this.marble, startquat.up, this.timeState, true);
this.deselectPowerUp(this.marble); this.deselectPowerUp(this.marble);
AudioManager.playSound(ResourceLoader.getResource('data/sound/spawn.wav', ResourceLoader.getAudio, this.soundResources)); AudioManager.playSound(ResourceLoader.getResource('data/sound/spawn.wav', ResourceLoader.getAudio, this.soundResources));

View file

@ -263,6 +263,8 @@ class Mission {
alarmStart = 15; alarmStart = 15;
if (this.missionInfo.alarmstarttime != null) if (this.missionInfo.alarmstarttime != null)
alarmStart = MisParser.parseNumber(this.missionInfo.alarmstarttime); alarmStart = MisParser.parseNumber(this.missionInfo.alarmstarttime);
if (alarmStart == 0)
alarmStart = 15;
return alarmStart; return alarmStart;
} }
alarmStart = 0; alarmStart = 0;

View file

@ -221,11 +221,11 @@ class JoinServerGui extends GuiImage {
var joinFunc = (password:String) -> { var joinFunc = (password:String) -> {
if (curSelection != -1) { if (curSelection != -1) {
var selectedServerVersion = ourServerList[curSelection].version; var selectedServerVersion = ourServerList[curSelection].version;
// if (selectedServerVersion != MarbleGame.currentVersion) { if (selectedServerVersion != MarbleGame.currentVersion) {
// var pup = new MessageBoxOkDlg("You are using a different version of the game than the server. Please update your game."); var pup = new MessageBoxOkDlg("You are using a different version of the game than the server. Please update your game.");
// MarbleGame.canvas.pushDialog(pup); MarbleGame.canvas.pushDialog(pup);
// return; return;
// } }
MarbleGame.canvas.setContent(new MPMessageGui("Please Wait", "Connecting")); MarbleGame.canvas.setContent(new MPMessageGui("Please Wait", "Connecting"));
var failed = true; var failed = true;

View file

@ -26,6 +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();
} }
public inline function reset() { public inline function reset() {

View file

@ -220,7 +220,7 @@ class MasterServerClient {
password: serverInfo.password, password: serverInfo.password,
state: serverInfo.state, state: serverInfo.state,
platform: serverInfo.platform, platform: serverInfo.platform,
version: "MBP" // MarbleGame.currentVersion version: MarbleGame.currentVersion
})); }));
} }

View file

@ -50,6 +50,7 @@ enum abstract MarbleNetFlags(Int) from Int to Int {
var GravityChange = 1 << 6; var GravityChange = 1 << 6;
var UsePowerup = 1 << 7; var UsePowerup = 1 << 7;
var UpdateTrapdoor = 1 << 8; var UpdateTrapdoor = 1 << 8;
var DoUltraBlast = 1 << 9;
} }
@:publicFields @:publicFields
@ -95,6 +96,7 @@ class MarbleUpdatePacket implements NetPacket {
b.writeInt(blastAmount, 11); b.writeInt(blastAmount, 11);
if (netFlags & MarbleNetFlags.DoBlast > 0) { if (netFlags & MarbleNetFlags.DoBlast > 0) {
b.writeFlag(true); b.writeFlag(true);
b.writeFlag(netFlags & MarbleNetFlags.DoUltraBlast > 0);
b.writeUInt16(blastTick); b.writeUInt16(blastTick);
} else { } else {
b.writeFlag(false); b.writeFlag(false);
@ -173,6 +175,9 @@ class MarbleUpdatePacket implements NetPacket {
blastAmount = b.readInt(11); blastAmount = b.readInt(11);
this.netFlags = 0; this.netFlags = 0;
if (b.readFlag()) { if (b.readFlag()) {
if (b.readFlag()) {
this.netFlags |= MarbleNetFlags.DoUltraBlast;
}
blastTick = b.readUInt16(); blastTick = b.readUInt16();
this.netFlags |= MarbleNetFlags.DoBlast; this.netFlags |= MarbleNetFlags.DoBlast;
} }

View file

@ -79,6 +79,11 @@ abstract class Explodable extends DtsObject {
}); });
} }
public inline function playExplosionSound() {
if (!this.level.rewinding && !Net.isClient)
AudioManager.playSound(ResourceLoader.getResource(explodeSoundFile, ResourceLoader.getAudio, this.soundResources));
}
override function onMarbleContact(marble:src.Marble, timeState:TimeState, ?contact:CollisionInfo) { override function onMarbleContact(marble:src.Marble, timeState:TimeState, ?contact:CollisionInfo) {
if (this.isCollideable && !this.level.rewinding) { if (this.isCollideable && !this.level.rewinding) {
// marble.velocity = marble.velocity.add(vec); // marble.velocity = marble.velocity.add(vec);
@ -90,7 +95,7 @@ abstract class Explodable extends DtsObject {
} }
this.setCollisionEnabled(false); this.setCollisionEnabled(false);
if (!this.level.rewinding && @:privateAccess !marble.isNetUpdate) if (!this.level.rewinding && @:privateAccess !marble.isNetUpdate && !Net.isClient)
AudioManager.playSound(ResourceLoader.getResource(explodeSoundFile, ResourceLoader.getAudio, this.soundResources)); AudioManager.playSound(ResourceLoader.getResource(explodeSoundFile, ResourceLoader.getAudio, this.soundResources));
if (@:privateAccess !marble.isNetUpdate) { if (@:privateAccess !marble.isNetUpdate) {
emitter1 = this.level.particleManager.createEmitter(particle, particleData, this.getAbsPos().getPosition()); emitter1 = this.level.particleManager.createEmitter(particle, particleData, this.getAbsPos().getPosition());