diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-07 19:16:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-07 19:16:09 +0300 |
commit | ac8a0111677c27779b2e7effe8ffe42ea013eb57 (patch) | |
tree | ade8601cace894f6ce9d6c0833fb6fe6c700b576 /src/resources | |
parent | b1753d59caa299c668b9c269e87f96c46e0ab33a (diff) | |
download | manaverse-ac8a0111677c27779b2e7effe8ffe42ea013eb57.tar.gz manaverse-ac8a0111677c27779b2e7effe8ffe42ea013eb57.tar.bz2 manaverse-ac8a0111677c27779b2e7effe8ffe42ea013eb57.tar.xz manaverse-ac8a0111677c27779b2e7effe8ffe42ea013eb57.zip |
Add monster wall collision type.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/beingcommon.cpp | 5 | ||||
-rw-r--r-- | src/resources/beinginfo.cpp | 7 | ||||
-rw-r--r-- | src/resources/map/map.cpp | 7 | ||||
-rw-r--r-- | src/resources/map/map.h | 15 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 3 |
5 files changed, 26 insertions, 11 deletions
diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp index aba464158..1daae68d5 100644 --- a/src/resources/beingcommon.cpp +++ b/src/resources/beingcommon.cpp @@ -60,7 +60,8 @@ void BeingCommon::readBasicAttributes(BeingInfo *const info, const int allFlags = BlockMask::GROUND | BlockMask::WALL | BlockMask::WATER | - BlockMask::AIR; + BlockMask::AIR | + BlockMask::MONSTERWALL; StringVect tokens; splitToStringVector(tokens, walkStr, ','); FOR_EACH (StringVectCIter, it, tokens) @@ -73,6 +74,8 @@ void BeingCommon::readBasicAttributes(BeingInfo *const info, block |= allFlags; else if (walkStr == "wall") block |= BlockMask::WALL; + else if (walkStr == "monsterwall") + block |= BlockMask::MONSTERWALL; else if (walkStr == "swim" || walkStr == "water") block |= BlockMask::WATER; else if (walkStr == "walkswim" || walkStr == "swimwalk") // legacy diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 605a91ce4..7e48d04ea 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -59,9 +59,10 @@ BeingInfo::BeingInfo() : mAttacks(), mMenu(), mStrings(), - mBlockWalkMask(BlockMask::WALL - | BlockMask::AIR - | BlockMask::WATER), + mBlockWalkMask(BlockMask::WALL | + BlockMask::AIR | + BlockMask::WATER | + BlockMask::MONSTERWALL), mBlockType(BlockType::NONE), mColors(nullptr), mTargetOffsetX(0), diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 073adb2ed..f8780fbf6 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -592,6 +592,7 @@ void Map::drawCollision(Graphics *restrict const graphics, fillCollision(BlockMask::WATER, WATER_COLLISION_HIGHLIGHT); fillCollision(BlockMask::GROUNDTOP, GROUNDTOP_COLLISION_HIGHLIGHT); fillCollision(BlockMask::PLAYERWALL, COLLISION_HIGHLIGHT); + fillCollision(BlockMask::MONSTERWALL, MONSTER_COLLISION_HIGHLIGHT); } } } @@ -713,6 +714,9 @@ void Map::addBlockMask(const int x, const int y, case BlockType::PLAYERWALL: mMetaTiles[tileNum].blockmask |= BlockMask::PLAYERWALL; break; + case BlockType::MONSTERWALL: + mMetaTiles[tileNum].blockmask |= BlockMask::MONSTERWALL; + break; default: case BlockType::NONE: case BlockType::NB_BLOCKTYPES: @@ -749,6 +753,9 @@ void Map::setBlockMask(const int x, const int y, case BlockType::PLAYERWALL: mMetaTiles[tileNum].blockmask = BlockMask::PLAYERWALL; break; + case BlockType::MONSTERWALL: + mMetaTiles[tileNum].blockmask = BlockMask::MONSTERWALL; + break; default: case BlockType::NONE: case BlockType::NB_BLOCKTYPES: diff --git a/src/resources/map/map.h b/src/resources/map/map.h index 5abc9c964..8f7b6dbab 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -72,13 +72,14 @@ class Map final : public Properties, public: enum CollisionTypes { - COLLISION_EMPTY = 0, // no collision - COLLISION_WALL = 1, // full collison - COLLISION_AIR = 2, // air units can walk - COLLISION_WATER = 3, // water units can walk - COLLISION_GROUNDTOP = 4, // no collision (chair, bed, etc) - COLLISION_PLAYER_WALL = 5, // full collision for player - COLLISION_MAX = 6 // count index + COLLISION_EMPTY = 0, // no collision + COLLISION_WALL = 1, // full collison + COLLISION_AIR = 2, // air units can walk + COLLISION_WATER = 3, // water units can walk + COLLISION_GROUNDTOP = 4, // no collision (chair, bed, etc) + COLLISION_PLAYER_WALL = 5, // full collision for player + COLLISION_MONSTER_WALL = 6, // full collision for monster + COLLISION_MAX = 7 // count index }; /** diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 51040a5e7..0b06fb455 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -578,6 +578,9 @@ inline static void setTile(Map *const map, case Map::COLLISION_PLAYER_WALL: map->addBlockMask(x, y, BlockType::PLAYERWALL); break; + case Map::COLLISION_MONSTER_WALL: + map->addBlockMask(x, y, BlockType::MONSTERWALL); + break; default: break; } |