summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-09 23:18:39 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-09 23:24:06 +0300
commit4561ae35f7c2c641e5dd0070b6cd3779dad0275b (patch)
treedc8cbe215e3ca68f15bab5b510931552d3a1f94b /src/map.cpp
parent94a9a81d9c6aa9fa287616c8b4bfc5ea86214dcd (diff)
downloadplus-4561ae35f7c2c641e5dd0070b6cd3779dad0275b.tar.gz
plus-4561ae35f7c2c641e5dd0070b6cd3779dad0275b.tar.bz2
plus-4561ae35f7c2c641e5dd0070b6cd3779dad0275b.tar.xz
plus-4561ae35f7c2c641e5dd0070b6cd3779dad0275b.zip
Add drawing colors for new collision types.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp57
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));
+ }
}
}
}