| 6305 | } |
| 6306 | |
| 6307 | U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream) |
| 6308 | { |
| 6309 | U32 retMask = Parent::packUpdate(con, mask, stream); |
| 6310 | |
| 6311 | if (stream->writeFlag((mask & ImpactMask) && !(mask & InitialUpdateMask))) |
| 6312 | stream->writeInt(mImpactSound, PlayerData::ImpactBits); |
| 6313 | |
| 6314 | if (stream->writeFlag(mask & ActionMask && |
| 6315 | mActionAnimation.action != PlayerData::NullAnimation && |
| 6316 | mActionAnimation.action >= PlayerData::NumTableActionAnims)) { |
| 6317 | stream->writeInt(mActionAnimation.action,PlayerData::ActionAnimBits); |
| 6318 | stream->writeFlag(mActionAnimation.holdAtEnd); |
| 6319 | stream->writeFlag(mActionAnimation.atEnd); |
| 6320 | stream->writeFlag(mActionAnimation.firstPerson); |
| 6321 | if (!mActionAnimation.atEnd) { |
| 6322 | // If somewhere in middle on initial update, must send position- |
| 6323 | F32 where = mShapeInstance->getPos(mActionAnimation.thread); |
| 6324 | if (stream->writeFlag((mask & InitialUpdateMask) != 0 && where > 0)) |
| 6325 | stream->writeSignedFloat(where, 6); |
| 6326 | } |
| 6327 | } |
| 6328 | |
| 6329 | if (stream->writeFlag(mask & ActionMask && |
| 6330 | mArmAnimation.action != PlayerData::NullAnimation && |
| 6331 | (!(mask & InitialUpdateMask) || |
| 6332 | mArmAnimation.action != mDataBlock->lookAction))) { |
| 6333 | stream->writeInt(mArmAnimation.action,PlayerData::ActionAnimBits); |
| 6334 | } |
| 6335 | retMask = afx_packUpdate(con, mask, stream, retMask); |
| 6336 | |
| 6337 | // The rest of the data is part of the control object packet update. |
| 6338 | // If we're controlled by this client, we don't need to send it. |
| 6339 | // we only need to send it if this is the initial update - in that case, |
| 6340 | // the client won't know this is the control object yet. |
| 6341 | if(stream->writeFlag(getControllingClient() == con && !(mask & InitialUpdateMask))) |
| 6342 | return(retMask); |
| 6343 | |
| 6344 | if (stream->writeFlag(mask & MoveMask)) |
| 6345 | { |
| 6346 | stream->writeFlag(mFalling); |
| 6347 | |
| 6348 | stream->writeFlag(mSwimming); |
| 6349 | stream->writeFlag(mJetting); |
| 6350 | stream->writeInt(mPose, NumPoseBits); |
| 6351 | |
| 6352 | stream->writeInt(mState,NumStateBits); |
| 6353 | if (stream->writeFlag(mState == RecoverState)) |
| 6354 | stream->writeInt(mRecoverTicks,PlayerData::RecoverDelayBits); |
| 6355 | |
| 6356 | Point3F pos; |
| 6357 | getTransform().getColumn(3,&pos); |
| 6358 | stream->writeCompressedPoint(pos); |
| 6359 | F32 len = mVelocity.len(); |
| 6360 | if(stream->writeFlag(len > 0.02f)) |
| 6361 | { |
| 6362 | Point3F outVel = mVelocity; |
| 6363 | outVel *= 1.0f/len; |
| 6364 | stream->writeNormalVector(outVel, 10); |
nothing calls this directly
no test coverage detected