FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

cl_dll/game_controls/classmenu.cpp

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //=============================================================================// #include "cbase.h" #include #include #include "classmenu.h" #include #include #include #include #include #include #include #include #include #include "cdll_util.h" #include "IGameUIFuncs.h" // for key bindings #ifndef _XBOX extern IGameUIFuncs *gameuifuncs; // for key binding details #endif #include #include // MAX_PATH define // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" using namespace vgui; ConVar hud_classautokill( "hud_classautokill", "1", FCVAR_CLIENTDLL | FCVAR_ARCHIVE, "Automatically kill player after choosing a new playerclass." ); //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- CClassMenu::CClassMenu(IViewPort *pViewPort) : Frame(NULL, PANEL_CLASS) { m_pViewPort = pViewPort; m_iScoreBoardKey = -1; // this is looked up in Activate() m_iTeam = 0; // initialize dialog SetTitle("", true); // load the new scheme early!! SetScheme("ClientScheme"); SetMoveable(false); SetSizeable(false); // hide the system buttons SetTitleBarVisible( false ); SetProportional(true); // info window about this class m_pPanel = new EditablePanel( this, "ClassInfo" ); LoadControlSettings( "Resource/UI/ClassMenu.res" ); } //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- CClassMenu::CClassMenu(IViewPort *pViewPort, const char *panelName) : Frame(NULL, panelName) { m_pViewPort = pViewPort; m_iScoreBoardKey = -1; // this is looked up in Activate() m_iTeam = 0; // initialize dialog SetTitle("", true); // load the new scheme early!! SetScheme("ClientScheme"); SetMoveable(false); SetSizeable(false); // hide the system buttons SetTitleBarVisible( false ); SetProportional(true); // info window about this class m_pPanel = new EditablePanel( this, "ClassInfo" ); // Inheriting classes are responsible for calling LoadControlSettings()! } //----------------------------------------------------------------------------- // Purpose: Destructor //----------------------------------------------------------------------------- CClassMenu::~CClassMenu() { } MouseOverPanelButton* CClassMenu::CreateNewMouseOverPanelButton(EditablePanel *panel) { return new MouseOverPanelButton(this, "MouseOverPanelButton", panel); } Panel *CClassMenu::CreateControlByName(const char *controlName) { if( !Q_stricmp( "MouseOverPanelButton", controlName ) ) { MouseOverPanelButton *newButton = CreateNewMouseOverPanelButton( m_pPanel ); m_mouseoverButtons.AddToTail( newButton ); return newButton; } else { return BaseClass::CreateControlByName( controlName ); } } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CClassMenu::Reset() { for ( int i = 0 ; i < GetChildCount() ; ++i ) { // Hide the subpanel for the MouseOverPanelButtons MouseOverPanelButton *pPanel = dynamic_cast( GetChild( i ) ); if ( pPanel ) { pPanel->HidePage(); } } // Turn the first button back on again (so we have a default description shown) Assert( m_mouseoverButtons.Count() ); for ( int i=0; i { if ( i == 0 ) { m_mouseoverButtons[i]->ShowPage(); // Show the first page } else { m_mouseoverButtons[i]->HidePage(); // Hide the rest } } } //----------------------------------------------------------------------------- // Purpose: Called when the user picks a class //----------------------------------------------------------------------------- void CClassMenu::OnCommand( const char *command) { if ( Q_stricmp( command, "vguicancel" ) ) { engine->ClientCmd( const_cast( command ) ); #ifndef CSTRIKE_DLL // They entered a command to change their class, kill them so they spawn with // the new class right away if ( hud_classautokill.GetBool() ) { engine->ClientCmd( "kill" ); } #endif // !CSTRIKE_DLL } Close(); gViewPortInterface->ShowBackGround( false ); BaseClass::OnCommand(command); } //----------------------------------------------------------------------------- // Purpose: shows the class menu //----------------------------------------------------------------------------- void CClassMenu::ShowPanel(bool bShow) { if ( bShow ) { Activate(); SetMouseInputEnabled( true ); // load a default class page for ( int i=0; i { if ( i == 0 ) { m_mouseoverButtons[i]->ShowPage(); // Show the first page } else { m_mouseoverButtons[i]->HidePage(); // Hide the rest } } if ( m_iScoreBoardKey < 0 ) { m_iScoreBoardKey = gameuifuncs->GetEngineKeyCodeForBind( "showscores" ); } } else { SetVisible( false ); SetMouseInputEnabled( false ); } m_pViewPort->ShowBackGround( bShow ); } void CClassMenu::SetData(KeyValues *data) { m_iTeam = data->GetInt( "team" ); } //----------------------------------------------------------------------------- // Purpose: Sets the text of a control by name //----------------------------------------------------------------------------- void CClassMenu::SetLabelText(const char *textEntryName, const char *text) { Label *entry = dynamic_cast if (entry) { entry->SetText(text); } } //----------------------------------------------------------------------------- // Purpose: Sets the visibility of a button by name //----------------------------------------------------------------------------- void CClassMenu::SetVisibleButton(const char *textEntryName, bool state) { Button *entry = dynamic_cast
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
/// =============== Fortress Forever ============== /// ======== A modification for Half-Life 2 ======= /// /// @file classmenu.cpp /// @author Gavin "Mirvin_Monkey" Bramhill /// @date August 15, 2005 /// @brief New class selection menu /// /// REVISIONS /// --------- /// Aug 15, 2005 Mirv: First creation #include "cbase.h" #include "classmenu.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ff_modelpanel.h" #include "ff_frame.h" #include #include "ienginevgui.h" #include "IGameUIFuncs.h" #include #include "ff_playerclass_parse.h" #include "ff_weapon_parse.h" #include "ff_utils.h" #include "ff_button.h" extern IFileSystem **pFilesystem; // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" using namespace vgui; extern INetworkStringTable *g_pStringTableInfoPanel; extern IGameUIFuncs *gameuifuncs; // Button names const char *szClassButtons[] = { "scoutbutton", "sniperbutton", "soldierbutton", "demomanbutton", "medicbutton", "hwguybutton", "pyrobutton", "spybutton", "engineerbutton", "civilianbutton" }; using namespace vgui; //============================================================================= // A team button has the following components: // A list of icons // Text //============================================================================= class LoadoutLabel : public Label { public: DECLARE_CLASS_SIMPLE(LoadoutLabel, Label); LoadoutLabel(Panel *parent, const char *panelName, const char *text) : BaseClass(parent, panelName, text) { RemoveAllIcons(); } void ApplySchemeSettings(IScheme *pScheme) { BaseClass::ApplySchemeSettings(pScheme); //SetTextInset(10, 7); SetContentAlignment(a_south); } void AddIcon(CHudTexture *pIcon) { if (!pIcon) return; m_Icons.AddToTail(pIcon); m_IconFonts.AddToTail(pIcon->hFont); } void AddIcon(CHudTexture *pIcon, vgui::HFont hFont ) { m_Icons.AddToTail(pIcon); m_IconFonts.AddToTail(hFont); } void RemoveAllIcons() { m_Icons.RemoveAll(); m_IconFonts.RemoveAll(); } virtual void Paint() { int gap = 3; int totalWidth = 0; for(int i=0; i { CHudTexture *pIcon = m_Icons.Element(i); if (!pIcon) continue; vgui::HFont hFont = pIcon->hFont; if (m_IconFonts.IsValidIndex(i)) hFont = m_IconFonts.Element(i); int width; if (hFont != pIcon->hFont) { char character = pIcon->cCharacterInFont; width = surface()->GetCharacterWidth(hFont, character); } else { width = pIcon->Width(); } totalWidth += width; if (i>0) totalWidth += gap; } int xpos = (GetWide()/2.0f) - totalWidth/2; for(int i=0; i { CHudTexture *pIcon = m_Icons.Element(i); if (!pIcon) continue; vgui::HFont hFont = pIcon->hFont; if (m_IconFonts.IsValidIndex(i)) hFont = m_IconFonts.Element(i); int width; if (hFont != pIcon->hFont) { char character = pIcon->cCharacterInFont; wchar_t unicode[2]; swprintf(unicode, L"%c", character); surface()->DrawSetTextColor(Color(255, 255, 255, 255)); surface()->DrawSetTextFont(hFont); surface()->DrawSetTextPos(xpos, 0); surface()->DrawUnicodeChar(unicode[0]); width = surface()->GetCharacterWidth(hFont, character); } else { pIcon->DrawSelf(xpos, 0, Color(255,255,255,255)); width = pIcon->Width(); } xpos += width + gap; } BaseClass::Paint(); } private: CUtlVector m_Icons; CUtlVector m_IconFonts; }; //============================================================================= // A team button has the following components: // Text // Progress bar //============================================================================= class ClassPropertiesLabel : public Label { public: DECLARE_CLASS_SIMPLE(ClassPropertiesLabel, Label); ClassPropertiesLabel(Panel *parent, const char *panelName, const char *text) : BaseClass(parent, panelName, text) { m_flValue = m_flMax = 0; m_pProgressBar = new vgui::ProgressBar( this, "ProgressBar" ); m_pProgressBar->SetPos( 20, 1 ); m_pProgressBar->SetSize( GetWide() - 20, GetTall() ); m_pProgressBar->SetVisible( true ); } void ApplySchemeSettings(IScheme *pScheme) { BaseClass::ApplySchemeSettings(pScheme); //SetTextInset(10, 7); SetContentAlignment(a_west); m_pProgressBar->SetSize( GetWide() - 100, GetTall() ); m_pProgressBar->SetPos( 100, 0 ); } void SetMaxValue( float flMaxValue ) { m_flMax = flMaxValue; } void SetValue( float flValue ) { m_flValue = flValue; } virtual void Paint() { m_pProgressBar->SetProgress( clamp( m_flValue / m_flMax, 0.0f, 1.0f ) ); m_pProgressBar->SetBgColor( Color( 0,0,0, 100 ) ); m_pProgressBar->SetFgColor( getIntensityColor((int)(m_flValue/m_flMax * 100), 255, 2, 100, 25, 50, 70, 90, 0) ); BaseClass::Paint(); } private: float m_flMax; float m_flValue; vgui::ProgressBar *m_pProgressBar; }; ///////////////////////////////////////////// // MouseOverButton ///////////////////////////////////////////// class MouseOverButton : public FFButton { DECLARE_CLASS_SIMPLE(MouseOverButton, FFButton); public: MouseOverButton(Panel *parent, const char *panelName, const char *text, Panel *pActionSignalTarget = NULL, const char *pCmd = NULL) : BaseClass(parent, panelName, text, pActionSignalTarget, pCmd) { } enum MouseEvent_t { MOUSE_ENTERED, MOUSE_EXITED, }; virtual void OnCursorEntered() { BaseClass::OnCursorEntered(); KeyValues *msg = new KeyValues("MouseOverEvent"); msg->SetInt("event", MOUSE_ENTERED); PostActionSignal(msg); } virtual void OnCursorExited() { BaseClass::OnCursorExited(); KeyValues *msg = new KeyValues("MouseOverEvent"); msg->SetInt("event", MOUSE_EXITED); PostActionSignal(msg); } }; // Mulch: TODO: make this work for pheeeeeeeesh-y CON_COMMAND( hud_reloadclassmenu, "hud_reloadclassmenu" ) { IViewPortPanel *pPanel = gViewPortInterface->FindPanelByName( PANEL_CLASS ); if( !pPanel ) return; CClassMenu *pClassMenu = dynamic_cast< CClassMenu * >( pPanel ); if( !pClassMenu ) return; vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ClientScheme.res", "HudScheme" ); pClassMenu->SetScheme( scheme ); pClassMenu->SetProportional( true ); pClassMenu->LoadControlSettings( "Resource/UI/ClassMenu.res" ); } //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- CClassMenu::CClassMenu(IViewPort *pViewPort) : Frame(NULL, PANEL_CLASS) { // initialize dialog m_pViewPort = pViewPort; m_flNextUpdate = 0; // load the new scheme early!! SetScheme("ClientScheme"); SetMoveable(false); SetSizeable(false); SetProportional(true); // hide the system buttons SetTitleBarVisible(false); // info window about this class m_pClassInfo = new RichText(this, "ClassInfo"); m_pClassInfo->SetVerticalScrollbar(false); m_pClassInfo->SetBgColor(Color(0,0,0,50)); m_pClassInfo->SetPaintBorderEnabled(true); m_pClassInfo->SetPaintBackgroundEnabled(true); m_pClassInfo->SetPaintBackgroundType(2); m_pCancelButton = new FFButton(this, "CancelButton", "#FF_CANCEL"); m_pRandomButton = new MouseOverButton(this, "RandomButton", "#FF_RANDOM", this, "RandomButton"); m_pPrimaryGren = new LoadoutLabel(this, "PrimaryGren", "Primary"); m_pSecondaryGren = new LoadoutLabel(this, "SecondaryGren", "Secondary"); m_pGrenadesSection = new Section( this, "GrenadesSection" ); m_pWeaponsSection = new Section( this, "WeaponsSection" ); m_pClassInfoSection = new Section( this, "ClassInfoSection" ); m_pClassRoleSection = new Section( this, "ClassRoleSection" ); m_pClassRole = new Label( this, "ClassRole", "" ); for(int i=0; i<8; i++) { m_WepSlots[i] = new LoadoutLabel(this, VarArgs("WepSlot%d", i+1), VarArgs("Weapon %d", i+1)); } char *pszButtons[] = { "ScoutButton", "SniperButton", "SoldierButton", "DemomanButton", "MedicButton", "HwguyButton", "PyroButton", "SpyButton", "EngineerButton", "CivilianButton" }; for (int iClassIndex = 0; iClassIndex < ARRAYSIZE(pszButtons); iClassIndex++) { m_pClassButtons[iClassIndex] = new MouseOverButton(this, pszButtons[iClassIndex], (const char *) NULL, this, pszButtons[iClassIndex]); } m_pSpeed = new ClassPropertiesLabel(this, "SpeedLabel", "Speed"); m_pSpeed->SetMaxValue( 400 - 180 ); m_pFirepower = new ClassPropertiesLabel(this, "FirepowerLabel", "Firepower"); m_pFirepower->SetMaxValue( 100 ); m_pHealth = new ClassPropertiesLabel(this, "HealthLabel", "Health"); m_pHealth->SetMaxValue( 400 ); m_pModelView = new PlayerModelPanel(this, "ClassPreview"); // HACKHACKHACKHACK // The pushing and popping in m_pModelView is breaking the rendering of subsequent // vgui items. Therefore we are sticking this right to the front so that it is // rendered last. m_pModelView->SetZPos(50); LoadControlSettings("Resource/UI/ClassMenu.res"); Reset(); } //----------------------------------------------------------------------------- // Purpose: Destructor //----------------------------------------------------------------------------- CClassMenu::~CClassMenu() { } //----------------------------------------------------------------------------- // Purpose: Do whatever command is needed //----------------------------------------------------------------------------- void CClassMenu::OnCommand(const char *command) { if (Q_strcmp(command, "cancel") != 0) { engine->ClientCmd(VarArgs("class %s", command)); } m_pViewPort->ShowPanel(this, false); BaseClass::OnCommand(command); } //----------------------------------------------------------------------------- // Purpose: Nothing //----------------------------------------------------------------------------- void CClassMenu::SetData(KeyValues *data) { } //----------------------------------------------------------------------------- // Purpose: Show or don't show //----------------------------------------------------------------------------- void CClassMenu::ShowPanel(bool bShow) { if (BaseClass::IsVisible() == bShow) return; m_pViewPort->ShowBackGround(bShow); if (bShow) { Activate(); SetMouseInputEnabled(true); // Update straight away Update(); MoveToFront(); } else { SetVisible(false); SetMouseInputEnabled(false); Reset(); } } //----------------------------------------------------------------------------- // Purpose: Don't need anything yet //----------------------------------------------------------------------------- void CClassMenu::Reset() { SetClassInfoVisible(false); } void CClassMenu::SetClassInfoVisible( bool state ) { if (state == false) m_pModelView->Reset(); m_pPrimaryGren->SetVisible(state); m_pSecondaryGren->SetVisible(state); for (int i=0; i<8; i++) m_WepSlots[i]->SetVisible(state); m_pSpeed->SetVisible(state); m_pFirepower->SetVisible(state); m_pHealth->SetVisible(state); m_pClassInfo->SetVisible(state); m_pClassRole->SetVisible(state); m_pGrenadesSection->SetVisible(state); m_pWeaponsSection->SetVisible(state); m_pClassInfoSection->SetVisible(state); m_pClassRoleSection->SetVisible(state); } //----------------------------------------------------------------------------- // Purpose: Update the menu with everything //----------------------------------------------------------------------------- void CClassMenu::Update() { IGameResources *pGR = GameResources(); if (!pGR) return; C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer(); if (pLocalPlayer == NULL) return; char nSpacesRemaining[10]; UTIL_GetClassSpaces(pLocalPlayer->GetTeamNumber(), nSpacesRemaining); int nOptions = 0; for (int iClassIndex = 0; iClassIndex < 10; iClassIndex++) { Button *pClassButton = m_pClassButtons[iClassIndex]; switch (nSpacesRemaining[iClassIndex]) { case -1: // pClassButton->SetVisible(false); // break; case 0: pClassButton->SetVisible(true); pClassButton->SetEnabled(false); break; default: pClassButton->SetVisible(true); pClassButton->SetEnabled(true); nOptions++; } } // Random button only enabled when there's more than one class m_pRandomButton->SetVisible((nOptions > 1)); // Cancel only visible if they already have a class m_pCancelButton->SetVisible((pGR->GetClass(pLocalPlayer->entindex()) != 0)); m_flNextUpdate = gpGlobals->curtime + 0.2f; } //----------------------------------------------------------------------------- // Purpose: Give them some key control too //----------------------------------------------------------------------------- void CClassMenu::OnKeyCodePressed(KeyCode code) { // Show the scoreboard over this if needed if (engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("showscores")) gViewPortInterface->ShowPanel(PANEL_SCOREBOARD, true); if (engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("serverinfo")) engine->ClientCmd( "serverinfo" ); // Support hiding the class menu by hitting your changeclass button again like TFC // 0001232: Or if the user presses escape, kill the menu if ((engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("changeclass")) || (engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("cancelselect"))) gViewPortInterface->ShowPanel(this, false); // Support bring the team menu back up if the class menu is showing if (engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("changeteam")) { m_pViewPort->ShowPanel(this, false); engine->ClientCmd("changeteam"); } BaseClass::OnKeyCodePressed(code); } void CClassMenu::OnKeyCodeReleased(KeyCode code) { // Bug #0000524: Scoreboard gets stuck with the class menu up when you first join // Hide the scoreboard now if (engine->GetLastPressedEngineKey() == gameuifuncs->GetEngineKeyCodeForBind("showscores")) { gViewPortInterface->ShowPanel(PANEL_SCOREBOARD, false); } BaseClass::OnKeyCodeReleased(code); } //----------------------------------------------------------------------------- // Purpose: Update the main display //----------------------------------------------------------------------------- void CClassMenu::OnMouseOverMessage(KeyValues *data) { Button *pButton = (Button *) data->GetPtr("panel", NULL); // Could not determine where this came from if (pButton == NULL) return; // Get the command from this button and parse accordingly if (data->GetInt("event") == MouseOverButton::MOUSE_ENTERED) { UpdateClassInfo(pButton->GetCommand()->GetString("command")); } } //----------------------------------------------------------------------------- // Purpose: Load the correct class into the model view //----------------------------------------------------------------------------- void CClassMenu::UpdateClassInfo(const char *pszClassName) { if (Q_stricmp(pszClassName, "randompc") == 0) { SetClassInfoVisible(false); return; } m_pModelView->SetClass(pszClassName); SetClassInfoVisible(true); // First get the class CBasePlayer *pLocalPlayer = CBasePlayer::GetLocalPlayer(); if (pLocalPlayer == NULL) return; PLAYERCLASS_FILE_INFO_HANDLE hClassInfo; bool bReadInfo = ReadPlayerClassDataFromFileForSlot(*pFilesystem, pszClassName, &hClassInfo, g_pGameRules->GetEncryptionKey()); if (!bReadInfo) return; const CFFPlayerClassInfo *pClassInfo = GetFilePlayerClassInfoFromHandle(hClassInfo); if (!pClassInfo) return; m_pSpeed->SetValue( pClassInfo->m_iSpeed - 180 ); m_pHealth->SetValue( pClassInfo->m_iHealth + pClassInfo->m_iMaxArmour ); m_pFirepower->SetValue( pClassInfo->m_iFirepower ); m_pClassInfo->SetText( pClassInfo->m_szDescription ); m_pClassRole->SetText( pClassInfo->m_szRole ); for (int i=0; i<8; i++) m_WepSlots[i]->SetVisible(false); for (int i=0; im_iNumWeapons && i<8; i++) { // Use the last weapon as their primary const char *pszWeapon = pClassInfo->m_aWeapons[i]; // Now load the weapon info WEAPON_FILE_INFO_HANDLE hWeaponInfo; bReadInfo = ReadWeaponDataFromFileForSlot(*pFilesystem, pszWeapon, &hWeaponInfo, g_pGameRules->GetEncryptionKey()); if (!bReadInfo) continue; const CFFWeaponInfo *pWeaponInfo = (CFFWeaponInfo *) GetFileWeaponInfoFromHandle(hWeaponInfo); if (!pWeaponInfo) continue; m_WepSlots[i]->SetText(pWeaponInfo->szPrintName); m_WepSlots[i]->RemoveAllIcons(); m_WepSlots[i]->AddIcon( pWeaponInfo->iconInactive, vgui::scheme()->GetIScheme(GetScheme())->GetFont( "WeaponIconsClassSelect" ) ); m_WepSlots[i]->SetVisible(true); } const char *pszPrimaryName = FF_GetPrimaryName( Class_StringToInt( pszClassName ) ); m_pPrimaryGren->SetVisible(false); GRENADE_FILE_INFO_HANDLE hGrenInfo = LookupGrenadeInfoSlot(pszPrimaryName); if (hGrenInfo) { CFFGrenadeInfo *pGrenInfo = GetFileGrenadeInfoFromHandle(hGrenInfo); if (pGrenInfo) { m_pPrimaryGren->RemoveAllIcons(); m_pPrimaryGren->AddIcon( pGrenInfo->iconAmmo ); m_pPrimaryGren->SetText( pGrenInfo->szPrintName ); m_pPrimaryGren->SetVisible(true); } } const char *pszSecondaryName = FF_GetSecondaryName( Class_StringToInt( pszClassName ) ); m_pSecondaryGren->SetVisible(false); hGrenInfo = LookupGrenadeInfoSlot(pszSecondaryName); if (hGrenInfo) { CFFGrenadeInfo *pGrenInfo = GetFileGrenadeInfoFromHandle(hGrenInfo); if (pGrenInfo) { m_pSecondaryGren->RemoveAllIcons(); m_pSecondaryGren->AddIcon( pGrenInfo->iconAmmo ); m_pSecondaryGren->SetText( pGrenInfo->szPrintName ); m_pSecondaryGren->SetVisible(true); } } }