mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
attempt compression
This commit is contained in:
parent
16dc9dc718
commit
0e777b0500
7 changed files with 130 additions and 47 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
|
import net.NetPacket.MarbleNetFlags;
|
||||||
import net.BitStream.OutputBitStream;
|
import net.BitStream.OutputBitStream;
|
||||||
import net.ClientConnection;
|
import net.ClientConnection;
|
||||||
import net.ClientConnection.GameConnection;
|
import net.ClientConnection.GameConnection;
|
||||||
|
|
@ -301,6 +302,7 @@ class Marble extends GameObject {
|
||||||
var moveMotionDir:Vector;
|
var moveMotionDir:Vector;
|
||||||
var lastMove:Move;
|
var lastMove:Move;
|
||||||
var isNetUpdate:Bool = false;
|
var isNetUpdate:Bool = false;
|
||||||
|
var netFlags:Int = 0;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -1611,6 +1613,8 @@ class Marble extends GameObject {
|
||||||
pTime.currentAttemptTime = passedTime;
|
pTime.currentAttemptTime = passedTime;
|
||||||
this.heldPowerup.use(cast this, pTime);
|
this.heldPowerup.use(cast this, pTime);
|
||||||
this.heldPowerup = null;
|
this.heldPowerup = null;
|
||||||
|
if (!this.isNetUpdate)
|
||||||
|
this.netFlags |= MarbleNetFlags.PickupPowerup;
|
||||||
if (this.level.isRecording) {
|
if (this.level.isRecording) {
|
||||||
this.level.replay.recordPowerupPickup(null);
|
this.level.replay.recordPowerupPickup(null);
|
||||||
}
|
}
|
||||||
|
|
@ -1672,6 +1676,8 @@ class Marble extends GameObject {
|
||||||
marbleUpdate.megaTick = this.megaMarbleUseTick;
|
marbleUpdate.megaTick = this.megaMarbleUseTick;
|
||||||
marbleUpdate.oob = this.outOfBounds;
|
marbleUpdate.oob = this.outOfBounds;
|
||||||
marbleUpdate.powerUpId = this.heldPowerup != null ? this.heldPowerup.netIndex : 0xFFFF;
|
marbleUpdate.powerUpId = this.heldPowerup != null ? this.heldPowerup.netIndex : 0xFFFF;
|
||||||
|
marbleUpdate.netFlags = this.netFlags;
|
||||||
|
this.netFlags = 0;
|
||||||
marbleUpdate.serialize(b);
|
marbleUpdate.serialize(b);
|
||||||
return b.getBytes();
|
return b.getBytes();
|
||||||
}
|
}
|
||||||
|
|
@ -1701,6 +1707,7 @@ class Marble extends GameObject {
|
||||||
} else {
|
} else {
|
||||||
this.level.pickUpPowerUp(cast this, this.level.powerUps[p.powerUpId]);
|
this.level.pickUpPowerUp(cast this, this.level.powerUps[p.powerUpId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.controllable && Net.isClient) {
|
if (this.controllable && Net.isClient) {
|
||||||
// We are client, need to do something about the queue
|
// We are client, need to do something about the queue
|
||||||
var mm = Net.clientConnection.moveManager;
|
var mm = Net.clientConnection.moveManager;
|
||||||
|
|
@ -2129,14 +2136,18 @@ class Marble extends GameObject {
|
||||||
if (this.blastTicks < (7500 >> 5))
|
if (this.blastTicks < (7500 >> 5))
|
||||||
return false;
|
return false;
|
||||||
this.blastUseTick = timeState.ticks;
|
this.blastUseTick = timeState.ticks;
|
||||||
|
if (!this.isNetUpdate)
|
||||||
|
this.netFlags |= MarbleNetFlags.DoBlast;
|
||||||
var amount = this.blastTicks / (30000 >> 5);
|
var amount = this.blastTicks / (30000 >> 5);
|
||||||
this.blastPerc = amount;
|
this.blastPerc = amount;
|
||||||
var impulse = this.currentUp.multiply(amount * 8);
|
var impulse = this.currentUp.multiply(amount * 8);
|
||||||
this.applyImpulse(impulse);
|
this.applyImpulse(impulse);
|
||||||
if (this.controllable)
|
if (this.controllable)
|
||||||
AudioManager.playSound(ResourceLoader.getResource('data/sound/use_blast.wav', ResourceLoader.getAudio, this.soundResources));
|
AudioManager.playSound(ResourceLoader.getResource('data/sound/use_blast.wav', ResourceLoader.getAudio, this.soundResources));
|
||||||
this.blastWave.doSequenceOnceBeginTime = this.level.timeState.timeSinceLoad;
|
if (!this.isNetUpdate) {
|
||||||
this.blastUseTime = this.level.timeState.currentAttemptTime;
|
this.blastWave.doSequenceOnceBeginTime = this.level.timeState.timeSinceLoad;
|
||||||
|
this.blastUseTime = this.level.timeState.currentAttemptTime;
|
||||||
|
}
|
||||||
this.blastTicks = 0;
|
this.blastTicks = 0;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2185,16 +2196,20 @@ class Marble extends GameObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enableHelicopter(timeState:TimeState) {
|
public function enableHelicopter(timeState:TimeState) {
|
||||||
if (this.level.isMultiplayer)
|
if (this.level.isMultiplayer) {
|
||||||
this.helicopterUseTick = timeState.ticks;
|
this.helicopterUseTick = timeState.ticks;
|
||||||
else
|
if (!this.isNetUpdate)
|
||||||
|
this.netFlags |= MarbleNetFlags.DoHelicopter;
|
||||||
|
} else
|
||||||
this.helicopterEnableTime = timeState.currentAttemptTime;
|
this.helicopterEnableTime = timeState.currentAttemptTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enableMegaMarble(timeState:TimeState) {
|
public function enableMegaMarble(timeState:TimeState) {
|
||||||
if (this.level.isMultiplayer)
|
if (this.level.isMultiplayer) {
|
||||||
this.megaMarbleUseTick = timeState.ticks;
|
this.megaMarbleUseTick = timeState.ticks;
|
||||||
else
|
if (!this.isNetUpdate)
|
||||||
|
this.netFlags |= MarbleNetFlags.DoMega;
|
||||||
|
} else
|
||||||
this.megaMarbleEnableTime = timeState.currentAttemptTime;
|
this.megaMarbleEnableTime = timeState.currentAttemptTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2223,6 +2238,7 @@ class Marble extends GameObject {
|
||||||
this.blastTicks = 0;
|
this.blastTicks = 0;
|
||||||
this.helicopterUseTick = 0;
|
this.helicopterUseTick = 0;
|
||||||
this.megaMarbleUseTick = 0;
|
this.megaMarbleUseTick = 0;
|
||||||
|
this.netFlags = MarbleNetFlags.DoBlast | MarbleNetFlags.DoMega | MarbleNetFlags.DoHelicopter | MarbleNetFlags.PickupPowerup;
|
||||||
this.lastContactNormal = new Vector(0, 0, 1);
|
this.lastContactNormal = new Vector(0, 0, 1);
|
||||||
this.contactEntities = [];
|
this.contactEntities = [];
|
||||||
this._firstTick = true;
|
this._firstTick = true;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package src;
|
package src;
|
||||||
|
|
||||||
|
import net.NetPacket.MarbleNetFlags;
|
||||||
import net.PowerupPredictionStore;
|
import net.PowerupPredictionStore;
|
||||||
import net.MarblePredictionStore;
|
import net.MarblePredictionStore;
|
||||||
import net.MarblePredictionStore.MarblePrediction;
|
import net.MarblePredictionStore.MarblePrediction;
|
||||||
|
|
@ -1973,6 +1974,8 @@ class MarbleWorld extends Scheduler {
|
||||||
return false;
|
return false;
|
||||||
Console.log("PowerUp pickup: " + powerUp.identifier);
|
Console.log("PowerUp pickup: " + powerUp.identifier);
|
||||||
marble.heldPowerup = powerUp;
|
marble.heldPowerup = powerUp;
|
||||||
|
if (@:privateAccess !marble.isNetUpdate)
|
||||||
|
@:privateAccess marble.netFlags |= MarbleNetFlags.PickupPowerup;
|
||||||
if (this.marble == marble) {
|
if (this.marble == marble) {
|
||||||
this.playGui.setPowerupImage(powerUp.identifier);
|
this.playGui.setPowerupImage(powerUp.identifier);
|
||||||
MarbleGame.instance.touchInput.powerupButton.setEnabled(true);
|
MarbleGame.instance.touchInput.powerupButton.setEnabled(true);
|
||||||
|
|
@ -1985,6 +1988,7 @@ class MarbleWorld extends Scheduler {
|
||||||
|
|
||||||
public function deselectPowerUp(marble:Marble) {
|
public function deselectPowerUp(marble:Marble) {
|
||||||
marble.heldPowerup = null;
|
marble.heldPowerup = null;
|
||||||
|
@:privateAccess marble.netFlags |= MarbleNetFlags.PickupPowerup;
|
||||||
if (this.marble == marble) {
|
if (this.marble == marble) {
|
||||||
this.playGui.setPowerupImage("");
|
this.playGui.setPowerupImage("");
|
||||||
MarbleGame.instance.touchInput.powerupButton.setEnabled(false);
|
MarbleGame.instance.touchInput.powerupButton.setEnabled(false);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class InputBitStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readFlag() {
|
public function readFlag() {
|
||||||
return readInt(1);
|
return readInt(1) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readByte() {
|
public function readByte() {
|
||||||
|
|
@ -99,6 +99,7 @@ class OutputBitStream {
|
||||||
this.shift = extra;
|
this.shift = extra;
|
||||||
} else {
|
} else {
|
||||||
lastByte |= (value << this.shift) & (0xFF >> (8 - bits - this.shift));
|
lastByte |= (value << this.shift) & (0xFF >> (8 - bits - this.shift));
|
||||||
|
this.shift += bits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,8 +111,8 @@ class OutputBitStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function writeFlag(value:Int) {
|
public function writeFlag(value:Bool) {
|
||||||
writeInt(value, 1);
|
writeInt(value ? 1 : 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function writeByte(value:Int) {
|
public function writeByte(value:Int) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package net;
|
package net;
|
||||||
|
|
||||||
|
import net.NetPacket.MarbleNetFlags;
|
||||||
import net.NetPacket.MarbleUpdatePacket;
|
import net.NetPacket.MarbleUpdatePacket;
|
||||||
import net.Net;
|
import net.Net;
|
||||||
|
|
||||||
|
|
@ -17,12 +18,37 @@ class MarbleUpdateQueue {
|
||||||
if (myMarbleUpdate != null && update.serverTicks > myMarbleUpdate.serverTicks)
|
if (myMarbleUpdate != null && update.serverTicks > myMarbleUpdate.serverTicks)
|
||||||
ourMoveApplied = true;
|
ourMoveApplied = true;
|
||||||
if (otherMarbleUpdates.exists(cc)) {
|
if (otherMarbleUpdates.exists(cc)) {
|
||||||
otherMarbleUpdates[cc].push(update);
|
var ourList = otherMarbleUpdates[cc];
|
||||||
|
if (ourList.length != 0) {
|
||||||
|
var lastOne = ourList[ourList.length - 1];
|
||||||
|
|
||||||
|
// Copy the netflagg'd fields
|
||||||
|
if (update.netFlags & MarbleNetFlags.DoBlast == 0)
|
||||||
|
update.blastTick = lastOne.blastTick;
|
||||||
|
if (update.netFlags & MarbleNetFlags.DoHelicopter == 0)
|
||||||
|
update.heliTick = lastOne.heliTick;
|
||||||
|
if (update.netFlags & MarbleNetFlags.DoMega == 0)
|
||||||
|
update.megaTick = lastOne.megaTick;
|
||||||
|
if (update.netFlags & MarbleNetFlags.PickupPowerup == 0)
|
||||||
|
update.powerUpId = lastOne.powerUpId;
|
||||||
|
}
|
||||||
|
ourList.push(update);
|
||||||
} else {
|
} else {
|
||||||
otherMarbleUpdates[cc] = [update];
|
otherMarbleUpdates[cc] = [update];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (myMarbleUpdate == null || update.serverTicks > myMarbleUpdate.serverTicks) {
|
if (myMarbleUpdate == null || update.serverTicks > myMarbleUpdate.serverTicks) {
|
||||||
|
if (myMarbleUpdate != null) {
|
||||||
|
// Copy the netflagg'd fields
|
||||||
|
if (update.netFlags & MarbleNetFlags.DoBlast == 0)
|
||||||
|
update.blastTick = myMarbleUpdate.blastTick;
|
||||||
|
if (update.netFlags & MarbleNetFlags.DoHelicopter == 0)
|
||||||
|
update.heliTick = myMarbleUpdate.heliTick;
|
||||||
|
if (update.netFlags & MarbleNetFlags.DoMega == 0)
|
||||||
|
update.megaTick = myMarbleUpdate.megaTick;
|
||||||
|
if (update.netFlags & MarbleNetFlags.PickupPowerup == 0)
|
||||||
|
update.powerUpId = myMarbleUpdate.powerUpId;
|
||||||
|
}
|
||||||
myMarbleUpdate = update;
|
myMarbleUpdate = update;
|
||||||
ourMoveApplied = false;
|
ourMoveApplied = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,14 +117,9 @@ class MoveManager {
|
||||||
b.writeUInt16(m.id);
|
b.writeUInt16(m.id);
|
||||||
b.writeByte(Std.int((m.move.d.x * 16) + 16));
|
b.writeByte(Std.int((m.move.d.x * 16) + 16));
|
||||||
b.writeByte(Std.int((m.move.d.y * 16) + 16));
|
b.writeByte(Std.int((m.move.d.y * 16) + 16));
|
||||||
var flags = 0;
|
b.writeFlag(m.move.jump);
|
||||||
if (m.move.jump)
|
b.writeFlag(m.move.powerup);
|
||||||
flags |= 1;
|
b.writeFlag(m.move.blast);
|
||||||
if (m.move.powerup)
|
|
||||||
flags |= 2;
|
|
||||||
if (m.move.blast)
|
|
||||||
flags |= 4;
|
|
||||||
b.writeByte(flags);
|
|
||||||
b.writeFloat(m.motionDir.x);
|
b.writeFloat(m.motionDir.x);
|
||||||
b.writeFloat(m.motionDir.y);
|
b.writeFloat(m.motionDir.y);
|
||||||
b.writeFloat(m.motionDir.z);
|
b.writeFloat(m.motionDir.z);
|
||||||
|
|
@ -137,10 +132,9 @@ class MoveManager {
|
||||||
move.d = new Vector();
|
move.d = new Vector();
|
||||||
move.d.x = (b.readByte() - 16) / 16.0;
|
move.d.x = (b.readByte() - 16) / 16.0;
|
||||||
move.d.y = (b.readByte() - 16) / 16.0;
|
move.d.y = (b.readByte() - 16) / 16.0;
|
||||||
var flags = b.readByte();
|
move.jump = b.readFlag();
|
||||||
move.jump = (flags & 1) != 0;
|
move.powerup = b.readFlag();
|
||||||
move.powerup = (flags & 2) != 0;
|
move.blast = b.readFlag();
|
||||||
move.blast = (flags & 4) != 0;
|
|
||||||
var motionDir = new Vector();
|
var motionDir = new Vector();
|
||||||
motionDir.x = b.readFloat();
|
motionDir.x = b.readFloat();
|
||||||
motionDir.y = b.readFloat();
|
motionDir.y = b.readFloat();
|
||||||
|
|
|
||||||
|
|
@ -161,9 +161,9 @@ class Net {
|
||||||
dc.onMessage = (msgBytes) -> {
|
dc.onMessage = (msgBytes) -> {
|
||||||
onPacketReceived(c, dc, new InputBitStream(msgBytes));
|
onPacketReceived(c, dc, new InputBitStream(msgBytes));
|
||||||
}
|
}
|
||||||
var b = haxe.io.Bytes.alloc(3);
|
var b = haxe.io.Bytes.alloc(2);
|
||||||
b.set(0, ClientIdAssign);
|
b.set(0, ClientIdAssign);
|
||||||
b.setUInt16(1, clientId);
|
b.set(1, clientId);
|
||||||
dc.sendBytes(b);
|
dc.sendBytes(b);
|
||||||
Console.log("Client has connected!");
|
Console.log("Client has connected!");
|
||||||
// Send the ping packet to calculcate the RTT
|
// Send the ping packet to calculcate the RTT
|
||||||
|
|
@ -205,7 +205,7 @@ class Net {
|
||||||
NetCommands.readPacket(input);
|
NetCommands.readPacket(input);
|
||||||
|
|
||||||
case ClientIdAssign:
|
case ClientIdAssign:
|
||||||
clientId = input.readUInt16();
|
clientId = input.readByte(); // 8 bit client id, hopefully we don't exceed this
|
||||||
Console.log('Client ID set to ${clientId}');
|
Console.log('Client ID set to ${clientId}');
|
||||||
|
|
||||||
case Ping:
|
case Ping:
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,26 @@ class MarbleMovePacket implements NetPacket {
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
public inline function deserialize(b:InputBitStream) {
|
public inline function deserialize(b:InputBitStream) {
|
||||||
clientId = b.readUInt16();
|
clientId = b.readByte();
|
||||||
clientTicks = b.readUInt16();
|
clientTicks = b.readUInt16();
|
||||||
move = MoveManager.unpackMove(b);
|
move = MoveManager.unpackMove(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline function serialize(b:OutputBitStream) {
|
public inline function serialize(b:OutputBitStream) {
|
||||||
b.writeUInt16(clientId);
|
b.writeByte(clientId);
|
||||||
b.writeUInt16(clientTicks);
|
b.writeUInt16(clientTicks);
|
||||||
MoveManager.packMove(move, b);
|
MoveManager.packMove(move, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum abstract MarbleNetFlags(Int) from Int to Int {
|
||||||
|
var NullFlag;
|
||||||
|
var DoBlast;
|
||||||
|
var DoHelicopter;
|
||||||
|
var DoMega;
|
||||||
|
var PickupPowerup;
|
||||||
|
}
|
||||||
|
|
||||||
@:publicFields
|
@:publicFields
|
||||||
class MarbleUpdatePacket implements NetPacket {
|
class MarbleUpdatePacket implements NetPacket {
|
||||||
var clientId:Int;
|
var clientId:Int;
|
||||||
|
|
@ -47,14 +55,15 @@ class MarbleUpdatePacket implements NetPacket {
|
||||||
var oob:Bool;
|
var oob:Bool;
|
||||||
var powerUpId:Int;
|
var powerUpId:Int;
|
||||||
var moveQueueSize:Int;
|
var moveQueueSize:Int;
|
||||||
|
var netFlags:Int;
|
||||||
|
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
public inline function serialize(b:OutputBitStream) {
|
public inline function serialize(b:OutputBitStream) {
|
||||||
b.writeUInt16(clientId);
|
b.writeByte(clientId);
|
||||||
MoveManager.packMove(move, b);
|
MoveManager.packMove(move, b);
|
||||||
b.writeUInt16(serverTicks);
|
b.writeUInt16(serverTicks);
|
||||||
b.writeByte(moveQueueSize);
|
b.writeInt(moveQueueSize, 6);
|
||||||
b.writeFloat(position.x);
|
b.writeFloat(position.x);
|
||||||
b.writeFloat(position.y);
|
b.writeFloat(position.y);
|
||||||
b.writeFloat(position.z);
|
b.writeFloat(position.z);
|
||||||
|
|
@ -64,28 +73,61 @@ class MarbleUpdatePacket implements NetPacket {
|
||||||
b.writeFloat(omega.x);
|
b.writeFloat(omega.x);
|
||||||
b.writeFloat(omega.y);
|
b.writeFloat(omega.y);
|
||||||
b.writeFloat(omega.z);
|
b.writeFloat(omega.z);
|
||||||
b.writeUInt16(blastAmount);
|
b.writeInt(blastAmount, 11);
|
||||||
b.writeUInt16(blastTick);
|
if (netFlags & MarbleNetFlags.DoBlast > 0) {
|
||||||
b.writeUInt16(heliTick);
|
b.writeFlag(true);
|
||||||
b.writeUInt16(megaTick);
|
b.writeUInt16(blastTick);
|
||||||
b.writeByte(oob ? 1 : 0);
|
} else {
|
||||||
b.writeUInt16(powerUpId);
|
b.writeFlag(false);
|
||||||
|
}
|
||||||
|
if (netFlags & MarbleNetFlags.DoHelicopter > 0) {
|
||||||
|
b.writeFlag(true);
|
||||||
|
b.writeUInt16(heliTick);
|
||||||
|
} else {
|
||||||
|
b.writeFlag(false);
|
||||||
|
}
|
||||||
|
if (netFlags & MarbleNetFlags.DoMega > 0) {
|
||||||
|
b.writeFlag(true);
|
||||||
|
b.writeUInt16(megaTick);
|
||||||
|
} else {
|
||||||
|
b.writeFlag(false);
|
||||||
|
}
|
||||||
|
b.writeFlag(oob);
|
||||||
|
if (netFlags & MarbleNetFlags.PickupPowerup > 0) {
|
||||||
|
b.writeFlag(true);
|
||||||
|
b.writeInt(powerUpId, 9);
|
||||||
|
} else {
|
||||||
|
b.writeFlag(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline function deserialize(b:InputBitStream) {
|
public inline function deserialize(b:InputBitStream) {
|
||||||
clientId = b.readUInt16();
|
clientId = b.readByte();
|
||||||
move = MoveManager.unpackMove(b);
|
move = MoveManager.unpackMove(b);
|
||||||
serverTicks = b.readUInt16();
|
serverTicks = b.readUInt16();
|
||||||
moveQueueSize = b.readByte();
|
moveQueueSize = b.readInt(6);
|
||||||
position = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
|
position = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
|
||||||
velocity = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
|
velocity = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
|
||||||
omega = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
|
omega = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
|
||||||
blastAmount = b.readUInt16();
|
blastAmount = b.readInt(11);
|
||||||
blastTick = b.readUInt16();
|
this.netFlags = 0;
|
||||||
heliTick = b.readUInt16();
|
if (b.readFlag()) {
|
||||||
megaTick = b.readUInt16();
|
blastTick = b.readUInt16();
|
||||||
oob = b.readByte() != 0;
|
this.netFlags |= MarbleNetFlags.DoBlast;
|
||||||
powerUpId = b.readUInt16();
|
}
|
||||||
|
if (b.readFlag()) {
|
||||||
|
heliTick = b.readUInt16();
|
||||||
|
this.netFlags |= MarbleNetFlags.DoHelicopter;
|
||||||
|
}
|
||||||
|
if (b.readFlag()) {
|
||||||
|
megaTick = b.readUInt16();
|
||||||
|
this.netFlags |= MarbleNetFlags.DoMega;
|
||||||
|
}
|
||||||
|
oob = b.readFlag();
|
||||||
|
if (b.readFlag()) {
|
||||||
|
powerUpId = b.readInt(9);
|
||||||
|
this.netFlags |= MarbleNetFlags.PickupPowerup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,14 +140,14 @@ class PowerupPickupPacket implements NetPacket {
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
public inline function deserialize(b:InputBitStream) {
|
public inline function deserialize(b:InputBitStream) {
|
||||||
clientId = b.readUInt16();
|
clientId = b.readByte();
|
||||||
serverTicks = b.readUInt16();
|
serverTicks = b.readUInt16();
|
||||||
powerupItemId = b.readUInt16();
|
powerupItemId = b.readInt(9);
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline function serialize(b:OutputBitStream) {
|
public inline function serialize(b:OutputBitStream) {
|
||||||
b.writeUInt16(clientId);
|
b.writeByte(clientId);
|
||||||
b.writeUInt16(serverTicks);
|
b.writeUInt16(serverTicks);
|
||||||
b.writeUInt16(powerupItemId);
|
b.writeInt(powerupItemId, 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue