Plan for uicolors.bin box style cleanup (splitting colors and box styles)

Jump to navigation Jump to search

This plan is complete! yay! It is recorded here for posterity

UICOLORS.BIN contains both user interface colors, and box styles. It is awkward to add new colors or styles because they are in the same binary lump, and we want to keep them grouped together.

implementation steps[edit]

  • Split in-memory representation (done)
  • Split editor (done)
  • update master palette remapping (done)
  • Implement saving/loading in general.reld (done)
    • continue writing uicolors.bin for downgrade-compatibility, and because it isn't much trouble to do. (done)
  • Add new uicolors to replace all the places where interface elements grab random colors from box styles (just styles 0 and 1?)
    • Need to make a list of these
  • Add new uicolors for places where a existing uicolor is used for different purposes when it really shouldn't be
  • Add support for allowing the game author to decide which box styles are used for various boxes in special screens
  • Add the ability to add additional box styles

Splitting in-memory representation[edit]

The contents of uicolors.bin is currently cached in-memory in the uilook array. This is good because it is fast. UI colors sometimes need to be looked up many times every tick.

We can split this into two arrays. uilook() can remain as it is now. We can add boxlook() to store the box style information. Only the lines that reference uilook() with the uiTextBox or uiTextBoxFrame constants will need to be updated.

uilook in general.reld[edit]

We can change how UI colors and box styles are stored. They can be stored in a new child node of general.reld

  • uicolors - parent node for colors
    • forpalette int - There will be a separate set of UI colors for each master palette. the integer value is the master palette number. At a minimum, the node for master palette 0 should be present
      • uilook int - parent node for each color. integer is the color number and corresponds to the colors numbers in
        • col int - color index in the master palette
      • boxlook int - parent node for box styles. integer is the style number
        • bgcol int - background color
        • edgecol int - box edge color (often covered up by the border sprite)
        • border int - border sprite set number. If node is not present, there is no sprite border