示例#1
0
/*
================
sdDeliveryVehicle::ApplyNetworkState
================
*/
void sdDeliveryVehicle::ApplyNetworkState( networkStateMode_t mode, const sdEntityStateNetworkData& newState ) {
	if ( mode == NSM_BROADCAST ) {
		NET_GET_NEW( sdDeliveryVehicleBroadcastData );

		lastRollAccel = newData.lastRollAccel;
	}

	sdScriptEntity::ApplyNetworkState( mode, newState );
}
示例#2
0
/*
================
sdPhysics_GeneralMover::ApplyNetworkState
================
*/
void sdPhysics_GeneralMover::ApplyNetworkState( networkStateMode_t mode, const sdEntityStateNetworkData& newState ) {
	if ( mode == NSM_VISIBLE ) {
		NET_GET_NEW( sdGeneralMoverPhysicsNetworkData );

		SetCurrentPos( newData.currentFraction );

		UpdateClipModel();
	}
}
示例#3
0
/*
================
sdPhysics_Linear::ApplyNetworkState
================
*/
void sdPhysics_Linear::ApplyNetworkState( networkStateMode_t mode, const sdEntityStateNetworkData& newState ) {
	traceCollection.ForceNextUpdate();
	if ( mode == NSM_BROADCAST ) {
		NET_GET_NEW( sdPhysicsLinearBroadcastData );

		// update state
		current.atRest				= newData.atRest;
		current.localOrigin			= newData.localOrigin;

		current.linearExtrapolation.Init( MS2SEC( newData.startTime ), MS2SEC( newData.duration ), newData.startValue, 
											newData.baseSpeed, newData.speed, newData.extrapolationType );

		self->UpdateVisuals();

		return;
	}
}
示例#4
0
/*
================
idScriptObject::ApplyNetworkState
================
*/
void idScriptObject::ApplyNetworkState( networkStateMode_t mode, const sdEntityStateNetworkData& newState ) {
	NET_GET_NEW( sdScriptObjectNetworkData );

	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& newBase = newData.GetInt();

				int& e = *reinterpret_cast< int* >( value.data );
				int oldE = e;

				idEntity* ent = gameLocal.EntityForSpawnId( newBase );
				e = ent ? ent->GetScriptObject()->GetHandle() : 0;

				if ( value.callback ) {
					if ( oldE != e ) {
						gameLocal.CallFrameCommand( this, value.callback );
					}
				}
				break;
			}
			case ev_vector: {
				const idVec3& newBase = newData.GetVector();

				idVec3& v = *reinterpret_cast< idVec3* >( value.data );

				if ( newBase != v ) {
					v = newBase;
					if ( value.callback ) {
						gameLocal.CallFrameCommand( this, value.callback );
					}
				}
				break;
			}
			case ev_float: {
				const float& newBase = newData.GetFloat();

				float& f = *reinterpret_cast< float* >( value.data );

				if ( newBase != f ) {
					f = newBase;
					if ( value.callback ) {
						gameLocal.CallFrameCommand( this, value.callback );
					}
				}

				break;
			}
			case ev_boolean: {
				const int& newBase = newData.GetInt();

				bool& b = *reinterpret_cast< bool* >( value.data );

				if ( ( newBase != 0 ) != b ) {
					b = newBase != 0;
					if ( value.callback ) {
						gameLocal.CallFrameCommand( this, value.callback );
					}
				}
				break;
			}
		}
	}
}