summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-11 17:14:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-11 17:14:27 +0300
commit2f2b3da534ad7d19afd96cdc92d04052aa63f567 (patch)
treec275ba32e0a08e332c16f9d892ca936eac9ce750
parent10cf17f8d83d2d925641f722acc004828dba3094 (diff)
downloadplus-2f2b3da534ad7d19afd96cdc92d04052aa63f567.tar.gz
plus-2f2b3da534ad7d19afd96cdc92d04052aa63f567.tar.bz2
plus-2f2b3da534ad7d19afd96cdc92d04052aa63f567.tar.xz
plus-2f2b3da534ad7d19afd96cdc92d04052aa63f567.zip
Move maptype into separate file.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/gui/viewport.cpp9
-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
7 files changed, 64 insertions, 30 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2aa6f5de7..e1df1a5a3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -719,6 +719,7 @@ SET(SRCS
resources/map/mapobject.h
resources/map/mapobjectlist.h
resources/map/maprowvertexes.h
+ resources/map/maptype.h
resources/map/metatile.h
resources/map/objectslayer.cpp
resources/map/objectslayer.h
diff --git a/src/Makefile.am b/src/Makefile.am
index dd43d57c3..a5889801e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -808,6 +808,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
resources/map/mapobject.h \
resources/map/mapobjectlist.h \
resources/map/maprowvertexes.h \
+ resources/map/maptype.h \
resources/map/metatile.h \
resources/map/objectslayer.cpp \
resources/map/objectslayer.h \
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index d4e13559a..ec9f5bac3 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -30,6 +30,7 @@
#include "resources/map/mapitem.h"
#include "resources/map/maplayer.h"
+#include "resources/map/maptype.h"
#include "resources/map/speciallayer.h"
#include "being/localplayer.h"
@@ -75,7 +76,7 @@ Viewport::Viewport() :
mMousePressY(0),
mPixelViewX(0),
mPixelViewY(0),
- mShowDebugPath(Map::MAP_NORMAL),
+ mShowDebugPath(MapType::NORMAL),
mCameraMode(0),
mLocalWalkTime(-1),
mCameraRelativeX(0),
@@ -237,7 +238,7 @@ void Viewport::draw(Graphics *graphics)
{
mMap->drawCollision(graphics, mPixelViewX,
mPixelViewY, mShowDebugPath);
- if (mShowDebugPath == Map::MAP_DEBUG)
+ if (mShowDebugPath == MapType::DEBUG)
drawDebugPath(graphics);
}
@@ -989,8 +990,8 @@ void Viewport::mouseMoved(MouseEvent &event A_UNUSED)
void Viewport::toggleDebugPath()
{
mShowDebugPath++;
- if (mShowDebugPath > Map::MAP_BLACKWHITE)
- mShowDebugPath = Map::MAP_NORMAL;
+ if (mShowDebugPath > MapType::BLACKWHITE)
+ mShowDebugPath = MapType::NORMAL;
if (mMap)
mMap->setDebugFlags(mShowDebugPath);
}
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