diff options
author | Filippos Karapetis | 2007-06-13 19:41:27 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-06-13 19:41:27 +0000 |
commit | 0d4a3c28d9cf092c5308bca529efcb0b46f21271 (patch) | |
tree | 22564013a264a430861f14c7ff3661ae5211489f /engines | |
parent | 7af7e3f192e12f8abcc99f708b9cc9f79f55e780 (diff) | |
download | scummvm-rg350-0d4a3c28d9cf092c5308bca529efcb0b46f21271.tar.gz scummvm-rg350-0d4a3c28d9cf092c5308bca529efcb0b46f21271.tar.bz2 scummvm-rg350-0d4a3c28d9cf092c5308bca529efcb0b46f21271.zip |
IHNM: Button textures are loaded correctly now for buttons in the option and quit panel. Also, implemented the voices/subtitles toggle functionality and fixed widget placement a bit
svn-id: r27388
Diffstat (limited to 'engines')
-rw-r--r-- | engines/saga/actor.cpp | 3 | ||||
-rw-r--r-- | engines/saga/detection_tables.h | 11 | ||||
-rw-r--r-- | engines/saga/displayinfo.h | 15 | ||||
-rw-r--r-- | engines/saga/interface.cpp | 71 | ||||
-rw-r--r-- | engines/saga/interface.h | 2 | ||||
-rw-r--r-- | engines/saga/itedata.cpp | 10 | ||||
-rw-r--r-- | engines/saga/itedata.h | 2 | ||||
-rw-r--r-- | engines/saga/saga.cpp | 10 | ||||
-rw-r--r-- | engines/saga/saga.h | 8 | ||||
-rw-r--r-- | engines/saga/sagaresnames.h | 1 | ||||
-rw-r--r-- | engines/saga/sndres.cpp | 3 |
11 files changed, 101 insertions, 35 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp index 27a563696b..da25d26069 100644 --- a/engines/saga/actor.cpp +++ b/engines/saga/actor.cpp @@ -1833,7 +1833,8 @@ void Actor::drawActors() { void Actor::drawSpeech(void) { if (!isSpeaking() || !_activeSpeech.playing || _vm->_script->_skipSpeeches - || (!_vm->_subtitlesEnabled && (_vm->getFeatures() & GF_CD_FX))) + || (!_vm->_subtitlesEnabled && (_vm->getFeatures() & GF_CD_FX)) + || (!_vm->_subtitlesEnabled && (_vm->getGameType() == GType_IHNM))) return; int i; diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h index 89fdbcd876..8cef19d37f 100644 --- a/engines/saga/detection_tables.h +++ b/engines/saga/detection_tables.h @@ -31,9 +31,10 @@ static const GameResourceDescription ITE_Resources = { RID_ITE_MAIN_PANEL, RID_ITE_CONVERSE_PANEL, RID_ITE_OPTION_PANEL, - 0, + 0, // Warning panel (IHNM only) RID_ITE_MAIN_SPRITES, RID_ITE_MAIN_PANEL_SPRITES, + 0, // Option panel sprites (IHNM only) RID_ITE_DEFAULT_PORTRAITS, RID_ITE_MAIN_STRINGS, RID_ITE_ACTOR_NAMES @@ -45,9 +46,10 @@ static const GameResourceDescription ITEDemo_Resources = { RID_ITEDEMO_MAIN_PANEL, RID_ITEDEMO_CONVERSE_PANEL, RID_ITEDEMO_OPTION_PANEL, - 0, + 0, // Warning panel (IHNM only) RID_ITEDEMO_MAIN_SPRITES, RID_ITEDEMO_MAIN_PANEL_SPRITES, + 0, // Option panel sprites (IHNM only) RID_ITEDEMO_DEFAULT_PORTRAITS, RID_ITEDEMO_MAIN_STRINGS, RID_ITEDEMO_ACTOR_NAMES @@ -292,9 +294,10 @@ static const GameResourceDescription IHNM_Resources = { RID_IHNM_WARNING_PANEL, RID_IHNM_MAIN_SPRITES, RID_IHNM_MAIN_PANEL_SPRITES, - 0, + RID_IHNM_OPTION_PANEL_SPRITES, + 0, // Default portraits (ITE only) RID_IHNM_MAIN_STRINGS, - 0 + 0 // Actors strings (ITE only) }; static const GameFontDescription IHNMDEMO_GameFonts[] = { diff --git a/engines/saga/displayinfo.h b/engines/saga/displayinfo.h index 4598158620..40792adc37 100644 --- a/engines/saga/displayinfo.h +++ b/engines/saga/displayinfo.h @@ -323,20 +323,19 @@ static PanelButton IHNM_ConversePanelButtons[] = { }; static PanelButton IHNM_OptionPanelButtons[] = { - //TODO: Add the rest of the buttons {kPanelButtonOptionText,28,36, 0,0, kTextReadingSpeed,'-',0, 0,0,0}, // text: read speed {kPanelButtonOptionText,60,61, 0,0, kTextMusic,'-',0, 0,0,0}, // text: music {kPanelButtonOptionText,60,86, 0,0, kTextSound,'-',0, 0,0,0}, // text: noise - // TODO: Add Voices text here - {kPanelButtonOption, 154,30, 79,23, kTextReadingSpeed,'r',0, 0,0,0}, //read speed - {kPanelButtonOption, 154,55, 79,23, kTextMusic,'m',0, 0,0,0}, //music - {kPanelButtonOption, 154,80, 79,23, kTextSound,'n',0, 0,0,0}, //sound-noise - // TODO: Add Voices widget here + {kPanelButtonOptionText,56,111, 0,0, kTextVoices,'-',0, 0,0,0}, // text: voices + {kPanelButtonOption, 153,29, 79,23, kTextReadingSpeed,'r',0, 0,0,0}, //read speed + {kPanelButtonOption, 153,54, 79,23, kTextMusic,'m',0, 0,0,0}, //music + {kPanelButtonOption, 153,79, 79,23, kTextSound,'n',0, 0,0,0}, //sound-noise + {kPanelButtonOption, 153,104,79,23, kTextVoices,'v',0, 0,0,0}, //voices {kPanelButtonOption, 19,149, 200,25, kTextQuitGame,'q',0, 0,0,0}, //quit {kPanelButtonOption, 19,177, 200,25, kTextContinuePlaying,'c',0, 0,0,0}, //continue // TODO: Implement load/save - {kPanelButtonOption, 244,164, 79,23, kTextLoad,'l',0, 0,0,0}, //load - {kPanelButtonOption, 335,164, 79,23, kTextSave,'s',0, 0,0,0}, //save + {kPanelButtonOption, 242,162, 79,23, kTextLoad,'l',0, 0,0,0}, //load + {kPanelButtonOption, 333,162, 79,23, kTextSave,'s',0, 0,0,0}, //save }; static PanelButton IHNM_QuitPanelButtons[] = { diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 5251a822ad..ddd00a23e6 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -142,6 +142,8 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { // Main panel sprites _vm->_sprite->loadList(_vm->getResourceDescription()->mainPanelSpritesResourceId, _mainPanel.sprites); + // Option panel sprites + _vm->_sprite->loadList(_vm->getResourceDescription()->optionPanelSpritesResourceId, _optionPanel.sprites); if (_vm->getGameType() == GType_ITE) { _vm->_sprite->loadList(_vm->getResourceDescription()->defaultPortraitsResourceId, _defPortraits); @@ -755,7 +757,8 @@ void Interface::drawOption() { PanelButton *panelButton; Point textPoint; Point point; - + int spritenum = 0; + backBuffer = _vm->_gfx->getBackBuffer(); _optionPanel.getRect(rect); @@ -764,16 +767,13 @@ void Interface::drawOption() { for (i = 0; i < _optionPanel.buttonsCount; i++) { panelButton = &_optionPanel.buttons[i]; - // TODO: This probably works for the button background, but the resources are still not loeaded - // (_optionPanel.sprites) - /* - point.x = _optionPanel.x + panelButton->xOffset; - point.y = _optionPanel.y + panelButton->yOffset; - _vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _optionPanel.sprites, i, point, 256); - */ - if (panelButton->type == kPanelButtonOption) { - drawPanelButtonText(backBuffer, &_optionPanel, panelButton); + if (_vm->getGameType() == GType_ITE) { + drawPanelButtonText(backBuffer, &_optionPanel, panelButton); + } else { + drawPanelButtonText(backBuffer, &_optionPanel, panelButton, spritenum); + spritenum += 2; // 2 sprites per button (lit and unlit) + } } if (panelButton->type == kPanelButtonOptionText) { drawPanelText(backBuffer, &_optionPanel, panelButton); @@ -781,11 +781,8 @@ void Interface::drawOption() { } if (_optionSaveRectTop.height() > 0) { - if (_vm->getGameType() == GType_ITE) { + if (_vm->getGameType() == GType_ITE) backBuffer->drawRect(_optionSaveRectTop, kITEColorDarkGrey); - } else { - // TODO: Draw the button graphic properly for IHNM - } } // FIXME: The _optionSaveFileSlider checks exist for IHNM, where @@ -1399,6 +1396,21 @@ void Interface::setOption(PanelButton *panelButton) { _vm->_sound->setVolume(_vm->_soundVolume == 10 ? 255 : _vm->_soundVolume * 25); ConfMan.setInt("sfx_volume", _vm->_soundVolume * 25); break; + case kTextVoices: + if (_vm->_subtitlesEnabled && _vm->_voicesEnabled) { // Both + _vm->_subtitlesEnabled = false; // Set it to "Audio" + _vm->_voicesEnabled = true; // Not necessary, just for completeness + } else if (!_vm->_subtitlesEnabled && _vm->_voicesEnabled) { + _vm->_subtitlesEnabled = true; // Set it to "Text" + _vm->_voicesEnabled = false; + } else if (_vm->_subtitlesEnabled && !_vm->_voicesEnabled) { + _vm->_subtitlesEnabled = true; // Set it to "Both" + _vm->_voicesEnabled = true; + } + + ConfMan.setBool("subtitles", _vm->_subtitlesEnabled); + ConfMan.setBool("voices", _vm->_voicesEnabled); + break; } } @@ -1917,14 +1929,16 @@ void Interface::drawButtonBox(Surface *ds, const Rect& rect, ButtonKind kind, bo static const int readingSpeeds[] = { kTextClick, kTextSlow, kTextMid, kTextFast }; -void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton) { +void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton, int spritenum) { const char *text; int textId; int textWidth; int textHeight; Point point; + Point texturePoint; KnownColor textColor; Rect rect; + int litButton = 0; textId = panelButton->id; switch (panelButton->id) { @@ -1950,6 +1964,14 @@ void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelBut else textId = kTextOff; break; + case kTextVoices: + if (_vm->_subtitlesEnabled && _vm->_voicesEnabled) + textId = kTextBoth; + else if (_vm->_subtitlesEnabled && !_vm->_voicesEnabled) + textId = kTextText; + else if (!_vm->_subtitlesEnabled && _vm->_voicesEnabled) + textId = kTextAudio; + break; } text = _vm->getTextString(textId); @@ -1971,7 +1993,24 @@ void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelBut } panel->calcPanelButtonRect(panelButton, rect); - drawButtonBox(ds, rect, kButton, panelButton->state > 0); + if (_vm->getGameType() == GType_ITE) { + drawButtonBox(ds, rect, kButton, panelButton->state > 0); + } else { + litButton = panelButton->state > 0; + + if (panel == &_optionPanel) { + texturePoint.x = _optionPanel.x + panelButton->xOffset; + texturePoint.y = _optionPanel.y + panelButton->yOffset; + _vm->_sprite->draw(ds, _vm->getDisplayClip(), _optionPanel.sprites, spritenum + 2 + litButton, texturePoint, 256); + } else if (panel == &_quitPanel) { + texturePoint.x = _quitPanel.x + panelButton->xOffset; + texturePoint.y = _quitPanel.y + panelButton->yOffset; + _vm->_sprite->draw(ds, _vm->getDisplayClip(), _optionPanel.sprites, 14 + litButton, texturePoint, 256); + } else { + // revert to default behavior + drawButtonBox(ds, rect, kButton, panelButton->state > 0); + } + } if (_vm->getGameType() == GType_ITE) _vm->_font->textDraw(kKnownFontMedium, ds, text, point, diff --git a/engines/saga/interface.h b/engines/saga/interface.h index dd4aeb861d..4de17a258b 100644 --- a/engines/saga/interface.h +++ b/engines/saga/interface.h @@ -330,7 +330,7 @@ private: void drawTextInput(Surface *ds, InterfacePanel *panel, PanelButton *panelButton); void drawPanelText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton); - void drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton); + void drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelButton *panelButton, int spritenum = 0); enum ButtonKind { kButton, kSlider, diff --git a/engines/saga/itedata.cpp b/engines/saga/itedata.cpp index 60082561e2..5e3d85c928 100644 --- a/engines/saga/itedata.cpp +++ b/engines/saga/itedata.cpp @@ -336,7 +336,7 @@ FxTable ITE_SfxTable[ITE_SFXCOUNT] = { { FX_CROWD_17, 64 } }; -const char *ITEinterfaceTextStrings[][52] = { +const char *ITEinterfaceTextStrings[][56] = { { "Walk to", "Look At", "Pick Up", "Talk to", "Open", "Close", "Use", "Give", "Options", "Test", @@ -354,7 +354,9 @@ const char *ITEinterfaceTextStrings[][52] = { "There's no opening to close.", "I don't know how to do that.", "Show Dialog", - "What is Rif's reply?" + "What is Rif's reply?", + "Voices", // IHNM + "Both", "Text", "Audio" // IHNM }, // German { @@ -374,7 +376,9 @@ const char *ITEinterfaceTextStrings[][52] = { "Hier ist keine \231ffnung zum Schlie$en.", "Ich wei$ nicht, wie ich das machen soll.", "Text zeigen", - "Wie lautet die Antwort?" + "Wie lautet die Antwort?", + "Sprache", // IHNM + "Beides", "Text", "Stimmen" // IHNM } }; diff --git a/engines/saga/itedata.h b/engines/saga/itedata.h index d9bd59adc4..e9b5bda5bc 100644 --- a/engines/saga/itedata.h +++ b/engines/saga/itedata.h @@ -91,7 +91,7 @@ struct FxTable { extern ObjectTableData ITE_ObjectTable[ITE_OBJECTCOUNT]; extern FxTable ITE_SfxTable[ITE_SFXCOUNT]; -extern const char *ITEinterfaceTextStrings[][52]; +extern const char *ITEinterfaceTextStrings[][56]; #define PUZZLE_PIECES 15 diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 23f5b51de7..611bc9b079 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -148,6 +148,16 @@ int SagaEngine::init() { _soundVolume = ConfMan.getInt("sfx_volume") / 25; _musicVolume = ConfMan.getInt("music_volume") / 25; _subtitlesEnabled = ConfMan.getBool("subtitles"); + if (getGameType() == GType_IHNM) { + if (!ConfMan.hasKey("voices")) { + _voicesEnabled = true; + ConfMan.setBool("voices", true); + } else { + _voicesEnabled = ConfMan.getBool("voices"); + } + } else { + _voicesEnabled = true; + } _readingSpeed = getTalkspeed(); _copyProtection = ConfMan.getBool("copy_protection"); diff --git a/engines/saga/saga.h b/engines/saga/saga.h index e43d2f15d3..e406b487c7 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -279,7 +279,11 @@ enum TextStringIds { kTextNoOpening, kTextDontKnow, kTextShowDialog, - kTextEnterProtectAnswer + kTextEnterProtectAnswer, + kTextVoices, + kTextBoth, + kTextText, + kTextAudio }; @@ -292,6 +296,7 @@ struct GameResourceDescription { uint32 warningPanelResourceId; uint32 mainSpritesResourceId; uint32 mainPanelSpritesResourceId; + uint32 optionPanelSpritesResourceId; uint32 defaultPortraitsResourceId; uint32 mainStringsResourceId; uint32 actorsStringsResourceId; @@ -518,6 +523,7 @@ public: int _soundVolume; int _musicVolume; bool _subtitlesEnabled; + bool _voicesEnabled; int _readingSpeed; bool _copyProtection; diff --git a/engines/saga/sagaresnames.h b/engines/saga/sagaresnames.h index 6527510910..94f97635c1 100644 --- a/engines/saga/sagaresnames.h +++ b/engines/saga/sagaresnames.h @@ -104,6 +104,7 @@ namespace Saga { #define RID_IHNM_ARROW_SPRITES 13 #define RID_IHNM_SAVEREMINDER_SPRITES 14 #define RID_IHNM_OPTION_PANEL 15 +#define RID_IHNM_OPTION_PANEL_SPRITES 16 #define RID_IHNM_WARNING_PANEL 17 #define RID_IHNM_BOSS_SCREEN 19 #define RID_IHNM_PROFILE_BG 20 diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 0e3db65898..c0442c75de 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -126,6 +126,9 @@ void SndRes::playSound(uint32 resourceId, int volume, bool loop) { void SndRes::playVoice(uint32 resourceId) { SoundBuffer buffer; + if (_vm->getGameType() == GType_IHNM && !(_vm->_voicesEnabled)) + return; + debug(4, "SndRes::playVoice %i", resourceId); if (!load(_voiceContext, resourceId, buffer, false)) { |