当前位置: 首页>>代码示例>>C++>>正文


C++ CVehicle::EnforceWorldBoundries方法代码示例

本文整理汇总了C++中CVehicle::EnforceWorldBoundries方法的典型用法代码示例。如果您正苦于以下问题:C++ CVehicle::EnforceWorldBoundries方法的具体用法?C++ CVehicle::EnforceWorldBoundries怎么用?C++ CVehicle::EnforceWorldBoundries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CVehicle的用法示例。


在下文中一共展示了CVehicle::EnforceWorldBoundries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Process

BOOL CLocalPlayer::Process()
{
	CSpawnSelection *pGameLogic;
	CVehicle *pGameVehicle;
	CVehicleManager *pVehicleManager;

	EntityId vehicleID;

	DWORD dwThisTick;

	if(m_bIsActive && !m_bIsWasted && (NULL != m_pPlayerPed))
	{
		// If they're in a vehicle and their health reaches 0 we need to
		// kill them manually or they don't actually die
		if(m_pPlayerPed->IsInVehicle() && m_pPlayerPed->IsDead()) {
			m_pPlayerPed->SetDead();
		}

		if((m_pPlayerPed->GetAction() == ACTION_WASTED) && !m_bIsWasted)
		{
			m_bIsWasted = TRUE;
			m_bIsActive = FALSE;
			SendWastedNotification();
		}
		else
		{
			dwThisTick = GetTickCount();

			if(m_pPlayerPed->IsInVehicle())
			{
				if(!m_pPlayerPed->IsAPassenger())
				{
					// DRIVING VEHICLE

					// VEHICLE WORLD BOUNDS STUFF
					pVehicleManager = pNetowkManager->GetVehicleManager();
					vehicleID = pVehicleManager->FindIDFromGtaPtr(m_pPlayerPed->GetGtaVehicle());
					if(vehicleID != INVALID_ENTITY_ID) {
						pGameVehicle = pVehicleManager->GetAt(vehicleID);
						pGameVehicle->EnforceWorldBoundries(
							pNetowkManager->m_WorldBounds[0],pNetowkManager->m_WorldBounds[1],
							pNetowkManager->m_WorldBounds[2],pNetowkManager->m_WorldBounds[3]);
					}

					if((dwThisTick - m_dwLastSendTick) > (UINT)GetOptimumInCarSendRate()) {
						m_dwLastSendTick = GetTickCount();
					
						// send nothing while we're getting out.
						if(m_pPlayerPed->GetAction() != ACTION_EXITING_VEHICLE) {
							SendInCarFullSyncData();
						}
					}

					pGame->DisablePassengerEngineAudio();
				}
				else
				{
					// PASSENGER

					if((dwThisTick - m_dwLastPassengerSendTick) > 1000) {
						m_dwLastPassengerSendTick = GetTickCount();
						SendInCarPassengerData();
					}

					pGame->EnablePassengerEngineAudio();
				}
			}
			else
			{
				// ONFOOT

				if((dwThisTick - m_dwLastSendTick) > (UINT)GetOptimumOnFootSendRate()) {
					m_dwLastSendTick = GetTickCount();

					// send nothing while we're getting in
					if(m_pPlayerPed->GetAction() != ACTION_DRIVING_VEHICLE)
					{
						SendOnFootFullSyncData(); 
					}
				}

				pGame->DisablePassengerEngineAudio();
			}			
		}
	}
	else if ((m_bIsWasted == TRUE) && 
			(m_pPlayerPed->GetAction() != ACTION_WASTED))
	{
		m_bIsWasted = FALSE;
		pNetowkManager->GetGameLogic()->HandleClassSelection(this);
		return TRUE;
	}
	if (pGame->IsMenuActive() != m_iPause)
	{
		m_iPause = pGame->IsMenuActive();
		SendPauseNotification(m_iPause);
	}

	pGameLogic = pNetowkManager->GetGameLogic();

//.........这里部分代码省略.........
开发者ID:Tonyx97,项目名称:vice-players,代码行数:101,代码来源:CLocalPlayer.cpp


注:本文中的CVehicle::EnforceWorldBoundries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。