stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus data/ccl/units.ccl data/ccl/human/uni...


From: Crestez Leonard
Subject: [Stratagus-CVS] stratagus data/ccl/units.ccl data/ccl/human/uni...
Date: Sat, 08 Nov 2003 21:42:06 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Crestez Leonard <address@hidden>        03/11/08 21:42:06

Modified files:
        data/ccl       : units.ccl 
        data/ccl/human : units.ccl 
        data/ccl/orc   : units.ccl 
        doc/ccl        : unittype.html 
        src/clone      : mainloop.c unit.c unit_draw.c 
        src/include    : unit.h unittype.h 
        src/unit       : ccl_unittype.c unittype.c 
        src/video      : cursor.c 

Log message:
        Removed DrawBuilding, merged it with DrawUnit. This was long overdue.

Patches:
Index: stratagus/data/ccl/human/units.ccl
diff -u stratagus/data/ccl/human/units.ccl:1.48 
stratagus/data/ccl/human/units.ccl:1.49
--- stratagus/data/ccl/human/units.ccl:1.48     Sat Nov  1 23:20:36 2003
+++ stratagus/data/ccl/human/units.ccl  Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: units.ccl,v 1.48 2003/11/02 04:20:36 jsalmon3 Exp $
+;;     $Id: units.ccl,v 1.49 2003/11/09 02:42:05 n0body Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -821,7 +821,7 @@
   'corpse '(unit-destroyed-2x2-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "farm-selected"
     acknowledge "farm-acknowledge"
@@ -851,7 +851,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "human-barracks-selected"
     acknowledge "human-barracks-acknowledge"
@@ -881,7 +881,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "church-selected"
     acknowledge "church-acknowledge"
@@ -912,7 +912,7 @@
   'explode-when-killed 'missile-explosion
   'type-land
   'can-target-land 'can-target-sea 'can-target-air
-  'building 
+  'building 'visible-under-fog 
   'detect-cloak
   'sounds '(
     selected "human-watch-tower-selected"
@@ -943,7 +943,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "stables-selected"
     acknowledge "stables-acknowledge"
@@ -973,7 +973,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "gnomish-inventor-selected"
     acknowledge "gnomish-inventor-acknowledge"
@@ -1003,7 +1003,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "gryphon-aviary-selected"
     acknowledge "gryphon-aviary-acknowledge"
@@ -1033,7 +1033,7 @@
   'corpse '(unit-destroyed-3x3-place 3)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'shore-building
   'can-store '(oil)
   'sounds '(
@@ -1067,7 +1067,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'can-store '(wood)
   'sounds '(
     selected "elven-lumber-mill-selected"
@@ -1098,7 +1098,7 @@
   'corpse '(unit-destroyed-3x3-place 3)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'shore-building
   'sounds '(
     selected "human-foundry-selected"
@@ -1130,7 +1130,7 @@
   'corpse '(unit-destroyed-4x4-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'can-store '(wood gold)
   'sounds '(
     selected "town-hall-selected"
@@ -1161,7 +1161,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "mage-tower-selected"
     acknowledge "mage-tower-acknowledge"
@@ -1191,7 +1191,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "human-blacksmith-selected"
     acknowledge "human-blacksmith-acknowledge"
@@ -1222,7 +1222,7 @@
   'corpse '(unit-destroyed-3x3-place 3)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'shore-building
   'can-store '(oil)
   'sounds '(
@@ -1253,7 +1253,7 @@
   'corpse '(unit-destroyed-3x3-place 3)
   'explode-when-killed 'missile-explosion
   'type-naval
-  'building 
+  'building 'visible-under-fog 
   'must-build-on-top 'unit-oil-patch
   'gives-resource 'oil 'can-harvest
   'sounds '(
@@ -1287,7 +1287,7 @@
   'corpse '(unit-destroyed-4x4-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'can-store '(gold wood)
   'sounds '(
     selected "keep-selected"
@@ -1320,7 +1320,7 @@
   'corpse '(unit-destroyed-4x4-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'can-store '(gold wood)
   'sounds '(
     selected "castle-selected"
@@ -1376,7 +1376,7 @@
   'type-land
   'can-attack
   'can-target-land 'can-target-sea 'can-target-air
-  'building 
+  'building 'visible-under-fog 
   'detect-cloak
   'sounds '(
     selected "human-guard-tower-selected"
@@ -1410,7 +1410,7 @@
   'type-land
   'can-attack
   'can-target-land 'can-target-sea
-  'building 
+  'building 'visible-under-fog 
   'detect-cloak
   'sounds '(
     selected "human-cannon-tower-selected"
@@ -1439,7 +1439,7 @@
   'corpse '(unit-destroyed-1x1-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "human-wall-selected"
     acknowledge "human-wall-acknowledge"
Index: stratagus/data/ccl/orc/units.ccl
diff -u stratagus/data/ccl/orc/units.ccl:1.50 
stratagus/data/ccl/orc/units.ccl:1.51
--- stratagus/data/ccl/orc/units.ccl:1.50       Sat Nov  1 23:20:36 2003
+++ stratagus/data/ccl/orc/units.ccl    Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: units.ccl,v 1.50 2003/11/02 04:20:36 jsalmon3 Exp $
+;;     $Id: units.ccl,v 1.51 2003/11/09 02:42:05 n0body Exp $
 
 ;;=============================================================================
 ;;     Define unit-types.
@@ -913,7 +913,7 @@
   'corpse '(unit-destroyed-2x2-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "pig-farm-selected"
     acknowledge "pig-farm-acknowledge"
@@ -943,7 +943,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "orc-barracks-selected"
     acknowledge "orc-barracks-acknowledge"
@@ -973,7 +973,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "altar-of-storms-selected"
     acknowledge "altar-of-storms-acknowledge"
@@ -1004,7 +1004,7 @@
   'explode-when-killed 'missile-explosion
   'type-land
   'can-target-land 'can-target-sea 'can-target-air
-  'building 
+  'building 'visible-under-fog 
   'detect-cloak
   'sounds '(
     selected "orc-watch-tower-selected"
@@ -1035,7 +1035,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "ogre-mound-selected"
     acknowledge "ogre-mound-acknowledge"
@@ -1065,7 +1065,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "goblin-alchemist-selected"
     acknowledge "goblin-alchemist-acknowledge"
@@ -1095,7 +1095,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "dragon-roost-selected"
     acknowledge "dragon-roost-acknowledge"
@@ -1125,7 +1125,7 @@
   'corpse '(unit-destroyed-3x3-place 3)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'shore-building
   'can-store '(oil)
   'sounds '(
@@ -1158,7 +1158,7 @@
   'corpse '(unit-destroyed-4x4-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'can-store '(gold wood)
   'sounds '(
     selected "great-hall-selected"
@@ -1191,7 +1191,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'can-store '(wood)
   'sounds '(
     selected "troll-lumber-mill-selected"
@@ -1222,7 +1222,7 @@
   'corpse '(unit-destroyed-3x3-place 3)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'shore-building
   'sounds '(
     selected "orc-foundry-selected"
@@ -1253,7 +1253,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "temple-of-the-damned-selected"
     acknowledge "temple-of-the-damned-acknowledge"
@@ -1283,7 +1283,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "orc-blacksmith-selected"
     acknowledge "orc-blacksmith-acknowledge"
@@ -1314,7 +1314,7 @@
   'corpse '(unit-destroyed-3x3-place 3)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'shore-building
   'can-store '(oil)
   'sounds '(
@@ -1345,7 +1345,7 @@
   'corpse '(unit-destroyed-3x3-place 3)
   'explode-when-killed 'missile-explosion
   'type-naval
-  'building 
+  'building 'visible-under-fog 
   'must-build-on-top 'unit-oil-patch
   'gives-resource 'oil 'can-harvest
   'sounds '(
@@ -1379,7 +1379,7 @@
   'corpse '(unit-destroyed-4x4-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'can-store '(gold wood)
   'sounds '(
     selected "stronghold-selected"
@@ -1412,7 +1412,7 @@
   'corpse '(unit-destroyed-4x4-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'can-store '(gold wood)
   'sounds '(
     selected "fortress-selected"
@@ -1468,7 +1468,7 @@
   'type-land
   'can-attack
   'can-target-land 'can-target-sea 'can-target-air
-  'building 
+  'building 'visible-under-fog 
   'detect-cloak
   'sounds '(
     selected "orc-guard-tower-selected"
@@ -1502,7 +1502,7 @@
   'type-land
   'can-attack
   'can-target-land 'can-target-sea
-  'building 
+  'building 'visible-under-fog 
   'detect-cloak
   'sounds '(
     selected "orc-cannon-tower-selected"
@@ -1529,7 +1529,7 @@
   'corpse '(unit-destroyed-1x1-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 
+  'building 'visible-under-fog 
   'sounds '(
     selected "orc-wall-selected"
     acknowledge "orc-wall-acknowledge"
Index: stratagus/data/ccl/units.ccl
diff -u stratagus/data/ccl/units.ccl:1.52 stratagus/data/ccl/units.ccl:1.53
--- stratagus/data/ccl/units.ccl:1.52   Sat Nov  8 05:23:03 2003
+++ stratagus/data/ccl/units.ccl        Sat Nov  8 21:42:04 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: units.ccl,v 1.52 2003/11/08 10:23:03 martinxyz Exp $
+;;     $Id: units.ccl,v 1.53 2003/11/09 02:42:04 n0body Exp $
 
 ;; Load the animations for the units.
 (ccl:load "ccl/anim.ccl")
@@ -199,7 +199,7 @@
   'corpse '(unit-destroyed-3x3-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building
+  'building 'visible-under-fog
   'gives-resource 'gold 'can-harvest
   'sounds '(
     selected "gold-mine-selected"
@@ -224,7 +224,7 @@
   'basic-damage 0 'piercing-damage 0 'missile 'missile-none
   'priority 0
   'type-naval
-  'building
+  'building 'visible-under-fog
   'gives-resource 'oil
   'sounds '(
     selected "oil-patch-selected"
@@ -249,7 +249,7 @@
   'corpse '(unit-destroyed-2x2-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building
+  'building 'visible-under-fog
   'sounds '(
     selected "circle-of-power-selected"
     acknowledge "circle-of-power-acknowledge"
@@ -281,7 +281,7 @@
   'corpse '(unit-destroyed-4x4-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 'builder-outside
+  'building 'visible-under-fog 'builder-outside
   'teleporter
   'sounds '(
     selected "dark-portal-selected"
@@ -314,7 +314,7 @@
   'corpse '(unit-destroyed-2x2-place 0)
   'explode-when-killed 'missile-explosion
   'type-land
-  'building 'builder-outside
+  'building 'visible-under-fog 'builder-outside
   'sounds '(
     selected "runestone-selected"
     acknowledge "runestone-acknowledge"
@@ -355,7 +355,7 @@
   'basic-damage 0 'piercing-damage 0 'missile 'missile-none
   'priority 0
   'type-land
-  'building
+  'building 'visible-under-fog
   'vanishes
   'sounds '())
 
@@ -374,7 +374,7 @@
   'basic-damage 0 'piercing-damage 0 'missile 'missile-none
   'priority 0
   'type-land
-  'building
+  'building 'visible-under-fog
   'vanishes
   'sounds '())
 
@@ -390,7 +390,7 @@
   'basic-damage 0 'piercing-damage 0 'missile 'missile-none
   'priority 0
   'type-land
-  'building
+  'building 'visible-under-fog
   'vanishes
   'sounds '())
 
@@ -406,7 +406,7 @@
   'basic-damage 0 'piercing-damage 0 'missile 'missile-none
   'priority 0
   'type-land
-  'building
+  'building 'visible-under-fog
   'vanishes
   'sounds '())
 
@@ -421,7 +421,7 @@
   'priority 0
   'decay-rate 1
   'type-land
-  'building
+  'building 'visible-under-fog
   'revealer
   'detect-cloak
   'sounds '())
@@ -437,7 +437,7 @@
   'priority 0
   'decay-rate 1
   'type-land
-  'building
+  'building 'visible-under-fog
   'sounds '())
 
 ;; Load the different races
Index: stratagus/doc/ccl/unittype.html
diff -u stratagus/doc/ccl/unittype.html:1.40 
stratagus/doc/ccl/unittype.html:1.41
--- stratagus/doc/ccl/unittype.html:1.40        Fri Oct 31 01:18:55 2003
+++ stratagus/doc/ccl/unittype.html     Sat Nov  8 21:42:05 2003
@@ -417,6 +417,10 @@
 <dt>building</dt>
 <dd>Unit is a building, and imobile. Available as a spell target check.
 </dd>
+<dt>visible-under-fow</dt>
+<dd>Unit remains visible under fog of war. In most games this is true for and 
only for
+buildings.
+</dd>
 <dt>shore-building</dt>
 <dd>Unit is a shore building, and imobile. This is used for those unique 
buildings
 that have to be build on sea and have at least one point on coast.
@@ -768,7 +772,7 @@
 <h4>Not Used</h4>
 
 <hr>
-Last changed: $Id: unittype.html,v 1.40 2003/10/31 06:18:55 jsalmon3 Exp $<br>
+Last changed: $Id: unittype.html,v 1.41 2003/11/09 02:42:05 n0body Exp $<br>
 All trademarks and copyrights on this page are owned by their respective 
owners.
 <address>(c) 2002-2003 by <a href="http://stratagus.org";>
 The Stratagus Project</a></address></body></html>
Index: stratagus/src/clone/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.158 
stratagus/src/clone/mainloop.c:1.159
--- stratagus/src/clone/mainloop.c:1.158        Sat Nov  8 11:00:24 2003
+++ stratagus/src/clone/mainloop.c      Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: mainloop.c,v 1.158 2003/11/08 16:00:24 jsalmon3 Exp $
+//     $Id: mainloop.c,v 1.159 2003/11/09 02:42:05 n0body Exp $
 
 //@{
 
@@ -423,11 +423,7 @@
        while (i < nunits && j < nmissiles) {
            if (table[i]->Type->DrawLevel <= missiletable[j]->Type->DrawLevel) {
                if (UnitVisibleInViewport(vp, table[i])) {
-                   if (table[i]->Type->Building) {
-                       DrawBuilding(table[i]);
-                   } else {
-                       DrawUnit(table[i]);
-                   }
+                   DrawUnit(table[i]);
                }
                ++i;
            } else {
@@ -452,11 +448,7 @@
        }
        for (; i < nunits; ++i) {
            if (UnitVisibleInViewport(vp, table[i])) {
-               if (table[i]->Type->Building) {
-                   DrawBuilding(table[i]);
-               } else {
-                   DrawUnit(table[i]);
-               }
+               DrawUnit(table[i]);
            }
        }
        for (; j < nmissiles; ++j) {
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.328 stratagus/src/clone/unit.c:1.329
--- stratagus/src/clone/unit.c:1.328    Sat Nov  8 01:54:03 2003
+++ stratagus/src/clone/unit.c  Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.c,v 1.328 2003/11/08 06:54:03 mr-russ Exp $
+//     $Id: unit.c,v 1.329 2003/11/09 02:42:05 n0body Exp $
 
 //@{
 
@@ -1215,7 +1215,7 @@
     for (; h-- > 0;) {
        for (w = w0; w-- > 0;) {
            if (IsMapFieldVisible(ThisPlayer, x + w, y + h) || ReplayRevealMap 
||
-                   (unit->Type->Building && unit->SeenFrame != UnitNotSeen &&
+                   (unit->Type->VisibleUnderFog && unit->SeenFrame != 
UnitNotSeen &&
                        IsMapFieldExplored(ThisPlayer, x + w, y + h))) {
                return 1;
            }
@@ -3755,7 +3755,7 @@
     int RunStart;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.328 2003/11/08 06:54:03 
mr-russ Exp $\n\n");
+    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.329 2003/11/09 02:42:05 
n0body Exp $\n\n");
 
     //
     // Local variables
Index: stratagus/src/clone/unit_draw.c
diff -u stratagus/src/clone/unit_draw.c:1.176 
stratagus/src/clone/unit_draw.c:1.177
--- stratagus/src/clone/unit_draw.c:1.176       Sat Nov  8 01:54:03 2003
+++ stratagus/src/clone/unit_draw.c     Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit_draw.c,v 1.176 2003/11/08 06:54:03 mr-russ Exp $
+//     $Id: unit_draw.c,v 1.177 2003/11/09 02:42:05 n0body Exp $
 
 //@{
 
@@ -583,7 +583,7 @@
 global void SaveDecorations(CLFile* file)
 {
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.176 
2003/11/08 06:54:03 mr-russ Exp $\n\n");
+    CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.177 
2003/11/09 02:42:05 n0body Exp $\n\n");
 
     CLprintf(file, "(mana-sprite \"%s\"  %d %d  %d %d)\n",
        ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -1742,7 +1742,7 @@
        x -= unit->Type->TileWidth * TileSizeX / 2;
        y -= unit->Type->TileHeight * TileSizeY / 2;
        GraphicUnitPixels(unit, unit->Type->Sprite);
-       DrawUnitType(unit->Type, frame, x, y);
+       DrawUnitType(unit->Type, unit->Type->Sprite, frame, x, y);
 #ifdef USE_OPENGL
        DrawUnitPlayerColor(unit->Type, unit->Player->Player, frame, x, y);
 #endif
@@ -1762,23 +1762,27 @@
 */
 
 /**
-**     Draw building on map.
+**     Draw unit on map.
 **
-**     @param unit     Pointer to the building
+**     @param unit     Pointer to the unit.
 */
-global void DrawBuilding(const Unit* unit)
+global void DrawUnit(const Unit* unit)
 {
     int x;
     int y;
-    const UnitType* type;
     int frame;
-    int visible;
     int state;
     int constructed;
+    Graphic* sprite;
+    ResourceInfo* resinfo;
+    const UnitType* type;
 
-    visible = BuildingVisibleOnMap(unit);
+    if (unit->Type->Revealer) {                // Revealers are not drawn
+       DebugLevel3Fn("Drawing revealer %d\n" _C_ UnitNumber(unit));
+       return;
+    }
 
-    if (ReplayRevealMap) {
+    if (ReplayRevealMap || !unit->Type->VisibleUnderFog) {
        type = unit->Type;
        frame = unit->Frame;
        y = unit->IY;
@@ -1795,15 +1799,20 @@
        state = unit->SeenState;
     }
 
-    x += Map2ViewportX(CurrentViewport, unit->X);
-    y += Map2ViewportY(CurrentViewport, unit->Y);
-
     if (frame == UnitNotSeen) {
-       DebugLevel0Fn("FIXME: Something is wrong, unit %d not seen time 
%lu?.\n" _C_
+       DebugLevel0Fn("FIXME: Something is wrong, unit %d not seen but drawn 
time %lu?.\n" _C_
            unit->Slot _C_ GameCycle);
        return;
     }
 
+#ifdef NEW_DECODRAW
+    if (!CurrentViewport) {
+       CurrentViewport = TheUI.SelectedViewport;
+    }
+#endif
+    x += Map2ViewportX(CurrentViewport, unit->X);
+    y += Map2ViewportY(CurrentViewport, unit->Y);
+
     if (state == 1 && constructed) {
        DrawConstructionShadow(unit, frame, x, y);
     } else {
@@ -1815,7 +1824,27 @@
     //
     DrawUnitSelection(unit);
 
+    GraphicUnitPixels(unit, type->Sprite);
+
+    //
+    // Adjust sprite for Harvesters.
     //
+    sprite = type->Sprite;
+    if (type->Harvester && unit->CurrentResource) {
+       resinfo = type->ResInfo[unit->CurrentResource];
+       if (unit->Value) {
+           if (resinfo->SpriteWhenLoaded) {
+               sprite = resinfo->SpriteWhenLoaded;
+           }
+       } else {
+           if (resinfo->SpriteWhenEmpty) {
+               sprite = resinfo->SpriteWhenEmpty;
+           }
+       }
+    }
+
+    //
+    // Now draw!
     // Buildings under construction/upgrade/ready.
     //
     if (state == 1) {
@@ -1830,90 +1859,20 @@
     } else if (state == 2) {
        // FIXME: this frame is hardcoded!!!
        GraphicUnitPixels(unit, type->Sprite);
-       DrawUnitType(type, frame < 0 ? -1 : 1, x, y);
+       DrawUnitType(type, sprite, frame < 0 ? -1 : 1, x, y);
 #ifdef USE_OPENGL
        DrawUnitPlayerColor(type, unit->Player->Player,
            frame < 0 ? -1 : 1, x, y);
 #endif
     } else {
-       GraphicUnitPixels(unit, type->Sprite);
-       DrawUnitType(type, frame, x, y);
+       DrawUnitType(type, sprite, frame, x, y);
 #ifdef USE_OPENGL
        DrawUnitPlayerColor(type, unit->Player->Player, frame, x, y);
 #endif
     }
 
-    // FIXME: johns: ugly check here, should be removed!
-    if (visible || ReplayRevealMap) {
-       DrawInformations(unit, type, x, y);
-    }
-}
-
-/**
-**     Draw unit on map.
-**
-**     @param unit     Pointer to the unit.
-*/
-global void DrawUnit(const Unit* unit)
-{
-    int x;
-    int y;
-    Graphic* sprite;
-    ResourceInfo* resinfo;
-    const UnitType* type;
-
-    if (unit->Type->Revealer) {                // Revealers are not drawn
-       DebugLevel3Fn("Drawing revealer %d\n" _C_ UnitNumber(unit));
-       return;
-    }
-
-#ifdef NEW_DECODRAW
-    if (!CurrentViewport) {
-       CurrentViewport = TheUI.SelectedViewport;
-    }
-#endif
-    x = Map2ViewportX(CurrentViewport, unit->X) + unit->IX;
-    y = Map2ViewportY(CurrentViewport, unit->Y) + unit->IY;
-
-    type = unit->Type;
-
-    DrawShadow(unit, NULL, unit->Frame, x, y);
-
-    //
-    // Show that the unit is selected
-    //
-    DrawUnitSelection(unit);
-
-    GraphicUnitPixels(unit, type->Sprite);
-
-    sprite = type->Sprite;
-    if (type->Harvester && unit->CurrentResource) {
-       resinfo = type->ResInfo[unit->CurrentResource];
-       if (unit->Value) {
-           if (resinfo->SpriteWhenLoaded) {
-               sprite = resinfo->SpriteWhenLoaded;
-           }
-       } else {
-           if (resinfo->SpriteWhenEmpty) {
-               sprite = resinfo->SpriteWhenEmpty;
-           }
-       }
-    }
-    if (unit->Frame < 0) {
-       VideoDrawClipX(sprite, -unit->Frame,
-           x - (type->Width - type->TileWidth * TileSizeX) / 2,
-           y - (type->Height - type->TileHeight * TileSizeY) / 2);
-    } else {
-       VideoDrawClip(sprite, unit->Frame,
-           x - (type->Width - type->TileWidth * TileSizeX) / 2,
-           y - (type->Height - type->TileHeight * TileSizeY) / 2);
-    }
-#ifdef USE_OPENGL
-    DrawUnitPlayerColor(type, unit->Player->Player, unit->Frame, x, y);
-#endif
-
 #ifndef NEW_DECODRAW
-// Unit's extras not fully supported.. need to be decorations themselves.
+    // Unit's extras not fully supported.. need to be decorations themselves.
     DrawInformations(unit, type, x, y);
 #endif
 }
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.231 stratagus/src/include/unit.h:1.232
--- stratagus/src/include/unit.h:1.231  Fri Nov  7 20:08:09 2003
+++ stratagus/src/include/unit.h        Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.h,v 1.231 2003/11/08 01:08:09 nehalmistry Exp $
+//     $Id: unit.h,v 1.232 2003/11/09 02:42:05 n0body Exp $
 
 #ifndef __UNIT_H__
 #define __UNIT_H__
@@ -923,7 +923,6 @@
     int x, int y);
     /// Draw A single Unit
 extern void DrawUnit(const Unit* unit);
-extern void DrawBuilding(const Unit* unit);
     /// Draw all units visible on map in viewport
 extern int FindAndSortUnits(const Viewport* vp, Unit** table);
     /// Show an unit's orders.
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.127 
stratagus/src/include/unittype.h:1.128
--- stratagus/src/include/unittype.h:1.127      Sat Nov  1 23:20:38 2003
+++ stratagus/src/include/unittype.h    Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.h,v 1.127 2003/11/02 04:20:38 jsalmon3 Exp $
+//     $Id: unittype.h,v 1.128 2003/11/09 02:42:05 n0body Exp $
 
 #ifndef __UNITTYPE_H__
 #define __UNITTYPE_H__
@@ -306,6 +306,10 @@
 **
 **             Unit is a Building
 **
+**     UnitType::VisibileUnderFog
+**
+**             Unit is visible under fog of war.
+**
 **     UnitType::PermanentCloak
 **
 **             Unit is permanently cloaked.
@@ -725,6 +729,7 @@
     unsigned SeaUnit : 1;              /// Sea animated
     unsigned ExplodeWhenKilled : 1;    /// Death explosion animated
     unsigned Building : 1;             /// Building
+    unsigned VisibleUnderFog : 1;      /// Unit is visible under fog of war.
     unsigned PermanentCloak : 1;       /// Is only visible by CloakDetectors.
     unsigned DetectCloak : 1;          /// Can see Cloaked units.
     unsigned Coward : 1;               /// Unit will only attack if instructed.
@@ -820,7 +825,7 @@
 extern void SaveUnitTypes(CLFile* file);               /// Save the unit-type 
table
 extern UnitType* NewUnitTypeSlot(char*);               /// Allocate an empty 
unit-type slot
     /// Draw the sprite frame of unit-type
-extern void DrawUnitType(const UnitType* type,int frame,int x,int y);
+extern void DrawUnitType(const UnitType* type, Graphic* sprite, int frame, int 
x, int y);
 
 extern void InitUnitTypes(int reset_player_stats);     /// Init unit-type table
 extern void LoadUnitTypes(void);                       /// Load the unit-type 
data
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.109 
stratagus/src/unit/ccl_unittype.c:1.110
--- stratagus/src/unit/ccl_unittype.c:1.109     Sat Nov  8 05:23:04 2003
+++ stratagus/src/unit/ccl_unittype.c   Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_unittype.c,v 1.109 2003/11/08 10:23:04 martinxyz Exp $
+//     $Id: ccl_unittype.c,v 1.110 2003/11/09 02:42:05 n0body Exp $
 
 //@{
 
@@ -423,6 +423,8 @@
 
        } else if (gh_eq_p(value, gh_symbol2scm("building"))) {
            type->Building = 1;
+       } else if (gh_eq_p(value, gh_symbol2scm("visible-under-fog"))) {
+           type->VisibleUnderFog = 1;
        } else if (gh_eq_p(value, gh_symbol2scm("builder-outside"))) {
            type->BuilderOutside = 1;
        } else if (gh_eq_p(value, gh_symbol2scm("builder-lost"))) {
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.123 stratagus/src/unit/unittype.c:1.124
--- stratagus/src/unit/unittype.c:1.123 Mon Nov  3 06:21:45 2003
+++ stratagus/src/unit/unittype.c       Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unittype.c,v 1.123 2003/11/03 11:21:45 pludov Exp $
+//     $Id: unittype.c,v 1.124 2003/11/09 02:42:05 n0body Exp $
 
 //@{
 
@@ -917,6 +917,9 @@
     if (type->Building) {
        CLprintf(file, "  'building");
     }
+    if (type->VisibleUnderFog) {
+       CLprintf(file, "  'visible-under-fog");
+    }
     if (type->BuilderOutside) {
        CLprintf(file, "  'builder-outside");
     }
@@ -1188,7 +1191,7 @@
     char** sp;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.123 2003/11/03 
11:21:45 pludov Exp $\n\n");
+    CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.124 2003/11/09 
02:42:05 n0body Exp $\n\n");
 
     // Original number to internal unit-type name.
 
@@ -1300,7 +1303,7 @@
 **     @todo   Do screen position caculation in high level.
 **             Better way to handle in x mirrored sprites.
 */
-global void DrawUnitType(const UnitType* type, int frame, int x, int y)
+global void DrawUnitType(const UnitType* type, Graphic* sprite, int frame, int 
x, int y)
 {
     // FIXME: move this calculation to high level.
     x -= (type->Width - type->TileWidth * TileSizeX) / 2;
@@ -1308,9 +1311,9 @@
 
     // FIXME: This is a hack for mirrored sprites
     if (frame < 0) {
-       VideoDrawClipX(type->Sprite, -frame, x, y);
+       VideoDrawClipX(sprite, -frame, x, y);
     } else {
-       VideoDrawClip(type->Sprite, frame, x, y);
+       VideoDrawClip(sprite, frame, x, y);
     }
 }
 
Index: stratagus/src/video/cursor.c
diff -u stratagus/src/video/cursor.c:1.74 stratagus/src/video/cursor.c:1.75
--- stratagus/src/video/cursor.c:1.74   Wed Oct 22 14:02:35 2003
+++ stratagus/src/video/cursor.c        Sat Nov  8 21:42:05 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: cursor.c,v 1.74 2003/10/22 18:02:35 jsalmon3 Exp $
+//     $Id: cursor.c,v 1.75 2003/11/09 02:42:05 n0body Exp $
 
 //@{
 
@@ -727,7 +727,7 @@
     SetClipping(vp->X, vp->Y, vp->EndX, vp->EndY);
     DrawShadow(NULL, CursorBuilding, frame, x, y);
     GraphicPlayerPixels(ThisPlayer, CursorBuilding->Sprite);
-    DrawUnitType(CursorBuilding, frame, x, y);
+    DrawUnitType(CursorBuilding, CursorBuilding->Sprite, frame, x, y);
     PopClipping();
 
     //
@@ -1121,7 +1121,7 @@
     int i;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: cursors $Id: cursor.c,v 1.74 2003/10/22 
18:02:35 jsalmon3 Exp $\n\n");
+    CLprintf(file, ";;; MODULE: cursors $Id: cursor.c,v 1.75 2003/11/09 
02:42:05 n0body Exp $\n\n");
 
     for (i = 0; Cursors[i].OType; ++i) {
        CLprintf(file, "(define-cursor '%s '%s\n",




reply via email to

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