Move all hard-coded colours (except map preview ones) into the palette file. Pass a PIELIGHT to widgSetColour() instead of RGB.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10466 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
f3aea9cc1e
commit
338bc9e322
|
@ -65,3 +65,10 @@ ff,ff,ff,ff // default form light
|
|||
ff,0,0,ff // default form cursor
|
||||
30,30,30,ff // default form tip background
|
||||
bf,bf,bf,ff // default form disabled
|
||||
0,a4,0,ff // design power form background
|
||||
cc,0,0,ff // power bar
|
||||
cc,eb,13,ff // action progress bar major
|
||||
55,0,0,ff // action progress bar minor
|
||||
ff,ff,0,ff // production run text
|
||||
0,20,40,ff // production run background
|
||||
0,0,0,18 // game loading bar background
|
||||
|
|
|
@ -89,8 +89,15 @@
|
|||
#define WZCOL_FORM_CURSOR psPalette[64]
|
||||
#define WZCOL_FORM_TIP_BACKGROUND psPalette[65]
|
||||
#define WZCOL_FORM_DISABLE psPalette[66]
|
||||
#define WZCOL_DESIGN_POWER_FORM_BACKGROUND psPalette[67]
|
||||
#define WZCOL_POWER_BAR psPalette[68]
|
||||
#define WZCOL_ACTION_PROGRESS_BAR_MAJOR psPalette[69]
|
||||
#define WZCOL_ACTION_PROGRESS_BAR_MINOR psPalette[70]
|
||||
#define WZCOL_ACTION_PRODUCTION_RUN_TEXT psPalette[71]
|
||||
#define WZCOL_ACTION_PRODUCTION_RUN_BACKGROUND psPalette[72]
|
||||
#define WZCOL_LOADING_BAR_BACKGROUND psPalette[73]
|
||||
|
||||
#define WZCOL_MAX 67
|
||||
#define WZCOL_MAX 74
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
|
@ -100,7 +107,7 @@ extern PIELIGHT psPalette[];
|
|||
|
||||
extern void pal_Init(void);
|
||||
extern void pal_ShutDown(void);
|
||||
extern PIELIGHT pal_GetTeamColour(int team);
|
||||
extern PIELIGHT pal_GetTeamColour(int team);
|
||||
|
||||
static inline PIELIGHT pal_Colour(UBYTE r, UBYTE g, UBYTE b)
|
||||
{
|
||||
|
@ -126,8 +133,6 @@ static inline PIELIGHT pal_SetBrightness(UBYTE brightness)
|
|||
return c;
|
||||
}
|
||||
|
||||
#define pal_Grey pal_SetBrightness
|
||||
|
||||
static inline PIELIGHT pal_RGBA(UBYTE r, UBYTE g, UBYTE b, UBYTE a)
|
||||
{
|
||||
PIELIGHT c;
|
||||
|
|
|
@ -660,26 +660,13 @@ void widgGetTabs(W_SCREEN *psScreen, UDWORD id, UWORD *pMajor, UWORD *pMinor)
|
|||
|
||||
|
||||
/* Set a colour on a form */
|
||||
void widgSetColour(W_SCREEN *psScreen, UDWORD id, UDWORD colour,
|
||||
UBYTE red, UBYTE green, UBYTE blue)
|
||||
void widgSetColour(W_SCREEN *psScreen, UDWORD id, UDWORD index, PIELIGHT colour)
|
||||
{
|
||||
W_TABFORM *psForm;
|
||||
W_TABFORM *psForm = (W_TABFORM *)widgGetFromID(psScreen, id);
|
||||
|
||||
psForm = (W_TABFORM *)widgGetFromID(psScreen, id);
|
||||
if (psForm == NULL || psForm->type != WIDG_FORM)
|
||||
{
|
||||
ASSERT( false,"widgSetColour: couldn't find form from id" );
|
||||
return;
|
||||
}
|
||||
ASSERT( psForm != NULL,
|
||||
"widgSetColour: Invalid tab form pointer" );
|
||||
|
||||
if (colour >= WCOL_MAX)
|
||||
{
|
||||
ASSERT( false, "widgSetColour: Colour id out of range" );
|
||||
return;
|
||||
}
|
||||
psForm->aColours[colour] = pal_Colour(red,green,blue);
|
||||
ASSERT_OR_RETURN(, psForm && psForm->type == WIDG_FORM, "Could not find form from id %u", id);
|
||||
ASSERT_OR_RETURN(, index < WCOL_MAX, "Colour id %u out of range", index);
|
||||
psForm->aColours[index] = colour;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -390,8 +390,7 @@ enum _w_colour
|
|||
};
|
||||
|
||||
/** Set a colour on a form */
|
||||
extern void widgSetColour(W_SCREEN *psScreen, UDWORD id, UDWORD colour,
|
||||
UBYTE red, UBYTE green, UBYTE blue);
|
||||
extern void widgSetColour(W_SCREEN *psScreen, UDWORD id, UDWORD index, PIELIGHT colour);
|
||||
|
||||
/** Set the global toop tip text colour. */
|
||||
extern void widgSetTipColour(PIELIGHT colour);
|
||||
|
|
10
src/design.c
10
src/design.c
|
@ -805,7 +805,7 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
}
|
||||
|
||||
/* Set the text colour for the form */
|
||||
widgSetColour(psWScreen, IDDES_POWERFORM, WCOL_TEXT, 0, 164, 0);
|
||||
widgSetColour(psWScreen, IDDES_POWERFORM, WCOL_TEXT, WZCOL_DESIGN_POWER_FORM_BACKGROUND);
|
||||
|
||||
/* Add the design template power bar and label*/
|
||||
sLabInit.formID = IDDES_POWERFORM;
|
||||
|
@ -1056,12 +1056,8 @@ BOOL intAddTemplateButtons(UDWORD formID, UDWORD formWidth, UDWORD formHeight,
|
|||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
sBarInit.height = STAT_PROGBARHEIGHT;
|
||||
sBarInit.size = 50;
|
||||
sBarInit.sCol.byte.r = STAT_PROGBARMAJORRED;
|
||||
sBarInit.sCol.byte.g = STAT_PROGBARMAJORGREEN;
|
||||
sBarInit.sCol.byte.b = STAT_PROGBARMAJORBLUE;
|
||||
sBarInit.sMinorCol.byte.r = STAT_PROGBARMINORRED;
|
||||
sBarInit.sMinorCol.byte.g = STAT_PROGBARMINORGREEN;
|
||||
sBarInit.sMinorCol.byte.b = STAT_PROGBARMINORBLUE;
|
||||
sBarInit.sCol = WZCOL_ACTION_PROGRESS_BAR_MAJOR;
|
||||
sBarInit.sMinorCol = WZCOL_ACTION_PROGRESS_BAR_MINOR;
|
||||
sBarInit.pTip = _("Power Usage");
|
||||
|
||||
droidTemplID = 0;
|
||||
|
|
50
src/hci.c
50
src/hci.c
|
@ -3886,9 +3886,7 @@ BOOL intAddPower(void)
|
|||
sBarInit.y = (SWORD)POW_Y;
|
||||
sBarInit.width = POW_BARWIDTH;
|
||||
sBarInit.height = iV_GetImageHeight(IntImages,IMAGE_PBAR_EMPTY);
|
||||
sBarInit.sCol.byte.r = POW_CLICKBARMAJORRED;
|
||||
sBarInit.sCol.byte.g = POW_CLICKBARMAJORGREEN;
|
||||
sBarInit.sCol.byte.b = POW_CLICKBARMAJORBLUE;
|
||||
sBarInit.sCol = WZCOL_POWER_BAR;
|
||||
sBarInit.pDisplay = intDisplayPowerBar;
|
||||
sBarInit.iRange = POWERBAR_SCALE;
|
||||
|
||||
|
@ -4577,12 +4575,8 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
sBarInit.height = STAT_PROGBARHEIGHT;
|
||||
sBarInit.size = 0;
|
||||
sBarInit.sCol.byte.r = STAT_PROGBARMAJORRED;
|
||||
sBarInit.sCol.byte.g = STAT_PROGBARMAJORGREEN;
|
||||
sBarInit.sCol.byte.b = STAT_PROGBARMAJORBLUE;
|
||||
sBarInit.sMinorCol.byte.r = STAT_PROGBARMINORRED;
|
||||
sBarInit.sMinorCol.byte.g = STAT_PROGBARMINORGREEN;
|
||||
sBarInit.sMinorCol.byte.b = STAT_PROGBARMINORBLUE;
|
||||
sBarInit.sCol = WZCOL_ACTION_PROGRESS_BAR_MAJOR;
|
||||
sBarInit.sMinorCol = WZCOL_ACTION_PROGRESS_BAR_MINOR;
|
||||
sBarInit.pTip = _("Progress Bar");
|
||||
|
||||
//object output bar ie manuf power o/p, research power o/p
|
||||
|
@ -4847,17 +4841,11 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
widgSetButtonState(psWScreen, sBFormInit2.id, WBUT_CLICKLOCK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( psObj->type != OBJ_DROID ||
|
||||
(((DROID *)psObj)->droidType == DROID_CONSTRUCT ||
|
||||
((DROID *)psObj)->droidType == DROID_CYBORG_CONSTRUCT))
|
||||
if (psObj->type != OBJ_DROID || (((DROID *)psObj)->droidType == DROID_CONSTRUCT || ((DROID *)psObj)->droidType == DROID_CYBORG_CONSTRUCT))
|
||||
{
|
||||
// Set the colour for the production run size text.
|
||||
widgSetColour(psWScreen, sBFormInit2.id, WCOL_TEXT,
|
||||
STAT_TEXTRED,STAT_TEXTGREEN,STAT_TEXTBLUE);
|
||||
widgSetColour(psWScreen, sBFormInit2.id, WCOL_BKGRND,
|
||||
STAT_PROGBARTROUGHRED,STAT_PROGBARTROUGHGREEN,STAT_PROGBARTROUGHBLUE);
|
||||
widgSetColour(psWScreen, sBFormInit2.id, WCOL_TEXT, WZCOL_ACTION_PRODUCTION_RUN_TEXT);
|
||||
widgSetColour(psWScreen, sBFormInit2.id, WCOL_BKGRND, WZCOL_ACTION_PRODUCTION_RUN_BACKGROUND);
|
||||
}
|
||||
|
||||
// Add command droid bits
|
||||
|
@ -5350,12 +5338,8 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
|
|||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
sBarInit.height = STAT_PROGBARHEIGHT;
|
||||
sBarInit.size = 0;
|
||||
sBarInit.sCol.byte.r = STAT_PROGBARMAJORRED;
|
||||
sBarInit.sCol.byte.g = STAT_PROGBARMAJORGREEN;
|
||||
sBarInit.sCol.byte.b = STAT_PROGBARMAJORBLUE;
|
||||
sBarInit.sMinorCol.byte.r = STAT_PROGBARMINORRED;
|
||||
sBarInit.sMinorCol.byte.g = STAT_PROGBARMINORGREEN;
|
||||
sBarInit.sMinorCol.byte.b = STAT_PROGBARMINORBLUE;
|
||||
sBarInit.sCol = WZCOL_ACTION_PROGRESS_BAR_MAJOR;
|
||||
sBarInit.sMinorCol = WZCOL_ACTION_PROGRESS_BAR_MINOR;
|
||||
sBarInit.iRange = GAME_TICKS_PER_SEC;
|
||||
// Setup widget update callback and object pointer so we can update the progress bar.
|
||||
sBarInit.pCallback = intUpdateProgressBar;
|
||||
|
@ -5427,14 +5411,10 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
|
|||
|
||||
sFormInit.pDisplay = intDisplayStatusButton;
|
||||
|
||||
|
||||
widgAddForm(psWScreen, &sFormInit);
|
||||
// Set the colour for the production run size text.
|
||||
widgSetColour(psWScreen, sFormInit.id, WCOL_TEXT,
|
||||
STAT_TEXTRED,STAT_TEXTGREEN,STAT_TEXTBLUE);
|
||||
widgSetColour(psWScreen, sFormInit.id, WCOL_BKGRND,
|
||||
STAT_PROGBARTROUGHRED,STAT_PROGBARTROUGHGREEN,STAT_PROGBARTROUGHBLUE);
|
||||
|
||||
widgSetColour(psWScreen, sFormInit.id, WCOL_TEXT, WZCOL_ACTION_PRODUCTION_RUN_TEXT);
|
||||
widgSetColour(psWScreen, sFormInit.id, WCOL_BKGRND, WZCOL_ACTION_PRODUCTION_RUN_BACKGROUND);
|
||||
|
||||
widgAddLabel(psWScreen, &sLabInit);
|
||||
widgAddBarGraph(psWScreen, &sBarInit);
|
||||
|
@ -5820,12 +5800,8 @@ if (numForms(numStats, butPerForm)> MAX_TAB_SMALL_SHOWN) //only want these butto
|
|||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
sBarInit.height = STAT_PROGBARHEIGHT;
|
||||
sBarInit.size = 50;
|
||||
sBarInit.sCol.byte.r = STAT_PROGBARMAJORRED;
|
||||
sBarInit.sCol.byte.g = STAT_PROGBARMAJORGREEN;
|
||||
sBarInit.sCol.byte.b = STAT_PROGBARMAJORBLUE;
|
||||
sBarInit.sMinorCol.byte.r = STAT_PROGBARMINORRED;
|
||||
sBarInit.sMinorCol.byte.g = STAT_PROGBARMINORGREEN;
|
||||
sBarInit.sMinorCol.byte.b = STAT_PROGBARMINORBLUE;
|
||||
sBarInit.sCol = WZCOL_ACTION_PROGRESS_BAR_MAJOR;
|
||||
sBarInit.sMinorCol = WZCOL_ACTION_PROGRESS_BAR_MINOR;
|
||||
//sBarInit.pTip = _("Power Usage");
|
||||
|
||||
statID = 0;
|
||||
|
@ -5864,7 +5840,7 @@ if (numForms(numStats, butPerForm)> MAX_TAB_SMALL_SHOWN) //only want these butto
|
|||
{
|
||||
return false;
|
||||
}
|
||||
widgSetColour(psWScreen, sBFormInit.id, WCOL_BKGRND, 0,0,0);
|
||||
widgSetColour(psWScreen, sBFormInit.id, WCOL_BKGRND, WZCOL_BLACK);
|
||||
|
||||
//Stat = ppsStatsList[i];
|
||||
if (Stat->ref >= REF_STRUCTURE_START &&
|
||||
|
|
16
src/hci.h
16
src/hci.h
|
@ -155,9 +155,6 @@ extern "C"
|
|||
|
||||
#define POW_GAPX 5
|
||||
#define POW_GAPY 2
|
||||
#define POW_CLICKBARMAJORRED 0xcc
|
||||
#define POW_CLICKBARMAJORGREEN 0
|
||||
#define POW_CLICKBARMAJORBLUE 0
|
||||
|
||||
//tab details
|
||||
#define OBJ_TABWIDTH 26
|
||||
|
@ -230,19 +227,6 @@ extern "C"
|
|||
#define STAT_POWERBARX 3
|
||||
#define STAT_POWERBARY (OBJ_BUTHEIGHT-STAT_PROGBARHEIGHT-6)
|
||||
|
||||
#define STAT_PROGBARMAJORRED 255//0xcc
|
||||
#define STAT_PROGBARMAJORGREEN 235//0
|
||||
#define STAT_PROGBARMAJORBLUE 19//0
|
||||
#define STAT_PROGBARMINORRED 0x55
|
||||
#define STAT_PROGBARMINORGREEN 0
|
||||
#define STAT_PROGBARMINORBLUE 0
|
||||
#define STAT_PROGBARTROUGHRED 0
|
||||
#define STAT_PROGBARTROUGHGREEN 32
|
||||
#define STAT_PROGBARTROUGHBLUE 64
|
||||
#define STAT_TEXTRED 255
|
||||
#define STAT_TEXTGREEN 255
|
||||
#define STAT_TEXTBLUE 0
|
||||
|
||||
/* maximum array sizes */
|
||||
#define MAXSTRUCTURES 200 //bumped up from 80. NOTE: was used for max # in build menus.
|
||||
#define MAXRESEARCH 200 //was 80 topic displayed " "
|
||||
|
|
|
@ -937,13 +937,8 @@ BOOL intAddDroidsAvailForm(void)
|
|||
sBarInit.width = STAT_PROGBARWIDTH;
|
||||
sBarInit.height = STAT_PROGBARHEIGHT;
|
||||
sBarInit.size = 50;
|
||||
sBarInit.sCol.byte.r = STAT_PROGBARMAJORRED;
|
||||
sBarInit.sCol.byte.g = STAT_PROGBARMAJORGREEN;
|
||||
sBarInit.sCol.byte.b = STAT_PROGBARMAJORBLUE;
|
||||
sBarInit.sMinorCol.byte.r = STAT_PROGBARMINORRED;
|
||||
sBarInit.sMinorCol.byte.g = STAT_PROGBARMINORGREEN;
|
||||
sBarInit.sMinorCol.byte.b = STAT_PROGBARMINORBLUE;
|
||||
|
||||
sBarInit.sCol = WZCOL_ACTION_PROGRESS_BAR_MAJOR;
|
||||
sBarInit.sMinorCol = WZCOL_ACTION_PROGRESS_BAR_MINOR;
|
||||
|
||||
//add droids built before the mission
|
||||
for (psDroid = mission.apsDroidLists[selectedPlayer]; psDroid != NULL;
|
||||
|
|
|
@ -69,7 +69,7 @@ static STAR newStar(void)
|
|||
STAR s;
|
||||
s.xPos = rand() % barRightX;
|
||||
s.speed = (rand() % 30 + 6) * pie_GetVideoBufferWidth() / 640.0;
|
||||
s.colour = pal_Grey(150 + rand() % 100);
|
||||
s.colour = pal_SetBrightness(150 + rand() % 100);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ TITLECODE titleLoop(void)
|
|||
//loadbar update
|
||||
void loadingScreenCallback(void)
|
||||
{
|
||||
const PIELIGHT loadingbar_background = pal_RGBA(0, 0, 0, 24);
|
||||
const PIELIGHT loadingbar_background = WZCOL_LOADING_BAR_BACKGROUND;
|
||||
const uint32_t currTick = SDL_GetTicks();
|
||||
unsigned int i;
|
||||
|
||||
|
|
Loading…
Reference in New Issue