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

src/map/map_fog.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include "player.h"
#include "unittype.h"
#include "unit.h"
#include "map.h"
#include "tileset.h"
#include "minimap.h"
#include "font.h"
#include "ui.h"
#include "../video/intern_video.h"

Classes

struct  _filter_flags

map_fog.cpp - The map fog of war handling.

int FogOfWarOpacity
 Path to the current map.
Uint32 FogOfWarColorSDL
 Fog of war Opacity.
int FogOfWarColor [3]
 RGB triplet (0-255) of fog of war color.
static const int FogTable [16]
static 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)
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)
int square (int v)
void MapSight (const CPlayer &player, const Vec2i &pos, int w, int h, int range, MapMarkerFunc *marker)
void UpdateFogOfWarChange ()
 Update fog of war.
void VideoDrawOnlyFog (int x, int y)
static void DrawFogOfWarTile (int sx, int sy, int dx, int dy)

Defines

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

Define 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:
sx Offset into fields to current tile.
sy Start of the current row.
dx X position into video memory.
dy Y position into video memory.

int MapFogFilterFlags ( CPlayer player,
const Vec2i pos,
int  mask 
)

int MapFogFilterFlags ( CPlayer player,
const unsigned int  index,
int  mask 
)

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

Parameters:
player player who is doing operation
x X map location
y Y map location
mask input mask to filter
Returns:
Filtered mask after taking fog into account

void MapMarkTileDetectCloak ( const CPlayer player,
const Vec2i pos 
)

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

Mark a tile for cloak detection.

Parameters:
player Player to mark sight.
x X tile to mark.
y Y tile to mark.

void MapMarkTileSight ( 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:
player Player to mark sight.
x X tile to mark.
y Y tile to mark.

void MapSight ( const CPlayer player,
const Vec2i pos,
int  w,
int  h,
int  range,
MapMarkerFunc marker 
)

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

Parameters:
player player to mark the sight for (not unit owner)
pos location to mark
w width to mark, in square
h height to mark, in square
range Radius to mark.
marker Function to mark or unmark sight

void MapUnmarkTileDetectCloak ( const CPlayer player,
const Vec2i pos 
)

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

Unmark a tile for cloak detection.

Parameters:
player Player to mark sight.
x X tile to mark.
y Y tile to mark.

void MapUnmarkTileSight ( 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:
player Player to mark sight.
x X tile to mark.
y Y tile to mark.

int square ( int  v  )  [inline]

void UpdateFogOfWarChange (  ) 

Update fog of war.

Update fog of war.

void VideoDrawOnlyFog ( int  x,
int  y 
)

Draw only fog of war

Parameters:
x X position into video memory
y Y position into video memory


Variable Documentation

CGraphic* AlphaFogG [static]

int FogOfWarColor[3]

RGB triplet (0-255) of fog of war color.

Fog of war Opacity.

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]

unsigned short* VisibleTable [static]

(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.