Bloodwych Pockets Data Structure - HoraceAndTheSpider/Bloodwych-68k GitHub Wiki

Bloodwych Pockets Data Structure

For SPS 439, champions.pockets is a 256-byte table containing sixteen 16-byte champion records. Object IDs use the definitions in Object Definitions; $00 means an empty slot.

Byte Meaning
$00 Left-hand object slot
$01 Right-hand object slot
$02 Body-armour object slot
$03 Shield object slot
$04–$0B Eight ordinary inventory-object slots
$0C Shared coinage quantity (object $01)
$0D Shared common-key quantity (object $02)
$0E Shared regular-arrow quantity (object $03)
$0F Shared elf-arrow quantity (object $04)

Counted objects

Coinage, common keys, regular arrows and elf arrows do not carry a quantity in their visible slot. The inventory renderer indexes the record's count area as $0B + object ID; thus the four object IDs $01–$04 select bytes $0C–$0F respectively.

Normal gameplay merges a counted object into its existing stack and clamps the shared count to 99. A modified record can nevertheless place the same counted object in more than one of the twelve slots. Every such slot displays the same one shared count; it is not a separate stack per slot.

During rendering, the game removes a counted-object slot whose shared count is zero before it draws the pocket. Coinage and common-key counts are printed in the upper part of their 16×16 cell; the two arrow counts are printed lower in the cell. Other object IDs have no quantity overlay.

Inventory drawing

The original 68000 inventory routine scans slots $00–$0B in order. For a non-empty slot it looks up the object definition's pocket icon and palette colour, then draws the resulting 16×16 Pockets graphic. Empty equipment slots use their dedicated hand, body-armour, and shield placeholders; ordinary empty slots use the standard empty-pocket picture.