diff --git a/src/common/HighScoresManager.cxx b/src/common/HighScoresManager.cxx index fbcfa4b55..2fd3e92de 100644 --- a/src/common/HighScoresManager.cxx +++ b/src/common/HighScoresManager.cxx @@ -31,6 +31,7 @@ - variation bits (Centipede) - player bits (Asteroids, Space Invaders) - score swaps (Asteroids) + - one optional and named value extra per game (round, level...) */ #include @@ -282,6 +283,15 @@ Int32 HighScoresManager::player(uInt16 addr, uInt32 numPlayers, bool zeroBased) return player; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Int32 HighScoresManager::numVariations() const +{ + Properties props; + uInt16 vars = numVariations(properties(props)); + + return vars;; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Int32 HighScoresManager::player() const { diff --git a/src/common/HighScoresManager.hxx b/src/common/HighScoresManager.hxx index 5dd2f9062..e66a358d0 100644 --- a/src/common/HighScoresManager.hxx +++ b/src/common/HighScoresManager.hxx @@ -96,6 +96,7 @@ class HighScoresManager const ScoreAddresses& scoreAddr) const; // Retrieve current values (using game's properties) + Int32 numVariations() const; Int32 player() const; Int32 variation() const; Int32 score() const; diff --git a/src/gui/HighScoresDialog.cxx b/src/gui/HighScoresDialog.cxx index 1645ca14c..6ff2b4e20 100644 --- a/src/gui/HighScoresDialog.cxx +++ b/src/gui/HighScoresDialog.cxx @@ -22,6 +22,7 @@ //#include "StringParser.hxx" #include "EditTextWidget.hxx" #include "PopUpWidget.hxx" +#include "HighScoresManager.hxx" #include "HighScoresDialog.hxx" @@ -32,16 +33,16 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent, : Dialog(osystem, parent, font, "High Scores") { const GUI::Font& ifont = instance().frameBuffer().infoFont(); - const int lineHeight = font.getLineHeight(), - fontWidth = font.getMaxCharWidth(), - fontHeight = font.getFontHeight(), - buttonHeight = font.getLineHeight() + 4; + const int lineHeight = font.getLineHeight(); + //fontWidth = font.getMaxCharWidth(), + //fontHeight = font.getFontHeight(), + //buttonHeight = font.getLineHeight() + 4; //infoLineHeight = ifont.getLineHeight(); const int VBORDER = 8; const int HBORDER = 10; const int VGAP = 4; - int xpos, ypos, lwidth, fwidth, pwidth, tabID; + int xpos, ypos; WidgetArray wid; VariantList items; @@ -55,7 +56,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent, StaticTextWidget* s = new StaticTextWidget(this, font, xpos, ypos + 1, "Variation "); myVariation = new PopUpWidget(this, font, s->getRight(), ypos, - font.getStringWidth("256"), lineHeight, items, "", 0, 0); + font.getStringWidth("256") - 4, lineHeight, items, "", 0, 0); ypos += lineHeight + VGAP * 2; @@ -116,10 +117,14 @@ void HighScoresDialog::loadConfig() items.clear(); - for (Int32 i = 1; i <= 10; ++i) - VarList::push_back(items, i, i); + for (Int32 i = 1; i <= instance().highScores().numVariations(); ++i) + { + ostringstream buf; + buf << std::setw(3) << std::setfill(' ') << i; + VarList::push_back(items, buf.str(), i); + } myVariation->addItems(items); - + myVariation->setSelected(instance().highScores().variation()); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/module.mk b/src/gui/module.mk index f550e167d..bb8943e85 100644 --- a/src/gui/module.mk +++ b/src/gui/module.mk @@ -21,6 +21,8 @@ MODULE_OBJS := \ src/gui/GameInfoDialog.o \ src/gui/GlobalPropsDialog.o \ src/gui/HelpDialog.o \ + src/gui/HighScoresDialog.o \ + src/gui/HighScoresMenu.o \ src/gui/InputDialog.o \ src/gui/InputTextDialog.o \ src/gui/JoystickDialog.o \