ScummVM API documentation
Sword25::WalkRegion Class Reference

#include <walkregion.h>

Inheritance diagram for Sword25::WalkRegion:
Sword25::Region Sword25::Persistable

Public Member Functions

bool init (const Polygon &contour, const Common::Array< Polygon > *pHoles=0) override
 
bool queryPath (int x1, int y1, int x2, int y2, BS_Path &path)
 
bool queryPath (Vertex startPoint, Vertex endPoint, BS_Path &path)
 
void setPos (int x, int y) override
 
const Common::Array< Vertex > & getNodes () const
 
const Common::Array< Common::Array< int > > & getVisibilityMatrix () const
 
bool persist (OutputPersistenceBlock &writer) override
 
bool unpersist (InputPersistenceBlock &reader) override
 
- Public Member Functions inherited from Sword25::Region
bool isValid () const
 
const VertexgetPosition () const
 
int getPosX () const
 
int getPosY () const
 
bool isPointInRegion (const Vertex &vertex) const
 
bool isPointInRegion (int x, int y) const
 
const PolygongetContour () const
 
int getHoleCount () const
 
const PolygongetHole (uint i) const
 
Vertex findClosestRegionPoint (const Vertex &point) const
 
Vertex getCentroid () const
 
bool isLineOfSight (const Vertex &a, const Vertex &b) const
 
void setPosX (int x)
 
void setPosY (int y)
 

Protected Member Functions

 WalkRegion (InputPersistenceBlock &Reader, uint handle)
 
- Protected Member Functions inherited from Sword25::Region
 Region ()
 
 Region (InputPersistenceBlock &reader, uint handle)
 
void updateBoundingBox ()
 
Vertex findClosestPointOnLine (const Vertex &lineStart, const Vertex &lineEnd, const Vertex point) const
 

Additional Inherited Members

- Public Types inherited from Sword25::Region
enum  REGION_TYPE { RT_REGION, RT_WALKREGION }
 
- Static Public Member Functions inherited from Sword25::Region
static uint create (REGION_TYPE type)
 
static uint create (InputPersistenceBlock &reader, uint handle=0)
 
- Protected Attributes inherited from Sword25::Region
REGION_TYPE _type
 This specifies the type of object.
 
bool _valid
 This variable indicates whether the current object state is valid.
 
Vertex _position
 This vertex is the position of the region.
 
Common::Array< Polygon_polygons
 This array contains all the polygons that define the region. The first element of.
 
Common::Rect _boundingBox
 The bounding box for the region.
 

Detailed Description

This class represents the region in which the main character can move

Member Function Documentation

◆ init()

bool Sword25::WalkRegion::init ( const Polygon contour,
const Common::Array< Polygon > *  pHoles = 0 
)
overridevirtual

Initializes a BS_Region object

Parameters
ContourA polygon indicating the outline of the region
pHolesA pointer to an array of polygons representing the hole state in the region. If the region has no holes, it must be passed as NULL. The default value is NULL.
Returns
Returns true if the initialisation was successful, otherwise false.
Remarks
If the region was already initialized, the old state will be deleted.

Reimplemented from Sword25::Region.

◆ queryPath() [1/2]

bool Sword25::WalkRegion::queryPath ( int  x1,
int  y1,
int  x2,
int  y2,
BS_Path path 
)
inline

Get the shortest path between two points in the region

This method requires that the starting point lies within the region. The end point may lie outside the region. Int his case, the end is chosen as the cloest point to it that lies within the region.

Parameters
X1X Co-ordinate of the start point
Y1Y Co-ordinate of the start point
X2X Co-ordinate of the end point
Y2Y Co-ordinate of the end point
PathAn empty BS_Path that will be set to the resulting path
Returns
Returns false if the result is invalid, otherwise returns true.

◆ queryPath() [2/2]

bool Sword25::WalkRegion::queryPath ( Vertex  startPoint,
Vertex  endPoint,
BS_Path path 
)

Get the shortest path between two points in the region.

Parameters
StartPointThe start point
EndPointThe end point
PathAn empty BS_Path that will be set to the resulting path
Returns
Returns false if the result is invalid, otherwise returns true.

◆ setPos()

void Sword25::WalkRegion::setPos ( int  x,
int  y 
)
overridevirtual

Sets the position of the region

Parameters
XThe new X psoition of the region
YThe new Y psoition of the region

Reimplemented from Sword25::Region.


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