#include <map.h>
Collaboration diagram for Map:
Public Member Functions | |
Map (long width, long height) | |
Create a new map of a particular size. | |
Map (const char *filename) | |
Create a new map by loading it from a file. | |
Map (Map *) | |
Create a new map by copying it from another map. | |
Map (FILE *) | |
Create a new map by loading it from a file pointer. | |
Map (std::istringstream &data) | |
Not implemented. | |
~Map () | |
void | load (const char *filename) |
Resets the current map by loading the file passed in. | |
void | load (FILE *f) |
Resets the current map by loading the file from the pointer passed in. | |
void | setSizeMultipler (int _sizeMultiplier) |
void | scale (long newWidth, long newHeight) |
void | save (std::stringstream &data) |
unimplemented. | |
void | save (const char *filename) |
Saves the current map out to the designated file. | |
void | save (FILE *f) |
Saves the current map out to the designated file. | |
Map * | clone () |
const char * | getMapName () |
void | print (int scale=1) |
Do an ASCII/ANSI print out of the map. | |
long | getMapWidth () const |
return the width of the map | |
long | getMapHeight () const |
return the height of the map | |
void | setTileSet (tTileset ts) |
Choose the tileset used for land colors. | |
tTileset | getTileSet () |
Get the tileset used for land colors. | |
Tile & | getTile (long x, long y) |
Return the tile at location x, y. | |
tSplit | getSplit (long x, long y) const |
Return the split of the tile at x, y. | |
void | setSplit (long x, long y, tSplit split) |
Set the split of the tile at x, y. | |
long | getTerrainType (long x, long y, tSplitSide split=kWholeTile) const |
Get the terrain type of the (split) tile at x, y. | |
long | getTerrainType (long x, long y, tEdge side) const |
Get the terrain type for one side of the tile at x, y. | |
void | setTerrainType (long x, long y, tTerrain type, tSplitSide split=kWholeTile) |
Set the terrain type of the side of the tile at x, y. | |
long | getHeight (long x, long y, tSplitSide split=kWholeTile) |
Get the (flat) height of the tile at x, y. | |
void | setHeight (long x, long y, long height, tSplitSide split=kWholeTile) |
Set the (flat) height of the tile at x, y. | |
long | getCornerHeight (long x, long y, tCorner which, tEdge edge) const |
Set the height of any one corner of a tile. | |
long | getCornerHeight (long x, long y, tCorner which, tSplitSide split=kWholeTile) const |
Get the height of any one corner of a tile. | |
void | setCornerHeight (long x, long y, tCorner which, long height, tSplitSide split=kWholeTile) |
Set the height of any one corner of a tile. | |
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. | |
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. | |
bool | adjacentEdges (long x, long y, tEdge edge) const |
Is the tile at x, y adjacent across the edge? | |
bool | adjacentCorners (long x, long y, tCorner corner) const |
bool | canStep (long x1, long y1, long x2, long y2) const |
void | openGLDraw (tDisplay how) |
Does actual OpenGL drawing of the map. | |
void | getOpenGLCoord (int _x, int _y, GLdouble &x, GLdouble &y, GLdouble &z, GLdouble &radius) const |
Get the openGL coordinates of a given tile. | |
void | getPointFromCoordinate (point3d loc, int &px, int &py) const |
double | getCoordinateScale () |
Returns the scale multiplier between openGL coordinates and map coordinates. | |
void | setDrawLand (bool land) |
Toggles whether the land is draw when you call openGLDraw. | |
bool | getDrawLand () |
void | drawTile (Tile *t, int x, int y, tDisplay how) |
Draw a single tile. | |
void | doVertexColor (tTerrain type, int height, bool darken=false) |
Using OpenGL set the correct color for a particular vertex. | |
void | doNormal (tSplit split, halfTile *t, int x, int y) |
does a rough approximation of the normal for a particular halfTile. | |
float | getEdgeWidthX (int x, int y) |
Returns the edge width between (x, y) and (x+1, y). | |
float | getEdgeWidthY (int x, int y) |
Returns the edge width between (x, y) and (x, y+1). | |
int | getNodeNum (int x, int y, tCorner c=kNone) |
Gets the abstract graph node number for this tile. | |
void | setNodeNum (int num, int x, int y, tCorner c=kNone) |
Sets the abstract graph node number for this tile. | |
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 | isLegalStone (char c) |
void | paintRoomInside (int x, int y) |
void | drawLandQuickly () |
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 |
|
Create a new map of a particular size. A map is an array of tiles according to the height and width of the map. |
|
Create a new map by loading it from a file. Creates a new map and initializes it with the file passed to it. |
|
Create a new map by copying it from another map. Creates a new map and initializes it with the map passed to it. |
|
Create a new map by loading it from a file pointer. Creates a new map and initializes it with the file pointer passed to it. |
|
Not implemented. This function is not implemented. |
|
|
|
|
|
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. |
|
|
|
|
|
does a rough approximation of the normal for a particular halfTile. (if I recall, this isn't perfect...) |
|
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 |
|
|
|
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) |
|
Returns the scale multiplier between openGL coordinates and map coordinates. If you measure a distance in openGL coordinate space, you can multiply it by this value to convert it to map space, where the distance between adjacent tiles is 1. |
|
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 |
|
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 |
|
|
|
Returns the edge width between (x, y) and (x+1, y).
|
|
Returns the edge width between (x, y) and (x, y+1).
|
|
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 |
|
return the height of the map
|
|
|
|
return the width of the map
|
|
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. |
|
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. |
|
|
|
|
|
Return the split of the tile at x, y. Returns the type of split; either kNoSplit, kForwardSplit, kBackwardSplit |
|
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. |
|
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. |
|
Return the tile at location x, y. returns a reference to the type at a particular x/y location. (starting from 0) |
|
Get the tileset used for land colors.
|
|
|
|
Resets the current map by loading the file from the pointer passed in.
|
|
Resets the current map by loading the file passed in. Resets the current map by loading the file passed in. |
|
|
|
|
|
|
|
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. |
|
|
|
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. |
|
Saves the current map out to the designated file. Saves the current map out to the designated file. |
|
Saves the current map out to the designated file. Saves the current map out to the designated file. |
|
unimplemented.
|
|
|
|
|
|
|
|
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. |
|
Toggles whether the land is draw when you call openGLDraw.
|
|
Set the (flat) height of the tile at x, y. Split is kWholeTile, kLeftSide or kRightSide. |
|
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. |
|
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. |
|
|
|
Set the split of the tile at x, y. Sets how a map is split; either kNoSplit, kForwardSplit, kBackwardSplit |
|
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. |
|
Choose the tileset used for land colors. Tilesets named xxxTile will draw the map as independant tiles as opposed to a smooth connected map. |
|
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. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|