From 4561ae35f7c2c641e5dd0070b6cd3779dad0275b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 9 May 2011 23:18:39 +0300 Subject: Add drawing colors for new collision types. --- src/map.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 7 deletions(-) (limited to 'src/map.cpp') 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)); + } } } } -- cgit v1.2.3-70-g09d2