== ABOUT == This command-line tool converts standard graphic files (tga, bmp, gif, pcx, png, and even jpg) to Quake2 WAL files, which are 8 bits indexed mip-mapped (4 levels) textures. These WAL files are not used by Kingpin itself, but they are used by QRAD (the compilation tool casting light in BSP levels) for bouncing rays. Since Hypov taught me that Kingpin can use animated textures (if maps are compiled with properly configured WAL files), this version also checks for animation frames; these are files starting with +, followed by a digit from 0 to 9 (for instance: +0anim1.tga, +1anim1.tga, +2anim1.tga, etc.) == PARAMETERS == -Replace Optional. Always replace matching files without warning. By default, the program will prompt the user before replacing a file. -SKip Optional. Never replace matching files. By default, the program will prompt the user before replacing a file. Note: -SKip has the priority over -Replace. -SubFolders Optional. Also parse all sub folders for images. By default, only the working directory or the specified directory will be parsed. -NoCheck Optional. Do not check texture dimensions. By default, images whose dimensions are not a power of two, above or equal to 16, are skipped. -Set16 Optional. When writing the color conversion table, use 16-bit (instead of 24-bit) per color. This will negatively impact the output quality, but will reduces the time to initialize the table, require less free space to save the conversion table, and generate a file similar to PICS/16TO8.DAT (which is helpful when working on a total conversion that requires its very own palette). This parameter is ignored when loading a look up table (the number of bits per color is implied by the table size). -SetAlpha [VALUE] Optional. Expects a value between 0 and 256, this will replace any pixel with an alpha value strictly below the threshold value with the will always generate opaque textures, a value of 256 will turn any picture into a blank surface. By default, the alpha channel is ignored. -Folder [DIRECTORY] Optional. Location of source images (relative directory or absolute path). WAL files will be saved under the same name, in the same directory, only with the WAL extension. By default, only files located in the working directory will be converted. Important: the path provided will be saved within the WAL file, make sure the whole path (including the filename) fits on 31 bytes. -Palette [FILE] Required. Palette file for the conversion. The expected palette is a simple ACT file (256 color attributes of 3 bytes each as R, G, B). -LookUp [FILE] Optional. 24-bit or 16-bit per color conversion table. If the table exists, it will be loaded into memory before proceeding to the conversion. If the file doesn't exist, one will be created within one or two minutes (the 24-bit per color requires 16 MB of free space, while the 16-bit per color only requires 64Kb). This file only needs to be written once and will speed up the conversion tremendously. By default, the program will try to find the most appropriate index using only the palette. -Source [FILE] Optional. Only create WAL files for textures used in the specified BSP file. Since texture names are stored with a relative path within BSP files, you also need to set -Folder (for instance: "c:/kingpin/main/textures/"). When using BSP files for texture lists, the -SubFolders parameter is ignored. == .WAL SPECIFICATION == Texture files always start with a 100-byte long header. Right after the header, you'll find the same texture stored four times using different scales (mipmaps). Pixels are encoded from left to right and top to bottom. Each pixel uses an index number defined by the palette of COLORMAP.PCX CHAR[32] Name Texture name UINT32 Width Width of the 1:1 texture, in pixels UINT32 Height Height of the 1:1 texture, in pixels UINT32 Ofst1 Offset of first pixel of 1:1 mipmap UINT32 Ofst2 Offset of first pixel of 1:2 mipmap UINT32 Ofst3 Offset of first pixel of 1:4 mipmap UINT32 Ofst4 Offset of first pixel of 1:8 mipmap CHAR[32] Next Next frame (animated texture) UINT32 SFlags Surface flags UINT32 CFlags Content flags UINT32 Light Light value CHAR[Width*Height] 1:1 texture, (Width x Height) pixels CHAR[Width*Height\4] 1:2 mipmap, (Width/2 x Height/2) pixels CHAR[Width*Height\16] 1:4 mipmap, (Width/4 x Height/4) pixels CHAR[Width*Height\64] 1:8 mipmap, (Width/8 x Height/8) pixels