[Scummvm-git-logs] scummvm master -> 07a113665d5b3e78f64ab7085ae277cf6b91fd05

OMGPizzaGuy noreply at scummvm.org
Sun Jan 8 03:12:14 UTC 2023


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

Summary:
07a113665d ULTIMA8: Small cleanup for setupGame


Commit: 07a113665d5b3e78f64ab7085ae277cf6b91fd05
    https://github.com/scummvm/scummvm/commit/07a113665d5b3e78f64ab7085ae277cf6b91fd05
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-01-07T21:11:42-06:00

Commit Message:
ULTIMA8: Small cleanup for setupGame

Changed paths:
    engines/ultima/ultima8/games/game_info.cpp
    engines/ultima/ultima8/games/game_info.h
    engines/ultima/ultima8/ultima8.cpp
    engines/ultima/ultima8/ultima8.h


diff --git a/engines/ultima/ultima8/games/game_info.cpp b/engines/ultima/ultima8/games/game_info.cpp
index 7a1ca7ccfd9..643545fe3e4 100644
--- a/engines/ultima/ultima8/games/game_info.cpp
+++ b/engines/ultima/ultima8/games/game_info.cpp
@@ -129,16 +129,11 @@ Std::string GameInfo::getPrintDetails() const {
 	if (lang == "") lang = "Unknown";
 	ret += lang;
 
-	if (_type != GAME_PENTAGRAM_MENU) {
-		// version, md5 don't make sense for the pentagram menu
-
-		ret += ", version ";
-		ret += getPrintableVersion();
-
-		ret += ", md5 ";
-		ret += getPrintableMD5();
-	}
+	ret += ", version ";
+	ret += getPrintableVersion();
 
+	ret += ", md5 ";
+	ret += getPrintableMD5();
 	return ret;
 }
 
diff --git a/engines/ultima/ultima8/games/game_info.h b/engines/ultima/ultima8/games/game_info.h
index 07b3604a589..529c511e245 100644
--- a/engines/ultima/ultima8/games/game_info.h
+++ b/engines/ultima/ultima8/games/game_info.h
@@ -39,8 +39,7 @@ struct GameInfo {
 		GAME_UNKNOWN = 0,
 		GAME_U8,
 		GAME_REMORSE,
-		GAME_REGRET,
-		GAME_PENTAGRAM_MENU
+		GAME_REGRET
 	} _type;
 
 	// Usecode coff variant
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 466e3982e94..656b0238f22 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -363,26 +363,87 @@ Common::Error Ultima8Engine::startup() {
 }
 
 bool Ultima8Engine::setupGame() {
-	istring gamename = _gameDescription->desc.gameId;
 	GameInfo *info = new GameInfo;
-	bool detected = getGameInfo(gamename, info);
+	info->_name = _gameDescription->desc.gameId;
+	info->_type = GameInfo::GAME_UNKNOWN;
+	info->version = 0;
+	info->_language = GameInfo::GAMELANG_UNKNOWN;
+	info->_ucOffVariant = GameInfo::GAME_UC_DEFAULT;
+
+	if (info->_name == "ultima8")
+		info->_type = GameInfo::GAME_U8;
+	else if (info->_name == "remorse")
+		info->_type = GameInfo::GAME_REMORSE;
+	else if (info->_name == "regret")
+		info->_type = GameInfo::GAME_REGRET;
+
+	if (info->_type == GameInfo::GAME_REMORSE) {
+		switch (_gameDescription->desc.flags & ADGF_USECODE_MASK) {
+		case ADGF_USECODE_DEMO:
+			info->_ucOffVariant = GameInfo::GAME_UC_DEMO;
+			break;
+		case ADGF_USECODE_ORIG:
+			info->_ucOffVariant = GameInfo::GAME_UC_ORIG;
+			break;
+		case ADGF_USECODE_ES:
+			info->_ucOffVariant = GameInfo::GAME_UC_REM_ES;
+			break;
+		case ADGF_USECODE_FR:
+			info->_ucOffVariant = GameInfo::GAME_UC_REM_FR;
+			break;
+		case ADGF_USECODE_JA:
+			info->_ucOffVariant = GameInfo::GAME_UC_REM_JA;
+			break;
+		default:
+			break;
+		}
+	} else if (info->_type == GameInfo::GAME_REGRET) {
+		switch (_gameDescription->desc.flags & ADGF_USECODE_MASK) {
+		case ADGF_USECODE_DEMO:
+			info->_ucOffVariant = GameInfo::GAME_UC_DEMO;
+			break;
+		case ADGF_USECODE_ORIG:
+			info->_ucOffVariant = GameInfo::GAME_UC_ORIG;
+			break;
+		case ADGF_USECODE_DE:
+			info->_ucOffVariant = GameInfo::GAME_UC_REG_DE;
+			break;
+		default:
+			break;
+		}
+	}
 
-	// output detected game info
-	debugN(MM_INFO, "%s: ", gamename.c_str());
-	if (detected) {
-		// add game to games map
-		Std::string details = info->getPrintDetails();
-		debug(MM_INFO, "%s", details.c_str());
-	} else {
-		debug(MM_INFO, "unknown, skipping");
-		return false;
+	switch (_gameDescription->desc.language) {
+	case Common::EN_ANY:
+		info->_language = GameInfo::GAMELANG_ENGLISH;
+		break;
+	case Common::FR_FRA:
+		info->_language = GameInfo::GAMELANG_FRENCH;
+		break;
+	case Common::DE_DEU:
+		info->_language = GameInfo::GAMELANG_GERMAN;
+		break;
+	case Common::ES_ESP:
+		info->_language = GameInfo::GAMELANG_SPANISH;
+		break;
+	case Common::JA_JPN:
+		info->_language = GameInfo::GAMELANG_JAPANESE;
+		break;
+	default:
+		error("Unknown language");
+		break;
 	}
 
-	_gameInfo = info;
+	if (info->_type == GameInfo::GAME_UNKNOWN) {
+		warning("%s: unknown, skipping", info->_name.c_str());
+		return false;
+	}
 
-	debug(MM_INFO, "Selected game: %s", info->_name.c_str());
-	debug(MM_INFO, "%s", info->getPrintDetails().c_str());
+	// output detected game info
+	Std::string details = info->getPrintDetails();
+	debug(MM_INFO, "%s: %s", info->_name.c_str(), details.c_str());
 
+	_gameInfo = info;
 	return true;
 }
 
@@ -849,83 +910,6 @@ void Ultima8Engine::handleDelayedEvents() {
 	_mouse->handleDelayedEvents();
 }
 
-bool Ultima8Engine::getGameInfo(const istring &game, GameInfo *ginfo) {
-	ginfo->_name = game;
-	ginfo->_type = GameInfo::GAME_UNKNOWN;
-	ginfo->version = 0;
-	ginfo->_language = GameInfo::GAMELANG_UNKNOWN;
-	ginfo->_ucOffVariant = GameInfo::GAME_UC_DEFAULT;
-
-	assert(game == "ultima8" || game == "remorse" || game == "regret");
-
-	if (game == "ultima8")
-		ginfo->_type = GameInfo::GAME_U8;
-	else if (game == "remorse")
-		ginfo->_type = GameInfo::GAME_REMORSE;
-	else if (game == "regret")
-		ginfo->_type = GameInfo::GAME_REGRET;
-
-	if (ginfo->_type == GameInfo::GAME_REMORSE)
-	{
-		switch (_gameDescription->desc.flags & ADGF_USECODE_MASK) {
-		case ADGF_USECODE_DEMO:
-			ginfo->_ucOffVariant = GameInfo::GAME_UC_DEMO;
-			break;
-		case ADGF_USECODE_ORIG:
-			ginfo->_ucOffVariant = GameInfo::GAME_UC_ORIG;
-			break;
-		case ADGF_USECODE_ES:
-			ginfo->_ucOffVariant = GameInfo::GAME_UC_REM_ES;
-			break;
-		case ADGF_USECODE_FR:
-			ginfo->_ucOffVariant = GameInfo::GAME_UC_REM_FR;
-			break;
-		case ADGF_USECODE_JA:
-			ginfo->_ucOffVariant = GameInfo::GAME_UC_REM_JA;
-			break;
-		default:
-			break;
-		}
-	} else if (ginfo->_type == GameInfo::GAME_REGRET) {
-		switch (_gameDescription->desc.flags & ADGF_USECODE_MASK) {
-		case ADGF_USECODE_DEMO:
-			ginfo->_ucOffVariant = GameInfo::GAME_UC_DEMO;
-			break;
-		case ADGF_USECODE_ORIG:
-			ginfo->_ucOffVariant = GameInfo::GAME_UC_ORIG;
-			break;
-		case ADGF_USECODE_DE:
-			ginfo->_ucOffVariant = GameInfo::GAME_UC_REG_DE;
-			break;
-		default:
-			break;
-		}
-	}
-
-	switch (_gameDescription->desc.language) {
-	case Common::EN_ANY:
-		ginfo->_language = GameInfo::GAMELANG_ENGLISH;
-		break;
-	case Common::FR_FRA:
-		ginfo->_language = GameInfo::GAMELANG_FRENCH;
-		break;
-	case Common::DE_DEU:
-		ginfo->_language = GameInfo::GAMELANG_GERMAN;
-		break;
-	case Common::ES_ESP:
-		ginfo->_language = GameInfo::GAMELANG_SPANISH;
-		break;
-	case Common::JA_JPN:
-		ginfo->_language = GameInfo::GAMELANG_JAPANESE;
-		break;
-	default:
-		error("Unknown language");
-		break;
-	}
-
-	return ginfo->_type != GameInfo::GAME_UNKNOWN;
-}
-
 void Ultima8Engine::writeSaveInfo(Common::WriteStream *ws) {
 	TimeDate timeInfo;
 	g_system->getTimeAndDate(timeInfo);
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index 2a852d7d491..3061ffae0da 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -165,12 +165,6 @@ private:
 
 	void handleDelayedEvents();
 
-	//! Fill a GameInfo struct for the give game name
-	//! \param game The id of the game to check (from pentagram.cfg)
-	//! \param gameinfo The GameInfo struct to fill
-	//! \return true if detected all the fields, false if detection failed
-	bool getGameInfo(const istring &game, GameInfo *gameinfo);
-
 	bool pollEvent(Common::Event &event);
 protected:
 	// Engine APIs




More information about the Scummvm-git-logs mailing list