X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FMap.cpp;h=1c55eaf0690a552d470efcbb97a4be5ffe2ca2dd;hb=6e88a625710c7936f87b38ecf6094472f3a49f4f;hp=a9e11df7e9064627cb4388b0696e78eada8c92b8;hpb=0ad5ca97b5df217329bc319d62564a9f46ba11d7;p=l2e.git diff --git a/src/map/Map.cpp b/src/map/Map.cpp index a9e11df..1c55eaf 100644 --- a/src/map/Map.cpp +++ b/src/map/Map.cpp @@ -11,6 +11,7 @@ #include "Tile.h" #include "Trigger.h" #include "../graphics/Sprite.h" +#include "../sdl/utility.h" #include @@ -122,12 +123,29 @@ void Map::RenderDebug(SDL_Surface *dest, const Vector &inOffset) const { } for (int i(0); i < numTriggers; ++i) { Vector offset((triggers[i].TilePosition() * tileset->Size()) + inOffset); - SDL_Rect destRect; - destRect.x = offset.X() + (tileset->Width() / 4); - destRect.y = offset.Y() + (tileset->Height() / 4); - destRect.w = tileset->Width() / 2; - destRect.h = tileset->Height() / 2; - SDL_FillRect(dest, &destRect, SDL_MapRGB(dest->format, 0x00, 0xFF, 0xFF)); + switch (triggers[i].GetType()) { + case Trigger::TYPE_NORTH: + sdl::HorizontalLine(dest, offset + (tileset->Size() / 4), tileset->Width() / 2, SDL_MapRGB(dest->format, 0x00, 0xFF, 0xFF)); + break; + case Trigger::TYPE_EAST: + sdl::VerticalLine(dest, offset + Vector(tileset->Width() * 3 / 4, tileset->Height() / 4), tileset->Height() / 2, SDL_MapRGB(dest->format, 0x00, 0xFF, 0xFF)); + break; + case Trigger::TYPE_SOUTH: + sdl::HorizontalLine(dest, offset + Vector(tileset->Width() / 4, tileset->Height() * 3 / 4), tileset->Width() / 2, SDL_MapRGB(dest->format, 0x00, 0xFF, 0xFF)); + break; + case Trigger::TYPE_WEST: + sdl::VerticalLine(dest, offset + (tileset->Size() / 4), tileset->Width() / 2, SDL_MapRGB(dest->format, 0x00, 0xFF, 0xFF)); + break; + case Trigger::TYPE_CONTACT: { + SDL_Rect destRect; + destRect.x = offset.X() + (tileset->Width() / 4); + destRect.y = offset.Y() + (tileset->Height() / 4); + destRect.w = tileset->Width() / 2; + destRect.h = tileset->Height() / 2; + SDL_FillRect(dest, &destRect, SDL_MapRGB(dest->format, 0x00, 0xFF, 0xFF)); + } + break; + } } }