diff --git a/src/include/map.h b/src/include/map.h index 04a5f38f9..506a5bc13 100644 --- a/src/include/map.h +++ b/src/include/map.h @@ -109,7 +109,7 @@ typedef struct _world_map_ { MapField* Fields; /// fields on map - unsigned NoFogOfWar; /// fog of war disabled + unsigned char NoFogOfWar; /// fog of war disabled unsigned Terrain; /// terrain type (summer,winter,...) Tileset* Tileset; /// tileset data diff --git a/src/map/map.cpp b/src/map/map.cpp index a82709acf..c9724774c 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -222,7 +222,7 @@ global void RevealMap(void) #else TheMap.Fields[ix+iy*TheMap.Width].Flags |= MapFieldExplored - | TheMap.NoFogOfWar ? MapFieldVisible : 0; + | (TheMap.NoFogOfWar ? MapFieldVisible : 0); #endif MapMarkSeenTile(ix,iy); } diff --git a/src/map/map_fog.cpp b/src/map/map_fog.cpp index 6e1253d6b..9f7a704ef 100644 --- a/src/map/map_fog.cpp +++ b/src/map/map_fog.cpp @@ -285,16 +285,21 @@ global void MapUpdateVisible(void) // Clear all visible flags. // w=TheMap.Width; - ye=TheMap.Height*w; - if (TheMap.NoFogOfWar) { - for( x=0; x<TheMap.Width; ++x ) { - for( y=0; y<TheMap.Height; y++ ) { - if ( IsMapFieldVisible(x,y) ) { + if ( TheMap.NoFogOfWar ) { + for( y=0; y<TheMap.Height; y++ ) { + for( x=0; x<TheMap.Width; ++x ) { +#ifdef NEW_FOW + TheMap.Fields[x+y*w].Visible=-1; +#else + TheMap.Fields[x+y*w].Flags|=MapFieldVisible; +#endif + if ( IsMapFieldExplored(x,y) ) { MapMarkSeenTile( x,y ); } } } } else { + ye=TheMap.Height*w; for( y=0; y<ye; y+=w ) { for( x=0; x<w; ++x ) { #ifdef NEW_FOW @@ -957,6 +962,10 @@ local void DrawFogOfWarTile(int sx,int sy,int dx,int dy) // if( mf->Explored && mf->ExploredMask ) { VideoDrawUnexplored(TheMap.Tiles[mf->ExploredMask],dx,dy); + // Don't need to draw the same tiles. + if( mf->Visible && mf->ExploredMask==mf->VisibleMask ) { + return; + } } if( mf->Visible ) { if( mf->VisibleMask ) { @@ -965,17 +974,6 @@ local void DrawFogOfWarTile(int sx,int sy,int dx,int dy) } else { VideoDrawOnlyFog(TheMap.Tiles[UNEXPLORED_TILE],dx,dy); } -#if 0 - if( !TheMap.NoFogOfWar ) { - if( TheMap.Fields[sx].Flags&MapFieldVisible ) { - if( tile ) { - VideoDrawFog(TheMap.Tiles[tile],dx,dy); - } - } else { - VideoDrawOnlyFog(TheMap.Tiles[UNEXPLORED_TILE],dx,dy); - } - } -#endif #else int w; int tile; @@ -1065,14 +1063,12 @@ local void DrawFogOfWarTile(int sx,int sy,int dx,int dy) tile=0; } } - if( !TheMap.NoFogOfWar ) { - if( TheMap.Fields[sx].Flags&MapFieldVisible ) { - if( tile ) { - VideoDrawFog(TheMap.Tiles[tile],dx,dy); - } - } else { - VideoDrawOnlyFog(TheMap.Tiles[UNEXPLORED_TILE],dx,dy); + if( TheMap.Fields[sx].Flags&MapFieldVisible ) { + if( tile ) { + VideoDrawFog(TheMap.Tiles[tile],dx,dy); } + } else { + VideoDrawOnlyFog(TheMap.Tiles[UNEXPLORED_TILE],dx,dy); } #endif } diff --git a/src/map/minimap.cpp b/src/map/minimap.cpp index 758f7d182..eacb82c94 100644 --- a/src/map/minimap.cpp +++ b/src/map/minimap.cpp @@ -260,7 +260,6 @@ global void DrawMinimap(int vx,int vy) mf=TheMap.Fields+Minimap2MapX[mx]+Minimap2MapY[my]; if( (mf->Explored&bits) && ( (mf->Visible&bits) - || TheMap.NoFogOfWar || ((mx&1)==(my&1)) ) ) { VideoDrawPixel(((char*)Minimap->Frames)[mx+my*MINIMAP_W] ,x+mx,y+my); @@ -268,8 +267,7 @@ global void DrawMinimap(int vx,int vy) #else flags=TheMap.Fields[Minimap2MapX[mx]+Minimap2MapY[my]].Flags; if( flags&MapFieldExplored && - ( (flags&MapFieldVisible) - || TheMap.NoFogOfWar || ((mx&1)==(my&1)) ) ) { + ( (flags&MapFieldVisible) || ((mx&1)==(my&1)) ) ) { VideoDrawPixel(((char*)Minimap->Frames)[mx+my*MINIMAP_W] ,x+mx,y+my); } @@ -297,7 +295,7 @@ global void DrawMinimap(int vx,int vy) continue; } // Draw only units on visible fields - if( !TheMap.NoFogOfWar && !(mf->Visible&bits) ) { + if( !(mf->Visible&bits) ) { continue; } #else @@ -307,7 +305,7 @@ global void DrawMinimap(int vx,int vy) continue; } // Draw only units on visible fields - if( !TheMap.NoFogOfWar && !(flags&MapFieldVisible) ) { + if( !(flags&MapFieldVisible) ) { continue; } #endif @@ -370,7 +368,7 @@ global void DrawMinimap(int vx,int vy) continue; } // Draw only units on visible fields - if( !TheMap.NoFogOfWar && !(flags&MapFieldVisible) ) { + if( !(flags&MapFieldVisible) ) { continue; } // FIXME: buildings under fog of war. diff --git a/src/unit/unit_draw.cpp b/src/unit/unit_draw.cpp index 3c48fc66c..2de1a0c19 100644 --- a/src/unit/unit_draw.cpp +++ b/src/unit/unit_draw.cpp @@ -518,7 +518,7 @@ local void DrawBuilding(Unit* unit) y = unit->Y; #ifdef NEW_FOW - if ( !TheMap.NoFogOfWar && !IsMapFieldVisible( x, y ) ) { + if ( !IsMapFieldVisible( x, y ) ) { frame = unit->SeenFrame; if (frame == 255) { return; @@ -536,7 +536,7 @@ local void DrawBuilding(Unit* unit) return; } - if ( !TheMap.NoFogOfWar && !IsMapFieldVisible( x, y ) ) { + if ( !IsMapFieldVisible( x, y ) ) { frame = unit->SeenFrame; if (frame == 255) { return;