Ticket #8664: subtitles-settings.patch

File subtitles-settings.patch, 3.4 KB (added by salty-horse, 17 years ago)

SCUMM Subtitle settings dialog

  • engines/scumm/input.cpp

     
    416416        if (lastKeyHit == 20) {
    417417                // FIXME: What key is '20' supposed to indicate? I can't trigger
    418418                // it with my keyboard, it seems...
    419                 char buf[256];
    420419
    421                 _voiceMode++;
    422                 if (_voiceMode == 3)
    423                         _voiceMode = 0;
     420                SubtitleSettingsDialog dialog(this, _voiceMode);
     421                _voiceMode = runDialog(dialog);
    424422
    425423                switch (_voiceMode) {
    426424                case 0:
    427                         sprintf(buf, "Speech Only");
    428425                        ConfMan.setBool("speech_mute", false);
    429426                        ConfMan.setBool("subtitles", false);
    430427                        break;
    431428                case 1:
    432                         sprintf(buf, "Speech and Subtitles");
    433429                        ConfMan.setBool("speech_mute", false);
    434430                        ConfMan.setBool("subtitles", true);
    435431                        break;
    436432                case 2:
    437                         sprintf(buf, "Subtitles Only");
    438433                        ConfMan.setBool("speech_mute", true);
    439434                        ConfMan.setBool("subtitles", true);
    440435                        break;
     
    443438                if (VAR_VOICE_MODE != 0xFF)
    444439                        VAR(VAR_VOICE_MODE) = _voiceMode;
    445440
    446                 GUI::TimedMessageDialog dialog(buf, 1500);
    447                 runDialog(dialog);
    448441                return;
    449442        }
    450443
  • engines/scumm/dialogs.cpp

     
    2727#include "common/config-manager.h"
    2828#include "common/savefile.h"
    2929#include "common/system.h"
     30#include "common/events.h"
    3031
    3132#include "graphics/scaler.h"
    3233
     
    920921        _timer = getMillis() + kDisplayDelay;
    921922}
    922923
     924SubtitleSettingsDialog::SubtitleSettingsDialog(ScummEngine *scumm, int value)
     925        : InfoDialog(scumm, "") {
     926
     927        _value = value + 1;
     928        if (_value == 3)
     929                _value = 0;
     930
     931        setInfoText(_subtitleDesc[_value]);
     932}
     933
     934void SubtitleSettingsDialog::handleTickle() {
     935        InfoDialog::handleTickle();
     936        if (getMillis() > _timer)
     937                close();
     938}
     939
     940void SubtitleSettingsDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
     941        if (keycode == 't' && modifiers == Common::KBD_CTRL) {
     942                _value++;
     943                if (_value == 3)
     944                        _value = 0;
     945
     946                setInfoText(_subtitleDesc[_value]);
     947                reflowLayout();
     948                setResult(_value);
     949                _timer = getMillis() + 1500;
     950                draw();
     951        } else {
     952                close();
     953        }
     954}
     955
     956void SubtitleSettingsDialog::open() {
     957        InfoDialog::open();
     958        setResult(_value);
     959        _timer = getMillis() + 1500;
     960}
     961
     962const char* SubtitleSettingsDialog::_subtitleDesc[] = {
     963        "Speech Only",
     964        "Speech and Subtitles",
     965        "Subtitles Only"
     966};
     967
    923968Indy3IQPointsDialog::Indy3IQPointsDialog(ScummEngine *scumm, char* text)
    924969        : InfoDialog(scumm, text) {
    925970}
  • engines/scumm/dialogs.h

     
    236236        uint32 _timer;
    237237};
    238238
     239/**
     240 * A dialog used to display and cycle subtitle settings.
     241 * Automatically closes after a brief time has passed.
     242 */
     243class SubtitleSettingsDialog : public InfoDialog {
     244public:
     245        SubtitleSettingsDialog(ScummEngine *scumm, int value);
    239246
     247        virtual void open();
     248        virtual void handleTickle();
     249        virtual void handleMouseDown(int x, int y, int button, int clickCount) {
     250                close();
     251        }
     252        virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers);
     253protected:
     254        int _value;
     255        uint32 _timer;
     256
     257        static const char* _subtitleDesc[];
     258};
     259
    240260//The Indy IQ dialog
    241261class Indy3IQPointsDialog : public InfoDialog {
    242262public: