This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
STARK: Implement the settings menu #1417
Merged
Merged
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
74f3565
STARK: Fix the screen name stack
Dougaak 19fed32
STARK: Build the Settings and link it with other screens
Dougaak ab76813
STARK: Change numbers to enums for readability
Dougaak 83f3126
STARK: Implement CheckBoxWidget
Dougaak 121cbc0
STARK: Roughly Implement VolumeWidget
Dougaak 4159a8b
STARK: Implement the dragged widget
Dougaak 2b40b95
STARK: Add the sound on the slider
Dougaak a8c3b32
STARK: Implement settings save and load
Dougaak ef83a24
STARK: Enable subtitles setting
Dougaak eacc77a
STARK: Enable special effects setting (unchecked)
Dougaak eeb0bc7
STARK: Enable time skip setting
Dougaak 86732d7
STARK: Enable video quality setting
Dougaak a5df211
STARK: Enable volume setting
Dougaak e94d2a7
STARK: SpecialFX setting checked
Dougaak 1079124
STARK: Add SpecialFX comments
Dougaak 464b9bb
STARK: Fix SoundManager's memory problem
Dougaak 7001c9c
STARK: Enable low-quality model setting
Dougaak dbb16f1
STARK: Twist the sliders' position
Dougaak 484b36b
STARK: Small fixing on settings
Dougaak a176e21
STARK: Move isDemo() to Settings service
Dougaak 924359e
STARK: Name changed
Dougaak 03eeb91
STARK: Allow StaticLocationWidget has empty renderentry
Dougaak 841c798
STARK: Fix low-res FMV wrong ration problem
Dougaak ccf04a2
STARK: Small fixing
Dougaak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,83 @@ | ||||
/* ResidualVM - A 3D game interpreter | ||||
* | ||||
* ResidualVM is the legal property of its developers, whose names | ||||
* are too numerous to list here. Please refer to the AUTHORS | ||||
* file distributed with this source distribution. | ||||
* | ||||
* This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License | ||||
* as published by the Free Software Foundation; either version 2 | ||||
* of the License, or (at your option) any later version. | ||||
* | ||||
* This program is distributed in the hope that it will be useful, | ||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
* GNU General Public License for more details. | ||||
* | ||||
* You should have received a copy of the GNU General Public License | ||||
* along with this program; if not, write to the Free Software | ||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
* | ||||
*/ | ||||
|
||||
#include "engines/stark/services/settings.h" | ||||
#include "engines/stark/services/services.h" | ||||
#include "engines/stark/services/archiveloader.h" | ||||
|
||||
#include "common/config-manager.h" | ||||
#include "common/debug.h" | ||||
|
||||
#include "audio/mixer.h" | ||||
|
||||
namespace Stark { | ||||
|
||||
Settings::Settings(Audio::Mixer *mixer) : | ||||
_mixer(mixer) { | ||||
// Initialize keys | ||||
_boolKey[kHighModel] = "high_model"; | ||||
_boolKey[kSubtitle] = "subtitles"; | ||||
_boolKey[kSpecialFX] = "specialfx"; | ||||
_boolKey[kShadow] = "shadow"; | ||||
_boolKey[kHighFMV] = "high_fmv"; | ||||
_boolKey[kTimeSkip] = "enable_time_skip"; | ||||
_intKey[kVoice] = "speech_volume"; | ||||
_intKey[kMusic] = "music_volume"; | ||||
_intKey[kSfx] = "sfx_volume"; | ||||
|
||||
// Register default settings | ||||
ConfMan.registerDefault(_boolKey[kHighModel], true); | ||||
ConfMan.registerDefault(_boolKey[kSubtitle], true); | ||||
ConfMan.registerDefault(_boolKey[kSpecialFX], true); | ||||
ConfMan.registerDefault(_boolKey[kShadow], true); | ||||
ConfMan.registerDefault(_boolKey[kHighFMV], true); | ||||
ConfMan.registerDefault(_boolKey[kTimeSkip], false); | ||||
|
||||
// Use the FunCom logo video to check low-resolution fmv | ||||
_hasLowRes = StarkArchiveLoader->getExternalFile("1402_lo_res.bbb", "Global/"); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This causes a memory leak when the file is found:
|
||||
|
||||
// Apply the volume | ||||
setIntSetting(kVoice, getIntSetting(kVoice)); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really needed? Line 561 in 3ec0165
Should already do the same. |
||||
setIntSetting(kMusic, getIntSetting(kMusic)); | ||||
setIntSetting(kSfx, getIntSetting(kSfx)); | ||||
} | ||||
|
||||
void Settings::setIntSetting(IntSettingIndex index, int value) { | ||||
ConfMan.setInt(_intKey[index], value); | ||||
|
||||
Audio::Mixer::SoundType type; | ||||
switch (index) { | ||||
case kVoice: | ||||
type = Audio::Mixer::kSpeechSoundType; | ||||
break; | ||||
case kMusic: | ||||
type = Audio::Mixer::kMusicSoundType; | ||||
break; | ||||
case kSfx: | ||||
type = Audio::Mixer::kSFXSoundType; | ||||
} | ||||
|
||||
bool flag = ConfMan.getBool("mute"); | ||||
_mixer->setVolumeForSoundType(type, flag ? 0 : value); | ||||
} | ||||
|
||||
} // End of namespace Stark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* ResidualVM - A 3D game interpreter | ||
* | ||
* ResidualVM is the legal property of its developers, whose names | ||
* are too numerous to list here. Please refer to the AUTHORS | ||
* file distributed with this source distribution. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
*/ | ||
|
||
#ifndef STARK_SERVICES_SETTINGS_H | ||
#define STARK_SERVICES_SETTINGS_H | ||
|
||
#include "common/config-manager.h" | ||
|
||
namespace Audio { | ||
class Mixer; | ||
} | ||
|
||
namespace Stark { | ||
|
||
/** | ||
* Settings services. | ||
* | ||
* Maintains the settings of the game. | ||
*/ | ||
class Settings { | ||
public: | ||
enum BoolSettingIndex { | ||
kHighModel, | ||
kSubtitle, | ||
kSpecialFX, | ||
kShadow, | ||
kHighFMV, | ||
kTimeSkip | ||
}; | ||
|
||
enum IntSettingIndex { | ||
kVoice, | ||
kMusic, | ||
kSfx | ||
}; | ||
|
||
explicit Settings(Audio::Mixer *mixer); | ||
~Settings() {} | ||
|
||
/** Get the settings value */ | ||
bool getBoolSetting(BoolSettingIndex index) { return ConfMan.getBool(_boolKey[index]); } | ||
int getIntSetting(IntSettingIndex index) { return ConfMan.getInt(_intKey[index]); } | ||
|
||
/** Flip the boolean settings */ | ||
void flipSetting(BoolSettingIndex index) { | ||
ConfMan.setBool(_boolKey[index], !getBoolSetting(index)); | ||
} | ||
|
||
/** Set the integer settings */ | ||
void setIntSetting(IntSettingIndex index, int value); | ||
|
||
/** Check whether low-resolution fmv is available */ | ||
bool hasLowResFMV() { return _hasLowRes; } | ||
|
||
private: | ||
const static int _maxVolume = 256; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not used. |
||
|
||
Audio::Mixer *_mixer; | ||
bool _hasLowRes; | ||
|
||
const char *_boolKey[6]; | ||
const char *_intKey[3]; | ||
}; | ||
|
||
} // End of namespace Stark | ||
|
||
#endif // STARK_SERVICES_SETTINGS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The settings name are user facing through the configuration file. I suggest using more explicit names: