+ ((selected - start) / cols) * RowHeight());
+ // This fixes the position of the third column of the inventory and capsule menus.
+ if (thirdColumnHack && selected % cols == 2) {
+ cursorOffset += math::Vector<int>(font->CharWidth() * thirdColumnHack, 0);
+ }
+ switch (state) {
+ case STATE_INACTIVE:
+ break;
+ case STATE_ACTIVE:
+ DrawCursor(dest, position + cursorOffset);
+ break;
+ case STATE_SELECTED:
+ DrawSelectedCursor(dest, position + cursorOffset);
+ break;
+ case STATE_DUAL:
+ DrawCursor(dest, position + cursorOffset
+ - math::Vector<int>(selectedCursor->Width(), 0));
+ if (secondarySelection >= start && secondarySelection <= end) {
+ math::Vector<int> secondaryOffset(
+ (secondarySelection % cols) * (ColWidth() + colGap) - cursor->Width(),
+ ((secondarySelection - start) / cols) * RowHeight());
+ DrawSelectedCursor(dest, position + secondaryOffset);
+ }
+ break;
+ }
+}
+
+template<class T>
+void Menu<T>::DrawCursor(
+ SDL_Surface *dest,
+ const math::Vector<int> &position) const {
+ if (animation.Running()) {
+ animation.Draw(dest, position);
+ } else {
+ cursor->Draw(dest, position);
+ }
+}
+
+template<class T>
+void Menu<T>::DrawSelectedCursor(
+ SDL_Surface *dest,
+ const math::Vector<int> &position) const {
+ if (selectedAnimation.Running()) {
+ selectedAnimation.Draw(dest, position);
+ } else {
+ selectedCursor->Draw(dest, position);
+ }