_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
Go to the documentation of this file.
50 MarkedTilesCache.clear();
55 const uint16_t height,
const uint16_t range,
MapMarkerFunc *marker);
70 SColumnPiece(int16_t xValue,
Vec2i top,
Vec2i bottom) : col(xValue), TopVector(top), BottomVector(bottom) {}
77 void ProceedSimpleRadial(
const CPlayer &player,
const Vec2i &pos,
const int16_t
w,
const int16_t
h,
80 void ProceedShadowCasting(
const Vec2i &spectatorPos,
const uint16_t width,
const uint16_t height,
const uint16_t range);
83 void ProceedRaysCast(
const uint8_t octant,
const Vec2i &origin,
const uint16_t width,
const uint16_t range);
85 void RefreshOctant(
const uint8_t octant,
const Vec2i &origin,
const uint16_t range);
87 void CalcFoVForColumnPiece(
const int16_t col,
Vec2i &topVector,
Vec2i &bottomVector,
88 const uint16_t range, std::queue<SColumnPiece> &wrkQueue);
90 int16_t CalcRow_ByVector(
const bool isTop,
const int16_t x,
const Vec2i &vector)
const;
93 bool SetCurrentTile(
const int16_t col,
const int16_t row);
95 bool IsTileOpaque()
const;
101 void ResetShadowCaster();
102 void PrepareCache(
const Vec2i pos,
const uint16_t width,
const uint16_t height,
const uint16_t range);
105 void SetEnvironment(
const uint8_t octant,
const Vec2i &origin);
106 void ResetEnvironment();
108 void ProjectCurrentTile(
const int16_t col,
const int16_t row);
111 struct FieldOfViewSettings
116 Vec2i currTilePos {0, 0};
117 uint8_t currOctant {0};
119 uint16_t OpaqueFields {0};
121 const CPlayer *Player {
nullptr};
122 const CUnit *Unit {
nullptr};
125 std::vector<uint8_t> MarkedTilesCache;
140 inline bool CFieldOfView::SetCurrentTile(
const int16_t col,
const int16_t row)
142 ProjectCurrentTile(col, row);
146 currTilePos = {0, 0};
151 inline bool CFieldOfView::IsTileOpaque()
const
154 return (
Map.
Field(currTilePos.
x, currTilePos.
y)->
Flags & OpaqueFields);
157 inline void CFieldOfView::MarkTile()
159 const size_t index =
Map.
getIndex(currTilePos.
x, currTilePos.
y);
160 if (!MarkedTilesCache[index]) {
161 map_setFoV(*Player, index);
162 MarkedTilesCache[index] = 1;
166 inline void CFieldOfView::ProjectCurrentTile(
const int16_t col,
const int16_t row)
168 switch (currOctant) {
169 case 1: currTilePos.
x = row; currTilePos.
y = col;
break;
170 case 2: currTilePos.
x = -row; currTilePos.
y = col;
break;
171 case 3: currTilePos.
x = -col; currTilePos.
y = row;
break;
172 case 4: currTilePos.
x = -col; currTilePos.
y = -row;
break;
173 case 5: currTilePos.
x = -row; currTilePos.
y = -col;
break;
174 case 6: currTilePos.
x = row; currTilePos.
y = -col;
break;
175 case 7: currTilePos.
x = col; currTilePos.
y = -row;
break;
176 default: currTilePos.
x = col; currTilePos.
y = row;
Diplomacy states for CommandDiplomacy.
Definition: player.h:83
void SetOpaqueFields(const uint16_t flags)
Set opaque map field flags (which fields will be opaque)
Definition: fov.cpp:87
CFieldOfView FieldOfView
Definition: map_fog.cpp:64
unsigned int Flags
graphic tile number
Definition: tile.h:248
T y
Definition: vec2i.h:43
void MapMarkerFunc(const CPlayer &player, const unsigned int index)
Function to (un)mark the vision table.
Definition: map.h:303
#define MapFieldOpaque
Definition: tileset.h:48
ENUM_CLASS FieldOfViewTypes
Definition: settings.h:216
CMapField * Field(unsigned int index) const
Definition: map.h:171
bool SetType(const FieldOfViewTypes fov_type)
Definition: fov.cpp:56
void Refresh(const CPlayer &player, const CUnit &unit, const Vec2i &pos, const uint16_t width, const uint16_t height, const uint16_t range, MapMarkerFunc *marker)
Refresh field of view.
Definition: fov.cpp:130
FieldOfViewTypes GetType() const
Definition: fov.cpp:77
w
Definition: update-images.py:53
Definition: settings.h:230
void ResetAdditionalOpaqueFields()
Reset opaque flags to default (MapFieldOpaque)
Definition: fov.cpp:114
unsigned int getIndex(int x, int y) const
Definition: map.h:162
void Clean()
Definition: fov.h:48
CMapInfo Info
Definition: map.h:276
bool IsPointOnMap(int x, int y) const
Definition: map.h:125
Select algorithm for field of view.
Definition: fov.h:45
uint16_t GetOpaqueFields() const
Definition: fov.cpp:105
T x
Definition: vec2i.h:42
h
Definition: update-images.py:53
CMap Map
Definition: map.cpp:55
The big unit structure.
Definition: unit.h:135
(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.