Color Palettes - XCOM:EU 2012

From Nexus Mods Wiki
Revision as of 10:52, 2 September 2014 by Dubiousintent (talk | contribs) (Updated references)
Jump to: navigation, search

Overview

The Color Palettes used in the Unit Customization options in the Barracks are populated by XComGame.XComContentManager. The native functions in this class are directed by entries in DefaultContent.INI.

 ColorPaletteInfo=(Palette=ePalette_HairColor,ArchetypeName="UnitPalettes.HairColor")
 ColorPaletteInfo=(Palette=ePalette_ShirtColor,ArchetypeName="UnitPalettes.ShirtColor")
 ColorPaletteInfo=(Palette=ePalette_PantsColor,ArchetypeName="UnitPalettes.PantsColor")
 ColorPaletteInfo=(Palette=ePalette_FormalClothesColor,ArchetypeName="UnitPalettes.FormalClothesColor")
 ColorPaletteInfo=(Palette=ePalette_CaucasianSkin,ArchetypeName="UnitPalettes.CaucasianSkin")
 ColorPaletteInfo=(Palette=ePalette_AfricanSkin,ArchetypeName="UnitPalettes.AfricanSkin")
 ColorPaletteInfo=(Palette=ePalette_HispanicSkin,ArchetypeName="UnitPalettes.HispanicSkin")
 ColorPaletteInfo=(Palette=ePalette_AsianSkin,ArchetypeName="UnitPalettes.AsianSkin")
 ColorPaletteInfo=(Palette=ePalette_EyeColor,ArchetypeName="UnitPalettes.EyeColor")
 ColorPaletteInfo=(Palette=ePalette_ArmorTint,ArchetypeName="UnitPalettes.ArmorTint")

Each of these links a Palette type to an ArchetypeName string, which the native function GetArchetypeFromCache uses to locate the desired object in the UPK files.

The various color palettes are contained in the UnitPalettes object, located in Startup.UPK. Here the arrays can be directly edited.

Programs and Tools

As these are bare data structures, no decompiler is necessary. All that is needed is a Hex editor, such as HxD.

Wasteland Ghosts' UPKUtils tool include the functionality to expand function and object size, and so can be used to indefinitely extend the color palettes.

See also the following related wiki articles:


Code Breakdown

Each palette object consists of a header and footer sandwiching all the individual color options.

 {Object Header}
 01 00 00 00 28 02 00 00 00 00 00 00 22 00 00 00 00 00 00 00 
    04 0D {Object size-64, reverse order,} 
 00 00 00 00 00 00 
    20 {# of Entries} 
 00 00 00

Each color in the palette has an entry in the body of the object.

 {Entry}
 DE 03 00 00 00 00 00 00 02 0B 00 00 00 00 00 00 10 00 00 00 00 00 00 00 40 03 00 00 00 00 00 00 
 {Primary Color}
    3B FF 9C 3E {R - 4 bytes, reverse order}
    48 63 11 3E {G - 4 bytes, reverse order}
    36 AB 17 3D {B - 4 bytes, reverse order}
    00 00 80 3F {Unknown - 4 bytes}
 92 04 00 00 00 00 00 00 02 0B 00 00 00 00 00 00 10 00 00 00 00 00 00 00 40 03 00 00 00 00 00 00 
 {Secondary Color}
    27 9C 5F 3D {R - 4 bytes, reverse order}
    D1 7C 36 3D {G - 4 bytes, reverse order}
    C1 EF B4 3B {B - 4 bytes, reverse order}
    00 00 80 3F {Unknown - 4 bytes}
 92 03 00 00 00 00 00 00 

Only the ArmorTint palette (Palette=ePalette_ArmorTint) uses the Secondary Colors. In other palettes, all four 4-Byte chunks in the Secondary Color field are replaced with "CC CC CC CC".

 {Object Ending}
 55 00 00 00 00 00 00 00 0E 03 00 00 00 00 00 00 04 00 00 00 00 00 00 00 
    20 {# of Entries} 
 00 00 00 92 03 00 00 00 00 00 00

Example

For the first four entries in ArmorTint, the Primary and Secondary RGB values have both been replaced with (from left to right)

 00 00 00 50 00 00 00 50 00 00 00 50 {All values far higher than normally used}
 00 00 00 00 00 00 00 00 00 00 00 00 {Entirely colorless}
 1C 43 25 41 1C 43 25 41 1C 43 25 41 {Somewhat whiter than default white}
 00 00 00 00 00 00 00 43 00 00 00 00 {Ridiculously green}

Adjusted XCOM Palettes

Related

Referred to by this article:

That refer to this article: