SWORD1: Use booleans for _systemVars speech and subtitles flags

The were defined as uint8 and the code was inconsistent in the
way they were handled, for example setting them to 1 in some
places and to true in others. It was working but relying on implicit
conversions both ways between 1 and true.
This commit is contained in:
Thierry Crozat 2017-07-08 12:41:22 +01:00
parent f59269006c
commit 6ff927bff7
3 changed files with 7 additions and 7 deletions

View File

@ -410,7 +410,7 @@ uint8 Control::runPanel() {
ConfMan.setInt("sfx_volume", (int)((volR + volL) / 2));
ConfMan.setInt("sfx_balance", volToBalance(volL, volR));
ConfMan.setBool("subtitles", SwordEngine::_systemVars.showText == 1);
ConfMan.setBool("subtitles", SwordEngine::_systemVars.showText);
ConfMan.flushToDisk();
}
@ -503,8 +503,8 @@ uint8 Control::handleButtonClick(uint8 id, uint8 mode, uint8 *retVal) {
(id == BUTTON_DONE) || (id == BUTTON_VOLUME_PANEL))
return id;
else if (id == BUTTON_TEXT) {
SwordEngine::_systemVars.showText ^= 1;
_buttons[5]->setSelected(SwordEngine::_systemVars.showText);
SwordEngine::_systemVars.showText = !SwordEngine::_systemVars.showText;
_buttons[5]->setSelected(SwordEngine::_systemVars.showText ? 1 : 0);
} else if (id == BUTTON_QUIT) {
if (getConfirm(_lStrings[STR_QUIT]))
Engine::quitGame();
@ -566,7 +566,7 @@ void Control::setupMainPanel() {
createButtons(_deathButtons, 3);
else {
createButtons(_panelButtons, 7);
_buttons[5]->setSelected(SwordEngine::_systemVars.showText);
_buttons[5]->setSelected(SwordEngine::_systemVars.showText ? 1 : 0);
}
if (SwordEngine::_systemVars.controlPanelMode == CP_THEEND) // end of game

View File

@ -154,7 +154,7 @@ Common::Error SwordEngine::init() {
_systemVars.showText = ConfMan.getBool("subtitles");
_systemVars.playSpeech = 1;
_systemVars.playSpeech = true;
_mouseState = 0;
// Some Mac versions use big endian for the speech files but not all of them.

View File

@ -70,8 +70,8 @@ struct SystemVars {
uint8 controlPanelMode; // 1 death screen version of the control panel, 2 = successful end of game, 3 = force restart
bool forceRestart;
bool wantFade; // when true => fade during scene change, else cut.
uint8 playSpeech;
uint8 showText;
bool playSpeech;
bool showText;
uint8 language;
bool isDemo;
Common::Platform platform;