Alley Cat Scenery Format

From ModdingWiki
Jump to navigation Jump to search

Backgrounds in Alley Cat use lists of rectangular image placements, mixed with procedural drawing. These lists are embedded data, not standalone map files. Each list gives one common image size followed by source-pointer/destination pairs.

File format

All words are little-endian. Addresses below refer to the IBM data segment unless stated otherwise.

Relative offset Data type Name Description
0 UINT8 widthBytes Width of every rectangle in bytes; multiply by 4 for pixels
1 UINT8 height Height of every rectangle in rows
2 onward PAIR[] placements Read until a source word of 0xFFFF
After last pair UINT16LE end 0xFFFF; no destination word is consumed

Each placement pair is:

Data type Name Description
UINT16LE source DS offset of packed image bytes
UINT16LE destination CGA byte offset, added to the base supplied by the caller

The minimum consumed length is 2 + 4 * count + 2 bytes. Each source image occupies widthBytes * height bytes. The renderer copies it opaquely and advances the destination through alternating CGA scan-line banks. It does not interpret destinations as x/y coordinate pairs.

destination = (storedDestination + callerBase) & 0xFFFF
for each image row:
    copy widthBytes consecutive source bytes to destination
    destination = destination XOR 0x2000
    if (destination & 0x2000) == 0:
        destination += 80

Here destination is kept at the beginning of the current row before the XOR. The real routine advances it while copying and subtracts the row width first.

Lists and groups

The viewer follows lists at DS offsets 28A0, 251C, 2384, 238C, 2570, 2344, 2624, 3C22, 3C3E, 3C9A, 3C56, 2E24, 361C (hexadecimal).

Furniture groups contain pointers to shape lists. The viewer follows four pointers at 2634 + 2*i, five at 263C + 2*i and four at 2646 + 2*i, with i starting at 1. The actual shapeGroup() renderer visits its selected offsets in descending order; the catalogue's ascending traversal is for finding graphics, not reproducing drawing order. Group base 2634 is also used as runtime scratch storage for the placement base.

Notes

  • This is only the placement-list component of the backgrounds. Room selection, procedural tiles, object setup, collision and goals are implemented in code and other tables. There is no complete editable level record in this format.
  • The list has a sentinel, not a count. The viewer's 1024-byte scan guard is a defensive catalogue limit, not a stored length.
  • Preserve a non-zero row count: the original decrement-and-repeat loop does not treat zero as an empty image.
  • Tandy source pointers are native Tandy DS offsets. Apply the edition map to known literal list addresses, not to pointers read from the lists.

Source code

From re-alleycat, the open-source HTML5 port (revision b003aa63ffbb):

Credits

This file format was reverse engineered by VorticonCmdr. Please credit the original research when using this information in your own project, and include a link back to this wiki.