diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-05-09 23:02:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-05-09 23:02:28 +0300 |
commit | 94a9a81d9c6aa9fa287616c8b4bfc5ea86214dcd (patch) | |
tree | a5fd9ec3c5844ce9b8d6b4c63c25c9ded803a6a0 /src/resources | |
parent | 51169702a6fba4626eeae44faa35ebcbf40e5fed (diff) | |
download | mv-94a9a81d9c6aa9fa287616c8b4bfc5ea86214dcd.tar.gz mv-94a9a81d9c6aa9fa287616c8b4bfc5ea86214dcd.tar.bz2 mv-94a9a81d9c6aa9fa287616c8b4bfc5ea86214dcd.tar.xz mv-94a9a81d9c6aa9fa287616c8b4bfc5ea86214dcd.zip |
Impliment air and water block types.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/beinginfo.cpp | 3 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 31 | ||||
-rw-r--r-- | src/resources/monsterdb.cpp | 4 |
3 files changed, 33 insertions, 5 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index d0535ef04..438de46dd 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -33,7 +33,8 @@ BeingInfo::BeingInfo(): mName(_("unnamed")), mTargetCursorSize(ActorSprite::TC_MEDIUM), mWalkMask(Map::BLOCKMASK_WALL | Map::BLOCKMASK_CHARACTER - | Map::BLOCKMASK_MONSTER), + | Map::BLOCKMASK_MONSTER | Map::BLOCKMASK_AIR + | Map::BLOCKMASK_WATER), mBlockType(Map::BLOCKTYPE_CHARACTER), mTargetOffsetX(0), mTargetOffsetY(0), mMaxHP(0), mStaticMaxHP(false) diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 818968621..7fa088326 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -288,6 +288,8 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path) else if (xmlStrEqual(childNode->name, BAD_CAST "properties")) { readProperties(childNode, map); + map->setVersion(atoi(map->getProperty( + "manaplus version").c_str())); } else if (xmlStrEqual(childNode->name, BAD_CAST "objectgroup")) { @@ -407,8 +409,33 @@ inline static void setTile(Map *map, MapLayer *layer, int x, int y, int gid) { // Set collision tile // if (set && (gid - set->getFirstGid() == 1)) buggy update - if (set && (gid - set->getFirstGid() != 0)) - map->blockTile(x, y, Map::BLOCKTYPE_WALL); + if (set) + { + if (map->getVersion() >= 1) + { + switch (gid - set->getFirstGid()) + { + case Map::COLLISION_WALL: + map->blockTile(x, y, Map::BLOCKTYPE_WALL); + break; + case Map::COLLISION_AIR: + logger->log("air: %d, %d", x, y); + map->blockTile(x, y, Map::BLOCKTYPE_AIR); + break; + case Map::COLLISION_WATER: + logger->log("water: %d, %d", x, y); + map->blockTile(x, y, Map::BLOCKTYPE_WATER); + break; + default: + break; + } + } + else + { + if (gid - set->getFirstGid() != 0) + map->blockTile(x, y, Map::BLOCKTYPE_WALL); + } + } } } diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index 9fce60306..5a80b4500 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -71,8 +71,8 @@ void MonsterDB::load() BeingInfo *currentInfo = new BeingInfo; currentInfo->setWalkMask(Map::BLOCKMASK_WALL - | Map::BLOCKMASK_CHARACTER - | Map::BLOCKMASK_MONSTER); + | Map::BLOCKMASK_CHARACTER | Map::BLOCKMASK_MONSTER + | Map::BLOCKMASK_AIR | Map::BLOCKMASK_WATER); currentInfo->setBlockType(Map::BLOCKTYPE_MONSTER); currentInfo->setName(XML::getProperty( |