Wednesday, January 2, 2008

Changing the color of the zoomed crosshair in Half Life 2 Deathmatch

Occasionally, the gamer in me likes to indulge in first-person shoot-em-up goodness. Recently, I've been playing Half Life 2 on KiTTeNChaoSS's [KAT] House 4. I got frustrated with the color of the crosshair when zoomed in, so I came up with an inventive hack that seems to help. The following procedure modifies the zoomed in crosshair appearance so that a small circle is drawn almost on center (apparently the Valve guys didn't center the crosshair artwork perfectly).

In order to modify the crosshair, you'll need to download and install the GCFScape utility, which allows you to extract resources from your half-life installation.

If you want to copy these instructions to your website or publication, you must include the following credit:

Zoomed Crosshair Color Hack

Before:
Reticle is useless and crosshair doesn't show up on white background

After:
Subtle, but helpful on all-white background




Step 1: Extract resources

Use GCFScape to open the following file:

C:\Program Files\Valve\Steam\SteamApps\half-life 2 deathmatch.gcf

Once this file is open, we're going to need to extract two resource files. In the left column, open the resource hierarchy and find

root/hl2mp/scripts/HudLayout.res

Extract this resource node by right-clicking and selecting Extract, and save it under the following directory:

C:\Program Files\Valve\Steam\SteamApps\*STEAM_USERNAME*\half-life 2 deathmatch\hl2mp\scripts

(if the directory doesn't exist, create it.)

Next, navigate the resource hierarchy in the left pane again, and this time, navigate to

root/hl2mp/resource/ClientScheme.res

Extract this resource node and save it inside the following directory:

C:\Program Files\Valve\Steam\SteamApps\*STEAM_USERNAME*\half-life 2 deathmatch\hl2mp\resource

(if the directory doesn't exist, create it.)

Step 2: Modify values

Open C:\Program Files\Valve\Steam\SteamApps\*STEAM_USERNAME*\half-life 2 deathmatch\hl2mp\resource\ClientScheme.resin your favorite text editor. You'll need to edit the "ZoomReticleColor" property, which is roughly on line 58:


// weapon selection colors
"SelectionNumberFg" "255 220 0 255"
"SelectionTextFg" "255 220 0 255"
"SelectionEmptyBoxBg" "0 0 0 80"
"SelectionBoxBg" "0 0 0 80"
"SelectionSelectedBoxBg" "0 0 0 80"

"ZoomReticleColor" "0 255 0 255
The format of the second argument consists of four values: red, green, blue, and alpha. Each can range from zero to 255, so in my example above, I changed my color to solid green.

Save your changes, and open the other extracted resource file, C:\Program Files\Valve\Steam\SteamApps\*STEAM_USERNAME*\half-life 2 deathmatch\hl2mp\scripts\HudLayout.res

We're going to modify the HUD so that the circles that are normally drawn in the zoomed reticle are drawn a lot smaller. The properties we're interested in are called "HudZoom" and are near line 194:

HudZoom
{
"fieldName" "HudZoom"
"visible" "1"
"enabled" "1"

"Circle1Radius" "0"
"Circle2Radius" "1"
"DashGap" "16"
"DashHeight" "4"
"BorderThickness" "88"
}

Save your changes, and proceed to lock your files so that HL2 won't over-write them. This step may require that you use NTFS on your drive -- FAT32 may not support file locking attributes.

Step 3: Lock files

Using the Windows explorer, navigate to the HudLayout.res file first. Right-click on the file in the shell, and select "Properties." Under the Attributes section, check Read-Only. Click the Apply button.

Repeat this procedure for the ClientScheme.res file as well.