ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

settings.cpp

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "engines/stark/services/settings.h"
00024 #include "engines/stark/services/services.h"
00025 #include "engines/stark/services/archiveloader.h"
00026 
00027 #include "common/config-manager.h"
00028 #include "common/debug.h"
00029 
00030 #include "audio/mixer.h"
00031 
00032 #include "engines/advancedDetector.h"
00033 
00034 namespace Stark {
00035 
00036 Settings::Settings(Audio::Mixer *mixer, const ADGameDescription *gd) :
00037         _mixer(mixer),
00038         _isDemo(gd->flags & ADGF_DEMO),
00039         _language(gd->language) {
00040     // Initialize keys
00041     _boolKey[kHighModel] = "enable_high_resolution_models";
00042     _boolKey[kSubtitle] = "subtitles";
00043     _boolKey[kSpecialFX] = "enable_special_effects";
00044     _boolKey[kShadow] = "enable_shadows";
00045     _boolKey[kHighFMV] = "play_high_resolution_videos";
00046     _boolKey[kTimeSkip] = "enable_time_skip";
00047     _intKey[kVoice] = "speech_volume";
00048     _intKey[kMusic] = "music_volume";
00049     _intKey[kSfx] = "sfx_volume";
00050     _intKey[kSaveLoadPage] = "saveload_lastpage";
00051 
00052     // Register default settings
00053     ConfMan.registerDefault(_boolKey[kHighModel], true);
00054     ConfMan.registerDefault(_boolKey[kSubtitle], true);
00055     ConfMan.registerDefault(_boolKey[kSpecialFX], true);
00056     ConfMan.registerDefault(_boolKey[kShadow], true);
00057     ConfMan.registerDefault(_boolKey[kHighFMV], true);
00058     ConfMan.registerDefault(_boolKey[kTimeSkip], false);
00059     ConfMan.registerDefault(_intKey[kSaveLoadPage], 0);
00060     ConfMan.registerDefault("replacement_png_premultiply_alpha", false);
00061 
00062     // Use the FunCom logo video to check low-resolution fmv
00063     Common::SeekableReadStream *lowResFMV = StarkArchiveLoader->getExternalFile("1402_lo_res.bbb", "Global/");
00064     _hasLowRes = lowResFMV;
00065     delete lowResFMV;
00066 }
00067 
00068 void Settings::setIntSetting(IntSettingIndex index, int value) {
00069     ConfMan.setInt(_intKey[index], value);
00070 
00071     Audio::Mixer::SoundType type;
00072     switch (index) {
00073         case kVoice:
00074             type = Audio::Mixer::kSpeechSoundType;
00075             break;
00076         case kMusic:
00077             type = Audio::Mixer::kMusicSoundType;
00078             break;
00079         case kSfx:
00080             type = Audio::Mixer::kSFXSoundType;
00081             break;
00082         default:
00083             return;
00084     }
00085 
00086     _mixer->setVolumeForSoundType(type, value);
00087 }
00088 
00089 bool Settings::isAssetsModEnabled() const {
00090     return ConfMan.getBool("enable_assets_mod");
00091 }
00092 
00093 bool Settings::shouldPreMultiplyReplacementPNGs() const {
00094     return ConfMan.getBool("replacement_png_premultiply_alpha");
00095 }
00096 
00097 Gfx::Texture::SamplingFilter Settings::getImageSamplingFilter() const {
00098     return ConfMan.getBool("use_linear_filtering") ? Gfx::Texture::kLinear : Gfx::Texture::kNearest;
00099 }
00100 
00101 Common::CodePage Settings::getTextCodePage() const {
00102     switch (_language) {
00103     case Common::PL_POL:
00104         return Common::kWindows1250;
00105     case Common::RU_RUS:
00106         return Common::kWindows1251;
00107     default:
00108         return Common::kWindows1252;
00109     }
00110 }
00111 
00112 } // End of namespace Stark


Generated on Sat Apr 20 2019 05:03:53 for ResidualVM by doxygen 1.7.1
curved edge   curved edge