Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9477) removal of coast_cape, and some bugs
Home

[Freeciv-Dev] (PR#9477) removal of coast_cape, and some bugs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9477) removal of coast_cape, and some bugs
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Jul 2004 09:07:42 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9477 >

It's now possible to remove the coast_cape sprites from tileset code. 
Instead these can just be drawn as boolean-matched cell-based sprites.

However doing so exposes some bugs in the code.  When matching a certain 
layer of a terrain, it is matched against all other nearby terrains - 
even if those terrains don't have that layer.  The result is that an 
unitialized match type is used, which is usually 0.  This causes forests 
in isotrident to always be drawn "full".

The attached patch fixes the bug, removes coast_cape, and makes the 
necessary changes to the trident tileset.  I did not edit the tiles.png 
file even though some (duplicated) sprites in it are now redundant.

It might be easier in future to make the first layer of ocean work like 
this: boolean-matched cell-based.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.187
diff -u -r1.187 tilespec.c
--- client/tilespec.c   22 Jul 2004 02:53:31 -0000      1.187
+++ client/tilespec.c   22 Jul 2004 16:03:20 -0000
@@ -1451,13 +1451,6 @@
     SET_SPRITE_ALT(tx.farmland[i], buffer, "tx.farmland");
   }
 
-  if (!is_isometric) {
-    for(i=1; i<NUM_DIRECTION_NSEW; i++) {
-      my_snprintf(buffer, sizeof(buffer), "tx.coast_cape_%s", nsew_str(i));
-      SET_SPRITE(tx.coast_cape[i], buffer);
-    }
-  }
-
   switch (darkness_style) {
   case DARKNESS0:
     /* Nothing. */
@@ -2465,7 +2458,8 @@
       int match_type = draw->layer[l].match_type;
 
 #define MATCH(dir)                                               \
-      (sprites.terrain[ttype_near[(dir)]]->layer[l].match_type)
+      (sprites.terrain[ttype_near[(dir)]]->num_layers > l       \
+       ? sprites.terrain[ttype_near[(dir)]]->layer[l].match_type : -1)
 
       if (draw->layer[l].cell_type == CELL_SINGLE) {
        int tileno = 0, i;
@@ -2521,6 +2515,9 @@
           array_index = array_index * count + (m[0] != match_type);
           break;
         case MATCH_FULL:
+          if (m[0] == -1 || m[1] == -1 || m[2] == -1) {
+            break;
+          }
           array_index = array_index * count + m[2];
           array_index = array_index * count + m[1];
           array_index = array_index * count + m[0];
@@ -2590,25 +2587,6 @@
     }
   }
 
-  /* Extra "capes" added on in non-iso view. */
-  if (is_ocean(ttype) && !is_isometric) {
-    int tileno = INDEX_NSEW((is_ocean(ttype_near[DIR8_NORTH])
-                            && is_ocean(ttype_near[DIR8_EAST])
-                            && !is_ocean(ttype_near[DIR8_NORTHEAST])),
-                           (is_ocean(ttype_near[DIR8_SOUTH])
-                            && is_ocean(ttype_near[DIR8_WEST])
-                            && !is_ocean(ttype_near[DIR8_SOUTHWEST])),
-                           (is_ocean(ttype_near[DIR8_EAST])
-                            && is_ocean(ttype_near[DIR8_SOUTH])
-                            && !is_ocean(ttype_near[DIR8_SOUTHEAST])),
-                           (is_ocean(ttype_near[DIR8_NORTH])
-                            && is_ocean(ttype_near[DIR8_WEST])
-                            && !is_ocean(ttype_near[DIR8_NORTHWEST])));
-    if (tileno != 0) {
-      ADD_SPRITE_SIMPLE(sprites.tx.coast_cape[tileno]);
-    }
-  }
-
   return sprs - saved_sprs;
 }
 
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.79
diff -u -r1.79 tilespec.h
--- client/tilespec.h   22 Jul 2004 02:53:31 -0000      1.79
+++ client/tilespec.h   22 Jul 2004 16:03:21 -0000
@@ -272,9 +272,7 @@
       *fog,
       *spec_river[MAX_INDEX_CARDINAL],
       *darkness[NUM_DIRECTION_NSEW],         /* first unused */
-      *river_outlet[4],                /* indexed by enum direction4 */
-      /* for non-isometric */
-      *coast_cape[NUM_DIRECTION_NSEW];       /* first unused */
+      *river_outlet[4];                /* indexed by enum direction4 */
   } tx;                                /* terrain extra */
 
   struct terrain_drawing_data *terrain[MAX_NUM_TERRAINS];
Index: data/trident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident.tilespec,v
retrieving revision 1.23
diff -u -r1.23 trident.tilespec
--- data/trident.tilespec       27 Jun 2004 16:52:17 -0000      1.23
+++ data/trident.tilespec       22 Jul 2004 16:03:21 -0000
@@ -66,6 +66,10 @@
 match_style = "BOOL"
 match_types = "arctic", "desert", "forest", "grassland", "hills", "jungle", 
"mountains", "ocean", "plains", "swamp", "tundra"
 
+[layer1]
+match_style = "BOOL"
+match_types = "ocean"
+
 [terrain_arctic]
 is_blended = 0
 num_layers = 1
@@ -114,9 +118,12 @@
 
 [terrain_ocean]
 is_blended = 0
-num_layers = 1
+num_layers = 2
 layer0_match_style = "bool"
 layer0_match_type = "ocean"
+layer1_match_style = "bool"
+layer1_match_type = "ocean"
+layer1_cell_type = "rect"
 
 [terrain_plains]
 is_blended = 0
Index: data/trident/tiles.spec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident/tiles.spec,v
retrieving revision 1.19
diff -u -r1.19 tiles.spec
--- data/trident/tiles.spec     20 Jul 2004 14:02:38 -0000      1.19
+++ data/trident/tiles.spec     22 Jul 2004 16:03:21 -0000
@@ -23,25 +23,6 @@
 
 tiles = { "row", "column", "tag"
 
-; "Shoreline" "corner" tiles, designate shores north, south, east, 
-; west, actually that direction rotated 45 degrees clockwise:
-
-  0,  0, "tx.coast_cape_n1s0e0w0"
-  0,  1, "tx.coast_cape_n0s0e1w0"
-  0,  2, "tx.coast_cape_n1s0e1w0"
-  0,  3, "tx.coast_cape_n0s1e0w0"
-  0,  4, "tx.coast_cape_n1s1e0w0"
-  0,  5, "tx.coast_cape_n0s1e1w0"
-  0,  6, "tx.coast_cape_n1s1e1w0"
-  0,  7, "tx.coast_cape_n0s0e0w1"
-  0,  8, "tx.coast_cape_n1s0e0w1"
-  0,  9, "tx.coast_cape_n0s0e1w1"
-  0, 10, "tx.coast_cape_n1s0e1w1"
-  0, 11, "tx.coast_cape_n0s1e0w1"
-  0, 12, "tx.coast_cape_n1s1e0w1"
-  0, 13, "tx.coast_cape_n0s1e1w1"
-  0, 14, "tx.coast_cape_n1s1e1w1"
-
 ; Grassland, and whether terrain to north, south, east, west 
 ; is more grassland:
 
@@ -518,3 +499,48 @@
 tiles = { "row", "column", "tag"
   0, 0, "explode.nuke"
 }
+
+[grid_ocean]
+x_top_left = 420
+y_top_left = 0
+dx = 15
+dy = 15
+
+tiles = {"row", "column", "tag"
+  0,  0, "t.ocean_cell_u010"
+  0,  1, "t.ocean_cell_r010"
+  1,  0, "t.ocean_cell_l010"
+  1,  1, "t.ocean_cell_d010"
+
+  0,  2, "t.ocean_cell_u000"
+  0,  2, "t.ocean_cell_u001"
+  0,  2, "t.ocean_cell_u011"
+  0,  2, "t.ocean_cell_u100"
+  0,  2, "t.ocean_cell_u101"
+  0,  2, "t.ocean_cell_u110"
+  0,  2, "t.ocean_cell_u111"
+
+  0,  2, "t.ocean_cell_l000"
+  0,  2, "t.ocean_cell_l001"
+  0,  2, "t.ocean_cell_l011"
+  0,  2, "t.ocean_cell_l100"
+  0,  2, "t.ocean_cell_l101"
+  0,  2, "t.ocean_cell_l110"
+  0,  2, "t.ocean_cell_l111"
+
+  0,  2, "t.ocean_cell_r000"
+  0,  2, "t.ocean_cell_r001"
+  0,  2, "t.ocean_cell_r011"
+  0,  2, "t.ocean_cell_r100"
+  0,  2, "t.ocean_cell_r101"
+  0,  2, "t.ocean_cell_r110"
+  0,  2, "t.ocean_cell_r111"
+
+  0,  2, "t.ocean_cell_d000"
+  0,  2, "t.ocean_cell_d001"
+  0,  2, "t.ocean_cell_d011"
+  0,  2, "t.ocean_cell_d100"
+  0,  2, "t.ocean_cell_d101"
+  0,  2, "t.ocean_cell_d110"
+  0,  2, "t.ocean_cell_d111"
+}

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9477) removal of coast_cape, and some bugs, Jason Short <=