Ejemplo n.º 1
0
/*
================
sdGameRulesStopWatch::ReadNetworkState
================
*/
void sdGameRulesStopWatch::ReadNetworkState( const sdEntityStateNetworkData& baseState, sdEntityStateNetworkData& newState, const idBitMsg& msg ) const {
	sdGameRules::ReadNetworkState( baseState, newState, msg );

	NET_GET_STATES( sdGameRulesStopWatchNetworkState );

	sdTeamManagerLocal& teamManager = sdTeamManager::GetInstance();

	newData.winningTeam	= teamManager.ReadTeamFromStream( baseData.winningTeam, msg );
	newData.progression = msg.ReadDeltaLong( baseData.progression );
	newData.timeToBeat	= msg.ReadDeltaLong( baseData.timeToBeat );
	newData.winReason	= msg.ReadDeltaLong( baseData.winReason );
}
Ejemplo n.º 2
0
/*
================
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;
	}
}
Ejemplo n.º 3
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.º 4
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;
			}
		}
	}
}