Anonymous

Changes

From Final Fantasy Inside

FF7/Field/Palette

998 bytes removed, 05:14, 23 May 2019
m
6 revisions imported
=== Section 4: Palette ([[User:Terence_Fergusson|Terence Fergusson]] & [[User:Myst6re|Terence Fergussonmyst6re]]) ===
The following is an overview of the palette data.
==== Section 4 Format ====
{| borderclass="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="centerwikitable"! style="background:rgb(204,204,204)" align="center" | Offset! style="background:rgb(204,204,204)" align="center" | Size! style="background:rgb(204,204,204); width: 250px" align="center" | Description
|-
|style="background:rgb(255,255,255)" | 0x00|style="background:rgb(255,255,255)" | 2 4 bytes|style="background:rgb(255,255,255)" | Length (Repeat of previous length header)
|-
|style="background:rgb(255,255,204)" | 0x020x04|style="background:rgb(255,255,204)" | 2 bytes|style="background:rgb(255,255,204)" | Unknown PalX
|-
|style="background:rgb(255,255,204)" | 0x040x06|style="background:rgb(255,255,204)" | 1 byte2 bytes|style="background:rgb(255,255,204)" | Unknown (often blank) PalY
|-
|style="background:rgb(255,255,255)" | 0x050x08|style="background:rgb(255,255,255)" | 4 2 bytes|style="background:rgb(255,255,255)" | Number of colors in palette
|-
|style="background:rgb(255,255,204)" | 0x090x0A|style="background:rgb(255,255,204)" | 1 byte2 bytes|style="background:rgb(255,255,204)" | Unknown (often blank) Number of palettes
|-
|style="background:rgb(255,255,255)" | 0x0A0x0C|style="background:rgb(255,255,255Number of palettes)" | Varies|style="background:rgb* (255,255,255Number of colors in palette)" * 2| Palette data
|}
After the first length indicator comes another integer, also indicating length. Useless, but it's there.<br /> Then there's one more integertwo bytes; unknown purposepalX, useful for the PS version only (always 0).<br /> Then one bytetwo bytes again; unknown palY, useful for the PS version only (blank oftenalways 480).<br /> Then a wordtwo bytes; number of colors in the palette plus one(always 256). No idea why. You can work numcolors out from the section length, but FF7 stores it anyway<br /> Then two bytes; why add one? Dunno.One more byte; unknown (blank often)number of palettes.<br /> Then the actual palette data.
Each palette entry is a 16-bit color. This is unusual - normally palettes store as high quality data as possible, usually 24/32 bit. However since FF7 only ever runs in 16 bit I guess there isn't much point storing any other kind of data. Actually, the data is 15-bit (1 mask bit, 5-bit RedBlue, 5-bit Green, and 5-bit Blue, and 1 mask bitRed).
{| borderclass="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="centerwikitable"! style="background:rgb(204,204,204)" aligncolspan="center16" colspanalign="16center" | Palette Data
|-
|style="background:rgb(255,255,255)" colspan="51" | RedMask|style="background:rgb(255,255,255)" colspan="5" | GreenBlue|style="background:rgb(255,255,255)" colspan="5" | Blue Green|style="background:rgb(255,255,255)" colspan="15" | MaskRed (LSB)
|-
|style="background:rgb(255,255,255)" align="center" | rm|style<font color="background:rgb(255,255,255)blue" | r> b </font>|style<font color="background:rgb(255,255,255)blue" | r> b </font>|style<font color="background:rgb(255,255,255)blue" | r> b </font>|style<font color="background:rgb(255,255,255)blue" | r> b </font>|style<font color="background:rgb(255,255,255)blue" | g> b </font>|style<font color="background:rgb(255,255,255)green" | > g</font>|style<font color="background:rgb(255,255,255)green" | > g</font>|style<font color="background:rgb(255,255,255)green" | > g</font>|style<font color="background:rgb(255,255,255)green" | > g</font>|style<font color="background:rgb(255,255,255)green" | b> g </font>|style<font color="background:rgb(255,255,255)red" | b> r </font>|style<font color="background:rgb(255,255,255)red" | b> r </font>|style<font color="background:rgb(255,255,255)red" | b> r </font>|style<font color="background:rgb(255,255,255)red" | b> r </font>|style<font color="background:rgb(255,255,255)red" align="center" | m> r </font>
|}
Palettes generally contain a number of colors that's a multiple of 256. This is because the palette is split up into 256-color 'pages' internally. So the first color is page 0/color 0. Color 256 is page 1/color 0. Color 628 is page 2/color 116. You'll see why in the [[FF7/Field/Background|background]] section.