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

Method unpackUpdate

Engine/source/T3D/shapeBase.cpp:3043–3259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3041}
3042
3043void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
3044{
3045 Parent::unpackUpdate(con, stream);
3046 mLastRenderFrame = sLastRenderFrame; // make sure we get a process after the event...
3047
3048 if(!stream->readFlag())
3049 return;
3050
3051 if (stream->readFlag()) {
3052 mDamage = mClampF(stream->readFloat(DamageLevelBits) * mDataBlock->maxDamage, 0.f, mDataBlock->maxDamage);
3053 DamageState prevState = mDamageState;
3054 mDamageState = DamageState(stream->readInt(NumDamageStateBits));
3055 stream->readNormalVector( &damageDir, 8 );
3056 if (prevState != Destroyed && mDamageState == Destroyed && isProperlyAdded())
3057 blowUp();
3058 updateDamageLevel();
3059 updateDamageState();
3060 }
3061
3062 if (stream->readFlag()) {
3063 for (S32 i = 0; i < MaxScriptThreads; i++) {
3064 if (stream->readFlag()) {
3065 Thread& st = mScriptThread[i];
3066 U32 seq = stream->readInt(ThreadSequenceBits);
3067 st.state = Thread::State(stream->readInt(2));
3068 stream->read( &st.timescale );
3069 stream->read( &st.position );
3070 st.atEnd = stream->readFlag();
3071 if (st.sequence != seq && st.state != Thread::Destroy)
3072 setThreadSequence(i,seq,false);
3073 else
3074 updateThread(st);
3075 }
3076 }
3077 }
3078
3079 if ( stream->readFlag() )
3080 {
3081 for ( S32 i = 0; i < MaxSoundThreads; i++ )
3082 {
3083 if ( stream->readFlag() )
3084 {
3085 Sound& st = mSoundThread[i];
3086 st.play = stream->readFlag();
3087 if ( st.play )
3088 {
3089 st.profile = (SFXTrack*) stream->readRangedU32( DataBlockObjectIdFirst,
3090 DataBlockObjectIdLast );
3091 }
3092
3093 if ( isProperlyAdded() )
3094 updateAudioState( st );
3095 }
3096 }
3097 }
3098
3099 // Mounted Images
3100 if (stream->readFlag()) {

Callers

nothing calls this directly

Calls 14

mClampFFunction · 0.85
DamageStateEnum · 0.85
readFlagMethod · 0.80
readFloatMethod · 0.80
readIntMethod · 0.80
readNormalVectorMethod · 0.80
readRangedU32Method · 0.80
readBitsMethod · 0.80
StateEnum · 0.70
findObjectFunction · 0.50
getCurrentTimeFunction · 0.50

Tested by

no test coverage detected