]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/Menu.h
made third column hack of menus configurable
[l2e.git] / src / graphics / Menu.h
index 886e2fd07af5a7bacb4d0c04566bc9824719231f..d83b2a5e9b540801b88128b77f4d41002bc36521 100644 (file)
@@ -28,6 +28,7 @@ struct MenuProperties {
        int charsPerNumber;
        int charsPerAdditionalText;
        int additionalTextGap;
+       int thirdColumnHack;
        char delimiter;
        bool wrapX;
        bool wrapY;
@@ -37,7 +38,7 @@ struct MenuProperties {
        , charsPerEntry(0), rows(1), rowGap(0)
        , iconSpace(0), cols(1), colGap(0)
        , charsPerNumber(0), charsPerAdditionalText(0)
-       , additionalTextGap(0), delimiter(':')
+       , additionalTextGap(0), thirdColumnHack(0), delimiter(':')
        , wrapX(false), wrapY(false) { }
 
        static void CreateTypeDescription();
@@ -241,10 +242,9 @@ void Menu<T>::Draw(SDL_Surface *dest, const geometry::Vector<int> &position) con
                                (i % cols) * (ColWidth() + colGap),
                                (i / cols) * RowHeight());
 
-               // Third column hack!
-               // This fixes the position of the "DROP" item in the inventory menu.
-               if (i % cols == 2) {
-                       iconOffset += geometry::Vector<int>(font->CharWidth(), 0);
+               // This fixes the position of the third column of the inventory and capsule menus.
+               if (thirdColumnHack && i % cols == 2) {
+                       iconOffset += geometry::Vector<int>(font->CharWidth() * thirdColumnHack, 0);
                }
 
                if (entries[start + i].icon) {
@@ -273,10 +273,9 @@ void Menu<T>::Draw(SDL_Surface *dest, const geometry::Vector<int> &position) con
        geometry::Vector<int> cursorOffset(
                        (selected % cols) * (ColWidth() + colGap) - cursor->Width(),
                        ((selected - start) / cols) * RowHeight());
-       // Third column hack!
-       // This fixes the position of the "DROP" item in the inventory menu.
-       if (selected % cols == 2) {
-               cursorOffset += geometry::Vector<int>(font->CharWidth(), 0);
+       // This fixes the position of the third column of the inventory and capsule menus.
+       if (thirdColumnHack && selected % cols == 2) {
+               cursorOffset += geometry::Vector<int>(font->CharWidth() * thirdColumnHack, 0);
        }
        switch (state) {
                case STATE_INACTIVE: