Mercurial > hg > openttd
changeset 17649:2b51d78fc404 draft
(svn r22421) -Fix: Replace various references to Windows palette greyscale indices with the DOS palette indices.
author | frosch <frosch@openttd.org> |
---|---|
date | Wed, 04 May 2011 17:45:16 +0000 |
parents | 1ffc84b7a931 |
children | 4448578123b7 |
files | src/ai/ai_gui.cpp src/airport_gui.cpp src/company_gui.cpp src/console_gui.cpp src/fios_gui.cpp src/gfx.cpp src/gfx_func.h src/graph_gui.cpp src/industry_gui.cpp src/misc_gui.cpp src/music_gui.cpp src/network/network_content_gui.cpp src/network/network_gui.cpp src/newgrf_gui.cpp src/news_gui.cpp src/object_gui.cpp src/rail_gui.cpp src/smallmap_gui.cpp src/widgets/dropdown.cpp |
diffstat | 19 files changed, 47 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -978,7 +978,7 @@ /* Check if the current line should be highlighted */ if (pos == this->highlight_row) { - GfxFillRect(r.left + 1, r.top + y, r.right - 1, r.top + y + this->resize.step_height - WD_PAR_VSEP_NORMAL, 0); + GfxFillRect(r.left + 1, r.top + y, r.right - 1, r.top + y + this->resize.step_height - WD_PAR_VSEP_NORMAL, GREY_SCALE(0)); if (colour == TC_BLACK) colour = TC_WHITE; // Make black text readable by inverting it to white. }
--- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -356,7 +356,7 @@ for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < AirportClass::GetCount(_selected_airport_class); i++) { const AirportSpec *as = AirportClass::Get(_selected_airport_class, i); if (!as->IsAvailable()) { - GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, 0, FILLRECT_CHECKER); + GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, GREY_SCALE(0), FILLRECT_CHECKER); } DrawString(r.left + WD_MATRIX_LEFT, r.right + WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, as->name, ((int)i == _selected_airport_index) ? TC_WHITE : TC_BLACK); y += this->line_height;
--- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -209,7 +209,7 @@ if (et == INVALID_EXPENSES) { Money cost = subtotal; subtotal = 0; - GfxFillRect(r.left, y, r.right, y, 215); + GfxFillRect(r.left, y, r.right, y, GREY_SCALE(1)); y += EXP_LINESPACE; DrawPrice(cost, r.left, r.right, y); y += FONT_HEIGHT_NORMAL + EXP_BLOCKSPACE; @@ -222,7 +222,7 @@ } } - GfxFillRect(r.left, y, r.right, y, 215); + GfxFillRect(r.left, y, r.right, y, GREY_SCALE(1)); y += EXP_LINESPACE; DrawPrice(sum, r.left, r.right, y); } @@ -385,7 +385,7 @@ } case CFW_LOAN_LINE: - GfxFillRect(r.left, r.top, r.right, r.top, 215); + GfxFillRect(r.left, r.top, r.right, r.top, GREY_SCALE(1)); break; } }
--- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -204,7 +204,7 @@ { const int right = this->width - 5; - GfxFillRect(0, 0, this->width - 1, this->height - 1, 0); + GfxFillRect(0, 0, this->width - 1, this->height - 1, GREY_SCALE(0)); int ypos = this->height - this->line_height; for (const IConsoleLine *print = IConsoleLine::Get(IConsoleWindow::scroll); print != NULL; print = print->previous) { SetDParamStr(0, print->buffer);
--- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -351,7 +351,7 @@ } case SLWW_DRIVES_DIRECTORIES_LIST: { - GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, 0xD7); + GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, GREY_SCALE(1)); uint y = r.top + WD_FRAMERECT_TOP; for (uint pos = this->vscroll->GetPosition(); pos < _fios_items.Length(); pos++) { @@ -369,7 +369,7 @@ case SLWW_DETAILS: { GfxFillRect(r.left + WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, - r.right - WD_FRAMERECT_RIGHT, r.top + FONT_HEIGHT_NORMAL * 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM, 0x0A); + r.right - WD_FRAMERECT_RIGHT, r.top + FONT_HEIGHT_NORMAL * 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM, GREY_SCALE(10)); DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL / 2 + WD_FRAMERECT_TOP, STR_SAVELOAD_DETAIL_CAPTION, TC_FROMSTRING, SA_HOR_CENTER); if (this->selected == NULL) break;
--- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -264,7 +264,7 @@ * ....V. */ - static const byte colour = 15; + static const byte colour = GREY_SCALE(15); GfxDrawLineUnscaled(x, y, x + dx1, y + dy1, colour); GfxDrawLineUnscaled(x, y, x + dx2, y + dy2, colour);
--- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -182,4 +182,11 @@ extern bool _palette_remap_grf[]; +/** + * Return the colour for a particular greyscale level. + * @param level Intensity, 0 = black, 15 = white + * @return colour + */ +#define GREY_SCALE(level) (level) + #endif /* GFX_FUNC_H */
--- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -177,7 +177,7 @@ struct BaseGraphWindow : Window { protected: static const int GRAPH_MAX_DATASETS = 32; - static const int GRAPH_AXIS_LINE_COLOUR = 215; + static const int GRAPH_AXIS_LINE_COLOUR = GREY_SCALE(1); static const int GRAPH_NUM_MONTHS = 24; ///< Number of months displayed in the graph. static const int MIN_GRAPH_NUM_LINES_Y = 9; ///< Minimal number of horizontal lines to draw. @@ -977,7 +977,7 @@ int rect_x = clk_dif + (rtl ? r.right - 12 : r.left + WD_FRAMERECT_LEFT); - GfxFillRect(rect_x, y + clk_dif, rect_x + 8, y + 5 + clk_dif, 0); + GfxFillRect(rect_x, y + clk_dif, rect_x + 8, y + 5 + clk_dif, GREY_SCALE(0)); GfxFillRect(rect_x + 1, y + 1 + clk_dif, rect_x + 7, y + 4 + clk_dif, cs->legend_colour); SetDParam(0, cs->name); DrawString(rtl ? r.left : x + 14 + clk_dif, (rtl ? r.right - 14 + clk_dif : r.right), y + clk_dif, STR_GRAPH_CARGO_PAYMENT_CARGO);
--- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -396,7 +396,7 @@ /* Draw the name of the industry in white is selected, otherwise, in orange */ DrawString(x + MATRIX_TEXT_OFFSET, r.right - WD_MATRIX_RIGHT, y, indsp->name, selected ? TC_WHITE : TC_ORANGE); - GfxFillRect(x, y + 1, x + 10, y + 7, selected ? 15 : 0); + GfxFillRect(x, y + 1, x + 10, y + 7, selected ? GREY_SCALE(15) : GREY_SCALE(0)); GfxFillRect(x + 1, y + 2, x + 9, y + 6, indsp->map_colour); } break; @@ -1677,7 +1677,7 @@ blob_left = xpos + BLOB_DISTANCE; blob_right = blob_left + BLOB_WIDTH; } - GfxFillRect(blob_left, ypos2 - BLOB_DISTANCE - BLOB_HEIGHT, blob_right, ypos2 - BLOB_DISTANCE, 0); // Border + GfxFillRect(blob_left, ypos2 - BLOB_DISTANCE - BLOB_HEIGHT, blob_right, ypos2 - BLOB_DISTANCE, GREY_SCALE(0)); // Border GfxFillRect(blob_left + 1, ypos2 - BLOB_DISTANCE - BLOB_HEIGHT + 1, blob_right - 1, ypos2 - BLOB_DISTANCE - 1, indsp->map_colour); } else { DrawString(xpos, xpos2, ypos, STR_INDUSTRY_CARGOES_HOUSES, TC_FROMSTRING, SA_HOR_CENTER);
--- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -930,7 +930,7 @@ virtual void DrawWidget(const Rect &r, int widget) const { /* There is only one widget. */ - GfxFillRect(r.left, r.top, r.right, r.bottom, 0); + GfxFillRect(r.left, r.top, r.right, r.bottom, GREY_SCALE(0)); GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0x44); for (uint arg = 0; arg < this->paramcount; arg++) { @@ -1303,7 +1303,7 @@ int top = wi->pos_y; int bottom = wi->pos_y + wi->current_y - 1; - GfxFillRect(left + 1, top + 1, right - 1, bottom - 1, 215); + GfxFillRect(left + 1, top + 1, right - 1, bottom - 1, GREY_SCALE(1)); /* Limit the drawing of the string inside the widget boundaries */ DrawPixelInfo dpi;
--- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -370,7 +370,7 @@ { switch (widget) { case MTSW_LIST_LEFT: { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0); + GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, GREY_SCALE(0)); int y = r.top + WD_FRAMERECT_TOP; for (uint i = 0; i < NUM_SONGS_AVAILABLE; i++) { @@ -387,7 +387,7 @@ } case MTSW_LIST_RIGHT: { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0); + GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, GREY_SCALE(0)); int y = r.top + WD_FRAMERECT_TOP; for (const byte *p = _playlists[_settings_client.music.playlist]; *p != 0; p++) { @@ -592,7 +592,7 @@ { switch (widget) { case MW_GAUGE: - GfxFillRect(r.left, r.top, r.right, r.bottom, 0); + GfxFillRect(r.left, r.top, r.right, r.bottom, GREY_SCALE(0)); for (uint i = 0; i != 8; i++) { int colour = 0xD0; @@ -607,7 +607,7 @@ break; case MW_TRACK_NR: { - GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, 0); + GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, GREY_SCALE(0)); StringID str = STR_MUSIC_TRACK_NONE; if (_song_is_active != 0 && _music_wnd_cursong != 0) { SetDParam(0, GetTrackNumber(_music_wnd_cursong - 1)); @@ -619,7 +619,7 @@ } case MW_TRACK_NAME: { - GfxFillRect(r.left, r.top + 1, r.right - 1, r.bottom, 0); + GfxFillRect(r.left, r.top + 1, r.right - 1, r.bottom, GREY_SCALE(0)); StringID str = STR_MUSIC_TITLE_NONE; if (_song_is_active != 0 && _music_wnd_cursong != 0) { str = STR_MUSIC_TITLE_NAME;
--- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -452,7 +452,7 @@ for (ConstContentIterator iter = this->content.Get(this->vscroll->GetPosition()); iter != this->content.End() && cnt < this->vscroll->GetCapacity(); iter++, cnt++) { const ContentInfo *ci = *iter; - if (ci == this->selected) GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->resize.step_height - 1, 10); + if (ci == this->selected) GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->resize.step_height - 1, GREY_SCALE(10)); SpriteID sprite; SpriteID pal = PAL_NONE;
--- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -382,7 +382,7 @@ const NWidgetBase *nwi_info = this->GetWidget<NWidgetBase>(NGWW_INFO); /* show highlighted item with a different colour */ - if (highlight) GfxFillRect(nwi_name->pos_x + 1, y - 2, nwi_info->pos_x + nwi_info->current_x - 2, y + FONT_HEIGHT_NORMAL - 1, 10); + if (highlight) GfxFillRect(nwi_name->pos_x + 1, y - 2, nwi_info->pos_x + nwi_info->current_x - 2, y + FONT_HEIGHT_NORMAL - 1, GREY_SCALE(10)); DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y, cur_item->info.server_name, TC_BLACK); @@ -1490,7 +1490,7 @@ byte company = NetworkLobbyFindCompanyIndex(pos); bool income = false; if (this->company == company) { - GfxFillRect(r.left + 1, y - 2, r.right - 1, y + FONT_HEIGHT_NORMAL, 10); // show highlighted item with a different colour + GfxFillRect(r.left + 1, y - 2, r.right - 1, y + FONT_HEIGHT_NORMAL, GREY_SCALE(10)); // show highlighted item with a different colour } DrawString(text_left, text_right, y, this->company_info[company].company_name, TC_BLACK); @@ -1826,7 +1826,7 @@ for (const ClientListAction *action = this->actions.Begin(); action != this->actions.End(); action++, y += FONT_HEIGHT_NORMAL) { TextColour colour; if (sel-- == 0) { // Selected item, highlight it - GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, 0); + GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, GREY_SCALE(0)); colour = TC_WHITE; } else { colour = TC_BLACK; @@ -1978,7 +1978,7 @@ FOR_ALL_CLIENT_INFOS(ci) { TextColour colour; if (this->selected_item == i++) { // Selected item, highlight it - GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, 0); + GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, GREY_SCALE(0)); colour = TC_WHITE; } else { colour = TC_BLACK;
--- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -695,7 +695,7 @@ { switch (widget) { case SNGRFS_FILE_LIST: { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0xD7); + GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, GREY_SCALE(1)); uint step_height = this->GetWidget<NWidgetBase>(SNGRFS_FILE_LIST)->resize_y; uint y = r.top + WD_FRAMERECT_TOP; @@ -727,7 +727,7 @@ } case SNGRFS_AVAIL_LIST: { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0xD7); + GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, GREY_SCALE(1)); uint step_height = this->GetWidget<NWidgetBase>(SNGRFS_AVAIL_LIST)->resize_y; int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
--- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -335,12 +335,12 @@ void DrawNewsBorder(const Rect &r) const { - GfxFillRect(r.left, r.top, r.right, r.bottom, 0xF); + GfxFillRect(r.left, r.top, r.right, r.bottom, GREY_SCALE(15)); - GfxFillRect(r.left, r.top, r.left, r.bottom, 0xD7); - GfxFillRect(r.right, r.top, r.right, r.bottom, 0xD7); - GfxFillRect(r.left, r.top, r.right, r.top, 0xD7); - GfxFillRect(r.left, r.bottom, r.right, r.bottom, 0xD7); + GfxFillRect(r.left, r.top, r.left, r.bottom, GREY_SCALE(1)); + GfxFillRect(r.right, r.top, r.right, r.bottom, GREY_SCALE(1)); + GfxFillRect(r.left, r.top, r.right, r.top, GREY_SCALE(1)); + GfxFillRect(r.left, r.bottom, r.right, r.bottom, GREY_SCALE(1)); } virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) @@ -425,7 +425,7 @@ break; case NTW_VEH_BKGND: - GfxFillRect(r.left, r.top, r.right, r.bottom, 10); + GfxFillRect(r.left, r.top, r.right, r.bottom, GREY_SCALE(10)); break; case NTW_VEH_NAME:
--- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -206,7 +206,7 @@ if (spec == NULL) break; if (!spec->IsAvailable()) { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0, FILLRECT_CHECKER); + GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, GREY_SCALE(0), FILLRECT_CHECKER); } DrawPixelInfo tmp_dpi; /* Set up a clipping area for the preview. */
--- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1163,7 +1163,7 @@ const StationSpec *statspec = StationClass::Get(_railstation.station_class, type); if (statspec != NULL && HasBit(statspec->callback_mask, CBM_STATION_AVAIL) && GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0, FILLRECT_CHECKER); + GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, GREY_SCALE(0), FILLRECT_CHECKER); } /* Set up a clipping area for the station preview. */
--- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -952,7 +952,7 @@ _cur_dpi = dpi; /* Clear it */ - GfxFillRect(dpi->left, dpi->top, dpi->left + dpi->width - 1, dpi->top + dpi->height - 1, 0); + GfxFillRect(dpi->left, dpi->top, dpi->left + dpi->width - 1, dpi->top + dpi->height - 1, GREY_SCALE(0)); /* Which tile is displayed at (dpi->left, dpi->top)? */ int dx; @@ -1204,7 +1204,7 @@ DrawString(x + text_left, x + text_right, y, STR_SMALLMAP_INDUSTRY, TC_GREY); } else { DrawString(x + text_left, x + text_right, y, STR_SMALLMAP_INDUSTRY, TC_BLACK); - GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, 0); // Outer border of the legend colour + GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, GREY_SCALE(0)); // Outer border of the legend colour } } else if (this->map_type == SMT_OWNER && tbl->company != INVALID_COMPANY) { SetDParam(0, tbl->company); @@ -1214,13 +1214,13 @@ DrawString(x + text_left, x + text_right, y, STR_SMALLMAP_COMPANY, TC_GREY); } else { DrawString(x + text_left, x + text_right, y, STR_SMALLMAP_COMPANY, TC_BLACK); - GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, 0); // Outer border of the legend colour + GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, GREY_SCALE(0)); // Outer border of the legend colour } } else { if (this->map_type == SMT_CONTOUR) SetDParam(0, tbl->height * TILE_HEIGHT_STEP); /* Anything that is not an industry or a company is using normal process */ - GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, 0); + GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, GREY_SCALE(0)); DrawString(x + text_left, x + text_right, y, tbl->legend); } GfxFillRect(x + blob_left + 1, y + 2, x + blob_right - 1, y + row_height - 2, tbl->colour); // Legend colour
--- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -248,7 +248,7 @@ if (y + item_height < r.bottom) { bool selected = (this->selected_index == item->result); - if (selected) GfxFillRect(r.left + 2, y, r.right - 1, y + item_height - 1, 0); + if (selected) GfxFillRect(r.left + 2, y, r.right - 1, y + item_height - 1, GREY_SCALE(0)); item->Draw(r.left, r.right, y, r.bottom, selected, colour);