Half-Life Sprite Tutorial by Spider
Download Mach 3's Sprite Viewer: sprview.zip 33k

Thanks to David Flor at Mach 3 for adding functions to his sprite viewer for editing. Download this file to edit the sprites that are in Half-Life.
Editing sprites is relatively easy. Just get the sprites out of the pak0.pak file. Open them up in the sprite viewer and save them as bitmaps. Edit them in a paint program. Then compile them and save them to half-life\valve\sprites.

Some important things to remember: Sprite sizes need to be multiples of 8. Multiple frames need to share the same 256 color palette. There are 4 types of $texture settings for sprites: additive, alphatest, indexalpha, and normal. Check below in Advanced Topics for more information on these.

Alphatest Tutorial
I'll be using crosshairs.spr for this example. Alphatest sprites can use 255 colors, but the last one in the palette is used for transparency.
 
crosshairs.spr
crosshairs.spr

  
Crosshairs divided up.
Crosshairs have to fit in these squares. Top row is normal, bottom row is autoaim.

 
crosshairs palette
Crosshairs palette. Note the last color is the transparency color.

1 > After you've extracted crosshairs.spr out of the pak file, open it up with the sprite viewer. Double-click the .spr file and when Windows asks what you want to open it with, browse to the SprView.exe and choose that.

2 > Save it by choosing 'File' then 'Save BMP...' and name it crosshairs.bmp.

3 > Open it in a paint program like Photoshop or Paint Shop Pro. You can edit them but each crosshair can't be larger than 24x24 pixels and the crossbow zoom can't be larger than 104x16 pixels. If you want to add a few new colors you'll have to add them to the palette. In Photoshop choose 'Image', 'Mode' and 'Color Table'. Click on the squares and select a color. In Paint Shop Pro choose 'Colors' and 'Edit Palette'. Double-click on a square and choose a color. This is helpful for changing a few colors, but if you were going to use alot more colors, then just change to RGB or 16 Million Colors and edit the picture. When you're done, change it back to 256 colors and make sure you have the transparent color in the last square of the palette. Save it when you're done editing.
 
new crosshairs palette

 

4 > Set up the sprite.qc and compile it by running sprite.bat. The included .zip has the .qc file ready to go for you:
 
// crosshairs
//
$spritename crosshairs
$type vp_parallel
$texture alphatest
$load crosshairs.bmp
$frame 0 0 128 128

$spritename is the filename. It will be compiled into crosshairs.spr
$type is always vp_parallel
$texture will be alphatest for this example
$load is the bitmap file name
$frame is for offsets (x,y) and size (x,y).

5 > Create a folder half-life\valve\sprites and copy crosshairs.spr to it and you're done.
 
 

Additive Tutorial
I'll be using 640_pain.spr for this example. Additive sprites can have 256 colors and are blended with additive transparency.
 
 
640_pain001.bmp
640_pain002.bmp
640_pain003.bmp
640_pain004.bmp
640_pain.spr frames

  
640_pain_palette
640_pain.spr palette

1 > After you've extracted 640_pain.spr out of the pak file, open it up with the sprite viewer.

2 > Save it by choosing 'File' then 'Save sequence...' and name it 640_pain.bmp. It will save all 4 frames as 640_pain00x.bmp

3 > Open them in a paint program. Paint something new, change the colors and resize them. If you're changing color, then just change to RGB or 16 Million Colors and edit the picture. When you're done, change it back to 256 colors. All frames must use the same palette, and paint programs usually have a way to save and load the palette. When you're done editing, save them.
Keep in mind that these are programmed to turn red when health points get below 10. Also, to totally get rid of them, paint them black and make the palette black.

4 > Set up the sprite.qc and compile it by running sprite.bat. This is how the .qc file is already set up, but you can change it:
 
// 640_pain
//
$spritename 640_pain
$type vp_parallel
$texture additive
$load 640_pain001.bmp
$frame 0 0 128 48
$load 640_pain002.bmp
$frame 0 0 48 128
$load 640_pain003.bmp
$frame 0 0 128 48
$load 640_pain004.bmp
$frame 0 0 48 128

5 > Copy 640_pain.spr to the half-life\valve\sprites folder and you're done.
 
 
 
Page 2