Ticket #8385: subtitles-new-fixed.patch
File subtitles-new-fixed.patch, 29.4 KB (added by , 19 years ago) |
---|
-
gui/options.h
64 64 void addAudioControls(GuiObject *boss, String prefix); 65 65 void addMIDIControls(GuiObject *boss, String prefix); 66 66 void addVolumeControls(GuiObject *boss, String prefix); 67 // The default value is the launcher's non-scaled talkspeed value. When SCUMM uses the widget, 68 // it uses its own scale 69 void addSubtitleControls(GuiObject *boss, String prefix, int maxSliderVal = 255); 67 70 68 71 void setGraphicSettingsState(bool enabled); 69 72 void setAudioSettingsState(bool enabled); 70 73 void setMIDISettingsState(bool enabled); 71 74 void setVolumeSettingsState(bool enabled); 75 void setSubtitleSettingsState(bool enabled); 72 76 73 77 private: 74 78 // … … 85 89 // 86 90 bool _enableAudioSettings; 87 91 PopUpWidget *_midiPopUp; 88 CheckboxWidget *_subCheckbox;89 92 90 93 // 91 94 // MIDI controls … … 94 97 CheckboxWidget *_multiMidiCheckbox; 95 98 CheckboxWidget *_mt32Checkbox; 96 99 CheckboxWidget *_enableGSCheckbox; 100 101 // 102 // Subtitle controls 103 // 104 int getSubtitleMode(bool subtitles, bool speech_mute); 105 bool _enableSubtitleSettings; 106 StaticTextWidget *_subToggleDesc; 107 ButtonWidget *_subToggleButton; 108 int _subMode; 109 static const char *_subModeDesc[]; 110 StaticTextWidget *_subSpeedDesc; 111 SliderWidget *_subSpeedSlider; 112 StaticTextWidget *_subSpeedLabel; 97 113 98 114 // 99 115 // Volume controls 100 116 // 101 117 bool _enableVolumeSettings; 102 118 119 StaticTextWidget *_musicVolumeDesc; 103 120 SliderWidget *_musicVolumeSlider; 104 121 StaticTextWidget *_musicVolumeLabel; 105 122 123 StaticTextWidget *_sfxVolumeDesc; 106 124 SliderWidget *_sfxVolumeSlider; 107 125 StaticTextWidget *_sfxVolumeLabel; 108 126 127 StaticTextWidget *_speechVolumeDesc; 109 128 SliderWidget *_speechVolumeSlider; 110 129 StaticTextWidget *_speechVolumeLabel; 111 130 }; -
gui/themes/modern.ini
217 217 opYoffset=vBorder 218 218 useWithPrefix=audioControls globaloptions_ 219 219 useWithPrefix=volumeControls globaloptions_ 220 useWithPrefix=subtitleControls globaloptions_ 220 221 221 222 # MIDI tab 222 223 opYoffset=vBorder … … 285 286 gameoptions_audioCheckbox=gox opYoffset (kFontHeight + 10 + 180) buttonHeight 286 287 opYoffset=(opYoffset + buttonHeight + 6) 287 288 useWithPrefix=audioControls gameoptions_ 289 useWithPrefix=subtitleControls gameoptions_ 288 290 289 291 # midi tab 290 292 opYoffset=vBorder … … 324 326 # hence it is on the end of the list 325 327 opYoffset=8 326 328 useWithPrefix=volumeControls scummconfig_ 327 scummconfig_subtitlesCheckbox=15 opYoffset (kFontHeight + 10 + 89) buttonHeight 329 useWithPrefix=subtitleControls scummconfig_ 328 330 opYoffset=(opYoffset + buttonHeight) 329 scummconfig_speechCheckbox=prev.x opYoffset (kFontHeight + 10 + 85) buttonHeight330 331 opYoffset=(opYoffset + buttonHeight + 4) 331 332 soWidth=(8 + 3 * buttonWidth + 4) 332 333 scummconfig_keys=(soWidth - 3 * (buttonWidth + 4) + 6) opYoffset (buttonWidth - 10) buttonHeight … … 373 374 chooser_cancel=(chooserW - 2 * (buttonWidth + 10)) (opHeight - buttonHeight - 8) buttonWidth buttonHeight 374 375 chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h 375 376 376 377 377 [graphicsControls] 378 378 gcx=(opXoffset + 10) 379 379 gcw=(parent.w - gcx - 25) … … 388 388 389 389 [audioControls] 390 390 aux=(opXoffset + 10) 391 auw=(parent.w - aux - 25) 392 auMidiPopup=(aux - 5) (opYoffset - 1) (auw + 5) (kLineHeight + 2) 393 opYoffset=(opYoffset + kLineHeight + 16) 394 auSubtitlesCheckbox=aux opYoffset (kFontHeight + 10 + 102) buttonHeight 395 opYoffset=(opYoffset + buttonHeight + 18) 391 auw=(parent.w - aux - 30) 392 auMidiPopup=(aux) (opYoffset - 1) (auw + 5) (kLineHeight + 2) 393 opYoffset=(opYoffset + buttonHeight + 4) 396 394 397 395 [volumeControls] 398 vctextw=95 399 vcxoff=(vctextw + 15) 400 vcMusicText=10 (opYoffset + 2) vctextw kLineHeight 396 vctextw=110 397 vcxoff=(opXoffset + vctextw + 10) 398 vcx=(opXoffset + 10) 399 vcMusicText=vcx (opYoffset + 2) vctextw kLineHeight 401 400 vcMusicText.align=kTextAlignRight 402 401 vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight 403 402 vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight 404 403 opYoffset=(opYoffset + sliderHeight + 8) 405 vcSfxText= 10(opYoffset + 2) vctextw kLineHeight404 vcSfxText=vcx (opYoffset + 2) vctextw kLineHeight 406 405 vcSfxText.align=kTextAlignRight 407 406 vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight 408 407 vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight 409 408 opYoffset=(opYoffset + sliderHeight + 8) 410 vcSpeechText= 10(opYoffset + 2) vctextw kLineHeight409 vcSpeechText=vcx (opYoffset + 2) vctextw kLineHeight 411 410 vcSpeechText.align=kTextAlignRight 412 411 vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight 413 412 vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight … … 426 425 mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight 427 426 opYoffset=(opYoffset + buttonHeight + midiControlsSpacing) 428 427 428 [subtitleControls] 429 sbx=(opXoffset + 10) 430 sbtextw=110 431 sbYoff=(buttonHeight / 8) 432 sbOff=((sliderHeight - kLineHeight) / 2) 433 opYoffset=(opYoffset + sbYoff) 434 subToggleDesc=sbx (opYoffset + sbYoff) sbtextw buttonHeight 435 subToggleButton=prev.x2 opYoffset (buttonWidth + 34) sliderHeight 436 opYoffset=(opYoffset + buttonHeight + 6) 437 subSubtitleSpeedDesc=sbx (opYoffset + sbOff) sbtextw kLineHeight 438 subSubtitleSpeedDesc.align=kTextAlignRight 439 subSubtitleSpeedSlider=prev.x2 opYoffset sliderWidth sliderHeight 440 subSubtitleSpeedLabel=(prev.x2 + 10) (opYoffset + sbOff) 24 kLineHeight 441 opYoffset=(opYoffset + sliderHeight + 8) 442 429 443 [scummmain] 430 444 ## Main dialog 431 445 # 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 _subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute")); 224 _subToggleButton->setLabel(_subModeDesc[_subMode]); 225 speed = ConfMan.getInt("talkspeed", _domain); 226 _subSpeedSlider->setValue(speed); 227 _subSpeedLabel->setValue(speed); 228 } 205 229 } 206 230 207 231 void OptionsDialog::close() { 208 232 if (getResult()) { 233 234 // Graphic options 209 235 if (_fullscreenCheckbox) { 210 236 if (_enableGraphicSettings) { 211 237 ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain); … … 224 250 } 225 251 } 226 252 253 // Volume options 227 254 if (_musicVolumeSlider) { 228 255 if (_enableVolumeSettings) { 229 256 ConfMan.setInt("music_volume", _musicVolumeSlider->getValue(), _domain); … … 236 263 } 237 264 } 238 265 239 if (_subCheckbox) { 266 // Audio options 267 if (_midiPopUp) { 240 268 if (_enableAudioSettings) { 241 ConfMan.setBool("subtitles", _subCheckbox->getState(), _domain);242 269 const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers(); 243 270 while (md->name && md->id != (int)_midiPopUp->getSelectedTag()) 244 271 md++; … … 248 275 ConfMan.removeKey("music_driver", _domain); 249 276 } else { 250 277 ConfMan.removeKey("music_driver", _domain); 251 ConfMan.removeKey("subtitles", _domain);252 278 } 253 279 } 254 280 … … 270 296 } 271 297 } 272 298 299 // Subtitle options 300 if (_subToggleButton) { 301 if (_enableSubtitleSettings) { 302 bool subtitles, speech_mute; 303 304 switch (_subMode) { 305 case 0: 306 subtitles = speech_mute = false; 307 break; 308 case 1: 309 subtitles = true; 310 speech_mute = false; 311 break; 312 case 2: 313 default: 314 subtitles = speech_mute = true; 315 break; 316 } 317 318 ConfMan.setBool("subtitles", subtitles, _domain); 319 ConfMan.setBool("speech_mute", speech_mute, _domain); 320 ConfMan.setInt("talkspeed", _subSpeedSlider->getValue(), _domain); 321 } else { 322 ConfMan.removeKey("subtitles", _domain); 323 ConfMan.removeKey("talkspeed", _domain); 324 ConfMan.removeKey("speech_mute", _domain); 325 } 326 } 327 273 328 // Save config file 274 329 ConfMan.flushToDisk(); 275 330 } … … 291 346 _speechVolumeLabel->setValue(_speechVolumeSlider->getValue()); 292 347 _speechVolumeLabel->draw(); 293 348 break; 349 case kSubtitleToggle: 350 if (_subMode < 2) 351 _subMode++; 352 else 353 _subMode = 0; 354 355 _subToggleButton->setLabel(_subModeDesc[_subMode]); 356 _subToggleButton->draw(); 357 _subSpeedDesc->draw(); 358 _subSpeedSlider->draw(); 359 _subSpeedLabel->draw(); 360 break; 361 case kSubtitleSpeedChanged: 362 _subSpeedLabel->setValue(_subSpeedSlider->getValue()); 363 _subSpeedLabel->draw(); 364 break; 294 365 case kOKCmd: 295 366 setResult(1); 296 367 close(); … … 315 386 _enableAudioSettings = enabled; 316 387 317 388 _midiPopUp->setEnabled(enabled); 318 _subCheckbox->setEnabled(enabled);319 389 } 320 390 321 391 void OptionsDialog::setMIDISettingsState(bool enabled) { … … 331 401 void OptionsDialog::setVolumeSettingsState(bool enabled) { 332 402 _enableVolumeSettings = enabled; 333 403 404 _musicVolumeDesc->setEnabled(enabled); 334 405 _musicVolumeSlider->setEnabled(enabled); 335 406 _musicVolumeLabel->setEnabled(enabled); 407 _sfxVolumeDesc->setEnabled(enabled); 336 408 _sfxVolumeSlider->setEnabled(enabled); 337 409 _sfxVolumeLabel->setEnabled(enabled); 410 _speechVolumeDesc->setEnabled(enabled); 338 411 _speechVolumeSlider->setEnabled(enabled); 339 412 _speechVolumeLabel->setEnabled(enabled); 340 413 } 341 414 415 void OptionsDialog::setSubtitleSettingsState(bool enabled) { 416 _enableSubtitleSettings = enabled; 417 418 _subToggleButton->setEnabled(enabled); 419 _subToggleDesc->setEnabled(enabled); 420 _subSpeedDesc->setEnabled(enabled); 421 _subSpeedSlider->setEnabled(enabled); 422 _subSpeedLabel->setEnabled(enabled); 423 } 424 342 425 void OptionsDialog::addGraphicControls(GuiObject *boss, String prefix) { 343 426 const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes(); 344 427 … … 391 474 md++; 392 475 } 393 476 394 // Subtitles on/off395 _subCheckbox = new CheckboxWidget(boss, prefix + "auSubtitlesCheckbox", "Display subtitles", 0, 0);396 397 477 _enableAudioSettings = true; 398 478 } 399 479 … … 414 494 _enableMIDISettings = true; 415 495 } 416 496 497 // The function has an extra slider range parameter, since both the launcher and SCUMM engine 498 // make use of the widgets. The launcher range is 0-255. SCUMM's 0-9 499 void OptionsDialog::addSubtitleControls(GuiObject *boss, String prefix, int maxSliderVal) { 500 501 _subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", "Text and Speech:"); 502 _subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle, 0); 503 504 // Subtitle speed 505 _subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", "Subtitle speed:"); 506 _subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", kSubtitleSpeedChanged); 507 _subSpeedLabel = new StaticTextWidget(boss, prefix + "subSubtitleSpeedLabel", "100%"); 508 _subSpeedSlider->setMinValue(0); _subSpeedSlider->setMaxValue(maxSliderVal); 509 _subSpeedLabel->setFlags(WIDGET_CLEARBG); 510 511 _enableSubtitleSettings = true; 512 } 513 417 514 void OptionsDialog::addVolumeControls(GuiObject *boss, String prefix) { 418 const char *slider_labels[] = {419 "Music volume:",420 "SFX volume:",421 "Speech volume:"422 };423 515 424 516 // Volume controllers 425 new StaticTextWidget(boss, prefix + "vcMusicText", slider_labels[0]);517 _musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", "Music volume:"); 426 518 _musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", kMusicVolumeChanged); 427 519 _musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", "100%"); 428 520 _musicVolumeSlider->setMinValue(0); 429 521 _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); 430 522 _musicVolumeLabel->setFlags(WIDGET_CLEARBG); 431 523 432 new StaticTextWidget(boss, prefix + "vcSfxText", slider_labels[1]);524 _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", "SFX volume:"); 433 525 _sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged); 434 526 _sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%"); 435 527 _sfxVolumeSlider->setMinValue(0); 436 528 _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); 437 529 _sfxVolumeLabel->setFlags(WIDGET_CLEARBG); 438 530 439 new StaticTextWidget(boss, prefix + "vcSpeechText" , slider_labels[2]);531 _speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , "Speech volume:"); 440 532 _speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", kSpeechVolumeChanged); 441 533 _speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", "100%"); 442 534 _speechVolumeSlider->setMinValue(0); … … 446 538 _enableVolumeSettings = true; 447 539 } 448 540 541 int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) { 542 if (!subtitles && !speech_mute) // Speech only 543 return 0; 544 else if (subtitles && !speech_mute) // Speech and subtitles 545 return 1; 546 else if (subtitles && speech_mute) // Subtitles only 547 return 2; 548 else 549 warning("Wrong configuration: Both subtitles and speech are off. Assuming subtitles only"); 550 return 2; 551 } 552 449 553 #pragma mark - 450 554 451 555 … … 468 572 tab->addTab("Audio"); 469 573 addAudioControls(tab, "globaloptions_"); 470 574 addVolumeControls(tab, "globaloptions_"); 575 addSubtitleControls(tab, "globaloptions_"); 576 471 577 // TODO: cd drive setting 472 578 473 579 // -
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 "\n" 55 56 "[XxY]\n" … … 76 77 "def_scummhelpW=370\n" 77 78 "def_scummhelpX=((w - scummhelpW) / 2)\n" 78 79 "def_midiControlsSpacing=2\n" 80 "def_vcAudioTabIndent=10\n" 79 81 "##### Widgets config\n" 80 82 "ListWidget.leftPadding=4\n" 81 83 "ListWidget.rightPadding=0\n" … … 132 134 "\n" 133 135 "# graphics tab\n" 134 136 "opYoffset=vBorder\n" 137 "opXoffset=0\n" 135 138 "useWithPrefix=graphicsControls globaloptions_\n" 136 139 "\n" 137 140 "# audio tab\n" 138 141 "opYoffset=vBorder\n" 139 142 "useWithPrefix=audioControls globaloptions_\n" 140 143 "useWithPrefix=volumeControls globaloptions_\n" 144 "useWithPrefix=subtitleControls globaloptions_\n" 141 145 "\n" 142 146 "# MIDI tab\n" 143 147 "opYoffset=vBorder\n" … … 196 200 "\n" 197 201 "# graphics tab\n" 198 202 "opYoffset=vBorder\n" 203 "opXoffset=gox\n" 199 204 "gameoptions_graphicsCheckbox=gox opYoffset (kFontHeight + 10 + 192) buttonHeight\n" 200 205 "opYoffset=(opYoffset + buttonHeight)\n" 201 206 "useWithPrefix=graphicsControls gameoptions_\n" … … 205 210 "gameoptions_audioCheckbox=gox opYoffset (kFontHeight + 10 + 180) buttonHeight\n" 206 211 "opYoffset=(opYoffset + buttonHeight)\n" 207 212 "useWithPrefix=audioControls gameoptions_\n" 213 "useWithPrefix=subtitleControls gameoptions_\n" 208 214 "\n" 209 215 "# midi tab\n" 210 216 "opYoffset=vBorder\n" … … 242 248 "# hence it is on the end of the list\n" 243 249 "opYoffset=8\n" 244 250 "useWithPrefix=volumeControls scummconfig_\n" 245 " scummconfig_subtitlesCheckbox=15 opYoffset (kFontHeight + 10 + 89) buttonHeight\n"251 "useWithPrefix=subtitleControls scummconfig_\n" 246 252 "opYoffset=(opYoffset + buttonHeight)\n" 247 "scummconfig_speechCheckbox=prev.x opYoffset (kFontHeight + 10 + 85) buttonHeight\n"248 253 "opYoffset=(opYoffset + buttonHeight + 4)\n" 249 254 "soWidth=(8 + 3 * buttonWidth + 4)\n" 250 255 "scummconfig_keys=(soWidth - 3 * (buttonWidth + 4) + 6) opYoffset (buttonWidth - 10) buttonHeight\n" … … 291 296 "chooser_cancel=(chooserW - 2 * (buttonWidth + 10)) (opHeight - buttonHeight - 8) buttonWidth buttonHeight\n" 292 297 "chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h\n" 293 298 "\n" 294 "\n"295 299 "[graphicsControls]\n" 296 300 "gcx=10\n" 297 301 "gcw=(parent.w - 2 * 10)\n" … … 301 305 "opYoffset=(opYoffset + kLineHeight + 4)\n" 302 306 "grFullscreenCheckbox=gcx opYoffset (kFontHeight + 10 + 96) buttonHeight\n" 303 307 "opYoffset=(opYoffset + buttonHeight)\n" 304 "grAspectCheckbox=prev.x opYoffset (kFontHeight + 10 + 1 36) prev.h\n"308 "grAspectCheckbox=prev.x opYoffset (kFontHeight + 10 + 140) prev.h\n" 305 309 "opYoffset=(opYoffset + buttonHeight)\n" 306 310 "\n" 307 311 "[audioControls]\n" 308 312 "aux=10\n" 309 313 "auw=(parent.w - 2 * 10)\n" 310 314 "auMidiPopup=(aux - 5) (opYoffset - 1) (auw + 5) (kLineHeight + 2)\n" 311 "opYoffset=(opYoffset + kLineHeight + 4)\n" 312 "auSubtitlesCheckbox=aux opYoffset (kFontHeight + 10 + 102) buttonHeight\n" 313 "opYoffset=(opYoffset + buttonHeight + 18)\n" 315 "opYoffset=(opYoffset + buttonHeight + 4)\n" 314 316 "\n" 315 317 "[volumeControls]\n" 316 "vctextw=95\n" 317 "vcxoff=(vctextw + 15)\n" 318 "vcMusicText=10 (opYoffset + 2) vctextw kLineHeight\n" 318 "vctextw=(95 + vcAudioTabIndent)\n" 319 "vcxoff=(opXoffset + vctextw + 15)\n" 320 "vcx=(opXoffset + 10)\n" 321 "vcMusicText=vcx (opYoffset + 2) vctextw kLineHeight\n" 319 322 "vcMusicText.align=kTextAlignRight\n" 320 323 "vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight\n" 321 324 "vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" 322 325 "opYoffset=(opYoffset + sliderHeight + 4)\n" 323 "vcSfxText= 10(opYoffset + 2) vctextw kLineHeight\n"326 "vcSfxText=vcx (opYoffset + 2) vctextw kLineHeight\n" 324 327 "vcSfxText.align=kTextAlignRight\n" 325 328 "vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight\n" 326 329 "vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" 327 330 "opYoffset=(opYoffset + sliderHeight + 4)\n" 328 "vcSpeechText= 10(opYoffset + 2) vctextw kLineHeight\n"331 "vcSpeechText=vcx (opYoffset + 2) vctextw kLineHeight\n" 329 332 "vcSpeechText.align=kTextAlignRight\n" 330 333 "vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight\n" 331 334 "vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n" … … 343 346 "mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight\n" 344 347 "opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)\n" 345 348 "\n" 349 "[subtitleControls]\n" 350 "sbx=(opXoffset + 10)\n" 351 "sbYoff=(buttonHeight / 8)\n" 352 "sbOff=((sliderHeight - kLineHeight) / 2 + 2)\n" 353 "sbtextw=(100 + vcAudioTabIndent)\n" 354 "opYoffset=(opYoffset + sbYoff)\n" 355 "subToggleDesc=sbx (opYoffset + sbYoff) sbtextw buttonHeight\n" 356 "subToggleButton=prev.x2 (opYoffset - sbYoff) (buttonWidth + 54) buttonHeight\n" 357 "opYoffset=(opYoffset + buttonHeight + 6)\n" 358 "subSubtitleSpeedDesc=sbx (opYoffset + sbOff) sbtextw kLineHeight\n" 359 "subSubtitleSpeedDesc.align=kTextAlignRight\n" 360 "subSubtitleSpeedSlider=prev.x2 opYoffset sliderWidth sliderHeight\n" 361 "subSubtitleSpeedLabel=(prev.x2 + 10) (opYoffset + sbOff) 24 kLineHeight\n" 362 "opYoffset=(opYoffset + sliderHeight + 8)\n" 363 "\n" 346 364 "[scummmain]\n" 347 365 "## Main dialog\n" 348 366 "# note that scummmain size depends on overall height\n" -
common/config-manager.h
151 151 void renameGameDomain(const String &oldName, const String &newName); 152 152 bool hasGameDomain(const String &domName) const; 153 153 const DomainMap & getGameDomains() const { return _gameDomains; } 154 154 void setTalkspeedScale(int minValue, int maxValue); 155 155 156 /* 156 157 TODO: Callback/change notification system 157 158 typedef void (*ConfigCallback)(const ConstString &key, void *refCon); … … 177 178 String _activeDomainName; 178 179 Domain * _activeDomain; 179 180 181 float _talkspeedScale; 182 int _talkspeedMinEngineValue; 183 int _talkspeedMaxEngineValue; 180 184 String _filename; 181 185 }; 182 186 -
common/config-manager.cpp
80 80 81 81 ConfigManager::ConfigManager() 82 82 : _activeDomain(0) { 83 84 // When in the launcher, setTalkSpeedScale() isn't called by any engine. 85 // talkspeed values won't be scaled 86 _talkspeedMinEngineValue = 0; 87 _talkspeedMaxEngineValue = 255; 88 _talkspeedScale = 1.0; 83 89 } 84 90 85 91 … … 433 439 error("ConfigManager::getInt(%s,%s): '%s' is not a valid integer", 434 440 key.c_str(), domName.c_str(), errpos); 435 441 442 // TalkSpeed values are given in the engine's scale. 443 // They are saved on a 0-255 scale and need to be converted to the engine's scale 444 if (key == String("talkspeed")) { 445 if (ivalue == 0) 446 ivalue = _talkspeedMinEngineValue; 447 else if (ivalue == 255) 448 ivalue = _talkspeedMaxEngineValue; 449 else if (_talkspeedScale != 1.0) 450 ivalue = (int)(_talkspeedMinEngineValue + ivalue * _talkspeedScale + 0.5); 451 } 452 436 453 return ivalue; 437 454 } 438 455 … … 508 525 } 509 526 510 527 void ConfigManager::setInt(const String &key, int value, const String &domName) { 528 529 // TalkSpeed values are given in the engine's scale. 530 // They are scaled back to a global 0-255 scale 531 if (key == String("talkspeed")) { 532 if (value == _talkspeedMinEngineValue) 533 value = 0; 534 else if (value == _talkspeedMaxEngineValue) 535 value = 255; 536 else if (_talkspeedScale != 1.0) 537 value = (int)((value - _talkspeedMinEngineValue) / _talkspeedScale + 0.5); 538 } 539 511 540 char tmp[128]; 512 541 snprintf(tmp, sizeof(tmp), "%i", value); 513 542 set(key, String(tmp), domName); … … 530 559 } 531 560 532 561 void ConfigManager::registerDefault(const String &key, int value) { 562 int scaledValue = value; 563 564 // TalkSpeed values are given in the engine's scale. 565 // They are scaled back to a global 0-255 scale 566 if (key == String("talkspeed")) { 567 scaledValue = (int)((value - _talkspeedMinEngineValue) / _talkspeedScale + 0.5); 568 } 569 533 570 char tmp[128]; 534 snprintf(tmp, sizeof(tmp), "%i", value);571 snprintf(tmp, sizeof(tmp), "%i", scaledValue); 535 572 registerDefault(key, tmp); 536 573 } 537 574 … … 626 663 return _keyValueComments.contains(key); 627 664 } 628 665 666 void ConfigManager::setTalkspeedScale(int minValue, int maxValue) { 667 _talkspeedMinEngineValue = minValue; 668 _talkspeedMaxEngineValue = maxValue; 669 _talkspeedScale = (maxValue - minValue) / 255.0; 670 } 671 629 672 } // End of namespace Common -
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 ConfMan.setInt("talkspeed", 9 - _defaultTalkDelay); 448 451 449 452 if (VAR_CHARINC != 0xFF) 450 453 VAR(VAR_CHARINC) = _defaultTalkDelay; -
engines/scumm/dialogs.cpp
649 649 #pragma mark - 650 650 651 651 enum { 652 kOKCmd 652 kOKCmd = 'ok ' 653 653 }; 654 654 655 655 enum { … … 694 694 // Some misc options 695 695 // 696 696 697 _subtitlesCheckbox = new GUI::CheckboxWidget(this, "scummconfig_subtitlesCheckbox", "Show subtitles", 0, 'S');698 _speechCheckbox = new GUI::CheckboxWidget(this, "scummconfig_speechCheckbox", "Enable speech", 0, 'E');697 // SCUMM has a talkspeed range of 0-9 698 addSubtitleControls(this, "scummconfig_", 9); 699 699 700 700 // 701 701 // Add the buttons … … 724 724 725 725 void ConfigDialog::open() { 726 726 GUI_OptionsDialog::open(); 727 728 // update checkboxes, too729 _subtitlesCheckbox->setState(ConfMan.getBool("subtitles", _domain));730 _speechCheckbox->setState(!ConfMan.getBool("speech_mute", _domain));731 727 } 732 728 733 729 void ConfigDialog::close() { 734 if (getResult()) { 735 // Subtitles 736 ConfMan.setBool("subtitles", _subtitlesCheckbox->getState(), _domain); 730 GUI_OptionsDialog::close(); 737 731 738 // Sync with current setting739 if (!_speechCheckbox->getState()) {740 ConfMan.setBool("speech_mute", true, _domain);732 if (getResult()) { 733 // Apply new settings to engine 734 if (ConfMan.getBool("speech_mute", _domain)) 741 735 _vm->_voiceMode = 2; 742 } else { 743 ConfMan.setBool("speech_mute", false, _domain); 744 _vm->_voiceMode = _subtitlesCheckbox->getState(); 745 } 746 736 else 737 _vm->_voiceMode = ConfMan.getBool("subtitles", _domain); 738 747 739 if (_vm->_game.version >= 7) 748 740 _vm->VAR(_vm->VAR_VOICE_MODE) = _vm->_voiceMode; 749 } 741 742 _vm->_defaultTalkDelay = 9 - ConfMan.getInt("talkspeed", _domain); 743 _vm->VAR(_vm->VAR_CHARINC) = _vm->_defaultTalkDelay; 750 744 751 GUI_OptionsDialog::close(); 752 753 _vm->setupVolumes(); 745 _vm->setupVolumes(); 746 } 754 747 } 755 748 756 749 void ConfigDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { … … 941 934 } 942 935 943 936 void ValueDisplayDialog::handleTickle() { 944 if (getMillis() > _timer) 937 if (getMillis() > _timer) { 945 938 close(); 939 } 946 940 } 947 941 948 942 void ValueDisplayDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { -
engines/scumm/scumm.cpp
460 460 VAR_SOUNDPARAM3 = 0xFF; 461 461 VAR_MOUSEPRESENT = 0xFF; 462 462 VAR_MEMORY_PERFORMANCE = 0xFF; 463 // Set talkspeed range and load values from ConfMan 464 ConfMan.setTalkspeedScale(0, 9); 465 466 if (ConfMan.hasKey("talkspeed")) { 467 _defaultTalkDelay = 9 - ConfMan.getInt("talkspeed"); 468 VAR_CHARINC = _defaultTalkDelay; 469 } 470 463 471 VAR_VIDEO_PERFORMANCE = 0xFF; 464 472 VAR_ROOM_FLAG = 0xFF; 465 473 VAR_GAME_LOADED = 0xFF; -
engines/scumm/dialogs.h
124 124 virtual void open(); 125 125 virtual void close(); 126 126 virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); 127 128 protected:129 GUI::CheckboxWidget *_subtitlesCheckbox;130 GUI::CheckboxWidget *_speechCheckbox;131 127 }; 132 128 133 129 /** -
engines/scumm/scumm.h
407 407 friend class ScummDebugger; 408 408 friend class SmushPlayer; 409 409 friend class Insane; 410 friend class ConfigDialog; 410 411 friend class CharsetRenderer; 411 412 friend class ResourceManager; 412 413 -
engines/queen/queen.cpp
445 445 446 446 _sound = Sound::giveSound(_mixer, this, _resource->compression()); 447 447 _walk = new Walk(this); 448 ConfMan.setTalkspeedScale(QueenEngine::MIN_TEXT_SPEED, QueenEngine::MAX_TEXT_SPEED); 448 449 449 450 registerDefaultSettings(); 450 451 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;