Added more extraction support for WC3; this time something we can actually see. This update includes support for extracting an image representation of a palette; this is actually a little trickier than it might seem. The colors in WC3 are not simply presented as they are encoded in a palette. Instead, gamma correction is applied to brighten or even darken a scene if necessary.
In DOS the options are more limited. Either gamma correction is disable which creates a very dark scene, or it is set to a low or high increase in brightness.
The flight deck without any gamma correction:
View attachment 11216
The palettes for the flight deck - with no gamma correction, and with low and high increases:
View attachment 11219 View attachment 11218 View attachment 11217
In Windows, a default gamma shift is set, but you can easily brighten or darken a scene in graduated steps. This is done by using a seed value to generate a mapping table which is used to shift the individual color components. When extracting a palette, I use the same default setting as in Windows, but you can specify a different value if you wish. You can also disable gamma shifting and produce the same effect as in DOS.
From the command line, the first example uses the default seed value of 80, the second example increases the brightness, and the third example disables any gamma shifting:
WC3ToolsCmd.exe expalette FILENAME.PAL
WC3ToolsCmd.exe expalette FILENAME.PAL /gamma:90
WC3ToolsCmd.exe expalette FILENAME.PAL /gamma:-1
The other bit of functionality is to make use of the palette and extract images from shape files. The use of an external palette is needed since shapes contain no color values.
Since the game data is divided among multiples files, and is contained in files within files, a multi-step process is used.
Let's begin by extracting the files from a tree archive (also making use the hash-to-name mapping file):
WC3ToolsCmd.exe extree GAMEFLOW.TRE /hashes:external\wc3-hashes\GAMEFLOW.TRE.txt
Afterwards we extract the packets:
WC3ToolsCmd.exe expack DATA\GAMEFLOW\SHAPES.PAK
Most of the extracted packets are shape files, but the ones which are 768 bytes are palettes. Let's rename a few files for convenience:
rename SHAPES.PAK-Packet036.PCK *.PAL
rename SHAPES.PAK-Packet037.PCK *.SHP
Next we convert a palette file into an image:
WC3ToolsCmd.exe expalette SHAPES.PAK-Packet036.PAL
Finally, we convert the shapes into images:
WC3ToolsCmd.exe exshape SHAPES.PAK-Packet037.SHP /palette:SHAPES.PAK-Packet036.PAL.PNG
View attachment 11220
Here are some additional images:
View attachment 11221 View attachment 11222 View attachment 11223
Surprisingly, some of the rooms are composited:
View attachment 11224 View attachment 11225 View attachment 11226 View attachment 11227