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

Method packUpdate

Engine/source/scene/sceneObject.cpp:892–956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

890//--------------------------------------------------------------------------
891
892U32 SceneObject::packUpdate( NetConnection* conn, U32 mask, BitStream* stream )
893{
894 U32 retMask = Parent::packUpdate( conn, mask, stream );
895
896 if ( stream->writeFlag( mask & FlagMask ) )
897 stream->writeRangedU32( (U32)mObjectFlags, 0, getObjectFlagMax() );
898
899 // PATHSHAPE
900 //Begin attachment
901 retMask = 0; //retry mask
902
903 if (stream->writeFlag(getParent() != NULL)) {
904 stream->writeAffineTransform(mGraph.objToParent);
905 }
906 if (stream->writeFlag(mask & MountedMask))
907 {
908 // Check to see if we need to write an object ID
909 if (stream->writeFlag(mGraph.parent)) {
910 S32 t = conn->getGhostIndex(mGraph.parent);
911 // Check to see if we can actually ghost this...
912 if (t == -1) {
913 // Cant, try again later
914 retMask |= MountedMask;
915 stream->writeFlag(false);
916 }
917 else {
918 // Can, write it.
919 stream->writeFlag(true);
920 stream->writeRangedU32(U32(t), 0, NetConnection::MaxGhostCount);
921 stream->writeAffineTransform(mGraph.objToParent);
922 //Con::errorf("%d: sent mounted on %d", getId(), mGraph.parent->getId());
923 }
924 }
925 }
926 // End of Attachment
927 // PATHSHAPE END
928
929 if ( mask & MountedMask )
930 {
931 if ( mMount.object )
932 {
933 S32 gIndex = conn->getGhostIndex( mMount.object );
934
935 if ( stream->writeFlag( gIndex != -1 ) )
936 {
937 stream->writeFlag( true );
938 stream->writeInt( gIndex, NetConnection::GhostIdBitSize );
939 if ( stream->writeFlag( mMount.node != -1 ) )
940 stream->writeInt( mMount.node, NumMountPointBits );
941 mathWrite( *stream, mMount.xfm );
942 }
943 else
944 // Will have to try again later
945 retMask |= MountedMask;
946 }
947 else
948 // Unmount if this isn't the initial packet
949 if ( stream->writeFlag( !(mask & InitialUpdateMask) ) )

Callers

nothing calls this directly

Calls 7

mathWriteFunction · 0.85
writeRangedU32Method · 0.80
writeAffineTransformMethod · 0.80
getGhostIndexMethod · 0.80
writeIntMethod · 0.80
U32Enum · 0.70
writeFlagMethod · 0.45

Tested by

no test coverage detected