Ticket #8604: sky-control2.patch
File sky-control2.patch, 5.3 KB (added by , 18 years ago) |
---|
-
engines/sky/control.h
203 203 uint16 handleClick(ConResource *pButton); 204 204 uint16 doMusicSlide(void); 205 205 uint16 doSpeedSlide(void); 206 uint16toggleFx(ConResource *pButton);206 void toggleFx(ConResource *pButton); 207 207 uint16 toggleText(void); 208 void toggleMusic( void);208 void toggleMusic(ConResource *pButton); 209 209 uint16 shiftDown(uint8 speed); 210 210 uint16 shiftUp(uint8 speed); 211 211 void drawTextCross(uint32 flags); -
engines/sky/sky.cpp
357 357 if (ConfMan.getBool("sfx_mute")) { 358 358 SkyEngine::_systemVars.systemFlags |= SF_FX_OFF; 359 359 } 360 if (ConfMan.getBool("music_mute")) { 361 SkyEngine::_systemVars.systemFlags |= SF_MUS_OFF; 362 } 360 363 _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); 361 364 _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); 362 365 _floppyIntro = ConfMan.getBool("alt_intro"); -
engines/sky/control.cpp
284 284 _savePanButton = createResource( _sprites.button, 3, 0, 58, 39, 48, SAVE_GAME_PANEL, MAINPANEL); 285 285 _dosPanButton = createResource( _sprites.button, 3, 0, 58, 59, 93, QUIT_TO_DOS, MAINPANEL); 286 286 _restartPanButton = createResource( _sprites.button, 3, 0, 58, 79, 94, RESTART, MAINPANEL); 287 if (SkyEngine::_systemVars.systemFlags & SF_FX_OFF) 288 _fxPanButton = createResource( _sprites.button, 3, 0, 58, 99, 87, TOGGLE_FX, MAINPANEL); 289 else 290 _fxPanButton = createResource( _sprites.button, 3, 2, 58, 99, 86, TOGGLE_FX, MAINPANEL); 287 _fxPanButton = createResource( _sprites.button, 3, 0, 58, 99, 90, TOGGLE_FX, MAINPANEL); 291 288 292 289 if (SkyEngine::isCDVersion()) { // CD Version: Toggle text/speech 293 _musicPanButton = createResource( 290 _musicPanButton = createResource( _sprites.button, 3, 0, 58, 119, 52, TOGGLE_TEXT, MAINPANEL); 294 291 } else { // disk version: toggle music on/off 295 _musicPanButton = createResource( 292 _musicPanButton = createResource( _sprites.button, 3, 0, 58, 119, 91, TOGGLE_MS, MAINPANEL); 296 293 } 297 294 _bodge = createResource( _sprites.musicBodge, 2, 1, 98, 115, 0, DO_NOTHING, MAINPANEL); 298 295 _yesNo = createResource( _sprites.yesNo, 1, 0, -2, 40, 0, DO_NOTHING, MAINPANEL); … … 474 471 else 475 472 _skyScreen->setPalette(60510); 476 473 474 // Set initial button lights 475 _fxPanButton->_curSprite = 476 (SkyEngine::_systemVars.systemFlags & SF_FX_OFF ? 0 : 2); 477 478 // music button only available in floppy version 479 if (!SkyEngine::isCDVersion()) 480 _musicPanButton->_curSprite = 481 (SkyEngine::_systemVars.systemFlags & SF_MUS_OFF ? 0 : 2); 482 477 483 drawMainPanel(); 478 484 479 485 _savedMouse = _skyMouse->giveCurrentMouseType(); … … 573 579 _mouseClicked = true; 574 580 return doMusicSlide(); 575 581 case TOGGLE_FX: 576 return toggleFx(pButton); 582 toggleFx(pButton); 583 return TOGGLED; 577 584 case TOGGLE_MS: 578 animClick(pButton); 579 toggleMusic(); 585 toggleMusic(pButton); 580 586 return TOGGLED; 581 587 case TOGGLE_TEXT: 582 588 animClick(pButton); … … 647 653 wantMouse = MOUSE_NORMAL; 648 654 } 649 655 _mouseClicked = false; 656 _skyMouse->spriteMouse(MOUSE_NORMAL, 0, 0); 650 657 if (dlgTextDat) 651 658 free(dlgTextDat); 652 659 delete dlgText; … … 708 715 return SPEED_CHANGED; 709 716 } 710 717 711 uint16Control::toggleFx(ConResource *pButton) {718 void Control::toggleFx(ConResource *pButton) { 712 719 713 720 SkyEngine::_systemVars.systemFlags ^= SF_FX_OFF; 714 721 if (SkyEngine::_systemVars.systemFlags & SF_FX_OFF) { 715 722 pButton->_curSprite = 0; 716 pButton->_text = 0x7000 + 87;717 723 _statusBar->setToText(0x7000 + 87); 718 724 } else { 719 725 pButton->_curSprite = 2; 720 pButton->_text = 0x7000 + 86;721 726 _statusBar->setToText(0x7000 + 86); 722 727 } 723 728 724 729 ConfMan.setBool("sfx_mute", (SkyEngine::_systemVars.systemFlags & SF_FX_OFF) != 0); 725 730 726 731 pButton->drawToScreen(WITH_MASK); 727 buttonControl(pButton);728 732 _system->updateScreen(); 729 return TOGGLED;730 733 } 731 734 732 735 uint16 Control::toggleText(void) { … … 756 759 return TOGGLED; 757 760 } 758 761 759 void Control::toggleMusic( void) {762 void Control::toggleMusic(ConResource *pButton) { 760 763 764 SkyEngine::_systemVars.systemFlags ^= SF_MUS_OFF; 761 765 if (SkyEngine::_systemVars.systemFlags & SF_MUS_OFF) { 762 SkyEngine::_systemVars.systemFlags &= ~SF_MUS_OFF; 766 _skyMusic->startMusic(0); 767 pButton->_curSprite = 0; 768 _statusBar->setToText(0x7000 + 89); 769 } else { 763 770 _skyMusic->startMusic(SkyEngine::_systemVars.currentMusic); 771 pButton->_curSprite = 2; 764 772 _statusBar->setToText(0x7000 + 88); 765 } else {766 SkyEngine::_systemVars.systemFlags |= SF_MUS_OFF;767 _skyMusic->startMusic(0);768 _statusBar->setToText(0x7000 + 89);769 773 } 774 775 ConfMan.setBool("music_mute", (SkyEngine::_systemVars.systemFlags & SF_MUS_OFF) != 0); 776 777 pButton->drawToScreen(WITH_MASK); 778 _system->updateScreen(); 770 779 } 771 780 772 781 uint16 Control::shiftDown(uint8 speed) {