Pyrogenesis
13997
|
Range manager implementation. More...
Public Member Functions | |
virtual void | Init (const CParamNode ¶mNode) |
virtual void | Deinit () |
template<typename S > | |
void | SerializeCommon (S &serialize) |
virtual void | Serialize (ISerializer &serialize) |
virtual void | Deserialize (const CParamNode ¶mNode, IDeserializer &deserialize) |
virtual void | HandleMessage (const CMessage &msg, bool global) |
virtual void | SetBounds (entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, ssize_t vertices) |
Set the bounds of the world. More... | |
virtual void | Verify () |
Perform some internal consistency checks for testing/debugging. More... | |
void | ResetDerivedData (bool skipLosState) |
void | ResetSubdivisions (entity_pos_t x1, entity_pos_t z1) |
virtual tag_t | CreateActiveQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, std::vector< int > owners, int requiredInterface, u8 flags) |
Construct an active query. More... | |
virtual tag_t | CreateActiveParabolicQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, entity_pos_t elevationBonus, std::vector< int > owners, int requiredInterface, u8 flags) |
Construct an active query of a paraboloic form around the unit. More... | |
virtual void | DestroyActiveQuery (tag_t tag) |
Destroy a query and clean up resources. More... | |
virtual void | EnableActiveQuery (tag_t tag) |
Re-enable the processing of a query. More... | |
virtual void | DisableActiveQuery (tag_t tag) |
Disable the processing of a query (no RangeUpdate messages will be sent). More... | |
virtual std::vector< entity_id_t > | ExecuteQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, std::vector< int > owners, int requiredInterface) |
Execute a passive query. More... | |
virtual std::vector< entity_id_t > | ResetActiveQuery (tag_t tag) |
Immediately execute a query, and re-enable it if disabled. More... | |
virtual std::vector< entity_id_t > | GetEntitiesByPlayer (player_id_t player) |
Returns list of all entities for specific player. More... | |
virtual void | SetDebugOverlay (bool enabled) |
Toggle the rendering of debug info. More... | |
void | ExecuteActiveQueries () |
Update all currently-enabled active queries. More... | |
bool | TestEntityQuery (const Query &q, entity_id_t id, const EntityData &entity) |
Returns whether the given entity matches the given query (ignoring maxRange) More... | |
void | PerformQuery (const Query &q, std::vector< entity_id_t > &r) |
Returns a list of distinct entity IDs that match the given query, sorted by ID. More... | |
virtual entity_pos_t | GetElevationAdaptedRange (CFixedVector3D pos, CFixedVector3D rot, entity_pos_t range, entity_pos_t elevationBonus, entity_pos_t angle) |
Get the average elevation over 8 points on distance range around the entity. More... | |
virtual std::vector< entity_pos_t > | getParabolicRangeForm (CFixedVector3D pos, entity_pos_t maxRange, entity_pos_t cutoff, entity_pos_t minAngle, entity_pos_t maxAngle, int numberOfSteps) |
Query | ConstructQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, const std::vector< int > &owners, int requiredInterface, u8 flagsMask) |
Query | ConstructParabolicQuery (entity_id_t source, entity_pos_t minRange, entity_pos_t maxRange, entity_pos_t elevationBonus, const std::vector< int > &owners, int requiredInterface, u8 flagsMask) |
void | RenderSubmit (SceneCollector &collector) |
virtual u8 | GetEntityFlagMask (std::string identifier) |
Returns the mask for the specified identifier. More... | |
virtual void | SetEntityFlag (entity_id_t ent, std::string identifier, bool value) |
Set the flag specified by the identifier to the supplied value for the entity. More... | |
virtual CLosQuerier | GetLosQuerier (player_id_t player) |
Returns a CLosQuerier for checking whether vertex positions are visible to the given player (or other players it shares LOS with). More... | |
virtual ELosVisibility | GetLosVisibility (CEntityHandle ent, player_id_t player, bool forceRetainInFog) |
Returns the visibility status of the given entity, with respect to the given player. More... | |
virtual ELosVisibility | GetLosVisibility (entity_id_t ent, player_id_t player, bool forceRetainInFog) |
virtual void | SetLosRevealAll (player_id_t player, bool enabled) |
Set whether the whole map should be made visible to the given player. More... | |
virtual bool | GetLosRevealAll (player_id_t player) |
Returns whether the whole map has been made visible to the given player. More... | |
virtual void | SetLosCircular (bool enabled) |
Set the LOS to be restricted to a circular map. More... | |
virtual bool | GetLosCircular () |
Returns whether the LOS is restricted to a circular map. More... | |
virtual void | SetSharedLos (player_id_t player, std::vector< player_id_t > players) |
Sets shared LOS data for player to the given list of players. More... | |
virtual u32 | GetSharedLosMask (player_id_t player) |
Returns shared LOS mask for player. More... | |
void | UpdateTerritoriesLos () |
bool | LosIsOffWorld (ssize_t i, ssize_t j) |
Returns whether the given vertex is outside the normal bounds of the world (i.e. More... | |
void | LosAddStripHelper (u8 owner, i32 i0, i32 i1, i32 j, u16 *counts) |
Update the LOS state of tiles within a given horizontal strip (i0,j) to (i1,j) (inclusive). More... | |
void | LosRemoveStripHelper (u8 owner, i32 i0, i32 i1, i32 j, u16 *counts) |
Update the LOS state of tiles within a given horizontal strip (i0,j) to (i1,j) (inclusive). More... | |
template<bool adding> | |
void | LosUpdateHelper (u8 owner, entity_pos_t visionRange, CFixedVector2D pos) |
Update the LOS state of tiles within a given circular range, either adding or removing visibility depending on the template parameter. More... | |
void | LosUpdateHelperIncremental (u8 owner, entity_pos_t visionRange, CFixedVector2D from, CFixedVector2D to) |
Update the LOS state of tiles within a given circular range, by removing visibility around the 'from' position and then adding visibility around the 'to' position. More... | |
void | LosAdd (player_id_t owner, entity_pos_t visionRange, CFixedVector2D pos) |
void | LosRemove (player_id_t owner, entity_pos_t visionRange, CFixedVector2D pos) |
void | LosMove (player_id_t owner, entity_pos_t visionRange, CFixedVector2D from, CFixedVector2D to) |
virtual u8 | GetPercentMapExplored (player_id_t player) |
Get percent map explored statistics for specified player. More... | |
![]() | |
std::string | GetLosVisibility_wrapper (entity_id_t ent, player_id_t player, bool forceRetainInFog) |
GetLosVisibility wrapped for script calls. More... | |
![]() | |
virtual | ~IComponent () |
CEntityHandle | GetEntityHandle () const |
void | SetEntityHandle (CEntityHandle ent) |
entity_id_t | GetEntityId () const |
CEntityHandle | GetSystemEntity () const |
const CSimContext & | GetSimContext () const |
void | SetSimContext (const CSimContext &context) |
virtual JSClass * | GetJSClass () const |
virtual jsval | GetJSInstance () const |
Static Public Member Functions | |
static void | ClassInit (CComponentManager &componentManager) |
static IComponent * | Allocate (ScriptInterface &, jsval) |
static void | Deallocate (IComponent *cmp) |
static std::string | GetSchema () |
![]() | |
static std::string | GetSchema () |
static u8 | GetSerializationVersion () |
Public Attributes | |
bool | m_DebugOverlayEnabled |
bool | m_DebugOverlayDirty |
std::vector< SOverlayLine > | m_DebugOverlayLines |
entity_pos_t | m_WorldX0 |
entity_pos_t | m_WorldZ0 |
entity_pos_t | m_WorldX1 |
entity_pos_t | m_WorldZ1 |
tag_t | m_QueryNext |
std::map< tag_t, Query > | m_Queries |
EntityMap< EntityData > | m_EntityData |
SpatialSubdivision | m_Subdivision |
std::map< player_id_t, bool > | m_LosRevealAll |
bool | m_LosCircular |
i32 | m_TerrainVerticesPerSide |
size_t | m_TerritoriesDirtyID |
std::vector< std::vector< u16 > > | m_LosPlayerCounts |
std::vector< u32 > | m_LosState |
std::vector< u32 > | m_LosStateRevealed |
std::map< player_id_t, u32 > | m_SharedLosMasks |
u32 | m_TotalInworldVertices |
std::vector< u32 > | m_ExploredVertices |
Static Public Attributes | |
static const player_id_t | MAX_LOS_PLAYER_ID = 16 |
Additional Inherited Members | |
![]() | |
enum | ELosState { LOS_UNEXPLORED = 0, LOS_EXPLORED = 1, LOS_VISIBLE = 2, LOS_MASK = 3 } |
enum | ELosVisibility { VIS_HIDDEN, VIS_FOGGED, VIS_VISIBLE } |
typedef u32 | tag_t |
External identifiers for active queries. More... | |
Range manager implementation.
Maintains a list of all entities (and their positions and owners), which is used for queries.
LOS implementation is based on the model described in GPG2. (TODO: would be nice to make it cleverer, so e.g. mountains and walls can block vision)
Definition at line 245 of file CCmpRangeManager.cpp.
|
inlinestatic |
Definition at line 261 of file CCmpRangeManager.cpp.
|
inlinestatic |
Definition at line 248 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 1130 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 1100 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Construct an active query of a paraboloic form around the unit.
The query will be disabled by default.
source | the entity around which the range will be computed. |
minRange | non-negative minimum horizontal distance in metres (inclusive). MinRange doesn't do parabolic checks. |
maxRange | non-negative maximum distance in metres (inclusive) for units on the same elevation; or -1.0 to ignore distance. For units on a different elevation, a physical correct paraboloid with height=maxRange/2 above the unit is used to query them |
elevationBonus | extra bonus so the source can be placed higher and shoot further |
owners | list of player IDs that matching entities may have; -1 matches entities with no owner. |
requiredInterface | if non-zero, an interface ID that matching entities must implement. |
flags | if a entity in range has one of the flags set it will show up. |
Implements ICmpRangeManager.
Definition at line 685 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Construct an active query.
The query will be disabled by default.
source | the entity around which the range will be computed. |
minRange | non-negative minimum distance in metres (inclusive). |
maxRange | non-negative maximum distance in metres (inclusive); or -1.0 to ignore distance. |
owners | list of player IDs that matching entities may have; -1 matches entities with no owner. |
requiredInterface | if non-zero, an interface ID that matching entities must implement. |
flags | if a entity in range has one of the flags set it will show up. |
Implements ICmpRangeManager.
Definition at line 675 of file CCmpRangeManager.cpp.
|
inlinestatic |
Definition at line 261 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Implements IComponent.
Definition at line 341 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Implements IComponent.
Definition at line 375 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Destroy a query and clean up resources.
This must be called when an entity no longer needs its query (e.g. when the entity is destroyed).
tag | identifier of query. |
Implements ICmpRangeManager.
Definition at line 695 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Disable the processing of a query (no RangeUpdate messages will be sent).
tag | identifier of query. |
Implements ICmpRangeManager.
Definition at line 719 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Re-enable the processing of a query.
tag | identifier of query. |
Implements ICmpRangeManager.
Definition at line 706 of file CCmpRangeManager.cpp.
|
inline |
Update all currently-enabled active queries.
Definition at line 820 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Execute a passive query.
source | the entity around which the range will be computed. |
minRange | non-negative minimum distance in metres (inclusive). |
maxRange | non-negative maximum distance in metres (inclusive); or -1.0 to ignore distance. |
owners | list of player IDs that matching entities may have; -1 matches entities with no owner. |
requiredInterface | if non-zero, an interface ID that matching entities must implement. |
Implements ICmpRangeManager.
Definition at line 732 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Get the average elevation over 8 points on distance range around the entity.
id | the entity id to look around |
range | the distance to compare terrain height with |
Implements ICmpRangeManager.
Definition at line 996 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Returns list of all entities for specific player.
(This is on this interface because it shares a lot of the implementation. Maybe it should be extended to be more like ExecuteQuery without the range parameter.)
Implements ICmpRangeManager.
Definition at line 793 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Returns the mask for the specified identifier.
Implements ICmpRangeManager.
Definition at line 1280 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Returns whether the LOS is restricted to a circular map.
Implements ICmpRangeManager.
Definition at line 1405 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Returns a CLosQuerier for checking whether vertex positions are visible to the given player (or other players it shares LOS with).
Implements ICmpRangeManager.
Definition at line 1318 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Returns whether the whole map has been made visible to the given player.
Implements ICmpRangeManager.
Definition at line 1381 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Returns the visibility status of the given entity, with respect to the given player.
Returns VIS_HIDDEN if the entity doesn't exist or is not in the world. This respects the GetLosRevealAll flag. If forceRetainInFog is true, the visibility acts as if CCmpVision's RetainInFog flag were set. TODO: This is a hack to allow preview entities in FoW to return fogged instead of hidden, see http://trac.wildfiregames.com/ticket/958
Implements ICmpRangeManager.
Definition at line 1326 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Implements ICmpRangeManager.
Definition at line 1369 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Definition at line 1024 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Get percent map explored statistics for specified player.
Implements ICmpRangeManager.
Definition at line 1796 of file CCmpRangeManager.cpp.
|
inlinestatic |
Definition at line 309 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Returns shared LOS mask for player.
Implements ICmpRangeManager.
Definition at line 1415 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Reimplemented from IComponent.
Definition at line 385 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Implements IComponent.
Definition at line 314 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 1760 of file CCmpRangeManager.cpp.
Update the LOS state of tiles within a given horizontal strip (i0,j) to (i1,j) (inclusive).
Definition at line 1490 of file CCmpRangeManager.cpp.
Returns whether the given vertex is outside the normal bounds of the world (i.e.
outside the range of a circular map)
Definition at line 1460 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 1776 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 1768 of file CCmpRangeManager.cpp.
|
inline |
Update the LOS state of tiles within a given horizontal strip (i0,j) to (i1,j) (inclusive).
Definition at line 1519 of file CCmpRangeManager.cpp.
|
inline |
Update the LOS state of tiles within a given circular range, either adding or removing visibility depending on the template parameter.
Assumes owner is in the valid range.
Definition at line 1546 of file CCmpRangeManager.cpp.
|
inline |
Update the LOS state of tiles within a given circular range, by removing visibility around the 'from' position and then adding visibility around the 'to' position.
Definition at line 1635 of file CCmpRangeManager.cpp.
|
inline |
Returns a list of distinct entity IDs that match the given query, sorted by ID.
Definition at line 905 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 1141 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Immediately execute a query, and re-enable it if disabled.
The next RangeUpdate message will say who has entered/left since this call, so you won't miss any notifications.
tag | identifier of query. |
Implements ICmpRangeManager.
Definition at line 758 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 610 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 662 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Implements IComponent.
Definition at line 370 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 346 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Set the bounds of the world.
Entities should not be outside the bounds (else efficiency will suffer).
x0,z0,x1,z1 | Coordinates of the corners of the world |
vertices | Number of terrain vertices per side |
Implements ICmpRangeManager.
Definition at line 559 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Toggle the rendering of debug info.
Implements ICmpRangeManager.
Definition at line 809 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Set the flag specified by the identifier to the supplied value for the entity.
ent | the entity whose flags will be modified. |
identifier | the flag to be modified. |
value | to which the flag will be set. |
Implements ICmpRangeManager.
Definition at line 1291 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Set the LOS to be restricted to a circular map.
Implements ICmpRangeManager.
Definition at line 1398 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Set whether the whole map should be made visible to the given player.
If player is -1, the map will be made visible to all players.
Implements ICmpRangeManager.
Definition at line 1376 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Sets shared LOS data for player to the given list of players.
Implements ICmpRangeManager.
Definition at line 1410 of file CCmpRangeManager.cpp.
|
inline |
Returns whether the given entity matches the given query (ignoring maxRange)
Definition at line 877 of file CCmpRangeManager.cpp.
|
inline |
Definition at line 1423 of file CCmpRangeManager.cpp.
|
inlinevirtual |
Perform some internal consistency checks for testing/debugging.
Implements ICmpRangeManager.
Definition at line 570 of file CCmpRangeManager.cpp.
bool CCmpRangeManager::m_DebugOverlayDirty |
Definition at line 264 of file CCmpRangeManager.cpp.
bool CCmpRangeManager::m_DebugOverlayEnabled |
Definition at line 263 of file CCmpRangeManager.cpp.
std::vector<SOverlayLine> CCmpRangeManager::m_DebugOverlayLines |
Definition at line 265 of file CCmpRangeManager.cpp.
EntityMap<EntityData> CCmpRangeManager::m_EntityData |
Definition at line 276 of file CCmpRangeManager.cpp.
std::vector<u32> CCmpRangeManager::m_ExploredVertices |
Definition at line 307 of file CCmpRangeManager.cpp.
bool CCmpRangeManager::m_LosCircular |
Definition at line 283 of file CCmpRangeManager.cpp.
std::vector<std::vector<u16> > CCmpRangeManager::m_LosPlayerCounts |
Definition at line 292 of file CCmpRangeManager.cpp.
std::map<player_id_t, bool> CCmpRangeManager::m_LosRevealAll |
Definition at line 282 of file CCmpRangeManager.cpp.
std::vector<u32> CCmpRangeManager::m_LosState |
Definition at line 295 of file CCmpRangeManager.cpp.
std::vector<u32> CCmpRangeManager::m_LosStateRevealed |
Definition at line 300 of file CCmpRangeManager.cpp.
Definition at line 275 of file CCmpRangeManager.cpp.
tag_t CCmpRangeManager::m_QueryNext |
Definition at line 274 of file CCmpRangeManager.cpp.
std::map<player_id_t, u32> CCmpRangeManager::m_SharedLosMasks |
Definition at line 303 of file CCmpRangeManager.cpp.
SpatialSubdivision CCmpRangeManager::m_Subdivision |
Definition at line 278 of file CCmpRangeManager.cpp.
i32 CCmpRangeManager::m_TerrainVerticesPerSide |
Definition at line 284 of file CCmpRangeManager.cpp.
size_t CCmpRangeManager::m_TerritoriesDirtyID |
Definition at line 285 of file CCmpRangeManager.cpp.
u32 CCmpRangeManager::m_TotalInworldVertices |
Definition at line 306 of file CCmpRangeManager.cpp.
entity_pos_t CCmpRangeManager::m_WorldX0 |
Definition at line 268 of file CCmpRangeManager.cpp.
entity_pos_t CCmpRangeManager::m_WorldX1 |
Definition at line 270 of file CCmpRangeManager.cpp.
entity_pos_t CCmpRangeManager::m_WorldZ0 |
Definition at line 269 of file CCmpRangeManager.cpp.
entity_pos_t CCmpRangeManager::m_WorldZ1 |
Definition at line 271 of file CCmpRangeManager.cpp.
|
static |
Definition at line 296 of file CCmpRangeManager.cpp.