Ticket #8385: subtitles-no-confman.patch
File subtitles-no-confman.patch, 29.0 KB (added by , 19 years ago) |
---|
-
gui/options.h
66 66 void addAudioControls(GuiObject *boss, String prefix); 67 67 void addMIDIControls(GuiObject *boss, String prefix); 68 68 void addVolumeControls(GuiObject *boss, String prefix); 69 // The default value is the launcher's non-scaled talkspeed value. When SCUMM uses the widget, 70 // it uses its own scale 71 void addSubtitleControls(GuiObject *boss, String prefix, int maxSliderVal = 255); 69 72 70 73 void setGraphicSettingsState(bool enabled); 71 74 void setAudioSettingsState(bool enabled); 72 75 void setMIDISettingsState(bool enabled); 73 76 void setVolumeSettingsState(bool enabled); 77 void setSubtitleSettingsState(bool enabled); 74 78 75 79 private: 76 80 // … … 87 91 // 88 92 bool _enableAudioSettings; 89 93 PopUpWidget *_midiPopUp; 90 CheckboxWidget *_subCheckbox;91 94 92 95 // 93 96 // MIDI controls … … 96 99 CheckboxWidget *_multiMidiCheckbox; 97 100 CheckboxWidget *_mt32Checkbox; 98 101 CheckboxWidget *_enableGSCheckbox; 102 103 // 104 // Subtitle controls 105 // 106 int getSubtitleMode(bool subtitles, bool speech_mute); 107 bool _enableSubtitleSettings; 108 StaticTextWidget *_subToggleDesc; 109 ButtonWidget *_subToggleButton; 110 int _subMode; 111 static const char *_subModeDesc[]; 112 StaticTextWidget *_subSpeedDesc; 113 SliderWidget *_subSpeedSlider; 114 StaticTextWidget *_subSpeedLabel; 99 115 100 116 // 101 117 // Volume controls 102 118 // 103 119 bool _enableVolumeSettings; 104 120 121 StaticTextWidget *_musicVolumeDesc; 105 122 SliderWidget *_musicVolumeSlider; 106 123 StaticTextWidget *_musicVolumeLabel; 107 124 125 StaticTextWidget *_sfxVolumeDesc; 108 126 SliderWidget *_sfxVolumeSlider; 109 127 StaticTextWidget *_sfxVolumeLabel; 110 128 129 StaticTextWidget *_speechVolumeDesc; 111 130 SliderWidget *_speechVolumeSlider; 112 131 StaticTextWidget *_speechVolumeLabel; 113 132 }; -
gui/themes/modern.ini
234 234 opYoffset=vBorder 235 235 useWithPrefix=audioControls globaloptions_ 236 236 useWithPrefix=volumeControls globaloptions_ 237 useWithPrefix=subtitleControls globaloptions_ 237 238 238 239 # MIDI tab 239 240 opYoffset=vBorder … … 302 303 gameoptions_audioCheckbox=gox opYoffset (kFontHeight + 10 + 180) buttonHeight 303 304 opYoffset=(opYoffset + buttonHeight + 6) 304 305 useWithPrefix=audioControls gameoptions_ 306 useWithPrefix=subtitleControls gameoptions_ 305 307 306 308 # midi tab 307 309 opYoffset=vBorder … … 341 343 # hence it is on the end of the list 342 344 opYoffset=8 343 345 useWithPrefix=volumeControls scummconfig_ 344 scummconfig_subtitlesCheckbox=15 opYoffset (kFontHeight + 10 + 89) buttonHeight 346 useWithPrefix=subtitleControls scummconfig_ 345 347 opYoffset=(opYoffset + buttonHeight) 346 scummconfig_speechCheckbox=prev.x opYoffset (kFontHeight + 10 + 85) buttonHeight347 348 opYoffset=(opYoffset + buttonHeight + 4) 348 349 soWidth=(8 + 3 * buttonWidth + 4) 349 350 scummconfig_keys=(soWidth - 3 * (buttonWidth + 4) + 6) opYoffset (buttonWidth - 10) buttonHeight … … 389 390 chooser_cancel=(chooserW - 2 * (buttonWidth + 10)) (opHeight - buttonHeight - 8) buttonWidth buttonHeight 390 391 chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h 391 392 392 393 393 [graphicsControls] 394 394 gcx=(opXoffset + 10) 395 395 gcw=(parent.w - gcx - 25) … … 404 404 405 405 [audioControls] 406 406 aux=(opXoffset + 10) 407 auw=(parent.w - aux - 25) 408 auMidiPopup=(aux - 5) (opYoffset - 1) (auw + 5) (kLineHeight + 2) 409 opYoffset=(opYoffset + kLineHeight + 16) 410 auSubtitlesCheckbox=aux opYoffset (kFontHeight + 10 + 102) buttonHeight 411 opYoffset=(opYoffset + buttonHeight + 18) 407 auw=(parent.w - aux - 30) 408 auMidiPopup=(aux) (opYoffset - 1) (auw + 5) (kLineHeight + 2) 409 opYoffset=(opYoffset + buttonHeight + 4) 412 410 413 411 [volumeControls] 414 vctextw=95 415 vcxoff=(vctextw + 15) 416 vcMusicText=10 (opYoffset + 2) vctextw kLineHeight 412 vctextw=110 413 vcxoff=(opXoffset + vctextw + 10) 414 vcx=(opXoffset + 10) 415 vcMusicText=vcx (opYoffset + 2) vctextw kLineHeight 417 416 vcMusicText.align=kTextAlignRight 418 417 vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight 419 418 vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight 420 419 opYoffset=(opYoffset + sliderHeight + 8) 421 vcSfxText= 10(opYoffset + 2) vctextw kLineHeight420 vcSfxText=vcx (opYoffset + 2) vctextw kLineHeight 422 421 vcSfxText.align=kTextAlignRight 423 422 vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight 424 423 vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight 425 424 opYoffset=(opYoffset + sliderHeight + 8) 426 vcSpeechText= 10(opYoffset + 2) vctextw kLineHeight425 vcSpeechText=vcx (opYoffset + 2) vctextw kLineHeight 427 426 vcSpeechText.align=kTextAlignRight 428 427 vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight 429 428 vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight … … 442 441 mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight 443 442 opYoffset=(opYoffset + buttonHeight + midiControlsSpacing) 444 443 444 [subtitleControls] 445 sbx=(opXoffset + 10) 446 sbtextw=110 447 sbYoff=(buttonHeight / 8) 448 sbOff=((sliderHeight - kLineHeight) / 2) 449 opYoffset=(opYoffset + sbYoff) 450 subToggleDesc=sbx (opYoffset + sbYoff) sbtextw buttonHeight 451 subToggleButton=prev.x2 opYoffset (buttonWidth + 34) sliderHeight 452 opYoffset=(opYoffset + buttonHeight + 6) 453 subSubtitleSpeedDesc=sbx (opYoffset + sbOff) sbtextw kLineHeight 454 subSubtitleSpeedDesc.align=kTextAlignRight 455 subSubtitleSpeedSlider=prev.x2 opYoffset sliderWidth sliderHeight 456 subSubtitleSpeedLabel=(prev.x2 + 10) (opYoffset + sbOff) 24 kLineHeight 457 opYoffset=(opYoffset + sliderHeight + 8) 458 445 459 [scummmain] 446 460 ## Main dialog 447 461 # note that scummmain size depends on overall height -
gui/options.cpp
55 55 // - music & graphics driver (but see also the comments on EditGameDialog 56 56 // for some techincal difficulties with this) 57 57 // - default volumes (sfx/speech/music) 58 // - aspect ratio, language, platform, subtitles,debug mode/level, cd drive, joystick, multi midi, native mt3258 // - aspect ratio, language, platform, debug mode/level, cd drive, joystick, multi midi, native mt32 59 59 60 60 enum { 61 61 kMusicVolumeChanged = 'muvc', 62 62 kSfxVolumeChanged = 'sfvc', 63 kSubtitleToggle = 'sttg', 64 kSubtitleSpeedChanged = 'stsc', 63 65 kSpeechVolumeChanged = 'vcvc', 64 66 kChooseSoundFontCmd = 'chsf', 65 67 kChooseSaveDirCmd = 'chos', … … 83 85 init(); 84 86 } 85 87 88 const char *OptionsDialog::_subModeDesc[] = { 89 "Speech Only", 90 "Speech and Subtitles", 91 "Subtitles Only" 92 }; 93 86 94 void OptionsDialog::init() { 87 95 _enableGraphicSettings = false; 88 96 _gfxPopUp = 0; … … 90 98 _fullscreenCheckbox = 0; 91 99 _aspectCheckbox = 0; 92 100 _enableAudioSettings = false; 93 _subCheckbox = 0;94 101 _midiPopUp = 0; 95 102 _enableMIDISettings = false; 96 103 _multiMidiCheckbox = 0; 97 104 _mt32Checkbox = 0; 98 105 _enableGSCheckbox = 0; 99 106 _enableVolumeSettings = false; 107 _musicVolumeDesc = 0; 100 108 _musicVolumeSlider = 0; 101 109 _musicVolumeLabel = 0; 110 _sfxVolumeDesc = 0; 102 111 _sfxVolumeSlider = 0; 103 112 _sfxVolumeLabel = 0; 113 _speechVolumeDesc = 0; 104 114 _speechVolumeSlider = 0; 105 115 _speechVolumeLabel = 0; 116 _subToggleDesc = 0; 117 _subToggleButton = 0; 118 _subSpeedDesc = 0; 119 _subSpeedSlider = 0; 120 _subSpeedLabel = 0; 106 121 } 107 122 108 123 void OptionsDialog::open() { … … 111 126 // Reset result value 112 127 setResult(0); 113 128 129 // Graphic options 114 130 if (_fullscreenCheckbox) { 115 131 _gfxPopUp->setSelected(0); 116 132 … … 150 166 #endif 151 167 } 152 168 153 if (_subCheckbox) { 169 // Audio options 170 if (_midiPopUp) { 154 171 // Music driver 155 172 const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers(); 156 173 int i = 0; … … 163 180 md++; 164 181 } 165 182 _midiPopUp->setSelected(md->name ? i : 0); 166 167 // Subtitles setting168 _subCheckbox->setState(ConfMan.getBool("subtitles", _domain));169 183 } 170 184 171 185 if (_multiMidiCheckbox) { … … 202 216 _speechVolumeSlider->setValue(vol); 203 217 _speechVolumeLabel->setValue(vol); 204 218 } 219 220 // Subtitle options 221 if (_subToggleButton) { 222 int speed; 223 int sliderMaxValue = _subSpeedSlider->getMaxValue(); 224 225 _subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute")); 226 _subToggleButton->setLabel(_subModeDesc[_subMode]); 227 228 // Engines that reuse the subtitle speed widget set their own max value. 229 // Scale the config value accordingly (see addSubtitleControls) 230 speed = ConfMan.getInt("talkspeed", _domain); 231 if (speed != 0) 232 if (speed == 255) 233 speed = sliderMaxValue; 234 else if (sliderMaxValue != 255) 235 speed = (int)(speed * (sliderMaxValue / 255.0) + 0.5); 236 237 _subSpeedSlider->setValue(speed); 238 _subSpeedLabel->setValue(speed); 239 } 205 240 } 206 241 207 242 void OptionsDialog::close() { 208 243 if (getResult()) { 244 245 // Graphic options 209 246 if (_fullscreenCheckbox) { 210 247 if (_enableGraphicSettings) { 211 248 ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain); … … 224 261 } 225 262 } 226 263 264 // Volume options 227 265 if (_musicVolumeSlider) { 228 266 if (_enableVolumeSettings) { 229 267 ConfMan.setInt("music_volume", _musicVolumeSlider->getValue(), _domain); … … 236 274 } 237 275 } 238 276 239 if (_subCheckbox) { 277 // Audio options 278 if (_midiPopUp) { 240 279 if (_enableAudioSettings) { 241 ConfMan.setBool("subtitles", _subCheckbox->getState(), _domain);242 280 const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers(); 243 281 while (md->name && md->id != (int)_midiPopUp->getSelectedTag()) 244 282 md++; … … 248 286 ConfMan.removeKey("music_driver", _domain); 249 287 } else { 250 288 ConfMan.removeKey("music_driver", _domain); 251 ConfMan.removeKey("subtitles", _domain);252 289 } 253 290 } 254 291 … … 270 307 } 271 308 } 272 309 310 // Subtitle options 311 if (_subToggleButton) { 312 if (_enableSubtitleSettings) { 313 bool subtitles, speech_mute; 314 int talkspeed; 315 int sliderMaxValue = _subSpeedSlider->getMaxValue(); 316 317 switch (_subMode) { 318 case 0: 319 subtitles = speech_mute = false; 320 break; 321 case 1: 322 subtitles = true; 323 speech_mute = false; 324 break; 325 case 2: 326 default: 327 subtitles = speech_mute = true; 328 break; 329 } 330 331 ConfMan.setBool("subtitles", subtitles, _domain); 332 ConfMan.setBool("speech_mute", speech_mute, _domain); 333 334 // Engines that reuse the subtitle speed widget set their own max value. 335 // Scale the config value accordingly (see addSubtitleControls) 336 talkspeed = _subSpeedSlider->getValue(); 337 if (talkspeed != 0) 338 if (talkspeed == sliderMaxValue) 339 talkspeed = 255; 340 else if (sliderMaxValue != 255) 341 talkspeed = (int)(talkspeed / (sliderMaxValue / 255.0) + 0.5); 342 ConfMan.setInt("talkspeed", talkspeed, _domain); 343 344 } else { 345 ConfMan.removeKey("subtitles", _domain); 346 ConfMan.removeKey("talkspeed", _domain); 347 ConfMan.removeKey("speech_mute", _domain); 348 } 349 } 350 273 351 // Save config file 274 352 ConfMan.flushToDisk(); 275 353 } … … 291 369 _speechVolumeLabel->setValue(_speechVolumeSlider->getValue()); 292 370 _speechVolumeLabel->draw(); 293 371 break; 372 case kSubtitleToggle: 373 if (_subMode < 2) 374 _subMode++; 375 else 376 _subMode = 0; 377 378 _subToggleButton->setLabel(_subModeDesc[_subMode]); 379 _subToggleButton->draw(); 380 _subSpeedDesc->draw(); 381 _subSpeedSlider->draw(); 382 _subSpeedLabel->draw(); 383 break; 384 case kSubtitleSpeedChanged: 385 _subSpeedLabel->setValue(_subSpeedSlider->getValue()); 386 _subSpeedLabel->draw(); 387 break; 294 388 case kOKCmd: 295 389 setResult(1); 296 390 close(); … … 315 409 _enableAudioSettings = enabled; 316 410 317 411 _midiPopUp->setEnabled(enabled); 318 _subCheckbox->setEnabled(enabled);319 412 } 320 413 321 414 void OptionsDialog::setMIDISettingsState(bool enabled) { … … 331 424 void OptionsDialog::setVolumeSettingsState(bool enabled) { 332 425 _enableVolumeSettings = enabled; 333 426 427 _musicVolumeDesc->setEnabled(enabled); 334 428 _musicVolumeSlider->setEnabled(enabled); 335 429 _musicVolumeLabel->setEnabled(enabled); 430 _sfxVolumeDesc->setEnabled(enabled); 336 431 _sfxVolumeSlider->setEnabled(enabled); 337 432 _sfxVolumeLabel->setEnabled(enabled); 433 _speechVolumeDesc->setEnabled(enabled); 338 434 _speechVolumeSlider->setEnabled(enabled); 339 435 _speechVolumeLabel->setEnabled(enabled); 340 436 } 341 437 438 void OptionsDialog::setSubtitleSettingsState(bool enabled) { 439 _enableSubtitleSettings = enabled; 440 441 _subToggleButton->setEnabled(enabled); 442 _subToggleDesc->setEnabled(enabled); 443 _subSpeedDesc->setEnabled(enabled); 444 _subSpeedSlider->setEnabled(enabled); 445 _subSpeedLabel->setEnabled(enabled); 446 } 447 342 448 void OptionsDialog::addGraphicControls(GuiObject *boss, String prefix) { 343 449 const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes(); 344 450 … … 391 497 md++; 392 498 } 393 499 394 // Subtitles on/off395 _subCheckbox = new CheckboxWidget(boss, prefix + "auSubtitlesCheckbox", "Display subtitles", 0, 0);396 397 500 _enableAudioSettings = true; 398 501 } 399 502 … … 414 517 _enableMIDISettings = true; 415 518 } 416 519 520 // The function has an extra slider range parameter, since both the launcher and SCUMM engine 521 // make use of the widgets. The launcher range is 0-255. SCUMM's 0-9 522 void OptionsDialog::addSubtitleControls(GuiObject *boss, String prefix, int maxSliderVal) { 523 524 _subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", "Text and Speech:"); 525 _subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle, 0); 526 527 // Subtitle speed 528 _subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", "Subtitle speed:"); 529 _subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", kSubtitleSpeedChanged); 530 _subSpeedLabel = new StaticTextWidget(boss, prefix + "subSubtitleSpeedLabel", "100%"); 531 _subSpeedSlider->setMinValue(0); _subSpeedSlider->setMaxValue(maxSliderVal); 532 _subSpeedLabel->setFlags(WIDGET_CLEARBG); 533 534 _enableSubtitleSettings = true; 535 } 536 417 537 void OptionsDialog::addVolumeControls(GuiObject *boss, String prefix) { 418 const char *slider_labels[] = {419 "Music volume:",420 "SFX volume:",421 "Speech volume:"422 };423 538 424 539 // Volume controllers 425 new StaticTextWidget(boss, prefix + "vcMusicText", slider_labels[0]);540 _musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", "Music volume:"); 426 541 _musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", kMusicVolumeChanged); 427 542 _musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", "100%"); 428 543 _musicVolumeSlider->setMinValue(0); 429 544 _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); 430 545 _musicVolumeLabel->setFlags(WIDGET_CLEARBG); 431 546 432 new StaticTextWidget(boss, prefix + "vcSfxText", slider_labels[1]);547 _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", "SFX volume:"); 433 548 _sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged); 434 549 _sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%"); 435 550 _sfxVolumeSlider->setMinValue(0); 436 551 _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); 437 552 _sfxVolumeLabel->setFlags(WIDGET_CLEARBG); 438 553 439 new StaticTextWidget(boss, prefix + "vcSpeechText" , slider_labels[2]);554 _speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , "Speech volume:"); 440 555 _speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", kSpeechVolumeChanged); 441 556 _speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", "100%"); 442 557 _speechVolumeSlider->setMinValue(0); … … 446 561 _enableVolumeSettings = true; 447 562 } 448 563 564 int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) { 565 if (!subtitles && !speech_mute) // Speech only 566 return 0; 567 else if (subtitles && !speech_mute) // Speech and subtitles 568 return 1; 569 else if (subtitles && speech_mute) // Subtitles only 570 return 2; 571 else 572 warning("Wrong configuration: Both subtitles and speech are off. Assuming subtitles only"); 573 return 2; 574 } 575 449 576 void OptionsDialog::handleScreenChanged() { 450 577 Dialog::handleScreenChanged(); 451 578 … … 481 608 tab->addTab("Audio"); 482 609 addAudioControls(tab, "globaloptions_"); 483 610 addVolumeControls(tab, "globaloptions_"); 611 addSubtitleControls(tab, "globaloptions_"); 612 484 613 // TODO: cd drive setting 485 614 486 615 // -
gui/launcher.cpp
189 189 _platformPopUp->appendEntry(p->description, p->id); 190 190 } 191 191 192 // 192 193 // 2) The 'Path' tab 194 // 193 195 tab->addTab("Paths"); 194 196 195 197 // These buttons have to be extra wide, or the text will be truncated … … 230 232 _globalAudioOverride = new CheckboxWidget(tab, "gameoptions_audioCheckbox", "Override global audio settings", kCmdGlobalAudioOverride, 0); 231 233 232 234 addAudioControls(tab, "gameoptions_"); 235 addSubtitleControls(tab, "gameoptions_"); 233 236 234 237 // 235 238 // 5) The MIDI tab … … 249 252 250 253 addVolumeControls(tab, "gameoptions_"); 251 254 252 253 255 // Activate the first tab 254 256 tab->setActiveTab(0); 255 257 … … 271 273 _globalGraphicsOverride->setState(e); 272 274 273 275 e = ConfMan.hasKey("music_driver", _domain) || 274 ConfMan.hasKey("subtitles", _domain); 276 ConfMan.hasKey("subtitles", _domain) || 277 ConfMan.hasKey("talkspeed", _domain); 275 278 _globalAudioOverride->setState(e); 276 279 277 280 e = ConfMan.hasKey("multi_midi", _domain) || … … 346 349 break; 347 350 case kCmdGlobalAudioOverride: 348 351 setAudioSettingsState(data != 0); 352 setSubtitleSettingsState(data != 0); 349 353 draw(); 350 354 break; 351 355 case kCmdGlobalMIDIOverride: … … 356 360 setVolumeSettingsState(data != 0); 357 361 draw(); 358 362 break; 359 360 363 case kCmdChooseSoundFontCmd: { 361 364 BrowserDialog browser("Select SoundFont", false); 362 365 -
gui/theme-config.cpp
50 50 "def_scummhelpX=5\n" 51 51 "def_scummhelpW=(w - 2 * 5)\n" 52 52 "def_midiControlsSpacing=1\n" 53 "def_vcAudioTabIndent=0\n" 53 54 "use=XxY\n" 54 55 "# Scumm Saveload dialog\n" 55 56 "scummsaveload=8 8 (w - 2 * 8) (h - 16)\n" … … 85 86 "def_scummhelpW=370\n" 86 87 "def_scummhelpX=((w - scummhelpW) / 2)\n" 87 88 "def_midiControlsSpacing=2\n" 89 "def_vcAudioTabIndent=10\n" 88 90 "##### Widgets config\n" 89 91 "ListWidget.leftPadding=4\n" 90 92 "ListWidget.rightPadding=0\n" … … 141 143 "\n" 142 144 "# graphics tab\n" 143 145 "opYoffset=vBorder\n" 146 "opXoffset=0\n" 144 147 "useWithPrefix=graphicsControls globaloptions_\n" 145 148 "\n" 146 149 "# audio tab\n" 147 150 "opYoffset=vBorder\n" 148 151 "useWithPrefix=audioControls globaloptions_\n" 149 152 "useWithPrefix=volumeControls globaloptions_\n" 153 "useWithPrefix=subtitleControls globaloptions_\n" 150 154 "\n" 151 155 "# MIDI tab\n" 152 156 "opYoffset=vBorder\n" … … 205 209 "\n" 206 210 "# graphics tab\n" 207 211 "opYoffset=vBorder\n" 212 "opXoffset=gox\n" 208 213 "gameoptions_graphicsCheckbox=gox opYoffset (kFontHeight + 10 + 192) buttonHeight\n" 209 214 "opYoffset=(opYoffset + buttonHeight)\n" 210 215 "useWithPrefix=graphicsControls gameoptions_\n" … … 214 219 "gameoptions_audioCheckbox=gox opYoffset (kFontHeight + 10 + 180) buttonHeight\n" 215 220 "opYoffset=(opYoffset + buttonHeight)\n" 216 221 "useWithPrefix=audioControls gameoptions_\n" 222 "useWithPrefix=subtitleControls gameoptions_\n" 217 223 "\n" 218 224 "# midi tab\n" 219 225 "opYoffset=vBorder\n" … … 251 257 "# hence it is on the end of the list\n" 252 258 "opYoffset=8\n" 253 259 "useWithPrefix=volumeControls scummconfig_\n" 254 " scummconfig_subtitlesCheckbox=15 opYoffset (kFontHeight + 10 + 89) buttonHeight\n"260 "useWithPrefix=subtitleControls scummconfig_\n" 255 261 "opYoffset=(opYoffset + buttonHeight)\n" 256 "scummconfig_speechCheckbox=prev.x opYoffset (kFontHeight + 10 + 85) buttonHeight\n"257 262 "opYoffset=(opYoffset + buttonHeight + 4)\n" 258 263 "soWidth=(8 + 3 * buttonWidth + 4)\n" 259 264 "scummconfig_keys=(soWidth - 3 * (buttonWidth + 4) + 6) opYoffset (buttonWidth - 10) buttonHeight\n" … … 299 304 "chooser_cancel=(chooserW - 2 * (buttonWidth + 10)) (opHeight - buttonHeight - 8) buttonWidth buttonHeight\n" 300 305 "chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h\n" 301 306 "\n" 302 "\n"303 307 "[graphicsControls]\n" 304 308 "gcx=10\n" 305 309 "gcw=(parent.w - 2 * 10)\n" … … 316 320 "aux=10\n" 317 321 "auw=(parent.w - 2 * 10)\n" 318 322 "auMidiPopup=(aux - 5) (opYoffset - 1) (auw + 5) (kLineHeight + 2)\n" 319 "opYoffset=(opYoffset + kLineHeight + 4)\n" 320 "auSubtitlesCheckbox=aux opYoffset (kFontHeight + 10 + 102) buttonHeight\n" 321 "opYoffset=(opYoffset + buttonHeight + 18)\n" 323 "opYoffset=(opYoffset + buttonHeight + 4)\n" 322 324 "\n" 323 325 "[volumeControls]\n" 324 "vctextw=95\n" 325 "vcxoff=(vctextw + 15)\n" 326 "vcMusicText=10 (opYoffset + 2) vctextw kLineHeight\n" 326 "vctextw=(95 + vcAudioTabIndent)\n" 327 "vcxoff=(opXoffset + vctextw + 15)\n" 328 "vcx=(opXoffset + 10)\n" 329 "vcMusicText=vcx (opYoffset + 2) vctextw kLineHeight\n" 327 330 "vcMusicText.align=kTextAlignRight\n" 328 331 "vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight\n" 329 332 "vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" 330 333 "opYoffset=(opYoffset + sliderHeight + 4)\n" 331 "vcSfxText= 10(opYoffset + 2) vctextw kLineHeight\n"334 "vcSfxText=vcx (opYoffset + 2) vctextw kLineHeight\n" 332 335 "vcSfxText.align=kTextAlignRight\n" 333 336 "vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight\n" 334 337 "vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" 335 338 "opYoffset=(opYoffset + sliderHeight + 4)\n" 336 "vcSpeechText= 10(opYoffset + 2) vctextw kLineHeight\n"339 "vcSpeechText=vcx (opYoffset + 2) vctextw kLineHeight\n" 337 340 "vcSpeechText.align=kTextAlignRight\n" 338 341 "vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight\n" 339 342 "vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" … … 351 354 "mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight\n" 352 355 "opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)\n" 353 356 "\n" 357 "[subtitleControls]\n" 358 "sbx=(opXoffset + 10)\n" 359 "sbYoff=(buttonHeight / 8)\n" 360 "sbOff=((sliderHeight - kLineHeight) / 2 + 2)\n" 361 "sbtextw=(100 + vcAudioTabIndent)\n" 362 "opYoffset=(opYoffset + sbYoff)\n" 363 "subToggleDesc=sbx (opYoffset + sbYoff) sbtextw buttonHeight\n" 364 "subToggleButton=prev.x2 (opYoffset - sbYoff) (buttonWidth + 54) buttonHeight\n" 365 "opYoffset=(opYoffset + buttonHeight + 6)\n" 366 "subSubtitleSpeedDesc=sbx (opYoffset + sbOff) sbtextw kLineHeight\n" 367 "subSubtitleSpeedDesc.align=kTextAlignRight\n" 368 "subSubtitleSpeedSlider=prev.x2 opYoffset sliderWidth sliderHeight\n" 369 "subSubtitleSpeedLabel=(prev.x2 + 10) (opYoffset + sbOff) 24 kLineHeight\n" 370 "opYoffset=(opYoffset + sliderHeight + 8)\n" 371 "\n" 354 372 "[scummmain]\n" 355 373 "## Main dialog\n" 356 374 "# note that scummmain size depends on overall height\n" -
engines/scumm/input.cpp
445 445 // Display the talk speed 446 446 ValueDisplayDialog dlg("Text speed: ", 0, 9, 9 - _defaultTalkDelay, '+', '-'); 447 447 _defaultTalkDelay = 9 - runDialog(dlg); 448 449 // Save the new talkspeed value to ConfMan 450 setTalkspeed(9 - _defaultTalkDelay); 448 451 449 452 if (VAR_CHARINC != 0xFF) 450 453 VAR(VAR_CHARINC) = _defaultTalkDelay; -
engines/scumm/dialogs.cpp
608 608 #pragma mark - 609 609 610 610 enum { 611 kOKCmd 611 kOKCmd = 'ok ' 612 612 }; 613 613 614 614 enum { … … 653 653 // Some misc options 654 654 // 655 655 656 _subtitlesCheckbox = new GUI::CheckboxWidget(this, "scummconfig_subtitlesCheckbox", "Show subtitles", 0, 'S');657 _speechCheckbox = new GUI::CheckboxWidget(this, "scummconfig_speechCheckbox", "Enable speech", 0, 'E');656 // SCUMM has a talkspeed range of 0-9 657 addSubtitleControls(this, "scummconfig_", 9); 658 658 659 659 // 660 660 // Add the buttons … … 683 683 684 684 void ConfigDialog::open() { 685 685 GUI_OptionsDialog::open(); 686 687 // update checkboxes, too688 _subtitlesCheckbox->setState(ConfMan.getBool("subtitles", _domain));689 _speechCheckbox->setState(!ConfMan.getBool("speech_mute", _domain));690 686 } 691 687 692 688 void ConfigDialog::close() { 693 if (getResult()) {694 // Subtitles695 ConfMan.setBool("subtitles", _subtitlesCheckbox->getState(), _domain);696 ConfMan.setBool("speech_mute", !_speechCheckbox->getState(), _domain);697 }698 699 689 GUI_OptionsDialog::close(); 700 690 } 701 691 … … 927 917 } 928 918 929 919 void ValueDisplayDialog::handleTickle() { 930 if (getMillis() > _timer) 920 if (getMillis() > _timer) { 931 921 close(); 922 } 932 923 } 933 924 934 925 void ValueDisplayDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { -
engines/scumm/scumm.cpp
499 499 VAR_SOUNDPARAM3 = 0xFF; 500 500 VAR_MOUSEPRESENT = 0xFF; 501 501 VAR_MEMORY_PERFORMANCE = 0xFF; 502 503 // Set scumm's 0-9 talkspeed scale in relation to the engine's 0-255 504 _talkspeedScale = 9.0 / 255.0; 505 506 if (ConfMan.hasKey("talkspeed")) { 507 _defaultTalkDelay = 9 - getTalkspeed(); 508 VAR_CHARINC = _defaultTalkDelay; 509 } 510 502 511 VAR_VIDEO_PERFORMANCE = 0xFF; 503 512 VAR_ROOM_FLAG = 0xFF; 504 513 VAR_GAME_LOADED = 0xFF; … … 1498 1507 _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic); 1499 1508 _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech); 1500 1509 1501 1502 1510 if (ConfMan.getBool("speech_mute")) 1503 1511 _voiceMode = 2; 1504 1512 else … … 1506 1514 1507 1515 if (VAR_VOICE_MODE != 0xFF) 1508 1516 VAR(VAR_VOICE_MODE) = _voiceMode; 1517 1518 _defaultTalkDelay = 9 - getTalkspeed(); 1519 VAR(VAR_CHARINC) = _defaultTalkDelay; 1509 1520 } 1510 1521 1522 void ScummEngine::setTalkspeed(int talkspeed) { 1523 if (talkspeed != 0) 1524 if (talkspeed == 9) 1525 talkspeed = 255; 1526 else 1527 talkspeed = (int)(talkspeed / _talkspeedScale + 0.5); 1528 ConfMan.setInt("talkspeed", talkspeed); 1529 } 1511 1530 1531 int ScummEngine::getTalkspeed() { 1532 int talkspeed = ConfMan.getInt("talkspeed"); 1512 1533 1534 if (talkspeed != 0) 1535 if (talkspeed == 255) 1536 talkspeed = 9; 1537 else 1538 talkspeed = (int)(talkspeed * _talkspeedScale + 0.5); 1539 return talkspeed; 1540 } 1541 1542 1513 1543 #pragma mark - 1514 1544 #pragma mark --- Main loop --- 1515 1545 #pragma mark - -
engines/scumm/dialogs.h
140 140 virtual void open(); 141 141 virtual void close(); 142 142 virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); 143 144 protected:145 GUI::CheckboxWidget *_subtitlesCheckbox;146 GUI::CheckboxWidget *_speechCheckbox;147 143 }; 148 144 149 145 /** -
engines/scumm/scumm.h
470 470 void loadCJKFont(); 471 471 void setupMusic(int midi); 472 472 void updateSoundSettings(); 473 void setTalkspeed(int talkspeed); 474 int getTalkspeed(); 475 float _talkspeedScale; 473 476 474 477 protected: 475 478 // Scumm main loop & helper functions. -
engines/scumm/script_v8.cpp
420 420 checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)"); 421 421 422 422 if (var == VAR_CHARINC && ConfMan.hasKey("talkspeed")) { 423 uint talkspeed = ConfMan.getInt("talkspeed");423 uint talkspeed = getTalkspeed(); 424 424 if (talkspeed <= 9) 425 425 VAR(VAR_CHARINC) = talkspeed; 426 426 } else -
engines/scumm/script.cpp
617 617 } 618 618 619 619 if (var == VAR_CHARINC && ConfMan.hasKey("talkspeed")) { 620 uint talkspeed = ConfMan.getInt("talkspeed");620 uint talkspeed = getTalkspeed(); 621 621 if (talkspeed <= 9) 622 622 VAR(VAR_CHARINC) = talkspeed; 623 623 } else { -
engines/queen/queen.cpp
186 186 _music->setVolume(ConfMan.getInt("music_volume")); 187 187 _sound->musicToggle(!ConfMan.getBool("music_mute")); 188 188 _sound->sfxToggle(!ConfMan.getBool("sfx_mute")); 189 _talkSpeed = ConfMan.getInt("talkspeed");189 _talkSpeed = (int)(ConfMan.getInt("talkspeed") * _talkspeedScale + 0.5); 190 190 _sound->speechToggle(!ConfMan.getBool("speech_mute")); 191 191 _subtitles = ConfMan.getBool("subtitles"); 192 192 checkOptionSettings(); … … 196 196 ConfMan.setInt("music_volume", _music->volume()); 197 197 ConfMan.setBool("music_mute", !_sound->musicOn()); 198 198 ConfMan.setBool("sfx_mute", !_sound->sfxOn()); 199 ConfMan.setInt("talkspeed", _talkSpeed);199 ConfMan.setInt("talkspeed", (int)(_talkSpeed / _talkspeedScale + 0.5)); 200 200 ConfMan.setBool("speech_mute", !_sound->speechOn()); 201 201 ConfMan.setBool("subtitles", _subtitles); 202 202 ConfMan.flushToDisk(); … … 444 444 445 445 _sound = Sound::giveSound(_mixer, this, _resource->compression()); 446 446 _walk = new Walk(this); 447 _talkspeedScale = (QueenEngine::MAX_TEXT_SPEED - QueenEngine::MIN_TEXT_SPEED) / 255.0; 447 448 448 449 registerDefaultSettings(); 449 450 readOptionSettings(); -
engines/queen/journal.cpp
310 310 enterYesNoPanelMode(zoneNum, TXT_GIVE_UP); 311 311 break; 312 312 case ZN_TEXT_SPEED: 313 313 val = (x - 136) * QueenEngine::MAX_TEXT_SPEED / (266 - 136); 314 314 _vm->talkSpeed(val); 315 315 drawConfigPanel(); 316 316 break; -
engines/queen/queen.h
156 156 Resource *_resource; 157 157 Sound *_sound; 158 158 Walk *_walk; 159 160 private: 161 float _talkspeedScale; 159 162 }; 160 163 161 164 } // End of namespace Queen