User Tools

Site Tools


super:technical_information:data_structures

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
super:technical_information:data_structures [2019/02/14 23:55] – Enemy projectiles, animated tiles objects, HDMA objects p.jboysuper:technical_information:data_structures [2019/05/31 14:51] – [Door header] Noted negative Samus door offset p.jboy
Line 1: Line 1:
 ====== Room header ====== ====== Room header ======
-   _______________________________________ Room index +   ____________________________________ Room index 
-  |   ____________________________________ Area index +  |   _________________________________ Area index 
-  |  |   _________________________________ X position (of top left corner) on the map +  |  |   ______________________________ X position (of top left corner) on the map 
-  |  |  |   ______________________________ Y position (of top left corner) on the map +  |  |  |   ___________________________ Y position (of top left corner) on the map 
-  |  |  |  |   ___________________________ Room width (in units of screens = 16 blocks = 256 pixels) +  |  |  |  |   ________________________ Room width (in units of screens = 16 blocks = 256 pixels) 
-  |  |  |  |  |   ________________________ Room height (in units of screens = 16 blocks = 256 pixels) +  |  |  |  |  |   _____________________ Room height (in units of screens = 16 blocks = 256 pixels) 
-  |  |  |  |  |  |   _____________________ Up scroller +  |  |  |  |  |  |   __________________ Up scroller 
-  |  |  |  |  |  |  |   __________________ Down scroller +  |  |  |  |  |  |  |   _______________ Down scroller 
-  |  |  |  |  |  |  |  |   _______________ CRE bitset +  |  |  |  |  |  |  |  |   ____________ CRE bitset 
-  |  |  |  |  |  |  |  |  |   ____________ Door list pointer +  |  |  |  |  |  |  |  |  |   _________ Door list pointer 
-  |  |  |  |  |  |  |  |  |  |     _______ Optional event headers +  |  |  |  |  |  |  |  |  |  |     ____ Event header 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 event headers) with ''E5E6'' as an effective terminator.+They are variable length (due to the event header list) with ''E5E6'' as terminator.
  
-The **event headers** define conditions to load alternative state headers, they are checked //in order// and the first event header whose check passes is to determine the state header to load.+The **event header list** defines conditions to load alternative state headers, they are checked //in order// and the first event header whose check passes is to determine the state header to load.
 Due to this, event headers must be specified in backwards chronological order. Due to this, event headers must be specified in backwards chronological order.
  
Line 45: Line 45:
 | 4 | Load extra large tileset | | 4 | Load extra large tileset |
  
-===== Event header ===== +===== Event header list ===== 
-   ____________ Event +   ______________ Event condition 
-  |     _______ Event parameters +  |     _________ Event condition parameters 
-  |    |      State header pointer+  |    |      ___ State header pointer
   |    |     |   |    |     |
-  eeee [...] ssss+  eeee [...] ssss ; First event header 
 +  eeee [...] ssss ; Second event header 
 +  [...]           ; Other event headers 
 +  E5E6            ; Default event header (terminator)
  
-**Events** are two-byte pointers to code in bank $8F that may have parameters depending on the event in question. +**Events conditions** are two-byte pointers to code in bank $8F that may have parameters depending on the event in question. 
-If the check defined in the event is passed, the state header pointer for that event is used to load the room. +If the check defined in the **event conditions** is passed, the **state header pointer** in that event header is used to load the room. 
-The only exception is event $E5E6, the default event, which doesn't have a state header pointer (the default state header simply follows this event header instead).+The only exception is event condition $E5E6, the default event, which doesn't have a **state header pointer** (the default state header simply follows this event header instead).
  
 <hidden List of events used in Super Metroid> <hidden List of events used in Super Metroid>
-Event Event parameters ^ Description ^+Condition Parameters ^ Description ^
 | $E5E6 | | Default | | $E5E6 | | Default |
 | $E5EB | ''dddd'' | Check passes if the current door pointer = ''d'' | | $E5EB | ''dddd'' | Check passes if the current door pointer = ''d'' |
Line 86: Line 89:
 | Eh | Zebes timebomb set | | Eh | Zebes timebomb set |
 | Fh | 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 128: 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 standard value of 0x00C8 is used for horizontal doors or 0x0180 for vertical doors.
  
 The **elevator properties** are as follows: The **elevator properties** are as follows:
Line 133: 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 index i as used |
  
 The **orientation** values are as follows: The **orientation** values are as follows:
Line 153: Line 157:
   |      |  |  |  |    |    |     ________________________________ Layer 2 scroll X   |      |  |  |  |    |    |     ________________________________ Layer 2 scroll X
   |      |  |  |  |    |    |    |   _____________________________ Layer 2 scroll Y   |      |  |  |  |    |    |    |   _____________________________ Layer 2 scroll Y
-  |      |  |  |  |    |    |    |  |     ________________________ Scroll +  |      |  |  |  |    |    |    |  |   __________________________ Scroll 
-  |      |  |  |  |    |    |    |  |         __________________ Special x-ray blocks +  |      |  |  |  |    |    |    |  |      _____________________ Special x-ray blocks 
-  |      |  |  |  |    |    |    |  |    |    |     ______________ Main ASM (FX2 in old SMILE) +  |      |  |  |  |    |    |    |  |  |    |     ________________ Main ASM (FX2 in old SMILE) 
-  |      |  |  |  |    |    |    |  |    |    |    |     _________ PLM population +  |      |  |  |  |    |    |    |  |  |    |    |     ___________ PLM population 
-  |      |  |  |  |    |    |    |  |    |    |    |    |     ____ Library background +  |      |  |  |  |    |    |    |  |  |    |    |    |     ______ Library background 
-  |      |  |  |  |    |    |    |  |    |    |    |    |    |   _ Setup ASM (Layer1_2 in old SMILE) +  |      |  |  |  |    |    |    |  |  |    |    |    |    |     _ Setup ASM (Layer1_2 in old SMILE) 
-  |      |  |  |  |    |    |    |  |    |    |    |    |    |  |+  |      |  |  |  |    |    |    |  |  |    |    |    |    |    |
   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 549: Line 553:
 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://metroidconstruction.com/resource.php?id=54|flexglow]] uses this pointer for the flexglow table instead.
  
 ==== PLM population ==== ==== PLM population ====
Line 704: Line 710:
  
 The **table timer** is how many frames to wait until the next instruction in the instruction list is proceeded to. 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:
 +   ______ Initialisation ASM pointer
 +  |     _ Instruction list pointer
 +  |    |
 +  aaaa iiii
 +
 +The **special instructions** for palette FX objects have the format:
 +   ______ Palette timer
 +  |     _ 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 ''(p * 10h + c) * 2'' where ''p'' is the palette number and ''c'' is the colour index within the palette.
 +
 +**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.
  
super/technical_information/data_structures.txt · Last modified: 2024/03/22 16:09 by p.jboy