MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / unpackUpdate

Method unpackUpdate

Engine/source/T3D/player.cpp:6388–6563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6386}
6387
6388void Player::unpackUpdate(NetConnection *con, BitStream *stream)
6389{
6390 Parent::unpackUpdate(con,stream);
6391
6392 if (stream->readFlag())
6393 mImpactSound = stream->readInt(PlayerData::ImpactBits);
6394
6395 // Server specified action animation
6396 if (stream->readFlag()) {
6397 U32 action = stream->readInt(PlayerData::ActionAnimBits);
6398 bool hold = stream->readFlag();
6399 bool atEnd = stream->readFlag();
6400 bool fsp = stream->readFlag();
6401
6402 F32 animPos = -1.0f;
6403 if (!atEnd && stream->readFlag())
6404 animPos = stream->readSignedFloat(6);
6405
6406 if (isProperlyAdded()) {
6407 setActionThread(action,true,hold,true,fsp);
6408 bool inDeath = inDeathAnim();
6409 if (atEnd)
6410 {
6411 mShapeInstance->clearTransition(mActionAnimation.thread);
6412 mShapeInstance->setPos(mActionAnimation.thread,
6413 mActionAnimation.forward? 1: 0);
6414 if (inDeath)
6415 mDeath.lastPos = 1.0f;
6416 }
6417 else if (animPos > 0) {
6418 mShapeInstance->setPos(mActionAnimation.thread, animPos);
6419 if (inDeath)
6420 mDeath.lastPos = animPos;
6421 }
6422
6423 // mMountPending suppresses tickDelay countdown so players will sit until
6424 // their mount, or another animation, comes through (or 13 seconds elapses).
6425 mMountPending = (S32) (inSittingAnim() ? sMountPendingTickWait : 0);
6426 }
6427 else {
6428 mActionAnimation.action = action;
6429 mActionAnimation.holdAtEnd = hold;
6430 mActionAnimation.atEnd = atEnd;
6431 mActionAnimation.firstPerson = fsp;
6432 }
6433 }
6434
6435 // Server specified arm animation
6436 if (stream->readFlag()) {
6437 U32 action = stream->readInt(PlayerData::ActionAnimBits);
6438 if (isProperlyAdded())
6439 setArmThread(action);
6440 else
6441 mArmAnimation.action = action;
6442 }
6443
6444 afx_unpackUpdate(con, stream);
6445 // Done if controlled by client ( and not initial update )

Callers

nothing calls this directly

Calls 15

getMaxFunction · 0.85
mFloorFunction · 0.85
mFabsFunction · 0.85
readFlagMethod · 0.80
readIntMethod · 0.80
readSignedFloatMethod · 0.80
clearTransitionMethod · 0.80
setPosMethod · 0.80
readCompressedPointMethod · 0.80
readNormalVectorMethod · 0.80
readFloatMethod · 0.80
setPositionFunction · 0.50

Tested by

no test coverage detected