Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <tier3/tier3.h>
- #define _____assert_ptr( something, name ) if (!something) Msg("[MS] Failed to assert %s\n", name)
- void GetGlobalInterfacePointers( CreateInterfaceFn VGUIFactory, CreateInterfaceFn VGUI2Factory )
- {
- g_pVGuiSurface = (vgui::ISurface*)VGUIFactory(VGUI_SURFACE_INTERFACE_VERSION, NULL);
- _____assert_ptr(g_pVGuiSurface, "g_pVGuiSurface");
- g_pVGuiInput = (vgui::IInput*)VGUI2Factory(VGUI_INPUT_INTERFACE_VERSION, NULL);
- _____assert_ptr(g_pVGuiInput, "g_pVGuiInput");
- g_pVGui = (vgui::IVGui*)VGUI2Factory(VGUI_IVGUI_INTERFACE_VERSION, NULL);
- _____assert_ptr(g_pVGui, "g_pVGui");
- g_pVGuiPanel = (vgui::IPanel*)VGUI2Factory(VGUI_PANEL_INTERFACE_VERSION, NULL);
- _____assert_ptr(g_pVGuiPanel, "g_pVGuiPanel");
- g_pVGuiSchemeManager = (vgui::ISchemeManager*)VGUI2Factory(VGUI_SCHEME_INTERFACE_VERSION, NULL);
- _____assert_ptr(g_pVGuiSchemeManager, "g_pVGuiSchemeManager");
- g_pVGuiSystem = (vgui::ISystem*)VGUI2Factory(VGUI_SYSTEM_INTERFACE_VERSION, NULL);
- _____assert_ptr(g_pVGuiSystem, "g_pVGuiSystem");
- g_pEngineVGui = (IEngineVGui*) g_AppSystemFactory( "VEngineVGui001", NULL );
- _____assert_ptr(g_pEngineVGui, "g_pEngineVGui");
- }
- // \/ This goes in plugin load or CON_COMMAND hook or whatever. Declare a global instance: CVMTHook g_PAINTTRAVERSEHOOK;
- g_PaintTraverseHook.Hook( (DWORD) &Hooked_PaintTraverse, (PDWORD) g_pVGuiPanel, 40 );
- Then:
- void __stdcall Hooked_PaintTraverse(VPANEL vguiPanel, bool forceRepaint, bool allowForce = true)
- {
- g_PaintTraverseHook.UnHook();
- g_pVGuiPanel->PaintTraverse(vguiPanel, forceRepaint, allowForce);
- g_PaintTraverseHook.ReHook();
- //This gets called multiple times / frame
- //You probably want to if(FStrEq(g_pEngineVGui->GetPanel(vguiPanel)->GetName(), "MatSysTopPanel"))
- //if you want to draw like a s3x0r.
- }
Advertisement
Add Comment
Please, Sign In to add comment