]> git.localhorst.tv Git - l2e.git/commitdiff
offset target selection cursor from indicator
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 10 Aug 2012 11:06:33 +0000 (13:06 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 10 Aug 2012 11:06:33 +0000 (13:06 +0200)
src/battle/states/SelectTarget.cpp
test-data/targeting-icons.png

index dedf8e77b193ce3f78bea9e67db1082752722af2..9c50991bf00c26b9deb34acc83b61f3b4f4b7152 100644 (file)
@@ -90,7 +90,8 @@ void SelectTarget::Render(SDL_Surface *screen) {
 
 void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector<int> &offset) {
        // TODO: this should be related to the enemy's width
-       Vector<int> cursorOffset(0, 0);
+       // offset the cursor by 1/8th to the left and bottom
+       Vector<int> cursorOffset(cursorIcon->Width() / -8, cursorIcon->Height() / 8);
        Vector<int> indicatorOffset(0, 0);
        vector<Point<int> > positions;
        if (selection->TargetsEnemies()) {
@@ -100,6 +101,8 @@ void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector<int
        } else {
                for (vector<Hero>::size_type i(0), end(battle->Heroes().size()); i < end; ++i) {
                        Vector<int> 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);
                }
        }
index c0e56fa83adda1b1386bbf9564296876c24d65af..f437c107bdd4e812d8794814976e323fdd625462 100644 (file)
Binary files a/test-data/targeting-icons.png and b/test-data/targeting-icons.png differ