Exemple #1
0
int CASW_Briefing::GetMarineSkillPoints( int nLobbySlot, int nSkillSlot )
{
	if ( nLobbySlot < 0 || nLobbySlot >= NUM_BRIEFING_LOBBY_SLOTS || !ASWGameResource() )
		return -1;

	int nMarineResourceIndex = LobbySlotToMarineResourceIndex( nLobbySlot );
	C_ASW_Marine_Resource *pMR = ASWGameResource() ? ASWGameResource()->GetMarineResource( nMarineResourceIndex ) : NULL;
	if ( !pMR )
		return -1;

	return GetProfileSkillPoints( pMR->GetProfileIndex(), nSkillSlot );
	
}
Exemple #2
0
int CASW_Briefing::GetProfileSelectedWeapon( int nProfileIndex, int nWeaponSlot )
{
	for ( int i = 0; i < ASWGameResource()->GetMaxMarineResources(); i++ )
	{
		C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( i );
		if ( !pMR )
			continue;

		if ( pMR->GetProfileIndex() == nProfileIndex )
		{
			return pMR->m_iWeaponsInSlots[ nWeaponSlot ];
		}
	}
	return -1;
}
Exemple #3
0
bool CASW_Briefing::IsProfileSelected( int nProfileIndex )
{
	C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if ( !pPlayer )
		return false;

	for ( int i = 0; i < ASWGameResource()->GetMaxMarineResources(); i++ )
	{
		C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( i );
		if ( !pMR )
			continue;

		if ( pMR->GetProfileIndex() == nProfileIndex )
		{
			return true;
		}
	}

	return false;
}
Exemple #4
0
void CASW_Briefing::SelectWeapon( int nProfileIndex, int nInventorySlot, int nEquipIndex )
{
	C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if ( !pPlayer )
		return;

	for ( int i = 0; i < ASWGameResource()->GetMaxMarineResources(); i++ )
	{
		C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( i );
		if ( !pMR )
			continue;

		if ( pMR->GetProfileIndex() == nProfileIndex )
		{
			int nMarineResourceIndex = ASWGameResource()->GetIndexFor( pMR );
			pPlayer->LoadoutSelectEquip( nMarineResourceIndex, nInventorySlot, nEquipIndex );
			return;
		}
	}
}
Exemple #5
0
const char* CASW_Briefing::GetPlayerNameForMarineProfile( int nProfileIndex )
{
	for ( int i = 0; i < ASWGameResource()->GetMaxMarineResources(); i++ )
	{
		C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( i );
		if ( !pMR )
			continue;

		if ( pMR->GetProfileIndex() == nProfileIndex )
		{
			C_ASW_Player *pPlayer = pMR->GetCommander();
			if ( pPlayer )
			{
				return pPlayer->GetPlayerName();
			}
			break;
		}
	}
	return "";
}
Exemple #6
0
bool CASW_Briefing::CheckMissionRequirements()
{
	if ( ASWGameRules() && ASWGameRules()->GetGameState() < ASW_GS_DEBRIEF && ASWGameResource() )
	{	
		if ( ASWGameRules()->m_bMissionRequiresTech )
		{
			bool bTech = false;
			for (int i=0;i<ASWGameResource()->GetMaxMarineResources();i++)
			{
				C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource(i);
				if (pMR && pMR->GetProfile() && pMR->GetProfile()->CanHack())
					bTech = true;
			}
			if (!bTech)
			{
				// have the server print a message about needing a tech, so all can see
				engine->ClientCmd("cl_needtech");
				return false;
			}
		}
		C_ASW_Equip_Req* pReq = C_ASW_Equip_Req::FindEquipReq();
		if (pReq)
		{
			if (pReq && !pReq->AreRequirementsMet())
			{
				// have the server print a message about needing equip, so all can see
				engine->ClientCmd("cl_needequip");
				return false;
			}
		}
		if ( !ASWGameResource()->AtLeastOneMarine() )
		{
			return false;
		}

		if ( ASWGameResource() && !asw_ignore_need_two_player_requirement.GetBool() )
		{
			CASW_Campaign_Info *pCampaign = ASWGameRules()->GetCampaignInfo();

			char mapname[64];
			V_FileBase( engine->GetLevelName(), mapname, sizeof( mapname ) );

			if ( pCampaign && pCampaign->GetMissionByMapName( mapname ) )
			{
				bool bNeedsMoreThanOneMarine = pCampaign->GetMissionByMapName( mapname )->m_bNeedsMoreThanOneMarine;
				if ( bNeedsMoreThanOneMarine )
				{
					// how many marines do we have?
					int numMarines = 0;
					for (int i=0;i<ASWGameResource()->GetMaxMarineResources();i++)
					{
						C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource(i);
						if ( pMR && pMR->GetProfileIndex() >= 0 )
							numMarines++;
					}

					if ( numMarines < 2 )
					{
						engine->ClientCmd("cl_needtwoplayers");
						return false;
					}
				}
			}
		}
	}
	return true;
}