The current URL is datacrystal.tcrf.net.
EarthBound/Map Data/Palettes: Difference between revisions
(→Format: Better documentation of format and add info about alternate palettes) |
m (Xkeeper moved page EarthBound:Map Data:Palettes to EarthBound/Map Data/Palettes: normalize subpages and titles) |
||
(7 intermediate revisions by one other user not shown) | |||
Line 25: | Line 25: | ||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x00</tt>|valrange=<tt>0x0000-0xffff</tt>}} | {{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. | 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. The alternate palette will then itself have its Alternate Palette Flag checked to determine if it should be replaced by another alternate palette. | ||
;Bits <tt>0x7ffff</tt> | ;Bits <tt>0x7ffff</tt> | ||
Line 59: | Line 59: | ||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | 15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | ||
=== | ===Sprite Palette Replacement Index=== | ||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x40</tt>|valrange= | {{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x40</tt>|valrange=<tt>0x0000-0x000F</tt>}} | ||
If non-zero, contains a subpalette index, counting all EarthBound subpalettes, not just the map subpalettes, from RAM addresses <tt>$7E0200-$7E03FF</tt>, except subpalette zero at <tt>$7E0200</tt> cannot be selected because the index is ignored if zero. The selected subpalette will completely replace sprite subpalette 3 (loaded into RAM at <tt>$7E0380-$7E039F</tt>). | |||
Used to bring a map subpalette into sprite subpalettes for the occasions where a map element needs to be created using sprites, e.g. to animate [https://earthbound.fandom.com/wiki/Lost_Underworld Lost Underworld] geysers. | |||
===Subpalette 2=== | ===Subpalette 2=== | ||
Line 69: | Line 73: | ||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | 15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | ||
=== | ===Palette Animation Index<span class="anchor" id="PaletteAnimationIndex"></span>=== | ||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x60</tt>|valrange= | {{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x60</tt>|valrange=0x0000-0x001f}} | ||
If non-zero, contains one plus index into [[EarthBound:Map_Data:Palette_Animation_Pointer_Table|Palette Animation Pointer Table]]. | |||
===Subpalette 3=== | ===Subpalette 3=== | ||
Line 79: | Line 85: | ||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | 15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | ||
=== | ===Unused=== | ||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x80</tt>|valrange= | {{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0x80</tt>|valrange=<tt>0x0000-0xffff</tt>}} | ||
Unused zero color that will always be treated as transparent, no matter its value. Always <tt>0x0000</tt> in unmodified EarthBound. | |||
===Subpalette 4=== | ===Subpalette 4=== | ||
Line 89: | Line 97: | ||
15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | 15-color subpalette. Same format as [[#Subpalette0|Subpalette 0]]. | ||
=== | ===Unused=== | ||
{{table el|len=<tt>2</tt> bytes (<tt>0x2</tt>)|loc=<tt>0xa0</tt>|valrange=<tt>0x0000-0xffff</tt>}} | |||
Unused zero color that will always be treated as transparent, no matter its value. Always <tt>0x0000</tt> in unmodified EarthBound. | |||
===Subpalette 5=== | ===Subpalette 5=== |
Latest revision as of 02:41, 24 January 2024
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. The alternate palette will then itself have its Alternate Palette Flag checked to determine if it should be replaced by another alternate palette.
- 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.
Sprite Palette Replacement Index
- Length: 2 bytes (0x2)
- Offset within entry: 0x40
- Range of values: 0x0000-0x000F
If non-zero, contains a subpalette index, counting all EarthBound subpalettes, not just the map subpalettes, from RAM addresses $7E0200-$7E03FF, except subpalette zero at $7E0200 cannot be selected because the index is ignored if zero. The selected subpalette will completely replace sprite subpalette 3 (loaded into RAM at $7E0380-$7E039F).
Used to bring a map subpalette into sprite subpalettes for the occasions where a map element needs to be created using sprites, e.g. to animate Lost Underworld geysers.
Subpalette 2
- Length: 30 bytes (0x1e)
- Offset within entry: 0x42
- Range of values: color values
15-color subpalette. Same format as Subpalette 0.
Palette Animation Index
- Length: 2 bytes (0x2)
- Offset within entry: 0x60
- Range of values: 0x0000-0x001f
If non-zero, contains one plus index into Palette Animation Pointer Table.
Subpalette 3
- Length: 30 bytes (0x1e)
- Offset within entry: 0x62
- Range of values: color values
15-color subpalette. Same format as Subpalette 0.
Unused
- Length: 2 bytes (0x2)
- Offset within entry: 0x80
- Range of values: 0x0000-0xffff
Unused zero color that will always be treated as transparent, no matter its value. Always 0x0000 in unmodified EarthBound.
Subpalette 4
- Length: 30 bytes (0x1e)
- Offset within entry: 0x82
- Range of values: color values
15-color subpalette. Same format as Subpalette 0.
Unused
- Length: 2 bytes (0x2)
- Offset within entry: 0xa0
- Range of values: 0x0000-0xffff
Unused zero color that will always be treated as transparent, no matter its value. Always 0x0000 in unmodified EarthBound.
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