From 6533db736c7a898211e9955a214a651b43ef712c Mon Sep 17 00:00:00 2001 From: hackykid Date: Tue, 14 Jun 2005 10:59:05 +0000 Subject: (svn r2438) - Feature: New display option, 'transparent station signs', makes station signs transparent instead of using a solid bar to draw text on (peter1138) --- lang/english.txt | 2 ++ main_gui.c | 4 +++- openttd.h | 15 ++++++++------- viewport.c | 7 +++++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lang/english.txt b/lang/english.txt index 2dc22dd39..271c10131 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -768,6 +768,8 @@ STR_02D1_FULL_DETAIL :{CHECKMARK}{SET STR_02D2_FULL_DETAIL :{SETX 12}Full detail STR_02D3_TRANSPARENT_BUILDINGS :{CHECKMARK}{SETX 12}Transparent buildings STR_02D4_TRANSPARENT_BUILDINGS :{SETX 12}Transparent buildings +STR_TRANSPARENT_SIGNS_C :{CHECKMARK}{SETX 12}Transparent station signs +STR_TRANSPARENT_SIGNS :{SETX 12}Transparent station signs ############ range ends here ############ range for menu starts diff --git a/main_gui.c b/main_gui.c index fa8495f64..df618e865 100644 --- a/main_gui.c +++ b/main_gui.c @@ -184,6 +184,7 @@ static void MenuClickSettings(int index) case 9: _display_opt ^= DO_FULL_ANIMATION; MarkWholeScreenDirty(); return; case 10: _display_opt ^= DO_FULL_DETAIL; MarkWholeScreenDirty(); return; case 11: _display_opt ^= DO_TRANS_BUILDINGS; MarkWholeScreenDirty(); return; + case 12: _display_opt ^= DO_TRANS_SIGNS; MarkWholeScreenDirty(); return; } } @@ -985,7 +986,7 @@ static void ToolbarOptionsClick(Window *w) { uint16 x; - w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 12); + w = PopupMainToolbMenu(w, 43, 2, STR_02C3_GAME_OPTIONS, 13); x = (uint16)-1; if (_display_opt & DO_SHOW_TOWN_NAMES) x &= ~(1<<5); @@ -995,6 +996,7 @@ static void ToolbarOptionsClick(Window *w) if (_display_opt & DO_FULL_ANIMATION) x &= ~(1<<9); if (_display_opt & DO_FULL_DETAIL) x &= ~(1<<10); if (_display_opt & DO_TRANS_BUILDINGS) x &= ~(1<<11); + if (_display_opt & DO_TRANS_SIGNS) x &= ~(1<<12); WP(w,menu_d).checked_items = x; } diff --git a/openttd.h b/openttd.h index c77225b37..6811ebf4e 100644 --- a/openttd.h +++ b/openttd.h @@ -125,13 +125,14 @@ enum { /* Display Options */ enum { - DO_SHOW_TOWN_NAMES = 1, - DO_SHOW_STATION_NAMES = 2, - DO_SHOW_SIGNS = 4, - DO_FULL_ANIMATION = 8, - DO_TRANS_BUILDINGS = 0x10, - DO_FULL_DETAIL = 0x20, - DO_WAYPOINTS = 0x40, + DO_SHOW_TOWN_NAMES = 1 << 0, + DO_SHOW_STATION_NAMES = 1 << 1, + DO_SHOW_SIGNS = 1 << 2, + DO_FULL_ANIMATION = 1 << 3, + DO_TRANS_BUILDINGS = 1 << 4, + DO_FULL_DETAIL = 1 << 5, + DO_WAYPOINTS = 1 << 6, + DO_TRANS_SIGNS = 1 << 7, }; /* Landscape types */ diff --git a/viewport.c b/viewport.c index 1cd6a4f5c..b58d5da98 100644 --- a/viewport.c +++ b/viewport.c @@ -1155,13 +1155,16 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, StringSpriteToDraw *ss) w -= 3; } - DrawFrameRect(x,y, x+w, bottom, ss->color, (_display_opt & DO_TRANS_BUILDINGS) ? 0x9 : 0); + /* Draw the rectangle if 'tranparent station signs' is off, or if we are drawing a general text sign (STR_2806) */ + if(!(_display_opt & DO_TRANS_SIGNS) || ss->string == STR_2806) + DrawFrameRect(x,y, x+w, bottom, ss->color, (_display_opt & DO_TRANS_BUILDINGS) ? 0x9 : 0); } SetDParam(0, ss->params[0]); SetDParam(1, ss->params[1]); SetDParam(2, ss->params[2]); - if (_display_opt & DO_TRANS_BUILDINGS && ss->width != 0) { + /* if we didnt draw a rectangle, or if transparant building is on, draw the text in the color the rectangle would have */ + if (((_display_opt & DO_TRANS_BUILDINGS) || (_display_opt & DO_TRANS_SIGNS && ss->string != STR_2806)) && ss->width != 0) { /* Real colors need the IS_PALETTE_COLOR flag, otherwise colors from _string_colormap are assumed. */ DrawString(ss->x >> zoom, (ss->y >> zoom) - (ss->width&0x8000?2:0), ss->string, (_color_list[ss->color].window_color_bgb | IS_PALETTE_COLOR)); -- cgit v1.2.3-70-g09d2