krunpack
Standalone C room renderer for Michael Jakobsen's BBC Micro game 'Citadel'
v0.1
21st December 2025

WHAT?
-----
This is a tool I wrote back in 2020, based on findings from my own disassembly of Michael Jakobsen's classic arcade-adventure 'Citadel'. It renders Citadel's rooms to image files based on Michael Jakobsen's original BBC Micro packed room data. Given a copy of CITAX or CITAM, and a valid room ID, it will draw the room and save a PNG. It will optionally also render the room's collision layer to a second PNG.

This tool proved very useful for examining old, development-era rooms uncovered on Michael's original discs.

BUILDING IT
-----------
You'll need a C compiler and a copy of libpng. Set the library path to libpng by editing the provided build.sh if necessary, then run build.sh.

USAGE
-----
A suitable copy of the CITAX data file has been included along with the source code for your convenience.

A shell script (all_rooms.sh) is included, which will render all rooms out to a directory of PNGs (optionally with their collision maps -- edit the shell script to enable).

Note that krunpack started out life as a PHP script, which is the reason for the weird non-POSIX '+'-style command-line switches. Specify a second PNG filename should you also want the collision.

Usage; [...] = optional; <...> = mandatory

./krunpack [switches] <CITAM file> <room ID> <PNG> [collision PNG]

Switches:
  +wd             The Well has been drained
  +bl             Central Tower battlements lift has been activated
  +sp             Star Port has been destroyed
  +ic             ice crystal is in use
  +ud, +od        unlock doors, open doors (mutually exclusive)
  +lo             The Lab has been opened
  +it <tile id>   draw item with tile ID <id> on item pad, if present
  +cr <cry. ids>  specify list of IDs (0-4) of crystals returned (e.g. "034")
  +to             draw PLOT 85 triangles as outlines only
  +xs             extend screen height to 192 pixels, show ROM overwrites

PROBLEMS
--------
If I remember correctly, the outstanding issue with this was that PLOT 85 triangles rendered by the bundled C Bresenham implementation do not exactly match those drawn by Acorn's MOS 1.2.



