Crosshair
The crosshair or crosshairs is a small graphics displayed as part of the HUD in the center of the screen and serving as a targeting aid.
ZDoom provides a selection of seven crosshairs, which can be configured through the HUD options menu. Additional crosshairs can be given through a custom XHAIRS lump. Weapons can feature their own built-in crosshairs with the A_SetCrosshair function.
The user's choice of crosshair is stored in the crosshair variable. A value of 0 means "no crosshair", and a positive value refers to that crosshair number.
Creating your own crosshairs
Crosshairs can be placed in any type of archive and loaded manually from the command line, or added to an autoload folder to load up every time you start ZDoom, so you can easily replace your crosshair with one of your own making. You can also include custom crosshairs with your mods and allow the user to select them from the menu using the XHAIRS lump, or apply them to custom weapons directly using A_SetCrosshair.
To create a custom crosshair, you need to make two images — one for the "big" version of your crosshair, and one for the small version. The small version is only used if the player is using a very low screen resolution; otherwise the big version will be used.
You can create the images in any image format that ZDoom supports. It is recommended to use a format which supports an alpha channel so you have direct control over the transparency of the crosshair. You can also use a grayscale image, with white areas showing as fully opaque and black as fully transparent.
Save your small version as XHAIRSxx, and your large version as XHAIRBxx, where xx is the number of the crosshair. If the number is a single digit, you do not need to include a leading zero. The default crosshairs use XHAIRS1 - XHAIRS7 and XHAIRB1 - XHAIRB7, so it is a good idea not to use those numbers unless you intend to replace them. The actual number you choose does not matter, as long as it is greater than zero: it is merely the number that you will refer to when setting the crosshair from the console or using A_SetCrosshair.
As a final step, you can optionally add your crosshair to the XHAIRS lump along with a text description. If you do so, your crosshair will be selectable from the in-game menu. Otherwise it can still be selected from the console assuming the user knows the crosshair number.