This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
super:technical_information:data_structures [2019/02/07 21:41] – Special x-ray blocks and PLM populations p.jboy | super:technical_information:data_structures [2019/03/02 17:50] – [Special x-ray blocks] added flexglow note p.jboy | ||
---|---|---|---|
Line 31: | Line 31: | ||
| 7 | Debug | | | 7 | Debug | | ||
</ | </ | ||
+ | |||
Notes: | Notes: | ||
Line 98: | Line 99: | ||
| 4 | Area torizo (Bomb Torizo, Golden Torizo) | | | 4 | Area torizo (Bomb Torizo, Golden Torizo) | | ||
</ | </ | ||
+ | |||
===== Door list ===== | ===== Door list ===== | ||
| | ||
Line 233: | Line 234: | ||
| 7 | Song 2 | | | 7 | Song 2 | | ||
</ | </ | ||
+ | |||
Notes: | Notes: | ||
Line 387: | Line 389: | ||
| ::: | ::: | 4Fh || Critters escape block | | | ::: | ::: | 4Fh || Critters escape block | | ||
</ | </ | ||
+ | |||
==== FX ==== | ==== FX ==== | ||
| | ||
Line 462: | Line 464: | ||
| 80h | Small tide (liquid fluctuates up and down) | | | 80h | Small tide (liquid fluctuates up and down) | | ||
</ | </ | ||
+ | |||
==== Enemy population ==== | ==== Enemy population ==== | ||
| | ||
Line 547: | Line 549: | ||
The **X/Y position** is specified in (16px x 16px) block units. | The **X/Y position** is specified in (16px x 16px) block units. | ||
The **block** uses the level data block format, except that the block type is ignored. | The **block** uses the level data block format, except that the block type is ignored. | ||
+ | |||
+ | Note that [[http:// | ||
==== PLM population ==== | ==== PLM population ==== | ||
Line 583: | Line 587: | ||
| Ch | | Clear Kraid' | | Ch | | Clear Kraid' | ||
| Eh | DDDD ssssss dddd nnnn | Transfer '' | | Eh | DDDD ssssss dddd nnnn | Transfer '' | ||
+ | |||
+ | |||
+ | ====== Object formats ====== | ||
+ | Super Metroid has lots of specialised **object formats**, which are defined with an **instruction list** possibly combined with an " | ||
+ | In general, **object formats** have a handler that, for each object, executes a **pre-instruction** and then interprets the **instruction list**. | ||
+ | |||
+ | The **instruction list** is a list of **ASM instructions** and **special instructions**. | ||
+ | **ASM instructions** have a negative value (meaning $8000..FFFF), | ||
+ | **Special instructions** (usually graphical in nature) have a positive value (meaning $0000..7FFF), | ||
+ | |||
+ | Common **ASM instructions** include looping, conditional execution, setting the pre-instruction, | ||
+ | The pre-instruction is a function that's executed before the object' | ||
+ | Objects that are sleeping are suspended from handling until they are awakened (usually by a pre-instruction set earlier in the object instruction list). | ||
+ | |||
+ | ===== PLMs ===== | ||
+ | PLMs (post-load modifications) are objects that modify level data blocks in real-time. | ||
+ | They exist in bank $84 and are typically loaded with a room from a room header (e.g. items, doors) or spawned as part of a block interaction (e.g. shot block crumbling). | ||
+ | |||
+ | PLM header: | ||
+ | | ||
+ | | _ Instruction list pointer | ||
+ | | | | ||
+ | aaaa iiii | ||
+ | |||
+ | Door PLM header: | ||
+ | | ||
+ | | | ||
+ | | | _ Instruction list pointer - door closing | ||
+ | | | | | ||
+ | aaaa iiii dddd | ||
+ | |||
+ | The third pointer for door PLMs is used instead of the second pointer when the PLM is placed where a blue door would normally be closing when Samus enters a room. | ||
+ | |||
+ | The **special instructions** for PLMs have the format: | ||
+ | | ||
+ | | _ Pointer to draw instruction | ||
+ | | | | ||
+ | tttt dddd | ||
+ | |||
+ | The **draw timer** is how many frames to wait until the next instruction in the instruction list is proceeded to. | ||
+ | |||
+ | The **draw instruction** format is a list of: | ||
+ | nnnn ; Number of blocks | ||
+ | bbbb [...] ; Blocks | ||
+ | xx yy ; X and Y offsets from origin to start drawing from | ||
+ | |||
+ | where the list is terminated by '' | ||
+ | |||
+ | Blocks are drawn from the PLM's position, the direction they' | ||
+ | If '' | ||
+ | If '' | ||
+ | |||
+ | ===== Enemy projectiles ===== | ||
+ | Enemy projectiles exist in bank $86 and are typically spawned by enemies and can use their graphics and palette. | ||
+ | |||
+ | Enemy projectile header: | ||
+ | | ||
+ | | | ||
+ | | | | ||
+ | | | | | ||
+ | | | | | | ||
+ | | | | | | | ||
+ | | | | | | | | ||
+ | | | | | | | | ___ Shot AI | ||
+ | | | | | | | | | | ||
+ | iiii pppp IIII xx yy Pddd tttt ssss | ||
+ | |||
+ | The **properties** are as follows: | ||
+ | |||
+ | | 8000h | Detect collisions with projectiles | | ||
+ | | 4000h | Don't die on contact | | ||
+ | | 2000h | Disable collisions with Samus | | ||
+ | | 1000h | Low priority (drawn under enemies/ | ||
+ | |||
+ | The **special instructions** for enemy projectiles have the format: | ||
+ | | ||
+ | | _ Pointer to spritemap | ||
+ | | | | ||
+ | tttt ssss | ||
+ | |||
+ | The **spritemap timer** is how many frames to wait until the next instruction in the instruction list is proceeded to. | ||
+ | Within the spritemap, the tile numbers added to the base tile number set when the enemy projectile was spawned (so the projectile can access enemy graphics). | ||
+ | |||
+ | ===== Animated tiles objects ===== | ||
+ | Animated tiles objects are objects that modify tile graphics in real-time. | ||
+ | They exist in bank $87 and are loaded with a room from an FX header. | ||
+ | |||
+ | Animated tiles object header format: | ||
+ | | ||
+ | | | ||
+ | | | _ VRAM address | ||
+ | | | | | ||
+ | iiii ssss vvvv | ||
+ | |||
+ | The **special instructions** for animated tiles objects have the format: | ||
+ | | ||
+ | | _ Pointer to tile graphics | ||
+ | | | | ||
+ | tttt ssss | ||
+ | |||
+ | The **animation timer** is how many frames to wait until the next instruction in the instruction list is proceeded to. | ||
+ | |||
+ | ===== HDMA objects ===== | ||
+ | HDMA objects exist in bank $88 and are typically loaded with a room as part of FX or spawned by power bombs / x-ray. | ||
+ | |||
+ | HDMA object header format: | ||
+ | | ||
+ | | ____ PPU register index | ||
+ | | | _ Instruction list pointer | ||
+ | | | | | ||
+ | dd pp iiii | ||
+ | |||
+ | The **special instructions** for HDMA objects have the format: | ||
+ | | ||
+ | | _ Pointer to HDMA table | ||
+ | | | | ||
+ | tttt ssss | ||
+ | |||
+ | The **table timer** is how many frames to wait until the next instruction in the instruction list is proceeded to. | ||
+ | |||
+ | ===== Palette FX objects ===== | ||
+ | Palette FX objects are objects that modify palette data in real-time. | ||
+ | They exist in bank $8D and are loaded with a room from an FX header. | ||
+ | |||
+ | Palette FX object header format: | ||
+ | | ||
+ | | _ Instruction list pointer | ||
+ | | | | ||
+ | aaaa iiii | ||
+ | |||
+ | The **special instructions** for palette FX objects have the format: | ||
+ | | ||
+ | | _ Palette instruction list | ||
+ | | | | ||
+ | tttt [...] | ||
+ | |||
+ | The **palette timer** is how many frames to wait until the next instruction in the instruction list is proceeded to. | ||
+ | |||
+ | The ASM instructions are usually used for setting the initial colour index, | ||
+ | which is an index into CGRAM equal to '' | ||
+ | |||
+ | **Palette instructions** are a mix of colours (which are positive values) and ASM instructions (negative values). | ||
+ | Colours are written to successive positions in CGRAM starting from initial colour index. | ||
+ | ASM instructions can modify the colour index between listed colour values, | ||
+ | and the instruction $C595 is used to terminate the palette instruction list. | ||