void asw_marine_skill_f(const CCommand &args) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!ASWGameRules()) return; if (!pPlayer) return; CASW_Game_Resource* pGameResource = ASWGameResource(); if (!pGameResource) return; CASW_Marine_Profile *pProfile = NULL; CASW_Marine *pMarine = pPlayer->GetMarine(); if (pMarine) { pProfile = pMarine->GetMarineProfile(); } else { // find the first marine info that belongs to us for (int i=0;i<pGameResource->GetMaxMarineResources();i++) { CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i); if (pMR && pMR->GetCommander() == pPlayer) { pProfile = pMR->GetProfile(); break; } } } if ( !pProfile ) return; if ( args.ArgC() < 2 ) { Msg("Usage: asw_marine_skill [SkillSlot] - reports the number of skill points of the current marine in that skill\n asw_marine_skill [SkillSlot] [x] - sets that skill to the specified number of skill points (0-5)\n"); Msg("SkillSlot goes from 0 to 4 for your skills, slot 5 is spare skill points.\n"); return; } int nSkillSlot = atoi(args[1]); if ( nSkillSlot < 0 || nSkillSlot >= ASW_NUM_SKILL_SLOTS ) { Msg("nSkillSlot out of bounds\n"); return; } if ( args.ArgC() < 3 ) { int iSkillPoints = ASWGameResource()->GetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot ); Msg( "Marine skill[%d] is %s = %d\n", nSkillSlot, SkillToString( pProfile->GetSkillMapping( nSkillSlot ) ), iSkillPoints ); } else { int iNewPoints = atoi(args[2]); ASWGameResource()->SetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot, iNewPoints ); int iSkillPoints = ASWGameResource()->GetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot ); Msg( "Marine skill[%d] is now %s = %d\n", nSkillSlot, SkillToString( pProfile->GetSkillMapping( nSkillSlot ) ), iSkillPoints ); } }
void CNB_Skill_Panel::OnThink() { BaseClass::OnThink(); if ( !MarineSkills() || !Briefing() ) return; CASW_Marine_Profile *pProfile = Briefing()->GetMarineProfileByProfileIndex( m_nProfileIndex ); if ( !pProfile ) return; int nMaxSkillPoints = MarineSkills()->GetMaxSkillPoints( pProfile->GetSkillMapping( m_nSkillSlot ) ); const char *szImageName = MarineSkills()->GetSkillImage( pProfile->GetSkillMapping( m_nSkillSlot ) ); if ( V_strcmp( m_szLastSkillImage, szImageName ) ) { V_snprintf( m_szLastSkillImage, sizeof( m_szLastSkillImage ), "%s", szImageName ); char buffer[ 256 ]; V_snprintf( buffer, sizeof( buffer ), "vgui/%s", szImageName ); color32 white; white.r = 255; white.g = 255; white.b = 255; white.a = 255; color32 dull; dull.r = 192; dull.g = 192; dull.b = 192; dull.a = 255; m_pSkillButton->SetImage( CBitmapButton::BUTTON_ENABLED, buffer, white ); m_pSkillButton->SetImage( CBitmapButton::BUTTON_DISABLED, buffer, dull ); m_pSkillButton->SetImage( CBitmapButton::BUTTON_PRESSED, buffer, white ); V_snprintf( buffer, sizeof( buffer ), "vgui/%s_over", szImageName ); m_pSkillButton->SetImage( CBitmapButton::BUTTON_ENABLED_MOUSE_OVER, buffer, white ); } m_pSkillButton->SetEnabled( m_bSpendPointsMode && CanSpendPoint() ); m_pSkillLabel->SetText( MarineSkills()->GetSkillName( pProfile->GetSkillMapping( m_nSkillSlot ) ) ); wchar_t wszPointsBuffer[ 24 ]; _snwprintf( wszPointsBuffer, sizeof( wszPointsBuffer ), L"%d / %d", m_nSkillPoints, nMaxSkillPoints ); m_pSkillNumberLabel->SetText( wszPointsBuffer ); m_pSkillBar->ClearMinMax(); m_pSkillBar->AddMinMax( 0, nMaxSkillPoints ); m_pSkillBar->Init( m_nSkillPoints, m_nSkillPoints, 0.1f, true, false ); if ( IsCursorOver() ) { if (!g_hBriefingTooltip.Get()) { g_hBriefingTooltip = new BriefingTooltip(GetParent(), "MedalsTooltip"); } else if ( g_hBriefingTooltip->GetParent() != GetParent() ) { g_hBriefingTooltip->SetParent( GetParent() ); } if ( g_hBriefingTooltip.Get() && IsFullyVisible() && g_hBriefingTooltip.Get()->GetTooltipPanel() != this ) { int tx, ty, w, h; tx = ty = 0; LocalToScreen(tx, ty); GetSize(w, h); tx += w * 0.5f; ty -= h * 0.01f; g_hBriefingTooltip.Get()->SetTooltip( this, MarineSkills()->GetSkillName( pProfile->GetSkillMapping( m_nSkillSlot ) ), MarineSkills()->GetSkillDescription( pProfile->GetSkillMapping( m_nSkillSlot ) ), tx, ty ); } } }