Ticket #8664: subtitles-settings2.patch
File subtitles-settings2.patch, 3.5 KB (added by , 17 years ago) |
---|
-
engines/scumm/input.cpp
414 414 415 415 void ScummEngine_v6::processKeyboard(int lastKeyHit) { 416 416 if (lastKeyHit == 20) { 417 // FIXME: What key is '20' supposed to indicate? I can't trigger418 // it with my keyboard, it seems...419 char buf[256];417 // FIXME: The 20 seems to indicate Ctrl-T. Of course this is a 418 // rather ugly way to detect it -- modifier + ascii code would 419 // be a *lot* cleaner... 420 420 421 _voiceMode++; 422 if (_voiceMode == 3) 423 _voiceMode = 0; 421 SubtitleSettingsDialog dialog(this, _voiceMode); 422 _voiceMode = runDialog(dialog); 424 423 425 424 switch (_voiceMode) { 426 425 case 0: 427 sprintf(buf, "Speech Only");428 426 ConfMan.setBool("speech_mute", false); 429 427 ConfMan.setBool("subtitles", false); 430 428 break; 431 429 case 1: 432 sprintf(buf, "Speech and Subtitles");433 430 ConfMan.setBool("speech_mute", false); 434 431 ConfMan.setBool("subtitles", true); 435 432 break; 436 433 case 2: 437 sprintf(buf, "Subtitles Only");438 434 ConfMan.setBool("speech_mute", true); 439 435 ConfMan.setBool("subtitles", true); 440 436 break; … … 443 439 if (VAR_VOICE_MODE != 0xFF) 444 440 VAR(VAR_VOICE_MODE) = _voiceMode; 445 441 446 GUI::TimedMessageDialog dialog(buf, 1500);447 runDialog(dialog);448 442 return; 449 443 } 450 444 -
engines/scumm/dialogs.cpp
27 27 #include "common/config-manager.h" 28 28 #include "common/savefile.h" 29 29 #include "common/system.h" 30 #include "common/events.h" 30 31 31 32 #include "graphics/scaler.h" 32 33 … … 920 921 _timer = getMillis() + kDisplayDelay; 921 922 } 922 923 924 SubtitleSettingsDialog::SubtitleSettingsDialog(ScummEngine *scumm, int value) 925 : InfoDialog(scumm, ""), _value(value) { 926 927 } 928 929 void SubtitleSettingsDialog::handleTickle() { 930 InfoDialog::handleTickle(); 931 if (getMillis() > _timer) 932 close(); 933 } 934 935 void SubtitleSettingsDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { 936 if (keycode == 't' && modifiers == Common::KBD_CTRL) { 937 cycleValue(); 938 939 reflowLayout(); 940 draw(); 941 } else { 942 close(); 943 } 944 } 945 946 void SubtitleSettingsDialog::open() { 947 cycleValue(); 948 InfoDialog::open(); 949 } 950 951 void SubtitleSettingsDialog::cycleValue() { 952 static const char* subtitleDesc[] = { 953 "Speech Only", 954 "Speech and Subtitles", 955 "Subtitles Only" 956 }; 957 958 _value = (_value + 1) % 3; 959 960 setInfoText(subtitleDesc[_value]); 961 962 setResult(_value); 963 _timer = getMillis() + 1500; 964 } 965 923 966 Indy3IQPointsDialog::Indy3IQPointsDialog(ScummEngine *scumm, char* text) 924 967 : InfoDialog(scumm, text) { 925 968 } -
engines/scumm/dialogs.h
236 236 uint32 _timer; 237 237 }; 238 238 239 /** 240 * A dialog used to display and cycle subtitle settings. 241 * Automatically closes after a brief time has passed. 242 */ 243 class SubtitleSettingsDialog : public InfoDialog { 244 public: 245 SubtitleSettingsDialog(ScummEngine *scumm, int value); 239 246 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); 253 protected: 254 int _value; 255 uint32 _timer; 256 257 void cycleValue(); 258 }; 259 240 260 //The Indy IQ dialog 241 261 class Indy3IQPointsDialog : public InfoDialog { 242 262 public: