HOG2
|
A tile-based representation of the world. More...
#include <Map.h>
Public Member Functions | |
Map (long width, long height) | |
Create a new map of a particular size. More... | |
Map (const char *filename) | |
Create a new map by loading it from a file. More... | |
Map (Map *) | |
Create a new map by copying it from another map. More... | |
Map (FILE *) | |
Create a new map by loading it from a file pointer. More... | |
Map (std::istringstream &data) | |
Not implemented. More... | |
~Map () | |
void | Load (const char *filename) |
Resets the current map by loading the file passed in. More... | |
void | Load (FILE *f) |
Resets the current map by loading the file from the pointer passed in. More... | |
void | setSizeMultipler (int _sizeMultiplier) |
void | Scale (long newWidth, long newHeight) |
void | Trim () |
void | Save (std::stringstream &data) |
unimplemented. More... | |
void | Save (const char *filename) |
Saves the current map out to the designated file. More... | |
void | Save (FILE *f) |
Saves the current map out to the designated file. More... | |
Map * | Clone () |
const char * | GetMapName () |
void | Print (int scale=1) |
Do an ASCII/ANSI print out of the map. More... | |
long | GetMapWidth () const |
return the width of the map More... | |
long | GetMapHeight () const |
return the height of the map More... | |
void | SetTileSet (tTileset ts) |
Choose the tileset used for land colors. More... | |
tTileset | GetTileSet () |
Get the tileset used for land colors. More... | |
Tile & | GetTile (long x, long y) |
Return the tile at location x, y. More... | |
tSplit | GetSplit (long x, long y) const |
Return the split of the tile at x, y. More... | |
void | SetSplit (long x, long y, tSplit split) |
Set the split of the tile at x, y. More... | |
long | GetTerrainType (long x, long y, tSplitSide split=kWholeTile) const |
Get the terrain type of the (split) tile at x, y. More... | |
long | GetTerrainType (long x, long y, tEdge side) const |
Get the terrain type for one side of the tile at x, y. More... | |
void | SetTerrainType (int32_t x1, int32_t y1, int32_t x2, int32_t y2, tTerrain t) |
Map::SetTerrainType() More... | |
void | SetTerrainType (long x, long y, tTerrain type, tSplitSide split=kWholeTile) |
Set the terrain type of the side of the tile at x, y. More... | |
long | GetHeight (long x, long y, tSplitSide split=kWholeTile) |
Get the (flat) height of the tile at x, y. More... | |
void | SetHeight (long x, long y, long height, tSplitSide split=kWholeTile) |
Set the (flat) height of the tile at x, y. More... | |
long | GetCornerHeight (long x, long y, tCorner which, tEdge edge) const |
Set the height of any one corner of a tile. More... | |
long | GetCornerHeight (long x, long y, tCorner which, tSplitSide split=kWholeTile) const |
Get the height of any one corner of a tile. More... | |
void | SetCornerHeight (long x, long y, tCorner which, long height, tSplitSide split=kWholeTile) |
Set the height of any one corner of a tile. More... | |
void | SmoothSetRectHeight (long x1, long y1, long x2, long y2, long h, tTerrain type=kGround) |
Places a rectangle into the map, but also modifies the edges to make the transition smooth. More... | |
void | SetRectHeight (long x1, long y1, long x2, long y2, long h, tTerrain type=kGround) |
Set the height and terrain of a set of tiles. More... | |
bool | AdjacentEdges (long x, long y, tEdge edge) const |
Is the tile at x, y adjacent across the edge? More... | |
bool | AdjacentCorners (long x, long y, tCorner corner) const |
bool | CanStep (long x1, long y1, long x2, long y2) const |
void | OpenGLDraw (tDisplay how=kPolygons) const |
Does actual OpenGL drawing of the map. More... | |
bool | GetOpenGLCoord (int _x, int _y, GLdouble &x, GLdouble &y, GLdouble &z, GLdouble &radius) const |
Get the openGL coordinates of a given tile. More... | |
bool | GetOpenGLCoord (float _x, float _y, GLdouble &x, GLdouble &y, GLdouble &z, GLdouble &radius) const |
Get the openGL coordinates of a given tile. More... | |
void | GetPointFromCoordinate (point3d loc, int &px, int &py) const |
double | GetCoordinateScale () |
Returns the scale multiplier between openGL coordinates and map coordinates. More... | |
void | SetDrawLand (bool land) |
Toggles whether the land is draw when you call OpenGLDraw. More... | |
bool | GetDrawLand () |
void | DrawTile (Tile *t, int x, int y, tDisplay how) const |
Draw a single tile. More... | |
void | DoVertexColor (tTerrain type, int height, bool darken=false) const |
Using OpenGL set the correct color for a particular vertex. More... | |
void | DoNormal (tSplit split, halfTile *t, int x, int y) const |
does a rough approximation of the normal for a particular halfTile. More... | |
float | GetEdgeWidthX (int x, int y) |
Returns the edge width between (x, y) and (x+1, y) More... | |
float | GetEdgeWidthY (int x, int y) |
Returns the edge width between (x, y) and (x, y+1) More... | |
int | GetNodeNum (int x, int y, tCorner c=kNone) |
Gets the abstract Graph node number for this tile. More... | |
void | SetNodeNum (int num, int x, int y, tCorner c=kNone) |
Sets the abstract Graph node number for this tile. More... | |
int | GetRevision () |
Private Member Functions | |
void | loadRaw (FILE *f, int height, int width) |
void | loadOctile (FILE *f, int height, int width) |
void | loadOctileCorner (FILE *f, int height, int width) |
void | saveOctile (FILE *f) |
void | saveRaw (FILE *f) |
bool | tryLoadRollingStone (FILE *f) |
bool | tryDragonAge (FILE *f) |
bool | isLegalStone (char c) |
void | paintRoomInside (int x, int y) |
void | drawLandQuickly () const |
Private Attributes | |
int | width |
int | height |
Tile ** | land |
bool | drawLand |
GLuint | dList |
bool | updated |
int | sizeMultiplier |
int | revision |
char | map_name [128] |
tMapType | mapType |
tTileset | tileSet |
Map::Map | ( | long | _width, |
long | _height | ||
) |
Create a new map of a particular size.
A map is an array of tiles according to the height and width of the map.
Definition at line 84 of file Map.cpp.
References dList, drawLand, height, kFall, kOctile, land, map_name, mapType, revision, sizeMultiplier, tileSet, updated, and width.
Referenced by Clone().
Map::Map | ( | const char * | filename | ) |
Map::Map | ( | Map * | m | ) |
Map::Map | ( | FILE * | f | ) |
Map::Map | ( | std::istringstream & | data | ) |
bool Map::AdjacentCorners | ( | long | x, |
long | y, | ||
tCorner | corner | ||
) | const |
Definition at line 1661 of file Map.cpp.
References AdjacentEdges(), GetMapWidth(), GetSplit(), height, kBackwardSplit, kBottomLeft, kBottomRight, kForwardSplit, kInternalEdge, kLeftEdge, kNone, kRightEdge, kTopEdge, kTopLeft, kTopRight, and width.
Referenced by CanStep(), DrawTile(), and SharedAMapGroup::UpdateLocation().
bool Map::AdjacentEdges | ( | long | x, |
long | y, | ||
tEdge | edge | ||
) | const |
Is the tile at x, y adjacent across the edge?
given an edge (kInternalEdge, kLeftEdge, kRightEdge, kBottomEdge, kTopEdge) returns whether the tiles on both sides of that edge have a smooth boundary that a unit should be able to cross.
Definition at line 1602 of file Map.cpp.
References GetCornerHeight(), GetSplit(), GetTerrainType(), height, kBackwardSplit, kBottomEdge, kBottomLeft, kBottomRight, kForwardSplit, kInternalEdge, kLeftEdge, kLeftSide, kNoSplit, kRightEdge, kRightSide, kTopEdge, kTopLeft, kTopRight, split(), terrainBits, and width.
Referenced by GraphSearchConstants::AddEdges(), AddMapEdges(), GraphSearchConstants::AddNodesToGraph(), AdjacentCorners(), CanStep(), GetEdgeWidthX(), GetEdgeWidthY(), GetMapGraph(), Scale(), and SharedAMapGroup::UpdateLocation().
bool Map::CanStep | ( | long | x1, |
long | y1, | ||
long | x2, | ||
long | y2 | ||
) | const |
Definition at line 1694 of file Map.cpp.
References AdjacentCorners(), AdjacentEdges(), GetTerrainType(), kBottomEdge, kBottomLeft, kBottomRight, kLeftEdge, kOctile, kRightEdge, kTopEdge, kTopLeft, kTopRight, mapType, and terrainBits.
Referenced by Map2DHeading::GetActions(), MPLRTA::MPLRTAStar::GetPath(), and Map2DHeading::GetSuccessors().
|
inline |
Definition at line 159 of file Map.h.
References Map().
Referenced by MapEnvironment::MapEnvironment().
does a rough approximation of the normal for a particular halfTile.
(if I recall, this isn't perfect...)
Definition at line 2224 of file Map.cpp.
References halfTile::corners, height, kBackwardSplit, kForwardSplit, kNoSplit, recVec::normalise(), split(), width, recVec::x, recVec::y, and recVec::z.
Referenced by DrawTile().
void Map::DoVertexColor | ( | tTerrain | type, |
int | vHeight, | ||
bool | darken = false |
||
) | const |
Using OpenGL set the correct color for a particular vertex.
calls the appropriate openGL functions to set the draw color according to the tile height/type
Definition at line 2147 of file Map.cpp.
References Colors::blue, Colors::green, kBlight, kFall, kFallTile, kGrass, kGround, kOutOfBounds, kOutOfBounds2, kSwamp, kTrees, kWater, kWinter, Colors::red, and tileSet.
Referenced by DrawTile().
|
private |
Definition at line 2254 of file Map.cpp.
References GetOpenGLCoord(), GetTerrainType(), height, kGround, and width.
Referenced by OpenGLDraw().
Draw a single tile.
draws a single tile which is at (x, y) in the land (technically we don't have to pass the tile, we could get it from the x,y coordinates)
Definition at line 1941 of file Map.cpp.
References AdjacentCorners(), halfTile::corners, DoNormal(), DoVertexColor(), GetOpenGLCoord(), kBackwardSplit, kBitmap, kBottomLeft, kBottomRight, kFallTile, kForwardSplit, kGround, kLines, kNoSplit, kOutOfBounds, kPoints, kPolygons, kSwamp, kTopLeft, kTopRight, kTrees, kWater, kWinterTile, Tile::split, Tile::tile1, Tile::tile2, tileSet, halfTile::type, and wall.
Referenced by OpenGLDraw().
double Map::GetCoordinateScale | ( | ) |
Set the height of any one corner of a tile.
corner is kTopLeft, kBottomLeft, kTopRight or kBottomRight edge is kBottomEdge, kLeftEdge, kRightEdge, kTopEdge returns kUndefinedHeight if the split is inconsistant with the tile type The combination of a corner and an edge uniquely define a single height
Definition at line 1204 of file Map.cpp.
References halfTile::corners, GetSplit(), kBackwardSplit, kBottomEdge, kBottomLeft, kBottomRight, kForwardSplit, kLeftEdge, kNoSplit, kRightEdge, kTopEdge, kTopLeft, kTopRight, kUndefinedHeight, land, Tile::tile1, and Tile::tile2.
Referenced by AdjacentEdges(), loadOctileCorner(), and SmoothSetRectHeight().
long Map::GetCornerHeight | ( | long | x, |
long | y, | ||
tCorner | which, | ||
tSplitSide | split = kWholeTile |
||
) | const |
Get the height of any one corner of a tile.
corner is kTopLeft, kBottomLeft, kTopRight or kBottomRight split is kLeftSide, kRightSide or kWholeTile returns kUndefinedHeight if the split is inconsistant with the tile type The combination of a corner and a split side uniquely define a single height
Definition at line 1278 of file Map.cpp.
References halfTile::corners, kBackwardSplit, kBottomLeft, kBottomRight, kForwardSplit, kLeftSide, kNoSplit, kRightSide, kTopLeft, kTopRight, kUndefinedHeight, kWholeTile, land, split(), Tile::tile1, and Tile::tile2.
float Map::GetEdgeWidthX | ( | int | x, |
int | y | ||
) |
Returns the edge width between (x, y) and (x+1, y)
Definition at line 2498 of file Map.cpp.
References AdjacentEdges(), edgewidth, GetSplit(), height, kBottomEdge, kRightEdge, kTopEdge, and width.
float Map::GetEdgeWidthY | ( | int | x, |
int | y | ||
) |
Returns the edge width between (x, y) and (x, y+1)
Definition at line 2541 of file Map.cpp.
References AdjacentEdges(), edgewidth, GetSplit(), height, kBottomEdge, kLeftEdge, kRightEdge, and width.
long Map::GetHeight | ( | long | x, |
long | y, | ||
tSplitSide | split = kWholeTile |
||
) |
Get the (flat) height of the tile at x, y.
returns the height of a particular tile – actually just one corner of the tile. If the tile is sloping you'll get back kUndefined and need to get the specific corner heights. returns kUndefinedHeight if the tile is split and you specify the whole tile
Definition at line 1144 of file Map.cpp.
References halfTile::corners, kLeftSide, kNoSplit, kRightSide, kUndefinedHeight, kWholeTile, land, split(), Tile::tile1, and Tile::tile2.
Referenced by MakePseudoMaze().
|
inline |
return the height of the map
Definition at line 165 of file Map.h.
References height.
Referenced by Map3DGrid::AddMap(), GraphSearchConstants::AddNodesToGraph(), BaseMapOccupancyInterface::BaseMapOccupancyInterface(), Racetrack::Boundaries(), BuildRandomRoomMap(), CanonicalGrid::CanonicalGrid::CanonicalGrid(), ClusterAbstraction::createClustersAndEntrances(), Racetrack::Draw(), GraphMapPerfectHeuristic::fillProbTable(), generatePaths(), GraphSearchConstants::GetEightConnectedGraph(), GraphSearchConstants::GetFourConnectedGraph(), GetMapGraph(), GetOpenGLCoord(), MapOverlay::GetOverlayValue(), GetPointFromCoordinate(), Racetrack::Legal(), MakeMaze(), TeleportUnit::MakeMove(), MakePseudoMaze(), MakeRandomMap(), Map3DGrid::Map3DGrid(), MapOverlay::MapOverlay(), MinimalSectorAbstraction::MinimalSectorAbstraction(), MapOverlay::OpenGLDraw(), MapUnit::OpenGLDraw(), SharedAMapGroup::OpenGLDraw(), AbsMapUnit::OpenGLDraw(), ClusterAbstraction::OpenGLDraw(), Racetrack::Reset(), MapOverlay::SetOverlayValue(), SetTerrainType(), SharedAMapGroup::SharedAMapGroup(), MapOverlay::SVGDraw(), SharedAMapGroup::UpdateLocation(), and Racetrack::UpdateMap().
const char * Map::GetMapName | ( | ) |
Definition at line 981 of file Map.cpp.
References map_name.
Referenced by MapEnvironment::GetName().
|
inline |
return the width of the map
Definition at line 163 of file Map.h.
References width.
Referenced by Map3DGrid::AddMap(), Map3DGrid::AddMapPoints(), GraphSearchConstants::AddNodesToGraph(), AdjacentCorners(), BaseMapOccupancyInterface::BaseMapOccupancyInterface(), Racetrack::Boundaries(), BuildRandomRoomMap(), CanonicalGrid::CanonicalGrid::CanonicalGrid(), ClusterAbstraction::createClustersAndEntrances(), MapOverlay::Draw(), Racetrack::Draw(), SharedAMapGroup::Explored(), GraphMapPerfectHeuristic::fillProbTable(), generatePaths(), GraphSearchConstants::GetEightConnectedGraph(), GraphSearchConstants::GetFourConnectedGraph(), Racetrack::GetIndex(), GetMapGraph(), GetOpenGLCoord(), MapOverlay::GetOverlayValue(), GetPointFromCoordinate(), Racetrack::Legal(), MakeMaze(), TeleportUnit::MakeMove(), MakePseudoMaze(), MakeRandomMap(), Map3DGrid::Map3DGrid(), MapOverlay::MapOverlay(), MinimalSectorAbstraction::MinimalSectorAbstraction(), MapOverlay::OpenGLDraw(), MapUnit::OpenGLDraw(), SharedAMapGroup::OpenGLDraw(), AbsMapUnit::OpenGLDraw(), ClusterAbstraction::OpenGLDraw(), Racetrack::Reset(), SharedAMapGroup::SeenBefore(), MapOverlay::SetOverlayValue(), SetTerrainType(), SharedAMapGroup::SharedAMapGroup(), MapOverlay::SVGDraw(), SharedAMapGroup::UpdateLocation(), and Racetrack::UpdateMap().
Gets the abstract Graph node number for this tile.
Because we have a Graph representation of the map as well, we need some way to get back and forth between the representations. This function will get the unique data (nodeNum) for a tile/half tile so that we can go from a tile in the map to a node in the Graph.
Definition at line 2339 of file Map.cpp.
References height, kBottomRight, kTopRight, land, halfTile::node, Tile::tile1, Tile::tile2, and width.
Referenced by ClusterAbstraction::createHorizEntrances(), ClusterAbstraction::createVertEntrances(), SearchUnit::makeMove(), ClusterAbstraction::setUpParents(), and SharedAMapGroup::UpdateLocation().
bool Map::GetOpenGLCoord | ( | float | _x, |
float | _y, | ||
GLdouble & | x, | ||
GLdouble & | y, | ||
GLdouble & | z, | ||
GLdouble & | radius | ||
) | const |
Get the openGL coordinates of a given tile.
Given a tile in (x, y) coordinates, it returns the OpenGL space coordinates of that tile along with the radius of the tile square. The map is drawn in the x<->z plane, with the y plane up.
Definition at line 1861 of file Map.cpp.
References GetOpenGLCoord().
bool Map::GetOpenGLCoord | ( | int | _x, |
int | _y, | ||
GLdouble & | x, | ||
GLdouble & | y, | ||
GLdouble & | z, | ||
GLdouble & | radius | ||
) | const |
Get the openGL coordinates of a given tile.
Given a tile in (x, y) coordinates, it returns the OpenGL space coordinates of that tile along with the radius of the tile square. The map is drawn in the x<->z plane, with the y plane up.
Definition at line 1826 of file Map.cpp.
References halfTile::corners, GetMapHeight(), GetMapWidth(), height, land, Tile::tile2, and width.
Referenced by ClusterAbstraction::addAbsNodes(), GraphSearchConstants::AddNodesToGraph(), MapOverlay::Draw(), Map2DSectorAbstraction::Draw(), MinimalSectorAbstraction::Draw(), drawLandQuickly(), DrawTile(), Racetrack::GetCarCoordinates(), GetOpenGLCoord(), Map2DConstrainedEnvironment::GLDrawLine(), Directional2DEnvironment::GLDrawLine(), ClusterAbstraction::insertNode(), MyFrameHandler(), rewardUnit::OpenGLDraw(), patrolUnit::OpenGLDraw(), MapOverlay::OpenGLDraw(), MapUnit::OpenGLDraw(), SharedAMapGroup::OpenGLDraw(), rewardSeekingUnit::OpenGLDraw(), AbsMapUnit::OpenGLDraw(), SearchUnit::OpenGLDraw(), Map2DConstrainedEnvironment::OpenGLDraw(), Map2DHeading::OpenGLDraw(), MinimalSectorAbstraction::OpenGLDraw(), Directional2DEnvironment::OpenGLDraw(), ClusterAbstraction::OpenGLDraw(), and GraphEnvironment::OpenGLDraw().
void Map::GetPointFromCoordinate | ( | point3d | loc, |
int & | px, | ||
int & | py | ||
) | const |
Definition at line 1900 of file Map.cpp.
References GetMapHeight(), GetMapWidth(), height, width, loc::x, and loc::y.
Referenced by ClusterAbstraction::computeClusterPaths(), ClusterAbstraction::getClusterIdFromNode(), ClusterAbstraction::getLowLevelNode(), ClusterAbstraction::insertNode(), ClusterAbstraction::printMapCoord(), ClusterAbstraction::removeNodes(), and ClusterAbstraction::setUpParents().
tSplit Map::GetSplit | ( | long | x, |
long | y | ||
) | const |
Return the split of the tile at x, y.
Returns the type of split; either kNoSplit, kForwardSplit, kBackwardSplit
Definition at line 1004 of file Map.cpp.
References land, and Tile::split.
Referenced by GraphSearchConstants::AddEdges(), AddMapEdges(), AdjacentCorners(), AdjacentEdges(), GetCornerHeight(), GetEdgeWidthX(), GetEdgeWidthY(), and SmoothSetRectHeight().
long Map::GetTerrainType | ( | long | x, |
long | y, | ||
tEdge | side | ||
) | const |
Get the terrain type for one side of the tile at x, y.
Gets the terrain type for a particular edge of the type. (kLeftEdge, kRightEdge, kTopEdge, kBottom Edge) This function avoids making you figure out all the ways a tile could be split to get the correct value out.
Definition at line 1077 of file Map.cpp.
References height, kBackwardSplit, kBottomEdge, kForwardSplit, kLeftEdge, kNoSplit, kRightEdge, kTopEdge, kUndefined, land, split(), Tile::tile1, Tile::tile2, halfTile::type, and width.
long Map::GetTerrainType | ( | long | x, |
long | y, | ||
tSplitSide | split = kWholeTile |
||
) | const |
Get the terrain type of the (split) tile at x, y.
Gets the terrain type for this tile. By default it looks for the value of the whole tile. Possible split values are kWholeTile, kLeftSide, and kRightSide.
Definition at line 1028 of file Map.cpp.
References height, kRightSide, kUndefined, land, split(), Tile::tile1, Tile::tile2, halfTile::type, and width.
Referenced by Map3DGrid::AddMap(), Map3DGrid::AddMapPoints(), GraphSearchConstants::AddNodesToGraph(), AdjacentEdges(), CanonicalGrid::CanonicalGrid::CanonicalGrid(), CanStep(), drawLandQuickly(), MinimalSectorAbstraction::FindParentRegion(), GetMapGraph(), OldSearchCode::MapSearchEnvironment::getNeighbors(), MinimalSectorAbstraction::GetRegion(), MinimalSectorAbstraction::GetSectorRegions(), Racetrack::GoalTest(), Racetrack::Legal(), Directional2DEnvironment::Legal(), Map2DHeading::LegalState(), MakeMaze(), MakeRandomMap(), paintRoomInside(), PossibileDirs(), Racetrack::Reset(), saveOctile(), StraightDir(), Trim(), tryLoadRollingStone(), SharedAMapGroup::UpdateLocation(), and Racetrack::UpdateMap().
Tile & Map::GetTile | ( | long | x, |
long | y | ||
) |
Return the tile at location x, y.
returns a reference to the type at a particular x/y location. (starting from 0)
Definition at line 994 of file Map.cpp.
References land.
Referenced by GraphSearchConstants::AddEdges(), AddMapEdges(), GraphSearchConstants::AddNodesToGraph(), and GetMapGraph().
tTileset Map::GetTileSet | ( | ) |
|
private |
Definition at line 817 of file Map.cpp.
Referenced by tryLoadRollingStone().
void Map::Load | ( | const char * | filename | ) |
void Map::Load | ( | FILE * | f | ) |
Resets the current map by loading the file from the pointer passed in.
Definition at line 292 of file Map.cpp.
References dList, drawLand, height, land, loadOctile(), loadOctileCorner(), loadRaw(), map_name, tryDragonAge(), tryLoadRollingStone(), updated, and width.
|
private |
Definition at line 362 of file Map.cpp.
References dList, drawLand, height, kBlight, kGrass, kGround, kNoGraphNode, kOctile, kOutOfBounds, kSwamp, kTrees, kWater, land, mapType, halfTile::node, SetTerrainType(), sizeMultiplier, Tile::tile1, Tile::tile2, updated, and width.
Referenced by Load().
|
private |
Definition at line 428 of file Map.cpp.
References dList, drawLand, GetCornerHeight(), height, kBottomLeft, kBottomRight, kGround, kNoGraphNode, kOctileCorner, kOutOfBounds, kSwamp, kTopLeft, kTopRight, kTrees, kWater, land, mapType, halfTile::node, SetCornerHeight(), SetHeight(), SetTerrainType(), Tile::tile1, Tile::tile2, updated, and width.
Referenced by Load().
|
private |
Definition at line 340 of file Map.cpp.
References dList, drawLand, height, kNoGraphNode, kRaw, land, mapType, halfTile::node, Tile::tile1, Tile::tile2, updated, and width.
Referenced by Load().
Does actual OpenGL drawing of the map.
If drawLand has been set (on by default) the ground will be drawn using the appropriate mode: kPolygons, kLines, kPoints kPolygon is the default mode. The map is cached in a display list unless it changes.
Definition at line 1777 of file Map.cpp.
References dList, drawLand, drawLandQuickly(), DrawTile(), height, kFast, land, tileSet, updated, verbose, and width.
Referenced by Map2DHeading::OpenGLDraw(), Directional2DEnvironment::OpenGLDraw(), and GraphEnvironment::OpenGLDraw().
|
private |
Definition at line 800 of file Map.cpp.
References GetTerrainType(), height, kGround, kNoGraphNode, kOutOfBounds, kWater, land, halfTile::node, SetTerrainType(), Tile::tile1, and width.
Referenced by tryLoadRollingStone().
void Map::Print | ( | int | _scale = 1 | ) |
Do an ASCII/ANSI print out of the map.
Moves the cursor to the top of the screen and draws an ASCII version of the map. The map is shrunk by a factor of 2 in the vertical scale, but left normal in the horizontal scale. For the moment we leave ground blank and draw the walls as x/X/^. No other ground type is drawn.
Definition at line 917 of file Map.cpp.
References height, kGround, kOutOfBounds, kSwamp, land, and width.
void Map::Save | ( | const char * | filename | ) |
void Map::Save | ( | FILE * | f | ) |
Saves the current map out to the designated file.
Saves the current map out to the designated file.
Definition at line 856 of file Map.cpp.
References kOctile, kOctileCorner, kRaw, kSokoban, mapType, saveOctile(), and saveRaw().
void Map::Save | ( | std::stringstream & | data | ) |
|
private |
|
private |
void Map::Scale | ( | long | newWidth, |
long | newHeight | ||
) |
Definition at line 177 of file Map.cpp.
References AdjacentEdges(), halfTile::corners, height, kLeftEdge, kTopEdge, land, map_name, revision, Tile::tile1, Tile::tile2, updated, and width.
Referenced by CreateSimulation(), and generatePaths().
void Map::SetCornerHeight | ( | long | x, |
long | y, | ||
tCorner | which, | ||
long | cHeight, | ||
tSplitSide | split = kWholeTile |
||
) |
Set the height of any one corner of a tile.
corner is kTopLeft, kBottomLeft, kTopRight or kBottomRight split is kLeftSide, kRightSide or kWholeTile The combination of a corner and a split side uniquely define a single height, which is returned.
Definition at line 1335 of file Map.cpp.
References halfTile::corners, kBackwardSplit, kBottomLeft, kBottomRight, kForwardSplit, kLeftSide, kNoSplit, kRightSide, kTopLeft, kTopRight, kWholeTile, land, revision, split(), Tile::tile1, and Tile::tile2.
Referenced by loadOctileCorner(), and SmoothSetRectHeight().
void Map::SetDrawLand | ( | bool | land | ) |
void Map::SetHeight | ( | long | x, |
long | y, | ||
long | tHeight, | ||
tSplitSide | split = kWholeTile |
||
) |
Set the (flat) height of the tile at x, y.
Split is kWholeTile, kLeftSide or kRightSide.
Definition at line 1173 of file Map.cpp.
References halfTile::corners, kLeftSide, kRightSide, kWholeTile, land, revision, split(), Tile::tile1, and Tile::tile2.
Referenced by loadOctileCorner(), MakePseudoMaze(), SetRectHeight(), and tryLoadRollingStone().
Sets the abstract Graph node number for this tile.
Because we have a Graph representation of the map as well, we need some way to get back and forth between the representations. This function will set the unique data (nodeNum) for a tile/half tile so that we can go from a tile in the map to a node in the Graph.
Definition at line 2319 of file Map.cpp.
References height, kBottomRight, kTopRight, land, halfTile::node, Tile::tile1, Tile::tile2, and width.
Set the height and terrain of a set of tiles.
Sets all the tiles in the region between (x1, y1) (x2, y2) to be the same height and terrain type, with no splits.
Definition at line 1578 of file Map.cpp.
References kNoSplit, map_name, revision, SetHeight(), SetSplit(), SetTerrainType(), and updated.
Referenced by MakeMaze(), MakePseudoMaze(), and SmoothSetRectHeight().
|
inline |
Definition at line 152 of file Map.h.
References sizeMultiplier.
void Map::SetSplit | ( | long | x, |
long | y, | ||
tSplit | split | ||
) |
Set the split of the tile at x, y.
Sets how a map is split; either kNoSplit, kForwardSplit, kBackwardSplit
Definition at line 1014 of file Map.cpp.
References land, revision, split(), and Tile::split.
Referenced by SetRectHeight(), SmoothSetRectHeight(), and tryLoadRollingStone().
void Map::SetTerrainType | ( | int32_t | x1, |
int32_t | y1, | ||
int32_t | x2, | ||
int32_t | y2, | ||
tTerrain | t | ||
) |
Set all the terrain between two points to be the same
x1 | The first x-coordinate to set |
y1 | The first y-coordinate to set |
x2 | The second x-coordinate to set |
y2 | The second y-coordinate to set |
terrain | The terrain for the line between the coordinates |
Definition at line 1049 of file Map.cpp.
References updated.
Referenced by BuildRandomRoomMap(), Burrow(), loadOctile(), loadOctileCorner(), MakeMaze(), MakePseudoMaze(), MakeRandomMap(), paintRoomInside(), SetRectHeight(), SmoothSetRectHeight(), tryDragonAge(), tryLoadRollingStone(), and SharedAMapGroup::UpdateLocation().
void Map::SetTerrainType | ( | long | x, |
long | y, | ||
tTerrain | type, | ||
tSplitSide | split = kWholeTile |
||
) |
Set the terrain type of the side of the tile at x, y.
side is one of kWholeTile, kLeftSide or kRightSide If tile is not split and you specify a split side, nothing happens If tile is split and you specify kWholeTile, the split remains, and the terrain is applied to both sides.
Definition at line 1108 of file Map.cpp.
References GetMapHeight(), GetMapWidth(), height, kLeftSide, kNoSplit, kRightSide, kWholeTile, land, map_name, revision, split(), Tile::tile1, Tile::tile2, halfTile::type, updated, and width.
void Map::SetTileSet | ( | tTileset | ts | ) |
Choose the tileset used for land colors.
Tilesets named xxxTile will draw the map as independant tiles as opposed to a smooth connected map.
Definition at line 1747 of file Map.cpp.
References InitTextures(), kBitmap, tileSet, and updated.
Referenced by CreateSimulation().
void Map::SmoothSetRectHeight | ( | long | x1, |
long | y1, | ||
long | x2, | ||
long | y2, | ||
long | h, | ||
tTerrain | type = kGround |
||
) |
Places a rectangle into the map, but also modifies the edges to make the transition smooth.
sets a rectangle of with corner coordinates (x1, y1) (x2, y2) but also takes the 1-radius tiles surrounding that rectangle and smooths them so you get a nice fit of land together.
Definition at line 1395 of file Map.cpp.
References GetCornerHeight(), GetSplit(), kBackwardSplit, kBottomLeft, kBottomRight, kForwardSplit, kLeftSide, kNoSplit, kRightSide, kTopLeft, kTopRight, map_name, SetCornerHeight(), SetRectHeight(), SetSplit(), SetTerrainType(), and updated.
void Map::Trim | ( | ) |
|
private |
Definition at line 521 of file Map.cpp.
References header::dataoffset, dList, drawLand, header::filetype, header::fileversion, height, kGround, kOctile, kOutOfBounds, kTrees, land, header::magic, mapType, header::platform, SetTerrainType(), header::structcount, updated, header::version, and width.
Referenced by Load().
|
private |
Definition at line 696 of file Map.cpp.
References dList, drawLand, GetTerrainType(), height, isLegalStone(), kBlight, kGrass, kNoGraphNode, kNoSplit, kOutOfBounds, kSokoban, kSwamp, kWater, land, mapType, max, halfTile::node, paintRoomInside(), SetHeight(), SetSplit(), SetTerrainType(), Tile::tile1, Tile::tile2, updated, and width.
Referenced by Load().
|
mutableprivate |
Definition at line 241 of file Map.h.
Referenced by Load(), loadOctile(), loadOctileCorner(), loadRaw(), Map(), OpenGLDraw(), tryDragonAge(), and tryLoadRollingStone().
|
private |
Definition at line 240 of file Map.h.
Referenced by GetDrawLand(), Load(), loadOctile(), loadOctileCorner(), loadRaw(), Map(), OpenGLDraw(), SetDrawLand(), tryDragonAge(), and tryLoadRollingStone().
|
private |
Definition at line 238 of file Map.h.
Referenced by AdjacentCorners(), AdjacentEdges(), DoNormal(), drawLandQuickly(), GetCoordinateScale(), GetEdgeWidthX(), GetEdgeWidthY(), GetMapHeight(), GetNodeNum(), GetOpenGLCoord(), GetPointFromCoordinate(), GetTerrainType(), Load(), loadOctile(), loadOctileCorner(), loadRaw(), Map(), OpenGLDraw(), paintRoomInside(), Print(), saveOctile(), saveRaw(), Scale(), SetNodeNum(), SetTerrainType(), Trim(), tryDragonAge(), and tryLoadRollingStone().
|
private |
Definition at line 239 of file Map.h.
Referenced by GetCornerHeight(), GetHeight(), GetNodeNum(), GetOpenGLCoord(), GetSplit(), GetTerrainType(), GetTile(), Load(), loadOctile(), loadOctileCorner(), loadRaw(), Map(), OpenGLDraw(), paintRoomInside(), Print(), saveRaw(), Scale(), SetCornerHeight(), SetHeight(), SetNodeNum(), SetSplit(), SetTerrainType(), Trim(), tryDragonAge(), tryLoadRollingStone(), and ~Map().
|
private |
Definition at line 245 of file Map.h.
Referenced by GetMapName(), Load(), Map(), Scale(), SetRectHeight(), SetTerrainType(), SmoothSetRectHeight(), and Trim().
|
private |
Definition at line 246 of file Map.h.
Referenced by CanStep(), loadOctile(), loadOctileCorner(), loadRaw(), Map(), Save(), tryDragonAge(), and tryLoadRollingStone().
|
private |
Definition at line 244 of file Map.h.
Referenced by GetRevision(), Load(), Map(), Scale(), SetCornerHeight(), SetHeight(), SetRectHeight(), SetSplit(), SetTerrainType(), and Trim().
|
private |
Definition at line 243 of file Map.h.
Referenced by loadOctile(), Map(), and setSizeMultipler().
|
private |
Definition at line 247 of file Map.h.
Referenced by DoVertexColor(), DrawTile(), GetTileSet(), Map(), OpenGLDraw(), and SetTileSet().
|
mutableprivate |
Definition at line 242 of file Map.h.
Referenced by Load(), loadOctile(), loadOctileCorner(), loadRaw(), Map(), OpenGLDraw(), Scale(), SetRectHeight(), SetTerrainType(), SetTileSet(), SmoothSetRectHeight(), Trim(), tryDragonAge(), and tryLoadRollingStone().
|
private |
Definition at line 238 of file Map.h.
Referenced by AdjacentCorners(), AdjacentEdges(), DoNormal(), drawLandQuickly(), GetCoordinateScale(), GetEdgeWidthX(), GetEdgeWidthY(), GetMapWidth(), GetNodeNum(), GetOpenGLCoord(), GetPointFromCoordinate(), GetTerrainType(), Load(), loadOctile(), loadOctileCorner(), loadRaw(), Map(), OpenGLDraw(), paintRoomInside(), Print(), saveOctile(), saveRaw(), Scale(), SetNodeNum(), SetTerrainType(), Trim(), tryDragonAge(), tryLoadRollingStone(), and ~Map().