ManaPlus
|
#include <maplayer.h>
Public Member Functions | |
MapLayer (const std::string &name, const int x, const int y, const int width, const int height, const bool isFringeLayer, const int mask, const int tileCondition) | |
~MapLayer () | |
void | setTile (const int x, const int y, Image *const img) |
void | setTile (const int index, Image *const img) |
void | draw (Graphics *const graphics, int startX, int startY, int endX, int endY, const int scrollX, const int scrollY) const |
void | drawSDL (Graphics *const graphics) const |
void | drawOGL (Graphics *const graphics) const |
void | updateOGL (Graphics *const graphics, int startX, int startY, int endX, int endY, const int scrollX, const int scrollY) |
void | updateSDL (const Graphics *const graphics, int startX, int startY, int endX, int endY, const int scrollX, const int scrollY) |
void | drawFringe (Graphics *const graphics, int startX, int startY, int endX, int endY, const int scrollX, const int scrollY, const Actors &actors) const |
bool | isFringeLayer () const |
void | setSpecialLayer (const SpecialLayer *const val) |
void | setTempLayer (const SpecialLayer *const val) |
int | getWidth () const |
int | getHeight () const |
void | optionChanged (const std::string &value) |
void | setDrawLayerFlags (const MapTypeT &n) |
void | setActorsFix (const int y) |
int | calcMemoryLocal () const |
int | calcMemoryChilds (const int level) const |
std::string | getCounterName () const |
Public Member Functions inherited from MemoryCounter | |
MemoryCounter () | |
virtual | ~MemoryCounter () |
int | calcMemory (const int level) const |
Public Member Functions inherited from ConfigListener | |
ConfigListener () | |
virtual | ~ConfigListener () |
Protected Member Functions | |
void | updateConditionTiles (const MetaTile *const metaTiles, const int width, const int height) |
void | updateCache (const int width, const int height) |
void | drawSpecialLayer (Graphics *const graphics, const int y, const int startX, const int endX, const int scrollX, const int scrollY) const |
Static Protected Member Functions | |
static int | getTileDrawWidth (const TileInfo *img, const int endX, int &width, int &nextTile) |
static int | getEmptyTileDrawWidth (const TileInfo *img, const int endX, int &nextTile) |
Private Types | |
typedef std::vector< MapRowVertexes * > | MapRows |
Private Attributes | |
const int | mX |
const int | mY |
const int | mPixelX |
const int | mPixelY |
const int | mWidth |
const int | mHeight |
TileInfo *const | mTiles |
MapTypeT | mDrawLayerFlags |
const SpecialLayer * | mSpecialLayer |
const SpecialLayer * | mTempLayer |
const std::string | mName |
MapRows | mTempRows |
int | mMask |
int | mTileCondition |
int | mActorsFix |
const bool | mIsFringeLayer |
bool | mHighlightAttackRange |
bool | mSpecialFlag |
Friends | |
class | Map |
A map layer. Stores a grid of tiles and their offset, and implements layer rendering.
Definition at line 49 of file maplayer.h.
|
private |
Definition at line 232 of file maplayer.h.
MapLayer::MapLayer | ( | const std::string & | name, |
const int | x, | ||
const int | y, | ||
const int | width, | ||
const int | height, | ||
const bool | isFringeLayer, | ||
const int | mask, | ||
const int | tileCondition | ||
) |
Constructor, taking layer origin, size and whether this layer is the fringe layer. The fringe layer is the layer that draws the actors. There can be only one fringe layer per map.
Definition at line 50 of file maplayer.cpp.
References Configuration::addListener(), and config.
Referenced by calcMemoryLocal().
MapLayer::~MapLayer | ( | ) |
Destructor.
Definition at line 82 of file maplayer.cpp.
References CHECKLISTENERS, config, delete_all(), mTempRows, mTiles, and Configuration::removeListener().
|
virtual |
Reimplemented from MemoryCounter.
Definition at line 831 of file maplayer.cpp.
References MemoryCounter::calcMemory(), mSpecialLayer, and mTempLayer.
|
virtual |
Reimplemented from MemoryCounter.
Definition at line 824 of file maplayer.cpp.
References MapLayer(), mHeight, mTempRows, and mWidth.
void MapLayer::draw | ( | Graphics *const | graphics, |
int | startX, | ||
int | startY, | ||
int | endX, | ||
int | endY, | ||
const int | scrollX, | ||
const int | scrollY | ||
) | const |
Draws this layer to the given graphics context. The coordinates are expected to be in map range and will be translated to local layer coordinates and clipped to the layer's dimensions.
The given actors are only drawn when this layer is the fringe layer.
Definition at line 100 of file maplayer.cpp.
References BLOCK_END, BLOCK_START, CAST_SIZE, TileInfo::count, TileInfo::image, TileInfo::isEnabled, mapTileSize, TileInfo::nextTile, TileInfo::width, x, and y.
void MapLayer::drawFringe | ( | Graphics *const | graphics, |
int | startX, | ||
int | startY, | ||
int | endX, | ||
int | endY, | ||
const int | scrollX, | ||
const int | scrollY, | ||
const Actors & | actors | ||
) | const |
Definition at line 425 of file maplayer.cpp.
References UserColorId::ATTACK_RANGE, UserColorId::ATTACK_RANGE_BORDER, MapType::BLACKWHITE, BLOCK_END, BLOCK_START, CAST_SIZE, TileInfo::count, LocalPlayer::getAttackRange(), UserPalette::getColorWithAlpha(), Actor::getPixelX(), Actor::getPixelY(), TileInfo::image, TileInfo::isEnabled, localPlayer, mapTileSize, TileInfo::nextTile, MapType::SPECIAL3, MapType::SPECIAL4, userPalette, TileInfo::width, x, and y.
void MapLayer::drawOGL | ( | Graphics *const | graphics | ) | const |
Definition at line 349 of file maplayer.cpp.
References BLOCK_END, and BLOCK_START.
void MapLayer::drawSDL | ( | Graphics *const | graphics | ) | const |
|
protected |
Definition at line 370 of file maplayer.cpp.
References MapItem::draw(), MapItemType::EMPTY, mapTileSize, MapItem::mType, x, and y.
|
inlinevirtual |
|
staticprotected |
|
inline |
|
staticprotected |
|
inline |
|
inline |
Definition at line 141 of file maplayer.h.
References mIsFringeLayer.
Referenced by Map::updateDrawLayersList().
|
virtual |
Called when an option changed. The config listener will have to be registered to the option name first.
Implements ConfigListener.
Definition at line 91 of file maplayer.cpp.
References config, and Configuration::getBoolValue().
|
inline |
|
inline |
Definition at line 161 of file maplayer.h.
References mDrawLayerFlags, mSpecialFlag, MapType::SPECIAL, MapType::SPECIAL2, and MapType::SPECIAL4.
|
inline |
|
inline |
|
inline |
Set tile image with x + y * width already known.
Definition at line 88 of file maplayer.h.
References TileInfo::image, and mTiles.
|
inline |
|
protected |
Definition at line 790 of file maplayer.cpp.
References TileInfo::count, TileInfo::image, TileInfo::isEnabled, TileInfo::nextTile, TileInfo::width, x, and y.
|
protected |
Definition at line 762 of file maplayer.cpp.
References MetaTile::blockmask, BlockMask::GROUND, x, and y.
void MapLayer::updateOGL | ( | Graphics *const | graphics, |
int | startX, | ||
int | startY, | ||
int | endX, | ||
int | endY, | ||
const int | scrollX, | ||
const int | scrollY | ||
) |
Definition at line 265 of file maplayer.cpp.
References BLOCK_END, BLOCK_START, CAST_SIZE, delete_all(), FOR_EACH, ImageVertexes::image, MapRowVertexes::images, TileInfo::isEnabled, mapTileSize, ImageVertexes::ogl, x, and y.
void MapLayer::updateSDL | ( | const Graphics *const | graphics, |
int | startX, | ||
int | startY, | ||
int | endX, | ||
int | endY, | ||
const int | scrollX, | ||
const int | scrollY | ||
) |
Definition at line 200 of file maplayer.cpp.
References BLOCK_END, BLOCK_START, CAST_SIZE, delete_all(), ImageVertexes::image, MapRowVertexes::images, TileInfo::isEnabled, mapTileSize, x, and y.
|
friend |
Definition at line 52 of file maplayer.h.
|
private |
Definition at line 236 of file maplayer.h.
Referenced by setActorsFix().
|
private |
Definition at line 228 of file maplayer.h.
Referenced by setDrawLayerFlags().
|
private |
Definition at line 226 of file maplayer.h.
Referenced by calcMemoryLocal(), and getHeight().
|
private |
Definition at line 238 of file maplayer.h.
|
private |
Whether the actors are drawn.
Definition at line 237 of file maplayer.h.
Referenced by isFringeLayer().
|
private |
Definition at line 234 of file maplayer.h.
Referenced by Map::updateDrawLayersList().
|
private |
Definition at line 231 of file maplayer.h.
Referenced by getCounterName().
|
private |
Definition at line 223 of file maplayer.h.
|
private |
Definition at line 224 of file maplayer.h.
|
private |
Definition at line 239 of file maplayer.h.
Referenced by setDrawLayerFlags().
|
private |
Definition at line 229 of file maplayer.h.
Referenced by calcMemoryChilds(), and setSpecialLayer().
|
private |
Definition at line 230 of file maplayer.h.
Referenced by calcMemoryChilds(), and setTempLayer().
|
private |
Definition at line 233 of file maplayer.h.
Referenced by calcMemoryLocal(), and ~MapLayer().
|
private |
Definition at line 235 of file maplayer.h.
|
private |
Definition at line 227 of file maplayer.h.
Referenced by setTile(), and ~MapLayer().
|
private |
Definition at line 225 of file maplayer.h.
Referenced by calcMemoryLocal(), getWidth(), and setTile().
|
private |
Definition at line 221 of file maplayer.h.
|
private |
Definition at line 222 of file maplayer.h.