Skip to content

Commit

Permalink
Merge pull request #999 from Yankes/InterfacePalette
Browse files Browse the repository at this point in the history
Interface palette
  • Loading branch information
Warboy1982 committed Apr 20, 2015
2 parents 7d3cfdd + 3261c25 commit 75c6994
Show file tree
Hide file tree
Showing 93 changed files with 274 additions and 686 deletions.
44 changes: 40 additions & 4 deletions bin/data/Ruleset/Xcom1Ruleset/interfaces.rul
Expand Up @@ -237,6 +237,7 @@ interfaces:
- id: button
color: 133 # minty green
- type: baseDefense
palette: PAL_BASESCAPE
elements:
- id: palette
color: 2 # red/orange
Expand Down Expand Up @@ -367,6 +368,7 @@ interfaces:
- id: button
color: 239 # bright green
- type: psiTraining
palette: PAL_BASESCAPE
elements:
- id: palette
color: 7 # violet
Expand All @@ -379,6 +381,7 @@ interfaces:
- id: button2
color: 218 # light blue
- type: allocatePsi
palette: PAL_BASESCAPE
elements:
- id: palette
color: 7 # violet
Expand Down Expand Up @@ -409,6 +412,7 @@ interfaces:
- id: button
color: 239 # bright green
- type: graphs
palette: PAL_GRAPHS
elements:
- id: text
color: 135 # red
Expand Down Expand Up @@ -500,17 +504,16 @@ interfaces:
color: 133 # minty green
- type: geoscape
elements:
- id: loadPalette
color: 6
- id: palette
color: 0 # brown
color2: 6
- id: textLoad
color: 133 # minty green
- id: button
color: 246 # light blue
color2: 245 # slightly lighter blue
- id: text
color: 244 # even lighter blue
- id: genericPalette
color: 0 # brown
- id: genericWindow
color: 239 # bright green
- id: genericText
Expand All @@ -532,6 +535,7 @@ interfaces:
- id: victoryText
color: 249
- type: sellMenu
palette: PAL_BASESCAPE
elements:
- id: palette
color: 0 # brown
Expand All @@ -548,6 +552,7 @@ interfaces:
- id: button
color: 218 # blue
- type: buyMenu
palette: PAL_BASESCAPE
elements:
- id: palette
color: 0 # brown
Expand All @@ -568,6 +573,7 @@ interfaces:
- id: errorMessage
color: 241 # pink
- type: manageContainment
palette: PAL_BASESCAPE
elements:
- id: palette
color: 1 # burgundy
Expand All @@ -587,6 +593,7 @@ interfaces:
- id: errorMessage
color: 241 # pink
- type: transferBaseSelect
palette: PAL_BASESCAPE
elements:
- id: palette
color: 4 # dark green
Expand All @@ -601,6 +608,7 @@ interfaces:
color: 241 # pink
color2: 213 # gold
- type: transferMenu
palette: PAL_BASESCAPE
elements:
- id: palette
color: 0 # brown
Expand All @@ -620,6 +628,7 @@ interfaces:
- id: errorMessage
color: 241 # pink
- type: transferConfirm
palette: PAL_BASESCAPE
elements:
- id: palette
color: 6 # oxide
Expand All @@ -631,6 +640,7 @@ interfaces:
color: 218 # blue
color2: 241 # pink
- type: transferInfo
palette: PAL_BASESCAPE
elements:
- id: palette
color: 6 # oxide
Expand All @@ -644,6 +654,7 @@ interfaces:
color: 218 # blue
border: 246 # purple
- type: selectFacility
palette: PAL_BASESCAPE
elements:
- id: palette
color: 6 # oxide
Expand All @@ -656,6 +667,7 @@ interfaces:
- id: list
color: 213 # gold
- type: placeFacility
palette: PAL_BASESCAPE
elements:
- id: palette
color: 6 # oxide
Expand All @@ -672,6 +684,7 @@ interfaces:
- id: errorMessage
color: 241 # pink
- type: dismantleFacility
palette: PAL_BASESCAPE
elements:
- id: palette
color: 6 # oxide
Expand All @@ -682,6 +695,7 @@ interfaces:
- id: text
color: 218 # blue
- type: manufactureMenu
palette: PAL_BASESCAPE
elements:
- id: palette
color: 6 # oxide
Expand All @@ -698,6 +712,7 @@ interfaces:
- id: button
color: 218 # blue
- type: selectNewManufacture
parent: manufactureMenu
elements:
- id: window
color: 241 # pink
Expand All @@ -711,6 +726,7 @@ interfaces:
- id: catBox
color: 241 # pink
- type: allocateManufacture
parent: manufactureMenu
elements:
- id: window
color: 218 # blue
Expand All @@ -723,6 +739,7 @@ interfaces:
- id: button
color: 218 # blue
- type: manufactureInfo
parent: manufactureMenu
elements:
- id: window
color: 241 # pink
Expand All @@ -737,6 +754,7 @@ interfaces:
- id: button2
color: 246 # purple
- type: researchMenu
palette: PAL_BASESCAPE
elements:
- id: palette
color: 1 # burgundy
Expand All @@ -751,6 +769,7 @@ interfaces:
- id: button
color: 246 # purple
- type: selectNewResearch
parent: researchMenu
elements:
- id: window
color: 218 # blue
Expand All @@ -762,6 +781,7 @@ interfaces:
- id: button
color: 246 # purple
- type: allocateResearch
parent: researchMenu
elements:
- id: window
color: 213 # gold
Expand All @@ -773,6 +793,7 @@ interfaces:
- id: button2
color: 218 # blue
- type: baseInfo
palette: PAL_BASESCAPE
elements:
- id: text1
color: 241 # pink
Expand All @@ -791,6 +812,7 @@ interfaces:
- id: detectionBars
color: 128 # pale blue
- type: storesInfo
palette: PAL_BASESCAPE
elements:
- id: palette
color: 0 # brown
Expand All @@ -803,6 +825,7 @@ interfaces:
- id: button
color: 218 # blue
- type: costsInfo
palette: PAL_BASESCAPE
elements:
- id: palette
color: 6 # oxide
Expand All @@ -818,6 +841,7 @@ interfaces:
- id: button
color: 241 # pink
- type: soldierList
palette: PAL_BASESCAPE
elements:
- id: palette
color: 2 # orange
Expand All @@ -834,6 +858,7 @@ interfaces:
- id: button
color: 218 # blue
- type: soldierInfo
palette: PAL_BASESCAPE
elements:
- id: text1
color: 218 # blue
Expand Down Expand Up @@ -893,6 +918,7 @@ interfaces:
- id: errorMessage
color: 241 # pink
- type: sackSoldier
palette: PAL_BASESCAPE
elements:
- id: palette
color: 6 # oxide
Expand All @@ -903,6 +929,7 @@ interfaces:
- id: button
color: 246 # purple
- type: soldierArmor
palette: PAL_BASESCAPE
elements:
- id: palette
color: 4 # green
Expand All @@ -916,6 +943,7 @@ interfaces:
- id: button
color: 213 # gold
- type: soldierMemorial
palette: PAL_BASESCAPE
elements:
- id: palette
color: 7 # violet
Expand All @@ -930,6 +958,7 @@ interfaces:
- id: button
color: 218 # blue
- type: craftEquipment
palette: PAL_BASESCAPE
elements:
- id: palette
color: 2 # orange
Expand All @@ -951,6 +980,7 @@ interfaces:
- id: errorMessage
color: 241 # pink
- type: craftArmor
palette: PAL_BASESCAPE
elements:
- id: palette
color: 4 # aqua
Expand All @@ -966,6 +996,7 @@ interfaces:
- id: otherCraft
color: 246 # purple
- type: craftInfo
palette: PAL_BASESCAPE
elements:
- id: palette
color: 3 # pink
Expand All @@ -980,6 +1011,7 @@ interfaces:
- id: button
color: 218 # blue
- type: craftWeapons
palette: PAL_BASESCAPE
elements:
- id: palette
color: 4 # aqua
Expand All @@ -992,6 +1024,7 @@ interfaces:
- id: button
color: 246 # purple
- type: craftSoldiers
palette: PAL_BASESCAPE
elements:
- id: palette
color: 2 # orange
Expand All @@ -1009,6 +1042,7 @@ interfaces:
- id: otherCraft
color: 246 # purple
- type: craftSelect
palette: PAL_BASESCAPE
elements:
- id: palette
color: 3 # pink
Expand All @@ -1026,6 +1060,7 @@ interfaces:
- id: errorMessage
color: 241 # pink
- type: basescape
palette: PAL_BASESCAPE
elements:
- id: button
color: 213 # gold
Expand All @@ -1048,6 +1083,7 @@ interfaces:
color: 48 # green
color2: 32 # red
- type: battlescape
palette: PAL_BATTLESCAPE
elements:
- id: textLoad
color: 15
Expand Down
12 changes: 2 additions & 10 deletions src/Basescape/BaseInfoState.cpp
Expand Up @@ -102,15 +102,7 @@ BaseInfoState::BaseInfoState(Base *base, BasescapeState *state) : _base(base), _
_barLongRange = new Bar(150, 5, 166, Options::storageLimitsEnforced ? 169 : 165);

// Set palette
Element *element = _game->getRuleset()->getInterface("baseInfo")->getElement("palette");
if (element && element->TFTDMode)
{
setPalette("PAL_GEOSCAPE");
}
else
{
setPalette("PAL_BASESCAPE");
}
setInterface("baseInfo");

add(_bg);
add(_mini, "miniBase", "basescape");
Expand Down Expand Up @@ -203,7 +195,7 @@ BaseInfoState::BaseInfoState(Base *base, BasescapeState *state) : _base(base), _

_edtBase->setBig();
_edtBase->onChange((ActionHandler)&BaseInfoState::edtBaseChange);

_txtPersonnel->setText(tr("STR_PERSONNEL_AVAILABLE_PERSONNEL_TOTAL"));

_txtSoldiers->setText(tr("STR_SOLDIERS"));
Expand Down
4 changes: 2 additions & 2 deletions src/Basescape/BasescapeState.cpp
Expand Up @@ -83,8 +83,8 @@ BasescapeState::BasescapeState(Base *base, Globe *globe) : _base(base), _globe(g
_btnGeoscape = new TextButton(128, 12, 192, 188);

// Set palette
setPalette("PAL_BASESCAPE");
setInterface("basescape");

add(_view, "baseView", "basescape");
add(_mini, "miniBase", "basescape");
add(_txtFacility, "textTooltip", "basescape");
Expand Down
17 changes: 1 addition & 16 deletions src/Basescape/BuildFacilitiesState.cpp
Expand Up @@ -50,22 +50,7 @@ BuildFacilitiesState::BuildFacilitiesState(Base *base, State *state) : _base(bas
_txtTitle = new Text(118, 17, 197, 48);

// Set palette
std::string pal = "PAL_BASESCAPE";
Uint8 color = 6; // oxide by default in ufo palette
Element *element = _game->getRuleset()->getInterface("selectFacility")->getElement("palette");
if (element)
{
if (element->TFTDMode)
{
pal = "PAL_GEOSCAPE";
}
if (element->color != INT_MAX)
{
color = element->color;
}
}

setPalette(pal, color);
setInterface("selectFacility");

add(_window, "window", "selectFacility");
add(_btnOk, "button", "selectFacility");
Expand Down

1 comment on commit 75c6994

@Volutar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhhh..
setInterface? really poor naming. It's setting of palette (state palette), not interface. Interface is something about API.
Ok, what's inside? Dig into categories, and then IGNORE that and still set battlescape palette (hope these PAL_BATTLESCAPE/PAL_GEOSCAPE is not hardcoded).
And numerous misspelings and typos.

Please sign in to comment.