Skip to content

Commit

Permalink
SCUMM: Add a difficulty selection dialog for Loom FM-Towns.
Browse files Browse the repository at this point in the history
It is in spirit of the DOS version's selection dialog, but it has the
description above the buttons instead of below it.
  • Loading branch information
Johannes Schickel committed Dec 26, 2011
1 parent 63ba398 commit 95cabb0
Show file tree
Hide file tree
Showing 13 changed files with 1,776 additions and 1,587 deletions.
34 changes: 34 additions & 0 deletions engines/scumm/dialogs.cpp
Expand Up @@ -648,4 +648,38 @@ void DebugInputDialog::handleKeyDown(Common::KeyState state) {
}
}

LoomTownsDifficultyDialog::LoomTownsDifficultyDialog()
: Dialog("LoomTownsDifficultyDialog"), _difficulty(-1) {
GUI::StaticTextWidget *text1 = new GUI::StaticTextWidget(this, "LoomTownsDifficultyDialog.Description1", _("Select a Proficiency Level."));
text1->setAlign(Graphics::kTextAlignCenter);
GUI::StaticTextWidget *text2 = new GUI::StaticTextWidget(this, "LoomTownsDifficultyDialog.Description2", _("Refer to your Loom(TM) manual for help."));
text2->setAlign(Graphics::kTextAlignCenter);

new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Standard", _("Standard"), 0, kStandardCmd);
new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Practice", _("Practice"), 0, kPracticeCmd);
new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Expert", _("Expert"), 0, kExpertCmd);
}

void LoomTownsDifficultyDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kStandardCmd:
_difficulty = 1;
close();
break;

case kPracticeCmd:
_difficulty = 0;
close();
break;

case kExpertCmd:
_difficulty = 2;
close();
break;

default:
GUI::Dialog::handleCommand(sender, cmd, data);
}
}

} // End of namespace Scumm
21 changes: 21 additions & 0 deletions engines/scumm/dialogs.h
Expand Up @@ -187,6 +187,27 @@ class DebugInputDialog : public InfoDialog {
Common::String mainText;
};

/**
* Difficulty selection dialog for Loom FM-Towns.
*/
class LoomTownsDifficultyDialog : public GUI::Dialog {
public:
LoomTownsDifficultyDialog();

int getSelectedDifficulty() const { return _difficulty; }
protected:
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);

private:
enum {
kStandardCmd = 'STDD',
kPracticeCmd = 'PRAD',
kExpertCmd = 'EXPD'
};

int _difficulty;
};

} // End of namespace Scumm

#endif
10 changes: 10 additions & 0 deletions engines/scumm/scumm.cpp
Expand Up @@ -1256,6 +1256,16 @@ void ScummEngine::setupScumm() {
// Load game from specified slot, if any
if (ConfMan.hasKey("save_slot")) {
requestLoad(ConfMan.getInt("save_slot"));
} else if (!ConfMan.hasKey("boot_param") && _game.id == GID_LOOM && _game.platform == Common::kPlatformFMTowns) {
// In case we run the Loom FM-Towns version and have no boot parameter
// nor start save game supplied we will show our own custom difficulty
// selection dialog, since the original does not have any.
LoomTownsDifficultyDialog difficultyDialog;
runDialog(difficultyDialog);

int difficulty = difficultyDialog.getSelectedDifficulty();
if (difficulty != -1)
_bootParam = difficulty;
}

_res->allocResTypeData(rtBuffer, 0, 10, kDynamicResTypeMode);
Expand Down
2 changes: 1 addition & 1 deletion gui/ThemeEngine.h
Expand Up @@ -35,7 +35,7 @@
#include "graphics/pixelformat.h"


#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.5"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.6"

class OSystem;

Expand Down

0 comments on commit 95cabb0

Please sign in to comment.