aboutsummaryrefslogtreecommitdiff
path: root/gui/dialog.cpp
diff options
context:
space:
mode:
authorMax Horn2002-07-18 20:26:35 +0000
committerMax Horn2002-07-18 20:26:35 +0000
commit6e6c3c3c962b403a89b80e38cd3702413bc6c4af (patch)
tree6e1b58ace59706672ecd34379f7728a273c2d4fb /gui/dialog.cpp
parentd66c9ea2b23ce4476783ddc7e1622fb6767b2cca (diff)
downloadscummvm-rg350-6e6c3c3c962b403a89b80e38cd3702413bc6c4af.tar.gz
scummvm-rg350-6e6c3c3c962b403a89b80e38cd3702413bc6c4af.tar.bz2
scummvm-rg350-6e6c3c3c962b403a89b80e38cd3702413bc6c4af.zip
put stuff in util.h into namespace ScummVM; fixed stupid bug in String class; took painelf's patch which implements save/load dialog in new GUI and fixed it slightly; various other minor changes
svn-id: r4591
Diffstat (limited to 'gui/dialog.cpp')
-rw-r--r--gui/dialog.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 03b19b5062..d0bd4dfe2b 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -24,6 +24,7 @@
#include "newgui.h"
#include "dialog.h"
#include "widget.h"
+#include "scumm.h"
#include "ListWidget.h"
Dialog::~Dialog()
@@ -248,6 +249,15 @@ enum {
kQuitCmd = 'QUIT'
};
+/*
+ * TODO
+ * - Maybe go back to the old way of differentiating between the save and the load mode?
+ * This would include that in the load mode the list is not editable.
+ * - Currently the savegame list is only loaded once when the dialog is created. Instead,
+ * it should be loaded whenever the dialog is opened. Might want to add an open()
+ * method to Dialog for that.
+ */
+
SaveLoadDialog::SaveLoadDialog(NewGui *gui)
: Dialog (gui, 30, 20, 260, 124)
{
@@ -269,16 +279,41 @@ SaveLoadDialog::SaveLoadDialog(NewGui *gui)
// FIXME - test
_savegameList = new ListWidget(this, 10, 40, 180, 74);
+
+ // Get savegame names
+ ScummVM::StringList l;
+ char name[32];
+ Scumm *s = _gui->getScumm();
+
+ for (int i = 0; i <= 80; i++) { // 80 I got from old gui
+ s->getSavegameName(i, name);
+ l.push_back(name);
+ }
+
+ ((ListWidget *)_savegameList)->setList(l);
}
void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
{
switch (cmd) {
case kSaveCmd:
- //printf("Saving game in slot %d\n", _savegameList->getSelected());
+ if (_savegameList->getSelectedString()[0] != 0) {
+ Scumm *s = _gui->getScumm();
+ s->_saveLoadSlot = _savegameList->getSelected();
+ s->_saveLoadCompatible = false;
+ s->_saveLoadFlag = 1; // 1 for save, I assume (Painelf)
+ strcpy(s->_saveLoadName, _savegameList->getSelectedString());
+ close();
+ }
break;
case kLoadCmd:
- //printf("Loading game in slot %d\n", _savegameList->getSelected());
+ if (_savegameList->getSelectedString()[0] != 0) {
+ Scumm *s = _gui->getScumm();
+ s->_saveLoadSlot = _savegameList->getSelected();
+ s->_saveLoadCompatible = false;
+ s->_saveLoadFlag = 2; // 2 for load. Magic number anyone?
+ close();
+ }
break;
case kPlayCmd:
close();