stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src clone/unit.c clone/unit_draw.c in...


From: Crestez Leonard
Subject: [Stratagus-CVS] stratagus/src clone/unit.c clone/unit_draw.c in...
Date: Tue, 11 Nov 2003 04:24:04 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Crestez Leonard <address@hidden>        03/11/11 04:24:04

Modified files:
        src/clone      : unit.c unit_draw.c 
        src/include    : unit.h 
        src/map        : map.c map_fog.c 

Log message:
        Fixed on screen/fow on/fow off

Patches:
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.332 stratagus/src/clone/unit.c:1.333
--- stratagus/src/clone/unit.c:1.332    Mon Nov 10 22:06:53 2003
+++ stratagus/src/clone/unit.c  Tue Nov 11 04:24:01 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.c,v 1.332 2003/11/11 03:06:53 n0body Exp $
+//     $Id: unit.c,v 1.333 2003/11/11 09:24:01 n0body Exp $
 
 //@{
 
@@ -1031,11 +1031,11 @@
 
 /**
 **     This function fills in the Seen fields of an unit from current fields.
-**     To be called when unit goes out of view.
+**     To be called when unit goes out of view, or when the map is revealed.
 ** 
 **     @param unit     The unit to work on
 */
-local void FillSeenValues(Unit* unit)
+global void UnitFillSeenValues(Unit* unit)
 {
     // Seen values are undefined for visible units.
     unit->SeenIY = unit->IY;
@@ -1102,7 +1102,7 @@
            DebugLevel3Fn("unit %d at %d,%d is now under fog time %lu.\n" _C_
                unit->Slot _C_ unit->X _C_ unit->Y _C_ GameCycle);
            if (player == ThisPlayer) {
-               FillSeenValues(unit);
+               UnitFillSeenValues(unit);
            }
        }
        --n;
@@ -1153,7 +1153,7 @@
            DebugLevel3Fn("unit %d(%s) at %d,%d got out of player %d's sight at 
cycle %lu.\n" _C_
                    unit->Slot _C_ unit->Type->Name _C_ unit->X _C_ unit->Y _C_ 
p _C_ GameCycle);
            if (p == ThisPlayer->Player) {
-               FillSeenValues(unit);
+               UnitFillSeenValues(unit);
            }
        }
        //  Now set the new visibility count
@@ -3838,7 +3838,7 @@
     int RunStart;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.332 2003/11/11 03:06:53 
n0body Exp $\n\n");
+    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.333 2003/11/11 09:24:01 
n0body Exp $\n\n");
 
     //
     // Local variables
Index: stratagus/src/clone/unit_draw.c
diff -u stratagus/src/clone/unit_draw.c:1.178 
stratagus/src/clone/unit_draw.c:1.179
--- stratagus/src/clone/unit_draw.c:1.178       Mon Nov 10 22:06:54 2003
+++ stratagus/src/clone/unit_draw.c     Tue Nov 11 04:24:02 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit_draw.c,v 1.178 2003/11/11 03:06:54 n0body Exp $
+//     $Id: unit_draw.c,v 1.179 2003/11/11 09:24:02 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.178 
2003/11/11 03:06:54 n0body Exp $\n\n");
+    CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.179 
2003/11/11 09:24:02 n0body Exp $\n\n");
 
     CLprintf(file, "(mana-sprite \"%s\"  %d %d  %d %d)\n",
        ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -1783,7 +1783,8 @@
     //
     // If we are in replay reveal map or the unit is visible(not under fog).
     //
-    if (ReplayRevealMap || unit->VisCount[ThisPlayer->Player]) {
+    if (ReplayRevealMap || TheMap.NoFogOfWar ||
+           unit->VisCount[ThisPlayer->Player]) {
        type = unit->Type;
        frame = unit->Frame;
        x = unit->IX;
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.234 stratagus/src/include/unit.h:1.235
--- stratagus/src/include/unit.h:1.234  Mon Nov 10 22:06:54 2003
+++ stratagus/src/include/unit.h        Tue Nov 11 04:24:02 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.h,v 1.234 2003/11/11 03:06:54 n0body Exp $
+//     $Id: unit.h,v 1.235 2003/11/11 09:24:02 n0body Exp $
 
 #ifndef __UNIT_H__
 #define __UNIT_H__
@@ -776,6 +776,8 @@
     /// Returns true, if building is known on the map
 extern int BuildingVisibleOnMap(const Unit* unit);
 
+    /// Fill in values, considering the unit was just recently seen.
+extern void UnitFillSeenValues(Unit* unit);
     /// Marks unit seen. (increases visibility count)
 extern void UnitsMarkSeen(const Player* player, int x, int y);
     /// Unmarks unit seen. (decreases visibility count)
Index: stratagus/src/map/map.c
diff -u stratagus/src/map/map.c:1.62 stratagus/src/map/map.c:1.63
--- stratagus/src/map/map.c:1.62        Mon Nov 10 22:06:54 2003
+++ stratagus/src/map/map.c     Tue Nov 11 04:24:02 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: map.c,v 1.62 2003/11/11 03:06:54 n0body Exp $
+//     $Id: map.c,v 1.63 2003/11/11 09:24:02 n0body Exp $
 
 //@{
 
@@ -132,21 +132,26 @@
 */
 global void RevealMap(void)
 {
-    int ix;
-    int iy;
+    int x;
+    int y;
 
     DebugLevel1Fn("\n");
-    for (ix = 0; ix < TheMap.Width; ++ix) {
-       for (iy = 0; iy < TheMap.Height; ++iy) {
+    for (x = 0; x < TheMap.Width; ++x) {
+       for (y = 0; y < TheMap.Height; ++y) {
            int i;
            for (i = 0; i < PlayerMax; ++i) {
-               if (!TheMap.Fields[ix+iy*TheMap.Width].Visible[i]) {
-                   TheMap.Fields[ix+iy*TheMap.Width].Visible[i] = 1;
+               if (!TheMap.Fields[x+y*TheMap.Width].Visible[i]) {
+                   TheMap.Fields[x+y*TheMap.Width].Visible[i] = 1;
                }
            }
-           MapMarkSeenTile(ix, iy);
-           //UnitsMarkSeen(ix, iy);
+           MapMarkSeenTile(x, y);
        }
+    }
+    //
+    // Start a global unit seen recount. It's the best way.
+    //
+    for (x = 0; x < NumUnits; ++x) {
+       UnitFillSeenValues(Units[x]);
     }
 }
 
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.112 stratagus/src/map/map_fog.c:1.113
--- stratagus/src/map/map_fog.c:1.112   Mon Nov 10 22:06:54 2003
+++ stratagus/src/map/map_fog.c Tue Nov 11 04:24:03 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: map_fog.c,v 1.112 2003/11/11 03:06:54 n0body Exp $
+//     $Id: map_fog.c,v 1.113 2003/11/11 09:24:03 n0body Exp $
 
 //@{
 
@@ -469,10 +469,15 @@
            for (x = 0; x < TheMap.Width; ++x) {
                if (IsMapFieldExplored(ThisPlayer, x, y)) {
                    MapMarkSeenTile(x, y);
-                   //UnitsMarkSeen(x, y);
                }
            }
        }
+    }
+    //
+    // Start a global unit seen recount. It's the best way.
+    //
+    for (x = 0; x < NumUnits; ++x) {
+       UnitCountSeen(Units[x]);
     }
     MarkDrawEntireMap();
 }




reply via email to

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