The current URL is datacrystal.tcrf.net.
EarthBound/Map Data/Palettes: Difference between revisions
(→Entry Ordering: Add formula to find individual palette) |
(→Format: Better documentation of format and add info about alternate palettes) |
||
Line 17: | Line 17: | ||
Each entry represents palette data for use by EarthBound map graphics for any sector. Each entry is itself comprised of 6 subpalettes (to create 6 different options for palettes to be used by any given map minitile), each comprised of 16 [[Super_Nintendo:Color|colors]]. | Each entry represents palette data for use by EarthBound map graphics for any sector. Each entry is itself comprised of 6 subpalettes (to create 6 different options for palettes to be used by any given map minitile), each comprised of 16 [[Super_Nintendo:Color|colors]]. | ||
Because the first color in each palette is generally ignored by the SNES and treated as transparent, EarthBound uses the bytes for that first color to instead stash some control data about the palette. | |||
Colors are stored as little endian (2 bytes): | ''Terminology Note: What the EarthBound modding community (and this page) generally refers to as a "subpalette" is itself referred to in the SNES development guide as a "palette", and therefore the grouping of 6 of those, which is generally referred to in EarthBound modding (and in this page) as a "palette" (at least in the context of map changes), would in general SNES development be a group of palettes.'' | ||
===Alternate Palette Flag<span class="anchor" id="AlternatePaletteFlag"></span>=== | |||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x00</tt>|valrange=<tt>0x0000-0xffff</tt>}} | |||
If non-zero, directs that the palette will be replaced by an alternate (designated by [[#AlternatePalettePointer|Alternate Palette Pointer]]), depending on [[EarthBound:Flags|flag]] values. | |||
;Bits <tt>0x7ffff</tt> | |||
: A flag number to check. Note that this allows up to 32767 flag numbers, but most of these bits will always be zero in unmodified EarthBound where the highest possible flag is 1024. There are however popular mods that greatly increase the number of possible flags | |||
;Bit <tt>0x8000</tt> | |||
: Alternate palette will be used if this bit matches the checked flag's status | |||
For example, given a value <code>0x01a6</code>, the alternate palette will be used if flag <tt>422</tt> (<tt>FLG_ONET_DAYBREAK</tt>) is not set (vs it would be looking for the flag to be set if <tt>0x8000</tt> were 1). This is the value used in the main Onett palette to instead use the "nighttime" palette until the flag is set to make the game "daytime". | |||
===Subpalette 0<span class="anchor" id="Subpalette0"></span>=== | |||
{{table el|len=<tt>30</tt> bytes (<tt>0x1e</tt>)|loc=<tt>0x02</tt>|valrange=[[Super_Nintendo:Color|color]] values}} | |||
15-color subpalette. Combined with [[#AlternatePaletteFlag|Alternate Palette Flag]] as the first ignored transparent "color" to create a 16-color subpalette. | |||
Colors are each stored as little endian (2 bytes): | |||
gggrrrrr 0bbbbbgg | gggrrrrr 0bbbbbgg | ||
The subpalette is formatted as 15 colors in a row. | |||
===Alternate Palette Pointer<span class="anchor" id="AlternatePalettePointer"></span>=== | |||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x20</tt>|valrange=<tt>0x0000-0xffff</tt>}} | |||
2-byte pointer to an alternative palette. Combined with the bank used in the first entry of the [[EarthBound:Map_Data:Palette_Pointer_Table|Palette Pointer Table]], which is <tt>$DA</tt> in unmodified EarthBound where all map palettes are always stored in a single block within that bank. | |||
See [[#AlternatePaletteFlag|Alternate Palette Flag]] for behavior of when the alternate palette pointer is used. | |||
===Subpalette 1=== | |||
{{table el|len=<tt>30</tt> bytes (<tt>0x1e</tt>)|loc=<tt>0x22</tt>|valrange=[[Super_Nintendo:Color|color]] values}} | |||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | |||
===Unknown=== | |||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x40</tt>|valrange=???}} | |||
===Subpalette 2=== | |||
{{table el|len=<tt>30</tt> bytes (<tt>0x1e</tt>)|loc=<tt>0x42</tt>|valrange=[[Super_Nintendo:Color|color]] values}} | |||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | |||
===Unknown=== | |||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x60</tt>|valrange=???}} | |||
===Subpalette 3=== | |||
{{table el|len=<tt>30</tt> bytes (<tt>0x1e</tt>)|loc=<tt>0x62</tt>|valrange=[[Super_Nintendo:Color|color]] values}} | |||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | |||
===Unknown=== | |||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x80</tt>|valrange=???}} | |||
===Subpalette 4=== | |||
{{table el|len=<tt>30</tt> bytes (<tt>0x1e</tt>)|loc=<tt>0x82</tt>|valrange=[[Super_Nintendo:Color|color]] values}} | |||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | |||
===Unknown=== | |||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0xa0</tt>|valrange=???}} | |||
===Subpalette 5=== | |||
{{table el|len=<tt>30</tt> bytes (<tt>0x1e</tt>)|loc=<tt>0xa2</tt>|valrange=[[Super_Nintendo:Color|color]] values}} | |||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | |||
==Entry Ordering== | |||
Palettes are ordered first by tileset number (from the [[EarthBound:Map_Data:Global_Tileset/Palette_Table|Global Tileset/Palette Table]]), then within each tileset by the palette number (also from the Global Tileset/Palette Table). Because different tilesets have different numbers of palettes, a lookup to the [[EarthBound:Map_Data:Palette_Pointer_Table|Palette Pointer Table]] is used to find a pointer to the first palette for any given tileset. The individual palette address can then be found using the following formula: <code>palette_pointer = first_palette_pointer_from_pointer_table + 0xC0 * palette_number</code> | Palettes are ordered first by tileset number (from the [[EarthBound:Map_Data:Global_Tileset/Palette_Table|Global Tileset/Palette Table]]), then within each tileset by the palette number (also from the Global Tileset/Palette Table). Because different tilesets have different numbers of palettes, a lookup to the [[EarthBound:Map_Data:Palette_Pointer_Table|Palette Pointer Table]] is used to find a pointer to the first palette for any given tileset. The individual palette address can then be found using the following formula: <code>palette_pointer = first_palette_pointer_from_pointer_table + 0xC0 * palette_number</code> | ||
[[Category:EarthBound:Map_Data|Palettes]] | [[Category:EarthBound:Map_Data|Palettes]] |
Revision as of 16:26, 26 June 2023
This is a sub-page of EarthBound/Map Data.
Map Palettes | |
Game | EarthBound |
Start Address | 0x1A7EA7 |
End Address | 0x1AFCA6 |
# of Entries | 168 |
Entry Length | 192 bytes (0xC0) |
Total Length | 32256 bytes (0x7E00) |
Back to the ROM map |
Data block of the palette data used for game maps.
Format
Each entry represents palette data for use by EarthBound map graphics for any sector. Each entry is itself comprised of 6 subpalettes (to create 6 different options for palettes to be used by any given map minitile), each comprised of 16 colors.
Because the first color in each palette is generally ignored by the SNES and treated as transparent, EarthBound uses the bytes for that first color to instead stash some control data about the palette.
Terminology Note: What the EarthBound modding community (and this page) generally refers to as a "subpalette" is itself referred to in the SNES development guide as a "palette", and therefore the grouping of 6 of those, which is generally referred to in EarthBound modding (and in this page) as a "palette" (at least in the context of map changes), would in general SNES development be a group of palettes.
Alternate Palette Flag
- Length: 2 bytes (0x2)
- Offset within entry: 0x00
- Range of values: 0x0000-0xffff
If non-zero, directs that the palette will be replaced by an alternate (designated by Alternate Palette Pointer), depending on flag values.
- Bits 0x7ffff
- A flag number to check. Note that this allows up to 32767 flag numbers, but most of these bits will always be zero in unmodified EarthBound where the highest possible flag is 1024. There are however popular mods that greatly increase the number of possible flags
- Bit 0x8000
- Alternate palette will be used if this bit matches the checked flag's status
For example, given a value 0x01a6
, the alternate palette will be used if flag 422 (FLG_ONET_DAYBREAK) is not set (vs it would be looking for the flag to be set if 0x8000 were 1). This is the value used in the main Onett palette to instead use the "nighttime" palette until the flag is set to make the game "daytime".
Subpalette 0
- Length: 30 bytes (0x1e)
- Offset within entry: 0x02
- Range of values: color values
15-color subpalette. Combined with Alternate Palette Flag as the first ignored transparent "color" to create a 16-color subpalette.
Colors are each stored as little endian (2 bytes):
gggrrrrr 0bbbbbgg
The subpalette is formatted as 15 colors in a row.
Alternate Palette Pointer
- Length: 2 bytes (0x2)
- Offset within entry: 0x20
- Range of values: 0x0000-0xffff
2-byte pointer to an alternative palette. Combined with the bank used in the first entry of the Palette Pointer Table, which is $DA in unmodified EarthBound where all map palettes are always stored in a single block within that bank.
See Alternate Palette Flag for behavior of when the alternate palette pointer is used.
Subpalette 1
- Length: 30 bytes (0x1e)
- Offset within entry: 0x22
- Range of values: color values
15-color subpalette. Same format as Subpalette 0.
Unknown
- Length: 2 bytes (0x2)
- Offset within entry: 0x40
- Range of values: ???
Subpalette 2
- Length: 30 bytes (0x1e)
- Offset within entry: 0x42
- Range of values: color values
15-color subpalette. Same format as Subpalette 0.
Unknown
- Length: 2 bytes (0x2)
- Offset within entry: 0x60
- Range of values: ???
Subpalette 3
- Length: 30 bytes (0x1e)
- Offset within entry: 0x62
- Range of values: color values
15-color subpalette. Same format as Subpalette 0.
Unknown
- Length: 2 bytes (0x2)
- Offset within entry: 0x80
- Range of values: ???
Subpalette 4
- Length: 30 bytes (0x1e)
- Offset within entry: 0x82
- Range of values: color values
15-color subpalette. Same format as Subpalette 0.
Unknown
- Length: 2 bytes (0x2)
- Offset within entry: 0xa0
- Range of values: ???
Subpalette 5
- Length: 30 bytes (0x1e)
- Offset within entry: 0xa2
- Range of values: color values
15-color subpalette. Same format as Subpalette 0.
Entry Ordering
Palettes are ordered first by tileset number (from the Global Tileset/Palette Table), then within each tileset by the palette number (also from the Global Tileset/Palette Table). Because different tilesets have different numbers of palettes, a lookup to the Palette Pointer Table is used to find a pointer to the first palette for any given tileset. The individual palette address can then be found using the following formula: palette_pointer = first_palette_pointer_from_pointer_table + 0xC0 * palette_number