(svn r2438) - Feature: New display option, 'transparent station signs', makes station signs transparent instead of using a solid bar to draw text on (peter1138)
authorhackykid
Tue, 14 Jun 2005 10:59:05 +0000
changeset 1932 275d72f700e2
parent 1931 a2a6669ef51c
child 1933 54663c631bc2
(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
main_gui.c
openttd.h
viewport.c
--- a/lang/english.txt	Fri Jun 10 07:41:26 2005 +0000
+++ b/lang/english.txt	Tue Jun 14 10:59:05 2005 +0000
@@ -768,6 +768,8 @@
 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
--- a/main_gui.c	Fri Jun 10 07:41:26 2005 +0000
+++ b/main_gui.c	Tue Jun 14 10:59:05 2005 +0000
@@ -184,6 +184,7 @@
 	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 @@
 {
 	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 @@
 	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;
 }
 
--- a/openttd.h	Fri Jun 10 07:41:26 2005 +0000
+++ b/openttd.h	Tue Jun 14 10:59:05 2005 +0000
@@ -125,13 +125,14 @@
 
 /* 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 */
--- a/viewport.c	Fri Jun 10 07:41:26 2005 +0000
+++ b/viewport.c	Tue Jun 14 10:59:05 2005 +0000
@@ -1155,13 +1155,16 @@
 				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));