[Scummvm-git-logs] scummvm master -> e401d2814f327ab0cb6d2908efeb084a5ed5a1e3

bluegr noreply at scummvm.org
Wed May 25 09:59:07 UTC 2022


This automated email contains information about 9 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5a7719cc66 HDB: Fix getting cheat enabled state from ConfMan
d1b3d9fe2d HDB: Fix warp screen back button placement
3328b03b70 HDB: Remove redundant "g_hdb->_menu->" in menu code
10c2d00967 HDB: Split some menu vars into bool and integers
1ab83c2a28 HDB: Add proper volume settings synchronization
6778baedcf HDB: Remove no longer used Sound::setMusicVolume()
afc309393c HDB: Remove redundant check for empty music_driver value
c8de160946 HDB: Use enum values for options and menu screen ids
e401d2814f HDB: Keep exhaustion attached when scrolling away the rocket


Commit: 5a7719cc6626cc07305b230a391083e62f791afe
    https://github.com/scummvm/scummvm/commit/5a7719cc6626cc07305b230a391083e62f791afe
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Fix getting cheat enabled state from ConfMan

Changed paths:
    engines/hdb/menu.cpp


diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index 0870da09c74..c2ba3602ef6 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -346,7 +346,7 @@ void Menu::readConfig() {
 		needFlush = true;
 	}
 
-	if (ConfMan.hasKey(CONFIG_CHEAT)) {
+	if (ConfMan.hasKey(CONFIG_CHEAT) && ConfMan.getBool(CONFIG_CHEAT)) {
 		g_hdb->setCheatingOn();
 		debug("Cheating enabled");
 	}
@@ -366,7 +366,7 @@ void Menu::writeConfig() {
 	ConfMan.setInt(CONFIG_MSTONE21, value);
 
 	if (g_hdb->getCheatingOn())
-		ConfMan.set(CONFIG_CHEAT, "1");
+		ConfMan.setBool(CONFIG_CHEAT, true);
 
 	ConfMan.flushToDisk();
 }


Commit: d1b3d9fe2d59bd85f56875254a0dd96dd0cda520
    https://github.com/scummvm/scummvm/commit/d1b3d9fe2d59bd85f56875254a0dd96dd0cda520
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Fix warp screen back button placement

Changed paths:
    engines/hdb/menu.cpp


diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index c2ba3602ef6..39fd76f424c 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -251,8 +251,6 @@ Menu::Menu() {
 	_versionGfx = nullptr;
 	_warpGfx = nullptr;
 
-	_warpBackoutX = 0;
-	_warpBackoutY = 0;
 	_titleCycle = 0;
 	_titleDelay = 0;
 	_resumeSong = SONG_NONE;


Commit: 3328b03b70bc27a8b78a6b5aa2c64aa4879e06d5
    https://github.com/scummvm/scummvm/commit/3328b03b70bc27a8b78a6b5aa2c64aa4879e06d5
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Remove redundant "g_hdb->_menu->" in menu code

Changed paths:
    engines/hdb/menu.cpp


diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index 39fd76f424c..7e8d12897ec 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -646,7 +646,7 @@ void Menu::drawMenu() {
 
 			// title logo
 			_titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + _mTitleY);
-			_menuBackoutGfx->drawMasked(_backoutX, g_hdb->_menu->_backoutY);
+			_menuBackoutGfx->drawMasked(_backoutX, _backoutY);
 		}
 	} else if (_optionsActive) {
 		//-------------------------------------------------------------------
@@ -711,7 +711,7 @@ void Menu::drawMenu() {
 
 			// title logo
 			_titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + _mTitleY);
-			_menuBackoutGfx->drawMasked(_backoutX, g_hdb->_menu->_backoutY);
+			_menuBackoutGfx->drawMasked(_backoutX, _backoutY);
 
 			// Ignore Controls Screen Button
 			//_controlButtonGfx->drawMasked(centerPic(_controlButtonGfx), _mControlsY);
@@ -756,7 +756,7 @@ void Menu::drawMenu() {
 			_titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + _mTitleY);
 			// CHOOSE SLOT screen
 			_modeLoadGfx->drawMasked(centerPic(_modeLoadGfx), _oBannerY);
-			_menuBackoutGfx->drawMasked(_backoutX, g_hdb->_menu->_backoutY);
+			_menuBackoutGfx->drawMasked(_backoutX, _backoutY);
 
 			if (!g_hdb->isPPC()) {
 				if (_saveGames[kAutoSaveSlot].seconds)
@@ -802,7 +802,7 @@ void Menu::drawMenu() {
 		drawWarpScreen();
 		// title logo
 		_titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + _mTitleY);
-		_menuBackoutGfx->drawMasked(_warpBackoutX, g_hdb->_menu->_warpBackoutY);
+		_menuBackoutGfx->drawMasked(_warpBackoutX, _warpBackoutY);
 
 		Common::String textString;
 		for (int i = 0; i < 10; i++) {
@@ -1373,7 +1373,7 @@ void Menu::processInput(int x, int y) {
 		if (!g_hdb->getCheatingOn())
 			open = (x >= _nebulaX && x < _nebulaX + 16 && y >= _nebulaY && y < _nebulaY + 16);
 		else
-			open = (y > g_hdb->_menu->_menuExitY && x < _menuExitXLeft);
+			open = (y > _menuExitY && x < _menuExitXLeft);
 
 		if (open) {
 
@@ -1389,7 +1389,7 @@ void Menu::processInput(int x, int y) {
 		//-------------------------------------------------------------------
 		int	xit = getMenuKey();
 
-		if (y >= g_hdb->_menu->_menuExitY || y < _menuExitYTop || xit) {
+		if (y >= _menuExitY || y < _menuExitYTop || xit) {
 			_optionsScrolling = true;
 			_optionsXV = -5;
 			g_hdb->_sound->playSound(SND_MENU_BACKOUT);
@@ -1402,7 +1402,7 @@ void Menu::processInput(int x, int y) {
 			_newgameActive = false;
 			g_hdb->changeGameState();
 			// that's it!  the Game Loop takes over from here...
-		} else if (y >= _modeActionY - 10 && y <= g_hdb->_menu->_menuExitY) {
+		} else if (y >= _modeActionY - 10 && y <= _menuExitY) {
 			// ACTION MODE area
 			g_hdb->setActionMode(1);
 			g_hdb->_sound->playSound(SND_MENU_ACCEPT);
@@ -1458,7 +1458,7 @@ void Menu::processInput(int x, int y) {
 				g_hdb->_sound->setVoiceStatus(value);
 				g_hdb->_sound->playSound(SND_GUI_INPUT);
 			}
-		} else if (y >= g_hdb->_menu->_menuExitY || y < _menuExitYTop || xit) {
+		} else if (y >= _menuExitY || y < _menuExitYTop || xit) {
 			g_hdb->_sound->playSound(SND_MENU_BACKOUT);
 			_optionsScrolling = true;
 			_optionsXV = -5;
@@ -1477,7 +1477,7 @@ void Menu::processInput(int x, int y) {
 		//-------------------------------------------------------------------
 		int	xit = getMenuKey();
 
-		if (y >= g_hdb->_menu->_menuExitY + 15 || y < _menuExitYTop || xit) {
+		if (y >= _menuExitY + 15 || y < _menuExitYTop || xit) {
 			_optionsScrolling = true;
 			_optionsXV = -5;
 			g_hdb->_sound->playSound(SND_MENU_BACKOUT);
@@ -1533,7 +1533,7 @@ void Menu::processInput(int x, int y) {
 		//-------------------------------------------------------------------
 		int	xit = getMenuKey();
 
-		if ((y >= g_hdb->_menu->_menuExitY && x < _menuExitXLeft) || xit) {
+		if ((y >= _menuExitY && x < _menuExitXLeft) || xit) {
 			_menuActive = true;
 			_warpActive = false;
 			g_hdb->_sound->playSound(SND_MENU_BACKOUT);


Commit: 10c2d00967d2eb37b626d7c0c5c754474adb6119
    https://github.com/scummvm/scummvm/commit/10c2d00967d2eb37b626d7c0c5c754474adb6119
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Split some menu vars into bool and integers

To clear up their role and improve code readability

Changed paths:
    engines/hdb/menu.cpp
    engines/hdb/menu.h


diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index 7e8d12897ec..255e59670fd 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -174,9 +174,11 @@ Menu::Menu() {
 	_titleActive = false;
 	_menuActive = false;
 	_optionsActive = false;
+	_optionsScreenId = 0;
 	_gamefilesActive = false;
 	_newgameActive = false;
 	_warpActive = false;
+	_warpMapId = -1;
 	_optionsScrolling = false;
 	_optionsScrollX = _menuX;
 	_rocketX = _mRocketX;
@@ -264,7 +266,8 @@ Menu::Menu() {
 	_handangoGfx = nullptr;
 	_clickDelay = 0;
 	_saveSlot = 0;
-	_quitActive = 0;
+	_quitActive = false;
+	_quitCounter = 0;
 	_optionsXV = 0;
 	_oBannerY = 0;
 	_introSong = SONG_NONE;
@@ -538,9 +541,10 @@ void Menu::drawMenu() {
 				switch (_nextScreen) {
 				case 0:
 					_optionsActive = true;
+					_optionsScreenId = 1;
 					break;
 				case 1:
-					_gamefilesActive = 1;
+					_gamefilesActive = true;
 					break;
 				case 2:
 					_newgameActive = true;
@@ -668,11 +672,12 @@ void Menu::drawMenu() {
 				_oBannerY = -48;
 				_optionsScrolling = false;
 				_optionsActive = false;
+				_optionsScreenId = 0;
 				_menuActive = true;
 			}
 
 			drawRocketAndSelections();
-		} else if (_optionsActive == 1) {
+		} else if (_optionsScreenId == 1) {
 			//
 			// Options menu content
 			//
@@ -715,7 +720,7 @@ void Menu::drawMenu() {
 
 			// Ignore Controls Screen Button
 			//_controlButtonGfx->drawMasked(centerPic(_controlButtonGfx), _mControlsY);
-		} else if (_optionsActive == 2) {
+		} else if (_optionsScreenId == 2) {
 			//
 			// Draw CONTROLS screen
 			//
@@ -821,9 +826,9 @@ void Menu::drawMenu() {
 			g_hdb->_gfx->drawText(textString.c_str());
 		}
 
-		if (_warpActive > 1) {
+		if (_warpMapId >= 0) {
 			g_hdb->_gfx->setCursor(_warpX + 60, _warpY + 164);
-			textString = Common::String::format("Warping to MAP%d", _warpActive - 2);
+			textString = Common::String::format("Warping to MAP%d", _warpMapId);
 			g_hdb->_gfx->centerPrint(textString.c_str());
 		}
 	} else if (_quitActive) {
@@ -833,13 +838,13 @@ void Menu::drawMenu() {
 		g_hdb->_gfx->draw3DStars();
 		drawNebula();
 
-		if (_quitActive == 3 || !g_hdb->isDemo()) {
+		if (_quitCounter == 3 || !g_hdb->isDemo()) {
 			if (!_quitScreen)
 				_quitScreen = g_hdb->_gfx->loadPic(PIC_QUITSCREEN);
 			_quitScreen->drawMasked(_quitX, _quitY);
-		} else if (_quitActive == 1) {
+		} else if (_quitCounter == 1) {
 			_screenshots1agfx->drawMasked(_quitX, _quitY);
-		} else if (_quitActive == 2) { // XXXX
+		} else if (_quitCounter == 2) { // XXXX
 			_screenshots1gfx->drawMasked(_quitX, _quitY);
 
 			if (!g_hdb->isPPC())
@@ -1288,7 +1293,8 @@ void Menu::processInput(int x, int y) {
 			y >= _menuY + _mQuitY && y < _menuY + _mQuitY + _menuItemHeight) {
 			g_hdb->_sound->playSound(SND_BYE);
 			_quitTimer = g_hdb->getTimeSlice() + 1000;
-			_quitActive = 1;
+			_quitActive = true;
+			_quitCounter = 1;
 			_menuActive = false;
 			return;
 		} else if (x >= _menuX && x < _menuX + _menuItemWidth &&
@@ -1339,6 +1345,7 @@ void Menu::processInput(int x, int y) {
 				y >= kStarRedY && y <= kStarRedY + _starRedGfx[0]->_height &&
 				g_hdb->getStarsMonkeystone7() == STARS_MONKEYSTONE_7) {
 				_optionsActive = false;
+				_optionsScreenId = 0;
 				g_hdb->setGameState(GAME_PLAY);
 				if (scumm_strnicmp(g_hdb->currentMapName(), "map30", 5))	// don't save if we're already on 30!
 					g_hdb->saveGameState(kAutoSaveSlot, "FIXME"); // Add here date/level name // TODO
@@ -1349,6 +1356,7 @@ void Menu::processInput(int x, int y) {
 				y >= kStarGreenY && y <= kStarGreenY + _starGreenGfx[0]->_height &&
 				g_hdb->getStarsMonkeystone14() == STARS_MONKEYSTONE_14) {
 				_optionsActive = false;
+				_optionsScreenId = 0;
 				g_hdb->setGameState(GAME_PLAY);
 				if (scumm_strnicmp(g_hdb->currentMapName(), "map30", 5))	// don't save if we're already on 30!
 					g_hdb->saveGameState(kAutoSaveSlot, "FIXME"); // Add here date/level name // TODO
@@ -1360,6 +1368,7 @@ void Menu::processInput(int x, int y) {
 				y >= kStarBlueY && y <= kStarBlueY + _starBlueGfx[0]->_height &&
 				g_hdb->getStarsMonkeystone21() == STARS_MONKEYSTONE_21) {
 				_optionsActive = false;
+				_optionsScreenId = 0;
 				g_hdb->setGameState(GAME_PLAY);
 				if (scumm_strnicmp(g_hdb->currentMapName(), "map30", 5))	// don't save if we're already on 30!
 					g_hdb->saveGameState(kAutoSaveSlot, "FIXME"); // Add here date/level name // TODO
@@ -1381,6 +1390,7 @@ void Menu::processInput(int x, int y) {
 
 			_menuActive = false;
 			_warpActive = true;
+			_warpMapId = -1;
 			_clickDelay = 30;
 		}
 	} else if (_newgameActive) {
@@ -1418,7 +1428,7 @@ void Menu::processInput(int x, int y) {
 		//
 		// Controls screen
 		//
-		if (_optionsActive == 2) {
+		if (_optionsScreenId == 2) {
 			controlsInput(x, y);
 			return;
 		}
@@ -1467,7 +1477,7 @@ void Menu::processInput(int x, int y) {
 			// CONTROLS BUTTON!
 
 			// Ignore Controls Button
-			//_optionsActive = 2;
+			//_optionsScreenId = 2;
 			//_clickDelay = 20;
 			//g_hdb->_sound->playSound(SND_POP);
 		}
@@ -1536,6 +1546,7 @@ void Menu::processInput(int x, int y) {
 		if ((y >= _menuExitY && x < _menuExitXLeft) || xit) {
 			_menuActive = true;
 			_warpActive = false;
+			_warpMapId = -1;
 			g_hdb->_sound->playSound(SND_MENU_BACKOUT);
 			_clickDelay = 10;
 		} else if (y >= _warpY && y < _warpY + 160) {
@@ -1551,11 +1562,12 @@ void Menu::processInput(int x, int y) {
 
 			map += (y - _warpY) / 16;
 
-			_warpActive = map + 2;
+			_warpMapId = map;
 			g_hdb->paint();
 			if (g_hdb->getDebug())
 				g_hdb->_gfx->updateVideo();
-			_warpActive = 0;
+			_warpActive = false;
+			_warpMapId = -1;
 
 			Common::String mapString = Common::String::format("MAP%02d", map);
 
@@ -1584,7 +1596,8 @@ void Menu::processInput(int x, int y) {
 				_quitScreen = nullptr;
 
 				_menuActive = true;
-				_quitActive = 0;
+				_quitActive = false;
+				_quitCounter = 0;
 			} else if (_quitTimer < g_hdb->getTimeSlice()) {
 				if (x >= _quitYesX1 && x <= _quitYesX2 && y > _quitYesY1 && y < _quitYesY2) {
 					writeConfig();
@@ -1592,18 +1605,19 @@ void Menu::processInput(int x, int y) {
 				}
 			}
 		} else {
-			if ((_quitActive == 1 || _quitActive == 2) && _quitTimer < g_hdb->getTimeSlice()) {
-				_quitActive++;
+			if ((_quitCounter == 1 || _quitCounter == 2) && _quitTimer < g_hdb->getTimeSlice()) {
+				_quitCounter++;
 				_quitTimer = g_hdb->getTimeSlice() + 1000;
 			} else {
-				if (_quitActive == 3 && (x >= _quitNoX1 && x <= _quitNoX2 && y > _quitNoY1 && y < _quitNoY2 && _quitTimer < g_hdb->getTimeSlice())) {
+				if (_quitCounter == 3 && (x >= _quitNoX1 && x <= _quitNoX2 && y > _quitNoY1 && y < _quitNoY2 && _quitTimer < g_hdb->getTimeSlice())) {
 					g_hdb->_sound->playSound(SND_MENU_BACKOUT);
 					delete _quitScreen;
 					_quitScreen = nullptr;
 
 					_menuActive = true;
-					_quitActive = 0;
-				} else if (_quitActive == 3 && _quitTimer < g_hdb->getTimeSlice()){
+					_quitActive = false;
+					_quitCounter = 0;
+				} else if (_quitCounter == 3 && _quitTimer < g_hdb->getTimeSlice()){
 					writeConfig();
 					g_hdb->quitGame();
 				}
diff --git a/engines/hdb/menu.h b/engines/hdb/menu.h
index b1c62c992e2..2c4b37458e8 100644
--- a/engines/hdb/menu.h
+++ b/engines/hdb/menu.h
@@ -197,8 +197,8 @@ public:
 	Picture	*_starRedGfx[2], *_starGreenGfx[2], *_starBlueGfx[2], *_versionGfx;
 	Picture *_screenshots1gfx, *_screenshots1agfx, *_screenshots2gfx, *_demoPlaqueGfx, *_handangoGfx;
 
-	bool _menuActive, _optionsScrolling, _newgameActive, _sayHDB;
-	int	_gamefilesActive, _clickDelay, _saveSlot, _optionsActive, _quitActive, _warpActive;
+	bool _menuActive, _optionsScrolling, _newgameActive, _sayHDB, _warpActive, _gamefilesActive, _optionsActive, _quitActive;
+	int	_clickDelay, _saveSlot, _optionsScreenId, _quitCounter, _warpMapId;
 	int	_optionsScrollX, _optionsXV, _oBannerY;
 	int	_nextScreen;
 


Commit: 1ab83c2a289b5cfb6ac33678bdfd96f8739c17f6
    https://github.com/scummvm/scummvm/commit/1ab83c2a289b5cfb6ac33678bdfd96f8739c17f6
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Add proper volume settings synchronization

Between GMM / ScummVM launcher settings and game

Also commented out some incomplete and unused code meant for cross fading or fading in and out music tracks (Songs)

Changed paths:
    engines/hdb/ai-funcs.cpp
    engines/hdb/hdb.cpp
    engines/hdb/hdb.h
    engines/hdb/menu.cpp
    engines/hdb/menu.h
    engines/hdb/sound.cpp
    engines/hdb/sound.h


diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp
index 9c4b8e5c642..84bf752e833 100644
--- a/engines/hdb/ai-funcs.cpp
+++ b/engines/hdb/ai-funcs.cpp
@@ -19,6 +19,8 @@
  *
  */
 
+#include "common/config-manager.h"
+
 #include "hdb/hdb.h"
 #include "hdb/ai.h"
 #include "hdb/ai-player.h"
@@ -825,7 +827,7 @@ void AI::killPlayer(Death method) {
 	}
 
 	// sound.StopMusic();
-	if (!g_hdb->_sound->getMusicVolume())
+	if (ConfMan.getInt(CONFIG_MUSICVOL) == 0)
 		g_hdb->_sound->playSound(SND_TRY_AGAIN);
 }
 
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index 1101051d630..928fe0477bf 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -36,6 +36,8 @@
 #include "hdb/mpc.h"
 #include "hdb/window.h"
 
+#include "audio/mididrv.h"
+
 #define CHEAT_PATCHES 0
 
 namespace HDB {
@@ -110,7 +112,7 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst
 	_loadInfo.active = false;
 	_loadInfo.slot = 0;
 
-	syncSoundSettings();
+	_noMusicDriver = false;
 }
 
 HDBGame::~HDBGame() {
@@ -140,6 +142,16 @@ HDBGame::~HDBGame() {
 }
 
 bool HDBGame::init() {
+	// Assign default values to the ScummVM configuration manager, in case settings are missing
+	ConfMan.registerDefault(CONFIG_MUSICVOL, 192);
+	ConfMan.registerDefault(CONFIG_SFXVOL, 192);
+	ConfMan.registerDefault(CONFIG_SPEECHVOL, 192);
+	ConfMan.registerDefault(CONFIG_MUTEALL, "false");
+	ConfMan.registerDefault(CONFIG_NOSPEECH, "false");
+	ConfMan.registerDefault(CONFIG_CHEAT, "false");
+	// Menu::readConfig() takes care of the default values for:
+	// CONFIG_MSTONE7, CONFIG_MSTONE14, CONFIG_MSTONE21
+
 	/*
 		Game Subsystem Initializations
 	*/
@@ -167,6 +179,12 @@ bool HDBGame::init() {
 	_lua->init();
 	_menu->init();
 
+	// Query the selected music device (defaults to MT_AUTO device).
+	Common::String selDevStr = ConfMan.hasKey("music_driver") ? ConfMan.get("music_driver") : Common::String("auto");
+	MidiDriver::DeviceHandle dev = MidiDriver::getDeviceHandle(selDevStr.empty() ? Common::String("auto") : selDevStr);
+	_noMusicDriver = (MidiDriver::getMusicType(dev) == MT_NULL || MidiDriver::getMusicType(dev) == MT_INVALID);
+	syncSoundSettings();
+
 	_debugLogo = _gfx->loadIcon("icon_debug_logo");
 	_progressGfx = _gfx->loadPic(PIC_LOADBAR);
 	_progressMarkGfx = _gfx->loadPic(PIC_LOADSTAR);
@@ -1077,4 +1095,35 @@ Common::Error HDBGame::run() {
 	return Common::kNoError;
 }
 
+void HDBGame::syncSoundSettings() {
+	Engine::syncSoundSettings();
+
+	_mixer->setVolumeForSoundType(_mixer->kMusicSoundType, ConfMan.getInt(CONFIG_MUSICVOL));
+	_mixer->setVolumeForSoundType(_mixer->kSFXSoundType, ConfMan.getInt(CONFIG_SFXVOL));
+	_mixer->setVolumeForSoundType(_mixer->kSpeechSoundType, ConfMan.getInt(CONFIG_SPEECHVOL));
+
+	if (_noMusicDriver) {
+		// This affects *only* the music muting.
+		_mixer->muteSoundType(_mixer->kMusicSoundType, true);
+	}
+
+	bool allSoundIsMuted = false;
+	if (ConfMan.hasKey(CONFIG_MUTEALL)) {
+		allSoundIsMuted = ConfMan.getBool(CONFIG_MUTEALL);
+		if (!_noMusicDriver) {
+			_mixer->muteSoundType(_mixer->kMusicSoundType, allSoundIsMuted);
+		}
+		_mixer->muteSoundType(_mixer->kSFXSoundType, allSoundIsMuted);
+		_mixer->muteSoundType(_mixer->kSpeechSoundType, allSoundIsMuted);
+	}
+
+	if (ConfMan.hasKey(CONFIG_NOSPEECH) && !allSoundIsMuted) {
+		_mixer->muteSoundType(_mixer->kSpeechSoundType, ConfMan.getBool(CONFIG_NOSPEECH));
+		_sound->setVoiceStatus(!ConfMan.getBool(CONFIG_NOSPEECH));
+	}
+
+	// write-back to ini file for persistence
+	ConfMan.flushToDisk();
+}
+
 } // End of namespace HDB
diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h
index 4732de94510..487cffe0e8b 100644
--- a/engines/hdb/hdb.h
+++ b/engines/hdb/hdb.h
@@ -47,6 +47,18 @@ class Picture;
 class Sound;
 class Window;
 
+#define	CONFIG_MUSICVOL     "music_volume"
+#define	CONFIG_SFXVOL       "sfx_volume"
+#define	CONFIG_SPEECHVOL    "speech_volume"
+#define	CONFIG_MSTONE7      "hdb_memory_heap"
+#define	CONFIG_MSTONE14     "lua_stack_offset"
+#define	CONFIG_MSTONE21     "fmod_mix_timer"
+#define	CONFIG_SOUNDCACHE   "sound_cache_max" // Unused
+#define	CONFIG_GFXCACHE     "gfx_cache_max"   // Unused
+#define	CONFIG_CHEAT        "hypercheat"
+#define	CONFIG_NOSPEECH     "speech_mute"
+#define	CONFIG_MUTEALL      "mute"
+
 enum {
 	kTileWidth = 32,
 	kTileHeight = 32,
@@ -143,6 +155,7 @@ public:
 	void initializePath(const Common::FSNode &gamePath) override;
 
 	Common::Error run() override;
+	void syncSoundSettings() override;
 
 	// Detection related members;
 	const ADGameDescription *_gameDescription;
@@ -370,6 +383,7 @@ private:
 		int  slot;
 	} _saveInfo, _loadInfo;
 
+	bool  _noMusicDriver; // If "Music Device" is set to "No Music" from Audio tab
 };
 
 extern HDBGame *g_hdb;
diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index 255e59670fd..d6db1fb02eb 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -494,6 +494,8 @@ void Menu::startMenu() {
 	// did we already say "HYPERSPACE DELIVERY BOY!" ??
 	// if not, this is a great time to check for Copy Protection!
 	if (_sayHDB == false) {
+		// NOTE The game intro "HYPERSPACE DELIVERY BOY!" sound plays as a SFX type sound.
+		//      It is not a Voice (Speech) quote.
 		g_hdb->_sound->playSound(SND_HDB);
 		_sayHDB = true;
 	}
@@ -686,20 +688,20 @@ void Menu::drawMenu() {
 			_optionsGfx->drawMasked(centerPic(_optionsGfx), _oBannerY);
 
 			g_hdb->_gfx->setCursor(_optionsX + kOptionSPC, _optionsY);
-			if (!g_hdb->_sound->getMusicVolume())
+			if (ConfMan.getInt(CONFIG_MUSICVOL) == 0)
 				g_hdb->_gfx->drawText("Music OFF");
 			else
 				g_hdb->_gfx->drawText("Music Volume");
 
-			drawSlider(_optionsX, _optionsY + 20, g_hdb->_sound->getMusicVolume());
+			drawSlider(_optionsX, _optionsY + 20, ConfMan.getInt(CONFIG_MUSICVOL));
 
 			g_hdb->_gfx->setCursor(_optionsX + kOptionSPC, _optionsY + kOptionLineSPC * 2);
-			if (!g_hdb->_sound->getSFXVolume())
+			if (ConfMan.getInt(CONFIG_SFXVOL) == 0)
 				g_hdb->_gfx->drawText("Sound Effects OFF");
 			else
 				g_hdb->_gfx->drawText("Sound Effects Volume");
 
-			drawSlider(_optionsX, _optionsY + kOptionLineSPC * 2 + 20, g_hdb->_sound->getSFXVolume());
+			drawSlider(_optionsX, _optionsY + kOptionLineSPC * 2 + 20, ConfMan.getInt(CONFIG_SFXVOL));
 
 			if (!g_hdb->isPPC()) {
 				// Voices ON or OFF
@@ -1437,16 +1439,18 @@ void Menu::processInput(int x, int y) {
 		// Slider 1
 		if (x >= 0 && x <= _optionsX + 200 &&
 			y >= _optionsY + 20 && y <= _optionsY + 36) {
-			int oldVol = g_hdb->_sound->getMusicVolume();
+			int oldVol = ConfMan.getInt(CONFIG_MUSICVOL);
 			if (x < _optionsX) {
-				if (oldVol) {
+				if (oldVol > 0) {
 					g_hdb->_sound->stopMusic();
-					g_hdb->_sound->setMusicVolume(0);
+					ConfMan.setInt(CONFIG_MUSICVOL, 0);
+					g_hdb->syncSoundSettings();
 					g_hdb->_sound->playSound(SND_GUI_INPUT);
 				}
 			} else {
-				offset = ((x - _optionsX) * 256) / 200;
-				g_hdb->_sound->setMusicVolume(offset);
+				offset = ((x - _optionsX) * Audio::Mixer::kMaxMixerVolume) / 200;
+				ConfMan.setInt(CONFIG_MUSICVOL, offset);
+				g_hdb->syncSoundSettings();
 				if (!oldVol)
 					g_hdb->_sound->startMusic(_resumeSong);
 			}
@@ -1454,18 +1458,20 @@ void Menu::processInput(int x, int y) {
 			y >= _optionsY + kOptionLineSPC * 2 + 20 && y <= _optionsY + kOptionLineSPC * 2 + 36) {
 			// Slider 2
 			if (x >= _optionsX)
-				offset = ((x - _optionsX) * 256) / 200;
+				offset = ((x - _optionsX) * Audio::Mixer::kMaxMixerVolume) / 200;
 			else
 				offset = 0;
-			g_hdb->_sound->setSFXVolume(offset);
+			ConfMan.setInt(CONFIG_SFXVOL, offset);
+			g_hdb->syncSoundSettings();
 			g_hdb->_sound->playSound(SND_MENU_SLIDER);
 		} else if (x >= _optionsX && x <= _optionsX + 200 &&
 			y >= _optionsY + kOptionLineSPC * 4 + 24 && y <= _optionsY + kOptionLineSPC * 4 + 40) {
 			// Voices ON/OFF
 			if (!g_hdb->isVoiceless()) {
-				bool value = g_hdb->_sound->getVoiceStatus();
-				value ^= true;
+				bool value = !g_hdb->_sound->getVoiceStatus();
 				g_hdb->_sound->setVoiceStatus(value);
+				ConfMan.setBool(CONFIG_NOSPEECH, !value);
+				g_hdb->syncSoundSettings();
 				g_hdb->_sound->playSound(SND_GUI_INPUT);
 			}
 		} else if (y >= _menuExitY || y < _menuExitYTop || xit) {
diff --git a/engines/hdb/menu.h b/engines/hdb/menu.h
index 2c4b37458e8..23f2fe1578e 100644
--- a/engines/hdb/menu.h
+++ b/engines/hdb/menu.h
@@ -28,16 +28,6 @@
 
 namespace HDB {
 
-#define	CONFIG_MUSICVOL		"music_volume"
-#define	CONFIG_SOUNDVOL		"sound_volume"
-#define	CONFIG_MSTONE7		"hdb_memory_heap"
-#define	CONFIG_MSTONE14		"lua_stack_offset"
-#define	CONFIG_MSTONE21		"fmod_mix_timer"
-#define	CONFIG_SOUNDCACHE	"sound_cache_max"
-#define	CONFIG_GFXCACHE		"gfx_cache_max"
-#define	CONFIG_CHEAT		"hypercheat"
-#define	CONFIG_VOICES		"voices"
-
 #define	TITLE_DELAY1		2				// time to wait before OOH OOH
 #define	TITLE_DELAY2		0.5				// time to spend doing OOH OOH
 #define	TITLE_DELAY3		1				// time to wait before ending title
diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp
index 70d446618b8..0cfa38b467f 100644
--- a/engines/hdb/sound.cpp
+++ b/engines/hdb/sound.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/config-manager.h"
 #include "common/debug.h"
 #include "common/file.h"
 #include "common/fs.h"
@@ -1405,10 +1406,9 @@ const SoundLookUp soundList[] =  {
 };
 
 Sound::Sound() {
-	_sfxVolume = 255;
-	_musicVolume = 255;
 	_numSounds = 0;
 	_voicesOn = false;
+	memset(_voicePlayed, 0, NUM_VOICES * sizeof(byte));
 }
 
 void Sound::test() {
@@ -1416,7 +1416,7 @@ void Sound::test() {
 		Common::SeekableReadStream *soundStream = g_hdb->_fileMan->findFirstData("M00_AIRLOCK_01_MP3", TYPE_BINARY);
 		Audio::SeekableAudioStream *audioStream = Audio::makeMP3Stream(soundStream, DisposeAfterUse::YES);
 		Audio::SoundHandle *handle = new Audio::SoundHandle();
-		g_hdb->_mixer->playStream(Audio::Mixer::kPlainSoundType, handle, audioStream);
+		g_hdb->_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, audioStream);
 	#endif
 }
 
@@ -1443,9 +1443,8 @@ void Sound::init() {
 	}
 	_numSounds = index;
 
-	// voices are on by default
-	_voicesOn = true;
-	memset(&_voicePlayed[0], 0, sizeof(_voicePlayed));
+	setVoiceStatus(true);
+	clearPersistent();
 }
 
 void Sound::save(Common::OutSaveFile *out) {
@@ -1462,7 +1461,7 @@ void Sound::loadSaveFile(Common::InSaveFile *in) {
 
 
 void Sound::playSound(int index) {
-	if (index > _numSounds || !_sfxVolume)
+	if (index > _numSounds || ConfMan.getInt(CONFIG_SFXVOL) == 0)
 		return;
 
 	// is sound in memory at least?
@@ -1498,8 +1497,6 @@ void Sound::playSound(int index) {
 	if (soundChannel == kLaserChannel)
 		return;
 
-	g_hdb->_mixer->setChannelVolume(_handles[soundChannel], _sfxVolume);
-
 	if (_soundCache[index].data == nullptr)
 		return;
 
@@ -1540,7 +1537,7 @@ void Sound::playSoundEx(int index, int channel, bool loop) {
 	if (g_hdb->_mixer->isSoundHandleActive(_handles[channel]))
 		return;
 
-	if (index > _numSounds || !_sfxVolume)
+	if (index > _numSounds || ConfMan.getInt(CONFIG_SFXVOL) == 0)
 		return;
 
 	// is sound in memory at least?
@@ -1561,9 +1558,6 @@ void Sound::playSoundEx(int index, int channel, bool loop) {
 		_soundCache[index].loaded = SNDMEM_LOADED;
 	}
 
-	g_hdb->_mixer->setChannelVolume(_handles[channel], _sfxVolume);
-
-
 	if (_soundCache[index].data == nullptr)
 		return;
 
@@ -1616,7 +1610,7 @@ void Sound::playSoundEx(int index, int channel, bool loop) {
 }
 
 void Sound::playVoice(int index, int actor) {
-	if (!_voicesOn || g_hdb->isPPC())
+	if (!_voicesOn || g_hdb->isPPC() || ConfMan.getInt(CONFIG_SPEECHVOL) == 0)
 		return;
 
 	// is voice channel already active?  if so, shut 'er down (automagically called StopVoice via callback)
@@ -1644,8 +1638,6 @@ void Sound::playVoice(int index, int actor) {
 			return;
 		}
 
-		g_hdb->_mixer->setChannelVolume(_voices[actor].handle, _sfxVolume);
-
 		g_hdb->_mixer->playStream(
 			Audio::Mixer::kSpeechSoundType,
 			&_voices[actor].handle,
@@ -1666,8 +1658,6 @@ void Sound::playVoice(int index, int actor) {
 			return;
 		}
 
-		g_hdb->_mixer->setChannelVolume(_voices[actor].handle, _sfxVolume);
-
 		g_hdb->_mixer->playStream(
 			Audio::Mixer::kSpeechSoundType,
 			&_voices[actor].handle,
@@ -1688,20 +1678,20 @@ void Sound::playVoice(int index, int actor) {
 	return;
 }
 
-void Sound::setMusicVolume(int volume) {
-	_musicVolume = volume;
-	if (_song1.isPlaying()) {
-		_song1.setVolume(volume);
-	}
-	if (_song2.isPlaying()) {
-		_song2.setVolume(volume);
-	}
-}
+//void Sound::setMusicVolume(int volume) {
+//	_musicVolume = volume;
+//	if (_song1.isPlaying()) {
+//		_song1.setVolume(volume);
+//	}
+//	if (_song2.isPlaying()) {
+//		_song2.setVolume(volume);
+//	}
+//}
 
 void Sound::startMusic(SoundType song) {
 	g_hdb->_menu->saveSong(song);
 
-	if (!_musicVolume)
+	if (ConfMan.getInt(CONFIG_MUSICVOL) == 0)
 		return;
 
 	beginMusic(song, false, 0);
@@ -1710,7 +1700,7 @@ void Sound::startMusic(SoundType song) {
 void Sound::fadeInMusic(SoundType song, int ramp) {
 	g_hdb->_menu->saveSong(song);
 
-	if (!_musicVolume)
+	if (ConfMan.getInt(CONFIG_MUSICVOL) == 0)
 		return;
 
 	stopMusic();
@@ -1777,7 +1767,7 @@ SoundType Song::getSong() const {
 void Song::fadeOut(int ramp) {
 	fadeOutRamp = ramp;
 	fadingOut = true;
-	fadeOutVol = g_hdb->_sound->_musicVolume;
+	fadeOutVol = Audio::Mixer::kMaxChannelVolume;
 }
 
 void Song::stop() {
@@ -1801,9 +1791,9 @@ void Song::playSong(SoundType song, bool fadeIn, int ramp) {
 		fadeInRamp = ramp;
 		fadingIn = true;
 		fadeInVol = 0;
-		initialVolume=0;
+		initialVolume = 0;
 	} else {
-		initialVolume=g_hdb->_sound->_musicVolume;
+		initialVolume = Audio::Mixer::kMaxChannelVolume;
 	}
 
 	g_hdb->_mixer->playStream(
@@ -1867,24 +1857,17 @@ Audio::AudioStream* Song::createStream(Common::String fileName) {
 	}
 }
 
-void Song::setVolume(int volume) {
-	if (fadingIn)
-		fadeInVol = volume;
-	if (!fadingOut)
-		g_hdb->_mixer->setChannelVolume(handle, volume);
-}
-
-void Song::update() {
-	if (fadingOut) {
-		fadeOutVol = 0;
-		_playing = false;
-		g_hdb->_mixer->stopHandle(handle);
-	}
-	else if (fadingIn) {
-		fadeInVol = g_hdb->_sound->_musicVolume;
-		fadingIn = false;
-	}
-}
+//void Song::update() {
+//	if (fadingOut) {
+//		fadeOutVol = 0;
+//		_playing = false;
+//		g_hdb->_mixer->stopHandle(handle);
+//	}
+//	else if (fadingIn) {
+//		fadeInVol = Audio::Mixer::kMaxChannelVolume;
+//		fadingIn = false;
+//	}
+//}
 
 Sound::~Sound() {
 	for (int i = 0; i < kMaxSounds; i++) {
@@ -1892,15 +1875,15 @@ Sound::~Sound() {
 	}
 }
 
-void Sound::updateMusic() {
-	if (_song1.isPlaying()) {
-		_song1.update();
-	}
-
-	if (_song2.isPlaying()) {
-		_song2.update();
-	}
-}
+//void Sound::updateMusic() {
+//	if (_song1.isPlaying()) {
+//		_song1.update();
+//	}
+//
+//	if (_song2.isPlaying()) {
+//		_song2.update();
+//	}
+//}
 
 SoundType Sound::whatSongIsPlaying() {
 	if (_song1.isPlaying())
diff --git a/engines/hdb/sound.h b/engines/hdb/sound.h
index 6874f6fbc71..7ba03e086aa 100644
--- a/engines/hdb/sound.h
+++ b/engines/hdb/sound.h
@@ -1468,9 +1468,9 @@ public:
 	bool isPlaying() const;
 	SoundType getSong() const;
 
-	void setVolume(int volume);
-
-	void update();
+	// The update() method is to be used for cross fading, fade-in and fade-out of music
+	// However, it's currently unused and only partially implemented.
+//	void update();
 
 private:
 	static Common::String getFileName(SoundType song);
@@ -1501,16 +1501,6 @@ public:
 	void init();
 	void save(Common::OutSaveFile *out);
 	void loadSaveFile(Common::InSaveFile *in);
-	void setMusicVolume(int value);
-	int getMusicVolume() {
-		return _musicVolume;
-	}
-	void setSFXVolume(int value) {
-		_sfxVolume = value;
-	}
-	int getSFXVolume() {
-		return _sfxVolume;
-	}
 	void setVoiceStatus(bool value) {
 		_voicesOn = value;
 	}
@@ -1518,7 +1508,7 @@ public:
 		return _voicesOn;
 	}
 	void clearPersistent() {
-		memset(&_voicePlayed[0], 0, sizeof(_voicePlayed));
+		memset(_voicePlayed, 0, NUM_VOICES * sizeof(byte));
 	}
 
 	void playSound(int index);
@@ -1539,7 +1529,9 @@ public:
 	void fadeOutMusic(int ramp);
 	void stopMusic();
 	void beginMusic(SoundType song, bool fadeIn, int ramp);
-	void updateMusic();
+	// The updateMusic() method is to be used for cross fading, fade-in and fade-out of music
+	// However, it's currently unused and only partially implemented.
+//	void updateMusic();
 	bool songPlaying(SoundType song);
 	void stopChannel(int channel);
 	int registerSound(const char *name);
@@ -1570,13 +1562,11 @@ public:
 	// Music System Variables
 
 	Song _song1, _song2;
-	int _musicVolume;
 
 	// Sound Caching System Variables
 
 	SoundCache _soundCache[kMaxSounds];
 	int _numSounds;
-	int _sfxVolume;
 	Audio::SoundHandle _handles[kMaxSNDChannels];
 
 };


Commit: 6778baedcf6916ae9480999eb4add05b3fdb1625
    https://github.com/scummvm/scummvm/commit/6778baedcf6916ae9480999eb4add05b3fdb1625
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Remove no longer used Sound::setMusicVolume()

Changed paths:
    engines/hdb/sound.cpp


diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp
index 0cfa38b467f..61b95756937 100644
--- a/engines/hdb/sound.cpp
+++ b/engines/hdb/sound.cpp
@@ -1678,16 +1678,6 @@ void Sound::playVoice(int index, int actor) {
 	return;
 }
 
-//void Sound::setMusicVolume(int volume) {
-//	_musicVolume = volume;
-//	if (_song1.isPlaying()) {
-//		_song1.setVolume(volume);
-//	}
-//	if (_song2.isPlaying()) {
-//		_song2.setVolume(volume);
-//	}
-//}
-
 void Sound::startMusic(SoundType song) {
 	g_hdb->_menu->saveSong(song);
 


Commit: afc309393ced90b34ca974291ab32f4a21e7adae
    https://github.com/scummvm/scummvm/commit/afc309393ced90b34ca974291ab32f4a21e7adae
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Remove redundant check for empty music_driver value

Changed paths:
    engines/hdb/hdb.cpp


diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index 928fe0477bf..8f3cae23d4f 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -180,8 +180,7 @@ bool HDBGame::init() {
 	_menu->init();
 
 	// Query the selected music device (defaults to MT_AUTO device).
-	Common::String selDevStr = ConfMan.hasKey("music_driver") ? ConfMan.get("music_driver") : Common::String("auto");
-	MidiDriver::DeviceHandle dev = MidiDriver::getDeviceHandle(selDevStr.empty() ? Common::String("auto") : selDevStr);
+	MidiDriver::DeviceHandle dev = MidiDriver::getDeviceHandle(ConfMan.hasKey("music_driver") ? ConfMan.get("music_driver") : Common::String("auto"));
 	_noMusicDriver = (MidiDriver::getMusicType(dev) == MT_NULL || MidiDriver::getMusicType(dev) == MT_INVALID);
 	syncSoundSettings();
 


Commit: c8de16094648c2f3b7786423a6c9044303bd3fe8
    https://github.com/scummvm/scummvm/commit/c8de16094648c2f3b7786423a6c9044303bd3fe8
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Use enum values for options and menu screen ids

Note that the Option screen for modifying controls (id 2) is not implemented

Changed paths:
    engines/hdb/menu.cpp
    engines/hdb/menu.h


diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index d6db1fb02eb..9a4a0c464ef 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -174,7 +174,7 @@ Menu::Menu() {
 	_titleActive = false;
 	_menuActive = false;
 	_optionsActive = false;
-	_optionsScreenId = 0;
+	_optionsScreenId = kOptionsScreenMain;
 	_gamefilesActive = false;
 	_newgameActive = false;
 	_warpActive = false;
@@ -185,7 +185,7 @@ Menu::Menu() {
 	_sayHDB = false;
 	_menuKey = 0;
 
-	_nextScreen = 0;
+	_nextScreen = kMenuOptions;
 
 	_nebulaY = 0;		// Used as a flag
 	_fStars[0].y = 0;	// Used as a flag
@@ -541,14 +541,14 @@ void Menu::drawMenu() {
 			_optionsXV += 3;
 			if (_optionsScrollX > g_hdb->_screenWidth + 10) {
 				switch (_nextScreen) {
-				case 0:
+				case kMenuOptions:
 					_optionsActive = true;
-					_optionsScreenId = 1;
+					_optionsScreenId = kOptionsScreenMain;
 					break;
-				case 1:
+				case kMenuLoadGame:
 					_gamefilesActive = true;
 					break;
-				case 2:
+				case kMenuNewGame:
 					_newgameActive = true;
 					break;
 				default:
@@ -674,12 +674,11 @@ void Menu::drawMenu() {
 				_oBannerY = -48;
 				_optionsScrolling = false;
 				_optionsActive = false;
-				_optionsScreenId = 0;
 				_menuActive = true;
 			}
 
 			drawRocketAndSelections();
-		} else if (_optionsScreenId == 1) {
+		} else if (_optionsScreenId == kOptionsScreenMain) {
 			//
 			// Options menu content
 			//
@@ -721,8 +720,8 @@ void Menu::drawMenu() {
 			_menuBackoutGfx->drawMasked(_backoutX, _backoutY);
 
 			// Ignore Controls Screen Button
-			//_controlButtonGfx->drawMasked(centerPic(_controlButtonGfx), _mControlsY);
-		} else if (_optionsScreenId == 2) {
+			_controlButtonGfx->drawMasked(centerPic(_controlButtonGfx), _mControlsY);
+		} else if (_optionsScreenId == kOptionsScreenModifyControls) {
 			//
 			// Draw CONTROLS screen
 			//
@@ -1306,14 +1305,14 @@ void Menu::processInput(int x, int y) {
 			_optionsXV = 5;
 			g_hdb->_sound->playSound(SND_MENU_ACCEPT);
 			g_hdb->_sound->freeSound(SND_HDB);
-			_nextScreen = 2;
+			_nextScreen = kMenuNewGame;
 		} else if (x >= _menuX && x < _menuX + _menuItemWidth &&
 			y >= _menuY + _mLoadY && y < _menuY + _mLoadY + _menuItemHeight) {
 			// game files?
-				_optionsScrolling = true;
-				_optionsXV = 5;
-				g_hdb->_sound->playSound(SND_MENU_ACCEPT);
-				_nextScreen = 1;
+			_optionsScrolling = true;
+			_optionsXV = 5;
+			g_hdb->_sound->playSound(SND_MENU_ACCEPT);
+			_nextScreen = kMenuLoadGame;
 		} else if (x >= _menuX && x < _menuX + _menuItemWidth &&
 			y >= _menuY + _mOptionsY && y < _menuY + _mOptionsY + _menuItemHeight) {
 			// options?
@@ -1323,7 +1322,7 @@ void Menu::processInput(int x, int y) {
 				_resumeSong = temp;
 			_optionsScrolling = true;
 			_optionsXV = 5;
-			_nextScreen = 0;
+			_nextScreen = kMenuOptions;
 			g_hdb->_sound->playSound(SND_MENU_ACCEPT);
 		} else if (((x >= _menuX && x < _menuX + _menuItemWidth &&
 			y >= _menuY + _mResumeY && y < _menuY + _mResumeY + _menuItemHeight) || resume) &&
@@ -1347,7 +1346,6 @@ void Menu::processInput(int x, int y) {
 				y >= kStarRedY && y <= kStarRedY + _starRedGfx[0]->_height &&
 				g_hdb->getStarsMonkeystone7() == STARS_MONKEYSTONE_7) {
 				_optionsActive = false;
-				_optionsScreenId = 0;
 				g_hdb->setGameState(GAME_PLAY);
 				if (scumm_strnicmp(g_hdb->currentMapName(), "map30", 5))	// don't save if we're already on 30!
 					g_hdb->saveGameState(kAutoSaveSlot, "FIXME"); // Add here date/level name // TODO
@@ -1358,7 +1356,6 @@ void Menu::processInput(int x, int y) {
 				y >= kStarGreenY && y <= kStarGreenY + _starGreenGfx[0]->_height &&
 				g_hdb->getStarsMonkeystone14() == STARS_MONKEYSTONE_14) {
 				_optionsActive = false;
-				_optionsScreenId = 0;
 				g_hdb->setGameState(GAME_PLAY);
 				if (scumm_strnicmp(g_hdb->currentMapName(), "map30", 5))	// don't save if we're already on 30!
 					g_hdb->saveGameState(kAutoSaveSlot, "FIXME"); // Add here date/level name // TODO
@@ -1370,7 +1367,6 @@ void Menu::processInput(int x, int y) {
 				y >= kStarBlueY && y <= kStarBlueY + _starBlueGfx[0]->_height &&
 				g_hdb->getStarsMonkeystone21() == STARS_MONKEYSTONE_21) {
 				_optionsActive = false;
-				_optionsScreenId = 0;
 				g_hdb->setGameState(GAME_PLAY);
 				if (scumm_strnicmp(g_hdb->currentMapName(), "map30", 5))	// don't save if we're already on 30!
 					g_hdb->saveGameState(kAutoSaveSlot, "FIXME"); // Add here date/level name // TODO
@@ -1430,7 +1426,7 @@ void Menu::processInput(int x, int y) {
 		//
 		// Controls screen
 		//
-		if (_optionsScreenId == 2) {
+		if (_optionsScreenId == kOptionsScreenModifyControls) {
 			controlsInput(x, y);
 			return;
 		}
@@ -1483,7 +1479,7 @@ void Menu::processInput(int x, int y) {
 			// CONTROLS BUTTON!
 
 			// Ignore Controls Button
-			//_optionsScreenId = 2;
+			//_optionsScreenId = kOptionsScreenModifyControls;
 			//_clickDelay = 20;
 			//g_hdb->_sound->playSound(SND_POP);
 		}
@@ -1675,13 +1671,13 @@ void Menu::drawRocketAndSelections() {
 
 	// top-down/up scrolling stuff
 	switch (_nextScreen) {
-	case 0:
+	case kMenuOptions:
 		_optionsGfx->drawMasked(centerPic(_optionsGfx), _oBannerY);
 		break;
-	case 1:
+	case kMenuLoadGame:
 		_modeLoadGfx->drawMasked(centerPic(_modeLoadGfx), _oBannerY);
 		break;
-	case 2:
+	case kMenuNewGame:
 		_newGfx->drawMasked(centerPic(_newGfx), _oBannerY);
 		break;
 	default:
diff --git a/engines/hdb/menu.h b/engines/hdb/menu.h
index 23f2fe1578e..de8e6025111 100644
--- a/engines/hdb/menu.h
+++ b/engines/hdb/menu.h
@@ -50,6 +50,17 @@ enum {
 	kMaxStars = 10
 };
 
+enum OptionsScreens {
+	kOptionsScreenMain = 1,          // The main Options screen; Sound Settings and Modify Controls button
+	kOptionsScreenModifyControls = 2 // The controls screen, for viewing and remapping controls (currently not implemented)
+};
+
+enum MenuScreens {
+	kMenuOptions  = 0,
+	kMenuLoadGame = 1,
+	kMenuNewGame  = 2
+};
+
 struct Star {
 	int x, y, speed, anim, delay;
 


Commit: e401d2814f327ab0cb6d2908efeb084a5ed5a1e3
    https://github.com/scummvm/scummvm/commit/e401d2814f327ab0cb6d2908efeb084a5ed5a1e3
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-05-25T12:58:59+03:00

Commit Message:
HDB: Keep exhaustion attached when scrolling away the rocket

Previously the scolling animation (to the left) would keep exhaustion in place

Changed paths:
    engines/hdb/menu.cpp


diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index 9a4a0c464ef..8649ead337c 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -1698,20 +1698,20 @@ void Menu::drawRocketAndSelections() {
 
 	// exhaust
 	if (_rocketEx < 5) {
-		_rocketEx1->drawMasked(_mRocketX + _mRocketEXHX, _rocketY + _mRocketYBottom);
+		_rocketEx1->drawMasked(_rocketX + _mRocketEXHX, _rocketY + _mRocketYBottom);
 		if (!g_hdb->isPPC()) {
-			_rocketEx2->drawMasked(_mRocketX + _mRocketEXHX2, _rocketY + _mRocketYBottom);
+			_rocketEx2->drawMasked(_rocketX + _mRocketEXHX2, _rocketY + _mRocketYBottom);
 		}
 	} else if (_rocketEx >= 5 && _rocketEx < 10) {
-		_rocketEx2->drawMasked(_mRocketX + _mRocketEXHX, _rocketY + _mRocketYBottom);
+		_rocketEx2->drawMasked(_rocketX + _mRocketEXHX, _rocketY + _mRocketYBottom);
 		if (!g_hdb->isPPC()) {
-			_rocketEx1->drawMasked(_mRocketX + _mRocketEXHX2, _rocketY + _mRocketYBottom);
+			_rocketEx1->drawMasked(_rocketX + _mRocketEXHX2, _rocketY + _mRocketYBottom);
 		}
 	} else {
 		_rocketEx = 0;
-		_rocketEx1->drawMasked(_mRocketX + _mRocketEXHX, _rocketY + _mRocketYBottom);
+		_rocketEx1->drawMasked(_rocketX + _mRocketEXHX, _rocketY + _mRocketYBottom);
 		if (!g_hdb->isPPC()) {
-			_rocketEx2->drawMasked(_mRocketX + _mRocketEXHX2, _rocketY + _mRocketYBottom);
+			_rocketEx2->drawMasked(_rocketX + _mRocketEXHX2, _rocketY + _mRocketYBottom);
 		}
 	}
 	_rocketEx++;




More information about the Scummvm-git-logs mailing list