To create the most recent Jazz Jackrabbit maps, I leverged and then horribly mangled the code from the OpenJazz project. This post provides downloads for my patch, the resultant source code, and a brief description on how to use it and what I did.
jazzmapper.patch (8.4 kb)
Patch to be applied to OpenJazz-src-160214
OpenJazz-src-Mapper.tar.bz2 (131.0 kb)
The full modified OpenJazz source with the patch applied, if there are troubles using the patch or finding the matching version.
First, a warning: due to how this mapper tool works, it should NOT be run in full-screen mode. This will be more apparent in the 'How it Works' section.
To map the first level in an episode, simply start openjazz normally and start the desired episode. As soon as the map loads, a BMP file for the level will be written to disk and the application will exit.
To map any other level, a new command-line argument was added (-w) which will warp to the specified world and level. For example, to load and map the file LEVEL1.035, you would type:
./openjazz -w 35 1
How it Works
Upon loading a map, the map filename is recorded as a 'screenshot filename' in the video subsystem. Then, when the level loop starts, a screenshot flag is set to true and the view canvas resized to fully fit the entire level at once. This is reason #1 why the tool should not be run fullscreen.
When the video subsystem sees the screenshot flag, instead of 'flipping' the normal screen buffer, it instead writes the screen buffer to disk. It also needs to set the palette as a logical palette rather than a physical palette so it will be included in the resulting image.
When loading a level, Jazz Jackrabbit has a fade in effect. Since we want to actually see the level rather than white, and and we don't want to wait for the effect to finish, I removed the code for this from paletteeffects.cpp. I probably removed more effects than needed, but it makes no real differences for the purposes of this tool.
To support the warp option, I added some new global flags to util.h which would be easily accessible from multiple places. These are parsed from the already-existing option parse loop in main.cpp then used in mainmenu.cpp to immediately switch to the difficulty select menu with the level pre-determined from the command line arguments.
Two other changes were performed to make this practical. The intro cutscene code was removed and the newGameDifficulty function was made public to allow the menu jump.
Overall, the changes were relatively small, so it was not much trouble to create the maps. Some ideas for a slightly better version of this tool could be:
- Skip the Planet approach animation
- Short-circuit the difficulty select menu to immediately advance to the level
- Support bonus stages
The last option in particular would require significant additional development, since the bonus levels would need to be re-rendered in a flat (or isometric?) format rather than the current perspective.
Since OpenJazz has some preliminary Jazz Jackrabbit 2 support, I may investigate that in a bit and see if I can use the same technique to map those levels too.