Mother 3/RAS block: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
m (Xkeeper moved page MOTHER 3:RAS block to MOTHER 3/RAS block: normalize subpages and titles)
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Overview==
{{subpage}}
RAS is a block that's only used for the [[MOTHER_3:Battle_background_layer/master_table|battle background layer/master]] table. For consistency with the other named data structures, the format is explained on this page, rather than on the battle data pages.
 
RAS is a block that's only used for the [[Mother 3/Battle background layer/master table|battle background layer/master]] table. For consistency with the other named data structures, the format is explained on this page, rather than on the battle data pages.


==Format==
==Format==
Line 48: Line 49:


===Graphics/arrangement entries===
===Graphics/arrangement entries===
These values correspond to indices in the [[MOTHER_3:Battle_background_data_table|battle background data table]].
These values correspond to indices in the [[Mother 3/Battle background data table|battle background data table]].


===Palettes===
===Palettes===
Line 104: Line 105:
The master entries immediately follow the layer entries. There are 243 (0xF3) master entries. Each entry uses 12 (0xC) bytes. Each master entry contains information for two background layers.
The master entries immediately follow the layer entries. There are 243 (0xF3) master entries. Each entry uses 12 (0xC) bytes. Each master entry contains information for two background layers.


These entries correspond to the [[MOTHER_3:Enemy_data#Battle_background|battle background numbers in the enemy data table]].
These entries correspond to the [[Mother 3/Enemy data#Battle background|battle background numbers in the enemy data table]].


===Master entry format===
===Master entry format===
Line 121: Line 122:
The alpha values must sum to 16 (0x10). These are used to blend the two layers together.
The alpha values must sum to 16 (0x10). These are used to blend the two layers together.


[[Category:MOTHER 3 named data structures|RAS]]
[[Category:Mother 3 named data structures|RAS]]
[[Category:MOTHER 3|RAS]]
[[Category:Mother 3|RAS]]

Latest revision as of 02:20, 20 May 2024

This is a sub-page of Mother 3.

RAS is a block that's only used for the battle background layer/master table. For consistency with the other named data structures, the format is explained on this page, rather than on the battle data pages.

Format

  • 00-03 (04) = "ras " header
  • 04-05 (02) = Number of layer entries
  • 06-07 (02) = Number of master entries
  • 08-.. (..) = Layer entries
  • ..-.. (..) = Master entries
  • ..-.. (04) = "~ras" footer

Layer entries

The layer entries immediately follow the 8-byte header. In the battle background data table, there are 546 (0x222) layer entries. Each entry uses 144 (0x90) bytes. Each entry contains animation information for its associated battle background layer.

Layer entry format

Table view

       00   01   02   03   04   05   06   07   08   09   0A   0B   0C   0D   0E   0F
    +--------------------------------------------------------------------------------
00  | [   A   ] [   B   ] [                            C                           ->
10  | <-                                     C                                     ->
20  | <-                                     C                                     ->
30  | <-                                     C                                     ->
40  | <-        C       ] [   D   ] [   ?   ] [   E   ] [   F   ] [   G   ] [   ?  ->
50  | <-                                     ?                                     ->
60  | <-                                     ?                                     ->
70  | <-        ?       ] [   H   ] [   I   ] [        ?        ] [   J   ] [   K   ]
80  | [   L   ] [   M   ] [   N   ] [   O   ] [                  ?                  ]

Graphics/arrangement entries

These values correspond to indices in the battle background data table.

Palettes

Each layer has two palettes. Any references to higher palette numbers in the arrangement data should be ignored (binary-AND the palette number with 0x1).

Palette rotation

The battle backgrounds have a feature which allows the palettes to cycle through colors. There are four known parameters: direction, start, end, and speed.

The direction value isn't fully known. Known values are:

00 = No rotation
01 = Backwards
02 = Forwards
03 = Backwards
04 = Backwards
05 = No rotation

The start and end values denote the range of cycled colors. Both values are inclusive.

The delay value denotes how many frames of delay are in between each cycle. 0x01 means the shortest delay (0x00 will yield no apparent motion), and 0xFF means the longest delay.

Distortion parameters

Each layer also has a number of distortion parameters to achieve various visual effects. One can calculate the horizontal and vertical offset of each scanline using the following approximate formula:

Offset = (Velocity * Time / 256) + Amplitude * sin(360 * Wavenumber * ([Frequency * Time / 65536] + [Y / 256])

Where:

  • Offset is in pixels
  • Time is in frames
  • Y is the scanline number
  • sin is using degrees

Velocity

Velocity controls how fast the layer moves in the X or Y direction. This value is signed: a positive value means right (for horizontal) or down (for vertical).

Amplitude

Amplitude controls how far the distortion travels in the X or Y direction. This value is signed.

Wavenumber

Wavenumber controls the spacial frequency of distortion. This value is signed.

Frequency

Frequency controls how fast the distortion occurs over time. This value is signed.


Master entries

The master entries immediately follow the layer entries. There are 243 (0xF3) master entries. Each entry uses 12 (0xC) bytes. Each master entry contains information for two background layers.

These entries correspond to the battle background numbers in the enemy data table.

Master entry format

  • 00-01 (02) = [ A ] Layer 1 number (corresponds to the layer entries above)
  • 02-03 (02) = [ B ] Layer 2 number (corresponds to the layer entries above)
  • 04-05 (02) = [ C ] Alpha 1
  • 06-07 (02) = [ D ] Alpha 2
  • 08-0B (04) = Unclassified data

Table view

       00   01   02   03   04   05   06   07   08   09   0A   0B   0C   0D   0E   0F
    +--------------------------------------------------------------------------------
00  | [   A   ] [   B   ] [   C   ] [   D   ] [        ?        ]

Alpha

The alpha values must sum to 16 (0x10). These are used to blend the two layers together.