From: Daniel Karbach Date: Fri, 10 Aug 2012 11:06:33 +0000 (+0200) Subject: offset target selection cursor from indicator X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=4356621a6440ac915dd0d2dfc70d2c17c3ff321a;p=l2e.git offset target selection cursor from indicator --- diff --git a/src/battle/states/SelectTarget.cpp b/src/battle/states/SelectTarget.cpp index dedf8e7..9c50991 100644 --- a/src/battle/states/SelectTarget.cpp +++ b/src/battle/states/SelectTarget.cpp @@ -90,7 +90,8 @@ void SelectTarget::Render(SDL_Surface *screen) { void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector &offset) { // TODO: this should be related to the enemy's width - Vector cursorOffset(0, 0); + // offset the cursor by 1/8th to the left and bottom + Vector cursorOffset(cursorIcon->Width() / -8, cursorIcon->Height() / 8); Vector indicatorOffset(0, 0); vector > positions; if (selection->TargetsEnemies()) { @@ -100,6 +101,8 @@ void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector::size_type i(0), end(battle->Heroes().size()); i < end; ++i) { Vector positionCorrection(cursorIcon->Width() / 2, battle->HeroTagAt(i).HeroSprite()->Height() - cursorIcon->Height() / 2); + // indicator offsets are inverted for heroes + positionCorrection -= cursorOffset; positions.push_back(battle->HeroTagPositionAt(i) + battle->HeroTagAt(i).HeroOffset() + positionCorrection); } } diff --git a/test-data/targeting-icons.png b/test-data/targeting-icons.png index c0e56fa..f437c10 100644 Binary files a/test-data/targeting-icons.png and b/test-data/targeting-icons.png differ