summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being/localplayer.cpp5
-rw-r--r--src/enums/resources/map/blockmask.h11
-rw-r--r--src/enums/resources/map/blocktype.h13
-rw-r--r--src/gui/windows/minimap.cpp6
-rw-r--r--src/resources/map/map.cpp7
-rw-r--r--src/resources/map/map.h3
-rw-r--r--src/resources/mapreader.cpp3
7 files changed, 33 insertions, 15 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index af020d7ea..647aba41b 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -2645,7 +2645,10 @@ void LocalPlayer::checkNewName(Being *const being)
unsigned char LocalPlayer::getBlockWalkMask() const
{
// for now blocking all types of collisions
- return BlockMask::WALL | BlockMask::AIR | BlockMask::WATER;
+ return BlockMask::WALL |
+ BlockMask::AIR |
+ BlockMask::WATER |
+ BlockMask::PLAYERWALL;
}
void LocalPlayer::removeHome()
diff --git a/src/enums/resources/map/blockmask.h b/src/enums/resources/map/blockmask.h
index 127938d7c..f5b5b25e0 100644
--- a/src/enums/resources/map/blockmask.h
+++ b/src/enums/resources/map/blockmask.h
@@ -27,11 +27,12 @@ namespace BlockMask
{
enum BlockMask
{
- WALL = 0x80, // 1000 0000
- AIR = 0x04, // 0000 0100
- WATER = 0x08, // 0000 1000
- GROUND = 0x10, // 0001 0000
- GROUNDTOP = 0x20 // 0010 0000
+ WALL = 0x80, // 1000 0000
+ AIR = 0x04, // 0000 0100
+ WATER = 0x08, // 0000 1000
+ GROUND = 0x10, // 0001 0000
+ GROUNDTOP = 0x20, // 0010 0000
+ PLAYERWALL = 0x40 // 0100 0000
};
} // namespace BlockMask
diff --git a/src/enums/resources/map/blocktype.h b/src/enums/resources/map/blocktype.h
index 8183e26e1..c7a7754de 100644
--- a/src/enums/resources/map/blocktype.h
+++ b/src/enums/resources/map/blocktype.h
@@ -27,12 +27,13 @@
enumStart(BlockType)
{
- NONE = -1,
- GROUND = 0,
- WALL = 1,
- AIR = 2,
- WATER = 3,
- GROUNDTOP = 4,
+ NONE = -1,
+ GROUND = 0,
+ WALL = 1,
+ AIR = 2,
+ WATER = 3,
+ GROUNDTOP = 4,
+ PLAYERWALL = 5,
NB_BLOCKTYPES
}
enumEnd(BlockType);
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 8d1bab734..8c605058f 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -153,8 +153,10 @@ void Minimap::setMap(const Map *const map)
return;
}
const int size = surface->h * surface->w;
- const int mask = (BlockMask::WALL | BlockMask::AIR
- | BlockMask::WATER);
+ const int mask = (BlockMask::WALL |
+ BlockMask::AIR |
+ BlockMask::WATER |
+ BlockMask::PLAYERWALL);
for (int ptr = 0; ptr < size; ptr ++)
{
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index e86c0c2a4..073adb2ed 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -591,6 +591,7 @@ void Map::drawCollision(Graphics *restrict const graphics,
fillCollision(BlockMask::AIR, AIR_COLLISION_HIGHLIGHT);
fillCollision(BlockMask::WATER, WATER_COLLISION_HIGHLIGHT);
fillCollision(BlockMask::GROUNDTOP, GROUNDTOP_COLLISION_HIGHLIGHT);
+ fillCollision(BlockMask::PLAYERWALL, COLLISION_HIGHLIGHT);
}
}
}
@@ -709,6 +710,9 @@ void Map::addBlockMask(const int x, const int y,
case BlockType::GROUNDTOP:
mMetaTiles[tileNum].blockmask |= BlockMask::GROUNDTOP;
break;
+ case BlockType::PLAYERWALL:
+ mMetaTiles[tileNum].blockmask |= BlockMask::PLAYERWALL;
+ break;
default:
case BlockType::NONE:
case BlockType::NB_BLOCKTYPES:
@@ -742,6 +746,9 @@ void Map::setBlockMask(const int x, const int y,
case BlockType::GROUNDTOP:
mMetaTiles[tileNum].blockmask = BlockMask::GROUNDTOP;
break;
+ case BlockType::PLAYERWALL:
+ mMetaTiles[tileNum].blockmask = BlockMask::PLAYERWALL;
+ break;
default:
case BlockType::NONE:
case BlockType::NB_BLOCKTYPES:
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index c658b9b30..5abc9c964 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -77,7 +77,8 @@ class Map final : public Properties,
COLLISION_AIR = 2, // air units can walk
COLLISION_WATER = 3, // water units can walk
COLLISION_GROUNDTOP = 4, // no collision (chair, bed, etc)
- COLLISION_MAX = 5 // count index
+ COLLISION_PLAYER_WALL = 5, // full collision for player
+ COLLISION_MAX = 6 // count index
};
/**
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index d1cf92396..51040a5e7 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -575,6 +575,9 @@ inline static void setTile(Map *const map,
case Map::COLLISION_GROUNDTOP:
map->addBlockMask(x, y, BlockType::GROUNDTOP);
break;
+ case Map::COLLISION_PLAYER_WALL:
+ map->addBlockMask(x, y, BlockType::PLAYERWALL);
+ break;
default:
break;
}