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

Method packUpdate

Engine/source/T3D/entity.cpp:399–487  ·  view source on GitHub ↗

Networking

Source from the content-addressed store, hash-verified

397
398//Networking
399U32 Entity::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
400{
401 U32 retMask = Parent::packUpdate(con, mask, stream);
402
403 if (stream->writeFlag(mask & TransformMask))
404 {
405 //mathWrite( *stream, getScale() );
406 //stream->writeAffineTransform(mObjToWorld);
407 //mathWrite(*stream, getPosition());
408 //mathWrite(*stream, mPos);
409
410 stream->writeCompressedPoint(mPos);
411 mathWrite(*stream, getRotation());
412
413 mDelta.move.pack(stream);
414
415 stream->writeFlag(!(mask & NoWarpMask));
416 }
417
418 /*if (stream->writeFlag(mask & MountedMask))
419 {
420 mathWrite(*stream, mMount.xfm.getPosition());
421 mathWrite(*stream, mMount.xfm.toEuler());
422 }*/
423
424 if (stream->writeFlag(mask & BoundsMask))
425 {
426 mathWrite(*stream, mObjBox);
427 }
428
429 //pass our behaviors around
430 if (mask & ComponentsMask || mask & InitialUpdateMask)
431 {
432 stream->writeFlag(true);
433 //now, we run through a list of our to-be-sent behaviors and begin sending them
434 //if any fail, we keep our list and re-queue the mask
435 S32 componentCount = mToLoadComponents.size();
436
437 //build our 'ready' list
438 //This requires both the instance and the instances' template to be prepped(if the template hasn't been ghosted,
439 //then we know we shouldn't be passing the instance's ghosts around yet)
440 U32 ghostedCompCnt = 0;
441 for (U32 i = 0; i < componentCount; i++)
442 {
443 if (con->getGhostIndex(mToLoadComponents[i]) != -1)
444 ghostedCompCnt++;
445 }
446
447 if (ghostedCompCnt != 0)
448 {
449 stream->writeFlag(true);
450
451 stream->writeFlag(mStartComponentUpdate);
452
453 //if not all the behaviors have been ghosted, we'll need another pass
454 if (ghostedCompCnt != componentCount)
455 retMask |= ComponentsMask;
456

Callers

nothing calls this directly

Calls 9

mathWriteFunction · 0.85
writeCompressedPointMethod · 0.80
getGhostIndexMethod · 0.80
writeIntMethod · 0.80
getRotationFunction · 0.70
writeFlagMethod · 0.45
packMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected