From 6e6c3c3c962b403a89b80e38cd3702413bc6c4af Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 18 Jul 2002 20:26:35 +0000 Subject: 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 --- gui/dialog.cpp | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'gui/dialog.cpp') 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(); -- cgit v1.2.3