mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-02-18 12:11:03 +00:00
get more powerups networked
This commit is contained in:
parent
a34abc2fe1
commit
55b08c4e6a
8 changed files with 232 additions and 78 deletions
199
src/Marble.hx
199
src/Marble.hx
|
|
@ -210,6 +210,8 @@ class Marble extends GameObject {
|
|||
|
||||
public var _radius = 0.2;
|
||||
|
||||
var _dtsRadius = 0.2;
|
||||
|
||||
var _prevRadius:Float;
|
||||
|
||||
var _maxRollVelocity:Float = 15;
|
||||
|
|
@ -476,6 +478,7 @@ class Marble extends GameObject {
|
|||
// Calculate radius according to marble model (egh)
|
||||
var b = marbleDts.getBounds();
|
||||
var avgRadius = (b.xSize + b.ySize + b.zSize) / 6;
|
||||
_dtsRadius = avgRadius;
|
||||
if (isUltra) {
|
||||
this._radius = 0.3;
|
||||
marbleDts.scale(0.3 / avgRadius);
|
||||
|
|
@ -709,7 +712,7 @@ class Marble extends GameObject {
|
|||
return return true;
|
||||
}
|
||||
|
||||
function velocityCancel(currentTime:Float, dt:Float, surfaceSlide:Bool, noBounce:Bool, stoppedPaths:Bool, pi:Array<PathedInterior>) {
|
||||
function velocityCancel(timeState:TimeState, surfaceSlide:Bool, noBounce:Bool, stoppedPaths:Bool, pi:Array<PathedInterior>) {
|
||||
var SurfaceDotThreshold = 0.0001;
|
||||
var looped = false;
|
||||
var itersIn = 0;
|
||||
|
|
@ -727,7 +730,7 @@ class Marble extends GameObject {
|
|||
|
||||
if (!_bounceYet) {
|
||||
_bounceYet = true;
|
||||
playBoundSound(currentTime, -surfaceDot);
|
||||
playBoundSound(timeState.currentAttemptTime, -surfaceDot);
|
||||
}
|
||||
|
||||
if (noBounce) {
|
||||
|
|
@ -765,10 +768,10 @@ class Marble extends GameObject {
|
|||
this.velocity.load(this.velocity.sub(surfaceVel));
|
||||
} else {
|
||||
var restitution = this._bounceRestitution;
|
||||
if (currentTime - this.superBounceEnableTime < 5) {
|
||||
if (isSuperBounceEnabled(timeState)) {
|
||||
restitution = 0.9;
|
||||
}
|
||||
if (currentTime - this.shockAbsorberEnableTime < 5) {
|
||||
if (isShockAbsorberEnabled(timeState)) {
|
||||
restitution = 0.01;
|
||||
}
|
||||
restitution *= contacts[i].restitution;
|
||||
|
|
@ -1522,7 +1525,7 @@ class Marble extends GameObject {
|
|||
m.d = new Vector();
|
||||
}
|
||||
|
||||
if (this.blastTicks < (30000 >> 5))
|
||||
if (Net.isMP && this.blastTicks < (25000 >> 5))
|
||||
this.blastTicks += 1;
|
||||
|
||||
if (Net.isClient)
|
||||
|
|
@ -1581,7 +1584,7 @@ class Marble extends GameObject {
|
|||
var desiredOmega = new Vector();
|
||||
var isCentered = this.computeMoveForces(m, aControl, desiredOmega);
|
||||
|
||||
stoppedPaths = this.velocityCancel(timeState.currentAttemptTime, timeStep, isCentered, false, stoppedPaths, pathedInteriors);
|
||||
stoppedPaths = this.velocityCancel(timeState, isCentered, false, stoppedPaths, pathedInteriors);
|
||||
var A = this.getExternalForces(tempState, m);
|
||||
var a = this.applyContactForces(timeStep, m, isCentered, aControl, desiredOmega, A);
|
||||
|
||||
|
|
@ -1601,7 +1604,7 @@ class Marble extends GameObject {
|
|||
this.velocity.y = 0;
|
||||
this.velocity.x = 0;
|
||||
}
|
||||
stoppedPaths = this.velocityCancel(timeState.currentAttemptTime, timeStep, isCentered, true, stoppedPaths, pathedInteriors);
|
||||
stoppedPaths = this.velocityCancel(timeState, isCentered, true, stoppedPaths, pathedInteriors);
|
||||
this._totalTime += timeStep;
|
||||
if (contacts.length != 0) {
|
||||
this._contactTime += timeStep;
|
||||
|
|
@ -1730,26 +1733,20 @@ class Marble extends GameObject {
|
|||
if (this.megaMarbleUseTick > 0) {
|
||||
if (Net.isHost) {
|
||||
if ((timeState.ticks - this.megaMarbleUseTick) <= 312 && this.megaMarbleUseTick > 0) {
|
||||
this._radius = 0.675;
|
||||
this.collider.radius = 0.675;
|
||||
this._radius = 0.6666;
|
||||
this.collider.radius = 0.6666;
|
||||
} else if ((timeState.ticks - this.megaMarbleUseTick) > 312) {
|
||||
this.collider.radius = this._radius = 0.2;
|
||||
if (!this.isNetUpdate && this.controllable)
|
||||
AudioManager.playSound(ResourceLoader.getResource("data/sound/MegaShrink.wav", ResourceLoader.getAudio, this.soundResources), null,
|
||||
false);
|
||||
this.megaMarbleUseTick = 0;
|
||||
this.netFlags |= MarbleNetFlags.DoMega;
|
||||
}
|
||||
}
|
||||
if (Net.isClient) {
|
||||
if (this.serverTicks - this.megaMarbleUseTick <= 312 && this.megaMarbleUseTick > 0) {
|
||||
this._radius = 0.675;
|
||||
this.collider.radius = 0.675;
|
||||
this._radius = 0.6666;
|
||||
this.collider.radius = 0.6666;
|
||||
} else {
|
||||
this.collider.radius = this._radius = 0.2;
|
||||
if (!this.isNetUpdate && this.controllable)
|
||||
AudioManager.playSound(ResourceLoader.getResource("data/sound/MegaShrink.wav", ResourceLoader.getAudio, this.soundResources), null,
|
||||
false);
|
||||
this.megaMarbleUseTick = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1786,6 +1783,8 @@ class Marble extends GameObject {
|
|||
marbleUpdate.blastTick = this.blastUseTick;
|
||||
marbleUpdate.heliTick = this.helicopterUseTick;
|
||||
marbleUpdate.megaTick = this.megaMarbleUseTick;
|
||||
marbleUpdate.superBounceTick = this.superBounceUseTick;
|
||||
marbleUpdate.shockAbsorberTick = this.shockAbsorberUseTick;
|
||||
marbleUpdate.oob = this.outOfBounds;
|
||||
marbleUpdate.powerUpId = this.heldPowerup != null ? this.heldPowerup.netIndex : 0x1FF;
|
||||
marbleUpdate.netFlags = this.netFlags;
|
||||
|
|
@ -1814,6 +1813,8 @@ class Marble extends GameObject {
|
|||
this.blastUseTick = p.blastTick;
|
||||
this.helicopterUseTick = p.heliTick;
|
||||
this.megaMarbleUseTick = p.megaTick;
|
||||
this.superBounceUseTick = p.superBounceTick;
|
||||
this.shockAbsorberUseTick = p.shockAbsorberTick;
|
||||
this.serverUsePowerup = p.netFlags & MarbleNetFlags.UsePowerup > 0;
|
||||
// this.currentUp = p.gravityDirection;
|
||||
this.level.setUp(cast this, p.gravityDirection, this.level.timeState);
|
||||
|
|
@ -1971,6 +1972,14 @@ class Marble extends GameObject {
|
|||
|
||||
updatePowerupStates(timeState);
|
||||
|
||||
var marbledts = cast(this.getChildAt(0), DtsObject);
|
||||
|
||||
if (isMegaMarbleEnabled(timeState)) {
|
||||
marbledts.setScale(0.6666 / _dtsRadius);
|
||||
} else {
|
||||
marbledts.setScale(0.2 / _dtsRadius);
|
||||
}
|
||||
|
||||
// if (isMegaMarbleEnabled(timeState)) {
|
||||
// this._marbleScale = this._defaultScale * 2.25;
|
||||
// } else {
|
||||
|
|
@ -2146,33 +2155,39 @@ class Marble extends GameObject {
|
|||
}
|
||||
|
||||
public function updatePowerupStates(timeState:TimeState) {
|
||||
if (timeState.currentAttemptTime - this.shockAbsorberEnableTime < 5) {
|
||||
this.shockabsorberSound.pause = false;
|
||||
} else {
|
||||
this.shockabsorberSound.pause = true;
|
||||
}
|
||||
if (timeState.currentAttemptTime - this.superBounceEnableTime < 5) {
|
||||
this.superbounceSound.pause = false;
|
||||
} else {
|
||||
this.superbounceSound.pause = true;
|
||||
var shockEnabled = isShockAbsorberEnabled(timeState);
|
||||
var bounceEnabled = isSuperBounceEnabled(timeState);
|
||||
var helicopterEnabled = isHelicopterEnabled(timeState);
|
||||
var selfMarble = level.marble == cast this;
|
||||
if (selfMarble) {
|
||||
if (shockEnabled) {
|
||||
this.shockabsorberSound.pause = false;
|
||||
} else {
|
||||
this.shockabsorberSound.pause = true;
|
||||
}
|
||||
if (bounceEnabled) {
|
||||
this.superbounceSound.pause = false;
|
||||
} else {
|
||||
this.superbounceSound.pause = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (timeState.currentAttemptTime - this.shockAbsorberEnableTime < 5) {
|
||||
this.forcefield.setPosition(0, 0, 0);
|
||||
} else if (timeState.currentAttemptTime - this.superBounceEnableTime < 5) {
|
||||
if (shockEnabled || bounceEnabled) {
|
||||
this.forcefield.setPosition(0, 0, 0);
|
||||
} else {
|
||||
this.forcefield.x = 1e8;
|
||||
this.forcefield.y = 1e8;
|
||||
this.forcefield.z = 1e8;
|
||||
}
|
||||
if (timeState.currentAttemptTime - this.helicopterEnableTime < 5) {
|
||||
if (helicopterEnabled) {
|
||||
this.helicopter.setPosition(x, y, z);
|
||||
this.helicopter.setRotationQuat(this.level.getOrientationQuat(timeState.currentAttemptTime));
|
||||
this.helicopterSound.pause = false;
|
||||
if (selfMarble)
|
||||
this.helicopterSound.pause = false;
|
||||
} else {
|
||||
this.helicopter.setPosition(1e8, 1e8, 1e8);
|
||||
this.helicopterSound.pause = true;
|
||||
if (selfMarble)
|
||||
this.helicopterSound.pause = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2187,17 +2202,34 @@ class Marble extends GameObject {
|
|||
}
|
||||
|
||||
public function useBlast(timeState:TimeState) {
|
||||
if (this.blastAmount < 0.2 || this.level.game != "ultra")
|
||||
return;
|
||||
var impulse = this.currentUp.multiply(Math.max(Math.sqrt(this.blastAmount), this.blastAmount) * 10);
|
||||
this.applyImpulse(impulse);
|
||||
AudioManager.playSound(ResourceLoader.getResource('data/sound/blast.wav', ResourceLoader.getAudio, this.soundResources));
|
||||
this.level.particleManager.createEmitter(this.blastAmount > 1 ? blastMaxParticleOptions : blastParticleOptions,
|
||||
this.blastAmount > 1 ? 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)));
|
||||
this.blastAmount = 0;
|
||||
if (Net.isMP) {
|
||||
if (this.blastTicks < 156)
|
||||
return;
|
||||
var blastAmt = this.blastTicks / (25000 >> 5);
|
||||
var impulse = this.currentUp.multiply(Math.max(Math.sqrt(blastAmt), blastAmt) * 10);
|
||||
this.applyImpulse(impulse);
|
||||
if (!isNetUpdate && level.marble == cast this)
|
||||
AudioManager.playSound(ResourceLoader.getResource('data/sound/blast.wav', ResourceLoader.getAudio, this.soundResources));
|
||||
if (!isNetUpdate)
|
||||
this.level.particleManager.createEmitter(blastAmt > 1 ? blastMaxParticleOptions : blastParticleOptions,
|
||||
blastAmt > 1 ? 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)));
|
||||
this.blastTicks = 0;
|
||||
} else {
|
||||
if (this.blastAmount < 0.2 || this.level.game != "ultra")
|
||||
return;
|
||||
var impulse = this.currentUp.multiply(Math.max(Math.sqrt(this.blastAmount), this.blastAmount) * 10);
|
||||
this.applyImpulse(impulse);
|
||||
AudioManager.playSound(ResourceLoader.getResource('data/sound/blast.wav', ResourceLoader.getAudio, this.soundResources));
|
||||
this.level.particleManager.createEmitter(this.blastAmount > 1 ? blastMaxParticleOptions : blastParticleOptions,
|
||||
this.blastAmount > 1 ? 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)));
|
||||
this.blastAmount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getForce(position:Vector, tick:Int) {
|
||||
|
|
@ -2232,26 +2264,95 @@ class Marble extends GameObject {
|
|||
}
|
||||
|
||||
public function enableSuperBounce(timeState:TimeState) {
|
||||
this.superBounceEnableTime = timeState.currentAttemptTime;
|
||||
if (this.level.isMultiplayer) {
|
||||
this.superBounceUseTick = Net.isHost ? timeState.ticks : serverTicks;
|
||||
if (!this.isNetUpdate)
|
||||
this.netFlags |= MarbleNetFlags.DoSuperBounce;
|
||||
} else
|
||||
this.superBounceEnableTime = timeState.currentAttemptTime;
|
||||
}
|
||||
|
||||
inline function isSuperBounceEnabled(timeState:TimeState) {
|
||||
if (this.level == null)
|
||||
return false;
|
||||
if (!this.level.isMultiplayer) {
|
||||
return timeState.currentAttemptTime - this.superBounceEnableTime < 5;
|
||||
} else {
|
||||
if (Net.isHost) {
|
||||
return (superBounceUseTick > 0 && (this.level.timeState.ticks - superBounceUseTick) <= 156);
|
||||
} else {
|
||||
return (superBounceUseTick > 0 && (serverTicks - superBounceUseTick) <= 156);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function enableShockAbsorber(timeState:TimeState) {
|
||||
this.shockAbsorberEnableTime = timeState.currentAttemptTime;
|
||||
if (this.level.isMultiplayer) {
|
||||
this.shockAbsorberUseTick = Net.isHost ? timeState.ticks : serverTicks;
|
||||
if (!this.isNetUpdate)
|
||||
this.netFlags |= MarbleNetFlags.DoShockAbsorber;
|
||||
} else
|
||||
this.shockAbsorberEnableTime = timeState.currentAttemptTime;
|
||||
}
|
||||
|
||||
inline function isShockAbsorberEnabled(timeState:TimeState) {
|
||||
if (this.level == null)
|
||||
return false;
|
||||
if (!this.level.isMultiplayer) {
|
||||
return timeState.currentAttemptTime - this.shockAbsorberEnableTime < 5;
|
||||
} else {
|
||||
if (Net.isHost) {
|
||||
return (shockAbsorberUseTick > 0 && (this.level.timeState.ticks - shockAbsorberUseTick) <= 156);
|
||||
} else {
|
||||
return (shockAbsorberUseTick > 0 && (serverTicks - shockAbsorberUseTick) <= 156);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function enableHelicopter(timeState:TimeState) {
|
||||
this.helicopterEnableTime = timeState.currentAttemptTime;
|
||||
if (this.level.isMultiplayer) {
|
||||
this.helicopterUseTick = Net.isHost ? timeState.ticks : serverTicks;
|
||||
if (!this.isNetUpdate)
|
||||
this.netFlags |= MarbleNetFlags.DoHelicopter;
|
||||
} else
|
||||
this.helicopterEnableTime = timeState.currentAttemptTime;
|
||||
}
|
||||
|
||||
inline function isHelicopterEnabled(timeState:TimeState) {
|
||||
if (this.level == null)
|
||||
return false;
|
||||
if (!this.level.isMultiplayer) {
|
||||
return timeState.currentAttemptTime - this.helicopterEnableTime < 5;
|
||||
} else {
|
||||
if (Net.isHost) {
|
||||
return (helicopterUseTick > 0 && (this.level.timeState.ticks - helicopterUseTick) <= 156);
|
||||
} else {
|
||||
return (helicopterUseTick > 0 && (serverTicks - helicopterUseTick) <= 156);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return timeState.currentAttemptTime - this.helicopterEnableTime < 5;
|
||||
inline function isMegaMarbleEnabled(timeState:TimeState) {
|
||||
if (this.level == null)
|
||||
return false;
|
||||
if (!this.level.isMultiplayer) {
|
||||
return timeState.currentAttemptTime - this.megaMarbleEnableTime < 10;
|
||||
} else {
|
||||
if (Net.isHost) {
|
||||
return (megaMarbleUseTick > 0 && (this.level.timeState.ticks - megaMarbleUseTick) <= 312);
|
||||
} else {
|
||||
return (megaMarbleUseTick > 0 && (serverTicks - megaMarbleUseTick) <= 312);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function enableMegaMarble(timeState:TimeState) {
|
||||
this.megaMarbleEnableTime = timeState.currentAttemptTime;
|
||||
if (this.level.isMultiplayer) {
|
||||
this.megaMarbleUseTick = Net.isHost ? timeState.ticks : serverTicks;
|
||||
if (!this.isNetUpdate)
|
||||
this.netFlags |= MarbleNetFlags.DoMega;
|
||||
} else
|
||||
this.megaMarbleEnableTime = timeState.currentAttemptTime;
|
||||
}
|
||||
|
||||
function updateTeleporterState(time:TimeState) {
|
||||
|
|
@ -2317,7 +2418,7 @@ class Marble extends GameObject {
|
|||
this.blastTicks = 0;
|
||||
this.helicopterUseTick = 0;
|
||||
this.megaMarbleUseTick = 0;
|
||||
this.netFlags = MarbleNetFlags.DoBlast | MarbleNetFlags.DoMega | MarbleNetFlags.DoHelicopter | MarbleNetFlags.PickupPowerup | MarbleNetFlags.GravityChange | MarbleNetFlags.UsePowerup;
|
||||
this.netFlags = MarbleNetFlags.DoBlast | MarbleNetFlags.DoMega | MarbleNetFlags.DoHelicopter | MarbleNetFlags.DoShockAbsorber | MarbleNetFlags.DoSuperBounce | MarbleNetFlags.PickupPowerup | MarbleNetFlags.GravityChange | MarbleNetFlags.UsePowerup;
|
||||
this.lastContactNormal = new Vector(0, 0, 1);
|
||||
this.contactEntities = [];
|
||||
this.cloak = false;
|
||||
|
|
|
|||
|
|
@ -767,8 +767,10 @@ class MarbleWorld extends Scheduler {
|
|||
if (isMultiplayer) {
|
||||
marble.megaMarbleUseTick = 0;
|
||||
marble.helicopterUseTick = 0;
|
||||
// marble.collider.radius = marble._radius = 0.3;
|
||||
@:privateAccess marble.netFlags |= MarbleNetFlags.DoHelicopter | MarbleNetFlags.DoMega | MarbleNetFlags.GravityChange;
|
||||
marble.shockAbsorberUseTick = 0;
|
||||
marble.superBounceUseTick = 0;
|
||||
marble.collider.radius = marble._radius = 0.2;
|
||||
@:privateAccess marble.netFlags |= MarbleNetFlags.DoHelicopter | MarbleNetFlags.DoMega | MarbleNetFlags.DoShockAbsorber | MarbleNetFlags.DoSuperBounce | MarbleNetFlags.GravityChange;
|
||||
} else {
|
||||
@:privateAccess marble.helicopterEnableTime = -1e8;
|
||||
@:privateAccess marble.megaMarbleEnableTime = -1e8;
|
||||
|
|
@ -1861,7 +1863,7 @@ class MarbleWorld extends Scheduler {
|
|||
if (timeToDisplay >= this.mission.qualifyTime)
|
||||
return 2;
|
||||
|
||||
if (this.timeState.currentAttemptTime >= 3.5) {
|
||||
if (this.timeState.currentAttemptTime >= 3.5 && !Net.isMP) {
|
||||
// Create the flashing effect
|
||||
var alarmStart = this.mission.computeAlarmStartTime();
|
||||
var elapsed = timeToDisplay - alarmStart;
|
||||
|
|
@ -1949,28 +1951,30 @@ class MarbleWorld extends Scheduler {
|
|||
this.timeState.timeSinceLoad += dt;
|
||||
|
||||
// Handle alarm warnings (that the user is about to exceed the par time)
|
||||
if (this.timeState.currentAttemptTime >= 3.5) {
|
||||
var alarmStart = this.mission.computeAlarmStartTime();
|
||||
if (!Net.isMP) {
|
||||
if (this.timeState.currentAttemptTime >= 3.5) {
|
||||
var alarmStart = this.mission.computeAlarmStartTime();
|
||||
|
||||
if (prevGameplayClock < alarmStart && this.timeState.gameplayClock >= alarmStart) {
|
||||
// Start the alarm
|
||||
this.alarmSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/alarm.wav", ResourceLoader.getAudio, this.soundResources),
|
||||
null, true); // AudioManager.createAudioSource('alarm.wav');
|
||||
this.displayHelp('You have ${(this.mission.qualifyTime - alarmStart)} seconds remaining.');
|
||||
}
|
||||
if (prevGameplayClock < this.mission.qualifyTime && this.timeState.gameplayClock >= this.mission.qualifyTime) {
|
||||
// Stop the alarm
|
||||
if (this.alarmSound != null) {
|
||||
this.alarmSound.stop();
|
||||
this.alarmSound = null;
|
||||
if (prevGameplayClock < alarmStart && this.timeState.gameplayClock >= alarmStart) {
|
||||
// Start the alarm
|
||||
this.alarmSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/alarm.wav", ResourceLoader.getAudio, this.soundResources),
|
||||
null, true); // AudioManager.createAudioSource('alarm.wav');
|
||||
this.displayHelp('You have ${(this.mission.qualifyTime - alarmStart)} seconds remaining.');
|
||||
}
|
||||
if (prevGameplayClock < this.mission.qualifyTime && this.timeState.gameplayClock >= this.mission.qualifyTime) {
|
||||
// Stop the alarm
|
||||
if (this.alarmSound != null) {
|
||||
this.alarmSound.stop();
|
||||
this.alarmSound = null;
|
||||
}
|
||||
this.displayHelp("The clock has passed the Par Time.");
|
||||
AudioManager.playSound(ResourceLoader.getResource("data/sound/alarm_timeout.wav", ResourceLoader.getAudio, this.soundResources));
|
||||
}
|
||||
this.displayHelp("The clock has passed the Par Time.");
|
||||
AudioManager.playSound(ResourceLoader.getResource("data/sound/alarm_timeout.wav", ResourceLoader.getAudio, this.soundResources));
|
||||
}
|
||||
}
|
||||
|
||||
if (finishTime != null)
|
||||
this.timeState.gameplayClock = finishTime.gameplayClock;
|
||||
if (finishTime != null)
|
||||
this.timeState.gameplayClock = finishTime.gameplayClock;
|
||||
}
|
||||
playGui.formatTimer(this.timeState.gameplayClock, determineClockColor(this.timeState.gameplayClock));
|
||||
|
||||
if (!this.isWatching && this.isRecording)
|
||||
|
|
@ -1978,7 +1982,11 @@ class MarbleWorld extends Scheduler {
|
|||
}
|
||||
|
||||
public function updateBlast(marble:Marble, timestate:TimeState) {
|
||||
if (this.game == "ultra") {
|
||||
if (Net.isMP) {
|
||||
if (this.marble == marble) {
|
||||
this.playGui.setBlastValue(marble.blastTicks / (25000 >> 5));
|
||||
}
|
||||
} else if (this.game == "ultra") {
|
||||
if (marble.blastAmount < 1) {
|
||||
marble.blastAmount = Util.clamp(marble.blastAmount + (timeState.dt / 25), 0, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ class MissionList {
|
|||
multiplayerMissions.set("beginner", parseDifficulty("multiplayer", "multiplayer/hunt", "beginner"));
|
||||
multiplayerMissions.set("intermediate", parseDifficulty("multiplayer", "multiplayer/hunt", "intermediate"));
|
||||
multiplayerMissions.set("advanced", parseDifficulty("multiplayer", "multiplayer/hunt", "advanced"));
|
||||
multiplayerMissions.set("custom", parseDifficulty("multiplayer", "multiplayer/hunt", "custom"));
|
||||
|
||||
customMissions = parseDifficulty("custom", "missions", "custom");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package gui;
|
||||
|
||||
import net.Net;
|
||||
import src.ProfilerUI;
|
||||
import hxd.App;
|
||||
import hxd.res.Image;
|
||||
|
|
@ -152,7 +153,7 @@ class PlayGui {
|
|||
initGemCounter();
|
||||
initCenterText();
|
||||
initPowerupBox();
|
||||
if (game == 'ultra')
|
||||
if (game == 'ultra' || Net.isMP)
|
||||
initBlastBar();
|
||||
initTexts();
|
||||
if (Settings.optionsSettings.frameRateVis)
|
||||
|
|
|
|||
|
|
@ -157,6 +157,9 @@ class HuntMode extends NullMode {
|
|||
this.gemSpawnPoints.push(spawn);
|
||||
this.gemOctree.insert(spawn);
|
||||
gem.setHide(true);
|
||||
if (level.isMultiplayer) {
|
||||
@:privateAccess level.gemPredictions.alloc();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@ class MarblePrediction {
|
|||
var subs = position.sub(p.position).lengthSq(); // + velocity.sub(p.velocity).lengthSq() + omega.sub(p.omega).lengthSq();
|
||||
if (p.netFlags != 0)
|
||||
subs += 1;
|
||||
if (subs > 0.01) {
|
||||
trace('Desync: ${position.x} ${position.y} ${position.z} != ${p.position.x} ${p.position.y} ${p.position.z}');
|
||||
}
|
||||
// if (p.powerUpId != powerupItemId)
|
||||
// if (tick % 10 == 0)
|
||||
// subs += 1; // temp
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ class OtherMarbleUpdate {
|
|||
var lastBlastTick:Int;
|
||||
var lastHeliTick:Int;
|
||||
var lastMegaTick:Int;
|
||||
var lastSuperBounceTick:Int;
|
||||
var lastShockAbsorberTick:Int;
|
||||
var lastPowerUpId:Int;
|
||||
var lastGravityUp:Vector;
|
||||
|
||||
|
|
@ -46,6 +48,14 @@ class MarbleUpdateQueue {
|
|||
update.megaTick = otherUpdate.lastMegaTick;
|
||||
else
|
||||
otherUpdate.lastMegaTick = update.megaTick;
|
||||
if (update.netFlags & MarbleNetFlags.DoSuperBounce == 0)
|
||||
update.superBounceTick = otherUpdate.lastSuperBounceTick;
|
||||
else
|
||||
otherUpdate.lastSuperBounceTick = update.superBounceTick;
|
||||
if (update.netFlags & MarbleNetFlags.DoShockAbsorber == 0)
|
||||
update.shockAbsorberTick = otherUpdate.lastShockAbsorberTick;
|
||||
else
|
||||
otherUpdate.lastShockAbsorberTick = update.shockAbsorberTick;
|
||||
if (update.netFlags & MarbleNetFlags.PickupPowerup == 0)
|
||||
update.powerUpId = otherUpdate.lastPowerUpId;
|
||||
else
|
||||
|
|
@ -65,6 +75,10 @@ class MarbleUpdateQueue {
|
|||
otherUpdate.lastHeliTick = update.heliTick;
|
||||
if (update.netFlags & MarbleNetFlags.DoMega != 0)
|
||||
otherUpdate.lastMegaTick = update.megaTick;
|
||||
if (update.netFlags & MarbleNetFlags.DoSuperBounce != 0)
|
||||
otherUpdate.lastSuperBounceTick = update.superBounceTick;
|
||||
if (update.netFlags & MarbleNetFlags.DoShockAbsorber != 0)
|
||||
otherUpdate.lastShockAbsorberTick = update.shockAbsorberTick;
|
||||
if (update.netFlags & MarbleNetFlags.PickupPowerup != 0)
|
||||
otherUpdate.lastPowerUpId = update.powerUpId;
|
||||
if (update.netFlags & MarbleNetFlags.GravityChange != 0)
|
||||
|
|
@ -81,6 +95,10 @@ class MarbleUpdateQueue {
|
|||
update.heliTick = myMarbleUpdate.heliTick;
|
||||
if (update.netFlags & MarbleNetFlags.DoMega == 0)
|
||||
update.megaTick = myMarbleUpdate.megaTick;
|
||||
if (update.netFlags & MarbleNetFlags.DoSuperBounce == 0)
|
||||
update.superBounceTick = myMarbleUpdate.superBounceTick;
|
||||
if (update.netFlags & MarbleNetFlags.DoShockAbsorber == 0)
|
||||
update.shockAbsorberTick = myMarbleUpdate.shockAbsorberTick;
|
||||
if (update.netFlags & MarbleNetFlags.PickupPowerup == 0)
|
||||
update.powerUpId = myMarbleUpdate.powerUpId;
|
||||
if (update.netFlags & MarbleNetFlags.GravityChange == 0)
|
||||
|
|
|
|||
|
|
@ -44,9 +44,11 @@ enum abstract MarbleNetFlags(Int) from Int to Int {
|
|||
var DoBlast = 1 << 0;
|
||||
var DoHelicopter = 1 << 1;
|
||||
var DoMega = 1 << 2;
|
||||
var PickupPowerup = 1 << 3;
|
||||
var GravityChange = 1 << 4;
|
||||
var UsePowerup = 1 << 5;
|
||||
var DoSuperBounce = 1 << 3;
|
||||
var DoShockAbsorber = 1 << 4;
|
||||
var PickupPowerup = 1 << 5;
|
||||
var GravityChange = 1 << 6;
|
||||
var UsePowerup = 1 << 7;
|
||||
}
|
||||
|
||||
@:publicFields
|
||||
|
|
@ -62,6 +64,8 @@ class MarbleUpdatePacket implements NetPacket {
|
|||
var blastTick:Int;
|
||||
var megaTick:Int;
|
||||
var heliTick:Int;
|
||||
var superBounceTick:Int;
|
||||
var shockAbsorberTick:Int;
|
||||
var gravityDirection:Vector;
|
||||
var oob:Bool;
|
||||
var powerUpId:Int;
|
||||
|
|
@ -103,6 +107,19 @@ class MarbleUpdatePacket implements NetPacket {
|
|||
} else {
|
||||
b.writeFlag(false);
|
||||
}
|
||||
if (netFlags & MarbleNetFlags.DoSuperBounce > 0) {
|
||||
b.writeFlag(true);
|
||||
b.writeUInt16(superBounceTick);
|
||||
} else {
|
||||
b.writeFlag(false);
|
||||
}
|
||||
if (netFlags & MarbleNetFlags.DoShockAbsorber > 0) {
|
||||
b.writeFlag(true);
|
||||
b.writeUInt16(shockAbsorberTick);
|
||||
} else {
|
||||
b.writeFlag(false);
|
||||
}
|
||||
|
||||
b.writeFlag(oob);
|
||||
if (netFlags & MarbleNetFlags.UsePowerup > 0) {
|
||||
b.writeFlag(true);
|
||||
|
|
@ -148,6 +165,14 @@ class MarbleUpdatePacket implements NetPacket {
|
|||
megaTick = b.readUInt16();
|
||||
this.netFlags |= MarbleNetFlags.DoMega;
|
||||
}
|
||||
if (b.readFlag()) {
|
||||
superBounceTick = b.readUInt16();
|
||||
this.netFlags |= MarbleNetFlags.DoSuperBounce;
|
||||
}
|
||||
if (b.readFlag()) {
|
||||
shockAbsorberTick = b.readUInt16();
|
||||
this.netFlags |= MarbleNetFlags.DoShockAbsorber;
|
||||
}
|
||||
oob = b.readFlag();
|
||||
if (b.readFlag())
|
||||
this.netFlags |= MarbleNetFlags.UsePowerup;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue