Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12072) unit offset
Home

[Freeciv-Dev] (PR#12072) unit offset

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12072) unit offset
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 1 Feb 2005 10:44:40 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch:

- Adds a unit_offset_x/unit_offset_y values to the tilespec (similar to 
flag_offset_x/flag_offset_y).

- Offsets units by that amount when drawing them.

- Removes the units from isotrident.  Instead isotrident uses the 
units.spec in trident.

- units.spec in isotrdident is still used but is much shorter.  Attached 
is the new units.png for isotrident.  This should really be renamed.  I 
made it with

   convert -crop 1280x48+0+144 units.png units2.png

Having isotrident use tridents units file is helpful at the moment, 
although future tilesets may use larger graphics that don't match the 
trident ones.  But having a unit_offset is helpful in general.

-jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.225
diff -u -r1.225 tilespec.c
--- client/tilespec.c   29 Jan 2005 18:18:04 -0000      1.225
+++ client/tilespec.c   1 Feb 2005 18:41:39 -0000
@@ -86,7 +86,9 @@
 
 static int roadstyle;
 int fogstyle;
+
 static int flag_offset_x, flag_offset_y;
+static int unit_offset_x, unit_offset_y;
 
 #define NUM_CORNER_DIRS 4
 #define TILES_PER_CORNER 4
@@ -879,6 +881,10 @@
                                             "tilespec.flag_offset_x");
   flag_offset_y = secfile_lookup_int_default(file, 0,
                                             "tilespec.flag_offset_y");
+  unit_offset_x = secfile_lookup_int_default(file, 0,
+                                            "tilespec.unit_offset_x");
+  unit_offset_y = secfile_lookup_int_default(file, 0,
+                                            "tilespec.unit_offset_y");
 
   c = secfile_lookup_str_default(file, "10x20", "tilespec.city_names_font");
   city_names_font = mystrdup(c);
@@ -1995,7 +2001,8 @@
     }
   }
 
-  ADD_SPRITE_FULL(unit_type(punit)->sprite);
+  ADD_SPRITE(unit_type(punit)->sprite, DRAW_FULL, TRUE,
+            unit_offset_x, unit_offset_y);
 
   if (sprites.unit.loaded && punit->transported_by != -1) {
     ADD_SPRITE_FULL(sprites.unit.loaded);
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.25
diff -u -r1.25 isotrident.tilespec
--- data/isotrident.tilespec    31 Jan 2005 01:34:04 -0000      1.25
+++ data/isotrident.tilespec    1 Feb 2005 18:41:39 -0000
@@ -31,6 +31,10 @@
 flag_offset_x = 17
 flag_offset_y = 11
 
+; offset the units by this amount when drawing units
+unit_offset_x = 21
+unit_offset_y = 13
+
 ; Font to use to draw city names:
 city_names_font = "9x15bold"
 
@@ -52,6 +56,7 @@
   "isotrident/tiles.spec",
   "misc/small.spec",
   "isotrident/units.spec",
+  "trident/units.spec",
   "misc/flags.spec",
   "misc/buildings.spec",
   "misc/space.spec",
Index: data/isotrident/units.png
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident/units.png,v
retrieving revision 1.5
diff -u -r1.5 units.png
Binary files /tmp/cvs61r4lO and units.png differ
Index: data/isotrident/units.spec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident/units.spec,v
retrieving revision 1.9
diff -u -r1.9 units.spec
--- data/isotrident/units.spec  4 Oct 2004 19:39:20 -0000       1.9
+++ data/isotrident/units.spec  1 Feb 2005 18:41:40 -0000
@@ -22,72 +22,18 @@
 
 tiles = { "row", "column", "tag"
 
-  0,  0, "u.armor"
-  0,  1, "u.howitzer"
-  0,  2, "u.battleship"
-  0,  3, "u.bomber"
-  0,  4, "u.cannon"
-  0,  5, "u.caravan"
-  0,  6, "u.carrier"
-  0,  7, "u.catapult"
-  0,  8, "u.horsemen"
-  0,  9, "u.chariot"
-  0, 10, "u.cruiser"
-  0, 11, "u.diplomat", "u.barbarian_leader"
-  0, 12, "u.fighter"
-  0, 13, "u.frigate"
-  0, 14, "u.ironclad"
-  0, 15, "u.knights"
-  0, 16, "u.legion"
-  0, 17, "u.mech_inf"
-  0, 18, "u.warriors"
-  0, 19, "u.musketeers"
-  1,  0, "u.nuclear"
-  1,  1, "u.phalanx"
-  1,  2, "u.riflemen"
-  1,  3, "u.caravel"
-  1,  4, "u.settlers"
-  1,  5, "u.submarine"
-  1,  6, "u.transport"
-  1,  7, "u.trireme"
-  1,  8, "u.archers"
-  1,  9, "u.cavalry"
-  1, 10, "u.cruise_missile"
-  1, 11, "u.destroyer"
-  1, 12, "u.dragoons"
-  1, 13, "u.explorer"
-  1, 14, "u.freight"
-  1, 15, "u.galleon"
-  1, 16, "u.partisan"
-  1, 17, "u.pikemen"
-  2,  0, "u.marines"
-  2,  1, "u.spy"
-  2,  2, "u.engineers"
-  2,  3, "u.artillery"
-  2,  4, "u.helicopter"
-  2,  5, "u.alpine_troops"
-  2,  6, "u.stealth_bomber"
-  2,  7, "u.stealth_fighter"
-  2,  8, "u.aegis_cruiser"
-  2,  9, "u.paratroopers"
-  2, 10, "u.elephants"
-  2, 11, "u.crusaders"
-  2, 12, "u.fanatics"
-  2, 13, "u.awacs"
-  2, 14, "u.worker"
-
 ; Veteran Levels: up to 9 military honors for experienced units
 
-  3, 0, "unit.vet_1"
-  3, 1, "unit.vet_2"
-  3, 2, "unit.vet_3"
-  3, 3, "unit.vet_4"
-  3, 4, "unit.vet_5"
-  3, 5, "unit.vet_6"
-  3, 6, "unit.vet_7"
-  3, 7, "unit.vet_8"
-  3, 8, "unit.vet_9"
+  0, 0, "unit.vet_1"
+  0, 1, "unit.vet_2"
+  0, 2, "unit.vet_3"
+  0, 3, "unit.vet_4"
+  0, 4, "unit.vet_5"
+  0, 5, "unit.vet_6"
+  0, 6, "unit.vet_7"
+  0, 7, "unit.vet_8"
+  0, 8, "unit.vet_9"
 
-  3, 11, "unit.lowfuel"
-  3, 11, "unit.tired"
+  0, 11, "unit.lowfuel"
+  0, 11, "unit.tired"
 }

PNG image


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12072) unit offset, Jason Short <=