]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectTarget.cpp
changed battle positions from bottom-center to center
[l2e.git] / src / battle / states / SelectTarget.cpp
index 8fe31cd60dad1e1953c3460d86f4998870158969..25838571162f0aa45e58ff88012063ce0024ade6 100644 (file)
@@ -90,9 +90,9 @@ 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
-       // 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<int> cursorOffset(cursorIcon->Width() / -2, cursorIcon->Height());
+       // offset the indicator by 1/8th to the right and top
+       Vector<int> indicatorOffset(cursorOffset + Vector<int>(cursorIcon->Width() / 8, cursorIcon->Height() / -8));
        vector<Point<int> > positions;
        if (selection->TargetsEnemies()) {
                for (vector<Point<int> >::const_iterator i(battle->MonsterPositions().begin()), end(battle->MonsterPositions().end()); i != end; ++i) {
@@ -100,16 +100,13 @@ void SelectTarget::RenderCursors(SDL_Surface *screen, const geometry::Vector<int
                }
        } else {
                for (int i(0), end(battle->NumHeroes()); 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);
+                       positions.push_back(battle->HeroTagPositionAt(i) + battle->HeroTagAt(i).HeroOffset());
                }
        }
        if (flipFlop) {
                for (vector<Point<int> >::size_type i(0); i < positions.size(); ++i) {
                        if (selection->IsSelected(i)) {
-                               cursorIcon->DrawTopRight(screen, positions[i] + offset);
+                               cursorIcon->DrawTopRight(screen, positions[i] + indicatorOffset + offset);
                        }
                }
        }