ManaPlus
Data Structures | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
Map Class Reference

#include <map.h>

Inheritance diagram for Map:
Properties ConfigListener MemoryCounter

Data Structures

struct  ParticleEffectData
 

Public Member Functions

 Map (const std::string &name, const int width, const int height, const int tileWidth, const int tileHeight)
 
 ~Map ()
 
void initializeAmbientLayers ()
 
void update (const int ticks)
 
void draw (Graphics *const graphics, int scrollX, int scrollY)
 
void drawCollision (Graphics *const graphics, const int scrollX, const int scrollY, const MapTypeT drawFlags) const
 
void addLayer (MapLayer *const layer)
 
void addTileset (Tileset *const tileset)
 
const TilesetgetTilesetWithGid (const int gid) const
 
const MetaTilegetMetaTile (const int x, const int y) const
 
void addBlockMask (const int x, const int y, const BlockTypeT type)
 
void setBlockMask (const int x, const int y, const BlockTypeT type)
 
bool getWalk (const int x, const int y, const unsigned char blockWalkMask) const
 
void setWalk (const int x, const int y)
 
unsigned char getBlockMask (const int x, const int y) const
 
int getWidth () const
 
int getHeight () const
 
int getTileWidth () const
 
int getTileHeight () const
 
const std::string getMusicFile () const
 
void setMusicFile (const std::string &file)
 
const std::string getName () const
 
const std::string getFilename () const
 
const std::string getGatName () const
 
Path findPath (const int startX, const int startY, const int destX, const int destY, const unsigned char blockWalkmask, const int maxCost)
 
void addParticleEffect (const std::string &effectFile, const int x, const int y, const int w, const int h)
 
void initializeParticleEffects () const
 
void addAnimation (const int gid, TileAnimation *const animation)
 
void setDrawLayersFlags (const MapTypeT &n)
 
MapTypeT getDrawLayersFlags () const
 
void addExtraLayer ()
 
void saveExtraLayer () const
 
SpecialLayergetTempLayer () const
 
SpecialLayergetSpecialLayer () const
 
void setHasWarps (const bool n)
 
bool getHasWarps () const
 
std::string getUserMapDirectory () const
 
void addPortal (const std::string &name, const int type, const int x, const int y, const int dx, const int dy)
 
void addRange (const std::string &name, const int type, const int x, const int y, const int dx, const int dy)
 
void addPortalTile (const std::string &name, const int type, const int x, const int y)
 
void updatePortalTile (const std::string &name, const int type, const int x, const int y, const bool addNew)
 
const std::vector< MapItem * > & getPortals () const
 
const TileAnimationgetAnimationForGid (const int gid) const
 
void optionChanged (const std::string &value)
 
MapItemfindPortalXY (const int x, const int y) const
 
int getActorsCount () const
 
void setPvpMode (const int mode)
 
int getPvpMode () const
 
const ObjectsLayergetObjectsLayer () const
 
std::string getObjectData (const unsigned x, const unsigned y, const int type) const
 
void indexTilesets ()
 
void clearIndexedTilesets ()
 
void setActorsFix (const int x, const int y)
 
int getVersion () const
 
void setVersion (const int n)
 
void reduce ()
 
void redrawMap ()
 
bool empty () const
 
void setCustom (const bool b)
 
bool isCustom () const
 
const std::map< int, TileAnimation * > & getTileAnimations () const
 
int getAtlasCount () const
 
void setAtlas (AtlasResource *const atlas)
 
bool haveAtlas () const
 
const MetaTilegetMetaTiles () const
 
const WalkLayergetWalkLayer () const
 
void setWalkLayer (WalkLayer *const layer)
 
void addHeights (const MapHeights *const heights)
 
uint8_t getHeightOffset (const int x, const int y) const
 
void setMask (const int mask)
 
void updateDrawLayersList ()
 
bool isHeightsPresent () const
 
void updateConditionLayers ()
 
void preCacheLayers ()
 
int calcMemoryLocal () const
 
int calcMemoryChilds (const int level) const
 
std::string getCounterName () const
 
void screenResized ()
 
- Public Member Functions inherited from Properties
 Properties ()
 
virtual ~Properties ()
 
const std::string getProperty (const std::string &name, const std::string &def) const
 
float getFloatProperty (const std::string &name, const float def) const
 
bool getBoolProperty (const std::string &name, const bool def) const
 
bool hasProperty (const std::string &name) const
 
void setProperty (const std::string &name, const std::string &value)
 
- Public Member Functions inherited from ConfigListener
 ConfigListener ()
 
virtual ~ConfigListener ()
 
- Public Member Functions inherited from MemoryCounter
 MemoryCounter ()
 
virtual ~MemoryCounter ()
 
int calcMemory (const int level) const
 

Protected Member Functions

Actors::iterator addActor (Actor *const actor)
 
void removeActor (const Actors::iterator &iterator)
 

Private Member Functions

void updateAmbientLayers (const float scrollX, const float scrollY)
 
void drawAmbientLayers (Graphics *const graphics, const MapLayerPositionT type, const int detail) const
 
bool contains (const int x, const int y) const
 

Private Attributes

const int mWidth
 
const int mHeight
 
const int mTileWidth
 
const int mTileHeight
 
int mMaxTileHeight
 
MetaTile *const mMetaTiles
 
WalkLayermWalkLayer
 
Layers mLayers
 
Layers mDrawUnderLayers
 
Layers mDrawOverLayers
 
Tilesets mTilesets
 
Actors mActors
 
bool mHasWarps
 
MapTypeT mDrawLayersFlags
 
unsigned int mOnClosedList
 
unsigned int mOnOpenList
 
AmbientLayerVector mBackgrounds
 
AmbientLayerVector mForegrounds
 
float mLastAScrollX
 
float mLastAScrollY
 
std::vector< ParticleEffectDatamParticleEffects
 
std::vector< MapItem * > mMapPortals
 
std::map< int, TileAnimation * > mTileAnimations
 
std::string mName
 
int mOverlayDetail
 
float mOpacity
 
const RenderType mOpenGL
 
int mPvp
 
bool mTilesetsIndexed
 
Tileset ** mIndexedTilesets
 
int mIndexedTilesetsSize
 
int mActorFixX
 
int mActorFixY
 
int mVersion
 
SpecialLayermSpecialLayer
 
SpecialLayermTempLayer
 
ObjectsLayermObjects
 
MapLayermFringeLayer
 
int mLastX
 
int mLastY
 
int mLastScrollX
 
int mLastScrollY
 
int mDrawX
 
int mDrawY
 
int mDrawScrollX
 
int mDrawScrollY
 
int mMask
 
AtlasResourcemAtlas
 
const MapHeightsmHeights
 
bool mRedrawMap
 
bool mBeingOpacity
 
bool mCachedDraw
 
bool mCustom
 
bool mDrawOnlyFringe
 
bool mClear
 

Friends

class Actor
 
class Minimap
 

Detailed Description

A tile map.

Definition at line 71 of file map.h.

Constructor & Destructor Documentation

◆ Map()

Map::Map ( const std::string &  name,
const int  width,
const int  height,
const int  tileWidth,
const int  tileHeight 
)

Constructor, taking map and tile size as parameters.

Definition at line 96 of file map.cpp.

100  :
101  Properties(),
102  mWidth(width), mHeight(height),
103  mTileWidth(tileWidth), mTileHeight(tileHeight),
104  mMaxTileHeight(height),
106  mWalkLayer(nullptr),
107  mLayers(),
109  mDrawOverLayers(),
110  mTilesets(),
111  mActors(),
112  mHasWarps(false),
114  mOnClosedList(1),
115  mOnOpenList(2),
116  mBackgrounds(),
117  mForegrounds(),
118  mLastAScrollX(0.0F),
119  mLastAScrollY(0.0F),
121  mMapPortals(),
122  mTileAnimations(),
123  mName(name),
124  mOverlayDetail(config.getIntValue("OverlayDetail")),
125  mOpacity(config.getFloatValue("guialpha")),
126 #ifdef USE_OPENGL
128 #else // USE_OPENGL
130 #endif // USE_OPENGL
131  mPvp(0),
132  mTilesetsIndexed(false),
133  mIndexedTilesets(nullptr),
135  mActorFixX(0),
136  mActorFixY(0),
137  mVersion(0),
138  mSpecialLayer(new SpecialLayer("special layer", width, height)),
139  mTempLayer(new SpecialLayer("temp layer", width, height)),
140  mObjects(new ObjectsLayer(width, height)),
141  mFringeLayer(nullptr),
142  mLastX(-1),
143  mLastY(-1),
144  mLastScrollX(-1),
145  mLastScrollY(-1),
146  mDrawX(-1),
147  mDrawY(-1),
148  mDrawScrollX(-1),
149  mDrawScrollY(-1),
150  mMask(1),
151 #ifdef USE_OPENGL
152  mAtlas(nullptr),
153 #endif // USE_OPENGL
154  mHeights(nullptr),
155  mRedrawMap(true),
156  mBeingOpacity(false),
157 #ifdef USE_OPENGL
162 #else // USE_OPENGL
163  mCachedDraw(false),
164 #endif // USE_OPENGL
165  mCustom(false),
166  mDrawOnlyFringe(false),
167  mClear(false)
168 {
169  config.addListener("OverlayDetail", this);
170  config.addListener("guialpha", this);
171  config.addListener("beingopacity", this);
172 
173  if (mOpacity != 1.0F)
174  mBeingOpacity = config.getBoolValue("beingopacity");
175  else
176  mBeingOpacity = false;
177 }

References Configuration::addListener(), config, Configuration::getBoolValue(), mBeingOpacity, and mOpacity.

Referenced by calcMemoryLocal().

◆ ~Map()

Map::~Map ( )

Destructor.

Definition at line 179 of file map.cpp.

180 {
181  config.removeListeners(this);
183 
184  if (mWalkLayer != nullptr)
185  {
186  mWalkLayer->decRef();
187  mWalkLayer = nullptr;
188  }
189  mFringeLayer = nullptr;
199 #ifdef USE_OPENGL
200  if (mAtlas != nullptr)
201  {
202  mAtlas->decRef();
203  mAtlas = nullptr;
204  }
205 #endif // USE_OPENGL
207  delete [] mMetaTiles;
208 }

References CHECKLISTENERS, config, AtlasResource::decRef(), Resource::decRef(), delete2, delete_all(), mAtlas, mBackgrounds, mForegrounds, mFringeLayer, mHeights, mLayers, mMapPortals, mMetaTiles, mObjects, mSpecialLayer, mTempLayer, mTileAnimations, mTilesets, mWalkLayer, and Configuration::removeListeners().

Member Function Documentation

◆ addActor()

Actors::iterator Map::addActor ( Actor *const  actor)
protected

Adds an actor to the map.

Definition at line 821 of file map.cpp.

822 {
823  mActors.push_front(actor);
824 // mSpritesUpdated = true;
825  return mActors.begin();
826 }

Referenced by Actor::setMap().

◆ addAnimation()

void Map::addAnimation ( const int  gid,
TileAnimation *const  animation 
)

Adds a tile animation to the map

Definition at line 1690 of file map.cpp.

1692 {
1693  std::map<int, TileAnimation*>::iterator it = mTileAnimations.find(gid);
1694  if (it != mTileAnimations.end())
1695  {
1696  logger->log("duplicate map animation with gid = %d", gid);
1697  delete (*it).second;
1698  }
1699  mTileAnimations[gid] = animation;
1700 }

References Logger::log(), and logger.

Referenced by MapReader::readTileset().

◆ addBlockMask()

void Map::addBlockMask ( const int  x,
const int  y,
const BlockTypeT  type 
)

Definition at line 706 of file map.cpp.

708 {
709  if (type == BlockType::NONE || !contains(x, y))
710  return;
711 
712  const int tileNum = x + y * mWidth;
713 
714  switch (type)
715  {
716  case BlockType::WALL:
718  break;
719  case BlockType::AIR:
720  mMetaTiles[tileNum].blockmask |= BlockMask::AIR;
721  break;
722  case BlockType::WATER:
724  break;
725  case BlockType::GROUND:
727  break;
730  break;
733  break;
736  break;
737  default:
738  case BlockType::NONE:
740  // Do nothing.
741  break;
742  }
743 }

References BlockMask::AIR, BlockType::AIR, Catch::contains(), BlockType::GROUND, BlockMask::GROUND, BlockMask::GROUNDTOP, BlockType::GROUNDTOP, BlockType::MONSTERWALL, BlockMask::MONSTERWALL, BlockType::NB_BLOCKTYPES, BlockType::NONE, BlockMask::PLAYERWALL, BlockType::PLAYERWALL, BlockMask::WALL, BlockType::WALL, BlockMask::WATER, BlockType::WATER, x, and y.

Referenced by setTile().

◆ addExtraLayer()

void Map::addExtraLayer ( )

Definition at line 1141 of file map.cpp.

1142 {
1143  BLOCK_START("Map::addExtraLayer")
1144  if (mSpecialLayer == nullptr)
1145  {
1146  logger->log1("No special layer");
1147  BLOCK_END("Map::addExtraLayer")
1148  return;
1149  }
1150  const std::string mapFileName = pathJoin(getUserMapDirectory(),
1151  "extralayer.txt");
1152  logger->log("loading extra layer: " + mapFileName);
1153  struct stat statbuf;
1154  if (stat(mapFileName.c_str(), &statbuf) == 0 &&
1155  S_ISREG(statbuf.st_mode))
1156  {
1157  std::ifstream mapFile;
1158  mapFile.open(mapFileName.c_str(), std::ios::in);
1159  if (!mapFile.is_open())
1160  {
1161  mapFile.close();
1162  BLOCK_END("Map::addExtraLayer")
1163  return;
1164  }
1165  char line[201];
1166 
1167  while (mapFile.getline(line, 200))
1168  {
1169  std::string buf;
1170  std::string str = line;
1171  if (!str.empty())
1172  {
1173  std::string x;
1174  std::string y;
1175  std::string type1;
1176  std::string comment;
1177  std::stringstream ss(str);
1178  ss >> x;
1179  ss >> y;
1180  ss >> type1;
1181  ss >> comment;
1182  while (ss >> buf)
1183  comment.append(" ").append(buf);
1184 
1185  const int type = atoi(type1.c_str());
1186 
1187  if (comment.empty())
1188  {
1189  if (type < MapItemType::ARROW_UP
1190  || type > MapItemType::ARROW_RIGHT)
1191  {
1192  comment = "unknown";
1193  }
1194  }
1195  if (type == MapItemType::PORTAL)
1196  {
1197  updatePortalTile(comment,
1198  type,
1199  atoi(x.c_str()),
1200  atoi(y.c_str()),
1201  false);
1202  }
1203  else if (type == MapItemType::HOME)
1204  {
1205  updatePortalTile(comment,
1206  type,
1207  atoi(x.c_str()),
1208  atoi(y.c_str()),
1209  true);
1210  }
1211  else
1212  {
1213  addPortalTile(comment,
1214  type,
1215  atoi(x.c_str()),
1216  atoi(y.c_str()));
1217  }
1218  }
1219  }
1220  mapFile.close();
1221  }
1222  BLOCK_END("Map::addExtraLayer")
1223 }

References addPortalTile(), MapItemType::ARROW_RIGHT, MapItemType::ARROW_UP, BLOCK_END, BLOCK_START, getUserMapDirectory(), MapItemType::HOME, Logger::log(), Logger::log1(), logger, mSpecialLayer, pathJoin(), MapItemType::PORTAL, updatePortalTile(), x, and y.

Referenced by Game::changeMap().

◆ addHeights()

void Map::addHeights ( const MapHeights *const  heights)

Definition at line 1624 of file map.cpp.

1625 {
1626  delete mHeights;
1627  mHeights = heights;
1628 }

Referenced by MapReader::readLayer().

◆ addLayer()

void Map::addLayer ( MapLayer *const  layer)

Adds a layer to this map. The map takes ownership of the layer.

Definition at line 312 of file map.cpp.

313 {
314  mLayers.push_back(layer);
315  if (layer->isFringeLayer() && (mFringeLayer == nullptr))
316  mFringeLayer = layer;
317 }

Referenced by MapReader::createEmptyMap(), and MapReader::readLayer().

◆ addParticleEffect()

void Map::addParticleEffect ( const std::string &  effectFile,
const int  x,
const int  y,
const int  w,
const int  h 
)

Adds a particle effect

Definition at line 1100 of file map.cpp.

1103 {
1104  ParticleEffectData newEffect(effectFile, x, y, w, h);
1105  mParticleEffects.push_back(newEffect);
1106 }

References x, and y.

◆ addPortal()

void Map::addPortal ( const std::string &  name,
const int  type,
const int  x,
const int  y,
const int  dx,
const int  dy 
)

Definition at line 1290 of file map.cpp.

1294 {
1295  addPortalTile(name, type, (x / mapTileSize) + (dx / mapTileSize / 2),
1296  (y / mapTileSize) + (dy / mapTileSize / 2));
1297 }

References mapTileSize, x, and y.

◆ addPortalTile()

void Map::addPortalTile ( const std::string &  name,
const int  type,
const int  x,
const int  y 
)

Definition at line 1299 of file map.cpp.

1302 {
1303  if (mSpecialLayer != nullptr)
1304  {
1305  mSpecialLayer->setTile(x, y, new MapItem(type, name, x, y));
1307  }
1308 
1309  mMapPortals.push_back(new MapItem(type, name, x, y));
1310 }

References x, and y.

Referenced by addExtraLayer(), Ea::BeingRecv::processNameResponse(), EAthena::BeingRecv::processNameResponseTitle(), and LocalPlayer::updateNavigateList().

◆ addRange()

void Map::addRange ( const std::string &  name,
const int  type,
const int  x,
const int  y,
const int  dx,
const int  dy 
)

Definition at line 1278 of file map.cpp.

1282 {
1283  if (mObjects == nullptr)
1284  return;
1285 
1286  mObjects->addObject(name, type, x / mapTileSize, y / mapTileSize,
1287  dx / mapTileSize, dy / mapTileSize);
1288 }

References mapTileSize, x, and y.

◆ addTileset()

void Map::addTileset ( Tileset *const  tileset)

Adds a tileset to this map. The map takes ownership of the tileset.

Definition at line 319 of file map.cpp.

320 {
321  mTilesets.push_back(tileset);
322  const int height = tileset->getHeight();
323  if (height > mMaxTileHeight)
324  mMaxTileHeight = height;
325 }

◆ calcMemoryChilds()

int Map::calcMemoryChilds ( const int  level) const
virtual

Reimplemented from MemoryCounter.

Definition at line 1773 of file map.cpp.

1774 {
1775  int sz = 0;
1776 
1777  if (mWalkLayer != nullptr)
1778  sz += mWalkLayer->calcMemory(level + 1);
1780  {
1781  sz += (*it)->calcMemory(level + 1);
1782  }
1783  FOR_EACH (Tilesets::const_iterator, it, mTilesets)
1784  {
1785  sz += (*it)->calcMemory(level + 1);
1786  }
1788  {
1789  sz += (*it)->calcMemory(level + 1);
1790  }
1792  {
1793  sz += (*it)->calcMemory(level + 1);
1794  }
1795  if (mSpecialLayer != nullptr)
1796  mSpecialLayer->calcMemory(level + 1);
1797  if (mTempLayer != nullptr)
1798  mTempLayer->calcMemory(level + 1);
1799  if (mObjects != nullptr)
1800  mObjects->calcMemory(level + 1);
1801  if (mHeights != nullptr)
1802  mHeights->calcMemory(level + 1);
1803  return sz;
1804 }

References MemoryCounter::calcMemory(), FOR_EACH, mBackgrounds, mForegrounds, mHeights, mLayers, mObjects, mSpecialLayer, mTempLayer, mTilesets, and mWalkLayer.

◆ calcMemoryLocal()

int Map::calcMemoryLocal ( ) const
virtual

Reimplemented from MemoryCounter.

Definition at line 1755 of file map.cpp.

1756 {
1757  return static_cast<int>(sizeof(Map) +
1758  mName.capacity() +
1759  sizeof(MetaTile) * mWidth * mHeight +
1760  sizeof(MapLayer*) * (mLayers.capacity() +
1761  mDrawUnderLayers.capacity() +
1762  mDrawOverLayers.capacity()) +
1763  sizeof(Tileset*) * mTilesets.capacity() +
1764  sizeof(Actor*) * mActors.size() +
1765  sizeof(AmbientLayer*) * (mBackgrounds.capacity()
1766  + mForegrounds.capacity()) +
1767  sizeof(ParticleEffectData) * mParticleEffects.capacity() +
1768  sizeof(MapItem) * mMapPortals.capacity() +
1769  (sizeof(TileAnimation) + sizeof(int)) * mTileAnimations.size() +
1770  sizeof(Tileset*) * mIndexedTilesetsSize);
1771 }

References mActors, Map(), mBackgrounds, mDrawOverLayers, mDrawUnderLayers, mForegrounds, mHeight, mIndexedTilesetsSize, mLayers, mMapPortals, mName, mParticleEffects, mTileAnimations, mTilesets, and mWidth.

◆ clearIndexedTilesets()

void Map::clearIndexedTilesets ( )

Definition at line 1462 of file map.cpp.

1463 {
1464  if (!mTilesetsIndexed)
1465  return;
1466 
1467  mTilesetsIndexed = false;
1468  delete [] mIndexedTilesets;
1470 }

References mIndexedTilesets, mIndexedTilesetsSize, and mTilesetsIndexed.

◆ contains()

bool Map::contains ( const int  x,
const int  y 
) const
private

Tells whether the given coordinates fall within the map boundaries.

Definition at line 811 of file map.cpp.

812 {
813  return x >= 0 && y >= 0 && x < mWidth && y < mHeight;
814 }

References x, and y.

◆ draw()

void Map::draw ( Graphics *const  graphics,
int  scrollX,
int  scrollY 
)

Draws the map to the given graphics output. This method draws all layers, actors and overlay effects.

Definition at line 338 of file map.cpp.

340 {
341  if (localPlayer == nullptr)
342  return;
343 
344  if (mClear)
346 
347  BLOCK_START("Map::draw")
348  // Calculate range of tiles which are on-screen
349  const int endPixelY = graphics->mHeight + scrollY + mTileHeight - 1
351  const int startX = scrollX / mTileWidth - 2;
352  const int startY = scrollY / mTileHeight;
353  const int endX = (graphics->mWidth + scrollX + mTileWidth - 1)
354  / mTileWidth + 1;
355  const int endY = endPixelY / mTileHeight + 1;
356 
357  // Make sure actors are sorted ascending by Y-coordinate
358  // so that they overlap correctly
359  BLOCK_START("Map::draw sort")
360  mActors.sort(actorCompare);
361  BLOCK_END("Map::draw sort")
362 
363  // update scrolling of all ambient layers
364  updateAmbientLayers(static_cast<float>(scrollX),
365  static_cast<float>(scrollY));
366 
367  // Draw backgrounds
368  drawAmbientLayers(graphics,
371 
372  if (mDrawLayersFlags == MapType::BLACKWHITE && (userPalette != nullptr))
373  {
374  graphics->setColor(userPalette->getColorWithAlpha(
376 
377  graphics->fillRectangle(Rect(0, 0,
378  graphics->mWidth, graphics->mHeight));
379  }
380 
381 #ifdef USE_OPENGL
382  int updateFlag = 0;
383 
384  if (mCachedDraw)
385  {
386  if (mLastX != startX || mLastY != startY || mLastScrollX != scrollX
387  || mLastScrollY != scrollY)
388  { // player moving
389  mLastX = startX;
390  mLastY = startY;
391  mLastScrollX = scrollX;
392  mLastScrollY = scrollY;
393  updateFlag = 2;
394  }
395  else if (mRedrawMap || startX != mDrawX || startY != mDrawY ||
396  scrollX != mDrawScrollX || scrollY != mDrawScrollY)
397  { // player mode to new position
398  mRedrawMap = false;
399  mDrawX = startX;
400  mDrawY = startY;
401  mDrawScrollX = scrollX;
402  mDrawScrollY = scrollY;
403  updateFlag = 1;
404  }
405  }
406 #endif // USE_OPENGL
407 
408  if (mDrawOnlyFringe)
409  {
410  if (mFringeLayer != nullptr)
411  {
414  mFringeLayer->drawFringe(graphics,
415  startX, startY,
416  endX, endY,
417  scrollX, scrollY,
418  mActors);
419  }
420  }
421  else
422  {
423 #ifdef USE_OPENGL
424  if (mCachedDraw)
425  {
426  if (updateFlag != 0)
427  {
428  FOR_EACH (Layers::iterator, it, mDrawUnderLayers)
429  {
430  (*it)->updateOGL(graphics,
431  startX, startY,
432  endX, endY,
433  scrollX, scrollY);
434  }
435  FOR_EACH (Layers::iterator, it, mDrawOverLayers)
436  {
437  (*it)->updateOGL(graphics,
438  startX, startY,
439  endX, endY,
440  scrollX, scrollY);
441  }
442  }
443 
444  FOR_EACH (Layers::iterator, it, mDrawUnderLayers)
445  (*it)->drawOGL(graphics);
446 
447  if (mFringeLayer != nullptr)
448  {
451  mFringeLayer->drawFringe(graphics,
452  startX, startY,
453  endX, endY,
454  scrollX, scrollY,
455  mActors);
456  }
457 
458  FOR_EACH (Layers::iterator, it, mDrawOverLayers)
459  (*it)->drawOGL(graphics);
460  }
461  else
462 #endif // USE_OPENGL
463  {
464  FOR_EACH (Layers::iterator, it, mDrawUnderLayers)
465  {
466  (*it)->draw(graphics,
467  startX, startY,
468  endX, endY,
469  scrollX, scrollY);
470  }
471 
472  if (mFringeLayer != nullptr)
473  {
476  mFringeLayer->drawFringe(graphics,
477  startX, startY,
478  endX, endY,
479  scrollX, scrollY,
480  mActors);
481  }
482 
483  FOR_EACH (Layers::iterator, it, mDrawOverLayers)
484  {
485  (*it)->draw(graphics, startX, startY,
486  endX, endY,
487  scrollX, scrollY);
488  }
489  }
490  }
491 
492  // Don't draw if gui opacity == 1
493  if (mBeingOpacity)
494  {
495  // Draws beings with a lower opacity to make them visible
496  // even when covered by a wall or some other elements...
497  ActorsCIter ai = mActors.begin();
498  const ActorsCIter ai_end = mActors.end();
499 
500  if (mOpenGL == RENDER_SOFTWARE)
501  {
502  while (ai != ai_end)
503  {
504  if (Actor *restrict const actor = *ai)
505  {
506  const int x = actor->getTileX();
507  const int y = actor->getTileY();
508  if (x < startX || x > endX || y < startY || y > endY)
509  {
510  ++ai;
511  continue;
512  }
513  // For now, just draw actors with only one layer.
514  if (actor->getNumberOfLayers() == 1)
515  {
516  actor->setAlpha(0.3F);
517  actor->draw(graphics, -scrollX, -scrollY);
518  actor->setAlpha(1.0F);
519  }
520  }
521  ++ai;
522  }
523  }
524  else
525  {
526  while (ai != ai_end)
527  {
528  if (Actor *const actor = *ai)
529  {
530  actor->setAlpha(0.3F);
531  actor->draw(graphics, -scrollX, -scrollY);
532  actor->setAlpha(1.0F);
533  }
534  ++ai;
535  }
536  }
537  }
538 
539  drawAmbientLayers(graphics,
542  BLOCK_END("Map::draw")
543 }

References actorCompare, MapLayerPosition::BACKGROUND_LAYERS, MapType::BLACKWHITE, BLOCK_END, BLOCK_START, Graphics::clearScreen(), FOR_EACH, MapLayerPosition::FOREGROUND_LAYERS, UserPalette::getColorWithAlpha(), localPlayer, mainGraphics, RENDER_SOFTWARE, restrict, userPalette, UserColorId::WALKABLE_HIGHLIGHT, x, and y.

◆ drawAmbientLayers()

void Map::drawAmbientLayers ( Graphics *const  graphics,
const MapLayerPositionT  type,
const int  detail 
) const
private

Draws the foreground or background layers to the given graphics output.

Definition at line 658 of file map.cpp.

661 {
662  BLOCK_START("Map::drawAmbientLayers")
663  // Detail 0 = no ambient effects except background image
664  if (detail <= 0 && type != MapLayerPosition::BACKGROUND_LAYERS)
665  {
666  BLOCK_END("Map::drawAmbientLayers")
667  return;
668  }
669 
670  // find out which layer list to draw
671  const AmbientLayerVector *restrict layers = nullptr;
672  switch (type)
673  {
675  layers = &mForegrounds;
676  break;
678  layers = &mBackgrounds;
679  break;
680  default:
681  return;
682  }
683 
684  // Draw overlays
686  {
687  const AmbientLayer *restrict const layer = *i;
688  // need check mask to draw or not to draw
689  if ((layer != nullptr) && ((layer->mMask & mMask) != 0))
690  (layer)->draw(graphics, graphics->mWidth, graphics->mHeight);
691 
692  // Detail 1: only one overlay, higher: all overlays
693  if (detail == 1)
694  break;
695  }
696  BLOCK_END("Map::drawAmbientLayers")
697 }

References MapLayerPosition::BACKGROUND_LAYERS, BLOCK_END, BLOCK_START, FOR_EACHP, MapLayerPosition::FOREGROUND_LAYERS, and restrict.

◆ drawCollision()

void Map::drawCollision ( Graphics *const  graphics,
const int  scrollX,
const int  scrollY,
const MapTypeT  drawFlags 
) const

Visualizes collision layer for debugging

Definition at line 568 of file map.cpp.

572 {
573  const int endPixelY = graphics->mHeight + scrollY + mTileHeight - 1;
574  int startX = scrollX / mTileWidth;
575  int startY = scrollY / mTileHeight;
576  int endX = (graphics->mWidth + scrollX + mTileWidth - 1) / mTileWidth;
577  int endY = endPixelY / mTileHeight;
578 
579  if (startX < 0)
580  startX = 0;
581  if (startY < 0)
582  startY = 0;
583  if (endX > mWidth)
584  endX = mWidth;
585  if (endY > mHeight)
586  endY = mHeight;
587 
588  if (drawFlags < MapType::SPECIAL)
589  {
591  graphics->drawNet(
592  startX * mTileWidth - scrollX,
593  startY * mTileHeight - scrollY,
594  endX * mTileWidth - scrollX,
595  endY * mTileHeight - scrollY,
597  }
598 
599  for (int y = startY; y < endY; y++)
600  {
601  const int yWidth = y * mWidth;
602  int tilePtr = startX + yWidth;
603  for (int x = startX; x < endX; x++, tilePtr++)
604  {
605  int width = 0;
606  const int x0 = x;
607 
614  }
615  }
616 }

References BlockMask::AIR, UserColorId::AIR_COLLISION_HIGHLIGHT, UserColorId::COLLISION_HIGHLIGHT, fillCollision, UserPalette::getColorWithAlpha(), BlockMask::GROUNDTOP, UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT, mapTileSize, UserColorId::MONSTER_COLLISION_HIGHLIGHT, BlockMask::MONSTERWALL, UserColorId::NET, BlockMask::PLAYERWALL, MapType::SPECIAL, userPalette, BlockMask::WALL, BlockMask::WATER, UserColorId::WATER_COLLISION_HIGHLIGHT, x, and y.

◆ empty()

bool Map::empty ( ) const
inline

Definition at line 320 of file map.h.

321  { return mLayers.empty(); }

References mLayers.

Referenced by SocialNavigationTab::updateList().

◆ findPath()

Path Map::findPath ( const int  startX,
const int  startY,
const int  destX,
const int  destY,
const unsigned char  blockWalkmask,
const int  maxCost 
)

Find a path from one location to the next.

Definition at line 862 of file map.cpp.

866 {
867  BLOCK_START("Map::findPath")
868  // The basic walking cost of a tile.
869  static const int basicCost = 100;
870  const int basicCost2 = 100 * 362 / 256;
871  const float basicCostF = 100.0 * 362 / 256;
872 
873  // Path to be built up (empty by default)
874  Path path;
875 
876  if (startX >= mWidth || startY >= mHeight || startX < 0 || startY < 0)
877  {
878  BLOCK_END("Map::findPath")
879  return path;
880  }
881 
882  // Return when destination not walkable
883  if (!getWalk(destX, destY, blockWalkMask))
884  {
885  BLOCK_END("Map::findPath")
886  return path;
887  }
888 
889  // Reset starting tile's G cost to 0
890  MetaTile *const startTile = &mMetaTiles[startX + startY * mWidth];
891  if (startTile == nullptr)
892  {
893  BLOCK_END("Map::findPath")
894  return path;
895  }
896 
897  startTile->Gcost = 0;
898 
899  // Declare open list, a list with open tiles sorted on F cost
900  std::priority_queue<Location> openList;
901 
902  // Add the start point to the open list
903  openList.push(Location(startX, startY, startTile));
904 
905  bool foundPath = false;
906 
907  // Keep trying new open tiles until no more tiles to try or target found
908  while (!openList.empty() && !foundPath)
909  {
910  // Take the location with the lowest F cost from the open list.
911  const Location curr = openList.top();
912  openList.pop();
913 
914  const MetaTile *const tile = curr.tile;
915 
916  // If the tile is already on the closed list, this means it has already
917  // been processed with a shorter path to the start point (lower G cost)
918  if (tile->whichList == mOnClosedList)
919  continue;
920 
921  // Put the current tile on the closed list
922  curr.tile->whichList = mOnClosedList;
923 
924  const int curWidth = curr.y * mWidth;
925  const int tileGcost = tile->Gcost;
926 
927  // Check the adjacent tiles
928  for (int dy = -1; dy <= 1; dy++)
929  {
930  const int y = curr.y + dy;
931  if (y < 0 || y >= mHeight)
932  continue;
933 
934  const int yWidth = y * mWidth;
935  const int dy1 = std::abs(y - destY);
936 
937  for (int dx = -1; dx <= 1; dx++)
938  {
939  // Calculate location of tile to check
940  const int x = curr.x + dx;
941 
942  // Skip if if we're checking the same tile we're leaving from,
943  // or if the new location falls outside of the map boundaries
944  if ((dx == 0 && dy == 0) || x < 0 || x >= mWidth)
945  continue;
946 
947  MetaTile *const newTile = &mMetaTiles[x + yWidth];
948 
949  // Skip if the tile is on the closed list or is not walkable
950  // unless its the destination tile
951  // +++ probably here "newTile->blockmask & BlockMask::WALL"
952  // can be removed. It left here only for protect from
953  // walk on wall in any case
954  if (newTile->whichList == mOnClosedList ||
955  (((newTile->blockmask & blockWalkMask) != 0)
956  && !(x == destX && y == destY))
957  || ((newTile->blockmask & BlockMask::WALL) != 0))
958  {
959  continue;
960  }
961 
962  // When taking a diagonal step, verify that we can skip the
963  // corner.
964  if (dx != 0 && dy != 0)
965  {
966  const MetaTile *const t1 = &mMetaTiles[curr.x +
967  (curr.y + dy) * mWidth];
968  const MetaTile *const t2 = &mMetaTiles[curr.x +
969  dx + curWidth];
970 
971  // on player abilities.
972  if (((t1->blockmask | t2->blockmask) & blockWalkMask) != 0)
973  continue;
974  }
975 
976  // Calculate G cost for this route, ~sqrt(2) for moving diagonal
977  int Gcost = tileGcost + (dx == 0 || dy == 0
978  ? basicCost : basicCost2);
979 
980  /* Demote an arbitrary direction to speed pathfinding by
981  adding a defect
982  Important: as long as the total defect along any path is
983  less than the basicCost, the pathfinder will still find one
984  of the shortest paths! */
985  if (dx == 0 || dy == 0)
986  {
987  // Demote horizontal and vertical directions, so that two
988  // consecutive directions cannot have the same Fcost.
989  ++Gcost;
990  }
991 
992 /*
993  // It costs extra to walk through a being (needs to be enough
994  // to make it more attractive to walk around).
995  if (occupied(x, y))
996  {
997  Gcost += 3 * basicCost;
998  }
999 */
1000 
1001  // Skip if Gcost becomes too much
1002  // Warning: probably not entirely accurate
1003  if (maxCost > 0 && Gcost > maxCost * basicCost)
1004  continue;
1005 
1006  if (newTile->whichList != mOnOpenList)
1007  {
1008  // Found a new tile (not on open nor on closed list)
1009 
1010  /* Update Hcost of the new tile. The pathfinder does not
1011  work reliably if the heuristic cost is higher than the
1012  real cost. In particular, using Manhattan distance is
1013  forbidden here. */
1014  const int dx1 = std::abs(x - destX);
1015  newTile->Hcost = std::abs(dx1 - dy1) * basicCost +
1016  CAST_S32(static_cast<float>(std::min(dx1, dy1)) *
1017  (basicCostF));
1018 
1019  // Set the current tile as the parent of the new tile
1020  newTile->parentX = curr.x;
1021  newTile->parentY = curr.y;
1022 
1023  // Update Gcost and Fcost of new tile
1024  newTile->Gcost = Gcost;
1025  newTile->Fcost = Gcost + newTile->Hcost;
1026 
1027  if (x != destX || y != destY)
1028  {
1029  // Add this tile to the open list
1030  newTile->whichList = mOnOpenList;
1031  openList.push(Location(x, y, newTile));
1032  }
1033  else
1034  {
1035  // Target location was found
1036  foundPath = true;
1037  }
1038  }
1039  else if (Gcost < newTile->Gcost)
1040  {
1041  // Found a shorter route.
1042  // Update Gcost and Fcost of the new tile
1043  newTile->Gcost = Gcost;
1044  newTile->Fcost = Gcost + newTile->Hcost;
1045 
1046  // Set the current tile as the parent of the new tile
1047  newTile->parentX = curr.x;
1048  newTile->parentY = curr.y;
1049 
1050  // Add this tile to the open list (it's already
1051  // there, but this instance has a lower F score)
1052  openList.push(Location(x, y, newTile));
1053  }
1054  }
1055  }
1056  }
1057 
1058  // Two new values to indicate whether a tile is on the open or closed list,
1059  // this way we don't have to clear all the values between each pathfinding.
1060  if (mOnOpenList > UINT_MAX - 2)
1061  {
1062  // We reset the list memebers value.
1063  mOnClosedList = 1;
1064  mOnOpenList = 2;
1065 
1066  // Clean up the metaTiles
1067  const int size = mWidth * mHeight;
1068  for (int i = 0; i < size; ++i)
1069  mMetaTiles[i].whichList = 0;
1070  }
1071  else
1072  {
1073  mOnClosedList += 2;
1074  mOnOpenList += 2;
1075  }
1076 
1077  // If a path has been found, iterate backwards using the parent locations
1078  // to extract it.
1079  if (foundPath)
1080  {
1081  int pathX = destX;
1082  int pathY = destY;
1083 
1084  while (pathX != startX || pathY != startY)
1085  {
1086  // Add the new path node to the start of the path list
1087  path.push_front(Position(pathX, pathY));
1088 
1089  // Find out the next parent
1090  const MetaTile *const tile = &mMetaTiles[pathX + pathY * mWidth];
1091  pathX = tile->parentX;
1092  pathY = tile->parentY;
1093  }
1094  }
1095 
1096  BLOCK_END("Map::findPath")
1097  return path;
1098 }

References BLOCK_END, BLOCK_START, MetaTile::blockmask, blockWalkMask, CAST_S32, MetaTile::Fcost, MetaTile::Gcost, MetaTile::Hcost, MetaTile::parentX, MetaTile::parentY, CastType::Position, EmoteDB::size(), Location::tile, BlockMask::WALL, MetaTile::whichList, Location::x, x, Location::y, and y.

Referenced by LocalPlayer::fixAttackTarget(), LocalPlayer::getPathLength(), LocalPlayer::isReachable(), LocalPlayer::moveToTarget(), LocalPlayer::navigateTo(), and LocalPlayer::pickUp().

◆ findPortalXY()

MapItem * Map::findPortalXY ( const int  x,
const int  y 
) const

Definition at line 1337 of file map.cpp.

1338 {
1339  FOR_EACH (STD_VECTOR<MapItem*>::const_iterator, it, mMapPortals)
1340  {
1341  if (*it == nullptr)
1342  continue;
1343 
1344  MapItem *restrict const item = *it;
1345  if (item->mX == x && item->mY == y)
1346  return item;
1347  }
1348  return nullptr;
1349 }

References FOR_EACH, restrict, x, and y.

Referenced by RenameListener::action(), SocialNavigationTab::addPortal(), AvatarListBox::mousePressed(), and SocialNavigationTab::updateNames().

◆ getActorsCount()

int Map::getActorsCount ( ) const
inline

Definition at line 286 of file map.h.

287  { return CAST_S32(mActors.size()); }

References CAST_S32, and mActors.

Referenced by MapDebugTab::logic().

◆ getAnimationForGid()

const TileAnimation * Map::getAnimationForGid ( const int  gid) const

Gets the tile animation for a specific gid

Definition at line 1351 of file map.cpp.

1352 {
1353  if (mTileAnimations.empty())
1354  return nullptr;
1355 
1356  const TileAnimationMapCIter i = mTileAnimations.find(gid);
1357  return (i == mTileAnimations.end()) ? nullptr : i->second;
1358 }

References nullptr.

◆ getAtlasCount()

int Map::getAtlasCount ( ) const

Definition at line 1820 of file map.cpp.

1821 {
1822  if (mAtlas == nullptr)
1823  return 0;
1824  return CAST_S32(mAtlas->atlases.size());
1825 }

References AtlasResource::atlases, CAST_S32, and mAtlas.

Referenced by MapDebugTab::logic().

◆ getBlockMask()

unsigned char Map::getBlockMask ( const int  x,
const int  y 
) const

Definition at line 795 of file map.cpp.

797 {
798  // You can't walk outside of the map
799  if (x < 0 || y < 0 || x >= mWidth || y >= mHeight)
800  return 0;
801 
802  // Check if the tile is walkable
803  return mMetaTiles[x + y * mWidth].blockmask;
804 }

References x, and y.

Referenced by Being::getMoveAction(), Being::getSitAction(), and Being::nextTile().

◆ getCounterName()

std::string Map::getCounterName ( ) const
inlinevirtual

Reimplemented from MemoryCounter.

Definition at line 372 of file map.h.

373  { return mName; }

References mName.

◆ getDrawLayersFlags()

MapTypeT Map::getDrawLayersFlags ( ) const
inline

Definition at line 230 of file map.h.

231  { return mDrawLayersFlags; }

References mDrawLayersFlags.

◆ getFilename()

const std::string Map::getFilename ( ) const

Gives the map id based on filepath (ex: 009-1)

Definition at line 847 of file map.cpp.

848 {
849  const std::string fileName = getProperty("_filename", std::string());
850  const size_t lastSlash = fileName.rfind('/') + 1;
851  return fileName.substr(lastSlash, fileName.rfind('.') - lastSlash);
852 }

References fileName, and Properties::getProperty().

Referenced by Minimap::setMap().

◆ getGatName()

const std::string Map::getGatName ( ) const

Definition at line 854 of file map.cpp.

855 {
856  const std::string fileName = getProperty("_filename", std::string());
857  const size_t lastSlash = rfindSepatator(fileName) + 1;
858  return fileName.substr(lastSlash,
859  fileName.rfind('.') - lastSlash).append(".gat");
860 }

References fileName, Properties::getProperty(), and rfindSepatator().

Referenced by Ea::MapRecv::processSetTilesType().

◆ getHasWarps()

bool Map::getHasWarps ( ) const
inline

Definition at line 246 of file map.h.

247  { return mHasWarps; }

References mHasWarps.

◆ getHeight()

int Map::getHeight ( ) const
inline

Returns the height of this map in tiles.

Definition at line 171 of file map.h.

172  { return mHeight; }

References mHeight.

Referenced by NavigationManager::loadWalkLayer(), Ea::PlayerRecv::processPlayerWarp(), MapReader::readLayer(), Minimap::setMap(), and Viewport::updateMaxVars().

◆ getHeightOffset()

uint8_t Map::getHeightOffset ( const int  x,
const int  y 
) const

Definition at line 1630 of file map.cpp.

1631 {
1632  if (mHeights == nullptr)
1633  return 0;
1634  return mHeights->getHeight(x, y);
1635 }

References x, and y.

Referenced by Viewport::getMouseTile(), Being::nextTile(), and FloorItem::postInit().

◆ getMetaTile()

const MetaTile * Map::getMetaTile ( const int  x,
const int  y 
) const

Get tile reference.

Definition at line 816 of file map.cpp.

817 {
818  return &mMetaTiles[x + y * mWidth];
819 }

References x, and y.

◆ getMetaTiles()

const MetaTile* Map::getMetaTiles ( ) const
inline

Definition at line 343 of file map.h.

344  { return mMetaTiles; }

References mMetaTiles.

Referenced by NavigationManager::loadWalkLayer().

◆ getMusicFile()

const std::string Map::getMusicFile ( ) const

Definition at line 834 of file map.cpp.

835 {
836  return getProperty("music", std::string());
837 }

References Properties::getProperty().

Referenced by Setup_Audio::apply(), Game::changeMap(), and LocalPlayer::updateMusic().

◆ getName()

const std::string Map::getName ( ) const

Definition at line 839 of file map.cpp.

840 {
841  if (hasProperty("name"))
842  return getProperty("name", std::string());
843 
844  return getProperty("mapname", std::string());
845 }

References Properties::getProperty(), and Properties::hasProperty().

Referenced by Minimap::setMap().

◆ getObjectData()

std::string Map::getObjectData ( const unsigned  x,
const unsigned  y,
const int  type 
) const

Definition at line 1392 of file map.cpp.

1394 {
1395  if (mObjects == nullptr)
1396  return "";
1397 
1398  MapObjectList *restrict const list = mObjects->getAt(x, y);
1399  if (list == nullptr)
1400  return "";
1401 
1402  STD_VECTOR<MapObject>::const_iterator it = list->objects.begin();
1403  const STD_VECTOR<MapObject>::const_iterator it_end = list->objects.end();
1404  while (it != it_end)
1405  {
1406  if ((*it).type == type)
1407  return (*it).data;
1408  ++ it;
1409  }
1410 
1411  return "";
1412 }

References restrict, x, and y.

Referenced by LocalPlayer::updateMusic().

◆ getObjectsLayer()

const ObjectsLayer* Map::getObjectsLayer ( ) const
inline

Definition at line 294 of file map.h.

296  { return mObjects; }

References mObjects.

◆ getPortals()

const std::vector<MapItem*>& Map::getPortals ( ) const
inline

Definition at line 270 of file map.h.

272  { return mMapPortals; }

References mMapPortals.

Referenced by SocialNavigationTab::updateList().

◆ getPvpMode()

int Map::getPvpMode ( ) const
inline

Definition at line 291 of file map.h.

292  { return mPvp; }

References mPvp.

Referenced by ActorManager::findNearestPvpPlayer().

◆ getSpecialLayer()

SpecialLayer* Map::getSpecialLayer ( ) const
inline

◆ getTempLayer()

SpecialLayer* Map::getTempLayer ( ) const
inline

Definition at line 237 of file map.h.

238  { return mTempLayer; }

References mTempLayer.

Referenced by LocalPlayer::navigateClean(), LocalPlayer::navigateTo(), LocalPlayer::setRealPos(), and LocalPlayer::updateCoords().

◆ getTileAnimations()

const std::map<int, TileAnimation*>& Map::getTileAnimations ( ) const
inline

Definition at line 329 of file map.h.

331  { return mTileAnimations; }

References mTileAnimations.

Referenced by MapReader::readBase64Layer(), MapReader::readCsvLayer(), and MapReader::readLayer().

◆ getTileHeight()

int Map::getTileHeight ( ) const
inline

◆ getTilesetWithGid()

const Tileset * Map::getTilesetWithGid ( const int  gid) const

Finds the tile set that a tile with the given global id is part of.

Definition at line 699 of file map.cpp.

700 {
701  if (gid >= 0 && gid < mIndexedTilesetsSize)
702  return mIndexedTilesets[gid];
703  return nullptr;
704 }

Referenced by setTile().

◆ getTileWidth()

int Map::getTileWidth ( ) const
inline

◆ getUserMapDirectory()

std::string Map::getUserMapDirectory ( ) const

Definition at line 1272 of file map.cpp.

1273 {
1275  getProperty("_realfilename", std::string()));
1276 }

References Properties::getProperty(), pathJoin(), Settings::serverConfigDir, and settings.

Referenced by addExtraLayer(), and saveExtraLayer().

◆ getVersion()

int Map::getVersion ( ) const
inline

Definition at line 309 of file map.h.

310  { return mVersion; }

References mVersion.

Referenced by setTile().

◆ getWalk()

bool Map::getWalk ( const int  x,
const int  y,
const unsigned char  blockWalkMask 
) const

Gets walkability for a tile with a blocking bitmask. When called without walkmask, only blocks against colliding tiles.

Definition at line 784 of file map.cpp.

786 {
787  // You can't walk outside of the map
788  if (x < 0 || y < 0 || x >= mWidth || y >= mHeight)
789  return false;
790 
791  // Check if the tile is walkable
792  return (mMetaTiles[x + y * mWidth].blockmask & blockWalkMask) == 0;
793 }

References blockWalkMask, x, and y.

Referenced by Being::botFixOffset(), CrazyMoves::crazyMove8(), Viewport::getMouseTile(), Being::moveBotTo(), Being::nextTile(), and LocalPlayer::startWalking().

◆ getWalkLayer()

const WalkLayer* Map::getWalkLayer ( ) const
inline

Definition at line 346 of file map.h.

347  { return mWalkLayer; }

References mWalkLayer.

Referenced by LocalPlayer::isReachable().

◆ getWidth()

int Map::getWidth ( ) const
inline

Returns the width of this map in tiles.

Definition at line 165 of file map.h.

166  { return mWidth; }

References mWidth.

Referenced by NavigationManager::loadWalkLayer(), Ea::PlayerRecv::processPlayerWarp(), MapReader::readLayer(), Minimap::setMap(), and Viewport::updateMaxVars().

◆ haveAtlas()

bool Map::haveAtlas ( ) const
inline

Definition at line 339 of file map.h.

340  { return mAtlas != nullptr; }

References mAtlas.

Referenced by MapReader::readTileset().

◆ indexTilesets()

void Map::indexTilesets ( )

Definition at line 1414 of file map.cpp.

1415 {
1416  if (mTilesetsIndexed)
1417  return;
1418 
1419  mTilesetsIndexed = true;
1420 
1421  const Tileset *restrict s = nullptr;
1422  size_t sSz = 0;
1423  FOR_EACH (Tilesets::const_iterator, it, mTilesets)
1424  {
1425  const size_t sz = (*it)->size();
1426  if ((s == nullptr) || CAST_SIZE(s->getFirstGid()) + sSz
1427  < CAST_SIZE((*it)->getFirstGid()) + sz)
1428  {
1429  s = *it;
1430  sSz = sz;
1431  }
1432  }
1433  if (s == nullptr)
1434  {
1436  mIndexedTilesets = nullptr;
1437  return;
1438  }
1439 
1440  const int size = CAST_S32(s->getFirstGid())
1441  + CAST_S32(s->size());
1444  std::fill_n(mIndexedTilesets, size, static_cast<Tileset*>(nullptr));
1445 
1446  FOR_EACH (Tilesets::const_iterator, it, mTilesets)
1447  {
1448  Tileset *restrict const s2 = *it;
1449  if (s2 != nullptr)
1450  {
1451  const int start = s2->getFirstGid();
1452  const int end = start + CAST_S32(s2->size());
1453  for (int f = start; f < end; f ++)
1454  {
1455  if (f < size)
1456  mIndexedTilesets[f] = s2;
1457  }
1458  }
1459  }
1460 }

References CAST_S32, CAST_SIZE, FOR_EACH, mIndexedTilesets, mIndexedTilesetsSize, mTilesets, mTilesetsIndexed, restrict, EmoteDB::size(), and anonymous_namespace{stringutils.cpp}::start.

Referenced by MapReader::readLayer().

◆ initializeAmbientLayers()

void Map::initializeAmbientLayers ( )

Initialize ambient layers. Has to be called after all the properties are set.

Definition at line 233 of file map.cpp.

234 {
235  // search for "foreground*" or "overlay*" (old term) in map properties
236  for (int i = 0; /* terminated by a break */; i++)
237  {
238  std::string name;
239  if (hasProperty(std::string("foreground").append(
240  toString(i)).append("image")))
241  {
242  name = "foreground" + toString(i);
243  }
244  else if (hasProperty(std::string("overlay").append(
245  toString(i)).append("image")))
246  {
247  name = "overlay" + toString(i);
248  }
249  else
250  {
251  break; // the FOR loop
252  }
253 
254  Image *restrict const img = Loader::getImage(
255  getProperty(name + "image", std::string()));
256  if (img != nullptr)
257  {
258  int mask = atoi(getProperty(name + "mask", std::string()).c_str());
259  if (mask == 0)
260  mask = 1;
261  const float parallax = getFloatProperty(name + "parallax", 0.0F);
262  mForegrounds.push_back(new AmbientLayer(
263  name,
264  img,
265  getFloatProperty(name + "parallaxX", parallax),
266  getFloatProperty(name + "parallaxY", parallax),
267  getFloatProperty(name + "posX", 0.0F),
268  getFloatProperty(name + "posY", 0.0F),
269  getFloatProperty(name + "scrollX", 0.0F),
270  getFloatProperty(name + "scrollY", 0.0F),
271  getBoolProperty(name + "keepratio", false),
272  mask));
273 
274  // The AmbientLayer takes control over the image.
275  img->decRef();
276  }
277  }
278 
279  // search for "background*" in map properties
280  for (int i = 0; hasProperty(std::string("background").append(
281  toString(i)).append("image")); i ++)
282  {
283  const std::string name("background" + toString(i));
284  Image *restrict const img = Loader::getImage(
285  getProperty(name + "image", std::string()));
286 
287  if (img != nullptr)
288  {
289  int mask = atoi(getProperty(name + "mask", std::string()).c_str());
290  if (mask == 0)
291  mask = 1;
292 
293  const float parallax = getFloatProperty(name + "parallax", 0.0F);
294  mBackgrounds.push_back(new AmbientLayer(
295  name,
296  img,
297  getFloatProperty(name + "parallaxX", parallax),
298  getFloatProperty(name + "parallaxY", parallax),
299  getFloatProperty(name + "posX", 0.0F),
300  getFloatProperty(name + "posY", 0.0F),
301  getFloatProperty(name + "scrollX", 0.0F),
302  getFloatProperty(name + "scrollY", 0.0F),
303  getBoolProperty(name + "keepratio", false),
304  mask));
305 
306  // The AmbientLayer takes control over the image.
307  img->decRef();
308  }
309  }
310 }

References Properties::getBoolProperty(), Properties::getFloatProperty(), Loader::getImage(), Properties::getProperty(), Properties::hasProperty(), mBackgrounds, mForegrounds, restrict, and Catch::toString().

◆ initializeParticleEffects()

void Map::initializeParticleEffects ( ) const

Initializes all added particle effects

Definition at line 1108 of file map.cpp.

1109 {
1110  BLOCK_START("Map::initializeParticleEffects")
1111  if (particleEngine == nullptr)
1112  {
1113  BLOCK_END("Map::initializeParticleEffects")
1114  return;
1115  }
1116 
1117  if (config.getBoolValue("particleeffects"))
1118  {
1119  for (STD_VECTOR<ParticleEffectData>::const_iterator
1120  i = mParticleEffects.begin();
1121  i != mParticleEffects.end();
1122  ++i)
1123  {
1124  // +++ add z for map particle effects?
1125  Particle *const p = particleEngine->addEffect(
1126  i->file,
1127  i->x,
1128  i->y,
1129  0);
1130  if ((p != nullptr) &&
1131  i->w > 0 &&
1132  i->h > 0)
1133  {
1134  p->adjustEmitterSize(i->w, i->h);
1135  }
1136  }
1137  }
1138  BLOCK_END("Map::initializeParticleEffects")
1139 }

References ParticleEngine::addEffect(), Particle::adjustEmitterSize(), BLOCK_END, BLOCK_START, config, Configuration::getBoolValue(), mParticleEffects, and particleEngine.

Referenced by Game::changeMap().

◆ isCustom()

bool Map::isCustom ( ) const
inline

Definition at line 326 of file map.h.

327  { return mCustom; }

References mCustom.

Referenced by LocalPlayer::setRealPos().

◆ isHeightsPresent()

bool Map::isHeightsPresent ( ) const
inline

Definition at line 361 of file map.h.

362  { return mHeights != nullptr; }

References mHeights.

Referenced by Viewport::getMouseTile().

◆ optionChanged()

void Map::optionChanged ( const std::string &  name)
virtual

Called when an option changed. The config listener will have to be registered to the option name first.

Implements ConfigListener.

Definition at line 210 of file map.cpp.

211 {
212  if (value == "OverlayDetail")
213  {
214  mOverlayDetail = config.getIntValue("OverlayDetail");
215  }
216  else if (value == "guialpha")
217  {
218  mOpacity = config.getFloatValue("guialpha");
219  if (mOpacity != 1.0F)
220  mBeingOpacity = config.getBoolValue("beingopacity");
221  else
222  mBeingOpacity = false;
223  }
224  else if (value == "beingopacity")
225  {
226  if (mOpacity != 1.0F)
227  mBeingOpacity = config.getBoolValue("beingopacity");
228  else
229  mBeingOpacity = false;
230  }
231 }

References config, Configuration::getBoolValue(), Configuration::getFloatValue(), and Configuration::getIntValue().

◆ preCacheLayers()

void Map::preCacheLayers ( )

Definition at line 1745 of file map.cpp.

1746 {
1748  {
1749  MapLayer *restrict const layer = *it;
1750  if (layer != nullptr)
1751  layer->updateCache(mWidth, mHeight);
1752  }
1753 }

References FOR_EACH, mHeight, mLayers, mWidth, and restrict.

Referenced by MapReader::createEmptyMap(), and Ea::MapRecv::processSetTilesType().

◆ redrawMap()

void Map::redrawMap ( )
inline

Definition at line 317 of file map.h.

318  { mRedrawMap = true; }

References mRedrawMap.

◆ reduce()

void Map::reduce ( )

Definition at line 1472 of file map.cpp.

1473 {
1474 #ifndef USE_SDL2
1475  if ((mFringeLayer == nullptr) ||
1476  mOpenGL != RENDER_SOFTWARE ||
1477  !config.getBoolValue("enableMapReduce"))
1478  {
1479  return;
1480  }
1481 
1482  int cnt = 0;
1483  for (int x = 0; x < mWidth; x ++)
1484  {
1485  for (int y = 0; y < mHeight; y ++)
1486  {
1487  bool correct(true);
1488  bool dontHaveAlpha(false);
1489 
1490  FOR_EACH (LayersCIter, layeri, mLayers)
1491  {
1492  const MapLayer *restrict const layer = *layeri;
1493  if (x >= layer->mWidth || y >= layer->mHeight)
1494  continue;
1495 
1496  // skip layers with flags
1497  if (layer->mTileCondition != -1 || layer->mMask != 1)
1498  continue;
1499 
1500  Image *restrict const img =
1501  layer->mTiles[x + y * layer->mWidth].image;
1502  if (img != nullptr)
1503  {
1504  if (img->hasAlphaChannel() && img->isAlphaCalculated())
1505  {
1506  if (!img->isAlphaVisible())
1507  {
1508  dontHaveAlpha = true;
1509  img->setAlphaVisible(false);
1510  }
1511  }
1512  else if (img->mBounds.w > mapTileSize
1513  || img->mBounds.h > mapTileSize)
1514  {
1515  correct = false;
1516  img->setAlphaVisible(true);
1517  break;
1518  }
1519  else if (!img->isHasAlphaChannel())
1520  {
1521  dontHaveAlpha = true;
1522  img->setAlphaVisible(false);
1523  }
1524  else if (img->hasAlphaChannel())
1525  {
1526  const uint8_t *restrict const arr =
1527  img->SDLgetAlphaChannel();
1528  if (arr == nullptr)
1529  continue;
1530 
1531  bool bad(false);
1532  bool stop(false);
1533  int width;
1534  const SubImage *restrict const subImg
1535  = dynamic_cast<SubImage*>(img);
1536  if (subImg != nullptr)
1537  width = subImg->mInternalBounds.w;
1538  else
1539  width = img->mBounds.w;
1540 
1541  for (int f = img->mBounds.x;
1542  f < img->mBounds.x + img->mBounds.w; f ++)
1543  {
1544  for (int d = img->mBounds.y;
1545  d < img->mBounds.y + img->mBounds.h; d ++)
1546  {
1547  const uint8_t chan = arr[f + d * width];
1548  if (chan != 255)
1549  {
1550  bad = true;
1551  stop = true;
1552  break;
1553  }
1554  }
1555  if (stop)
1556  break;
1557  }
1558  if (!bad)
1559  {
1560  dontHaveAlpha = true;
1561  img->setAlphaVisible(false);
1562  }
1563  else
1564  {
1565  img->setAlphaVisible(true);
1566  }
1567  }
1568  img->setAlphaCalculated(true);
1569  }
1570  }
1571  if (!correct || !dontHaveAlpha)
1572  continue;
1573 
1574  Layers::reverse_iterator ri = mLayers.rbegin();
1575  while (ri != mLayers.rend())
1576  {
1577  const MapLayer *restrict const layer = *ri;
1578  if (x >= layer->mWidth || y >= layer->mHeight)
1579  {
1580  ++ ri;
1581  continue;
1582  }
1583 
1584  // skip layers with flags
1585  if (layer->mTileCondition != -1 || layer->mMask != 1)
1586  {
1587  ++ ri;
1588  continue;
1589  }
1590 
1591  const Image *restrict img =
1592  layer->mTiles[x + y * layer->mWidth].image;
1593  if ((img != nullptr) && !img->isAlphaVisible())
1594  { // removing all down tiles
1595  ++ ri;
1596  while (ri != mLayers.rend())
1597  {
1598  MapLayer *restrict const layer2 = *ri;
1599  // skip layers with flags
1600  if (layer2->mTileCondition != -1 || layer2->mMask != 1)
1601  {
1602  ++ ri;
1603  continue;
1604  }
1605  const size_t pos = x + y * CAST_SIZE(layer2->mWidth);
1606  img = layer2->mTiles[pos].image;
1607  if (img != nullptr)
1608  {
1609  layer2->mTiles[pos].image = nullptr;
1610  cnt ++;
1611  }
1612  ++ ri;
1613  }
1614  break;
1615  }
1616  ++ ri;
1617  }
1618  }
1619  }
1620  logger->log("tiles reduced: %d", cnt);
1621 #endif // USE_SDL2
1622 }

References CAST_SIZE, config, FOR_EACH, Configuration::getBoolValue(), Logger::log(), logger, mapTileSize, mFringeLayer, mHeight, SubImage::mInternalBounds, mLayers, mOpenGL, mWidth, RENDER_SOFTWARE, restrict, x, and y.

◆ removeActor()

void Map::removeActor ( const Actors::iterator &  iterator)
protected

Removes an actor from the map.

Definition at line 828 of file map.cpp.

829 {
830  mActors.erase(iterator);
831 // mSpritesUpdated = true;
832 }

Referenced by Actor::setMap(), and Actor::~Actor().

◆ saveExtraLayer()

void Map::saveExtraLayer ( ) const

Definition at line 1225 of file map.cpp.

1226 {
1227  if (mSpecialLayer == nullptr)
1228  {
1229  logger->log1("No special layer");
1230  return;
1231  }
1232  const std::string mapFileName = pathJoin(getUserMapDirectory(),
1233  "extralayer.txt");
1234  logger->log("saving extra layer: " + mapFileName);
1235 
1236  if (mkdir_r(getUserMapDirectory().c_str()) != 0)
1237  {
1238  logger->log(strprintf("%s doesn't exist and can't be created! "
1239  "Exiting.", getUserMapDirectory().c_str()));
1240  return;
1241  }
1242 
1243  std::ofstream mapFile;
1244  mapFile.open(mapFileName.c_str(), std::ios::binary);
1245  if (!mapFile.is_open())
1246  {
1247  reportAlways("Error opening file for writing: %s",
1248  mapFileName.c_str())
1249  return;
1250  }
1251 
1252  const int width = mSpecialLayer->mWidth;
1253  const int height = mSpecialLayer->mHeight;
1254 
1255  for (int x = 0; x < width; x ++)
1256  {
1257  for (int y = 0; y < height; y ++)
1258  {
1259  const MapItem *restrict const item = mSpecialLayer->getTile(x, y);
1260  if ((item != nullptr) && item->mType != MapItemType::EMPTY
1261  && item->mType != MapItemType::HOME)
1262  {
1263  mapFile << x << " " << y << " "
1264  << CAST_S32(item->mType) << " "
1265  << item->mComment << std::endl;
1266  }
1267  }
1268  }
1269  mapFile.close();
1270 }

References CAST_S32, MapItemType::EMPTY, SpecialLayer::getTile(), getUserMapDirectory(), MapItemType::HOME, Logger::log(), Logger::log1(), logger, SpecialLayer::mHeight, mkdir_r(), mSpecialLayer, SpecialLayer::mWidth, pathJoin(), reportAlways, restrict, strprintf(), x, and y.

Referenced by QuitDialog::action(), Game::changeMap(), and Game::slowLogic().

◆ screenResized()

void Map::screenResized ( )

Definition at line 1806 of file map.cpp.

1807 {
1808  if (mWidth * mapTileSize < mainGraphics->mWidth ||
1809  mHeight * mapTileSize < mainGraphics->mHeight)
1810  {
1811  mClear = true;
1812  }
1813  else
1814  {
1815  mClear = false;
1816  }
1817 }

References mClear, mHeight, and mWidth.

◆ setActorsFix()

void Map::setActorsFix ( const int  x,
const int  y 
)

Definition at line 1723 of file map.cpp.

1724 {
1725  mActorFixX = x;
1726  mActorFixY = y;
1727  if (mFringeLayer != nullptr)
1729 }

References x, and y.

◆ setAtlas()

void Map::setAtlas ( AtlasResource *const  atlas)
inline

Definition at line 336 of file map.h.

337  { mAtlas = atlas; }

References mAtlas.

◆ setBlockMask()

void Map::setBlockMask ( const int  x,
const int  y,
const BlockTypeT  type 
)

Definition at line 745 of file map.cpp.

747 {
748  if (type == BlockType::NONE || !contains(x, y))
749  return;
750 
751  const int tileNum = x + y * mWidth;
752 
753  switch (type)
754  {
755  case BlockType::WALL:
757  break;
758  case BlockType::AIR:
760  break;
761  case BlockType::WATER:
763  break;
764  case BlockType::GROUND:
766  break;
769  break;
772  break;
775  break;
776  default:
777  case BlockType::NONE:
779  // Do nothing.
780  break;
781  }
782 }

References BlockMask::AIR, BlockType::AIR, Catch::contains(), BlockType::GROUND, BlockMask::GROUND, BlockMask::GROUNDTOP, BlockType::GROUNDTOP, BlockType::MONSTERWALL, BlockMask::MONSTERWALL, BlockType::NB_BLOCKTYPES, BlockType::NONE, BlockMask::PLAYERWALL, BlockType::PLAYERWALL, BlockMask::WALL, BlockType::WALL, BlockMask::WATER, BlockType::WATER, x, and y.

Referenced by Ea::MapRecv::processSetTilesType().

◆ setCustom()

void Map::setCustom ( const bool  b)
inline

Definition at line 323 of file map.h.

324  { mCustom = b; }

References mCustom.

Referenced by MapReader::createEmptyMap().

◆ setDrawLayersFlags()

void Map::setDrawLayersFlags ( const MapTypeT n)

Definition at line 1702 of file map.cpp.

1703 {
1704  mDrawLayersFlags = n;
1708  {
1709  mDrawOnlyFringe = true;
1710  }
1711  else
1712  {
1713  mDrawOnlyFringe = false;
1714  }
1716  FOR_EACH (Layers::iterator, it, mLayers)
1717  {
1718  MapLayer *restrict const layer = *it;
1719  layer->setDrawLayerFlags(mDrawLayersFlags);
1720  }
1721 }

References MapType::BLACKWHITE, FOR_EACH, restrict, MapType::SPECIAL3, and MapType::SPECIAL4.

Referenced by GameModifiers::resetModifiers().

◆ setHasWarps()

void Map::setHasWarps ( const bool  n)
inline

Definition at line 243 of file map.h.

244  { mHasWarps = n; }

References mHasWarps.

◆ setMask()

void Map::setMask ( const int  mask)

Definition at line 1675 of file map.cpp.

1676 {
1677  if (mask != mMask)
1678  {
1679  mRedrawMap = true;
1680  mMask = mask;
1682  }
1683 }

Referenced by Ea::PlayerRecv::processMapMask().

◆ setMusicFile()

void Map::setMusicFile ( const std::string &  file)

Definition at line 1685 of file map.cpp.

1686 {
1687  setProperty("music", file);
1688 }

Referenced by Ea::PlayerRecv::processMapMusic().

◆ setPvpMode()

void Map::setPvpMode ( const int  mode)

Definition at line 1360 of file map.cpp.

1361 {
1362  const int oldMode = mPvp;
1363 
1364  if (mode == 0)
1365  mPvp = 0;
1366  else
1367  mPvp |= mode;
1368 
1369  if (mPvp != oldMode && (localPlayer != nullptr))
1370  {
1371  switch (mPvp)
1372  {
1373  case 0:
1375  break;
1376  case 1:
1378  break;
1379  case 2:
1381  break;
1382  case 3:
1384  break;
1385  default:
1387  break;
1388  }
1389  }
1390 }

References NotifyTypes::GVG_ON, localPlayer, NotifyManager::notify(), NotifyTypes::PVP_OFF_GVG_OFF, NotifyTypes::PVP_ON, NotifyTypes::PVP_ON_GVG_ON, and NotifyTypes::PVP_UNKNOWN.

Referenced by EAthena::BeingRecv::processMapTypeProperty(), and Ea::BeingRecv::processPvpMapMode().

◆ setVersion()

void Map::setVersion ( const int  n)
inline

Definition at line 312 of file map.h.

313  { mVersion = n; }

References mVersion.

◆ setWalk()

void Map::setWalk ( const int  x,
const int  y 
)

Definition at line 806 of file map.cpp.

807 {
809 }

References BlockType::GROUNDTOP, x, and y.

Referenced by LocalPlayer::setRealPos().

◆ setWalkLayer()

void Map::setWalkLayer ( WalkLayer *const  layer)
inline

Definition at line 349 of file map.h.

350  { mWalkLayer = layer; }

References mWalkLayer.

◆ update()

void Map::update ( const int  ticks)

Updates animations. Called as needed.

Definition at line 327 of file map.cpp.

328 {
329  // Update animated tiles
331  {
332  TileAnimation *restrict const tileAni = iAni->second;
333  if ((tileAni != nullptr) && tileAni->update(ticks))
334  mRedrawMap = true;
335  }
336 }

References FOR_EACH, and restrict.

Referenced by Game::logic().

◆ updateAmbientLayers()

void Map::updateAmbientLayers ( const float  scrollX,
const float  scrollY 
)
private

Updates scrolling of ambient layers. Has to be called each game tick.

Definition at line 618 of file map.cpp.

620 {
621  BLOCK_START("Map::updateAmbientLayers")
622  static int lastTick = tick_time;
623 
624  if (mLastAScrollX == 0.0F && mLastAScrollY == 0.0F)
625  {
626  // First call - initialisation
627  mLastAScrollX = scrollX;
628  mLastAScrollY = scrollY;
629  }
630 
631  // Update Overlays
632  const float dx = scrollX - mLastAScrollX;
633  const float dy = scrollY - mLastAScrollY;
634  const int timePassed = get_elapsed_time(lastTick);
635 
636  // need check mask to update or not to update
637 
639  {
640  AmbientLayer *const layer = *i;
641  if ((layer != nullptr) && ((layer->mMask & mMask) != 0))
642  layer->update(timePassed, dx, dy);
643  }
644 
646  {
647  AmbientLayer *const layer = *i;
648  if ((layer != nullptr) && ((layer->mMask & mMask) != 0))
649  layer->update(timePassed, dx, dy);
650  }
651 
652  mLastAScrollX = scrollX;
653  mLastAScrollY = scrollY;
654  lastTick = tick_time;
655  BLOCK_END("Map::updateAmbientLayers")
656 }

References BLOCK_END, BLOCK_START, FOR_EACH, get_elapsed_time(), AmbientLayer::mMask, tick_time, and AmbientLayer::update().

◆ updateConditionLayers()

void Map::updateConditionLayers ( )

Definition at line 1731 of file map.cpp.

1732 {
1733  mRedrawMap = true;
1734 
1736  {
1737  MapLayer *restrict const layer = *it;
1738  if ((layer == nullptr) || layer->mTileCondition == -1)
1739  continue;
1740  layer->updateConditionTiles(mMetaTiles,
1741  mWidth, mHeight);
1742  }
1743 }

References FOR_EACH, mHeight, mLayers, mMetaTiles, mRedrawMap, mWidth, and restrict.

Referenced by MapReader::createEmptyMap(), and Ea::MapRecv::processSetTilesType().

◆ updateDrawLayersList()

void Map::updateDrawLayersList ( )

Definition at line 1637 of file map.cpp.

1638 {
1639  mDrawUnderLayers.clear();
1640  mDrawOverLayers.clear();
1641 
1642  if (mDrawOnlyFringe)
1643  return;
1644 
1645  LayersCIter layers = mLayers.begin();
1646  const LayersCIter layers_end = mLayers.end();
1647  for (; layers != layers_end; ++ layers)
1648  {
1649  MapLayer *const layer = *layers;
1650  if ((layer->mMask & mMask) == 0)
1651  continue;
1652 
1653  if (layer->isFringeLayer())
1654  {
1655  ++ layers;
1656  break;
1657  }
1658 
1659  mDrawUnderLayers.push_back(layer);
1660  }
1661 
1663  return;
1664 
1665  for (; layers != layers_end; ++ layers)
1666  {
1667  MapLayer *const layer = *layers;
1668  if ((layer->mMask & mMask) == 0)
1669  continue;
1670 
1671  mDrawOverLayers.push_back(layer);
1672  }
1673 }

References MapLayer::isFringeLayer(), mDrawLayersFlags, mDrawOnlyFringe, mDrawOverLayers, mDrawUnderLayers, mLayers, MapLayer::mMask, mMask, and MapType::SPECIAL2.

Referenced by MapReader::createEmptyMap().

◆ updatePortalTile()

void Map::updatePortalTile ( const std::string &  name,
const int  type,
const int  x,
const int  y,
const bool  addNew 
)

Definition at line 1312 of file map.cpp.

1316 {
1317  MapItem *restrict item = findPortalXY(x, y);
1318  if (item != nullptr)
1319  {
1320  item->mComment = name;
1321  item->setType(type);
1322  item->mX = x;
1323  item->mY = y;
1324  if (mSpecialLayer != nullptr)
1325  {
1326  item = new MapItem(type, name, x, y);
1327  mSpecialLayer->setTile(x, y, item);
1329  }
1330  }
1331  else if (addNew)
1332  {
1333  addPortalTile(name, type, x, y);
1334  }
1335 }

References restrict, x, and y.

Referenced by addExtraLayer(), and LocalPlayer::setHome().

Friends And Related Function Documentation

◆ Actor

friend class Actor
friend

Definition at line 378 of file map.h.

◆ Minimap

friend class Minimap
friend

Definition at line 379 of file map.h.

Field Documentation

◆ mActorFixX

int Map::mActorFixX
private

Definition at line 476 of file map.h.

◆ mActorFixY

int Map::mActorFixY
private

Definition at line 477 of file map.h.

◆ mActors

Actors Map::mActors
private

Definition at line 422 of file map.h.

Referenced by calcMemoryLocal(), and getActorsCount().

◆ mAtlas

AtlasResource* Map::mAtlas
private

Definition at line 496 of file map.h.

Referenced by getAtlasCount(), haveAtlas(), setAtlas(), and ~Map().

◆ mBackgrounds

AmbientLayerVector Map::mBackgrounds
private

Definition at line 433 of file map.h.

Referenced by calcMemoryChilds(), calcMemoryLocal(), initializeAmbientLayers(), and ~Map().

◆ mBeingOpacity

bool Map::mBeingOpacity
private

Definition at line 501 of file map.h.

Referenced by Map().

◆ mCachedDraw

bool Map::mCachedDraw
private

Definition at line 502 of file map.h.

◆ mClear

bool Map::mClear
private

Definition at line 505 of file map.h.

Referenced by screenResized().

◆ mCustom

bool Map::mCustom
private

Definition at line 503 of file map.h.

Referenced by isCustom(), and setCustom().

◆ mDrawLayersFlags

MapTypeT Map::mDrawLayersFlags
private

Definition at line 426 of file map.h.

Referenced by getDrawLayersFlags(), and updateDrawLayersList().

◆ mDrawOnlyFringe

bool Map::mDrawOnlyFringe
private

Definition at line 504 of file map.h.

Referenced by updateDrawLayersList().

◆ mDrawOverLayers

Layers Map::mDrawOverLayers
private

Definition at line 420 of file map.h.

Referenced by calcMemoryLocal(), and updateDrawLayersList().

◆ mDrawScrollX

int Map::mDrawScrollX
private

Definition at line 492 of file map.h.

◆ mDrawScrollY

int Map::mDrawScrollY
private

Definition at line 493 of file map.h.

◆ mDrawUnderLayers

Layers Map::mDrawUnderLayers
private

Definition at line 419 of file map.h.

Referenced by calcMemoryLocal(), and updateDrawLayersList().

◆ mDrawX

int Map::mDrawX
private

Definition at line 490 of file map.h.

◆ mDrawY

int Map::mDrawY
private

Definition at line 491 of file map.h.

◆ mForegrounds

AmbientLayerVector Map::mForegrounds
private

Definition at line 434 of file map.h.

Referenced by calcMemoryChilds(), calcMemoryLocal(), initializeAmbientLayers(), and ~Map().

◆ mFringeLayer

MapLayer* Map::mFringeLayer
private

Definition at line 483 of file map.h.

Referenced by reduce(), and ~Map().

◆ mHasWarps

bool Map::mHasWarps
private

Definition at line 423 of file map.h.

Referenced by getHasWarps(), and setHasWarps().

◆ mHeight

const int Map::mHeight
private

◆ mHeights

const MapHeights* Map::mHeights
private

Definition at line 499 of file map.h.

Referenced by calcMemoryChilds(), isHeightsPresent(), and ~Map().

◆ mIndexedTilesets

Tileset** Map::mIndexedTilesets
private

Definition at line 474 of file map.h.

Referenced by clearIndexedTilesets(), and indexTilesets().

◆ mIndexedTilesetsSize

int Map::mIndexedTilesetsSize
private

Definition at line 475 of file map.h.

Referenced by calcMemoryLocal(), clearIndexedTilesets(), and indexTilesets().

◆ mLastAScrollX

float Map::mLastAScrollX
private

Definition at line 435 of file map.h.

◆ mLastAScrollY

float Map::mLastAScrollY
private

Definition at line 436 of file map.h.

◆ mLastScrollX

int Map::mLastScrollX
private

Definition at line 487 of file map.h.

◆ mLastScrollY

int Map::mLastScrollY
private

Definition at line 488 of file map.h.

◆ mLastX

int Map::mLastX
private

Definition at line 485 of file map.h.

◆ mLastY

int Map::mLastY
private

Definition at line 486 of file map.h.

◆ mLayers

Layers Map::mLayers
private

◆ mMapPortals

std::vector<MapItem*> Map::mMapPortals
private

Definition at line 464 of file map.h.

Referenced by calcMemoryLocal(), getPortals(), and ~Map().

◆ mMask

int Map::mMask
private

Definition at line 494 of file map.h.

Referenced by updateDrawLayersList().

◆ mMaxTileHeight

int Map::mMaxTileHeight
private

Definition at line 415 of file map.h.

◆ mMetaTiles

MetaTile* const Map::mMetaTiles
private

Definition at line 416 of file map.h.

Referenced by getMetaTiles(), Minimap::setMap(), updateConditionLayers(), and ~Map().

◆ mName

std::string Map::mName
private

Definition at line 468 of file map.h.

Referenced by calcMemoryLocal(), and getCounterName().

◆ mObjects

ObjectsLayer* Map::mObjects
private

Definition at line 482 of file map.h.

Referenced by calcMemoryChilds(), getObjectsLayer(), and ~Map().

◆ mOnClosedList

unsigned int Map::mOnClosedList
private

Definition at line 429 of file map.h.

◆ mOnOpenList

unsigned int Map::mOnOpenList
private

Definition at line 430 of file map.h.

◆ mOpacity

float Map::mOpacity
private

Definition at line 470 of file map.h.

Referenced by Map().

◆ mOpenGL

const RenderType Map::mOpenGL
private

Definition at line 471 of file map.h.

Referenced by reduce().

◆ mOverlayDetail

int Map::mOverlayDetail
private

Definition at line 469 of file map.h.

◆ mParticleEffects

std::vector<ParticleEffectData> Map::mParticleEffects
private

Definition at line 462 of file map.h.

Referenced by calcMemoryLocal(), and initializeParticleEffects().

◆ mPvp

int Map::mPvp
private

Definition at line 472 of file map.h.

Referenced by getPvpMode().

◆ mRedrawMap

bool Map::mRedrawMap
private

Definition at line 500 of file map.h.

Referenced by redrawMap(), and updateConditionLayers().

◆ mSpecialLayer

SpecialLayer* Map::mSpecialLayer
private

Definition at line 480 of file map.h.

Referenced by addExtraLayer(), calcMemoryChilds(), getSpecialLayer(), saveExtraLayer(), and ~Map().

◆ mTempLayer

SpecialLayer* Map::mTempLayer
private

Definition at line 481 of file map.h.

Referenced by calcMemoryChilds(), getTempLayer(), and ~Map().

◆ mTileAnimations

std::map<int, TileAnimation*> Map::mTileAnimations
private

Definition at line 466 of file map.h.

Referenced by calcMemoryLocal(), getTileAnimations(), and ~Map().

◆ mTileHeight

const int Map::mTileHeight
private

Definition at line 414 of file map.h.

Referenced by getTileHeight().

◆ mTilesets

Tilesets Map::mTilesets
private

Definition at line 421 of file map.h.

Referenced by calcMemoryChilds(), calcMemoryLocal(), indexTilesets(), and ~Map().

◆ mTilesetsIndexed

bool Map::mTilesetsIndexed
private

Definition at line 473 of file map.h.

Referenced by clearIndexedTilesets(), and indexTilesets().

◆ mTileWidth

const int Map::mTileWidth
private

Definition at line 413 of file map.h.

Referenced by getTileWidth().

◆ mVersion

int Map::mVersion
private

Definition at line 478 of file map.h.

Referenced by getVersion(), and setVersion().

◆ mWalkLayer

WalkLayer* Map::mWalkLayer
private

Definition at line 417 of file map.h.

Referenced by calcMemoryChilds(), getWalkLayer(), setWalkLayer(), and ~Map().

◆ mWidth

const int Map::mWidth
private

The documentation for this class was generated from the following files:
Map::mActorFixY
int mActorFixY
Definition: map.h:477
Properties::setProperty
void setProperty(const std::string &name, const std::string &value)
Definition: properties.h:127
BlockType::NONE
@ NONE
Definition: blocktype.h:30
Map::mName
std::string mName
Definition: map.h:468
Map::mDrawX
int mDrawX
Definition: map.h:490
reportAlways
#define reportAlways(...)
Definition: checkutils.h:252
Map::mIndexedTilesetsSize
int mIndexedTilesetsSize
Definition: map.h:475
CHECKLISTENERS
#define CHECKLISTENERS
Definition: localconsts.h:276
SpecialLayer::getTile
MapItem * getTile(const int x, const int y) const
Definition: speciallayer.cpp:56
AtlasResource::atlases
std::vector< TextureAtlas * > atlases
Definition: atlasresource.h:51
Map::mHeight
const int mHeight
Definition: map.h:412
CastType::Position
@ Position
Definition: casttype.h:30
MapType::SPECIAL4
@ SPECIAL4
Definition: maptype.h:35
MapItemType::ARROW_UP
@ ARROW_UP
Definition: mapitemtype.h:32
CAST_SIZE
#define CAST_SIZE
Definition: cast.h:33
NotifyTypes::PVP_ON
@ PVP_ON
Definition: notifytypes.h:108
MapLayer::setActorsFix
void setActorsFix(const int y)
Definition: maplayer.h:169
Map::mTilesetsIndexed
bool mTilesetsIndexed
Definition: map.h:473
Map::mWidth
const int mWidth
Definition: map.h:411
FOR_EACHP
#define FOR_EACHP(type, iter, array)
Definition: foreach.h:30
anonymous_namespace{stringutils.cpp}::start
unsigned int start
Definition: stringutils.cpp:227
UserColorId::COLLISION_HIGHLIGHT
@ COLLISION_HIGHLIGHT
Definition: usercolorid.h:79
SubImage::mInternalBounds
SDL_Rect mInternalBounds
Definition: subimage.h:78
Location
Definition: location.h:33
MapType
Definition: maptype.h:28
Map::mLastScrollX
int mLastScrollX
Definition: map.h:487
TileAnimationMapCIter
TileAnimationMap::const_iterator TileAnimationMapCIter
Definition: tileanimation.h:64
Particle
Definition: particle.h:44
MapType::SPECIAL
@ SPECIAL
Definition: maptype.h:32
UserPalette::getColorWithAlpha
const Color & getColorWithAlpha(const UserColorIdT type)
Definition: userpalette.h:199
BlockType::MONSTERWALL
@ MONSTERWALL
Definition: blocktype.h:37
actorCompare
class ActorFunctuator actorCompare
Map::mOnClosedList
unsigned int mOnClosedList
Definition: map.h:429
MapLayer::setSpecialLayer
void setSpecialLayer(const SpecialLayer *const val)
Definition: maplayer.h:143
AtlasResource::decRef
void decRef()
Definition: atlasresource.cpp:66
MapItem
Definition: mapitem.h:31
ParticleEngine::addEffect
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation)
Definition: particleengine.cpp:129
Map::mActors
Actors mActors
Definition: map.h:422
MapLayer::drawFringe
void drawFringe(Graphics *const graphics, int startX, int startY, int endX, int endY, const int scrollX, const int scrollY, const Actors &actors) const
Definition: maplayer.cpp:424
Map::mSpecialLayer
SpecialLayer * mSpecialLayer
Definition: map.h:480
Tileset
Definition: tileset.h:33
particleEngine
ParticleEngine * particleEngine
Definition: particleengine.cpp:41
Map::mDrawLayersFlags
MapTypeT mDrawLayersFlags
Definition: map.h:426
settings
Settings settings
Definition: settings.cpp:31
Path
std::list< Position > Path
Definition: position.h:48
RENDER_NORMAL_OPENGL
@ RENDER_NORMAL_OPENGL
Definition: rendertype.h:27
Map::mDrawOverLayers
Layers mDrawOverLayers
Definition: map.h:420
AmbientLayer::mMask
int mMask
Definition: ambientlayer.h:85
MapItemType::ARROW_RIGHT
@ ARROW_RIGHT
Definition: mapitemtype.h:35
MapLayer::isFringeLayer
bool isFringeLayer() const
Definition: maplayer.h:140
NotifyTypes::GVG_ON
@ GVG_ON
Definition: notifytypes.h:109
MapLayer::mMask
int mMask
Definition: maplayer.h:233
NotifyManager::notify
void notify(const unsigned int message)
Definition: notifymanager.cpp:81
Map::updateDrawLayersList
void updateDrawLayersList()
Definition: map.cpp:1637
MapType::NORMAL
@ NORMAL
Definition: maptype.h:30
BlockType::WATER
@ WATER
Definition: blocktype.h:34
Map::mObjects
ObjectsLayer * mObjects
Definition: map.h:482
Map::getWalk
bool getWalk(const int x, const int y, const unsigned char blockWalkMask) const
Definition: map.cpp:784
Map::mHasWarps
bool mHasWarps
Definition: map.h:423
Map::mTileWidth
const int mTileWidth
Definition: map.h:413
Actor
Definition: actor.h:40
Map::mMask
int mMask
Definition: map.h:494
Image
Definition: image.h:67
Map::mDrawOnlyFringe
bool mDrawOnlyFringe
Definition: map.h:504
LayersCIter
Layers::const_iterator LayersCIter
Definition: map.h:62
BlockMask::WATER
@ WATER
Definition: blockmask.h:32
rfindSepatator
size_t rfindSepatator(const std::string &str1)
Definition: stringutils.cpp:1162
Properties::Properties
Properties()
Definition: properties.h:37
Settings::serverConfigDir
std::string serverConfigDir
Definition: settings.h:116
pathJoin
std::string pathJoin(std::string str1, const std::string &str2)
Definition: stringutils.cpp:1036
Map::mLayers
Layers mLayers
Definition: map.h:418
MapLayerPosition
Definition: maplayerposition.h:30
BlockType::AIR
@ AIR
Definition: blocktype.h:33
Map::mForegrounds
AmbientLayerVector mForegrounds
Definition: map.h:434
BlockType::WALL
@ WALL
Definition: blocktype.h:32
NotifyTypes::PVP_ON_GVG_ON
@ PVP_ON_GVG_ON
Definition: notifytypes.h:110
Map::mAtlas
AtlasResource * mAtlas
Definition: map.h:496
MapLayer::setTempLayer
void setTempLayer(const SpecialLayer *const val)
Definition: maplayer.h:147
Map::getUserMapDirectory
std::string getUserMapDirectory() const
Definition: map.cpp:1272
Map::mRedrawMap
bool mRedrawMap
Definition: map.h:500
MapType::SPECIAL2
@ SPECIAL2
Definition: maptype.h:33
delete2
#define delete2(var)
Definition: delete2.h:24
userPalette
UserPalette * userPalette
Definition: userpalette.cpp:33
Configuration::addListener
void addListener(const std::string &key, ConfigListener *const listener)
Definition: configuration.cpp:905
Catch::toString
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
logger
Logger * logger
Definition: logger.cpp:88
Graphics::clearScreen
virtual void clearScreen() const
Definition: graphics.h:455
BlockMask::GROUND
@ GROUND
Definition: blockmask.h:33
ActorsCIter
Actors::const_iterator ActorsCIter
Definition: actor.h:38
if
if(!vert) return
MetaTile::parentY
int parentY
Definition: metatile.h:50
Map::mOpacity
float mOpacity
Definition: map.h:470
ObjectsLayer::getAt
MapObjectList * getAt(const unsigned x, const unsigned y) const
Definition: objectslayer.cpp:75
Location::y
int y
Definition: location.h:57
fileName
std::string fileName
Definition: testmain.cpp:38
RENDER_GLES_OPENGL
@ RENDER_GLES_OPENGL
Definition: rendertype.h:29
localPlayer
LocalPlayer * localPlayer
Definition: localplayer.cpp:108
BlockMask::MONSTERWALL
@ MONSTERWALL
Definition: blockmask.h:36
Properties::getBoolProperty
bool getBoolProperty(const std::string &name, const bool def) const
Definition: properties.h:96
Map::mTilesets
Tilesets mTilesets
Definition: map.h:421
Map::mTempLayer
SpecialLayer * mTempLayer
Definition: map.h:481
MapType::BLACKWHITE
@ BLACKWHITE
Definition: maptype.h:36
nullptr
#define nullptr
Definition: localconsts.h:44
blockWalkMask
static const int blockWalkMask
Definition: navigationmanager.cpp:31
UserColorId::AIR_COLLISION_HIGHLIGHT
@ AIR_COLLISION_HIGHLIGHT
Definition: usercolorid.h:80
MetaTile
Definition: metatile.h:33
MapObjectList
Definition: mapobjectlist.h:32
intToRenderType
RenderType intToRenderType(const int mode)
Definition: renderers.cpp:42
Map::mLastAScrollY
float mLastAScrollY
Definition: map.h:436
MapLayer
Definition: maplayer.h:48
Map::mWalkLayer
WalkLayer * mWalkLayer
Definition: map.h:417
MapType::SPECIAL3
@ SPECIAL3
Definition: maptype.h:34
BlockType::GROUNDTOP
@ GROUNDTOP
Definition: blocktype.h:35
Map::draw
void draw(Graphics *const graphics, int scrollX, int scrollY)
Definition: map.cpp:338
strprintf
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
MemoryCounter::calcMemory
int calcMemory(const int level) const
Definition: memorycounter.cpp:36
Map::mTileAnimations
std::map< int, TileAnimation * > mTileAnimations
Definition: map.h:466
Map::mLastAScrollX
float mLastAScrollX
Definition: map.h:435
Graphics::drawNet
virtual void drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height)
Definition: graphics.cpp:652
RENDER_MODERN_OPENGL
@ RENDER_MODERN_OPENGL
Definition: rendertype.h:31
Loader::getImage
Image * getImage(const std::string &idPath)
Definition: imageloader.cpp:85
Map::mIndexedTilesets
Tileset ** mIndexedTilesets
Definition: map.h:474
Map::mClear
bool mClear
Definition: map.h:505
MapItemType::HOME
@ HOME
Definition: mapitemtype.h:29
MetaTile::parentX
int parentX
Definition: metatile.h:49
Map::mHeights
const MapHeights * mHeights
Definition: map.h:499
get_elapsed_time
int get_elapsed_time(const int startTime)
Definition: timer.cpp:93
Map::mParticleEffects
std::vector< ParticleEffectData > mParticleEffects
Definition: map.h:462
NotifyTypes::PVP_UNKNOWN
@ PVP_UNKNOWN
Definition: notifytypes.h:111
BlockMask::WALL
@ WALL
Definition: blockmask.h:30
SpecialLayer::updateCache
void updateCache()
Definition: speciallayer.cpp:168
Map::mDrawScrollX
int mDrawScrollX
Definition: map.h:492
mainGraphics
Graphics * mainGraphics
Definition: graphics.cpp:108
x
x
Definition: graphics_calcImageRect.hpp:72
Map::mBeingOpacity
bool mBeingOpacity
Definition: map.h:501
UserColorId::WALKABLE_HIGHLIGHT
@ WALKABLE_HIGHLIGHT
Definition: usercolorid.h:84
AmbientLayer::update
void update(const int timePassed, const float dx, const float dy)
Definition: ambientlayer.cpp:96
Map::mLastX
int mLastX
Definition: map.h:485
Properties::hasProperty
bool hasProperty(const std::string &name) const
Definition: properties.h:118
Map::empty
bool empty() const
Definition: map.h:320
MetaTile::whichList
unsigned whichList
Definition: metatile.h:48
Map::updateAmbientLayers
void updateAmbientLayers(const float scrollX, const float scrollY)
Definition: map.cpp:618
Configuration::getFloatValue
float getFloatValue(const std::string &key) const
Definition: configuration.cpp:541
MetaTile::Hcost
int Hcost
Definition: metatile.h:47
Map::mPvp
int mPvp
Definition: map.h:472
BlockMask::PLAYERWALL
@ PLAYERWALL
Definition: blockmask.h:35
tick_time
volatile int tick_time
Definition: timer.cpp:52
Map::mDrawUnderLayers
Layers mDrawUnderLayers
Definition: map.h:419
RENDER_SOFTWARE
@ RENDER_SOFTWARE
Definition: rendertype.h:26
Properties::getProperty
const std::string getProperty(const std::string &name, const std::string &def) const
Definition: properties.h:58
MapItemType::EMPTY
@ EMPTY
Definition: mapitemtype.h:28
Logger::log1
void log1(const char *const log_text)
Definition: logger.cpp:237
Configuration::getIntValue
int getIntValue(const std::string &key) const
Definition: configuration.cpp:403
ImageSet::getHeight
int getHeight() const
Definition: imageset.h:65
Map::mOverlayDetail
int mOverlayDetail
Definition: map.h:469
Map::mDrawY
int mDrawY
Definition: map.h:491
config
Configuration config
Definition: configuration.cpp:51
AmbientLayerVector
std::vector< AmbientLayer * > AmbientLayerVector
Definition: map.h:64
Graphics::mHeight
int mHeight
Definition: graphics.h:484
MapLayerPosition::BACKGROUND_LAYERS
@ BACKGROUND_LAYERS
Definition: maplayerposition.h:33
SpecialLayer
Definition: speciallayer.h:33
delete_all
void delete_all(Container &c)
Definition: dtor.h:55
TileAnimation
Definition: tileanimation.h:43
MetaTile::blockmask
unsigned char blockmask
Definition: metatile.h:51
EmoteDB::size
int size()
Definition: emotedb.cpp:305
Graphics::setColor
virtual void setColor(const Color &color)
Definition: graphics.h:319
MapHeights::getHeight
uint8_t getHeight(const int x, const int y) const
Definition: mapheights.h:43
Configuration::removeListeners
void removeListeners(ConfigListener *const listener)
Definition: configuration.cpp:938
BlockMask::AIR
@ AIR
Definition: blockmask.h:31
Location::x
int x
Definition: location.h:57
Map::mOpenGL
const RenderType mOpenGL
Definition: map.h:471
std
Definition: mseprimitives.h:398
Map::findPortalXY
MapItem * findPortalXY(const int x, const int y) const
Definition: map.cpp:1337
Rect
Definition: rect.h:72
Particle::adjustEmitterSize
void adjustEmitterSize(const int w, const int h)
Definition: particle.cpp:555
MapLayerPosition::FOREGROUND_LAYERS
@ FOREGROUND_LAYERS
Definition: maplayerposition.h:32
ObjectsLayer
Definition: objectslayer.h:30
Map::mFringeLayer
MapLayer * mFringeLayer
Definition: map.h:483
Resource::decRef
virtual void decRef()
Definition: resource.cpp:49
AmbientLayerVectorIter
AmbientLayerVector::iterator AmbientLayerVectorIter
Definition: map.h:66
MapItemType::PORTAL
@ PORTAL
Definition: mapitemtype.h:36
UserColorId::WATER_COLLISION_HIGHLIGHT
@ WATER_COLLISION_HIGHLIGHT
Definition: usercolorid.h:81
Map
Definition: map.h:71
Map::Map
Map(const std::string &name, const int width, const int height, const int tileWidth, const int tileHeight)
Definition: map.cpp:96
restrict
#define restrict
Definition: localconsts.h:164
Map::drawAmbientLayers
void drawAmbientLayers(Graphics *const graphics, const MapLayerPositionT type, const int detail) const
Definition: map.cpp:658
UserColorId::MONSTER_COLLISION_HIGHLIGHT
@ MONSTER_COLLISION_HIGHLIGHT
Definition: usercolorid.h:82
MetaTile::Gcost
int Gcost
Definition: metatile.h:46
BLOCK_START
#define BLOCK_START(name)
Definition: perfomance.h:78
Properties::getFloatProperty
float getFloatProperty(const std::string &name, const float def) const
Definition: properties.h:74
BlockType::PLAYERWALL
@ PLAYERWALL
Definition: blocktype.h:36
BLOCK_END
#define BLOCK_END(name)
Definition: perfomance.h:79
CAST_S32
#define CAST_S32
Definition: cast.h:29
BlockMask::GROUNDTOP
@ GROUNDTOP
Definition: blockmask.h:34
ObjectsLayer::addObject
void addObject(const std::string &name, const int type, const unsigned x, const unsigned y, unsigned dx, unsigned dy)
Definition: objectslayer.cpp:49
UserColorId::NET
@ NET
Definition: usercolorid.h:85
Map::addPortalTile
void addPortalTile(const std::string &name, const int type, const int x, const int y)
Definition: map.cpp:1299
Map::mDrawScrollY
int mDrawScrollY
Definition: map.h:493
BlockType::NB_BLOCKTYPES
@ NB_BLOCKTYPES
Definition: blocktype.h:38
UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT
@ GROUNDTOP_COLLISION_HIGHLIGHT
Definition: usercolorid.h:83
Map::contains
bool contains(const int x, const int y) const
Definition: map.cpp:811
Map::mActorFixX
int mActorFixX
Definition: map.h:476
MapObjectList::objects
std::vector< MapObject > objects
Definition: mapobjectlist.h:42
BlockType::GROUND
@ GROUND
Definition: blocktype.h:31
Map::mMaxTileHeight
int mMaxTileHeight
Definition: map.h:415
Map::mMetaTiles
MetaTile *const mMetaTiles
Definition: map.h:416
MetaTile::Fcost
int Fcost
Definition: metatile.h:45
Map::updatePortalTile
void updatePortalTile(const std::string &name, const int type, const int x, const int y, const bool addNew)
Definition: map.cpp:1312
Map::mLastY
int mLastY
Definition: map.h:486
Location::tile
MetaTile * tile
Definition: location.h:59
RENDER_GLES2_OPENGL
@ RENDER_GLES2_OPENGL
Definition: rendertype.h:32
SpecialLayer::setTile
void setTile(const int x, const int y, MapItem *const item)
Definition: speciallayer.cpp:66
AmbientLayer
Definition: ambientlayer.h:33
Map::mBackgrounds
AmbientLayerVector mBackgrounds
Definition: map.h:433
y
y
Definition: graphics_calcImageRect.hpp:72
Map::mCustom
bool mCustom
Definition: map.h:503
SubImage
Definition: subimage.h:33
Map::mLastScrollY
int mLastScrollY
Definition: map.h:488
Map::mCachedDraw
bool mCachedDraw
Definition: map.h:502
mkdir_r
int mkdir_r(const char *const pathname)
Create a directory, making leading components first if necessary.
Definition: mkdir.cpp:108
NotifyTypes::PVP_OFF_GVG_OFF
@ PVP_OFF_GVG_OFF
Definition: notifytypes.h:107
Map::mTileHeight
const int mTileHeight
Definition: map.h:414
Map::mOnOpenList
unsigned int mOnOpenList
Definition: map.h:430
Logger::log
void log(const char *const log_text,...)
Definition: logger.cpp:268
Map::mMapPortals
std::vector< MapItem * > mMapPortals
Definition: map.h:464
FOR_EACH
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
Map::mVersion
int mVersion
Definition: map.h:478
mapTileSize
static const int mapTileSize
Definition: map.h:26
fillCollision
#define fillCollision(collision, color)
Definition: map.cpp:545
AmbientLayerVectorCIter
AmbientLayerVector::const_iterator AmbientLayerVectorCIter
Definition: map.h:65
Configuration::getBoolValue
bool getBoolValue(const std::string &key) const
Definition: configuration.cpp:596
Graphics::mWidth
int mWidth
Definition: graphics.h:483
Map::addBlockMask
void addBlockMask(const int x, const int y, const BlockTypeT type)
Definition: map.cpp:706