Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11464) fogstyle tileset setting
Home

[Freeciv-Dev] (PR#11464) fogstyle tileset setting

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11464) fogstyle tileset setting
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Dec 2004 17:21:11 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch adds a new fogstyle setting.  If set to 0 then fog is done 
civ2-style.  If set to 1 then fog is done civ1-style.  (0 and 1 have the 
same meanings for roadstyle.)  In theory this should allow 
mix-and-matching in the future to make later extensions easier.  See 
also PR#11433 and PR#11080.

Even in the near future this could be used to speed up iso-view drawing 
and fix the reported FOW problems.  It is therefore a candidate for 2.0 
(maybe).

-jason

? core.13161
? diff
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.164
diff -u -r1.164 mapview_common.c
--- client/mapview_common.c     9 Dec 2004 21:28:53 -0000       1.164
+++ client/mapview_common.c     11 Dec 2004 01:19:51 -0000
@@ -1311,14 +1311,8 @@
                  int canvas_x, int canvas_y, bool citymode)
 {
   if (tile_get_known(ptile) != TILE_UNKNOWN) {
-    struct drawn_sprite tile_sprs[80];
-
-    int count = fill_sprite_array(tile_sprs, ptile,
-                                 get_drawable_unit(ptile, citymode),
-                                 map_get_city(ptile), citymode);
-
-    put_drawn_sprites(pcanvas, canvas_x, canvas_y,
-                     count, tile_sprs, FALSE);
+    /* FIXME: These two functions should be merged. */
+    put_one_tile_iso(pcanvas, ptile, canvas_x, canvas_y, citymode);
   } else {
     /* tile is unknown */
     canvas_put_rectangle(pcanvas, COLOR_STD_BLACK,
@@ -1464,7 +1458,8 @@
   int count = fill_sprite_array(tile_sprs, ptile,
                                get_drawable_unit(ptile, citymode),
                                ptile->city, citymode);
-  bool fog = ptile->known == TILE_KNOWN_FOGGED && draw_fog_of_war;
+  bool fog = (ptile->known == TILE_KNOWN_FOGGED && draw_fog_of_war
+             && fogstyle == 0);
 
   /*** Draw terrain and specials ***/
   put_drawn_sprites(pcanvas, canvas_x, canvas_y, count, tile_sprs, fog);
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.218
diff -u -r1.218 tilespec.c
--- client/tilespec.c   9 Dec 2004 02:21:46 -0000       1.218
+++ client/tilespec.c   11 Dec 2004 01:19:51 -0000
@@ -85,6 +85,7 @@
 int num_tiles_explode_unit=0;
 
 static int roadstyle;
+int fogstyle;
 static int flag_offset_x, flag_offset_y;
 
 #define NUM_CORNER_DIRS 4
@@ -846,6 +847,8 @@
 
   roadstyle = secfile_lookup_int_default(file, is_isometric ? 0 : 1,
                                         "tilespec.roadstyle");
+  fogstyle = secfile_lookup_int_default(file, is_isometric ? 0 : 1,
+                                       "tilespec.fogstyle");
   darkness_style = secfile_lookup_int(file, "tilespec.darkness_style");
   if (darkness_style < DARKNESS_NONE
       || darkness_style > DARKNESS_CARD_FULL
@@ -1896,7 +1899,7 @@
    sprs->type = DRAWN_SPRITE,                                  \
    sprs->data.sprite.style = draw_style,                       \
    sprs->data.sprite.sprite = s,                               \
-   sprs->data.sprite.foggable = draw_fog,                      \
+   sprs->data.sprite.foggable = (draw_fog && fogstyle == 0),   \
    sprs->data.sprite.offset_x = x_offset,                      \
    sprs->data.sprite.offset_y = y_offset,                      \
    sprs++)
@@ -2754,9 +2757,9 @@
     }
   }
 
-  if (!is_isometric && draw_fog_of_war
+  if (fogstyle == 1 && draw_fog_of_war
       && ptile && tile_get_known(ptile) == TILE_KNOWN_FOGGED) {
-    /* Fogging in non-iso is done this way. */
+    /* With fogstyle 1, fog is done this way. */
     ADD_SPRITE_SIMPLE(sprites.tx.fog);
   }
 
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.92
diff -u -r1.92 tilespec.h
--- client/tilespec.h   3 Dec 2004 09:39:39 -0000       1.92
+++ client/tilespec.h   11 Dec 2004 01:19:51 -0000
@@ -266,6 +266,7 @@
 };
 
 extern struct named_sprites sprites;
+extern int fogstyle;
 
 struct Sprite *get_citizen_sprite(struct citizen_type type,
                                  int citizen_index,
Index: data/isophex.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isophex.tilespec,v
retrieving revision 1.2
diff -u -r1.2 isophex.tilespec
--- data/isophex.tilespec       24 Oct 2004 23:44:22 -0000      1.2
+++ data/isophex.tilespec       11 Dec 2004 01:19:51 -0000
@@ -19,6 +19,9 @@
 ; Use roadstyle 0 (old iso style)
 roadstyle = 0
 
+; Use fogstyle 0 (old iso style)
+fogstyle = 0
+
 ; Use darkness style 1 (single-sprite)
 darkness_style = 2
  
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.22
diff -u -r1.22 isotrident.tilespec
--- data/isotrident.tilespec    1 Dec 2004 19:21:17 -0000       1.22
+++ data/isotrident.tilespec    11 Dec 2004 01:19:51 -0000
@@ -21,6 +21,9 @@
 ; Use roadstyle 0 (old iso style)
 roadstyle = 0
 
+; Use fogstyle  (old iso style)
+fogstyle = 0
+
 ; Use darkness style 1 (single-sprite)
 darkness_style = 1
  
Index: data/trident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident.tilespec,v
retrieving revision 1.26
diff -u -r1.26 trident.tilespec
--- data/trident.tilespec       1 Dec 2004 19:21:17 -0000       1.26
+++ data/trident.tilespec       11 Dec 2004 01:19:51 -0000
@@ -21,6 +21,9 @@
 ; Use roadstyle 1 (old non-iso style)
 roadstyle = 1
 
+; Use fogstyle 1 (old non-iso style)
+fogstyle = 1
+
 ; Use darkness style 3 (15 sprites)
 darkness_style = 3
  
Index: data/trident_shields.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident_shields.tilespec,v
retrieving revision 1.16
diff -u -r1.16 trident_shields.tilespec
--- data/trident_shields.tilespec       3 Nov 2004 03:34:54 -0000       1.16
+++ data/trident_shields.tilespec       11 Dec 2004 01:19:51 -0000
@@ -25,6 +25,9 @@
 ; Do not blend hills and mountains together.
 is_mountainous = 0
 
+; Use fogstyle 1 (old non-iso style)
+fogstyle = 1
+
 ; Use roadstyle 1 (old non-iso style)
 roadstyle = 1
 
Index: doc/README.graphics
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/README.graphics,v
retrieving revision 1.13
diff -u -r1.13 README.graphics
--- doc/README.graphics 1 Dec 2004 19:21:17 -0000       1.13
+++ doc/README.graphics 11 Dec 2004 01:19:52 -0000
@@ -104,6 +104,14 @@
                           2 : One sprite is drawn to show roads in all
                               directions.  There are thus 256 road and 256
                               rail sprites (64 for a hex tileset).
+  fogstyle              : Specifies how fog is drawn.
+                          0 : A single fog sprite is drawn on top of all
+                              other sprites for fogged tiles.  The
+                              tx.fog sprite is used for this.
+                          1 : Each sprite for a fogged tile is drawn fogged.
+                              The tx.fog sprite may be used for the fog
+                              drawing (but clipped by the mask of the
+                              underlying sprite).
   darkness_style        : Specifies how "encroaching darkness" is drawn.
                           0 : No darkness.
                           1 : A single sprite can be split into 4 parts, each

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11464) fogstyle tileset setting, Jason Short <=