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     ConfMan.registerDefault("ignore_font_settings", true);
00062 
00063     // Use the FunCom logo video to check low-resolution fmv
00064     Common::SeekableReadStream *lowResFMV = StarkArchiveLoader->getExternalFile("1402_lo_res.bbb", "Global/");
00065     _hasLowRes = lowResFMV;
00066     delete lowResFMV;
00067 }
00068 
00069 void Settings::setIntSetting(IntSettingIndex index, int value) {
00070     ConfMan.setInt(_intKey[index], value);
00071 
00072     Audio::Mixer::SoundType type;
00073     switch (index) {
00074         case kVoice:
00075             type = Audio::Mixer::kSpeechSoundType;
00076             break;
00077         case kMusic:
00078             type = Audio::Mixer::kMusicSoundType;
00079             break;
00080         case kSfx:
00081             type = Audio::Mixer::kSFXSoundType;
00082             break;
00083         default:
00084             return;
00085     }
00086 
00087     _mixer->setVolumeForSoundType(type, value);
00088 }
00089 
00090 bool Settings::isAssetsModEnabled() const {
00091     return ConfMan.getBool("enable_assets_mod");
00092 }
00093 
00094 bool Settings::shouldPreMultiplyReplacementPNGs() const {
00095     return ConfMan.getBool("replacement_png_premultiply_alpha");
00096 }
00097 
00098 Gfx::Texture::SamplingFilter Settings::getImageSamplingFilter() const {
00099     return ConfMan.getBool("use_linear_filtering") ? Gfx::Texture::kLinear : Gfx::Texture::kNearest;
00100 }
00101 
00102 bool Settings::isFontAntialiasingEnabled() const {
00103     return ConfMan.getBool("enable_font_antialiasing");
00104 }
00105 
00106 Common::CodePage Settings::getTextCodePage() const {
00107     switch (_language) {
00108     case Common::PL_POL:
00109         return Common::kWindows1250;
00110     case Common::RU_RUS:
00111         return Common::kWindows1251;
00112     default:
00113         return Common::kWindows1252;
00114     }
00115 }
00116 
00117 bool Settings::shouldIgnoreFontSettings() const {
00118     return ConfMan.getBool("ignore_font_settings") && _language == Common::EN_ANY;
00119 }
00120 
00121 } // End of namespace Stark


Generated on Sat Jul 20 2019 05:00:58 for ResidualVM by doxygen 1.7.1
curved edge   curved edge