Ejemplo n.º 1
0
/*
================
sdPhysics_GeneralMover::ReadNetworkState
================
*/
void sdPhysics_GeneralMover::ReadNetworkState( networkStateMode_t mode, const sdEntityStateNetworkData& baseState, sdEntityStateNetworkData& newState, const idBitMsg& msg ) const {
	if ( mode == NSM_VISIBLE ) {
		NET_GET_STATES( sdGeneralMoverPhysicsNetworkData );

		newData.currentFraction = msg.ReadDeltaFloat( baseData.currentFraction );
	}
}
Ejemplo n.º 2
0
/*
================
idPhysics_Monster::ReadFromSnapshot
================
*/
void idPhysics_Monster::ReadFromSnapshot( const idBitMsg& msg )
{
	current.origin[0] = msg.ReadFloat();
	current.origin[1] = msg.ReadFloat();
	current.origin[2] = msg.ReadFloat();
	current.velocity[0] = msg.ReadFloat( MONSTER_VELOCITY_EXPONENT_BITS, MONSTER_VELOCITY_MANTISSA_BITS );
	current.velocity[1] = msg.ReadFloat( MONSTER_VELOCITY_EXPONENT_BITS, MONSTER_VELOCITY_MANTISSA_BITS );
	current.velocity[2] = msg.ReadFloat( MONSTER_VELOCITY_EXPONENT_BITS, MONSTER_VELOCITY_MANTISSA_BITS );
	current.localOrigin[0] = msg.ReadDeltaFloat( current.origin[0] );
	current.localOrigin[1] = msg.ReadDeltaFloat( current.origin[1] );
	current.localOrigin[2] = msg.ReadDeltaFloat( current.origin[2] );
	current.pushVelocity[0] = msg.ReadDeltaFloat( 0.0f, MONSTER_VELOCITY_EXPONENT_BITS, MONSTER_VELOCITY_MANTISSA_BITS );
	current.pushVelocity[1] = msg.ReadDeltaFloat( 0.0f, MONSTER_VELOCITY_EXPONENT_BITS, MONSTER_VELOCITY_MANTISSA_BITS );
	current.pushVelocity[2] = msg.ReadDeltaFloat( 0.0f, MONSTER_VELOCITY_EXPONENT_BITS, MONSTER_VELOCITY_MANTISSA_BITS );
	current.atRest = msg.ReadLong();
	current.onGround = msg.ReadBits( 1 ) != 0;
}
Ejemplo n.º 3
0
/*
==============
sdDeliveryVehicle::ReadNetworkState
==============
*/
void sdDeliveryVehicle::ReadNetworkState( networkStateMode_t mode, const sdEntityStateNetworkData& baseState, sdEntityStateNetworkData& newState, const idBitMsg& msg ) const {
	if ( mode == NSM_BROADCAST ) {
		NET_GET_STATES( sdDeliveryVehicleBroadcastData );

		// read state
		newData.lastRollAccel = msg.ReadDeltaFloat( baseData.lastRollAccel );
	}

	sdScriptEntity::ReadNetworkState( mode, baseState, newState, msg );
}
Ejemplo n.º 4
0
/*
================
sdProficiencyTable::ReadNetworkState
================
*/
void sdProficiencyTable::ReadNetworkState( const sdNetworkData& baseData, sdNetworkData& newData, const idBitMsg& msg ) const {
	if ( msg.ReadBool() ) {
		for ( int i = 0; i < points.Num(); i++ ) {
			newData.points[ i ] = msg.ReadDeltaFloat( baseData.points[ i ] );
		}
	} else {
		for ( int i = 0; i < points.Num(); i++ ) {
			newData.points[ i ] = baseData.points[ i ];
		}
	}

	if ( msg.ReadBool() ) {
		for ( int i = 0; i < basePoints.Num(); i++ ) {
			newData.basePoints[ i ] = msg.ReadDeltaFloat( baseData.basePoints[ i ] );
		}
	} else {
		for ( int i = 0; i < basePoints.Num(); i++ ) {
			newData.basePoints[ i ] = baseData.basePoints[ i ];
		}
	}

	if ( msg.ReadBool() ) {
		for ( int i = 0; i < points.Num(); i++ ) {
			newData.spawnLevels[ i ] = msg.ReadDeltaLong( baseData.spawnLevels[ i ] );
		}
	} else {
		for ( int i = 0; i < points.Num(); i++ ) {
			newData.spawnLevels[ i ] = baseData.spawnLevels[ i ];
		}
	}

	if ( !baseData.fixedRank ) {
		newData.fixedRank = msg.ReadBool();
		if ( newData.fixedRank ) {
			newData.fixedRankIndex = msg.ReadLong();
		} else {
			newData.fixedRankIndex = -1;
		}
	} else {
		newData.fixedRank = true;
		newData.fixedRankIndex = baseData.fixedRankIndex;
	}
}
Ejemplo n.º 5
0
/*
================
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;
			}
		}
	}
}