_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros
map_fog.cpp File Reference
#include "stratagus.h"
#include "map.h"
#include "actions.h"
#include "minimap.h"
#include "player.h"
#include "ui.h"
#include "unit.h"
#include "unit_manager.h"
#include "video.h"
#include "../video/intern_video.h"

Classes

class  _filter_flags
 
class  _TileSeen< MARK >
 

Macros

#define IsMapFieldExploredTable(index)   (VisibleTable[(index)])
 
#define IsMapFieldVisibleTable(index)   (VisibleTable[(index)] > 1)
 

map_fog.cpp - The map fog of war handling.

int FogOfWarOpacity
 Path to the current map. More...
 
Uint32 FogOfWarColorSDL
 Fog of war Opacity. More...
 
CColor FogOfWarColor
 fog of war color More...
 
static const int FogTable [16]
 
static std::vector< unsigned
short > 
VisibleTable
 
static SDL_Surface * OnlyFogSurface
 
static CGraphicAlphaFogG
 
int MapFogFilterFlags (CPlayer &player, const unsigned int index, int mask)
 
int MapFogFilterFlags (CPlayer &player, const Vec2i &pos, int mask)
 Filter map flags through fog. More...
 
static void UnitsOnTileMarkSeen (const CPlayer &player, CMapField &mf, int cloak)
 
static void UnitsOnTileUnmarkSeen (const CPlayer &player, CMapField &mf, int cloak)
 
void MapMarkTileSight (const CPlayer &player, const unsigned int index)
 
void MapMarkTileSight (const CPlayer &player, const Vec2i &pos)
 
void MapUnmarkTileSight (const CPlayer &player, const unsigned int index)
 
void MapUnmarkTileSight (const CPlayer &player, const Vec2i &pos)
 
void MapMarkTileDetectCloak (const CPlayer &player, const unsigned int index)
 
void MapMarkTileDetectCloak (const CPlayer &player, const Vec2i &pos)
 
void MapUnmarkTileDetectCloak (const CPlayer &player, const unsigned int index)
 
void MapUnmarkTileDetectCloak (const CPlayer &player, const Vec2i &pos)
 
void MapSight (const CPlayer &player, const Vec2i &pos, int w, int h, int range, MapMarkerFunc *marker)
 Mark sight changes. More...
 
void UpdateFogOfWarChange ()
 Update fog of war. More...
 
void VideoDrawOnlyFog (int x, int y)
 
static void GetFogOfWarTile (int sx, int sy, int *fogTile, int *blackFogTile)
 
static void DrawFogOfWarTile (int sx, int sy, int dx, int dy)
 

Macro Definition Documentation

#define IsMapFieldExploredTable (   index)    (VisibleTable[(index)])
#define IsMapFieldVisibleTable (   index)    (VisibleTable[(index)] > 1)

Function Documentation

static void DrawFogOfWarTile ( int  sx,
int  sy,
int  dx,
int  dy 
)
static

Draw fog of war tile.

Parameters
sxOffset into fields to current tile.
syStart of the current row.
dxX position into video memory.
dyY position into video memory.
static void GetFogOfWarTile ( int  sx,
int  sy,
int *  fogTile,
int *  blackFogTile 
)
static
int MapFogFilterFlags ( CPlayer player,
const unsigned int  index,
int  mask 
)

Find out what the tile flags are a tile is covered by fog

Parameters
playerplayer who is doing operation
indexmap location
maskinput mask to filter
Returns
Filtered mask after taking fog into account
int MapFogFilterFlags ( CPlayer player,
const Vec2i pos,
int  mask 
)

Filter map flags through fog.

void MapMarkTileDetectCloak ( const CPlayer player,
const unsigned int  index 
)

Mark a tile for cloak detection.

Parameters
playerPlayer to mark sight.
indexTile to mark.
void MapMarkTileDetectCloak ( const CPlayer player,
const Vec2i pos 
)
void MapMarkTileSight ( const CPlayer player,
const unsigned int  index 
)

Mark a tile's sight. (Explore and make visible.)

Parameters
playerPlayer to mark sight.
indextile to mark.
void MapMarkTileSight ( const CPlayer player,
const Vec2i pos 
)
void MapSight ( const CPlayer player,
const Vec2i pos,
int  w,
int  h,
int  range,
MapMarkerFunc marker 
)

Mark sight changes.

Mark the sight of unit. (Explore and make visible.)

Parameters
playerplayer to mark the sight for (not unit owner)
poslocation to mark
wwidth to mark, in square
hheight to mark, in square
rangeRadius to mark.
markerFunction to mark or unmark sight
void MapUnmarkTileDetectCloak ( const CPlayer player,
const unsigned int  index 
)

Unmark a tile for cloak detection.

Parameters
playerPlayer to mark sight.
indextile to mark.
void MapUnmarkTileDetectCloak ( const CPlayer player,
const Vec2i pos 
)
void MapUnmarkTileSight ( const CPlayer player,
const unsigned int  index 
)

Unmark a tile's sight. (Explore and make visible.)

Parameters
playerPlayer to mark sight.
indexxtile to mark.
void MapUnmarkTileSight ( const CPlayer player,
const Vec2i pos 
)
static void UnitsOnTileMarkSeen ( const CPlayer player,
CMapField mf,
int  cloak 
)
static

Mark all units on a tile as now visible.

Parameters
playerThe player this is for.
mffield location to check
cloakIf we mark cloaked units too.
static void UnitsOnTileUnmarkSeen ( const CPlayer player,
CMapField mf,
int  cloak 
)
static

This function unmarks units on x, y as seen. It uses a reference count.

Parameters
playerThe player to mark for.
mffield to check if building is on, and mark as seen
cloakIf this is for cloaked units.
void UpdateFogOfWarChange ( )

Update fog of war.

Update fog of war.

void VideoDrawOnlyFog ( int  x,
int  y 
)

Draw only fog of war

Parameters
xX position into video memory
yY position into video memory

Variable Documentation

CGraphic* AlphaFogG
static
CColor FogOfWarColor

fog of war color

Uint32 FogOfWarColorSDL

Fog of war Opacity.

int FogOfWarOpacity

Path to the current map.

Contrast of fog of war

const int FogTable[16]
static
Initial value:
= {
0, 11, 10, 2, 13, 6, 14, 3, 12, 15, 4, 1, 8, 9, 7, 0,
}

Mapping for fog of war tiles.

SDL_Surface* OnlyFogSurface
static
std::vector<unsigned short> VisibleTable
static
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.