diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-05-09 23:18:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-05-09 23:24:06 +0300 |
commit | 4561ae35f7c2c641e5dd0070b6cd3779dad0275b (patch) | |
tree | dc8cbe215e3ca68f15bab5b510931552d3a1f94b /src/map.cpp | |
parent | 94a9a81d9c6aa9fa287616c8b4bfc5ea86214dcd (diff) | |
download | manaplus-4561ae35f7c2c641e5dd0070b6cd3779dad0275b.tar.gz manaplus-4561ae35f7c2c641e5dd0070b6cd3779dad0275b.tar.bz2 manaplus-4561ae35f7c2c641e5dd0070b6cd3779dad0275b.tar.xz manaplus-4561ae35f7c2c641e5dd0070b6cd3779dad0275b.zip |
Add drawing colors for new collision types.
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/src/map.cpp b/src/map.cpp index 83143a7c8..d35133bcc 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -684,17 +684,60 @@ void Map::drawCollision(Graphics *graphics, int scrollX, int scrollY, width += 32; x ++; } + if (width && userPalette) + { + graphics->setColor(userPalette->getColorWithAlpha( + UserPalette::COLLISION_HIGHLIGHT)); + + graphics->fillRectangle(gcn::Rectangle( + x0 * mTileWidth - scrollX, + y * mTileHeight - scrollY, + width, 32)); + } } - if (width && userPalette) + if (!getWalk(x, y, BLOCKMASK_AIR)) { - graphics->setColor(userPalette->getColorWithAlpha( - UserPalette::COLLISION_HIGHLIGHT)); + width = 32; + for (int x2 = x + 1; x < endX; x2 ++) + { + if (getWalk(x2, y, BLOCKMASK_AIR)) + break; + width += 32; + x ++; + } + if (width && userPalette) + { + graphics->setColor(userPalette->getColorWithAlpha( + UserPalette::AIR_COLLISION_HIGHLIGHT)); - graphics->fillRectangle(gcn::Rectangle( - x0 * mTileWidth - scrollX, - y * mTileHeight - scrollY, - width, 32)); + graphics->fillRectangle(gcn::Rectangle( + x0 * mTileWidth - scrollX, + y * mTileHeight - scrollY, + width, 32)); + } + } + + if (!getWalk(x, y, BLOCKMASK_WATER)) + { + width = 32; + for (int x2 = x + 1; x < endX; x2 ++) + { + if (getWalk(x2, y, BLOCKMASK_WATER)) + break; + width += 32; + x ++; + } + if (width && userPalette) + { + graphics->setColor(userPalette->getColorWithAlpha( + UserPalette::WATER_COLLISION_HIGHLIGHT)); + + graphics->fillRectangle(gcn::Rectangle( + x0 * mTileWidth - scrollX, + y * mTileHeight - scrollY, + width, 32)); + } } } } |