____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
#include "stratagus.h"
#include "player.h"
#include "unittype.h"
#include "unit.h"
#include "unit_cache.h"
#include "map.h"
#include "ui.h"
#include "../video/intern_video.h"
Go to the source code of this file.
Defines | |
| #define | IsMapFieldExploredTable(x, y) (VisibleTable[(y) * Map.Info.MapWidth + (x)]) |
| #define | IsMapFieldVisibleTable(x, y) (VisibleTable[(y) * Map.Info.MapWidth + (x)] > 1) |
Functions | |
| int | MapFogFilterFlags (CPlayer *player, int x, int y, int mask) |
| Mark a tile for normal sight. | |
| void | MapMarkTileSight (const CPlayer *player, int x, int y) |
| void | MapUnmarkTileSight (const CPlayer *player, int x, int y) |
| void | MapSight (const CPlayer *player, int x, int y, int w, int h, int range, MapMarkerFunc *marker) |
| Mark tiles with fog of war to be redrawn. | |
| void | UpdateFogOfWarChange (void) |
| Builds Vision and Goal Tables. | |
| void | VideoDrawOnlyFog (int x, int y) |
| static void | DrawFogOfWarTile (int sx, int sy, int dx, int dy) |
| void | InitVisionTable (void) |
| Cleans up Vision and Goal Tables. | |
| void | FreeVisionTable (void) |
Variables | |
| static int | FogOfWarOpacity = 128 |
| Fog of war Opacity. | |
| static const int | FogTable [16] |
| unsigned char * | VisionTable [3] |
| Companion table for fast lookups. | |
| int * | VisionLookup |
| Flag must reveal the map. | |
| static unsigned short * | VisibleTable |
| static SDL_Surface * | OnlyFogSurface |
| static CGraphic * | AlphaFogG |
Definition in file map_fog.cpp.
| #define IsMapFieldExploredTable | ( | x, | |||
| y | ) | (VisibleTable[(y) * Map.Info.MapWidth + (x)]) |
Referenced by DrawFogOfWarTile().
| #define IsMapFieldVisibleTable | ( | x, | |||
| y | ) | (VisibleTable[(y) * Map.Info.MapWidth + (x)] > 1) |
Referenced by DrawFogOfWarTile().
| static void DrawFogOfWarTile | ( | int | sx, | |
| int | sy, | |||
| int | dx, | |||
| int | dy | |||
| ) | [static] |
Draw fog of war tile.
| 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. |
Definition at line 375 of file map_fog.cpp.
References CGraphic::DrawFrameClip(), CGraphic::DrawFrameClipTrans(), CMap::FogGraphic, FogOfWarOpacity, FogTable, CMap::Info, IsMapFieldExploredTable, IsMapFieldVisibleTable, Map, CMapInfo::MapHeight, CMapInfo::MapWidth, ReplayRevealMap, UseOpenGL, VideoDrawOnlyFog(), and y.
Referenced by CViewport::DrawMapFogOfWar().
| void FreeVisionTable | ( | void | ) |
Clean Up Generated Vision and Goal Tables.
Definition at line 760 of file map_fog.cpp.
References VisionLookup, and VisionTable.
Referenced by CleanGame(), and CleanModules().
| void InitVisionTable | ( | void | ) |
Cleans up Vision and Goal Tables.
Initialize Vision and Goal Tables.
Definition at line 657 of file map_fog.cpp.
References isqrt(), MaxMapWidth, VisionLookup, and VisionTable.
Referenced by CreateGame(), InitAStar(), and LoadGame().
| int MapFogFilterFlags | ( | CPlayer * | player, | |
| int | x, | |||
| int | y, | |||
| int | mask | |||
| ) |
Mark a tile for normal sight.
Find out what the tile flags are a tile is covered by fog
| player | player who is doing operation | |
| x | X map location | |
| y | Y map location | |
| mask | input mask to filter |
Definition at line 124 of file map_fog.cpp.
References CUnitType::FieldFlags, CMap::Info, Map, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnitCache::Select(), CUnit::Type, UnitCache, and UnitMax.
Referenced by CanBuildUnitType(), and DrawBuildingCursor().
| void MapMarkTileSight | ( | const CPlayer * | player, | |
| int | x, | |||
| int | y | |||
| ) |
Mark a tile's sight. (Explore and make visible.)
| player | Player to mark sight. | |
| x | X tile to mark. | |
| y | Y tile to mark. |
Definition at line 155 of file map_fog.cpp.
References Assert, CMap::Field(), CPlayer::Index, CMap::Info, Map, CMapInfo::MapHeight, MapMarkTileSight, CMapInfo::MapWidth, CMap::NoFogOfWar, UnitsOnTileMarkSeen(), and CMapField::Visible.
| void MapSight | ( | const CPlayer * | player, | |
| int | x, | |||
| int | y, | |||
| int | w, | |||
| int | h, | |||
| int | range, | |||
| MapMarkerFunc * | marker | |||
| ) |
Mark tiles with fog of war to be redrawn.
Mark the sight of unit. (Explore and make visible.)
| player | player to mark the sight for (not unit owner) | |
| x | x location to mark | |
| y | y 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 |
Definition at line 219 of file map_fog.cpp.
References CPlayer::Index, CMap::Info, Map, CMapInfo::MapHeight, CMapInfo::MapWidth, and VisionTable.
Referenced by CclUnit(), MapMarkRadar(), MapMarkRadarJammer(), MapMarkSight(), MapMarkUnitSightRec(), MapUnmarkRadar(), MapUnmarkRadarJammer(), and MapUnmarkSight().
| void MapUnmarkTileSight | ( | const CPlayer * | player, | |
| int | x, | |||
| int | y | |||
| ) |
Unmark a tile's sight. (Explore and make visible.)
| player | Player to mark sight. | |
| x | X tile to mark. | |
| y | Y tile to mark. |
Definition at line 182 of file map_fog.cpp.
References Assert, CMap::Field(), CPlayer::Index, CMap::Info, Map, CMapInfo::MapHeight, MapUnmarkTileSight, CMapInfo::MapWidth, CMap::NoFogOfWar, UnitsOnTileUnmarkSeen(), and CMapField::Visible.
| void UpdateFogOfWarChange | ( | void | ) |
Builds Vision and Goal Tables.
Update fog of war.
Definition at line 314 of file map_fog.cpp.
References NumUnits, UnitCountSeen(), and Units.
Referenced by CclSetFogOfWar().
| void VideoDrawOnlyFog | ( | int | x, | |
| int | y | |||
| ) |
Draw only fog of war
| x | X position into video memory | |
| y | Y position into video memory |
Definition at line 334 of file map_fog.cpp.
References CLIP_RECTANGLE, CVideo::FillRectangleClip(), FogOfWarOpacity, CVideo::MapRGBA(), OnlyFogSurface, TheScreen, TileSizeX, TileSizeY, UseOpenGL, and Video.
Referenced by DrawFogOfWarTile().
Definition at line 65 of file map_fog.cpp.
int FogOfWarOpacity = 128 [static] |
Fog of war Opacity.
Definition at line 49 of file map_fog.cpp.
Referenced by DrawFogOfWarTile(), and VideoDrawOnlyFog().
const int FogTable[16] [static] |
Initial value:
{
0,11,10, 2, 13, 6, 14, 3, 12, 15, 4, 1, 8, 9, 7, 0,
}
Definition at line 55 of file map_fog.cpp.
Referenced by DrawFogOfWarTile().
SDL_Surface* OnlyFogSurface [static] |
Definition at line 64 of file map_fog.cpp.
Referenced by CMap::CleanFogOfWar(), and VideoDrawOnlyFog().
unsigned short* VisibleTable [static] |
Definition at line 62 of file map_fog.cpp.
Referenced by CMap::CleanFogOfWar(), and CViewport::DrawMapFogOfWar().
| int* VisionLookup |
Flag must reveal the map.
Definition at line 60 of file map_fog.cpp.
Referenced by AStarMarkGoal(), FreeAStar(), FreeVisionTable(), and InitVisionTable().
| unsigned char* VisionTable[3] |
Companion table for fast lookups.
Definition at line 59 of file map_fog.cpp.
Referenced by AStarMarkGoal(), FreeAStar(), FreeVisionTable(), InitVisionTable(), and MapSight().
1.5.6