diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-05-21 03:07:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-05-21 03:07:34 +0300 |
commit | 61350cc4f65d53dd3add0c15558f6017b18ddbea (patch) | |
tree | dccde6c12fec3d5d9bfcfc25c48f7a5869b3f8ef /src/resources/monsterdb.cpp | |
parent | d2e83863e6e5faa6d6eeb3ab0c0a384dac3a0a11 (diff) | |
download | manaplus-61350cc4f65d53dd3add0c15558f6017b18ddbea.tar.gz manaplus-61350cc4f65d53dd3add0c15558f6017b18ddbea.tar.bz2 manaplus-61350cc4f65d53dd3add0c15558f6017b18ddbea.tar.xz manaplus-61350cc4f65d53dd3add0c15558f6017b18ddbea.zip |
Add monster walktype attribute to detect on what collisions monster can move.
Diffstat (limited to 'src/resources/monsterdb.cpp')
-rw-r--r-- | src/resources/monsterdb.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index fbd7d10ad..ac5b2c7f9 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -82,16 +82,29 @@ void MonsterDB::load() monsterNode, "name", _("unnamed"))); currentInfo->setTargetCursorSize(XML::getProperty(monsterNode, - "targetCursor", "medium")); + "targetCursor", "medium")); currentInfo->setTargetOffsetX(XML::getProperty(monsterNode, - "targetOffsetX", 0)); + "targetOffsetX", 0)); currentInfo->setTargetOffsetY(XML::getProperty(monsterNode, - "targetOffsetY", 0)); - - currentInfo->setMaxHP(XML::getProperty(monsterNode, - "maxHP", 0)); + "targetOffsetY", 0)); + + currentInfo->setMaxHP(XML::getProperty(monsterNode, "maxHP", 0)); + + unsigned char block = 0; + std::string walkStr = XML::getProperty( + monsterNode, "walkType", "walk"); + if (walkStr == "walk") + block = Map::BLOCKMASK_WATER | Map::BLOCKMASK_AIR; + else if (walkStr == "fly") + block = 0; + else if (walkStr == "swim") + block = Map::BLOCKMASK_GROUND | Map::BLOCKMASK_AIR; + else if (walkStr == "walkswim" || walkStr == "swimwalk") + block = Map::BLOCKMASK_AIR; + + currentInfo->setWalkMask(Map::BLOCKMASK_WALL | block); if (currentInfo->getMaxHP()) currentInfo->setStaticMaxHP(true); |