Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] (PR#11792) New fog of war is too dark
Home

[Freeciv-Dev] (PR#11792) New fog of war is too dark

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#11792) New fog of war is too dark
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 4 Jan 2005 13:49:31 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11792 >

This transaction appears to have no content
? gmon.out
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.101
diff -u -r1.101 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       25 Dec 2004 19:50:29 -0000      1.101
+++ client/gui-gtk-2.0/gui_main.c       4 Jan 2005 21:35:19 -0000
@@ -87,6 +87,7 @@
 bool enable_tabs = TRUE;
 bool solid_unit_icon_bg = FALSE;
 bool better_fog = TRUE;
+int fog_level = 50;
 
 GtkWidget *toplevel;
 GdkWindow *root_window;
@@ -185,7 +186,14 @@
                  N_("If this is enabled then a better method is used for "
                     "drawing fog-of-war.  It is not any slower but will "
                     "consume about twice as much memory."),
-                 COC_GRAPHICS)
+                 COC_GRAPHICS),
+  GEN_INT_OPTION(fog_level,
+                N_("Fog-of-war darkness level percentage"),
+                N_("If better fog-of-war drawing is enabled then this "
+                   "option controls how dark fog will be.  A value of 20 "
+                   "means fog will be drawn at 20% brightness.  You will "
+                   "have to restart the client after changing this value."),
+                COC_GRAPHICS)
 };
 const int num_gui_options = ARRAY_SIZE(gui_options);
 
Index: client/gui-gtk-2.0/gui_main.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.h,v
retrieving revision 1.19
diff -u -r1.19 gui_main.h
--- client/gui-gtk-2.0/gui_main.h       25 Dec 2004 19:50:29 -0000      1.19
+++ client/gui-gtk-2.0/gui_main.h       4 Jan 2005 21:35:19 -0000
@@ -45,6 +45,7 @@
 extern bool enable_tabs;
 extern bool solid_unit_icon_bg;
 extern bool better_fog;
+extern int fog_level;
 
 extern GdkGC *          civ_gc;
 extern GdkGC *          mask_fg_gc;
Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.152
diff -u -r1.152 mapview.c
--- client/gui-gtk-2.0/mapview.c        28 Dec 2004 23:01:51 -0000      1.152
+++ client/gui-gtk-2.0/mapview.c        4 Jan 2005 21:35:20 -0000
@@ -878,16 +878,17 @@
                                 0, 0, sprite->width, sprite->height);
 
   /* Iterate over all pixels, reducing brightness by 50%. */
+  fog_level = CLIP(0, fog_level, 100);
   for (x = 0; x < sprite->width; x++) {
     for (y = 0; y < sprite->height; y++) {
       guint32 pixel =  gdk_image_get_pixel(ftile, x, y);
 
       guint8 red = ((pixel & ftile->visual->red_mask)
-                   >> ftile->visual->red_shift) / 2;
+                   >> ftile->visual->red_shift) * fog_level / 100;
       guint8 green = ((pixel & ftile->visual->green_mask)
-                     >> ftile->visual->green_shift) / 2;
+                     >> ftile->visual->green_shift) * fog_level / 100;
       guint8 blue = ((pixel & ftile->visual->blue_mask)
-                    >> ftile->visual->blue_shift) / 2;
+                    >> ftile->visual->blue_shift) * fog_level / 100;
       guint32 result = red << ftile->visual->red_shift
        | green << ftile->visual->green_shift          
        | blue << ftile->visual->blue_shift;

[Prev in Thread] Current Thread [Next in Thread]