Rasterization-DiscoBall
 All Classes Files Functions Variables Pages
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
Map Class Reference

Abstract representation of all the current elements in an instance of a game A Map is a collection of MapElement as well as helper data structures. More...

#include <Map.h>

Inheritance diagram for Map:

Public Member Functions

bool add (shared_ptr< VisibleEntity > e, int type, int x, int y, int z)
 Wrapper for calling add(shared_ptr<VisibleEntity> e, int type, int creatureType, int x, int y, intz) to support old code. More...
 
bool add (shared_ptr< VisibleEntity > e, int type, int creatureType, int x, int y, int z, float HPFactor)
 Add a MapElement to the map. More...
 
bool addBullet (int x, int y, int z, Vector3 velocity)
 
bool canAdd (int type, int creatureType)
 
bool canAddBox (int x, int y, int z)
 Checks if we can add a box at the given location. More...
 
bool canSpawnCreature (int x, int y, int z, int occupancy)
 Checks if we can spawn a creature at the given location. More...
 
std::vector< shared_ptr< Change > > getChange ()
 Called by App. More...
 
shared_ptr< MapElementgetClosestLOSEntity (Vector3 pos, float maxDist, int type)
 
IntVec3 getSelectedBuildPos (Ray ray)
 
shared_ptr< MapElementgetSelectedEntity (Ray ray, int type)
 
 Map (shared_ptr< DemoScene > scene)
 Constructor. More...
 
bool remove (shared_ptr< VisibleEntity > e)
 Remove an element with the corresponding VisibleEntity. More...
 

Public Attributes

shared_ptr< AABoxManageraaBoxManager
 Manages the AABox for all the objects in the map. More...
 
int attackDamage [15][15][15]
 Area damage on each grid towards the Cube (defenders). More...
 
int defendDamage [15][15][15]
 Area damage on each grid towards the Creature (attackers). More...
 
int discoBallHP
 HP left for Disco Ball. More...
 
const IntVec3 discoBallLoc = IntVec3(7,1,7)
 Location of Disco Ball. More...
 
std::vector< shared_ptr
< MapElement > > 
elements
 Array of MapElement that is in the map. More...
 
int gold
 Gold left. More...
 
int gridOccupancy [15][15][15]
 Keeps track of the occupancy of each grid. More...
 
bool hasBox [15][15][15]
 Keeps track of if there is a box in the current grid. More...
 
int m_bulletCount = 0
 counts bullet for playing gun sound (can't play every turn other wise too noisy More...
 
shared_ptr< DemoScenem_scene
 Pointer to the scene. More...
 

Static Public Attributes

static const bool debugMap = false
 Prints debug information if sets to true. More...
 
static const int dimX = 15
 X dimension of the map, currently hardcoded as 15 in many places. More...
 
static const int dimY = 15
 Y dimension of the map, currently hardcoded as 15 in many places. More...
 
static const int dimZ = 15
 Z dimension of the map, currently hardcoded as 15 in many places. More...
 

Protected Member Functions

void foo ()
 

Detailed Description

Abstract representation of all the current elements in an instance of a game A Map is a collection of MapElement as well as helper data structures.

It stores all the information about a game. App provides with specific information about a game i.e. the creature to spawn, the default terrain, used inputs and etc. VisualControl comminucates with it to update the graphics.

Information is stored in a 3D-grid. Currently this is a 15*15*15 Map

Constructor & Destructor Documentation

Map::Map ( shared_ptr< DemoScene scene)

Constructor.

Parameters
scenethe scene the relates to the map

Member Function Documentation

bool Map::add ( shared_ptr< VisibleEntity >  e,
int  type,
int  x,
int  y,
int  z 
)

Wrapper for calling add(shared_ptr<VisibleEntity> e, int type, int creatureType, int x, int y, intz) to support old code.

creatureType is set to 0

bool Map::add ( shared_ptr< VisibleEntity >  e,
int  type,
int  creatureType,
int  x,
int  y,
int  z,
float  HPFactor 
)

Add a MapElement to the map.

Parameters
ecorresponding VisibleEntity
typetype of MapElement
creatureTypesubtype
x,y,zinitial location
bool Map::addBullet ( int  x,
int  y,
int  z,
Vector3  velocity 
)
bool Map::canAdd ( int  type,
int  creatureType 
)
bool Map::canAddBox ( int  x,
int  y,
int  z 
)

Checks if we can add a box at the given location.

Checks if there is any element in the grid already and if there is proper support for the box.

Parameters
x,y,zlocation to check
bool Map::canSpawnCreature ( int  x,
int  y,
int  z,
int  occupancy 
)

Checks if we can spawn a creature at the given location.

Parameters
x,y,zlocation to check
occupancyoccupancy of the Creature to be spawned
void Map::foo ( )
protected
std::vector< shared_ptr< Change > > Map::getChange ( )

Called by App.

Computes and returns an array of changes to the VisibleEntity MapElement::run() and MapElement::updateHP() is called for every MapElement in elements. Any elements with HP below zero gets removed. Any elements that changed is included in the array of changes.

shared_ptr< MapElement > Map::getClosestLOSEntity ( Vector3  pos,
float  maxDist,
int  type 
)
IntVec3 Map::getSelectedBuildPos ( Ray  ray)
shared_ptr< MapElement > Map::getSelectedEntity ( Ray  ray,
int  type 
)
bool Map::remove ( shared_ptr< VisibleEntity >  e)

Remove an element with the corresponding VisibleEntity.

Parameters
eVisibleEntity to be removed

Member Data Documentation

shared_ptr<AABoxManager> Map::aaBoxManager

Manages the AABox for all the objects in the map.

int Map::attackDamage[15][15][15]

Area damage on each grid towards the Cube (defenders).

Reset every turn. Single-target damage is dealted directly in MapElement::run()

const bool Map::debugMap = false
static

Prints debug information if sets to true.

int Map::defendDamage[15][15][15]

Area damage on each grid towards the Creature (attackers).

Reset every turn. Single-target damage is dealted directly in MapElement::run()

const int Map::dimX = 15
static

X dimension of the map, currently hardcoded as 15 in many places.

const int Map::dimY = 15
static

Y dimension of the map, currently hardcoded as 15 in many places.

const int Map::dimZ = 15
static

Z dimension of the map, currently hardcoded as 15 in many places.

int Map::discoBallHP

HP left for Disco Ball.

const IntVec3 Map::discoBallLoc = IntVec3(7,1,7)

Location of Disco Ball.

std::vector<shared_ptr<MapElement> > Map::elements

Array of MapElement that is in the map.

int Map::gold

Gold left.

Used to construct Cube. Can't construct without gold

int Map::gridOccupancy[15][15][15]

Keeps track of the occupancy of each grid.

If it exceeds 100, no more MapElement can be added

bool Map::hasBox[15][15][15]

Keeps track of if there is a box in the current grid.

Used for implementing basic gravity on boxes

int Map::m_bulletCount = 0

counts bullet for playing gun sound (can't play every turn other wise too noisy

shared_ptr<DemoScene> Map::m_scene

Pointer to the scene.


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