示例#1
0
void TransitionArea::Load( ILTMessage_Read *pMsg, uint32 dwSaveFlags )
{
	if( !pMsg ) return;

	LOAD_DWORD( m_dwFlags );
	LOAD_INT( m_nTransLevel );

	LOAD_ROTATION( m_tfWorld.m_rRot );
	LOAD_VECTOR( m_tfWorld.m_vPos );
}
示例#2
0
void AI_Helicopter::Load(HMESSAGEREAD hRead, uint32 dwLoadFlags)
{
	CAIVehicle::Load(hRead, dwLoadFlags);

	// Load state...

    uint32 dwState;
	LOAD_DWORD(dwState);

	if (dwState != (DWORD)-1)
	{
		SetState((CAIHelicopterState::AIHelicopterStateType)dwState);

		if (m_pHelicopterState)
		{
			m_pHelicopterState->Load(hRead);
		}
	}

	LOAD_FLOAT(m_fSpeed);
	LOAD_FLOAT(m_fFlySpeed);
	LOAD_ROTATION(m_rRotSearchlight);
	LOAD_VECTOR(m_vPosSearchlight);
	LOAD_INT(m_iObjectSearchLight);
	LOAD_ROTATION(m_rRotGunner);
	LOAD_VECTOR(m_vPosGunner);
	LOAD_INT(m_iObjectGunner);

	LOAD_BOOL(m_bWantsRightDoorOpened);
	LOAD_BOOL(m_bWantsRightDoorClosed);
	LOAD_BOOL(m_bRightDoorOpened);
	LOAD_BOOL(m_bWantsLeftDoorOpened);
	LOAD_BOOL(m_bWantsLeftDoorClosed);
	LOAD_BOOL(m_bLeftDoorOpened);

	LOAD_FLOAT(m_fDeathDelay);
	LOAD_HSTRING(m_hstrDeathMessage);
	LOAD_HSTRING(m_hstrDeath2_3rdMessage);
	LOAD_HSTRING(m_hstrDeath1_3rdMessage);
	LOAD_HSTRING(m_hstrDeath0_3rdMessage);
	LOAD_BOOL(m_bExploded);
}
示例#3
0
void PlayerVehicle::Load(HMESSAGEREAD hRead)
{
    ILTServer* pServerDE = GetServerDE();
	if (!pServerDE || !hRead) return;

	LOAD_VECTOR(m_vOriginalPos);
	LOAD_VECTOR(m_vOriginalDims);
	LOAD_ROTATION(m_rOriginalRot);
 	LOAD_FLOAT(m_fRespawnTime);

    uint8 nModel;
	LOAD_BYTE(nModel);
	m_ePPhysicsModel = (PlayerPhysicsModel)nModel;

	m_RespawnTimer.Load(hRead);
}
示例#4
0
void PlayerVehicle::Load(ILTMessage_Read *pMsg)
{
	if (!pMsg) return;

	LOAD_VECTOR(m_vOriginalPos);
	LOAD_VECTOR(m_vOriginalDims);
	LOAD_ROTATION(m_rOriginalRot);
 	LOAD_FLOAT(m_fRespawnTime);
	LOAD_BYTE_CAST(m_ePPhysicsModel, PlayerPhysicsModel);
	LOAD_bool( m_bLocked );
	LOAD_bool( m_bRidden );
	LOAD_HSTRING( m_hstrLockedCommand );
	LOAD_DWORD(m_dwSavedFlags);
	LOAD_TIME( m_fLastRideTime );
	LOAD_bool( m_bVirgin );

	m_RespawnTimer.Load(pMsg);
}
示例#5
0
void WorldModel::OnLoad( ILTMessage_Read *pMsg, uint32 dwSaveFlags )
{
	ASSERT( pMsg != NULL );

	m_ActivateTypeHandler.Load( pMsg );

	LOAD_bool( m_bIsKeyframed );
	LOAD_bool( m_bStartHidden );
	LOAD_HSTRING( m_hstrAttachments );
	LOAD_BOOL( m_bRemoveAttachments );
	LOAD_VECTOR( m_vAttachDir );
	LOAD_HOBJECT( m_hAttachDirObj );
	LOAD_ROTATION( m_hackInitialRot );
	LOAD_FLOAT( m_fStimRadius );
	LOAD_HOBJECT( m_hActivateParent );
	LOAD_bool( m_bCanActivate );

	// Load the object lists last...
	uint8	nObjsInList = 0;

	// First the Attachment list
	LOAD_BYTE( nObjsInList );
	m_AttachmentList.clear( );
	if( nObjsInList > 0 )
	{
		LTObjRefNotifier ref( *this );
		for( uint8 i = 0; i < nObjsInList; ++i )
		{
			LOAD_HOBJECT( ref );
			if( ref )
			{
				m_AttachmentList.push_back( ref );
			}
		}
	}

	// Then the other attachment list
	LOAD_BYTE( nObjsInList );
	m_AttachMsgObjList.clear( );
	if( nObjsInList > 0 )
	{
		LTObjRefNotifier ref( *this );
		for( uint8 i = 0; i < nObjsInList; ++i )
		{
			LOAD_HOBJECT( ref );
			if( ref )
			{
				m_AttachMsgObjList.push_back( ref );
			}
		}
	}

	// Then the Mark list
	LOAD_BYTE( nObjsInList );
	m_MarkList.clear( );
	if( nObjsInList > 0 )
	{
		LTObjRefNotifier ref( *this );
		for( uint8 i = 0; i < nObjsInList; ++i )
		{
			LOAD_HOBJECT( ref );
			if( ref )
			{
				m_MarkList.push_back( ref );
			}
		}
	}
}
示例#6
0
void CTransitionAggregate::Load( ILTMessage_Read *pMsg, uint32 dwLoadFlags )
{
	if( !pMsg ) return;
	
	LOAD_HOBJECT( m_hObject );

	// The rest is dependent on the load type...

	if( dwLoadFlags != LOAD_TRANSITION ) return;
	
	HOBJECT hTransArea = g_pTransMgr->GetTransitionArea();
	if( !hTransArea ) return;
	
	TransitionArea *pTransArea = (TransitionArea*)g_pLTServer->HandleToObject( hTransArea );
	if( !pTransArea ) return;

	LTransform tfLocal;
	LTransform tfObjectWorld;
	LTVector vVelRel;
	LTransform const& tfTransAreaWorld = pTransArea->GetWorldTransform( );
	LTMatrix mRotation;
	tfTransAreaWorld.m_Rot.ConvertToMatrix( mRotation );

	LOAD_VECTOR( tfLocal.m_Pos );
	LOAD_ROTATION( tfLocal.m_Rot );
	LOAD_VECTOR( vVelRel );
	
	// Calc pos and rot based on offsets and current TransArea...

	tfObjectWorld.m_Pos = tfTransAreaWorld.m_Pos + ( mRotation * tfLocal.m_Pos );
	tfObjectWorld.m_Rot = tfTransAreaWorld.m_Rot * tfLocal.m_Rot;
	LTVector vVel = mRotation * vVelRel;

	if( IsPlayer( m_hObject ))
	{
		// Since the PlayerObj is controlled by the client we need to notify the
		// client of the rotation.  We are only worried about the Yaw since Roll doesn't 
		// matter and Pitch can be preserved on the client.


		CPlayerObj *pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject( m_hObject );
		if( !pPlayer ) return;

		
		LTFLOAT		fYaw;
		LTVector	vF = tfObjectWorld.m_Rot.Forward();

		// We don't care about Roll...

		vF.y = 0.0f; 
		vF.Normalize();

		// Yaw = arctan( vF.x / vF.z );
		// atan2 is well defined even for vF.z == 0

		fYaw = (LTFLOAT)atan2( vF.x, vF.z );
		
		// Inform the client of the correct camera/player orientation...

		LTVector vVec( 0.0f, fYaw, 0.0f );
		
		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_PLAYER_ORIENTATION );
		cMsg.Writeuint8( MID_ORIENTATION_YAW );
		cMsg.WriteLTVector( vVec );
		g_pLTServer->SendToClient(cMsg.Read(), pPlayer->GetClient(), MESSAGE_GUARANTEED);
		
	}

	g_pLTServer->SetObjectPos( m_hObject, &tfObjectWorld.m_Pos );
	g_pLTServer->SetObjectRotation( m_hObject, &tfObjectWorld.m_Rot );
	g_pPhysicsLT->SetVelocity( m_hObject, &vVel );
}