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 [2018/09/28 14:27] – Use collapsible sections p.jboy | super:technical_information:data_structures [2021/05/08 20:12] – [Room header] incorrect hex prefi p.jboy | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Room header ====== | ====== Room header ====== | ||
- | _______________________________________ | + | ____________________________________ |
- | | ____________________________________ | + | | _________________________________ |
- | | | _________________________________ | + | | | ______________________________ |
- | | | | ______________________________ | + | | | | ___________________________ |
- | | | | | ___________________________ | + | | | | | ________________________ |
- | | | | | | ________________________ | + | | | | | | _____________________ |
- | | | | | | | _____________________ | + | | | | | | | __________________ |
- | | | | | | | | __________________ | + | | | | | | | | _______________ |
- | | | | | | | | | _______________ | + | | | | | | | | | ____________ |
- | | | | | | | | | | ____________ | + | | | | | | | | | | _________ |
- | | | | | | | | | | | _______ Optional event headers | + | | | | | | | | | | | ____ State conditions list |
- | | | | | | | | | | | | _ Mandatory event header, specifies that the default state follows this room header | + | | | | | | | | | | | | |
- | | | | | | | | | | | | + | | | | | | | | | | | | |
- | ii aa xx yy ww hh uu dd cc dddd [...] E5E6 | + | ii aa xx yy ww hh uu dd cc dddd [...] |
Room headers define rooms, they exist in bank $8F and room header pointers are what SMILE displays as a dropdown box for room selection. | Room headers define rooms, they exist in bank $8F and room header pointers are what SMILE displays as a dropdown box for room selection. | ||
- | They are variable length (due to the optional | + | They are variable length (due to the event header list) with '' |
- | The **event headers** define | + | The **state conditions list** defines |
- | Due to this, event headers | + | Due to this, state conditions |
<hidden **Area indices**> | <hidden **Area indices**> | ||
Line 31: | Line 31: | ||
| 7 | Debug | | | 7 | Debug | | ||
</ | </ | ||
+ | |||
Notes: | Notes: | ||
* The **room index** is almost unused, aside from some specific checks to do with atmospheric graphics in some areas. | * The **room index** is almost unused, aside from some specific checks to do with atmospheric graphics in some areas. | ||
* The **room width** may not exceed 15 due to the way block collision calculations are implemented | * The **room width** may not exceed 15 due to the way block collision calculations are implemented | ||
- | * **Room width** * **room height** may not exceed | + | * **Room width** * **room height** may not exceed |
- | * The **up scroller** defines the threshold Y position that Samus needs to exceed (relative to the screen) for the screen to start scolling | + | * The **up scroller** defines the threshold Y position that Samus needs to exceed (relative to the screen) for the screen to start scrolling |
- | * The **down scroller** defines the threshold Y position that Samus needs to exceed (relative to the screen) for the screen to start scolling | + | * The **down scroller** defines the threshold Y position that Samus needs to exceed (relative to the screen) for the screen to start scrolling |
* The **CRE bitset** defines some flags that affect how the CRE is loaded during door transitions: | * The **CRE bitset** defines some flags that affect how the CRE is loaded during door transitions: | ||
Line 44: | Line 45: | ||
| 4 | Load extra large tileset | | | 4 | Load extra large tileset | | ||
- | ===== Event header | + | ===== State conditions list ===== |
- | ____________ Event | + | ______________ State condition |
- | | _______ Event parameters | + | | _________ State condition |
- | | | | + | | | |
| | | | | | | | ||
- | eeee [...] ssss | + | eeee [...] ssss ; First state condition |
+ | eeee [...] ssss ; Second state condition | ||
+ | [...] ; Other state conditions | ||
+ | E5E6 ; Default state condition (terminator) | ||
- | **Events** are two-byte pointers to code in bank $8F that may have parameters | + | **State conditions** are two-byte pointers to code in bank $8F that may have parameters. |
- | If the check defined in the event is passed, the state header pointer | + | If the check defined in the **state conditions** |
- | The only exception is event $E5E6, the default | + | The only exception is state condition |
- | <hidden List of events | + | <hidden List of state conditions |
- | ^ Event ^ Event parameters | + | ^ Condition |
| $E5E6 | | Default | | | $E5E6 | | Default | | ||
| $E5EB | '' | | $E5EB | '' | ||
Line 69: | Line 73: | ||
Event numbers are given as follows: | Event numbers are given as follows: | ||
- | | 00 | Zebes is awake | | + | | 0 | Zebes is awake | |
- | | 01 | Shitroid ate sidehopper | | + | | 1 | Shitroid ate sidehopper | |
- | | 02 | Mother Brain' | + | | 2 | Mother Brain' |
- | | 03 | Zebetite 1 is destroyed | | + | | 3 | Zebetite 1 is destroyed | |
- | | 04 | Zebetite 2 is destroyed | | + | | 4 | Zebetite 2 is destroyed | |
- | | 05 | Zebetite 3 is destroyed | | + | | 5 | Zebetite 3 is destroyed | |
- | | 06 | Phantoon statue is grey | | + | | 6 | Phantoon statue is grey | |
- | | 07 | Ridley statue is grey | | + | | 7 | Ridley statue is grey | |
- | | 08 | Draygon statue is grey | | + | | 8 | Draygon statue is grey | |
- | | 09 | Kraid statue is grey | | + | | 9 | Kraid statue is grey | |
- | | 0A | Entrance to Tourian is unlocked | | + | | Ah | Entrance to Tourian is unlocked | |
- | | 0B | Maridia noobtube is broken | | + | | Bh | Maridia noobtube is broken | |
- | | 0C | Lower Norfair chozo has lowered the acid | | + | | Ch | Lower Norfair chozo has lowered the acid | |
- | | 0D | Shaktool cleared a path | | + | | Dh | Shaktool cleared a path | |
- | | 0E | Zebes timebomb set | | + | | Eh | Zebes timebomb set | |
- | | 0F | Critters escaped | | + | | Fh | Critters escaped | |
- | | 10 | 1st Metroid hall cleared | | + | | 10h | 1st Metroid hall cleared | |
- | | 11 | 1st Metroid shaft cleared | | + | | 11h | 1st Metroid shaft cleared | |
- | | 12 | 2nd Metroid hall cleared | | + | | 12h | 2nd Metroid hall cleared | |
- | | 13 | 2nd Metroid shaft cleared | | + | | 13h | 2nd Metroid shaft cleared | |
- | | 14 | //Unused// | | + | | 14h | //Unused// | |
- | | 15 | Outran speed booster lavaquake | | + | | 15h | Outran speed booster lavaquake | |
Boss bits are given as follows: | Boss bits are given as follows: | ||
Line 98: | Line 102: | ||
| 4 | Area torizo (Bomb Torizo, Golden Torizo) | | | 4 | Area torizo (Bomb Torizo, Golden Torizo) | | ||
</ | </ | ||
+ | |||
===== Door list ===== | ===== Door list ===== | ||
| | ||
| | | | ||
- | | | | + | | | |
| | | | | | | | ||
aaaa bbbb [...] | aaaa bbbb [...] | ||
Line 127: | Line 131: | ||
Door headers define doors, they exist in bank $83 and have a fixed length of 12 bytes. | Door headers define doors, they exist in bank $83 and have a fixed length of 12 bytes. | ||
The **door ASM** can execute any arbitrary ASM and is often used to set scroll values for the new room where the door would normally be hidden inside a red scroll. | The **door ASM** can execute any arbitrary ASM and is often used to set scroll values for the new room where the door would normally be hidden inside a red scroll. | ||
+ | If the **distance from door to spawn Samus** is negative (8000h..FFFFh), | ||
The **elevator properties** are as follows: | The **elevator properties** are as follows: | ||
Line 132: | Line 137: | ||
| 0x80 | Door is an elevator | | | 0x80 | Door is an elevator | | ||
| 0x40 | Switch map to new area | | | 0x40 | Switch map to new area | | ||
- | | 0x0i | Marks elevator i as used | | + | | 0x0i | Marks elevator |
The **orientation** values are as follows: | The **orientation** values are as follows: | ||
Line 152: | Line 157: | ||
| | | | | | | | | | | | | | | | ||
| | | | | | | | | | | | | | | | | | ||
- | | | | | | | | | | ________________________ | + | | | | | | | | | | __________________________ |
- | | | | | | | | | | | | + | | | | | | | | | | | _____________________ |
- | | | | | | | | | | | | ______________ | + | | | | | | | | | | | | ________________ |
- | | | | | | | | | | | | | _________ | + | | | | | | | | | | | | | ___________ |
- | | | | | | | | | | | | | | ____ Library background | + | | | | | | | | | | | | | | ______ |
- | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | |
- | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | |
llllll tt MM mm ffff eeee EEEE xx yy ssss xxxx AAAA pppp bbbb aaaa | llllll tt MM mm ffff eeee EEEE xx yy ssss xxxx AAAA pppp bbbb aaaa | ||
Line 233: | Line 238: | ||
| 7 | Song 2 | | | 7 | Song 2 | | ||
</ | </ | ||
+ | |||
Notes: | Notes: | ||
Line 259: | Line 265: | ||
==== Level data ==== | ==== Level data ==== | ||
+ | ssssssssssssssss ; Size of decompressed layer 1 data (2 x the number of blocks) | ||
+ | | ||
| | ||
| ___ Y flip | | ___ Y flip | ||
Line 264: | Line 272: | ||
| || _ Block number | | || _ Block number | ||
| ||| | | ||| | ||
- | ttttyxnnnnnnnnnn | + | ttttyxnnnnnnnnnn |
+ | ttttyxnnnnnnnnnn ; Second block | ||
+ | [...] ; Other blocks | ||
+ | |||
+ | bbbbbbbb | ||
+ | bbbbbbbb | ||
+ | [...] | ||
+ | |||
+ | Optional: | ||
+ | 0000yxnnnnnnnnnn ; First block layer 2 | ||
+ | 0000yxnnnnnnnnnn ; Second block layer 2 | ||
+ | [...] ; Other blocks layer 2 | ||
- | Level data is defined by specifying data for each 16px x 16px block for every block in the room. | + | Level data is defined by specifying data for each 16px x 16px block in the room. |
This data is split into layer 1 blocks, BTS and optionally layer 2 blocks. | This data is split into layer 1 blocks, BTS and optionally layer 2 blocks. | ||
- | Layer 1/2 are two bytes per block and BTS is one byte per block; layer 1 data is followed by BTS, followed by layer 2 (if used) in that order. | + | Layer 1/2 are two bytes per block, BTS is one byte per block, and a two byte " |
+ | The decompressed size is followed by layer 1 data, followed by BTS, followed by layer 2 (if used) in that order. | ||
Level data is compressed in ROM. | Level data is compressed in ROM. | ||
Layer 1 blocks uses the binary format shown above where: | Layer 1 blocks uses the binary format shown above where: | ||
- | * **Block type** specifies the primary type of the block: | + | * **Block type** specifies the primary type of the block |
- | + | ||
- | | 0 | Air | | + | |
- | | 1 | Slope | | + | |
- | | 2 | Spike air | | + | |
- | | 3 | Special air | | + | |
- | | 4 | Shootable air | | + | |
- | | 5 | Horizontal extension | | + | |
- | | 6 | Unused air | | + | |
- | | 7 | Bombable air | | + | |
- | | 8 | Solid block | | + | |
- | | 9 | Door block | | + | |
- | | Ah | Spike block | | + | |
- | | Bh | Special block | | + | |
- | | Ch | Shootable block | | + | |
- | | Dh | Vertical extension | | + | |
- | | Eh | Grapple block | | + | |
- | | Fh | Bombable block | | + | |
* **X/Y flip** flips the graphics of the block | * **X/Y flip** flips the graphics of the block | ||
* **Block number** specifies the index of the block into the tile table (provides the graphics of the block) | * **Block number** specifies the index of the block into the tile table (provides the graphics of the block) | ||
Line 296: | Line 298: | ||
Layer 2 blocks use the same format, except that they have no **block type** (they are padded with zeros instead). | Layer 2 blocks use the same format, except that they have no **block type** (they are padded with zeros instead). | ||
- | BTS data further specifies the type of a block, depending on the primary block type used, e.g. different slope types. | + | **BTS** data further specifies the type of a block, depending on the primary block type used, e.g. different slope types. |
+ | <hidden **Block types** and **BTS** values> | ||
+ | ^ Air types ^^ Solid types ^^ | ||
+ | | 0 | Air | 8 | Solid block | | ||
+ | | 1 | Slope | 9 | Door block | | ||
+ | | 2 | Spike air | Ah | Spike block | | ||
+ | | 3 | Special air | Bh | Special block | | ||
+ | | 4 | Shootable air | Ch | Shootable block | | ||
+ | | 5 | Horizontal extension | Dh | Vertical extension | | ||
+ | | 6 | Unused air | Eh | Grapple block | | ||
+ | | 7 | Bombable air | Fh | Bombable block | | ||
+ | |||
+ | ^ Block type ^^ BTS ^^ Description ^ | ||
+ | | 2 / Ah | Spike | 0 || Solid only. Generic spike (60 damage) | | ||
+ | | ::: | ::: | 1 || Solid only. Kraid' | ||
+ | | ::: | ::: | 2 || Air only. Air spike (10h damage) | | ||
+ | | ::: | ::: | 3 || Solid only. Draygon' | ||
+ | | ::: | ::: | Eh || Solid only. X-rayable block (used in Blue Brinstar boulder room) | | ||
+ | | ::: | ::: | Fh || Solid only. Enemy breakable block (used in Shaktool' | ||
+ | | 3 / Bh | Special | 0 || 1x1 respawning crumble block | | ||
+ | | ::: | ::: | 1 || 2x1 respawning crumble block | | ||
+ | | ::: | ::: | 2 || 1x2 respawning crumble block | | ||
+ | | ::: | ::: | 3 || 2x2 respawning crumble block | | ||
+ | | ::: | ::: | 4 || 1x1 crumble block | | ||
+ | | ::: | ::: | 5 || 2x1 crumble block | | ||
+ | | ::: | ::: | 6 || 1x2 crumble block | | ||
+ | | ::: | ::: | 7 || 2x2 crumble block | | ||
+ | | ::: | ::: | 8 || Air only. Rightwards treadmill, disabled in Wrecked Ship unless Phantoon is dead | | ||
+ | | ::: | ::: | 9 || Air only. Leftwards treadmill, disabled in Wrecked Ship unless Phantoon is dead | | ||
+ | | ::: | ::: | Ah || Air only. Rightwards treadmill, always on | | ||
+ | | ::: | ::: | Bh || Air only. Leftwards treadmill, always on | | ||
+ | | ::: | ::: | Eh || Respawning speed boost block | | ||
+ | | ::: | ::: | Fh || Speed boost block | | ||
+ | | ::: | ::: | 44h || Generic PLM shot trigger | | ||
+ | | ::: | ::: | 45h || Item collision detection | | ||
+ | | ::: | ::: | 46h || Scroll PLM trigger | | ||
+ | | ::: | ::: | 47h || Map station right access | | ||
+ | | ::: | ::: | 48h || Map station left access | | ||
+ | | ::: | ::: | 49h || Energy station right access | | ||
+ | | ::: | ::: | 4Ah || Energy station left access | | ||
+ | | ::: | ::: | 4Bh || Missile station right access | | ||
+ | | ::: | ::: | 4Ch || Missile station left access | | ||
+ | | ::: | ::: | 4Dh || Save station trigger | | ||
+ | | ::: | ::: | Crateria/ | ||
+ | | ::: | ::: | Brinstar | 80h | Floor plant | | ||
+ | | ::: | ::: | ::: | 81h | Ceiling plant | | ||
+ | | ::: | ::: | ::: | 82h | Respawning speed block, slower crumble animation | | ||
+ | | ::: | ::: | ::: | 83h | Speed block, slower crumble animation | | ||
+ | | ::: | ::: | ::: | 84h | Respawning speed block (used by dachora pit) | | ||
+ | | ::: | ::: | ::: | 85h | Speed boost block | | ||
+ | | ::: | ::: | Norfair | 83h | Lower Norfair chozo hand trigger | | ||
+ | | ::: | ::: | Wrecked Ship | 80h | Wrecked Ship chozo hand trigger | | ||
+ | | ::: | ::: | Maridia | 80h | Quicksand surface, can run on without sinking (used in snail room) | | ||
+ | | ::: | ::: | ::: | 81h | Quicksand surface | | ||
+ | | ::: | ::: | ::: | 82h | Quicksand surface | | ||
+ | | ::: | ::: | ::: | 83h | Submerging quicksand (used in sand falls rooms) | | ||
+ | | ::: | ::: | ::: | 84h | Sand falls - slow. Used in the ceilings of pre-Draygon mochtroid rooms (so basically unused) | | ||
+ | | ::: | ::: | ::: | 85h | Sand falls - fast | | ||
+ | | 7 / Fh | Bombable | 0 || 1x1 respawning bomb block | | ||
+ | | ::: | ::: | 1 || 2x1 respawning bomb block | | ||
+ | | ::: | ::: | 2 || 1x2 respawning bomb block | | ||
+ | | ::: | ::: | 3 || 2x2 respawning bomb block | | ||
+ | | ::: | ::: | 4 || 1x1 bomb block | | ||
+ | | ::: | ::: | 5 || 2x1 bomb block | | ||
+ | | ::: | ::: | 6 || 1x2 bomb block | | ||
+ | | ::: | ::: | 7 || 2x2 bomb block | | ||
+ | | 4 / Ch | Shootable | 0 || 1x1 respawning shot block | | ||
+ | | ::: | ::: | 1 || 2x1 respawning shot block | | ||
+ | | ::: | ::: | 2 || 1x2 respawning shot block | | ||
+ | | ::: | ::: | 3 || 2x2 respawning shot block | | ||
+ | | ::: | ::: | 4 || 1x1 shot block | | ||
+ | | ::: | ::: | 5 || 2x1 shot block | | ||
+ | | ::: | ::: | 6 || 1x2 shot block | | ||
+ | | ::: | ::: | 7 || 2x2 shot block | | ||
+ | | ::: | ::: | 8 || Respawning power bomb block | | ||
+ | | ::: | ::: | 9 || Power bomb block | | ||
+ | | ::: | ::: | Ah || Respawning super missile block | | ||
+ | | ::: | ::: | Bh || Super missile block | | ||
+ | | ::: | ::: | Ch || Fake super missile block (solid block but shows super missile block when x-rayed) | | ||
+ | | ::: | ::: | Dh || Fake super missile block | | ||
+ | | ::: | ::: | Eh || Fake super missile block | | ||
+ | | ::: | ::: | Fh || Fake super missile block | | ||
+ | | ::: | ::: | 10h || Gate blocks | | ||
+ | | ::: | ::: | 40h || Blue door facing left | | ||
+ | | ::: | ::: | 41h || Blue door facing right | | ||
+ | | ::: | ::: | 42h || Blue door facing up | | ||
+ | | ::: | ::: | 43h || Blue door facing down | | ||
+ | | ::: | ::: | 44h || Generic shot trigger | | ||
+ | | ::: | ::: | 45h || Item trigger | | ||
+ | | ::: | ::: | 46h || Left blue gate trigger | | ||
+ | | ::: | ::: | 47h || Right blue gate trigger | | ||
+ | | ::: | ::: | 48h || Left red gate trigger | | ||
+ | | ::: | ::: | 49h || Right red gate trigger | | ||
+ | | ::: | ::: | 4Ah || Left green gate trigger | | ||
+ | | ::: | ::: | 4Bh || Right green gate trigger | | ||
+ | | ::: | ::: | 4Ch || Left orange gate trigger | | ||
+ | | ::: | ::: | 4Dh || Right orange gate trigger | | ||
+ | | ::: | ::: | 4Fh || Critters escape block | | ||
+ | | Eh | Grapple block | 0 || Generic grapple block | | ||
+ | | ::: | ::: | 1 || Respawning crumbling grapple block | | ||
+ | | ::: | ::: | 2 || Non-respawning crumbling grapple block | | ||
+ | | ::: | ::: | 80h+ || Grapple-through block | | ||
+ | </ | ||
+ | |||
==== FX ==== | ==== FX ==== | ||
| | ||
Line 304: | Line 409: | ||
| | | | | | | | ||
| | | | | | | | | | ||
- | | | | | | | + | | | | | | |
- | | | | | | | | + | | | | | | | |
- | | | | | | | | | + | | | | | | | | |
- | | | | | | | | | | + | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | ||
| | | | | | | | | | ____ Animated tiles bitset | | | | | | | | | | | ____ Animated tiles bitset | ||
Line 315: | Line 420: | ||
dddd, | dddd, | ||
[...] ; Other FX entries | [...] ; Other FX entries | ||
- | 0000, | + | 0000, |
OR | OR | ||
Line 321: | Line 426: | ||
FFFF ; No FX | FFFF ; No FX | ||
+ | FX defines roomwide graphical effects, they' | ||
+ | A room either has a two byte '' | ||
+ | A door-dependent FX entries is used if the door taken into the room matches the entry' | ||
+ | |||
+ | <hidden **Layer 3 types**> | ||
+ | | 0 | None | | ||
+ | | 2 | Lava | | ||
+ | | 4 | Acid | | ||
+ | | 6 | Water | | ||
+ | | 8 | Spores | | ||
+ | | Ah | Rain | | ||
+ | | Ch | Fog | | ||
+ | | 20h | Scrolling sky | | ||
+ | | 22h | Unused | | ||
+ | | 24h | Fireflea | | ||
+ | | 26h | Tourian entrance statue | | ||
+ | | 28h | Ceres Ridley | | ||
+ | | 2Ah | Ceres elevator | | ||
+ | | 2Ch | Haze | | ||
+ | </ | ||
+ | |||
+ | <hidden **Layer blending configurations**> | ||
+ | | 2/Eh/20h | Normal. BG1/ | ||
+ | | 4 | Normal, but BG2 is disabled | Used by Phantoon | | ||
+ | | 6 | Normal, but sprites aren't affected by BG3 and sprites are added to BG1/BG2 (instead of hidden) | Unused | | ||
+ | | 8 | Normal, but BG1/sprites aren't affected by BG3 and sprites are added to BG2 (instead of hidden) | Used in some power off Wrecked Ship rooms | | ||
+ | | Ah | Normal, but BG1 isn't affected by BG3 | Used with FX layer 3 type = spores | | ||
+ | | Ch | Normal, but BG3 is disabled and colour math is subtractive | Used with FX layer 3 type = fireflea | | ||
+ | | 10h/12h | Normal, but BG3 is disabled inside window 1 | Used by morph ball eye and varia/ | ||
+ | | 14h/22h | Normal, but BG1 isn't affected by BG3 and colour math is subtractive | Sometimes use with FX layer 3 type = water | | ||
+ | | 16h | BG1/sprites are drawn after the result of drawing BG2/BG3 is subtracted | Sometimes use with FX layer 3 type = water | | ||
+ | | 18h/1Eh/30h | BG3 is drawn with the result of drawing BG1/ | ||
+ | | 1Ah | Normal, but BG2 and BG3 have reversed roles | Used by Phantoon | | ||
+ | | 1Ch | Normal, but BG2 and BG3 have reversed roles, colour addition is halved and backdrop is disabled | Unused | | ||
+ | | 24h | BG1/ | ||
+ | | 26h | Normal, but colour addition is halved | Unused | | ||
+ | | 28h | Normal, but BG3 is disabled, colour math is subtractive, | ||
+ | | 2Ah | Normal, but BG3 is disabled, colour math is subtractive, | ||
+ | | 2Ch | Normal, but BG3 is disabled | Used by FX layer 3 type = haze and torizos | | ||
+ | | 2Eh | Normal, but colour math is subtractive | Unused | | ||
+ | | 32h | Normal, but BG1 isn't affected by BG3 and colour math is subtractive | Unused | | ||
+ | | 34h | Normal, but power bombs don't affect BG2 | Unused | | ||
+ | </ | ||
+ | |||
+ | <hidden **Liquid options**> | ||
+ | | 1 | Liquid flows (leftwards) | | ||
+ | | 2 | Layer 2 is wavy | | ||
+ | | 4 | Liquid physics are disabled (used in n00b tube room) | | ||
+ | | 40h | Big tide (liquid fluctuates up and down, a la the gauntlet) | | ||
+ | | 80h | Small tide (liquid fluctuates up and down) | | ||
+ | </ | ||
+ | |||
==== Enemy population ==== | ==== Enemy population ==== | ||
| | ||
| | | | ||
| | | | | | ||
- | | | | | + | | | | |
| | | | | | | | | | ||
- | | | | | | | + | | | | | | |
| | | | | | | | | | | | | | ||
- | | | | | | | | _ General purpose parameter (speed2 | + | | | | | | | | _ General purpose parameter (speed 2 in SMILE) |
| | | | | | | | | | | | | | | | | | ||
iiii xxxx yyyy oooo pppp gggg aaaa bbbb ; First enemy | iiii xxxx yyyy oooo pppp gggg aaaa bbbb ; First enemy | ||
Line 335: | Line 492: | ||
[...] ; Other enemies | [...] ; Other enemies | ||
FFFF ; Terminator | FFFF ; Terminator | ||
- | | + | |
+ | |||
+ | Enemy population defines the placement of enemies, as well as some generic and enemy specific properties. | ||
+ | They' | ||
+ | The **initialisation parameter** is overwritten by generic enemy routines and so is often only used during enemy initialisation, | ||
+ | |||
+ | The **properties** are as follows: | ||
+ | |||
+ | | 8000h | Hitbox solid to Samus | | ||
+ | | 4000h | Respawns if killed | | ||
+ | | 2000h | Process instructions | | ||
+ | | 1000h | Block plasma beam | | ||
+ | | 800h | Process whilst off-screen | | ||
+ | | 400h | Intangible | | ||
+ | | 200h | Delete | | ||
+ | | 100h | Invisible | | ||
+ | |||
+ | The **extra properties** are as follows: | ||
+ | | 4 | Enable extended spritemap format | | ||
+ | | 1 | Disable enemy AI. Isn't disabled if intangible | | ||
==== Enemy set ==== | ==== Enemy set ==== | ||
Line 345: | Line 521: | ||
[...] ; Other enemies | [...] ; Other enemies | ||
FFFF ; Terminator | FFFF ; Terminator | ||
+ | |||
+ | Enemy set defines which enemies are allowed inside the room and which palette slot to use. | ||
+ | They' | ||
+ | Enemies that use the same palette may share the same palette index. | ||
+ | Valid palette indices are 1, 2, 3 and 7; note that only palette 7 is affected by colour math. | ||
==== Scroll ==== | ==== Scroll ==== | ||
Line 352: | Line 533: | ||
| | | | | | | | ||
aa bb [...] | aa bb [...] | ||
+ | |||
+ | Scrolls define how the camera works for each 16x16 block (256px x 256px) area in left-to-right, | ||
+ | They' | ||
+ | |||
+ | Scroll values are as follows: | ||
+ | |||
+ | | 0 | Red. Cannot scroll into this area | | ||
+ | | 1 | Blue. Hides the bottom 2 rows of the area | | ||
+ | | 2 | Green. Unrestricted | | ||
==== Special x-ray blocks ==== | ==== Special x-ray blocks ==== | ||
| | ||
| ____ Y position | | ____ Y position | ||
- | | | _ Block number | + | | | _ Block |
| | | | | | | | ||
xx yy nnnn ; First x-ray block | xx yy nnnn ; First x-ray block | ||
Line 362: | Line 552: | ||
[...] ; Other x-ray blocks | [...] ; Other x-ray blocks | ||
0000 ; Terminator | 0000 ; Terminator | ||
+ | |||
+ | Special x-ray blocks display custom x-ray graphics for blocks at given positions in the room. | ||
+ | They' | ||
+ | |||
+ | Special x-ray blocks are used in exactly one place in vanilla Super Metroid: the Bomb Torizo room during the escape sequence. | ||
+ | It's a hacky way of allowing Samus to x-ray the shootable block in the bottom-right corner of the screen. | ||
+ | Note that even after you've shot the shootable block, x-ray will still show the shootable block graphics. | ||
+ | |||
+ | 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. | ||
+ | |||
+ | Note that [[http:// | ||
==== PLM population ==== | ==== PLM population ==== | ||
Line 373: | Line 575: | ||
[...] ; Other PLMs | [...] ; Other PLMs | ||
0000 ; Terminator | 0000 ; Terminator | ||
+ | |||
+ | PLM population defines the placement of PLMs, as well as some PLM specific properties. | ||
+ | They' | ||
+ | |||
+ | PLMs with **PLM ID** >= $DF89 are considered to be "item PLMs", meaning the PLM argument specified in the PLM populations will be used as a unique ID and cannot be negative. | ||
==== Library background ==== | ==== Library background ==== | ||
Line 383: | Line 590: | ||
0000 ; Terminator | 0000 ; Terminator | ||
- | The list of types used in Super Metroid is as follows: | + | The list of commands |
^ Type ^ Parameters ^ Description ^ | ^ Type ^ Parameters ^ Description ^ | ||
Line 393: | Line 600: | ||
| 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. | ||