예제 #1
0
void CEditorGame::InitActionMapsEnums(IGameToEditorInterface* pGTE)
{
	IActionMapManager* pAM = m_pGame->GetIGameFramework()->GetIActionMapManager();
	IActionMapIteratorPtr iter = pAM->CreateActionMapIterator();

	const int numActionMaps = pAM->GetActionMapsCount();

	if(numActionMaps == 0)
		return;

	const char** nameValueStrings = new const char*[numActionMaps];
	int curEntryIndex = 0;
	while (IActionMap* pMap = iter->Next())
	{
		assert(curEntryIndex < numActionMaps);
		PREFAST_ASSUME(curEntryIndex < numActionMaps);
		nameValueStrings[curEntryIndex++] = pMap->GetName();

		if (curEntryIndex > numActionMaps)
		{
			CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "[InitActionMapsEnums] Wrong number of Action Maps.");
			break;
		}
	}

	pGTE->SetUIEnums("action_maps", nameValueStrings, numActionMaps);

	delete[] nameValueStrings;
}
예제 #2
0
파일: MPTutorial.cpp 프로젝트: RenEvo/dead6
const char* CMPTutorial::GetKeyName(const char* action)
{
	IActionMapManager* pAM = gEnv->pGame->GetIGameFramework()->GetIActionMapManager();
	IActionMapIteratorPtr iter = pAM->CreateActionMapIterator();
	while (IActionMap* pMap = iter->Next())
	{
		const char* actionMapName = pMap->GetName();
		IActionMapBindInfoIteratorPtr pIter = pMap->CreateBindInfoIterator();
		while (const SActionMapBindInfo* pInfo = pIter->Next())
		{
			if(!strcmp(pInfo->action, action))
				return pInfo->keys[0];
		}
	}

	return "";
}