https://github.com/mrglaster/hl-hud-upscaler
A utility for generating .spr and .txt weapon sprite files to support higher resolutions. Compatible with both the 25th Anniversary client version and pre-anniversary versions.
https://github.com/mrglaster/hl-hud-upscaler
amx amxmodx amxx colortrans command-line-tool half-life hl pillow python python3 spr sprite sprites txt upscale upscaling valve weaponmod wpnmod
Last synced: about 1 month ago
JSON representation
A utility for generating .spr and .txt weapon sprite files to support higher resolutions. Compatible with both the 25th Anniversary client version and pre-anniversary versions.
- Host: GitHub
- URL: https://github.com/mrglaster/hl-hud-upscaler
- Owner: mrglaster
- Created: 2025-01-16T18:21:07.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-18T17:43:25.000Z (3 months ago)
- Last Synced: 2025-01-25T16:14:55.589Z (3 months ago)
- Topics: amx, amxmodx, amxx, colortrans, command-line-tool, half-life, hl, pillow, python, python3, spr, sprite, sprites, txt, upscale, upscaling, valve, weaponmod, wpnmod
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Half-Life Weapon Sprites HUD Upscaler
### Overview
The Half-Life 25th Anniversary update introduced support for higher screen resolutions. However, to properly display weapon sprites in the updated HUD, the associated `.spr` and `.txt` files must be updated. Without these updates, the sprites may appear distorted or misaligned.
This utility automates the process of generating updated `.spr` and `.txt` files, ensuring compatibility with the new resolution support and streamlining the workflow.
#### weapon_357.txt before 25th anniversary update
```
12
weapon 320 320hud1 0 80 80 20
weapon_s 320 320hud1 0 100 80 20
ammo 320 320hud2 18 16 18 18
crosshair 320 crosshairs 48 0 24 24
autoaim 320 crosshairs 24 72 24 24
zoom 320 crosshairs 96 0 24 24
weapon 640 640hud1 0 90 170 45
weapon_s 640 640hud4 0 90 170 45
ammo 640 640hud7 24 72 24 24
crosshair 640 crosshairs 48 0 24 24
autoaim 640 crosshairs 24 72 24 24
zoom 640 crosshairs 96 0 24 24
```#### weapon_357.txt after 25th anniversary update
```
24
weapon 2560 2560/weapon_357_weapon 0 0 510 135
weapon_s 2560 2560/weapon_357_weapon_s 0 0 510 135
ammo 2560 2560/weapon_357_ammo 0 0 72 72
crosshair 2560 2560crosshairs 144 0 72 72
autoaim 2560 2560crosshairs 72 216 72 72
zoom 2560 2560crosshairs 288 0 72 72
weapon 1280 1280/weapon_357_weapon 0 0 340 90
weapon_s 1280 1280/weapon_357_weapon_s 0 0 340 90
ammo 1280 1280/weapon_357_ammo 0 0 48 48
crosshair 1280 1280crosshairs 96 0 48 48
autoaim 1280 1280crosshairs 48 144 48 48
zoom 1280 1280crosshairs 192 0 48 48
weapon 640 640hud1 0 90 170 45
weapon_s 640 640hud4 0 90 170 45
ammo 640 640hud7 24 72 24 24
crosshair 640 crosshairs 48 0 24 24
autoaim 640 crosshairs 24 72 24 24
zoom 640 crosshairs 96 0 24 24
weapon 320 320hud1 0 80 80 20
weapon_s 320 320hud1 0 100 80 20
ammo 320 320hud2 18 16 18 18
crosshair 320 crosshairs 48 0 24 24
autoaim 320 crosshairs 24 72 24 24
zoom 320 crosshairs 96 0 24 24
```---
### Environment Setup
Follow these steps to configure the environment for the utility:
1. Install **Python 3**.
2. Clone the repository or download the contents as a compressed archive and extract them.
3. Install the required Python packages by running:```bash
pip3 install -r requirements.txt
```
4. The utility can automatically use paths to the standard highres sprites for ammo and crosshairs added in the HL25th Anniversary Update (it will be done if your sprite uses their default versions in resolution 640). To avoid issues, make sure to add them to the server's precache.
5. Configuration is complete! You are now ready to use the utility.---
### Usage Instructions
1. Place all the required `.spr` and `.txt` files in a **single directory** (see example below):

2. Run the utility using the following command:
```bash
python3 hud_upscaler.py --path /path/to/directory/with/your/weapon/sprites --umodel edsr-base
```#### Command Line Arguments:
- **`--path`**: The path to the directory containing your `.spr` and `.txt` files.
- **`--umodel`**: The name of the upscaling model to use.
You can find the list of available models [here](https://pypi.org/project/super-image/) or in the table below:
---
### Comparation
#### Weaponmod gun before the utlity was used

#### Weaponmod gun after the utlity was used

### Links
- https://github.com/ValveSoftware/halflife/blob/master/devtools/image_to_spr.py
- https://developer.valvesoftware.com/wiki/SPR
- https://twhl.info/wiki/page/hud.txt_and_weapon_*.txt
- http://infotex58.ru/forum/index.php?topic=1135.0
- https://pypi.org/project/super-image/