Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CCmpFootprint Class Referencefinal
Inheritance diagram for CCmpFootprint:
Collaboration diagram for CCmpFootprint:

Public Member Functions

int GetComponentTypeId () const override
 
void Init (const CParamNode &paramNode) override
 
void Deinit () override
 
void Serialize (ISerializer &) override
 
void Deserialize (const CParamNode &paramNode, IDeserializer &) override
 
void GetShape (EShape &shape, entity_pos_t &size0, entity_pos_t &size1, entity_pos_t &height) const override
 Return the shape of this footprint. More...
 
CFixedVector3D PickSpawnPoint (entity_id_t spawned) const override
 Pick a sensible position to place a newly-spawned entity near this footprint, such that it won't be in an invalid (obstructed) location regardless of the spawned unit's orientation. More...
 
CFixedVector3D PickSpawnPointBothPass (entity_id_t spawned) const override
 Pick a sensible position to place a newly-spawned entity near this footprint, at the intersection between the footprint passability and the entity one. More...
 
void GetGridTiles (const entity_pos_t &tileSize, const std::uint16_t tilesW, const std::uint16_t tilesH, std::vector< std::pair< std::uint16_t, std::uint16_t > > &tiles) const override
 Get the grid tiles covered by this footprint: every tile whose center lies inside the footprint (boundary included), plus the tile containing the entity position, which is always included. More...
 
- Public Member Functions inherited from ICmpFootprint
virtual void GetShape (EShape &shape, entity_pos_t &size0, entity_pos_t &size1, entity_pos_t &height) const =0
 Return the shape of this footprint. More...
 
JS::Value GetShape_wrapper () const
 GetShape wrapper for script calls. More...
 
virtual CFixedVector3D PickSpawnPoint (entity_id_t spawned) const =0
 Pick a sensible position to place a newly-spawned entity near this footprint, such that it won't be in an invalid (obstructed) location regardless of the spawned unit's orientation. More...
 
virtual CFixedVector3D PickSpawnPointBothPass (entity_id_t spawned) const =0
 Pick a sensible position to place a newly-spawned entity near this footprint, at the intersection between the footprint passability and the entity one. More...
 
virtual void GetGridTiles (const entity_pos_t &tileSize, const std::uint16_t tilesW, const std::uint16_t tilesH, std::vector< std::pair< std::uint16_t, std::uint16_t > > &tiles) const =0
 Get the grid tiles covered by this footprint: every tile whose center lies inside the footprint (boundary included), plus the tile containing the entity position, which is always included. More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
virtual void Init (const CParamNode &paramNode)=0
 
virtual void Deinit ()=0
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
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 void Serialize (ISerializer &serialize)=0
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)=0
 
virtual JS::HandleValue GetJSInstance () const =0
 @Returns JS::NullHandleValue if a scripted wrapper of this IComponent is not supported, the wrapper otherwise. More...
 
virtual int GetComponentTypeId () const =0
 

Static Public Member Functions

static void ClassInit (CComponentManager &)
 
static IComponent * Allocate (const Script::Interface &, JS::HandleValue)
 
static void Deallocate (IComponent *cmp)
 
static std::string GetSchema ()
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static void RegisterComponentType (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
 
static void RegisterComponentTypeScriptWrapper (CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema, ClassInitFunc classInit)
 
static std::uint8_t GetSerializationVersion ()
 

Public Attributes

EShape m_Shape
 
entity_pos_t m_Size0
 
entity_pos_t m_Size1
 
entity_pos_t m_Height
 
entity_pos_t m_MaxSpawnDistance
 

Additional Inherited Members

- Public Types inherited from ICmpFootprint
enum  EShape { CIRCLE , SQUARE }
 
- Public Types inherited from IComponent
using AllocFunc = IComponent *(*)(const Script::Interface &scriptInterface, JS::HandleValue ctor)
 
using DeallocFunc = void(*)(IComponent *)
 
using ClassInitFunc = void(*)(CComponentManager &componentManager)
 

Member Function Documentation

◆ Allocate()

static IComponent * CCmpFootprint::Allocate ( const Script::Interface &  ,
JS::HandleValue   
)
inlinestatic

◆ ClassInit()

static void CCmpFootprint::ClassInit ( CComponentManager &  )
inlinestatic

◆ Deallocate()

static void CCmpFootprint::Deallocate ( IComponent *  cmp)
inlinestatic

◆ Deinit()

void CCmpFootprint::Deinit ( )
inlineoverridevirtual

Implements IComponent.

◆ Deserialize()

void CCmpFootprint::Deserialize ( const CParamNode &  paramNode,
IDeserializer &   
)
inlineoverridevirtual

Implements IComponent.

◆ GetComponentTypeId()

int CCmpFootprint::GetComponentTypeId ( ) const
inlineoverridevirtual

Implements IComponent.

◆ GetGridTiles()

void CCmpFootprint::GetGridTiles ( const entity_pos_t &  tileSize,
const std::uint16_t  tilesW,
const std::uint16_t  tilesH,
std::vector< std::pair< std::uint16_t, std::uint16_t > > &  tiles 
) const
inlineoverridevirtual

Get the grid tiles covered by this footprint: every tile whose center lies inside the footprint (boundary included), plus the tile containing the entity position, which is always included.

Parameters
tileSizeThe size of each tile in world units.
tilesWWidth of the grid.
tilesHHeight of the grid.
[out]tilesVector to fill with (i, j) tile coordinates covered by the footprint. The vector is cleared before being filled. Reusing a caller-provided vector avoids per-entity allocations when processing many entities.

Implements ICmpFootprint.

◆ GetSchema()

static std::string CCmpFootprint::GetSchema ( )
inlinestatic

◆ GetShape()

void CCmpFootprint::GetShape ( EShape &  shape,
entity_pos_t &  size0,
entity_pos_t &  size1,
entity_pos_t &  height 
) const
inlineoverridevirtual

Return the shape of this footprint.

Shapes are horizontal circles or squares, extended vertically upwards to make cylinders or boxes.

Parameters
[out]shapeeither CIRCLE or SQUARE
[out]size0if CIRCLE then radius, else width (size in X axis)
[out]size1if CIRCLE then radius, else depth (size in Z axis)
[out]heightsize in Y axis

Implements ICmpFootprint.

◆ Init()

void CCmpFootprint::Init ( const CParamNode &  paramNode)
inlineoverridevirtual

Implements IComponent.

◆ PickSpawnPoint()

CFixedVector3D CCmpFootprint::PickSpawnPoint ( entity_id_t  spawned) const
inlineoverridevirtual

Pick a sensible position to place a newly-spawned entity near this footprint, such that it won't be in an invalid (obstructed) location regardless of the spawned unit's orientation.

Returns
the X and Z coordinates of the spawn point, with Y = 0; or the special value (-1, -1, -1) if there's no space

Implements ICmpFootprint.

◆ PickSpawnPointBothPass()

CFixedVector3D CCmpFootprint::PickSpawnPointBothPass ( entity_id_t  spawned) const
inlineoverridevirtual

Pick a sensible position to place a newly-spawned entity near this footprint, at the intersection between the footprint passability and the entity one.

Returns
the X and Z coordinates of the spawn point, with Y = 0; or the special value (-1, -1, -1) if there's no space

Implements ICmpFootprint.

◆ Serialize()

void CCmpFootprint::Serialize ( ISerializer &  )
inlineoverridevirtual

Implements IComponent.

Member Data Documentation

◆ m_Height

entity_pos_t CCmpFootprint::m_Height

◆ m_MaxSpawnDistance

entity_pos_t CCmpFootprint::m_MaxSpawnDistance

◆ m_Shape

EShape CCmpFootprint::m_Shape

◆ m_Size0

entity_pos_t CCmpFootprint::m_Size0

◆ m_Size1

entity_pos_t CCmpFootprint::m_Size1

The documentation for this class was generated from the following file: