summaryrefslogtreecommitdiff
path: root/src/resources/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/map')
-rw-r--r--src/resources/map/blockmask.h40
-rw-r--r--src/resources/map/map.cpp26
-rw-r--r--src/resources/map/map.h16
3 files changed, 56 insertions, 26 deletions
diff --git a/src/resources/map/blockmask.h b/src/resources/map/blockmask.h
new file mode 100644
index 000000000..3e10fa64e
--- /dev/null
+++ b/src/resources/map/blockmask.h
@@ -0,0 +1,40 @@
+/*
+ * 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_BLOCKMASK_H
+#define RESOURCES_MAP_BLOCKMASK_H
+
+namespace BlockMask
+{
+ enum BlockMask
+ {
+ WALL = 0x80, // 1000 0000
+ CHARACTER = 0x01, // 0000 0001
+ MONSTER = 0x02, // 0000 0010
+ AIR = 0x04, // 0000 0100
+ WATER = 0x08, // 0000 1000
+ GROUND = 0x10, // 0001 0000
+ GROUNDTOP = 0x20 // 0010 0000
+ };
+}
+
+#endif // RESOURCES_MAP_BLOCKMASK_H
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 99b27bce2..7f856d786 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -527,10 +527,10 @@ void Map::drawCollision(Graphics *const graphics,
int width = 0;
const int x0 = x;
- fillCollision(BLOCKMASK_WALL, COLLISION_HIGHLIGHT);
- fillCollision(BLOCKMASK_AIR, AIR_COLLISION_HIGHLIGHT);
- fillCollision(BLOCKMASK_WATER, WATER_COLLISION_HIGHLIGHT);
- fillCollision(BLOCKMASK_GROUNDTOP, GROUNDTOP_COLLISION_HIGHLIGHT);
+ fillCollision(BlockMask::WALL, COLLISION_HIGHLIGHT);
+ fillCollision(BlockMask::AIR, AIR_COLLISION_HIGHLIGHT);
+ fillCollision(BlockMask::WATER, WATER_COLLISION_HIGHLIGHT);
+ fillCollision(BlockMask::GROUNDTOP, GROUNDTOP_COLLISION_HIGHLIGHT);
}
}
}
@@ -636,25 +636,25 @@ void Map::blockTile(const int x, const int y,
switch (type)
{
case BlockType::WALL:
- mMetaTiles[tileNum].blockmask |= BLOCKMASK_WALL;
+ mMetaTiles[tileNum].blockmask |= BlockMask::WALL;
break;
case BlockType::CHARACTER:
- mMetaTiles[tileNum].blockmask |= BLOCKMASK_CHARACTER;
+ mMetaTiles[tileNum].blockmask |= BlockMask::CHARACTER;
break;
case BlockType::MONSTER:
- mMetaTiles[tileNum].blockmask |= BLOCKMASK_MONSTER;
+ mMetaTiles[tileNum].blockmask |= BlockMask::MONSTER;
break;
case BlockType::AIR:
- mMetaTiles[tileNum].blockmask |= BLOCKMASK_AIR;
+ mMetaTiles[tileNum].blockmask |= BlockMask::AIR;
break;
case BlockType::WATER:
- mMetaTiles[tileNum].blockmask |= BLOCKMASK_WATER;
+ mMetaTiles[tileNum].blockmask |= BlockMask::WATER;
break;
case BlockType::GROUND:
- mMetaTiles[tileNum].blockmask |= BLOCKMASK_GROUND;
+ mMetaTiles[tileNum].blockmask |= BlockMask::GROUND;
break;
case BlockType::GROUNDTOP:
- mMetaTiles[tileNum].blockmask |= BLOCKMASK_GROUNDTOP;
+ mMetaTiles[tileNum].blockmask |= BlockMask::GROUNDTOP;
break;
default:
case BlockType::NONE:
@@ -815,7 +815,7 @@ Path Map::findPath(const int startX, const int startY,
if (newTile->whichList == mOnClosedList ||
((newTile->blockmask & walkmask)
&& !(x == destX && y == destY))
- || (newTile->blockmask & BLOCKMASK_WALL))
+ || (newTile->blockmask & BlockMask::WALL))
{
continue;
}
@@ -831,7 +831,7 @@ Path Map::findPath(const int startX, const int startY,
// +++ here need check block must depend
// on player abilities.
- if (((t1->blockmask | t2->blockmask) & BLOCKMASK_WALL))
+ if (((t1->blockmask | t2->blockmask) & BlockMask::WALL))
continue;
}
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index 0085206a6..db9f09dd0 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -27,6 +27,7 @@
#include "being/actor.h"
+#include "resources/map/blockmask.h"
#include "resources/map/blocktype.h"
#include "resources/map/metatile.h"
#include "resources/map/properties.h"
@@ -77,17 +78,6 @@ class Map final : public Properties, public ConfigListener
COLLISION_MAX = 5 // count index
};
- enum BlockMask
- {
- BLOCKMASK_WALL = 0x80, // 1000 0000
- BLOCKMASK_CHARACTER = 0x01, // 0000 0001
- BLOCKMASK_MONSTER = 0x02, // 0000 0010
- BLOCKMASK_AIR = 0x04, // 0000 0100
- BLOCKMASK_WATER = 0x08, // 0000 1000
- BLOCKMASK_GROUND = 0x10, // 0001 0000
- BLOCKMASK_GROUNDTOP = 0x20 // 0010 0000
- };
-
enum DebugType
{
MAP_NORMAL = 0,
@@ -171,8 +161,8 @@ class Map final : public Properties, public ConfigListener
* without walkmask, only blocks against colliding tiles.
*/
bool getWalk(const int x, const int y,
- const unsigned char walkmask = BLOCKMASK_WALL
- | BLOCKMASK_AIR | BLOCKMASK_WATER) const A_WARN_UNUSED;
+ const unsigned char walkmask = BlockMask::WALL
+ | BlockMask::AIR | BlockMask::WATER) const A_WARN_UNUSED;
void setWalk(const int x, const int y, const bool walkable);