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

Method unpackUpdate

Engine/source/T3D/shapeBase.cpp:3196–3418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3194}
3195
3196void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
3197{
3198 Parent::unpackUpdate(con, stream);
3199 mLastRenderFrame = sLastRenderFrame; // make sure we get a process after the event...
3200
3201 if(!stream->readFlag())
3202 return;
3203
3204 if (stream->readFlag()) {
3205 mDamage = mClampF(stream->readFloat(DamageLevelBits) * mDataBlock->maxDamage, 0.f, mDataBlock->maxDamage);
3206 DamageState prevState = mDamageState;
3207 mDamageState = DamageState(stream->readInt(NumDamageStateBits));
3208 stream->readNormalVector( &damageDir, 8 );
3209 if (prevState != Destroyed && mDamageState == Destroyed && isProperlyAdded())
3210 blowUp();
3211 updateDamageLevel();
3212 updateDamageState();
3213 }
3214
3215 if (stream->readFlag()) {
3216 for (S32 i = 0; i < MaxScriptThreads; i++) {
3217 if (stream->readFlag()) {
3218 Thread& st = mScriptThread[i];
3219 U32 seq = stream->readInt(ThreadSequenceBits);
3220 st.state = Thread::State(stream->readInt(2));
3221 stream->read( &st.timescale );
3222 stream->read( &st.position );
3223 st.atEnd = stream->readFlag();
3224 if (st.sequence != seq && st.state != Thread::Destroy)
3225 setThreadSequence(i,seq,false);
3226 else
3227 updateThread(st);
3228 }
3229 }
3230 }
3231
3232 if ( stream->readFlag() )
3233 {
3234 for ( S32 i = 0; i < MaxSoundThreads; i++ )
3235 {
3236 if ( stream->readFlag() )
3237 {
3238 SoundThread& st = mSoundThread[i];
3239 st.play = stream->readFlag();
3240 if ( st.play )
3241 {
3242 StringTableEntry temp = StringTable->insert(con->unpackNetStringHandleU(stream).getString());
3243 if (AssetDatabase.isDeclaredAsset(temp))
3244 {
3245 AssetPtr<SoundAsset> tempSoundAsset;
3246 tempSoundAsset = temp;
3247
3248 st.asset = temp;
3249 }
3250 }
3251
3252 if ( isProperlyAdded() )
3253 updateAudioState( st );

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected