Legacy of the Wizard/ROM map: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(documenting ROM banks and map format)
 
(→‎Map Format: finish documenting enemies, categorizing)
Line 51: Line 51:


All unlisted bytes are always filled with 0.
All unlisted bytes are always filled with 0.
=== Tiles ===


The map grid is one byte per tile. The high 2 bits select a palette. The low 6 bits select metatile from the selected metatile page. Each metatile index has a special function:
The map grid is one byte per tile. The high 2 bits select a palette. The low 6 bits select metatile from the selected metatile page. Each metatile index has a special function:
Line 75: Line 77:


The block replacement is simply the tile that appears under a block or locked door when it is moved or destroyed. This only happens when it's moved from its starting position.
The block replacement is simply the tile that appears under a block or locked door when it is moved or destroyed. This only happens when it's moved from its starting position.
=== Music ===


Music tracks:
Music tracks:
Line 94: Line 98:
Music Control Bitfield: this prevents switching the music if the previously playing track is in the bitfield. (Only works for the first 8 tracks.) 1<<0 is dungeon, 1<<1 is xemn, etc.
Music Control Bitfield: this prevents switching the music if the previously playing track is in the bitfield. (Only works for the first 8 tracks.) 1<<0 is dungeon, 1<<1 is xemn, etc.


Demo Bitfield: this controls which family members can be randomly selected in each from for random demonstration during title screen:
=== Items ===
* 0 - xemn
* 1 - meyna
* 2 - roas
* 3 - lyll
* 4 - pochi


Shop items are in same order as inventory screen. 0 is wings, 1 is armour, etc.
Shop items are in same order as inventory screen.
* 0 - wings
* 1 - armour
* 2 - mattock
* 3 - glove
* 4 - rod
* 5 - power shoes
* 6 - jump boots
* 7 - key stick
* 8 - power knuckle
* 9 - winged rod
* 10 - shield
* 11 - magic potion
* 12 - elixer
* 13 - crystal ball
* 14 - crown
* 15 - dragonslayer


Treasure includes 8 more items:
Treasure includes 8 more items:
Line 113: Line 128:
* 7 - scroll
* 7 - scroll
* 8+ - same as shop if 8 less: wings, armour, etc.
* 8+ - same as shop if 8 less: wings, armour, etc.
=== Enemies ===
Every map has exactly 9 enemies. They cannot be removed, but you might choose an offscreen/inactive behaviour.
The sprite index is just an NES tall-sprites index. This is generally one of: $41, $51, $61, $71.
The draw attribute is an NES sprite attribute byte. The low 2 bits select a palette. Bit 5 will draw the enemy behind the background, but also cause the enemy to "hide" from damage until touched by the player.
Enemies will still be alive with 0 hit points. They do not die until their hit points go below 0.
There are 4 available animation styles:
* 0 - always show sprite 0, flipping horizontally
* 1 - switch between sprites 0 and 1
* 2 - like 1, but when moving vertically use sprite 2 and flip horizontally
* 3 - cycle through sprites 0, 1, 2, 3
There are 9 enemy behaviour types:
* 0 - wander, jump
* 1 - fly in a line
* 2 - walk on ground
* 3 - follow player, jump
* 4 - fly toward player
* 5 - ceiling crawl
* 6 - sleeping lion / mimic
* 7 - fly random line
* 8 - boss projectile
Bosses appear as a collection of 4 enemies. Their hit points and damage are given by the first enemy slot. Some of them have hit points above 99, and their life bar will not start to visibly drop until they go below 99 hit points.
=== Other ===
Demo Bitfield: this controls which family members can be randomly selected in each from for random demonstration during title screen:
* 0 - xemn
* 1 - meyna
* 2 - roas
* 3 - lyll
* 4 - pochi


The unused field $316 is not 0 in only two maps. It does not appear to be read for any purpose. The shops read $315 and $316 and use them to draw a few tiles offscreen, but this does not seem to serve any purpose and is probably just harmless vestigial code?
The unused field $316 is not 0 in only two maps. It does not appear to be read for any purpose. The shops read $315 and $316 and use them to draw a few tiles offscreen, but this does not seem to serve any purpose and is probably just harmless vestigial code?
=== Dragon ===
The dragon is stored as a special map in bank 9, beginning at PRG $13800. This map contains 4 dragon renderings as tiles, and metatile pages $10-17 can be used to select 8 different sets of dragon images.

Revision as of 04:27, 13 April 2020

PRG Banks

8kb MMC3 banks

$0-8 - $00000-$1FFFF level maps
$9-9 - $12000-$13FFF metatile sets, dragon map
$A-B - $14000-17FFF music, unused title screen
$C-D - $18000-1FFFF music, title screen, code, credits
$E-F - $1C000-1FFFF fixed upper bank, code

Map Format

Each 1kb of PRG in the map banks represents a single 4-screen map in the dungeon.

$000-2FF - 64 columns of 12 tiles each
$300 - Metatile Page
$301 - Enemy CHR (PPU $1400)
$302 - Secret Wall Tile
$303 - Secret Wall Replacement
$304 - Block Replacement
$305 - Terrain CHR 0 (PPU $0000)
$306 - Terrain CHR 1 (PPU $0800)
$307 - Treasure Active (1 = active)
$308 - Treasure X (grid 0-63)
$309 - Treasury Y (pixel 0-191)
$30A - Treasure Contents (0-23)
$30B - Music track (0-15)
$30C - Celina Teleport Map X (0-3)
$30D - Celina Teleport May Y (0-17)
$30E - Celina Teleport Player X (grid 0-63)
$30F - Celina Teleport Player Y (pixel 0-191)
$310 - Shop Item 0 (0-15)
$311 - Shop Price 0
$312 - Shop Item 1
$313 - Shop Price 1
$314 - Demo Bitfield
$315 - Music Control Bitfield
$316 - Unused*
$320-3AF - 9 x 16 byte enemy
    $3X0 - First Sprite Index
    $3X1 - Draw Attribute
    $3X2 - Position X (grid 0-63)
    $3X3 - Position Y (0-191)
    $3X4 - Hit Points
    $3X5 - Damage
    $3X6 - Death Sprite Index
    $3X7 - Animation Style
    $3X8 - Behaviour (0-8)
    $3X9 - Speed
$3E0-3FF - Palette

All unlisted bytes are always filled with 0.

Tiles

The map grid is one byte per tile. The high 2 bits select a palette. The low 6 bits select metatile from the selected metatile page. Each metatile index has a special function:

  • $00 - Ladder
  • $01 - Shop or Inn door (requires sign on the tile above to function)
  • $02 - Locked door
  • $03 - Celina portrait
  • $04 - Shop sign
  • $05 - Inn sign
  • $06-2F - Open space
  • $30 - Spike
  • $31-3D - Solid
  • $3E - Movable block
  • $3F - Solid

Metatile pages are stored in bank 9. Each page contains 64 4-byte entries. Each entry is two columns of tiles to select from the terrain CHR.

The secret tile designates a tile that will be replaced by another when touched. (The high 2 bits are ignored.) The replacement tile will replace it, and its top 2 bits will apply a new palette. Any pair of tiles can be used here, for a lot of different functions. E.g.:

  • Open replaced by open: the player will fall through.
  • Solid replaced by open: the player must push on it to pass through.
  • Inn replaced by shop: touching the sign converts the inn to a shop.

The block replacement is simply the tile that appears under a block or locked door when it is moved or destroyed. This only happens when it's moved from its starting position.

Music

Music tracks:

  • 0 - dungeon
  • 1 - xemn
  • 2 - meyna
  • 3 - lyll
  • 4 - pochi
  • 5 - dragon
  • 6 - inn
  • 7 - shop
  • 8 - death
  • 9 - title
  • 10 - credits
  • 11 - boss
  • 12 - home

Music Control Bitfield: this prevents switching the music if the previously playing track is in the bitfield. (Only works for the first 8 tracks.) 1<<0 is dungeon, 1<<1 is xemn, etc.

Items

Shop items are in same order as inventory screen.

  • 0 - wings
  • 1 - armour
  • 2 - mattock
  • 3 - glove
  • 4 - rod
  • 5 - power shoes
  • 6 - jump boots
  • 7 - key stick
  • 8 - power knuckle
  • 9 - winged rod
  • 10 - shield
  • 11 - magic potion
  • 12 - elixer
  • 13 - crystal ball
  • 14 - crown
  • 15 - dragonslayer

Treasure includes 8 more items:

  • 0 - bread
  • 1 - magic
  • 2 - gold
  • 3 - poison
  • 4 - key
  • 5 - ring
  • 6 - cross
  • 7 - scroll
  • 8+ - same as shop if 8 less: wings, armour, etc.

Enemies

Every map has exactly 9 enemies. They cannot be removed, but you might choose an offscreen/inactive behaviour.

The sprite index is just an NES tall-sprites index. This is generally one of: $41, $51, $61, $71.

The draw attribute is an NES sprite attribute byte. The low 2 bits select a palette. Bit 5 will draw the enemy behind the background, but also cause the enemy to "hide" from damage until touched by the player.

Enemies will still be alive with 0 hit points. They do not die until their hit points go below 0.

There are 4 available animation styles:

  • 0 - always show sprite 0, flipping horizontally
  • 1 - switch between sprites 0 and 1
  • 2 - like 1, but when moving vertically use sprite 2 and flip horizontally
  • 3 - cycle through sprites 0, 1, 2, 3

There are 9 enemy behaviour types:

  • 0 - wander, jump
  • 1 - fly in a line
  • 2 - walk on ground
  • 3 - follow player, jump
  • 4 - fly toward player
  • 5 - ceiling crawl
  • 6 - sleeping lion / mimic
  • 7 - fly random line
  • 8 - boss projectile

Bosses appear as a collection of 4 enemies. Their hit points and damage are given by the first enemy slot. Some of them have hit points above 99, and their life bar will not start to visibly drop until they go below 99 hit points.

Other

Demo Bitfield: this controls which family members can be randomly selected in each from for random demonstration during title screen:

  • 0 - xemn
  • 1 - meyna
  • 2 - roas
  • 3 - lyll
  • 4 - pochi

The unused field $316 is not 0 in only two maps. It does not appear to be read for any purpose. The shops read $315 and $316 and use them to draw a few tiles offscreen, but this does not seem to serve any purpose and is probably just harmless vestigial code?

Dragon

The dragon is stored as a special map in bank 9, beginning at PRG $13800. This map contains 4 dragon renderings as tiles, and metatile pages $10-17 can be used to select 8 different sets of dragon images.