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


C++ CContextData::GetPlayerInfo方法代码示例

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


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

示例1: StoreArmHeadingUpDown

void StoreArmHeadingUpDown(EFLC::IPed * pPed, float * fArmHeading, float * fArmUpDown)
{
	// Do we have a valid ped pointer?
	if(pPed)
	{
		// Get the remote players context data
		CContextData * pContextData = CContextDataManager::GetContextData((EFLC::IPlayerPed *)pPed);

		// Do we have a valid context data?
		if(pContextData)
		{
			// Is this the local player?
			if(pContextData->GetPlayerInfo()->GetPlayerNumber() == 0)
			{
				pContextData->SetArmHeading(*fArmHeading);
				pContextData->SetArmUpDown(*fArmUpDown);
			}
			else
			{
				pContextData->GetArmHeading(*fArmHeading);
				pContextData->GetArmUpDown(*fArmUpDown);
			}
		}
		else
			CLogFile::PrintDebugf("StoreArmHeadingUpDown Warning: Invalid Player Ped");
	}
}
开发者ID:DarkSlim,项目名称:IV-Network,代码行数:27,代码来源:CWeaponHandler.cpp

示例2: StoreShotSourceTarget

void StoreShotSourceTarget(EFLC::IPed * pPed, CVector3 * pWeaponSource, CVector3 * pWeaponTarget)
{
	// Do we have a valid ped pointer, source pointer and target pointer?
	if(pPed && pWeaponSource && pWeaponTarget)
	{
		// Get the remote players context data
		CContextData * pContextData = CContextDataManager::GetContextData((EFLC::IPlayerPed *)pPed);

		// Do we have a valid context data?
		if(pContextData)
		{
			// Is this the local player?
			if(pContextData->GetPlayerInfo()->GetPlayerNumber() == 0)
			{
				pContextData->SetWeaponShotSource(*pWeaponSource);
				pContextData->SetWeaponShotTarget(*pWeaponTarget);
			}
			else
			{
				pContextData->GetWeaponShotSource(*pWeaponSource);
				pContextData->GetWeaponShotTarget(*pWeaponTarget);
			}
		}
		else
			CLogFile::PrintDebugf("StoreShotSourceTarget Warning: Invalid Player Ped");
	}
}
开发者ID:DarkSlim,项目名称:IV-Network,代码行数:27,代码来源:CWeaponHandler.cpp

示例3: StoreAimTarget

void StoreAimTarget(IVPed * pPed, CVector3 * vecWeaponTarget)
{
	// Do we have a valid ped pointer and target pointer?
	if(pPed && vecWeaponTarget)
	{
		// Get the remote players context data
		CContextData * pContextData = CContextDataManager::GetContextData((IVPlayerPed *)pPed);

		// Do we have a valid context data?
		if(pContextData)
		{
			// Is this the local player?
			if(pContextData->GetPlayerInfo()->GetPlayerNumber() == 0)
			{
				pContextData->SetWeaponAimTarget(*vecWeaponTarget);
			}
			else
			{
				pContextData->GetWeaponAimTarget(*vecWeaponTarget);
			}
		}
		else
			CLogFile::PrintDebugf("StoreAimTarget Warning: Invalid Player Ped");
	}
}
开发者ID:panzercrak,项目名称:IV-Network,代码行数:25,代码来源:CWeaponHandler.cpp

示例4: GetIndexFromPlayerInfo

unsigned int GetIndexFromPlayerInfo(IVPlayerInfo * pPlayerInfo)
{
    uiReturnedIndex = 0;

    if (pPlayerInfo != g_pCore->GetGame()->GetPools()->GetPlayerInfoFromIndex(0))
    {
        CContextData * pContextInfo = CContextDataManager::GetContextData(pPlayerInfo);

        if (pContextInfo)
            uiReturnedIndex = pContextInfo->GetPlayerInfo()->GetPlayerNumber();
    }

    return uiReturnedIndex;
}
开发者ID:B2O,项目名称:IV-Network,代码行数:14,代码来源:CHooks.cpp

示例5: GetPlayerInfoFromIndex

IVPlayerInfo * GetPlayerInfoFromIndex(unsigned int uiIndex)
{
    pReturnedPlayerInfo = g_pCore->GetGame()->GetPools()->GetPlayerInfoFromIndex(0);

    if (uiIndex != 0)
    {
        CContextData * pContextInfo = CContextDataManager::GetContextData(uiIndex);

        if (pContextInfo)
            pReturnedPlayerInfo = pContextInfo->GetPlayerInfo()->GetPlayerInfo();
    }

    return pReturnedPlayerInfo;
}
开发者ID:B2O,项目名称:IV-Network,代码行数:14,代码来源:CHooks.cpp

示例6:

CContextData * CContextDataManager::GetContextData(IVPlayerInfo * pPlayerInfo)
{
	// Loop through the context info list
	for(std::list<CContextData *>::iterator iter = m_contextDataList.begin(); iter != m_contextDataList.end(); iter++)
	{
		// Get the context info pointer
		CContextData * pContextInfo = *iter;

		// Is this the context info we are looking for?
		if(pContextInfo->GetPlayerInfo()->GetPlayerInfo() == pPlayerInfo)
			return pContextInfo;
	}

	return NULL;
}
开发者ID:guilhermelhr,项目名称:ivmultiplayer,代码行数:15,代码来源:CContextDataManager.cpp

示例7:

CContextData * CContextDataManager::GetContextData(IVPlayerInfo * pPlayerInfo)
{
	// Loop through the context data list
	for(std::list<CContextData *>::iterator iter = m_contextDataList.begin(); iter != m_contextDataList.end(); iter++)
	{
		// Get the context data pointer
		CContextData * pContextData = *iter;

		// Is this the context data we're looking for?
		if(pContextData->GetPlayerInfo()->GetPlayerInfo() == pPlayerInfo)
		{
			return pContextData;
		}
	}

	return nullptr;
}
开发者ID:ALArmagost,项目名称:IV-Network,代码行数:17,代码来源:CContextData.cpp

示例8: ContextSwitch

void ContextSwitch(IVPed * pPed, bool bPost)
{
    // Do we have a valid ped pointer?
    if(pPed)
    {
        // Get the game pad
        CIVPad * pPad = g_pClient->GetGame()->GetPad();

        /*CContextData * pTestContextInfo = CContextDataManager::GetContextData((IVPlayerPed *)pPed);
        CIVPad * pTestPad = g_pClient->GetGame()->GetPad();
        bool bLocalPlayer = ((IVPlayerPed *)pPed == CPools::GetPlayerInfoFromIndex(0)->m_pPlayerPed);
        if(!bLocalPlayer && pTestContextInfo)
        {
        	pTestPad = pTestContextInfo->GetPad();
        }
        CClientPadState curPad;
        CClientPadState lasPad;
        pTestPad->GetCurrentClientPadState(curPad);
        pTestPad->GetLastClientPadState(lasPad);
        if(curPad.byteKeys[INPUT_MELEE_KICK] && !lasPad.byteKeys[INPUT_MELEE_KICK])
        {
        	CLogFile::Printf("(%d) Melee kick start hold", bLocalPlayer);
        	if(bLocalPlayer)
        		bRecordHistory = true;
        	else
        		bRecordHistory2 = true;
        }
        if(bRecordHistory || bRecordHistory2)
        {
        	CLogFile::Printf("(%d) Current history taken at %d is %d", bLocalPlayer, pTestPad->GetPad()->m_padData[INPUT_MELEE_KICK].m_pHistory->m_historyItems[pTestPad->GetPad()->m_padData[INPUT_MELEE_KICK].m_byteHistoryIndex].m_dwLastUpdateTime, pTestPad->GetPad()->m_padData[INPUT_MELEE_KICK].m_pHistory->m_historyItems[pTestPad->GetPad()->m_padData[INPUT_MELEE_KICK].m_byteHistoryIndex].m_byteValue);
        }
        if(!curPad.byteKeys[INPUT_MELEE_KICK] && lasPad.byteKeys[INPUT_MELEE_KICK])
        {
        	CLogFile::Printf("(%d) Melee kick end hold", bLocalPlayer);
        	if(bLocalPlayer)
        		bRecordHistory = false;
        	else
        		bRecordHistory2 = false;
        }*/

        // Is this not the local player ped?
        if((IVPlayerPed *)pPed != CPools::GetPlayerInfoFromIndex(0)->m_pPlayerPed)
        {
            if(!bPost && !bInLocalContext)
            {
                CLogFile::Printf("Not switching due to not being in local context!");
                return;
            }

            if(bPost && bInLocalContext)
            {
                CLogFile::Printf("Not switching due to being in local context!");
                return;
            }

            // Get the remote players context info
            CContextData * pContextInfo = CContextDataManager::GetContextData((IVPlayerPed *)pPed);

            // Do we have a valid context info?
            if(pContextInfo)
            {
                //CLogFile::SetUseCallback(false);
                //CLogFile::Printf("ContextSwitch(0x%p, %d) (Player Ped %d)", pPed, bPost, pContextInfo->GetPlayerInfo()->GetPlayerNumber());
                //CLogFile::SetUseCallback(true);

                if(!bPost)
                {
                    // Store the local players index
                    m_uiLocalPlayerIndex = CPools::GetLocalPlayerIndex();

                    // Store the local players pad
                    memcpy(&m_localPad, pPad->GetPad(), sizeof(IVPad));

                    // Store the local players camera matrix
                    GetGameCameraMatrix(&m_matLocalCameraMatrix);

                    // Swap the local player index with the remote players index
                    CPools::SetLocalPlayerIndex(pContextInfo->GetPlayerInfo()->GetPlayerNumber());

                    // Set the history values
                    for(int i = 0; i < INPUT_COUNT; i++)
                    {
                        CPadData * pPadData = &pContextInfo->GetPad()->GetPad()->m_padData[i];

                        if(pPadData->m_pHistory)
                        {
                            pPadData->m_byteHistoryIndex++;

                            if(pPadData->m_byteHistoryIndex >= MAX_HISTORY_ITEMS)
                                pPadData->m_byteHistoryIndex = 0;

                            pPadData->m_pHistory->m_historyItems[pPadData->m_byteHistoryIndex].m_byteValue = pContextInfo->GetPad()->GetPad()->m_padData[i].m_byteLastValue;
                            pPadData->m_pHistory->m_historyItems[pPadData->m_byteHistoryIndex].m_dwLastUpdateTime = g_pClient->GetGame()->GetTime();
                        }
                    }

                    // Swap the local players pad with the remote players pad
                    memcpy(pPad->GetPad(), pContextInfo->GetPad()->GetPad(), sizeof(IVPad));

                    // Swap the local players camera matrix with the remote players camera matrix
//.........这里部分代码省略.........
开发者ID:killserver,项目名称:GTA-IV,代码行数:101,代码来源:KeySync.cpp

示例9: ContextSwitch

void ContextSwitch(IVPed * pPed, bool bPost) 
{
	// Do we have a valid ped pointer?
	if(pPed) {
		// Get the remote players context data
		CContextData * pContextData = CContextDataManager::GetContextData((IVPlayerPed *)pPed);

		// Do we have a valid context data?
		if(pContextData) {
			// Is this not the local player?
			if(pContextData->GetPlayerInfo()->GetPlayerNumber() != 0) {
				if(!bPost && !g_bInLocalContext) {
					CLogFile::Printf("Not switching due to not being in local context!");
					return;
				}

				if(bPost && g_bInLocalContext) {
					CLogFile::Printf("Not switching due to being in local context!");
					return;
				}

				// Get the game pad
				CIVPad * pPad = g_pCore->GetGame()->GetPad();

				if(!bPost) {
					// Store the local players index
					g_uiLocalPlayerIndex = g_pCore->GetGame()->GetPools()->GetLocalPlayerIndex();

					// Store the local players pad
					memcpy(&g_localPad, pPad->GetPad(), sizeof(IVPad));

					g_pLocalPlayerInfo = g_pCore->GetGame()->GetPools()->GetPlayerInfoFromIndex(g_uiLocalPlayerIndex);

					g_pCore->GetGame()->GetPools()->SetPlayerInfoAtIndex(g_uiLocalPlayerIndex, pContextData->GetPlayerInfo()->GetPlayerInfo());

					// Set the history values
					for(int i = 0; i < INPUT_COUNT; i++) {
						IVPadData * pPadData = &pContextData->GetPad()->GetPad()->m_padData[i];

						if(pPadData->m_pHistory) {
							pPadData->m_byteHistoryIndex++;

							if(pPadData->m_byteHistoryIndex >= MAX_HISTORY_ITEMS)
								pPadData->m_byteHistoryIndex = 0;

							pPadData->m_pHistory->m_historyItems[pPadData->m_byteHistoryIndex].m_byteValue = pPadData->m_byteLastValue;
							pPadData->m_pHistory->m_historyItems[pPadData->m_byteHistoryIndex].m_dwLastUpdate = CGameFunction::GetTimeOfDay();
						}
					}

					// Swap the local players pad with the remote players pad
					memcpy(pPad->GetPad(), pContextData->GetPad()->GetPad(), sizeof(IVPad));

					// Flag ourselves as no longer in local context
					g_bInLocalContext = false;
				}
				else {
					// Restore the local players pad
					memcpy(pPad->GetPad(), &g_localPad, sizeof(IVPad));

					g_pCore->GetGame()->GetPools()->SetPlayerInfoAtIndex(g_uiLocalPlayerIndex, g_pLocalPlayerInfo);

					// Flag ourselves as back in local context
					g_bInLocalContext = true;
				}
			}
		}
		else
			CLogFile::Printf("ContextSwitch Warning: Invalid Player Ped");
	}
}
开发者ID:B2O,项目名称:IV-Network,代码行数:71,代码来源:CContextSwitch.cpp


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