/* ================ sdPhysics_Linear::ReadNetworkState ================ */ void sdPhysics_Linear::ReadNetworkState( networkStateMode_t mode, const sdEntityStateNetworkData& baseState, sdEntityStateNetworkData& newState, const idBitMsg& msg ) const { if ( mode == NSM_BROADCAST ) { NET_GET_STATES( sdPhysicsLinearBroadcastData ); // read state newData.atRest = msg.ReadDeltaLong( baseData.atRest ); newData.localOrigin = msg.ReadDeltaVector( baseData.localOrigin ); newData.baseSpeed = msg.ReadDeltaVector( baseData.baseSpeed ); newData.duration = msg.ReadDeltaLong( baseData.duration ); newData.extrapolationType = ( extrapolation_t )msg.ReadDelta( baseData.extrapolationType, 8 ); newData.speed = msg.ReadDeltaVector( baseData.speed ); newData.startTime = msg.ReadDeltaLong( baseData.startTime ); newData.startValue = msg.ReadDeltaVector( baseData.startValue ); return; } }
/* ================ idScriptObject::ReadNetworkState ================ */ void idScriptObject::ReadNetworkState( networkStateMode_t mode, const sdEntityStateNetworkData& baseState, sdEntityStateNetworkData& newState, const idBitMsg& msg ) const { NET_GET_STATES( sdScriptObjectNetworkData ); SetupStateData( mode, newData ); baseData.Reset(); newData.Reset(); for ( int i = 0; i < networkFields[ mode ].fields.Num(); i++ ) { const networkFieldSync_t& value = networkFields[ mode ].fields[ i ]; switch( value.type ) { case ev_object: { const int& oldBase = baseData.GetInt(); int& newBase = newData.GetInt(); newBase = msg.ReadDeltaLong( oldBase ); break; } case ev_vector: { const idVec3& oldBase = baseData.GetVector(); idVec3& newBase = newData.GetVector(); newBase = msg.ReadDeltaVector( oldBase ); break; } case ev_float: { const float& oldBase = baseData.GetFloat(); float& newBase = newData.GetFloat(); newBase = msg.ReadDeltaFloat( oldBase ); break; } case ev_boolean: { const int& oldBase = baseData.GetInt(); int& newBase = newData.GetInt(); newBase = msg.ReadBits( 1 ); break; } } } }