Warcraft II (DOS) Death Knight Spell Icons Fix

The Battle.net Edition of Warcraft II includes many big and small changes and improvements over the original DOS releases, including proper icons for the Death Knight‘s Death Coil and Death and Decay spells. The original DOS releases had them swapped (the manual shows the correct icons). It always bothered me a little bit, and recently, after browsing the Warcraft II modding forum, I was finally able to put this OCD to rest. šŸ™‚

Below are the final patch offsets for the program versions I tested. The first and second offset are always 18Ɨ5 = 90 bytes apart and specify the icons for the Death Coil and Death and Decay commands, respectively. The two values are simply swapped.

VersionOffset  1 (67ā†’6C)Offset 2 (6Cā†’67)
1.220xCDA3C0xCDA96
1.300xD2BF00xD2C4A
1.330xD2BFC0xD2C56
1.500xD44F80xD4552

Background / further reading

The key to the patch are the command offsets and structures described in this post. The unit commands table starts at offset 0xD2380 (for v1.33) and is essentially an array of structs (18 bytes long) for all commands of all units. The important fields for us are the first two – position of icon (which is between 0 and 8 in a 3×3 grid, with 0 being top left and 8 being bottom right), and icon number (which is an index to a table of pointers to graphical resources). Both are stored as 2-byte integers. The goal was to find the command table entries for Death Coil and Death and Decay and swap their icon numbers.

The table is quite long, but a few insights helped find the offsets fast without having to dig through other parts of the program. The table is organized first by unit, then by command. The position for Death and Decay is bottom right, which stands for 08 00. Death Coil is at the left of the middle row (03 00). Not all game units have a possible command at the bottom right, so 08 00 should not appear frequently. Of those that do have an icon at 08 00, some have “gaps” in the command grid, such as Goblin Sappers / Dwarven Demolition Squads (which only have positions 0, 1, 2 and 8) and Paladins / Ogre-Magi (which have nothing in position 5).

The task was therefore to find instances of 08 00 in the table, which will be preceded by 07 00, 06 00, 05 00, 04 00 and 03 00, offset by 18 bytes each. This is quite easy with an editor such as XVI32 where the line length is controlled by window size, as shown below. There were not so many candidate locations: as far as I recall, only Magi / Death Knights, and Peon/Peasant Advanced Build sub-command screen have all icons populated. Then, the two numbers following the 08 00 and the preceding 03 00 must be switched. It didn’t take too much trial-and-error to find the correct offsets, and after swapping just two bytes – the spell icons for the Death Knight are now correct – including the special Death Knight heroes – Gul’dan and Teron Gorefiend (I thought they may have their own table entries, but it turned out not to be the case).

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s