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 ); }
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; }
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; }
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; } } }
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 ""; }
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; }