summaryrefslogtreecommitdiff
path: root/src/resources/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/map')
-rw-r--r--src/resources/map/map.cpp11
-rw-r--r--src/resources/map/map.h10
-rw-r--r--src/resources/map/maplayer.cpp23
-rw-r--r--src/resources/map/maptype.h39
4 files changed, 57 insertions, 26 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 7f856d786..65d1dda3e 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -32,6 +32,7 @@
#include "resources/map/mapheights.h"
#include "resources/map/maplayer.h"
#include "resources/map/mapitem.h"
+#include "resources/map/maptype.h"
#include "resources/map/objectslayer.h"
#include "resources/map/speciallayer.h"
#include "resources/map/tileset.h"
@@ -86,7 +87,7 @@ Map::Map(const int width, const int height,
mTilesets(),
mActors(),
mHasWarps(false),
- mDebugFlags(MAP_NORMAL),
+ mDebugFlags(MapType::NORMAL),
mOnClosedList(1),
mOnOpenList(2),
mBackgrounds(),
@@ -337,7 +338,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
// Draw backgrounds
drawAmbientLayers(graphics, BACKGROUND_LAYERS, mOverlayDetail);
- if (mDebugFlags == MAP_BLACKWHITE && userPalette)
+ if (mDebugFlags == MapType::BLACKWHITE && userPalette)
{
graphics->setColor(userPalette->getColorWithAlpha(
UserPalette::WALKABLE_HIGHLIGHT));
@@ -373,7 +374,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
}
#endif
- if (mDebugFlags == MAP_SPECIAL3 || mDebugFlags == MAP_BLACKWHITE)
+ if (mDebugFlags == MapType::SPECIAL3 || mDebugFlags == MapType::BLACKWHITE)
{
if (mFringeLayer)
{
@@ -398,7 +399,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
{
layer->setSpecialLayer(mSpecialLayer);
layer->setTempLayer(mTempLayer);
- if (mDebugFlags == MAP_SPECIAL2)
+ if (mDebugFlags == MapType::SPECIAL2)
overFringe = true;
layer->drawFringe(graphics, startX, startY, endX, endY,
@@ -507,7 +508,7 @@ void Map::drawCollision(Graphics *const graphics,
if (endY > mHeight)
endY = mHeight;
- if (debugFlags < MAP_SPECIAL)
+ if (debugFlags < MapType::SPECIAL)
{
graphics->setColor(userPalette->getColorWithAlpha(UserPalette::NET));
graphics->drawNet(
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index db9f09dd0..76b55f988 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -78,16 +78,6 @@ class Map final : public Properties, public ConfigListener
COLLISION_MAX = 5 // count index
};
- enum DebugType
- {
- MAP_NORMAL = 0,
- MAP_DEBUG = 1,
- MAP_SPECIAL = 2,
- MAP_SPECIAL2 = 3,
- MAP_SPECIAL3 = 4,
- MAP_BLACKWHITE = 5
- };
-
/**
* Constructor, taking map and tile size as parameters.
*/
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index 1bcd65681..b5de484e1 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -39,6 +39,7 @@
#include "resources/map/mapitem.h"
#include "resources/map/mapobjectlist.h"
#include "resources/map/maprowvertexes.h"
+#include "resources/map/maptype.h"
#include "resources/map/speciallayer.h"
#include "gui/font.h"
@@ -116,8 +117,8 @@ void MapLayer::draw(Graphics *const graphics,
const int dx = (mX * mapTileSize) - scrollX;
const int dy = (mY * mapTileSize) - scrollY + mapTileSize;
- const bool flag = (debugFlags != Map::MAP_SPECIAL
- && debugFlags != Map::MAP_SPECIAL2);
+ const bool flag = (debugFlags != MapType::SPECIAL
+ && debugFlags != MapType::SPECIAL2);
for (int y = startY; y < endY; y++)
{
@@ -209,8 +210,8 @@ void MapLayer::updateSDL(const Graphics *const graphics,
const int dx = (mX * mapTileSize) - scrollX;
const int dy = (mY * mapTileSize) - scrollY + mapTileSize;
- const bool flag = (debugFlags != Map::MAP_SPECIAL
- && debugFlags != Map::MAP_SPECIAL2);
+ const bool flag = (debugFlags != MapType::SPECIAL
+ && debugFlags != MapType::SPECIAL2);
for (int y = startY; y < endY; y++)
{
@@ -274,8 +275,8 @@ void MapLayer::updateOGL(const Graphics *const graphics,
const int dx = (mX * mapTileSize) - scrollX;
const int dy = (mY * mapTileSize) - scrollY + mapTileSize;
- const bool flag = (debugFlags != Map::MAP_SPECIAL
- && debugFlags != Map::MAP_SPECIAL2);
+ const bool flag = (debugFlags != MapType::SPECIAL
+ && debugFlags != MapType::SPECIAL2);
MapRowVertexes *const row = new MapRowVertexes();
mTempRows.push_back(row);
@@ -404,8 +405,8 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
}
BLOCK_END("MapLayer::drawFringe drawmobs")
- if (debugFlags == Map::MAP_SPECIAL3
- || debugFlags == Map::MAP_BLACKWHITE)
+ if (debugFlags == MapType::SPECIAL3
+ || debugFlags == MapType::BLACKWHITE)
{
if (y < specialHeight)
{
@@ -454,8 +455,8 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
{
const int px = x32 + dx;
const int py = py0 - img->mBounds.h;
- if ((debugFlags != Map::MAP_SPECIAL
- && debugFlags != Map::MAP_SPECIAL2)
+ if ((debugFlags != MapType::SPECIAL
+ && debugFlags != MapType::SPECIAL2)
|| img->mBounds.h <= mapTileSize)
{
int width = 0;
@@ -513,7 +514,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
}
// Draw any remaining actors
- if (debugFlags != Map::MAP_SPECIAL3)
+ if (debugFlags != MapType::SPECIAL3)
{
BLOCK_START("MapLayer::drawFringe drawmobs")
while (ai != ai_end)
diff --git a/src/resources/map/maptype.h b/src/resources/map/maptype.h
new file mode 100644
index 000000000..edfbfeacc
--- /dev/null
+++ b/src/resources/map/maptype.h
@@ -0,0 +1,39 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RESOURCES_MAP_TYPE_H
+#define RESOURCES_MAP_TYPE_H
+
+namespace MapType
+{
+ enum MapType
+ {
+ NORMAL = 0,
+ DEBUG = 1,
+ SPECIAL = 2,
+ SPECIAL2 = 3,
+ SPECIAL3 = 4,
+ BLACKWHITE = 5
+ };
+}
+
+#endif // RESOURCES_MAP_TYPE_H