From 859ef578dc6faa881cab115fd0059a88b6a5899a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 19 Sep 2002 17:44:41 +0000 Subject: moved the Scumm specific dialogs to scumm/dialogs.* svn-id: r4973 --- gui/dialog.cpp | 249 --------------------------------------------------------- gui/dialog.h | 96 +--------------------- gui/newgui.cpp | 88 ++++++++------------ gui/newgui.h | 9 --- 4 files changed, 33 insertions(+), 409 deletions(-) (limited to 'gui') diff --git a/gui/dialog.cpp b/gui/dialog.cpp index e1886af83d..d9c25d15bb 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -24,13 +24,6 @@ #include "newgui.h" #include "dialog.h" #include "widget.h" -#include "ListWidget.h" -#include "config-file.h" - -#include "scumm/sound.h" -#include "sound/mididrv.h" -#include "scumm/scumm.h" -#include "scumm/imuse.h" /* * TODO list @@ -250,250 +243,8 @@ Widget *Dialog::findWidget(int x, int y) return w; } -void Dialog::addResText(int x, int y, int w, int h, int resID) -{ - // Get the string - const char *str = _gui->queryResString(resID); - if (!str) - str = "Dummy!"; - new StaticTextWidget(this, x, y, w, h, str, kTextAlignLeft); -} - void Dialog::addButton(int x, int y, int w, int h, const char *label, uint32 cmd, char hotkey) { new ButtonWidget(this, x, y, w, h, label, cmd, hotkey); } -#pragma mark - - - -enum { - kSaveCmd = 'SAVE', - kLoadCmd = 'LOAD', - kPlayCmd = 'PLAY', - kOptionsCmd = 'OPTN', - 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, Scumm *scumm) - : Dialog (gui, 30, 20, 260, 124), _scumm(scumm) -{ - addResText(10, 7, 240, 16, 1); -// addResText(10, 7, 240, 16, 2); -// addResText(10, 7, 240, 16, 3); - - addButton(200, 20, 54, 16, RES_STRING(4), kSaveCmd, 'S'); // Save - addButton(200, 40, 54, 16, RES_STRING(5), kLoadCmd, 'L'); // Load - addButton(200, 60, 54, 16, RES_STRING(6), kPlayCmd, 'P'); // Play - addButton(200, 80, 54, 16, CUSTOM_STRING(17), kOptionsCmd, 'O'); // Options - addButton(200, 100, 54, 16, RES_STRING(8), kQuitCmd, 'Q'); // Quit - - _savegameList = new ListWidget(this, 10, 20, 180, 90); - _savegameList->setNumberingMode(kListNumberingZero); - - // Get savegame names - ScummVM::StringList l; - char name[32]; - - for (int i = 0; i <= 80; i++) { // 80 - got this value from the old GUI - _scumm->getSavegameName(i, name); - l.push_back(name); - } - - _savegameList->setList(l); -} - -void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) -{ - switch (cmd) { - case kListItemChangedCmd: - case kSaveCmd: - if (_savegameList->getSelected() >= 1 && !_savegameList->getSelectedString().isEmpty()) { - Scumm *s = _scumm; - s->_saveLoadSlot = _savegameList->getSelected(); - s->_saveLoadCompatible = false; - s->_saveLoadFlag = 1; // 1 for save, I assume (Painelf) - strcpy(s->_saveLoadName, _savegameList->getSelectedString().c_str()); - close(); - } - break; - case kListItemDoubleClickedCmd: - case kLoadCmd: - if (_savegameList->getSelected() >= 0 && !_savegameList->getSelectedString().isEmpty()) { - Scumm *s = _scumm; - s->_saveLoadSlot = _savegameList->getSelected(); - s->_saveLoadCompatible = false; - s->_saveLoadFlag = 2; // 2 for load. Magic number anyone? - close(); - } - break; - case kPlayCmd: - close(); - break; - case kOptionsCmd: - _gui->optionsDialog(); - break; - case kQuitCmd: { - _scumm->_system->quit(); - } - break; - default: - Dialog::handleCommand(sender, cmd, data); - } -} - - -#pragma mark - - -enum { - kSoundCmd = 'SOUN', - kKeysCmd = 'KEYS', - kAboutCmd = 'ABOU', - kMiscCmd = 'OPTN' -}; - -OptionsDialog::OptionsDialog(NewGui *gui) - : Dialog (gui, 50, 80, 210, 60) -{ - addButton( 10, 10, 40, 16, CUSTOM_STRING(5), kSoundCmd, 'S'); // Sound - addButton( 80, 10, 40, 16, CUSTOM_STRING(6), kKeysCmd, 'K'); // Keys - addButton(150, 10, 40, 16, CUSTOM_STRING(7), kAboutCmd, 'A'); // About - addButton( 10, 35, 40, 16, CUSTOM_STRING(18), kMiscCmd, 'M'); // Misc - addButton(150, 35, 40, 16, CUSTOM_STRING(23), kCloseCmd, 'C'); // Close dialog - FIXME -} - -void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) -{ - switch (cmd) { - case kSoundCmd: - _gui->soundDialog(); - break; - case kKeysCmd: - break; - case kAboutCmd: - _gui->aboutDialog(); - break; - case kMiscCmd: - break; - default: - Dialog::handleCommand(sender, cmd, data); - } -} - - -#pragma mark - - -AboutDialog::AboutDialog(NewGui *gui) - : Dialog (gui, 30, 20, 260, 124) -{ - addButton(110, 100, 40, 16, CUSTOM_STRING(23), kCloseCmd, 'C'); // Close dialog - FIXME - new StaticTextWidget(this, 10, 10, 240, 16, "ScummVM " SCUMMVM_VERSION " (" SCUMMVM_CVS ")", kTextAlignCenter); - new StaticTextWidget(this, 10, 30, 240, 16, "http://scummvm.sourceforge.net", kTextAlignCenter); - new StaticTextWidget(this, 10, 50, 240, 16, "All games (c) LucasArts", kTextAlignCenter); - new StaticTextWidget(this, 10, 64, 240, 16, "Except", kTextAlignCenter); - new StaticTextWidget(this, 10, 78, 240, 16, "Simon the Sorcerer (c) Adventuresoft", kTextAlignCenter); -} - -PauseDialog::PauseDialog(NewGui *gui) - : Dialog (gui, 50, 80, 220, 16) -{ - addResText(4, 4, 220, 16, 10); -} - -SoundDialog::SoundDialog(NewGui *gui, Scumm *scumm) - : Dialog (gui, 30, 20, 260, 110), _scumm(scumm) -{ - - // set up dialog - addButton(70, 90, 54, 16, "OK", kOKCmd, 'O'); // Confirm dialog - addButton(136, 90, 54, 16, "Cancel", kCancelCmd, 'C'); // Abort dialog - new StaticTextWidget(this, 20, 17, 85, 16, "Master volume:", kTextAlignRight); - new StaticTextWidget(this, 20, 37, 85, 16, "Music volume:", kTextAlignRight); - new StaticTextWidget(this, 20, 57, 85, 16, "SFX volume:", kTextAlignRight); - - masterVolumeSlider = new SliderWidget(this, 110, 13, 80, 16, "Volume1", kMasterVolumeChanged); - musicVolumeSlider = new SliderWidget(this, 110, 33, 80, 16, "Volume2", kMusicVolumeChanged); - sfxVolumeSlider = new SliderWidget(this, 110, 53, 80, 16, "Volume3", kSfxVolumeChanged); - - masterVolumeSlider->setMinValue(0); masterVolumeSlider->setMaxValue(256); - musicVolumeSlider->setMinValue(0); musicVolumeSlider->setMaxValue(256); - sfxVolumeSlider->setMinValue(0); sfxVolumeSlider->setMaxValue(256); - - masterVolumeLabel = new StaticTextWidget(this, 195, 17, 60, 16, "Volume1", kTextAlignLeft); - musicVolumeLabel = new StaticTextWidget(this, 195, 37, 60, 16, "Volume2", kTextAlignLeft); - sfxVolumeLabel = new StaticTextWidget(this, 195, 57, 60, 16, "Volume3", kTextAlignLeft); - - masterVolumeLabel->setFlags(WIDGET_CLEARBG); - musicVolumeLabel->setFlags(WIDGET_CLEARBG); - sfxVolumeLabel->setFlags(WIDGET_CLEARBG); -} - -void SoundDialog::open() -{ - Dialog::open(); - - // get current variables - _soundVolumeMaster = _scumm->_sound->_sound_volume_master; - _soundVolumeMusic = _scumm->_sound->_sound_volume_music; - _soundVolumeSfx = _scumm->_sound->_sound_volume_sfx; - - masterVolumeSlider->setValue(_soundVolumeMaster); - musicVolumeSlider->setValue(_soundVolumeMusic); - sfxVolumeSlider->setValue(_soundVolumeSfx); - - masterVolumeLabel->setValue(_soundVolumeMaster); - musicVolumeLabel->setValue(_soundVolumeMusic); - sfxVolumeLabel->setValue(_soundVolumeSfx); -} - - -void SoundDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) -{ - switch (cmd) { - case kMasterVolumeChanged: - _soundVolumeMaster = masterVolumeSlider->getValue(); - masterVolumeLabel->setValue(_soundVolumeMaster); - masterVolumeLabel->draw(); - break; - case kMusicVolumeChanged: - _soundVolumeMusic = musicVolumeSlider->getValue(); - musicVolumeLabel->setValue(_soundVolumeMusic); - musicVolumeLabel->draw(); - break; - case kSfxVolumeChanged: - _soundVolumeSfx = sfxVolumeSlider->getValue(); - sfxVolumeLabel->setValue(_soundVolumeSfx); - sfxVolumeLabel->draw(); - break; - case kOKCmd: { - // FIXME: Look at Fingolfins comments in Gui::handleSoundDialogCommand(), gui.cpp - _scumm->_sound->_sound_volume_master = _soundVolumeMaster; // Master - _scumm->_sound->_sound_volume_music = _soundVolumeMusic; // Music - _scumm->_sound->_sound_volume_sfx = _soundVolumeSfx; // SFX - - _scumm->_imuse->set_music_volume(_soundVolumeMusic); - _scumm->_imuse->set_master_volume(_soundVolumeMaster); - _scumm->_mixer->setVolume(_soundVolumeSfx); - _scumm->_mixer->setMusicVolume(_soundVolumeMusic); - - scummcfg->setInt("master_volume", _soundVolumeMaster); - scummcfg->setInt("music_volume", _soundVolumeMusic); - scummcfg->setInt("sfx_volume", _soundVolumeSfx); - scummcfg->flush(); - } - case kCancelCmd: - close(); - break; - default: - Dialog::handleCommand(sender, cmd, data); - } -} diff --git a/gui/dialog.h b/gui/dialog.h index 3d1577b9e3..a530a79075 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -22,14 +22,9 @@ #define DIALOG_H #include "scummsys.h" -#include "widget.h" -#include "ListWidget.h" +#include "widget.h" // For CommandReceiver class NewGui; -class Scumm; - -#define RES_STRING(id) _gui->queryResString(id) -#define CUSTOM_STRING(id) _gui->queryCustomString(id) // Some "common" commands sent to handleCommand() enum { @@ -75,96 +70,7 @@ public: protected: Widget* findWidget(int x, int y); // Find the widget at pos x,y if any - void addResText(int x, int y, int w, int h, int resID); void addButton(int x, int y, int w, int h, const char *label, uint32 cmd, char hotkey); }; - -class SaveLoadDialog : public Dialog { -public: - SaveLoadDialog(NewGui *gui, Scumm *scumm); - - virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); - -protected: - Scumm *_scumm; - ListWidget *_savegameList; -}; - - -class AboutDialog : public Dialog { -public: - AboutDialog(NewGui *gui); -}; - -class SoundDialog; -class KeysDialog; -class MiscDialog; - -class OptionsDialog : public Dialog { -protected: - SoundDialog *_soundDialog; - KeysDialog *_keysDialog; - MiscDialog *_miscDialog; - -public: - OptionsDialog(NewGui *gui); - - virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); -}; - -class PauseDialog : public Dialog { -public: - PauseDialog(NewGui *gui); - - virtual void handleMouseDown(int x, int y, int button, int clickCount) - { close(); } - virtual void handleKeyDown(char key, int modifiers) - { - if (key == 32) - close(); - else - Dialog::handleKeyDown(key, modifiers); - } - - // Enforce no transparency! - virtual void setupScreenBuf() {} - virtual void teardownScreenBuf() {} - -}; - - -class SoundDialog : public Dialog { -public: - SoundDialog(NewGui *gui, Scumm *scumm); - - enum { - kMasterVolumeChanged = 'mavc', - kMusicVolumeChanged = 'muvc', - kSfxVolumeChanged = 'sfvc', - kOKCmd = 'ok ', - kCancelCmd = 'cncl', - }; - - virtual void open(); - - virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); - -protected: - Scumm *_scumm; - - int _soundVolumeMaster; - int _soundVolumeMusic; - int _soundVolumeSfx; - - SliderWidget *masterVolumeSlider; - SliderWidget *musicVolumeSlider; - SliderWidget *sfxVolumeSlider; - - StaticTextWidget *masterVolumeLabel; - StaticTextWidget *musicVolumeLabel; - StaticTextWidget *sfxVolumeLabel; -}; - - #endif diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 5485895855..08d51b7c83 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -23,8 +23,8 @@ #include "scumm/scumm.h" #include "scumm/sound.h" #include "newgui.h" -#include "guimaps.h" #include "dialog.h" +#include "scumm/dialogs.h" /* * TODO list @@ -38,7 +38,35 @@ * - ... */ - +// Built-in font +static byte guifont[] = {0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,0,0,0,0,0,0,0,0,0,0,0,0,4,3,7,8,7,7,8,4,5,5,8,7,4,7,3,8,7,7,7,7,8,7,7,7,7,7,3,4,7,5,7,7,8,7,7,7,7,7,7,7,7,5,7,7, +7,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,8,5,8,8,7,7,7,6,7,7,7,7,7,5,6,7,5,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,3,5,0,8,7,7,7,7,7,7,0,6,7,7,7,5,5,5,7,0,6,8,8,7,7,7,7,7,0,7,7,0,0, +0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,1,3,6,12, +24,62,3,0,128,192,96,48,24,124,192,0,0,3,62,24,12,6,3,1,0,192,124,24,48,96,192,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,237,74,72,0,0,0,0,0,128,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,60,66,153,161,161,153,66,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,96,96,96,96,0,0,96,0,102,102,102,0,0,0,0,0,102,102,255,102,255,102,102,0,24,62,96,60,6,124,24,0,98,102,12,24,48,102,70,0,60,102,60,56,103,102,63,0,96,48,16,0,0,0,0,0,24,48,96,96,96,48,24,0,96,48,24,24,24,48,96,0, +0,102,60,255,60,102,0,0,0,24,24,126,24,24,0,0,0,0,0,0,0,48,48,96,0,0,0,126,0,0,0,0,0,0,0,0,0,96,96,0,0,3,6,12,24,48,96,0,60,102,102,102,102,102,60,0,24,24,56,24,24,24,126,0,60,102,6,12,48,96,126,0,60,102,6,28,6,102,60,0,6, +14,30,102,127,6,6,0,126,96,124,6,6,102,60,0,60,102,96,124,102,102,60,0,126,102,12,24,24,24,24,0,60,102,102,60,102,102,60,0,60,102,102,62,6,102,60,0,0,0,96,0,0,96,0,0,0,0,48,0,0,48,48,96,14,24,48,96,48,24,14,0,0,0,120,0,120,0,0,0,112,24, +12,6,12,24,112,0,60,102,6,12,24,0,24,0,0,0,0,255,255,0,0,0,24,60,102,126,102,102,102,0,124,102,102,124,102,102,124,0,60,102,96,96,96,102,60,0,120,108,102,102,102,108,120,0,126,96,96,120,96,96,126,0,126,96,96,120,96,96,96,0,60,102,96,110,102,102,60,0,102,102,102, +126,102,102,102,0,120,48,48,48,48,48,120,0,30,12,12,12,12,108,56,0,102,108,120,112,120,108,102,0,96,96,96,96,96,96,126,0,99,119,127,107,99,99,99,0,102,118,126,126,110,102,102,0,60,102,102,102,102,102,60,0,124,102,102,124,96,96,96,0,60,102,102,102,102,60,14,0,124,102,102,124, +120,108,102,0,60,102,96,60,6,102,60,0,126,24,24,24,24,24,24,0,102,102,102,102,102,102,60,0,102,102,102,102,102,60,24,0,99,99,99,107,127,119,99,0,102,102,60,24,60,102,102,0,102,102,102,60,24,24,24,0,126,6,12,24,48,96,126,0,120,96,96,96,96,96,120,0,3,6,12,24,48, +96,192,0,120,24,24,24,24,24,120,0,0,0,0,0,0,219,219,0,0,0,0,0,0,0,0,255,102,102,102,0,0,0,0,0,0,0,60,6,62,102,62,0,0,96,96,124,102,102,124,0,0,0,60,96,96,96,60,0,0,6,6,62,102,102,62,0,0,0,60,102,126,96,60,0,0,14,24,62,24,24, +24,0,0,0,62,102,102,62,6,124,0,96,96,124,102,102,102,0,0,48,0,112,48,48,120,0,0,12,0,12,12,12,12,120,0,96,96,108,120,108,102,0,0,112,48,48,48,48,120,0,0,0,102,127,127,107,99,0,0,0,124,102,102,102,102,0,0,0,60,102,102,102,60,0,0,0,124,102,102,124,96, +96,0,0,62,102,102,62,6,6,0,0,124,102,96,96,96,0,0,0,62,96,60,6,124,0,0,24,126,24,24,24,14,0,0,0,102,102,102,102,62,0,0,0,102,102,102,60,24,0,0,0,99,107,127,62,54,0,0,0,102,60,24,60,102,0,0,0,102,102,102,62,12,120,0,0,126,12,24,48,126,0, +24,48,48,96,48,48,24,0,96,96,96,0,96,96,96,0,96,48,48,24,48,48,96,0,0,0,0,0,0,0,0,0,8,12,14,255,255,14,12,8,60,102,96,96,102,60,24,56,102,0,102,102,102,102,62,0,12,24,60,102,126,96,60,0,24,36,60,6,62,102,62,0,102,0,60,6,62,102,62,0,48, +24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,60,96,96,96,60,24,56,24,36,60,102,126,96,60,0,102,0,60,102,126,96,60,0,48,24,60,102,126,96,60,0,0,216,0,112,48,48,120,0,48,72,0,112,48,48,120,0,96,48,0,112,48,48,120,0,102,24,60,102,126,102,102,0,0,0, +0,0,0,0,0,0,24,48,124,96,120,96,124,0,0,0,108,26,126,216,110,0,30,40,40,126,72,136,142,0,24,36,60,102,102,102,60,0,102,0,60,102,102,102,60,0,48,24,60,102,102,102,60,0,24,36,0,102,102,102,62,0,48,24,102,102,102,102,62,0,0,0,0,0,0,0,0,0,102,60,102, +102,102,102,60,0,102,0,102,102,102,102,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,28,54,54,124,102,102,124,64,0,0,0}; + +// Constructor NewGui::NewGui(Scumm *s) : _s(s), _system(s->_system), _screen(0), _use_alpha_blending(true), _need_redraw(false),_prepare_for_gui(true), _pauseDialog(0), _saveLoadDialog(0), _aboutDialog(0), _optionsDialog(0), @@ -49,7 +77,7 @@ NewGui::NewGui(Scumm *s) : _s(s), _system(s->_system), _screen(0), void NewGui::pauseDialog() { if (!_pauseDialog) - _pauseDialog = new PauseDialog(this); + _pauseDialog = new PauseDialog(this, _s); _pauseDialog->open(); } @@ -60,27 +88,13 @@ void NewGui::saveloadDialog() _saveLoadDialog->open(); } -void NewGui::aboutDialog() -{ - if (!_aboutDialog) - _aboutDialog = new AboutDialog(this); - _aboutDialog->open(); -} - void NewGui::optionsDialog() { if (!_optionsDialog) - _optionsDialog = new OptionsDialog(this); + _optionsDialog = new OptionsDialog(this, _s); _optionsDialog->open(); } -void NewGui::soundDialog() -{ - if (!_soundDialog) - _soundDialog = new SoundDialog(this, _s); - _soundDialog->open(); -} - void NewGui::loop() { Dialog *activeDialog = _dialogStack.top(); @@ -266,44 +280,6 @@ void NewGui::closeTopDialog() _need_redraw = true; } -#pragma mark - - -const char *NewGui::queryResString(int stringno) -{ - char *result; - int string; - - if (stringno == 0) - return NULL; - - if (_s->_features & GF_AFTER_V7) - string = _s->_vars[string_map_table_v7[stringno - 1].num]; - else if (_s->_features & GF_AFTER_V6) - string = _s->_vars[string_map_table_v6[stringno - 1].num]; - else - string = string_map_table_v5[stringno - 1].num; - - result = (char *)_s->getStringAddress(string); - if (result && *result == '/') { - _s->translateText((char*)result, (char*)&_s->transText); - strcpy((char*)result, (char*)&_s->transText); - } - - if (!result) { // Gracelessly degrade to english :) - if (_s->_features & GF_AFTER_V6) - return string_map_table_v6[stringno - 1].string; - else - return string_map_table_v5[stringno - 1].string; - } - - return result; -} - -const char *NewGui::queryCustomString(int stringno) -{ - return string_map_table_custom[stringno]; -} - #pragma mark - diff --git a/gui/newgui.h b/gui/newgui.h index f8e085f18a..bf60f3ed6b 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -71,9 +71,7 @@ public: // Dialogs void pauseDialog(); void saveloadDialog(); - void aboutDialog(); void optionsDialog(); - void soundDialog(); void loop(); @@ -145,13 +143,6 @@ public: void drawString(const char *str, int x, int y, int w, int16 color, int align = kTextAlignLeft); void drawBitmap(uint32 bitmap[8], int x, int y, int16 color); - - // Query a string from the resources - const char *queryResString(int stringno); - - // Query a custom string. This is in a seperate method so that we - // can easily localize the messages in the future if we want to. - const char *queryCustomString(int stringno); }; #endif -- cgit v1.2.3