aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorNeeraj Kumar2010-06-08 17:24:29 +0000
committerNeeraj Kumar2010-06-08 17:24:29 +0000
commit207a5e0779de9f0002b0b1984bde90ce6597e1f2 (patch)
tree98883ef89261afd4288f6dadbffe436d5d966dfc /engines/scumm
parente00e94ae18aeb1ed460476f822e20b5bdfe171a4 (diff)
parent356728dab7f2c4cedf73684d7fe3b968be7396fd (diff)
downloadscummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.tar.gz
scummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.tar.bz2
scummvm-rg350-207a5e0779de9f0002b0b1984bde90ce6597e1f2.zip
updated my outdate copy of trunk, added couple of more tests in gfxtests
svn-id: r49510
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/charset.cpp2
-rw-r--r--engines/scumm/debugger.cpp2
-rw-r--r--engines/scumm/dialogs.cpp213
-rw-r--r--engines/scumm/dialogs.h24
-rw-r--r--engines/scumm/he/resource_he.cpp4
-rw-r--r--engines/scumm/input.cpp2
-rw-r--r--engines/scumm/scumm-md5.h5
-rw-r--r--engines/scumm/scumm.cpp18
-rw-r--r--engines/scumm/scumm.h2
9 files changed, 25 insertions, 247 deletions
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 757171b24c..0e0c0e129e 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -845,7 +845,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
offsX = offsY = 0;
} else {
uint32 charOffs = READ_LE_UINT32(_fontPtr + chr * 4 + 4);
- assert(charOffs < 0x10000);
+ assert(charOffs < 0x14000);
if (!charOffs)
return;
charPtr = _fontPtr + charOffs;
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index a0975839d6..ea29e25a1f 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -870,7 +870,7 @@ bool ScummDebugger::Cmd_Passcode(int argc, const char **argv) {
_detach_now = true;
} else {
- DebugPrintf("Use 'passcode <SEGA CD Passcode>'\n");
+ DebugPrintf("Current Passcode is %d \nUse 'passcode <SEGA CD Passcode>'\n",_vm->_scummVars[411]);
return true;
}
return false;
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 1f153094c1..d9c24ddca2 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -233,19 +233,6 @@ protected:
#endif
-class ConfigDialog : public GUI::OptionsDialog {
-protected:
-#ifdef SMALL_SCREEN_DEVICE
- GUI::Dialog *_keysDialog;
-#endif
-
-public:
- ConfigDialog();
- ~ConfigDialog();
-
- virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
-};
-
#pragma mark -
ScummDialog::ScummDialog(int x, int y, int w, int h) : GUI::Dialog(x, y, w, h) {
@@ -258,223 +245,31 @@ ScummDialog::ScummDialog(String name) : GUI::Dialog(name) {
#pragma mark -
-enum {
- kSaveCmd = 'SAVE',
- kLoadCmd = 'LOAD',
- kPlayCmd = 'PLAY',
- kOptionsCmd = 'OPTN',
- kHelpCmd = 'HELP',
- kAboutCmd = 'ABOU',
- kQuitCmd = 'QUIT',
- kChooseCmd = 'CHOS'
-};
-
-ScummMenuDialog::ScummMenuDialog(ScummEngine *scumm)
- : ScummDialog("ScummMain"), _vm(scumm) {
-
- new GUI::ButtonWidget(this, "ScummMain.Resume", "Resume", kPlayCmd, 'P');
-
- _loadButton = new GUI::ButtonWidget(this, "ScummMain.Load", "Load", kLoadCmd, 'L');
- _saveButton = new GUI::ButtonWidget(this, "ScummMain.Save", "Save", kSaveCmd, 'S');
-
- new GUI::ButtonWidget(this, "ScummMain.Options", "Options", kOptionsCmd, 'O');
#ifndef DISABLE_HELP
- new GUI::ButtonWidget(this, "ScummMain.Help", "Help", kHelpCmd, 'H');
-#endif
- new GUI::ButtonWidget(this, "ScummMain.About", "About", kAboutCmd, 'A');
-
- new GUI::ButtonWidget(this, "ScummMain.Quit", "Quit", kQuitCmd, 'Q');
- //
- // Create the sub dialog(s)
- //
- _aboutDialog = new GUI::AboutDialog();
- _optionsDialog = new ConfigDialog();
-#ifndef DISABLE_HELP
+ScummMenuDialog::ScummMenuDialog(ScummEngine *scumm)
+ : MainMenuDialog(scumm) {
_helpDialog = new HelpDialog(scumm->_game);
-#endif
- _saveDialog = new GUI::SaveLoadChooser("Save game:", "Save");
- _saveDialog->setSaveMode(true);
- _loadDialog = new GUI::SaveLoadChooser("Load game:", "Load");
- _loadDialog->setSaveMode(false);
+ _helpButton->setEnabled(true);
}
ScummMenuDialog::~ScummMenuDialog() {
- delete _aboutDialog;
- delete _optionsDialog;
-#ifndef DISABLE_HELP
delete _helpDialog;
-#endif
- delete _saveDialog;
- delete _loadDialog;
-}
-
-int ScummMenuDialog::runModal() {
- _loadButton->setEnabled(_vm->canLoadGameStateCurrently());
- _saveButton->setEnabled(_vm->canSaveGameStateCurrently());
- return ScummDialog::runModal();
-}
-
-void ScummMenuDialog::reflowLayout() {
- _loadButton->setEnabled(_vm->canLoadGameStateCurrently());
- _saveButton->setEnabled(_vm->canSaveGameStateCurrently());
- Dialog::reflowLayout();
}
void ScummMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
- case kSaveCmd:
- save();
- break;
- case kLoadCmd:
- load();
- break;
- case kPlayCmd:
- close();
- break;
- case kOptionsCmd:
- _optionsDialog->runModal();
- break;
- case kAboutCmd:
- _aboutDialog->runModal();
- break;
-#ifndef DISABLE_HELP
case kHelpCmd:
_helpDialog->runModal();
break;
-#endif
- case kQuitCmd:
- _vm->quitGame();
- close();
- break;
default:
- ScummDialog::handleCommand(sender, cmd, data);
- }
-}
-
-void ScummMenuDialog::save() {
- Common::String gameId = ConfMan.get("gameid");
-
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(gameId, &plugin);
-
- int idx = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName());
- if (idx >= 0) {
- String result(_saveDialog->getResultString());
- char buffer[20];
- const char *str;
- if (result.empty()) {
- // If the user was lazy and entered no save name, come up with a default name.
- sprintf(buffer, "Save %d", idx);
- str = buffer;
- } else
- str = result.c_str();
- _vm->requestSave(idx, str);
- close();
- }
-}
-
-void ScummMenuDialog::load() {
- Common::String gameId = ConfMan.get("gameid");
-
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(gameId, &plugin);
-
- int idx = _loadDialog->runModal(plugin, ConfMan.getActiveDomainName());
- if (idx >= 0) {
- _vm->requestLoad(idx);
- close();
+ MainMenuDialog::handleCommand(sender, cmd, data);
}
}
#pragma mark -
enum {
- kKeysCmd = 'KEYS'
-};
-
-// FIXME: We use the empty string as domain name here. This tells the
-// ConfigManager to use the 'default' domain for all its actions. We do that
-// to get as close as possible to editing the 'active' settings.
-//
-// However, that requires bad & evil hacks in the ConfigManager code,
-// and even then still doesn't work quite correctly.
-// For example, if the transient domain contains 'false' for the 'fullscreen'
-// flag, but the user used a hotkey to switch to windowed mode, then the dialog
-// will display the wrong value anyway.
-//
-// Proposed solution consisting of multiple steps:
-// 1) Add special code to the open() code that reads out everything stored
-// in the transient domain that is controlled by this dialog, and updates
-// the dialog accordingly.
-// 2) Even more code is added to query the backend for current settings, like
-// the fullscreen mode flag etc., and also updates the dialog accordingly.
-// 3) The domain being edited is set to the active game domain.
-// 4) If the dialog is closed with the "OK" button, then we remove everything
-// stored in the transient domain (or at least everything corresponding to
-// switches in this dialog.
-// If OTOH the dialog is closed with "Cancel" we do no such thing.
-//
-// These changes will achieve two things at once: Allow us to get rid of using
-// "" as value for the domain, and in fact provide a somewhat better user
-// experience at the same time.
-ConfigDialog::ConfigDialog()
- : GUI::OptionsDialog("", "ScummConfig") {
-
- //
- // Sound controllers
- //
-
- addVolumeControls(this, "ScummConfig.");
-
- //
- // Some misc options
- //
-
- // SCUMM has a talkspeed range of 0-9
- addSubtitleControls(this, "ScummConfig.", 9);
-
- //
- // Add the buttons
- //
-
- new GUI::ButtonWidget(this, "ScummConfig.Ok", "OK", GUI::kOKCmd, 'O');
- new GUI::ButtonWidget(this, "ScummConfig.Cancel", "Cancel", GUI::kCloseCmd, 'C');
-#ifdef SMALL_SCREEN_DEVICE
- new GUI::ButtonWidget(this, "ScummConfig.Keys", "Keys", kKeysCmd, 'K');
- _keysDialog = NULL;
-#endif
-}
-
-ConfigDialog::~ConfigDialog() {
-#ifdef SMALL_SCREEN_DEVICE
- delete _keysDialog;
-#endif
-}
-
-void ConfigDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
- switch (cmd) {
- case kKeysCmd:
-#ifdef SMALL_SCREEN_DEVICE
- //
- // Create the sub dialog(s)
- //
- _keysDialog = new GUI::KeysDialog();
- _keysDialog->runModal();
- delete _keysDialog;
- _keysDialog = NULL;
-#endif
- break;
- default:
- GUI::OptionsDialog::handleCommand (sender, cmd, data);
- }
-}
-
-#ifndef DISABLE_HELP
-
-#pragma mark -
-
-enum {
kNextCmd = 'NEXT',
kPrevCmd = 'PREV'
};
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index 7889027dcf..41a8ec83c1 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -27,9 +27,8 @@
#include "common/str.h"
#include "gui/dialog.h"
-#include "gui/options.h"
#include "gui/widget.h"
-#include "gui/saveload.h"
+#include "engines/dialogs.h"
#include "scumm/detection.h"
@@ -52,32 +51,17 @@ protected:
typedef Common::String String;
};
-class ScummMenuDialog : public ScummDialog {
+#ifndef DISABLE_HELP
+class ScummMenuDialog : public MainMenuDialog {
public:
ScummMenuDialog(ScummEngine *scumm);
~ScummMenuDialog();
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
- virtual void reflowLayout();
-
- int runModal();
protected:
- ScummEngine *_vm;
-
- GUI::Dialog *_aboutDialog;
- GUI::Dialog *_optionsDialog;
-#ifndef DISABLE_HELP
GUI::Dialog *_helpDialog;
-#endif
- GUI::SaveLoadChooser *_saveDialog;
- GUI::SaveLoadChooser *_loadDialog;
-
- GUI::ButtonWidget *_loadButton;
- GUI::ButtonWidget *_saveButton;
-
- void save();
- void load();
};
+#endif
/**
* A dialog which displays an arbitrary message to the user and returns
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 886ee99e57..c259c3ffd2 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -633,8 +633,10 @@ Win32ResExtractor::WinResource *Win32ResExtractor::list_pe_resources(WinLibrary
wr[c].children = fi->first_resource + (FROM_LE_32(dirent[c].offset_to_data) & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY);
/* fill in wr->id, wr->numeric_id */
- if (!decode_pe_resource_id(fi, wr + c, FROM_LE_32(dirent[c].name)))
+ if (!decode_pe_resource_id(fi, wr + c, FROM_LE_32(dirent[c].name))) {
+ free(wr);
return NULL;
+ }
}
return wr;
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 8a9570f534..dc3a5d26b3 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -508,7 +508,7 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) {
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);
- scummMenuDialog(); // Display GUI
+ openMainMenuDialog(); // Display global main menu
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0);
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index 9b7e0798eb..cc382d9621 100644
--- a/engines/scumm/scumm-md5.h
+++ b/engines/scumm/scumm-md5.h
@@ -1,5 +1,5 @@
/*
- This file was generated by the md5table tool on Sun May 9 20:53:55 2010
+ This file was generated by the md5table tool on Mon May 24 13:24:24 2010
DO NOT EDIT MANUALLY!
*/
@@ -170,11 +170,13 @@ static const MD5Table md5table[] = {
{ "3af61c5edf8e15b43dbafd285b2e9777", "puttcircus", "", "Demo", -1, Common::HE_ISR, Common::kPlatformWindows },
{ "3b301b7892f883ce42ab4be6a274fea6", "samnmax", "Floppy", "Floppy", -1, Common::EN_ANY, Common::kPlatformPC },
{ "3b832f4a90740bf22e9b8ed42ca0128c", "freddi4", "HE 99", "", -1, Common::EN_GRB, Common::kPlatformWindows },
+ { "3c4c471342bd95505a42334367d8f127", "puttmoon", "HE 70", "", 12161, Common::RU_RUS, Common::kPlatformWindows },
{ "3cce1913a3bc586b51a75c3892ff18dd", "indy3", "VGA", "VGA", -1, Common::RU_RUS, Common::kPlatformPC },
{ "3d219e7546039543307b55a91282bf18", "funpack", "", "", -1, Common::EN_ANY, Common::kPlatformPC },
{ "3de99ef0523f8ca7958faa3afccd035a", "spyfox", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "3df6ead57930488bc61e6e41901d0e97", "fbear", "HE 62", "", -1, Common::EN_ANY, Common::kPlatformMacintosh },
{ "3e48298920fab9b7aec5a971e1bd1fab", "pajama3", "", "Demo", -1, Common::EN_GRB, Common::kPlatformWindows },
+ { "3e861421f494711bc6f619d4aba60285", "airport", "", "", 93231, Common::RU_RUS, Common::kPlatformWindows },
{ "40564ec47da48a67787d1f9bd043902a", "maniac", "V2 Demo", "V2 Demo", 1988, Common::EN_ANY, Common::kPlatformPC },
{ "4167a92a1d46baa4f4127d918d561f88", "tentacle", "", "CD", 7932, Common::EN_ANY, Common::kPlatformUnknown },
{ "41958e24d03181ff9a381a66d048a581", "ft", "", "", -1, Common::PT_BRA, Common::kPlatformUnknown },
@@ -243,6 +245,7 @@ static const MD5Table md5table[] = {
{ "5bd335265a61caa3d78956ad9f88ba23", "football", "", "Demo", -1, Common::EN_ANY, Common::kPlatformUnknown },
{ "5c21fc49aee8f46e58fef21579e614a1", "thinker1", "", "", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "5d88b9d6a88e6f8e90cded9d01b7f082", "loom", "VGA", "VGA", 8307, Common::EN_ANY, Common::kPlatformPC },
+ { "5dda73606533d66a4c3f4f9ea6e842af", "farm", "", "", 87061, Common::RU_RUS, Common::kPlatformWindows },
{ "5e8fb66971a60e523e5afbc4c129c0e8", "socks", "HE 85", "", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "5ebb57234b2fe5c5dff641e00184ad81", "freddi", "HE 73", "", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "5fbe557049892eb4b709d90916ec97ca", "indy3", "EGA", "EGA", 5361, Common::EN_ANY, Common::kPlatformPC },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 2359d4a04f..bb50ce7bb2 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -108,7 +108,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_language(dr.language),
_debugger(0),
_currentScript(0xFF), // Let debug() work on init stage
- _messageDialog(0), _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) {
+ _messageDialog(0), _pauseDialog(0), _versionDialog(0) {
if (_game.platform == Common::kPlatformNES) {
_gdi = new GdiNES(this);
@@ -140,7 +140,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_fileHandle = 0;
-
// Init all vars
_v0ObjectIndex = false;
_v0ObjectInInventory = false;
@@ -152,7 +151,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_sound = NULL;
memset(&vm, 0, sizeof(vm));
_pauseDialog = NULL;
- _scummMenuDialog = NULL;
_versionDialog = NULL;
_fastMode = 0;
_actors = NULL;
@@ -552,6 +550,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
for (int i = 0; i < ARRAYSIZE(debugChannels); ++i)
DebugMan.addDebugChannel(debugChannels[i].flag, debugChannels[i].channel, debugChannels[i].desc);
+#ifndef DISABLE_HELP
+ // Create custom GMM dialog providing a help subdialog
+ assert(!_mainMenuDialog);
+ _mainMenuDialog = new ScummMenuDialog(this);
+#endif
+
g_eventRec.registerRandomSource(_rnd, "scumm");
}
@@ -572,7 +576,6 @@ ScummEngine::~ScummEngine() {
delete _charset;
delete _messageDialog;
delete _pauseDialog;
- delete _scummMenuDialog;
delete _versionDialog;
delete _fileHandle;
@@ -2437,13 +2440,6 @@ void ScummEngine::versionDialog() {
runDialog(*_versionDialog);
}
-void ScummEngine::scummMenuDialog() {
- if (!_scummMenuDialog)
- _scummMenuDialog = new ScummMenuDialog(this);
- runDialog(*_scummMenuDialog);
- syncSoundSettings();
-}
-
void ScummEngine::confirmExitDialog() {
ConfirmDialog d(this, 6);
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 885ab790de..42322ba5a2 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -530,7 +530,6 @@ protected:
Dialog *_pauseDialog;
Dialog *_messageDialog;
Dialog *_versionDialog;
- Dialog *_scummMenuDialog;
virtual int runDialog(Dialog &dialog);
void confirmExitDialog();
@@ -538,7 +537,6 @@ protected:
void pauseDialog();
void messageDialog(const char *message);
void versionDialog();
- void scummMenuDialog();
char displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4);