Remove TheMap.NoFogOfWa tests, only IsMapFieldVisible must be checked
This commit is contained in:
parent
317f6a20f1
commit
073e8a2407
5 changed files with 27 additions and 33 deletions
src
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue