Someone asked about this in my HUD's thread, so I figured I'd make a post about it. I believe Wiethoofd and I were the first to discover this so we probably should have made a little instructional post when we did it. Hope no one is upset.
This post is going to be a short tutorial geared to other HUD makers who should already know how to create and import custom textures into the Source engine. I will largely be copying from the post I made in response to the dude in my thread.
Many of you know that custom textures can bypass sv_pure by being placed in the vgui/replay/thumbnails folder. This isn't limited to just custom CP icons; it applies to any other texture you want to use in the HUD.
After I created the icons and named them appropriately, I converted them to VTFs and put them in the folder above. Following that, I extracted the corresponding VMTs and placed them in their proper directory (sprites/obj_icons for CP icons), and changed the $basetexture parameter to reflect the icons' new location in vgui/replay/thumbnails.
http://puu.sh/r3wQZ/a2777c6359.png
VMT example for icon_obj_blu:
"UnlitGeneric"
{
"$translucent" 1
"$baseTexture" "vgui/replay/thumbnails/icon_obj_blu"
"$vertexcolor" 1
"$no_fullbright" 1
"$ignorez" 1
}
This is where most custom textures can stop and be expected to work. But the CP icons are special for some reason. Maybe because they're dynamic and can be called in and out during a typical CP round? Who knows, but Wiet and I figured the icons needed to be preloaded since they only showed up if you joined a listen server prior to joining one with sv_pure.
I did the preloading by referencing them on the main menu. You will need to append some code somewhere in mainmenuoverride.res to set this up. Here's what mine looked like for icon_obj_blu:
"cpicondummy1"
{
"ControlName" "EditablePanel"
"fieldname" "cpicondummy1"
"xpos" "9999"
"ypos" "9999"
"zpos" "11"
"wide" "0"
"tall" "0"
"visible" "0"
"SubButton"
{
"ControlName" "CExImageButton"
"fieldName" "SubButton"
"xpos" "0"
"ypos" "0"
"wide" "0"
"tall" "0"
"autoResize" "0"
"pinCorner" "3"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"textinsetx" "0"
"use_proportional_insets" "1"
"font" "VersionFont"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"default" "1"
"SubImage"
{
"ControlName" "ImagePanel"
"fieldName" "SubImage"
"xpos" "9999"
"ypos" "9999"
"zpos" "1"
"wide" "12"
"tall" "12"
"visible" "1"
"enabled" "1"
"image" "../sprites/obj_icons/icon_obj_blu"
"scaleImage" "1"
}
}
}
All I did was create an element with a sub-image that I could use to reference (thereby preloading) the icons. Then I made damn sure to keep it hidden by setting the x/ypos way off-screen, hiding everything etc. You will of course need to repeat the code for each icon you are replacing. You should only need to replace the image path and control name each time you copy the code.
Hope this clears some things up!