Mainly created this program to created wal files for Kingpin.
That can used for compiling lighting in bsp or for TrenchBroom.

Best to put tga2wal.exe into your Kingpin directory and run it.
It wil try then to get colormap.pcx from pak0.pak. But you can also add a custom one by just putting it in the same directory.
Examples commands:
  tga2wal -skipalpha kingpin\main
  tga2wal -alphathresh 128 kingpin\main
  tga2wal -onlyini

for wal_json see more info on:
https://ericw-tools.readthedocs.io/en/latest/qbsp.html#wal-json


Usage: tga2wal [options] [directory]
If no directory is given, current directory is used.

Options:
  -alphathresh <N>      : set alpha threshold (default 255).
                          Pixels with alpha < N map to palette index 255 (transparent).
  -alphathreshsemi <N>  : detect semi-transparent 32-bit TGAs.
                          If any alpha in (0..N), ignore alpha for that texture (no pink cutout).
  -onlyalpha            : use alpha channel only (ignore RGB images)
  -skipalpha            : ignore alpha channel (RGB images only)
  -skipini              : ignore textureinfo.ini completely
  -onlyini              : convert only TGAs listed in textureinfo.ini (apply INI flags/contents)
  -powerof2             : skip textures that are not power-of-two (e.g. 64x64, 128x256)
  -q2flags              : only apply Quake II-compatible flags
  -q2palette            : Use hardcoded Quake II palette
  -kppalette            : Use hardcoded Kingpin palette
  -deletedwal           : delete WALs corresponding to TGAs
  -deletedwal_json      : delete .wal_json files corresponding to TGAs
  -wal_json             : write per-texture .wal_json files next to the TGA
  -scantga              : scan TGA header and report issues (no conversion)
  -scanini              : scan textureinfo.ini for entries with no matching .tga (no conversion)
  -scanalpha            : scan TGAs that have alpha and report whether alpha is semi-transparent
  -fixtga               : attempt to repair TGA and overwrite file.
  -skipoverwrite        : skip if .wal exists (default: overwrite existing .wal files)
  -h, --help            : show this help message

By default, the tool auto-detects the textures folder:
      Kingpin   main/textures
      Quake II  baseq2/textures
If run inside kingpin/main or quake2/baseq2, it will look for the local 'textures' subfolder.
If no textures folder is found, the tool exits with an error.

Created by FREDZ
17 December 2025
