@@ -25,8 +25,32 @@ LoadoutIcons::LoadoutIcons()
2525
2626bool LoadoutIcons::CheckDependencies ()
2727{
28- // Development
29- return true ;
28+ bool ready = true ;
29+
30+ if (!g_pVGuiPanel)
31+ {
32+ PluginWarning (" Required interface vgui::IPanel for module %s not available!\n " , GetModuleName ());
33+ ready = false ;
34+ }
35+
36+ if (!Interfaces::GetClientMode ())
37+ {
38+ PluginWarning (" Required interface IClientMode for module %s not available!\n " , GetModuleName ());
39+ ready = false ;
40+ }
41+
42+ try
43+ {
44+ HookManager::GetRawFunc_EditablePanel_GetDialogVariables ();
45+ HookManager::GetRawFunc_ImagePanel_SetImage ();
46+ }
47+ catch (bad_pointer ex)
48+ {
49+ PluginWarning (" No signature match found for %s, required for module %s!\n " , ex.what (), GetModuleName ());
50+ ready = false ;
51+ }
52+
53+ return ready;
3054}
3155
3256void LoadoutIcons::OnTick (bool ingame)
@@ -36,10 +60,6 @@ void LoadoutIcons::OnTick(bool ingame)
3660 GatherWeapons ();
3761 DrawIcons ();
3862 }
39- else
40- {
41- // DeleteIconPanels();
42- }
4363}
4464
4565int LoadoutIcons::GetWeaponDefinitionIndex (IClientNetworkable* networkable)
@@ -172,29 +192,6 @@ void LoadoutIcons::PlayerPanelUpdateIcons(vgui::EditablePanel* playerPanel)
172192 *m_DrawColor = ConVarGetColor (team == TEAM_RED ? *ce_loadout_filter_inactive_red : *ce_loadout_filter_inactive_blu);
173193 }
174194
175- #if 0
176- // Just set our settings through the vgui::Panel::GetSettings/SetSettings virtual function.
177- // Less flexible and slower than just calling the correct functions, but I believe there's
178- // been a change between how VS2015 (valve code) and VS2017 handles virtual inheritance.
179- // Trying to call functions on any subclass of vgui::Panel results in a crash.
180- KeyValuesAD temp(new KeyValues("tempKV"));
181- iconPanel->GetSettings(temp);
182-
183- temp->SetString("image", materialBuffer);
184-
185- if (iconIndex == IDX_ACTIVE || m_ActiveWeaponIndices[playerIndex] == iconIndex)
186- {
187- temp->SetString("drawcolor_override", team == TEAM_RED ? ce_loadout_filter_active_red->GetString() : ce_loadout_filter_active_blu->GetString());
188- }
189- else
190- {
191- temp->SetString("drawcolor_override", team == TEAM_RED ? ce_loadout_filter_inactive_red->GetString() : ce_loadout_filter_inactive_blu->GetString());
192- }
193-
194- auto test = KeyValuesDumpAsString(temp);
195-
196- iconPanel->ApplySettings(temp);
197- #endif
198195 iconPanel->SetVisible (true );
199196 }
200197
0 commit comments