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 | |
parent | b1753d59caa299c668b9c269e87f96c46e0ab33a (diff) | |
download | plus-ac8a0111677c27779b2e7effe8ffe42ea013eb57.tar.gz plus-ac8a0111677c27779b2e7effe8ffe42ea013eb57.tar.bz2 plus-ac8a0111677c27779b2e7effe8ffe42ea013eb57.tar.xz plus-ac8a0111677c27779b2e7effe8ffe42ea013eb57.zip |
Add monster wall collision type.
-rw-r--r-- | src/enums/gui/usercolorid.h | 1 | ||||
-rw-r--r-- | src/enums/resources/map/blockmask.h | 13 | ||||
-rw-r--r-- | src/enums/resources/map/blocktype.h | 15 | ||||
-rw-r--r-- | src/gui/userpalette.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_colors.cpp | 2 | ||||
-rw-r--r-- | src/navigationmanager.cpp | 5 | ||||
-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 |
11 files changed, 54 insertions, 26 deletions
diff --git a/src/enums/gui/usercolorid.h b/src/enums/gui/usercolorid.h index 3da13ea42..31be98e43 100644 --- a/src/enums/gui/usercolorid.h +++ b/src/enums/gui/usercolorid.h @@ -79,6 +79,7 @@ enumStart(UserColorId) COLLISION_HIGHLIGHT, AIR_COLLISION_HIGHLIGHT, WATER_COLLISION_HIGHLIGHT, + MONSTER_COLLISION_HIGHLIGHT, GROUNDTOP_COLLISION_HIGHLIGHT, WALKABLE_HIGHLIGHT, NET, diff --git a/src/enums/resources/map/blockmask.h b/src/enums/resources/map/blockmask.h index f5b5b25e0..02b6b5fe9 100644 --- a/src/enums/resources/map/blockmask.h +++ b/src/enums/resources/map/blockmask.h @@ -27,12 +27,13 @@ namespace BlockMask { enum BlockMask { - WALL = 0x80, // 1000 0000 - AIR = 0x04, // 0000 0100 - WATER = 0x08, // 0000 1000 - GROUND = 0x10, // 0001 0000 - GROUNDTOP = 0x20, // 0010 0000 - PLAYERWALL = 0x40 // 0100 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 + MONSTERWALL = 0x80 // 1000 0000 }; } // namespace BlockMask diff --git a/src/enums/resources/map/blocktype.h b/src/enums/resources/map/blocktype.h index c7a7754de..54895fd4a 100644 --- a/src/enums/resources/map/blocktype.h +++ b/src/enums/resources/map/blocktype.h @@ -27,13 +27,14 @@ enumStart(BlockType) { - NONE = -1, - GROUND = 0, - WALL = 1, - AIR = 2, - WATER = 3, - GROUNDTOP = 4, - PLAYERWALL = 5, + NONE = -1, + GROUND = 0, + WALL = 1, + AIR = 2, + WATER = 3, + GROUNDTOP = 4, + PLAYERWALL = 5, + MONSTERWALL = 6, NB_BLOCKTYPES } enumEnd(BlockType); diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index ac0049b87..73690c742 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -84,6 +84,7 @@ const std::string ColorTypeNames[CAST_SIZE( "ColorCollisionHighlight", "ColorCollisionAirHighlight", "ColorCollisionWaterHighlight", + "ColorCollisionMonsterHighlight", "ColorCollisionGroundtopHighlight", "ColorWalkableTileHighlight", "ColorNet", @@ -384,6 +385,12 @@ UserPalette::UserPalette() : // TRANSLATORS: palette color _("Water collision highlight"), 64); + addColor(UserColorId::MONSTER_COLLISION_HIGHLIGHT, + 0x2050e0, + GradientType::STATIC, + // TRANSLATORS: palette color + _("Monster collision highlight"), + 64); addColor(UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT, 0xffff00, GradientType::STATIC, diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index d2f38f745..9036356ba 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -294,6 +294,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) { case UserColorId::AIR_COLLISION_HIGHLIGHT: case UserColorId::WATER_COLLISION_HIGHLIGHT: + case UserColorId::MONSTER_COLLISION_HIGHLIGHT: case UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT: case UserColorId::COLLISION_HIGHLIGHT: case UserColorId::PORTAL_HIGHLIGHT: @@ -344,6 +345,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) case UserColorId::HOME_PLACE_BORDER: case UserColorId::AIR_COLLISION_HIGHLIGHT: case UserColorId::WATER_COLLISION_HIGHLIGHT: + case UserColorId::MONSTER_COLLISION_HIGHLIGHT: case UserColorId::GROUNDTOP_COLLISION_HIGHLIGHT: case UserColorId::COLLISION_HIGHLIGHT: case UserColorId::WALKABLE_HIGHLIGHT: diff --git a/src/navigationmanager.cpp b/src/navigationmanager.cpp index d69c62389..3a5f72f47 100644 --- a/src/navigationmanager.cpp +++ b/src/navigationmanager.cpp @@ -26,8 +26,9 @@ #include "debug.h" -static const int blockWalkMask = (BlockMask::WALL | BlockMask::AIR - | BlockMask::WATER); +static const int blockWalkMask = (BlockMask::WALL | + BlockMask::AIR | + BlockMask::WATER); #ifndef DYECMD namespace 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; } |