From f101906bc2d654c80ccadbf560261727759eea0c Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Mon, 2 Jul 2018 10:45:17 +0300 Subject: BLADERUNNER: Removed compile time macros, added synch with GUI --- engines/bladerunner/ui/elevator.cpp | 7 ++-- engines/bladerunner/ui/esper.cpp | 6 +--- engines/bladerunner/ui/kia.cpp | 6 +--- engines/bladerunner/ui/kia_section_settings.cpp | 46 +++---------------------- engines/bladerunner/ui/kia_section_settings.h | 4 --- engines/bladerunner/ui/vk.cpp | 6 +--- 6 files changed, 10 insertions(+), 65 deletions(-) (limited to 'engines/bladerunner/ui') diff --git a/engines/bladerunner/ui/elevator.cpp b/engines/bladerunner/ui/elevator.cpp index 7026f0ea01..759c0e7cb6 100644 --- a/engines/bladerunner/ui/elevator.cpp +++ b/engines/bladerunner/ui/elevator.cpp @@ -32,9 +32,7 @@ #include "bladerunner/time.h" #include "bladerunner/ui/ui_image_picker.h" #include "bladerunner/vqa_player.h" -#if SUBTITLES_SUPPORT #include "bladerunner/subtitles.h" -#endif #include "common/rect.h" #include "common/str.h" @@ -229,9 +227,8 @@ void Elevator::tick() { _imagePicker->draw(_vm->_surfaceFront); _vm->_mouse->draw(_vm->_surfaceFront, p.x, p.y); -#if SUBTITLES_SUPPORT - _vm->_subtitles->tick(_vm->_surfaceFront); -#endif + _vm->_subtitles->tick(_vm->_surfaceFront); + _vm->blitToScreen(_vm->_surfaceFront); tickDescription(); _vm->_system->delayMillis(10); diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp index 2a0431f0d8..791dd273ab 100644 --- a/engines/bladerunner/ui/esper.cpp +++ b/engines/bladerunner/ui/esper.cpp @@ -38,9 +38,7 @@ #include "bladerunner/time.h" #include "bladerunner/ui/ui_image_picker.h" #include "bladerunner/vqa_player.h" -#if SUBTITLES_SUPPORT #include "bladerunner/subtitles.h" -#endif #include "common/rect.h" #include "common/str.h" @@ -233,9 +231,7 @@ void ESPER::tick() { drawMouse(_vm->_surfaceFront); tickSound(); -#if SUBTITLES_SUPPORT - _vm->_subtitles->tick(_vm->_surfaceFront); -#endif + _vm->_subtitles->tick(_vm->_surfaceFront); _vm->blitToScreen(_vm->_surfaceFront); // TODO: implement 60hz lock for smoother experience diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp index 183bf615d9..d54133a7e4 100644 --- a/engines/bladerunner/ui/kia.cpp +++ b/engines/bladerunner/ui/kia.cpp @@ -53,9 +53,7 @@ #include "bladerunner/ui/kia_shapes.h" #include "bladerunner/ui/ui_image_picker.h" #include "bladerunner/vqa_player.h" -#if SUBTITLES_SUPPORT #include "bladerunner/subtitles.h" -#endif // SUBTITLES_SUPPORT #include "common/str.h" #include "common/keyboard.h" @@ -374,9 +372,7 @@ void KIA::tick() { } _vm->_mouse->draw(_vm->_surfaceFront, mouse.x, mouse.y); -#if SUBTITLES_SUPPORT - _vm->_subtitles->tick(_vm->_surfaceFront); -#endif + _vm->_subtitles->tick(_vm->_surfaceFront); _vm->blitToScreen(_vm->_surfaceFront); _vm->_system->delayMillis(10); diff --git a/engines/bladerunner/ui/kia_section_settings.cpp b/engines/bladerunner/ui/kia_section_settings.cpp index 8ff3c7e7b5..4fd04a9b00 100644 --- a/engines/bladerunner/ui/kia_section_settings.cpp +++ b/engines/bladerunner/ui/kia_section_settings.cpp @@ -55,14 +55,8 @@ KIASectionSettings::KIASectionSettings(BladeRunnerEngine *vm) _ambientSoundVolume = new UISlider(_vm, sliderCallback, this, Common::Rect(180, 210, 460, 220), 101, 0); _speechVolume = new UISlider(_vm, sliderCallback, this, Common::Rect(180, 235, 460, 245), 101, 0); _gammaCorrection = new UISlider(_vm, sliderCallback, this, Common::Rect(180, 260, 460, 270), 101, 0); -#if BLADERUNNER_RESTORED_CONTENT_GAME _directorsCut = new UICheckBox(_vm, checkBoxCallback, this, Common::Rect(180, 364, 270, 374), 0, false); - #if SUBTITLES_SUPPORT - _subtitlesEnable = new UICheckBox(_vm, checkBoxCallback, this, Common::Rect(291, 364, 360, 374), 0, false); - #endif // SUBTITLES_SUPPORT -#else - _directorsCut = new UICheckBox(_vm, checkBoxCallback, this, Common::Rect(180, 364, 460, 374), 0, false); // original -#endif // BLADERUNNER_RESTORED_CONTENT_GAME + _subtitlesEnable = new UICheckBox(_vm, checkBoxCallback, this, Common::Rect(291, 364, 360, 374), 0, false); _playerAgendaSelector = new UIImagePicker(_vm, 5); _uiContainer->add(_musicVolume); @@ -71,11 +65,7 @@ KIASectionSettings::KIASectionSettings(BladeRunnerEngine *vm) _uiContainer->add(_speechVolume); _uiContainer->add(_gammaCorrection); _uiContainer->add(_directorsCut); -#if BLADERUNNER_RESTORED_CONTENT_GAME - #if SUBTITLES_SUPPORT _uiContainer->add(_subtitlesEnable); - #endif // SUBTITLES_SUPPORT -#endif // BLADERUNNER_RESTORED_CONTENT_GAME _learyPos = 0; } @@ -88,11 +78,7 @@ KIASectionSettings::~KIASectionSettings() { delete _speechVolume; delete _gammaCorrection; delete _directorsCut; -#if BLADERUNNER_RESTORED_CONTENT_GAME - #if SUBTITLES_SUPPORT delete _subtitlesEnable; - #endif // SUBTITLES_SUPPORT -#endif // BLADERUNNER_RESTORED_CONTENT_GAME delete _playerAgendaSelector; } @@ -108,11 +94,7 @@ void KIASectionSettings::open() { _playerAgendaSelector->activate(mouseInCallback, nullptr, nullptr, mouseUpCallback, this); _directorsCut->enable(); -#if BLADERUNNER_RESTORED_CONTENT_GAME - #if SUBTITLES_SUPPORT _subtitlesEnable->enable(); - #endif // SUBTITLES_SUPPORT -#endif // BLADERUNNER_RESTORED_CONTENT_GAME } void KIASectionSettings::close() { @@ -126,11 +108,8 @@ void KIASectionSettings::draw(Graphics::Surface &surface) { _speechVolume->setValue(_vm->_audioSpeech->getVolume()); _gammaCorrection->setValue(100.0f); _directorsCut->setChecked(_vm->_gameFlags->query(kFlagDirectorsCut)); -#if BLADERUNNER_RESTORED_CONTENT_GAME - #if SUBTITLES_SUPPORT - _subtitlesEnable->setChecked(_vm->_extraGameFlagsForRestoredContent->query(kEDSFlagSubtitlesEnable)); - #endif // SUBTITLES_SUPPORT -#endif // BLADERUNNER_RESTORED_CONTENT_GAME + + _subtitlesEnable->setChecked(_vm->isSubtitlesEnabled()); const char *textConversationChoices = _vm->_textOptions->getText(0); const char *textMusic = _vm->_textOptions->getText(2); @@ -143,11 +122,8 @@ void KIASectionSettings::draw(Graphics::Surface &surface) { const char *textDark = _vm->_textOptions->getText(14); const char *textLight = _vm->_textOptions->getText(15); const char *textDesignersCut = _vm->_textOptions->getText(18); -#if BLADERUNNER_RESTORED_CONTENT_GAME - #if SUBTITLES_SUPPORT + // TODO REPLACE THIS STRING LITERAL MAYBE WITH A TEXT RESOURCE ITEM? const char *textSubtitles = "Subtitles"; - #endif // SUBTITLES_SUPPORT -#endif // BLADERUNNER_RESTORED_CONTENT_GAME int posConversationChoices = 320 - _vm->_mainFont->getTextWidth(textConversationChoices) / 2; int posMusic = 320 - _vm->_mainFont->getTextWidth(textMusic) / 2; @@ -184,11 +160,7 @@ void KIASectionSettings::draw(Graphics::Surface &surface) { _vm->_mainFont->drawColor(textLight, surface, 462, 261, 0x6EEE); _vm->_mainFont->drawColor(textDesignersCut, surface, 192, 365, 0x7751); -#if BLADERUNNER_RESTORED_CONTENT_GAME - #if SUBTITLES_SUPPORT _vm->_mainFont->drawColor(textSubtitles, surface, 303, 365, 0x7751); - #endif // SUBTITLES_SUPPORT -#endif // BLADERUNNER_RESTORED_CONTENT_GAME _playerAgendaSelector->drawTooltip(surface, _mouseX, _mouseY); } @@ -264,17 +236,9 @@ void KIASectionSettings::checkBoxCallback(void *callbackData, void *source) { self->_vm->_gameFlags->reset(kFlagDirectorsCut); } } - #if BLADERUNNER_RESTORED_CONTENT_GAME - #if SUBTITLES_SUPPORT else if (source == self->_subtitlesEnable) { - if (self->_subtitlesEnable->_isChecked) { - self->_vm->_extraGameFlagsForRestoredContent->set(kEDSFlagSubtitlesEnable); - } else { - self->_vm->_extraGameFlagsForRestoredContent->reset(kEDSFlagSubtitlesEnable); - } + self->_vm->setSubtitlesEnabled(self->_subtitlesEnable->_isChecked); } - #endif // SUBTITLES_SUPPORT - #endif // BLADERUNNER_RESTORED_CONTENT_GAME } void KIASectionSettings::mouseInCallback(int buttonId, void *callbackData) { diff --git a/engines/bladerunner/ui/kia_section_settings.h b/engines/bladerunner/ui/kia_section_settings.h index 4c5452b595..d554087b96 100644 --- a/engines/bladerunner/ui/kia_section_settings.h +++ b/engines/bladerunner/ui/kia_section_settings.h @@ -44,11 +44,7 @@ class KIASectionSettings : public KIASectionBase { UISlider *_speechVolume; UISlider *_gammaCorrection; UICheckBox *_directorsCut; -#if BLADERUNNER_RESTORED_CONTENT_GAME - #if SUBTITLES_SUPPORT UICheckBox *_subtitlesEnable; - #endif -#endif // BLADERUNNER_RESTORED_CONTENT_GAME UIImagePicker *_playerAgendaSelector; int _mouseX; diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp index 8565d39a36..031ba3b093 100644 --- a/engines/bladerunner/ui/vk.cpp +++ b/engines/bladerunner/ui/vk.cpp @@ -41,9 +41,7 @@ #include "bladerunner/time.h" #include "bladerunner/ui/ui_image_picker.h" #include "bladerunner/vqa_player.h" -#if SUBTITLES_SUPPORT #include "bladerunner/subtitles.h" -#endif #include "common/str.h" #include "common/keyboard.h" @@ -199,9 +197,7 @@ void VK::tick() { draw(); -#if SUBTITLES_SUPPORT - _vm->_subtitles->tick(_vm->_surfaceFront); -#endif // SUBTITLES_SUPPORT + _vm->_subtitles->tick(_vm->_surfaceFront); _vm->blitToScreen(_vm->_surfaceFront); _vm->_system->delayMillis(10); -- cgit v1.2.3