MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / writePacketData

Method writePacketData

Engine/source/T3D/player.cpp:6040–6091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6038//----------------------------------------------------------------------------
6039
6040void Player::writePacketData(GameConnection *connection, BitStream *stream)
6041{
6042 Parent::writePacketData(connection, stream);
6043
6044 stream->writeInt(mState,NumStateBits);
6045 if (stream->writeFlag(mState == RecoverState))
6046 stream->writeInt(mRecoverTicks,PlayerData::RecoverDelayBits);
6047 if (stream->writeFlag(mJumpDelay > 0))
6048 stream->writeInt(mJumpDelay,PlayerData::JumpDelayBits);
6049
6050 Point3F pos;
6051 getTransform().getColumn(3,&pos);
6052 if (stream->writeFlag(!isMounted())) {
6053 // Will get position from mount
6054 stream->setCompressionPoint(pos);
6055 stream->write(pos.x);
6056 stream->write(pos.y);
6057 stream->write(pos.z);
6058 stream->write(mVelocity.x);
6059 stream->write(mVelocity.y);
6060 stream->write(mVelocity.z);
6061 stream->writeInt(mJumpSurfaceLastContact > 15 ? 15 : mJumpSurfaceLastContact, 4);
6062
6063 if (stream->writeFlag(!mAllowSprinting || !mAllowCrouching || !mAllowProne || !mAllowJumping || !mAllowJetJumping || !mAllowSwimming))
6064 {
6065 stream->writeFlag(mAllowJumping);
6066 stream->writeFlag(mAllowJetJumping);
6067 stream->writeFlag(mAllowSprinting);
6068 stream->writeFlag(mAllowCrouching);
6069 stream->writeFlag(mAllowProne);
6070 stream->writeFlag(mAllowSwimming);
6071 }
6072 }
6073 stream->write(mHead.x);
6074 if(stream->writeFlag(mDataBlock->cameraCanBank))
6075 {
6076 // Include mHead.y to allow for camera banking
6077 stream->write(mHead.y);
6078 }
6079 stream->write(mHead.z);
6080 stream->write(mRot.z);
6081
6082 if (mControlObject) {
6083 S32 gIndex = connection->getGhostIndex(mControlObject);
6084 if (stream->writeFlag(gIndex != -1)) {
6085 stream->writeInt(gIndex,NetConnection::GhostIdBitSize);
6086 mControlObject->writePacketData(connection, stream);
6087 }
6088 }
6089 else
6090 stream->writeFlag(false);
6091}
6092
6093
6094void Player::readPacketData(GameConnection *connection, BitStream *stream)

Callers

nothing calls this directly

Calls 6

writeIntMethod · 0.80
getColumnMethod · 0.80
setCompressionPointMethod · 0.80
getGhostIndexMethod · 0.80
writeFlagMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected