#  MapHacker - (c) 2007 Stu Redman
#  Tool for Duke Nukem map hacking
#  list sprites from maps and their coordinates
#  patch maphacks into maps
#  check maphacks for duplicate or out-of-range entries
#  diff maps and update maphacks from the diff 
#  (so you can adjust angles directly in Mapster32)

1) Install it
MapHacker is a Perl program, so you need to install Perl. I suggest ActivePerl
from http://www.activestate.com/products/activeperl/ . Maphacker is not tested 
under Linux and will probably fail due to the case sensitive file system.
Make a folder in your Duke folder and add:
- your maps (you have to extract them from the GRP, I used Roma Loom's
    GRPViewer  http://romaloom.ho.com.ua/index.php?cmd=grpv)
- your maphacks
- NAMES.H from the EDuke32 zip
- Maphacker.cmd

2) List sprites and build patchmaps
Now run it. Open a command window, cd to your MapHacker folder and type:
maphacker maps 603,1294,1323,1334
It should print no messages. When it is finished, there is a new subfolder 
"hackmaps", and a new file "spritelist.txt".
The spritelist lists all maps which contain the sprites you entered, the
positions of the sprites, and their names (if available in names.h).
The hackmaps folder has copies of these maps in it. If you open one of
them in Mapster 32, you will find that the sprites are already rotated
like they are in the game with maphacks applied. That's because MapHacker
patched the Hacks into the maps by rotating the sprites by their hack offset.
(Maphacker applied ALL hacks, not just the hacks for the sprites you entered).

To get a complete sprite reference, type
maphacker maps all
You will get an error message if the hackmaps dir is already present, so 
delete it first. MapHacker won't overwrite your (maybe already patched !)
maps.

3) Fix angles
Open the patched maps (not the original ones !) in Mapster32. Navigate to
the sprites in your list using the coordinates:
- hit esc for loading
- zoom out using the mouse wheel
- press shift to get a coordinate cross
- right click when you're close enough
- zoom in
- switch to 3D mode with Enter (on the numpad)
- you can move around with cursor keys
- move mouse curse on sprite and rotate it with "," and "." (shift for fine adjustment)
- hit esc and save it
(that's Mapster 4 dummies, like myself :-) )

4) Update Hacks
type:
maphacker hacks
and Maphacker will compare all maps in the hackmaps dir with the originals, 
calculate the differences between the sprite angles, and update your maphack files 
by these values.

Have fun !

Stu
