send inAir attribute as part of NETWORK_PLAYER_POSITION...
--- a/src/proto2/Network.hh Mon Nov 24 22:18:49 2008 +0000
+++ b/src/proto2/Network.hh Mon Nov 24 22:20:32 2008 +0000
@@ -29,6 +29,10 @@
NETCHAN_CORE = 0x01,
};
+enum NetworkPhysicsFlags {
+ NETWORK_PHYSICS_INAIR = 0x01,
+};
+
enum NetworkMessage {
NETMSG_PACKET_INVALID = 0x00,
@@ -71,6 +75,7 @@
*
* Vector position
* Vector velocity
+ * uint8_t NetworkPhysicsFlags
*/
NETMSG_PLAYER_POSITION = 0x0301,
};
--- a/src/proto2/NetworkClient.cc Mon Nov 24 22:18:49 2008 +0000
+++ b/src/proto2/NetworkClient.cc Mon Nov 24 22:20:32 2008 +0000
@@ -105,11 +105,12 @@
void NetworkClientLocalPlayer::on_position (NetworkPacket &pkt) {
Vector position = pkt.read_vector();
Vector velocity = pkt.read_vector();
+ uint8_t flags = pkt.read_uint8();
Engine::log(INFO, "client_player.on_position") << "obj=" << obj << ", position=" << position << ", velocity=" << velocity;
// just update...
- updatePhysics(position, velocity);
+ updatePhysics(position, velocity, flags & NETWORK_PHYSICS_INAIR);
}
NetworkClientRemotePlayer::NetworkClientRemotePlayer (NetworkClient &client, NetworkObject_Client *obj, Vector position) :
@@ -123,11 +124,12 @@
void NetworkClientRemotePlayer::on_position (NetworkPacket &pkt) {
Vector position = pkt.read_vector();
Vector velocity = pkt.read_vector();
+ uint8_t flags = pkt.read_uint8();
Engine::log(INFO, "client_player.on_position") << "obj=" << obj << ", position=" << position << ", velocity=" << velocity;
// just update...
- updatePhysics(position, velocity);
+ updatePhysics(position, velocity, flags & NETWORK_PHYSICS_INAIR);
}
void NetworkClientRemotePlayer::on_quit (NetworkPacket &pkt) {
--- a/src/proto2/NetworkServer.cc Mon Nov 24 22:18:49 2008 +0000
+++ b/src/proto2/NetworkServer.cc Mon Nov 24 22:20:32 2008 +0000
@@ -105,6 +105,7 @@
NetworkPacket pkt;
pkt.write_vector(position);
pkt.write_vector(velocity);
+ pkt.write_uint8(inAir & NETWORK_PHYSICS_INAIR);
Engine::log(INFO, "server_player.send_position_update") << "obj=" << obj << " -> " << position << "+" << velocity;
--- a/src/proto2/Physics.cc Mon Nov 24 22:18:49 2008 +0000
+++ b/src/proto2/Physics.cc Mon Nov 24 22:20:32 2008 +0000
@@ -414,9 +414,10 @@
this->inAir = true;
}
-void PhysicsObject::updatePhysics (Vector position, Vector velocity) {
+void PhysicsObject::updatePhysics (Vector position, Vector velocity, bool inAir) {
this->position = position;
this->velocity = velocity;
+ this->inAir = inAir;
}
Vector PhysicsObject::getPosition () {
--- a/src/proto2/Physics.hh Mon Nov 24 22:18:49 2008 +0000
+++ b/src/proto2/Physics.hh Mon Nov 24 22:20:32 2008 +0000
@@ -91,7 +91,7 @@
/**
* Called on network clients to sync state from server
*/
- void updatePhysics (Vector position, Vector velocity);
+ void updatePhysics (Vector position, Vector velocity, bool inAir);
/**
* Handle ground movement