Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2378) blend hills and mountains
Home

[Freeciv-Dev] (PR#2378) blend hills and mountains

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2378) blend hills and mountains
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Fri, 22 Nov 2002 03:38:00 -0800
Reply-to: rt@xxxxxxxxxxxxxx

This patch was sent by Rafal Burseg, but I've separated it and cleaned 
it up a bit.

It causes hills and mountains to blend together.  Currently, in 
isometric view there are 16 different hill and mountain tiles.  Which 
one gets chosen depends on whether the 4 orthogonally adjacent tiles are 
hills or mountains, respectively.  This means if a hill and a mountain 
are right next to each other, the same graphic is chosen as if they were 
bordering plains.

With the patch, hills and mountains are both considered 'mountainous' 
and will be considered equivalent in the adjacency check.  This makes 
mountainous regions look a lot more mountainous.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.91
diff -u -r1.91 tilespec.c
--- client/tilespec.c   2002/11/21 02:26:48     1.91
+++ client/tilespec.c   2002/11/22 11:31:17
@@ -1227,6 +1227,16 @@
 }
 
 /**********************************************************************
+  Return TRUE iff the given terrain type should be considered
+  'mountainous' by the drawing code.  Using this, hills and mountains
+  can blend together better.
+***********************************************************************/
+static bool is_mountainous(enum tile_terrain_type ttype)
+{
+  return ttype == T_HILLS || ttype == T_MOUNTAINS;
+}
+
+/**********************************************************************
 Fill in the sprite array for the tile at position (abs_x0,abs_y0).
 Does not fill in the city or unit; that have to be done seperatly in
 isometric view. Also, no fog here.
@@ -1298,10 +1308,10 @@
 
       switch (ttype) {
         case T_HILLS:
-        tileno = INDEX_NSEW(ttype_near[DIR8_NORTH] == T_HILLS,
-                         ttype_near[DIR8_SOUTH] == T_HILLS,
-                         ttype_near[DIR8_EAST] == T_HILLS,
-                         ttype_near[DIR8_WEST] == T_HILLS);
+        tileno = INDEX_NSEW(is_mountainous(ttype_near[DIR8_NORTH]),
+                           is_mountainous(ttype_near[DIR8_SOUTH]),
+                           is_mountainous(ttype_near[DIR8_EAST]),
+                           is_mountainous(ttype_near[DIR8_WEST]));
         *sprs++ = sprites.tx.spec_hill[tileno];
         break;
  
@@ -1314,10 +1324,10 @@
         break;
  
         case T_MOUNTAINS:
-        tileno = INDEX_NSEW(ttype_near[DIR8_NORTH] == T_MOUNTAINS,
-                         ttype_near[DIR8_SOUTH] == T_MOUNTAINS,
-                         ttype_near[DIR8_EAST] == T_MOUNTAINS,
-                         ttype_near[DIR8_WEST] == T_MOUNTAINS);
+        tileno = INDEX_NSEW(is_mountainous(ttype_near[DIR8_NORTH]),
+                           is_mountainous(ttype_near[DIR8_SOUTH]),
+                           is_mountainous(ttype_near[DIR8_EAST]),
+                           is_mountainous(ttype_near[DIR8_WEST]));
         *sprs++ = sprites.tx.spec_mountain[tileno];
         break;
 

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