stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src/map map_fog.c


From: Nehal Mistry
Subject: [Stratagus-CVS] stratagus/src/map map_fog.c
Date: Sun, 30 Nov 2003 17:38:57 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Nehal Mistry <address@hidden>   03/11/30 17:38:57

Modified files:
        src/map        : map_fog.c 

Log message:
        small fixes

Patches:
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.127 stratagus/src/map/map_fog.c:1.128
--- stratagus/src/map/map_fog.c:1.127   Sun Nov 30 15:34:47 2003
+++ stratagus/src/map/map_fog.c Sun Nov 30 17:38:57 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: map_fog.c,v 1.127 2003/11/30 20:34:47 nehalmistry Exp $
+//     $Id: map_fog.c,v 1.128 2003/11/30 22:38:57 nehalmistry Exp $
 
 //@{
 
@@ -570,19 +570,17 @@
     for (i = y; i < y + TileSizeY; ++i) {
        for (j = x; j < x + TileSizeX; ++j) {
            p = &((Uint16*)TheScreen->pixels)[j + i * VideoWidth];
-           if (*p) {
-               SDL_GetRGB(*p, TheScreen->format, &cdest.r, &cdest.g, &cdest.b);
-               // Saturation + Brightness
-               max = (cdest.r + cdest.g + cdest.b) / 3;
-               v = cdest.r + bright;
-               cdest.r = (v > 255 ? 255 : v) + (max - cdest.r) * sat / 100;
-               v = cdest.g + bright;
-               cdest.g = (v > 255 ? 255 : v) + (max - cdest.g) * sat / 100;
-               v = cdest.b + bright;
-               cdest.b = (v > 255 ? 255 : v) + (max - cdest.b) * sat / 100;
+           SDL_GetRGB(*p, TheScreen->format, &cdest.r, &cdest.g, &cdest.b);
+           // Saturation + Brightness
+           max = (cdest.r + cdest.g + cdest.b) / 3;
+           v = cdest.r + bright;
+           cdest.r = (v > 255 ? 255 : v) + (max - cdest.r) * sat / 100;
+           v = cdest.g + bright;
+           cdest.g = (v > 255 ? 255 : v) + (max - cdest.g) * sat / 100;
+           v = cdest.b + bright;
+           cdest.b = (v > 255 ? 255 : v) + (max - cdest.b) * sat / 100;
 
-               *p = SDL_MapRGB(TheScreen->format, cdest.r, cdest.g, cdest.b);
-           }
+           *p = SDL_MapRGB(TheScreen->format, cdest.r, cdest.g, cdest.b);
        }
     }
     VideoUnlockScreen();
@@ -655,9 +653,9 @@
            p = &((Uint16*)TheScreen->pixels)[j + i * VideoWidth];
            ptile = &((Uint8*)TheMap.TileGraphic->Surface->pixels)[srect.x + j 
- x 
                + srect.y + (i - y) * TheMap.TileGraphic->Surface->w];
-           SDL_GetRGB(*ptile, TheMap.TileGraphic->Surface->format, 
-               &cdest.r, &cdest.g, &cdest.b);
-           if (!(cdest.r | cdest.g | cdest.b) && *p) {
+           SDL_GetRGBA(*ptile, TheMap.TileGraphic->Surface->format, 
+               &cdest.r, &cdest.g, &cdest.b, &alpha);
+           if (!(cdest.r | cdest.g | cdest.b)) {
                SDL_GetRGB(*p, TheScreen->format, &cdest.r, &cdest.g, &cdest.b);
                // Saturation + Brightness
                max = (cdest.r + cdest.g + cdest.b) / 3;
@@ -2781,19 +2779,6 @@
        tile = 0;
     }
 
-    if (tile2) {
-#ifdef USE_SDL_SURFACE
-       VideoDrawUnexplored(tile2, dx, dy);
-#else
-       VideoDrawUnexplored(TheMap.Tiles[tile2], dx, dy);
-#endif
-       if (tile2 == tile) {            // no same fog over unexplored
-//         if (tile != 0xf) {
-//             TheMap.Fields[sx].VisibleLastFrame |= MapFieldPartiallyVisible;
-//         }
-           tile = 0;
-       }
-    }
     if (IsMapFieldVisible(ThisPlayer, x, y) || ReplayRevealMap) {
        if (tile) {
 #ifdef USE_SDL_SURFACE
@@ -2812,6 +2797,21 @@
        VideoDrawOnlyFog(TheMap.Tiles[UNEXPLORED_TILE], dx, dy);
 #endif
     }   
+    if (tile2) {
+#ifdef USE_SDL_SURFACE
+       VideoDrawUnexplored(tile2, dx, dy);
+#else
+       VideoDrawUnexplored(TheMap.Tiles[tile2], dx, dy);
+#endif
+/*
+       if (tile2 == tile) {            // no same fog over unexplored
+//         if (tile != 0xf) {
+//             TheMap.Fields[sx].VisibleLastFrame |= MapFieldPartiallyVisible;
+//         }
+           tile = 0;
+       }
+*/
+    }
 }
 
 #ifdef HIERARCHIC_PATHFINDER




reply via email to

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