_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
Tileset definition. More...
#include <tileset.h>
Public Member Functions | |
unsigned int | getTileCount () const |
const PixelSize & | getPixelTileSize () const |
unsigned | getRemovedRockTile () const |
unsigned | getRemovedTreeTile () const |
unsigned | getBottomOneTreeTile () const |
unsigned | getTopOneTreeTile () const |
unsigned | getMidOneTreeTile () const |
Public Attributes | |
std::string | Name |
std::string | ImageFile |
Nice name to display. More... | |
std::vector< CTile > | tiles |
File containing image data. More... | |
std::vector< unsigned char > | TileTypeTable |
script_tileset.cpp - The tileset ccl functions. | |
void | parse (lua_State *l) |
void | buildTable (lua_State *l) |
int | parseTilesetTileFlags (lua_State *l, int *back, int *j) |
tileset.cpp - The tileset. | |
void | clear () |
unsigned int | getDefaultTileIndex () const |
unsigned int | getDefaultWoodTileIndex () const |
bool | isAWallTile (unsigned tile) const |
bool | isARaceWallTile (unsigned tile, bool human) const |
bool | isAWoodTile (unsigned tile) const |
bool | isARockTile (unsigned tile) const |
unsigned | getWallDirection (int tileIndex, bool human) const |
unsigned | getHumanWallTileIndex (int dirFlag) const |
unsigned | getOrcWallTileIndex (int dirFlag) const |
unsigned | getHumanWallTileIndex_broken (int dirFlag) const |
unsigned | getOrcWallTileIndex_broken (int dirFlag) const |
unsigned | getHumanWallTileIndex_destroyed (int dirFlag) const |
unsigned | getOrcWallTileIndex_destroyed (int dirFlag) const |
unsigned int | getSolidTerrainCount () const |
const std::string & | getTerrainName (int solidTerrainIndex) const |
int | findTileIndexByTile (unsigned int tile) const |
unsigned int | getTileNumber (int basic, bool random, bool filler) const |
void | fillSolidTiles (std::vector< unsigned int > *solidTiles) const |
unsigned | getQuadFromTile (unsigned int tile) const |
int | getTileBySurrounding (unsigned short type, int up, int right, int bottom, int left) const |
int | tileFromQuad (unsigned fixed, unsigned quad) const |
bool | isEquivalentTile (unsigned int tile1, unsigned int tile2) const |
int | findTileIndex (unsigned char baseTerrain, unsigned char mixTerrain=0) const |
Tileset definition.
#include "tileset.h"
This structure contains information about the tileset of the map. It defines the look and properties of the tiles. Currently only one tileset per map is supported. In the future it is planned to support multiple tilesets on the same map. Also it is planned to support animated tiles.
The tileset structure members:
Long name of the tileset. Can be used by the level editor.
Name of the graphic file, containing all tiles.
CTileset::Table
Table to map the abstract level (PUD) tile numbers, to tile numbers in the graphic file (CTileset::File). FE. 16 (solid light water) in pud to 328 in png.
CTileset::Flags
Table of the tile flags used by the editor. @see CMapField::Flags
CTileset::solidTerrainTypes
Index to name of the basic tile type. FE. "light-water". If the index is 0, the tile is not used.
CTileset::MixedNameTable
Index to name of the mixed tile type. FE. "light-water". If this index is 0, the tile is a solid tile. @see CTileset::TileNames
Lookup table of the tile type. Maps the graphic file tile number back to a tile type (::TileTypeWood, ::TileTypeWater, ...) @note The creation of this table is currently hardcoded in the engine. It should be calculated from the flags in the tileset configuration. And it is created for the map and not for the tileset. @note I'm not sure if this table is needed in the future. @see TileType.
CTileset::topOneTreeTile
The tile number of tile only containing the top part of a tree. Is created on the map by lumber chopping.
CTileset::midOneTreeTile
The tile number of tile only containing the connection of the top part to the bottom part of tree. Is created on the map by lumber chopping.
CTileset::botOneTreeTile
The tile number of tile only containing the bottom part of a tree. Is created on the map by lumber chopping.
CTileset::removedTreeTile
The tile number of the tile placed where trees are removed. Is created on the map by lumber chopping.
CTilset::woodTable[20]
Table for wood removable. This table contains the tile which is placed after a tree removement, depending on the surrounding.
CTileset::mixedLookupTable[] Table for finding what part of the tile contains wood/rock, and which part is grass or bare ground.
CTileset::topOneRockTile
The tile number of tile only containing the top part of a rock. Is created on the map by destroying rocks.
CTileset::midOneRockTile
The tile number of tile only containing the connection of the top part to the bottom part of a rock. Is created on the map by destroying rocks.
CTileset::botOneRockTile
The tile number of tile only containing the bottom part of a rock. Is created on the map by destroying rocks.
CTileset::removedRockTile
The tile number of the tile placed where rocks are removed. Is created on the map by destroying rocks.
CTileset::rockTable[20]
Table for rock removable. Depending on the surrinding this table contains the new tile to be placed. @todo Johns: I don't think this table or routines look correct. But they work correct.
CTileset::humanWallTable
Table of human wall tiles, index depends on the surroundings.
CTileset::orcWallTable
Table of orc wall tiles, index depends on the surroundings.
void CTileset::buildTable | ( | lua_State * | l | ) |
void CTileset::clear | ( | ) |
void CTileset::fillSolidTiles | ( | std::vector< unsigned int > * | solidTiles | ) | const |
int CTileset::findTileIndex | ( | unsigned char | baseTerrain, |
unsigned char | mixTerrain = 0 |
||
) | const |
int CTileset::findTileIndexByTile | ( | unsigned int | tile | ) | const |
|
inline |
unsigned int CTileset::getDefaultTileIndex | ( | ) | const |
unsigned int CTileset::getDefaultWoodTileIndex | ( | ) | const |
unsigned CTileset::getHumanWallTileIndex | ( | int | dirFlag | ) | const |
unsigned CTileset::getHumanWallTileIndex_broken | ( | int | dirFlag | ) | const |
unsigned CTileset::getHumanWallTileIndex_destroyed | ( | int | dirFlag | ) | const |
|
inline |
unsigned CTileset::getOrcWallTileIndex | ( | int | dirFlag | ) | const |
unsigned CTileset::getOrcWallTileIndex_broken | ( | int | dirFlag | ) | const |
unsigned CTileset::getOrcWallTileIndex_destroyed | ( | int | dirFlag | ) | const |
|
inline |
unsigned CTileset::getQuadFromTile | ( | unsigned int | tile | ) | const |
Get quad from tile.
A quad is a 32 bit value defining the content of the tile.
A tile is split into 4 parts, the basic tile type of this part is stored as 8bit value in the quad.
ab cd -> abcd
If the tile is 100% light grass(0x05) the value is 0x05050505. If the tile is 3/4 light grass and dark grass(0x06) in upper left corner the value is 0x06050505.
|
inline |
|
inline |
unsigned int CTileset::getSolidTerrainCount | ( | ) | const |
const std::string & CTileset::getTerrainName | ( | int | solidTerrainIndex | ) | const |
int CTileset::getTileBySurrounding | ( | unsigned short | type, |
int | up, | ||
int | right, | ||
int | bottom, | ||
int | left | ||
) | const |
|
inline |
unsigned int CTileset::getTileNumber | ( | int | basic, |
bool | random, | ||
bool | filler | ||
) | const |
Get tile number.
basic | Basic tile number |
random | Return random tile |
filler | Get a decorated tile. |
|
inline |
unsigned CTileset::getWallDirection | ( | int | tileIndex, |
bool | human | ||
) | const |
bool CTileset::isARaceWallTile | ( | unsigned | tile, |
bool | human | ||
) | const |
bool CTileset::isARockTile | ( | unsigned | tile | ) | const |
bool CTileset::isAWallTile | ( | unsigned | tile | ) | const |
bool CTileset::isAWoodTile | ( | unsigned | tile | ) | const |
bool CTileset::isEquivalentTile | ( | unsigned int | tile1, |
unsigned int | tile2 | ||
) | const |
void CTileset::parse | ( | lua_State * | l | ) |
int CTileset::parseTilesetTileFlags | ( | lua_State * | l, |
int * | back, | ||
int * | j | ||
) |
Parse the flag section of a tile definition.
l | Lua state. |
back | pointer for the flags (return). |
j | pointer for the location in the array. in and out |
int CTileset::tileFromQuad | ( | unsigned | fixed, |
unsigned | quad | ||
) | const |
Get tile from quad.
fixed | Part can't be changed. |
quad | Quad of the tile type. |
std::string CTileset::ImageFile |
Nice name to display.
std::string CTileset::Name |
std::vector<CTile> CTileset::tiles |
File containing image data.
std::vector<unsigned char> CTileset::TileTypeTable |