diff options
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)); + } } } } |