diff options
| -rw-r--r-- | engines/cine/bg.cpp | 2 | ||||
| -rw-r--r-- | engines/cine/cine.cpp | 124 | ||||
| -rw-r--r-- | engines/cine/cine.h | 34 | ||||
| -rw-r--r-- | engines/cine/detection.cpp | 695 | ||||
| -rw-r--r-- | engines/cine/gfx.cpp | 2 | ||||
| -rw-r--r-- | engines/cine/main_loop.cpp | 2 | ||||
| -rw-r--r-- | engines/cine/module.mk | 1 | ||||
| -rw-r--r-- | engines/cine/part.cpp | 237 | ||||
| -rw-r--r-- | engines/cine/prc.cpp | 3 | ||||
| -rw-r--r-- | engines/cine/resource.cpp | 2 | ||||
| -rw-r--r-- | engines/cine/script.cpp | 12 | ||||
| -rw-r--r-- | engines/cine/sfx_player.cpp | 2 | ||||
| -rw-r--r-- | engines/cine/texte.cpp | 2 | ||||
| -rw-r--r-- | engines/cine/various.cpp | 33 | ||||
| -rw-r--r-- | engines/cine/various.h | 2 | 
15 files changed, 996 insertions, 157 deletions
| diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp index 397557d905..badb8bb888 100644 --- a/engines/cine/bg.cpp +++ b/engines/cine/bg.cpp @@ -44,7 +44,7 @@ byte loadCt(const char *ctName) {  	byte *ptr = readBundleFile(findFileInBundle(ctName)); -	if (gameType == Cine::GID_OS) { +	if (g_cine->getGameType() == Cine::GType_OS) {  		uint16 bpp = READ_BE_UINT16(ptr); ptr += 2;  		if (bpp == 8) {  			ptr += 3 * 256; diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 2868f50c73..58c957e77d 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -29,8 +29,6 @@  #include "common/config-manager.h"  #include "common/system.h" -#include "base/plugins.h" -  #include "graphics/cursorman.h"  #include "sound/mididrv.h" @@ -50,96 +48,9 @@ SoundDriver *g_soundDriver;  SfxPlayer *g_sfxPlayer;  Common::SaveFileManager *g_saveFileMan; -static void initialize(); - -struct GameSettings { -	const char *gameid; -	const char *description; -	byte id; -	uint32 features; -	const char *detectname; -}; - -static const GameSettings cine_settings[] = { -	{"fw", "Future Wars", Cine::GID_FW, MDT_ADLIB, "AUTO00.PRC"}, -	{"os", "Operation Stealth", Cine::GID_OS, MDT_ADLIB, "PROCS00"}, -	{NULL, NULL, 0, 0, NULL} -}; - -} // End of namespace Cine - - -GameList Engine_CINE_gameIDList() { -	GameList games; -	const Cine::GameSettings *g = Cine::cine_settings; - -	while (g->gameid) { -		games.push_back(*g); -		g++; -	} - -	return games; -} - -GameDescriptor Engine_CINE_findGameID(const char *gameid) { -	const Cine::GameSettings *g = Cine::cine_settings; -	while (g->gameid) { -		if (0 == scumm_stricmp(gameid, g->gameid)) -			break; -		g++; -	} -	return *g; -} - -DetectedGameList Engine_CINE_detectGames(const FSList &fslist) { -	DetectedGameList detectedGames; -	const Cine::GameSettings *g; - -	for (g = Cine::cine_settings; g->gameid; ++g) { -		// Iterate over all files in the given directory -		for (FSList::const_iterator file = fslist.begin(); -		    file != fslist.end(); ++file) { -			const char *fileName = file->name().c_str(); - -			if (0 == scumm_stricmp(g->detectname, fileName)) { -				// Match found, add to list of candidates, then abort inner loop. -				detectedGames.push_back(*g); -				break; -			} -		} -	} -	return detectedGames; -} - -PluginError Engine_CINE_create(OSystem *syst, Engine **engine) { -	assert(syst); -	assert(engine); - -	FSList fslist; -	FilesystemNode dir(ConfMan.get("path")); -	if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { -		warning("CineEngine: invalid game path '%s'", dir.path().c_str()); -		return kInvalidPathError; -	} - -	// Invoke the detector -	Common::String gameid = ConfMan.get("gameid"); -	DetectedGameList detectedGames = Engine_CINE_detectGames(fslist); - -	for (uint i = 0; i < detectedGames.size(); i++) { -		if (detectedGames[i].gameid == gameid) { -			*engine = new Cine::CineEngine(syst); -			return kNoError; -		} -	} -	 -	warning("CineEngine: Unable to locate game data at path '%s'", dir.path().c_str()); -	return kNoGameDataFoundError; -} +CineEngine *g_cine; -REGISTER_PLUGIN(CINE, "CINE Engine", "TODO (C) TODO"); - -namespace Cine { +static void initialize();  CineEngine::CineEngine(OSystem *syst) : Engine(syst) {  	Common::addSpecialDebugLevel(kCineDebugScript, "Script", "Script debug level"); @@ -152,29 +63,26 @@ CineEngine::CineEngine(OSystem *syst) : Engine(syst) {  	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));  	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); -	const Cine::GameSettings *g; - -	const char *gameid = ConfMan.get("gameid").c_str(); -	for (g = Cine::cine_settings; g->gameid; ++g) -		if (!scumm_stricmp(g->gameid, gameid)) { -			_gameId = g->id; -			break; -		} - -	gameType = _gameId; +	g_cine = this;  }  CineEngine::~CineEngine() {  }  int CineEngine::init() { +	// Detect game +	if (!initGame()) { +		GUIErrorMessage("No valid games were found in the specified directory."); +		return -1; +	} +  	// Initialize backend  	_system->beginGFXTransaction();  	initCommonGFX(false);  	_system->initSize(320, 200);  	_system->endGFXTransaction(); -	if (gameType == GID_FW) { +	if (g_cine->getGameType() == GType_FW) {  		g_soundDriver = new AdlibSoundDriverINS(_mixer);  	} else {  		g_soundDriver = new AdlibSoundDriverADL(_mixer); @@ -192,7 +100,7 @@ int CineEngine::go() {  	mainLoop(1); -	if (gameType == Cine::GID_FW) +	if (g_cine->getGameType() == Cine::GType_FW)  		snd_clearBasesonEntries();  	delete g_sfxPlayer; @@ -201,8 +109,6 @@ int CineEngine::go() {  } -int gameType; -  static void initialize() {  	uint16 i; @@ -219,11 +125,11 @@ static void initialize() {  	loadTextData("texte.dat", textDataPtr); -	switch (gameType) { -	case Cine::GID_FW: +	switch (g_cine->getGameType()) { +	case Cine::GType_FW:  		snd_loadBasesonEntries("BASESON.SND");  		break; -	case Cine::GID_OS: +	case Cine::GType_OS:  		// TODO  		// load POLDAT.DAT  		// load ERRMESS.DAT (default responses to actions) @@ -240,7 +146,7 @@ static void initialize() {  	}  	// bypass protection -	if (gameType == GID_OS && !ConfMan.getBool("copy_protection")) { +	if (g_cine->getGameType() == GType_OS && !ConfMan.getBool("copy_protection")) {  		globalVars[255] = 1;  	} diff --git a/engines/cine/cine.h b/engines/cine/cine.h index f0de296986..bddbfd86b7 100644 --- a/engines/cine/cine.h +++ b/engines/cine/cine.h @@ -28,6 +28,7 @@  #include "common/stdafx.h"  #include "common/scummsys.h"  #include "common/util.h" +#include "common/advancedDetector.h"  #include "engines/engine.h" @@ -47,27 +48,46 @@  namespace Cine { -enum CineGameId { -	GID_FW = 1, -	GID_OS +enum CineGameType { +	GType_FW = 1, +	GType_OS +}; + +enum CineGameFeatures { +	GF_CD =   1 << 0, +	GF_DEMO = 1 << 1 +}; + +struct CINEGameDescription { +	Common::ADGameDescription desc; + +	int gameType; +	uint32 features;  };  class CineEngine : public Engine { -	int _gameId;  protected:  	int init();  	int go();  	void shutdown(); +	 +	bool initGame();  public:  	CineEngine(OSystem *syst);  	virtual ~CineEngine(); -	int getGameId() { -		return _gameId; -	} + +	int getGameType() const { return _gameDescription->gameType; } +	uint32 getFeatures() const { return _gameDescription->features; } +	Common::Language getLanguage() const { return _gameDescription->desc.language; } +	Common::Platform getPlatform() const { return _gameDescription->desc.platform; } + +	const CINEGameDescription *_gameDescription;  }; +extern CineEngine *g_cine; +  #define BOOT_PRC_NAME "AUTO00.PRC"  enum { diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp new file mode 100644 index 0000000000..6db133a488 --- /dev/null +++ b/engines/cine/detection.cpp @@ -0,0 +1,695 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2006 The ScummVM project + * + * cinE Engine is (C) 2004-2005 by CinE Team + * + * 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. + * + * $URL$ + * $Id$ + * + */ + +#include "common/stdafx.h" + +#include "base/plugins.h" + +#include "common/advancedDetector.h" +#include "common/config-manager.h" +#include "common/file.h" + +#include "cine/cine.h" + +namespace Cine { +static DetectedGameList GAME_detectGames(const FSList &fslist); +} + +using Common::File; + +static const PlainGameDescriptor cineGames[] = { +	{"fw", "Future Wars"}, +	{"os", "Operation Stealth"}, +	{NULL, NULL} +}; + +GameList Engine_CINE_gameIDList() { +	GameList games; +	const PlainGameDescriptor *g = cineGames; +	while (g->gameid) { +		games.push_back(*g); +		g++; +	} + +	return games; +} + +GameDescriptor Engine_CINE_findGameID(const char *gameid) { +	// First search the list of supported game IDs. +	const PlainGameDescriptor *g = cineGames; +	while (g->gameid) { +		if (!scumm_stricmp(gameid, g->gameid)) +			return *g; +		g++; +	} + +	return *g; +} + +DetectedGameList Engine_CINE_detectGames(const FSList &fslist) { +	return Cine::GAME_detectGames(fslist); +} + +PluginError Engine_CINE_create(OSystem *syst, Engine **engine) { +	assert(syst); +	assert(engine); + +	FSList fslist; +	FilesystemNode dir(ConfMan.get("path")); +	if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { +		warning("CineEngine: invalid game path '%s'", dir.path().c_str()); +		return kInvalidPathError; +	} + +	// Invoke the detector +	Common::String gameid = ConfMan.get("gameid"); +	DetectedGameList detectedGames = Engine_CINE_detectGames(fslist); + +	for (uint i = 0; i < detectedGames.size(); i++) { +		if (detectedGames[i].gameid == gameid) { +			*engine = new Cine::CineEngine(syst); +			return kNoError; +		} +	} +	 +	warning("CineEngine: Unable to locate game data at path '%s'", dir.path().c_str()); +	return kNoGameDataFoundError; +} + +REGISTER_PLUGIN(CINE, "Cinematique evo.1 engine", "Future Wars & Operation Stealth (C) Delphine Software"); + +namespace Cine { + +#define FILE_MD5_BYTES 5000 + +using Common::ADGameFileDescription; +using Common::ADGameDescription; + +static const ADGameFileDescription FW_GameFiles[] = { +	{ "part01",		0,	"61d003202d301c29dd399acfb1354310"}, +}; + +static const ADGameFileDescription FWDE_GameFiles[] = { +	{ "part01",		0,	"f5e98fcca3fb5e7afa284c81c39d8b14"}, +}; + +static const ADGameFileDescription FWES_GameFiles[] = { +	{ "part01",		0,	"570109f965c7f53984b98c83d86eb206"}, +}; + +static const ADGameFileDescription FWFR_GameFiles[] = { +	{ "part01",		0,	"5d1acb97abe9591f9008e00d07add95a"}, +}; + +static const ADGameFileDescription FWAmiga_GameFiles[] = { +	{ "part01",		0,	"57afd280b598b4180fda6689fbedc4b8"}, +}; + +static const ADGameFileDescription FWAmigaDE_GameFiles[] = { +	{ "part01",		0,	"3a87a913e0e33963a48a7f822ca0eb0e"}, +}; + +static const ADGameFileDescription FWAmigaES_GameFiles[] = { +	{ "part01",		0,	"5ad0007ccd5f7b3dd6b15ea7f281f9e1"}, +}; + +static const ADGameFileDescription FWAmigaFR_GameFiles[] = { +	{ "part01",		0,	"460f2da8793bc581a2d4b6fc19ccb5ae"}, +}; + +static const ADGameFileDescription FWAmigaIT_GameFiles[] = { +	{ "part01",		0,	"1c8e5207743172134409ac58860021af"}, +}; + +static const ADGameFileDescription FWAmigaDemo_GameFiles[] = { +	{ "demo",		0,	"0f50767cd964e302d3af0ba2528df8c4"}, +	{ "demo.prc",		0,	"d2ac3a743d288359c63644ea7071edae"}, +}; + +static const ADGameFileDescription FWST_GameFiles[] = { +	{ "part01",		0,	"36050db13af57e462ca1adc4df99de4e"}, +}; + +static const ADGameFileDescription FWSTFR_GameFiles[] = { +	{ "part01",		0,	"ef245573b7dab0d4825ceb98e37cef4d"}, +}; + +static const ADGameFileDescription OS_GameFiles[] = { +	{ "procs00",		0,	"d6752e7d25924cb866b61eb7cb0c8b56"}, +}; + +static const ADGameFileDescription OSUS_GameFiles[] = { +	{ "procs1",		0,	"d8c3a9d05a63e4cfa801826a7063a126"}, +}; + +static const ADGameFileDescription OSUSAlt_GameFiles[] = { +	{ "procs00",	0,	"862a75d76fb7fffec30e52be9ad1c474"}, +}; + +static const ADGameFileDescription OSDE_GameFiles[] = { +	{ "procs1",		0,	"39b91ae35d1297ce0a76a1a803ca1593"}, +}; + +static const ADGameFileDescription OSES_GameFiles[] = { +	{ "procs1",		0,	"74c2dabd9d212525fca8875a5f6d8994"}, +}; + +static const ADGameFileDescription OSESCD_GameFiles[] = { +	{ "procs1",		0,	"74c2dabd9d212525fca8875a5f6d8994"}, +	{ "sds1",		0,	"75443ba39cdc95667e07d7118e5c151c"}, +}; + +static const ADGameFileDescription OSFR_GameFiles[] = { +	{ "procs00",		0,	"f143567f08cfd1a9b1c9a41c89eadfef"}, +}; + +static const ADGameFileDescription OSIT_GameFiles[] = { +	{ "procs1",		0,	"da066e6b8dd93f2502c2a3755f08dc12"}, +}; + +static const ADGameFileDescription OSAmiga_GameFiles[] = { +	{ "procs0",		0,	"a9da5531ead0ebf9ad387fa588c0cbb0"}, +}; + +static const ADGameFileDescription OSAmigaAlt_GameFiles[] = { +	{ "procs0",		0,	"8a429ced2f4acff8a15ae125174042e8"}, +}; + +static const ADGameFileDescription OSAmigaUS_GameFiles[] = { +	{ "procs0",		0,	"d5f27e33fc29c879f36f15b86ccfa58c"}, +}; + +static const ADGameFileDescription OSAmigaDE_GameFiles[] = { +	{ "procs0",		0,	"8b7dce249821d3a62b314399c4334347"}, +}; + +static const ADGameFileDescription OSAmigaES_GameFiles[] = { +	{ "procs0",		0,	"35fc295ddd0af9da932d256ba799a4b0"}, +}; + +static const ADGameFileDescription OSAmigaFR_GameFiles[] = { +	{ "procs0",		0,	"d4ea4a97e01fa67ea066f9e785050ed2"}, +}; + +static const ADGameFileDescription OSAmigaDemo_GameFiles[] = { +	{ "demo",		0,	"8d3a750d1c840b1b1071e42f9e6f6aa2"}, +}; + +static const ADGameFileDescription OSST_GameFiles[] = { +	{ "procs0",		0,	"1501d5ae364b2814a33ed19347c3fcae"}, +}; + +static const ADGameFileDescription OSSTFR_GameFiles[] = { +	{ "procs0",		0,	"2148d25de3219dd4a36580ca735d0afa"}, +}; + + +static const CINEGameDescription gameDescriptions[] = { +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FW_GameFiles), +			FW_GameFiles, +			Common::EN_ANY, +			Common::kPlatformPC, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWDE_GameFiles), +			FWDE_GameFiles, +			Common::DE_DEU, +			Common::kPlatformPC, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWES_GameFiles), +			FWES_GameFiles, +			Common::ES_ESP, +			Common::kPlatformPC, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWFR_GameFiles), +			FWFR_GameFiles, +			Common::FR_FRA, +			Common::kPlatformPC, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWAmiga_GameFiles), +			FWAmiga_GameFiles, +			Common::EN_ANY, +			Common::kPlatformAmiga, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWAmigaDE_GameFiles), +			FWAmigaDE_GameFiles, +			Common::DE_DEU, +			Common::kPlatformAmiga, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWAmigaES_GameFiles), +			FWAmigaES_GameFiles, +			Common::ES_ESP, +			Common::kPlatformAmiga, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWAmigaFR_GameFiles), +			FWAmigaFR_GameFiles, +			Common::FR_FRA, +			Common::kPlatformAmiga, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWAmigaIT_GameFiles), +			FWAmigaIT_GameFiles, +			Common::IT_ITA, +			Common::kPlatformAmiga, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"Demo", +			ARRAYSIZE(FWAmigaDemo_GameFiles), +			FWAmigaDemo_GameFiles, +			Common::EN_ANY, +			Common::kPlatformAmiga, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWST_GameFiles), +			FWST_GameFiles, +			Common::EN_ANY, +			Common::kPlatformAtariST, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"fw", +			"", +			ARRAYSIZE(FWSTFR_GameFiles), +			FWSTFR_GameFiles, +			Common::FR_FRA, +			Common::kPlatformAtariST, +		}, +		GType_FW, +		0, +	}, + +	{ +		{ +			"os", +			"CD", +			ARRAYSIZE(OS_GameFiles), +			OS_GameFiles, +			Common::EN_GRB, +			Common::kPlatformPC, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSUS_GameFiles), +			OSUS_GameFiles, +			Common::EN_USA, +			Common::kPlatformPC, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"CD", +			ARRAYSIZE(OSUSAlt_GameFiles), +			OSUSAlt_GameFiles, +			Common::EN_USA, +			Common::kPlatformPC, +		}, +		GType_OS, +		GF_CD, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSDE_GameFiles), +			OSDE_GameFiles, +			Common::DE_DEU, +			Common::kPlatformPC, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSES_GameFiles), +			OSES_GameFiles, +			Common::ES_ESP, +			Common::kPlatformPC, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"CD", +			ARRAYSIZE(OSESCD_GameFiles), +			OSESCD_GameFiles, +			Common::ES_ESP, +			Common::kPlatformPC, +		}, +		GType_OS, +		GF_CD, +	}, + +	{ +		{ +			"os", +			"CD", +			ARRAYSIZE(OSFR_GameFiles), +			OSFR_GameFiles, +			Common::FR_FRA, +			Common::kPlatformPC, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSIT_GameFiles), +			OSIT_GameFiles, +			Common::IT_ITA, +			Common::kPlatformPC, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSAmiga_GameFiles), +			OSAmiga_GameFiles, +			Common::EN_GRB, +			Common::kPlatformAmiga, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"alt", +			ARRAYSIZE(OSAmigaAlt_GameFiles), +			OSAmigaAlt_GameFiles, +			Common::EN_GRB, +			Common::kPlatformAmiga, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSAmigaUS_GameFiles), +			OSAmigaUS_GameFiles, +			Common::EN_USA, +			Common::kPlatformAmiga, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSAmigaDE_GameFiles), +			OSAmigaDE_GameFiles, +			Common::DE_DEU, +			Common::kPlatformAmiga, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSAmigaES_GameFiles), +			OSAmigaES_GameFiles, +			Common::ES_ESP, +			Common::kPlatformAmiga, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSAmigaFR_GameFiles), +			OSAmigaFR_GameFiles, +			Common::FR_FRA, +			Common::kPlatformAmiga, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"Demo", +			ARRAYSIZE(OSAmigaDemo_GameFiles), +			OSAmigaDemo_GameFiles, +			Common::EN_GRB, +			Common::kPlatformAmiga, +		}, +		GType_OS, +		GF_DEMO, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSST_GameFiles), +			OSST_GameFiles, +			Common::EN_GRB, +			Common::kPlatformAtariST, +		}, +		GType_OS, +		0, +	}, + +	{ +		{ +			"os", +			"", +			ARRAYSIZE(OSSTFR_GameFiles), +			OSSTFR_GameFiles, +			Common::FR_FRA, +			Common::kPlatformAtariST, +		}, +		GType_OS, +		0, +	}, + +}; + +DetectedGame toDetectedGame(const ADGameDescription &g) { +	const char *title = 0; + +	const PlainGameDescriptor *sg = cineGames; +	while (sg->gameid) { +		if (!scumm_stricmp(g.name, sg->gameid)) +			title = sg->description; +		sg++; +	} + +	DetectedGame dg(g.name, title, g.language, g.platform); +	dg.updateDesc(g.extra); +	return dg; +} + +bool CineEngine::initGame() { +	int gameNumber = -1; +	 +	DetectedGameList detectedGames; +	Common::AdvancedDetector AdvDetector; +	Common::ADList matches; +	Common::ADGameDescList descList; + +	Common::Language language = Common::UNK_LANG; +	Common::Platform platform = Common::kPlatformUnknown; + +	if (ConfMan.hasKey("language")) +		language = Common::parseLanguage(ConfMan.get("language")); +	if (ConfMan.hasKey("platform")) +		platform = Common::parsePlatform(ConfMan.get("platform")); + +	Common::String gameid = ConfMan.get("gameid"); + +	// At this point, Engine_Cine_create() has already verified that the +	// desired game is in the specified directory. But we've already +	// forgotten which particular version it was, so we have to do it all +	// over again... + +	for (int i = 0; i < ARRAYSIZE(gameDescriptions); i++) +		descList.push_back((ADGameDescription *)&gameDescriptions[i]); + +	AdvDetector.registerGameDescriptions(descList); +	AdvDetector.setFileMD5Bytes(FILE_MD5_BYTES); + +	matches = AdvDetector.detectGame(NULL, language, platform); + +	for (uint i = 0; i < matches.size(); i++) { +		if (toDetectedGame(gameDescriptions[matches[i]].desc).gameid == gameid) { +			gameNumber = matches[i]; +			break; +		} +	} + +	//delete &matches; + +	if (gameNumber >= ARRAYSIZE(gameDescriptions) || gameNumber == -1) { +		error("CineEngine::loadGame wrong gameNumber"); +	} + +	debug(2, "Running %s", toDetectedGame(gameDescriptions[gameNumber].desc).description.c_str()); + +	_gameDescription = &gameDescriptions[gameNumber]; + +	return true; +} + +DetectedGameList GAME_detectGames(const FSList &fslist) { +	DetectedGameList detectedGames; +	Common::AdvancedDetector AdvDetector; +	Common::ADList matches; +	Common::ADGameDescList descList; + +	for (int i = 0; i < ARRAYSIZE(gameDescriptions); i++) +		descList.push_back((ADGameDescription *)&gameDescriptions[i]); + +	AdvDetector.registerGameDescriptions(descList); +	AdvDetector.setFileMD5Bytes(FILE_MD5_BYTES); + +	matches = AdvDetector.detectGame(&fslist, Common::UNK_LANG, Common::kPlatformUnknown); + +	for (uint i = 0; i < matches.size(); i++) +		detectedGames.push_back(toDetectedGame(gameDescriptions[matches[i]].desc)); +	 +	//delete &matches; +	return detectedGames; +} + +} // End of namespace Cine diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index cc8f9ffe07..e44019244d 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -335,7 +335,7 @@ void drawSpriteRaw(byte *spritePtr, byte *maskPtr, int16 width, int16 height,  		destPtr += i * 320;  		for (j = 0; j < width * 8; j++) { -			if (((gameType == Cine::GID_FW && (!maskPtr || !(*maskPtr))) || (gameType == Cine::GID_OS)) && (x + j >= 0 +			if (((g_cine->getGameType() == Cine::GType_FW && (!maskPtr || !(*maskPtr))) || (g_cine->getGameType() == Cine::GType_OS)) && (x + j >= 0  					&& x + j < 320 && i + y >= 0 && i + y < 200)) {  				*(destPtr++) = *(spritePtr++);  			} else { diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 99807b5002..d35bfaa766 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -304,7 +304,7 @@ void mainLoop(int bootScriptIdx) {  	unloadAllMasks();  	freePrcLinkedList();  	releaseObjectScripts(); -	// if (gameType == Cine::GID_OS) { +	// if (g_cine->getGameType() == Cine::GType_OS) {  	// 	freeUnkList();  	// }  	closeEngine7(); diff --git a/engines/cine/module.mk b/engines/cine/module.mk index 24e7b55e55..10f2ddbaa0 100644 --- a/engines/cine/module.mk +++ b/engines/cine/module.mk @@ -5,6 +5,7 @@ MODULE_OBJS = \  	bg.o \  	bg_list.o \  	cine.o \ +	detection.o \  	font.o \  	gfx.o \  	main_loop.o \ diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 5346a380a9..cc43b9c70d 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -68,7 +68,7 @@ void loadPart(const char *partName) {  		partFileHandle.readUint32BE(); // unused  	} -	if (gameType == Cine::GID_FW) +	if (g_cine->getGameType() == Cine::GType_FW && g_cine->getPlatform() == Common::kPlatformPC)  		loadPal(partName);  } @@ -97,7 +97,7 @@ void freePartRange(byte startIdx, byte numIdx) {  void closePart(void) {  } -static const char *bundleNames[] = { +static const char *bundleNamesDOSEN[] = {  	"EGOUBASE",  	"LABYBASE",  	"PROCEGOU", @@ -133,8 +133,6 @@ static const char *bundleNames[] = {  	"RSC15",  	"RSC16",  	"RSC17", -// english version -#if 1  	"SONS1",  	"SONS2",  	"SONS3", @@ -144,34 +142,247 @@ static const char *bundleNames[] = {  	"SONS7",  	"SONS8",  	"SONS9", -#else -	"SONS31", // french version +	NULL +}; + +static const char *bundleNamesDOSUS[] = { +	"EGOUBASE", +	"LABYBASE", +	"PROCEGOU", +	"PROCLABY", +	"PROCS00", +	"PROCS01", +	"PROCS02", +	"PROCS03", +	"PROCS04", +	"PROCS06", +	"PROCS07", +	"PROCS08", +	"PROCS12", +	"PROCS13", +	"PROCS15", +	"PROCS16", +	"RSC00", +	"RSC02", +	"RSC03", +	"RSC04", +	"RSC05", +	"RSC06", +	"RSC07", +	"RSC08", +	"RSC09", +	"RSC10", +	"RSC11", +	"RSC12", +	"RSC13", +	"RSC14", +	"RSC15", +	"RSC16", +	"RSC17", +	"SONS31", +	"SONS32", +	"SONS33", +	"SONS34", +	NULL +}; + +static const char *bundleNamesDOSFR[] = { +	"EGOUBASE", +	"LABYBASE", +	"PROCEGOU", +	"PROCLABY", +	"PROCS00", +	"PROCS01", +	"PROCS02", +	"PROCS03", +	"PROCS04", +	"PROCS06", +	"PROCS07", +	"PROCS08", +	"PROCS10", +	"PROCS12", +	"PROCS13", +	"PROCS15", +	"PROCS16", +	"RSC00", +	"RSC01", +	"RSC02", +	"RSC03", +	"RSC04", +	"RSC05", +	"RSC06", +	"RSC07", +	"RSC08", +	"RSC09", +	"RSC10", +	"RSC11", +	"RSC12", +	"RSC13", +	"RSC14", +	"RSC15", +	"RSC16", +	"RSC17", +	"SONS31",  	"SONS32",  	"SONS33", -	"SONS34" -#endif +	"SONS34", +	NULL +}; + +static const char *bundleNamesDOSES[] = { +	"EGOUBASE", +	"LABYBASE", +	"PROCS1", +	"PROCS2", +	"PROCS3", +	"PROCS4", +	"PROCS5", +	"PROCS6", +	"SD01A", +	"SD01B", +	"SD01C", +	"SD01D", +	"SD021", +	"SD022", +	"SD03", +	"SDSONS", +	"SDSONS2", +	"SDSONS3", +	"SINTRO2", +	NULL +}; + +static const char *bundleNamesDOSInt[] = { +	"EGOUBASE", +	"LABYBASE", +	"PROCS1", +	"PROCS2", +	"PROCS3", +	"PROCS4", +	"PROCS5", +	"PROCS6", +	"SD01A", +	"SD01B", +	"SD01C", +	"SD01D", +	"SD021", +	"SD022", +	"SD03", +	"SDS1", +	"SDS2", +	"SDS3", +	"SDS4", +	"SDS5", +	"SDS6", +	"SINTRO2", +	NULL +}; + +static const char *bundleNamesAmiga[] = { +	"EGOUBASE", +	"LABYBASE", +	"PROCS0", +	"PROCS1", +	"PROCS2", +	"SAMPLES", +	"SAMPLES2", +	"SAMPLES3", +	"SD01A", +	"SD01B", +	"SD01C", +	"SD01D", +	"SD02", +	"SD03", +	"SDSONS", +	"SDSONS2", +	"SDSONS3", +	"SINTRO2", +	NULL +}; + +static const char *bundleNamesAmigaDemo[] = { +	"DEMO_OS", +	"SDSONS", +	NULL +}; + +static const char *bundleNamesAtari[] = { +	"EGOUBASE", +	"LABYBASE", +	"PROCS0", +	"PROCS1", +	"PROCS2", +	"SAMPLES", +	"SD01A", +	"SD01B", +	"SD01C", +	"SD01D", +	"SD02", +	"SD03", +	"SDSONS", +	"SDSONS2", +	"SDSONS3", +	"SINTRO2", +	NULL  };  int16 findFileInBundle(const char *fileName) {  	uint16 i; -	if (gameType == Cine::GID_OS) { -		uint16 j; - +	if (g_cine->getGameType() == Cine::GType_OS) {  		for (i = 0; i < numElementInPart; i++) {  			if (!strcmp(fileName, partBuffer[i].partName)) {  				return i;  			}  		} -		for (j = 0; j < 39; j++) { -			loadPart(bundleNames[j]); +		const char **bPtr; + +		if (g_cine->getPlatform() == Common::kPlatformPC) { +			switch (g_cine->getLanguage()) { +			case Common::EN_GRB: +				bPtr = bundleNamesDOSEN; +				break; +			case Common::EN_USA: +				if (g_cine->getFeatures() & GF_CD) +					bPtr = bundleNamesDOSUS; +				else +					bPtr = bundleNamesDOSInt; +				break; +			case Common::DE_DEU: +			case Common::IT_ITA: +				bPtr = bundleNamesDOSInt; +				break; +			case Common::ES_ESP: +				if (g_cine->getFeatures() & GF_CD) +					bPtr = bundleNamesDOSInt; +				else +					bPtr = bundleNamesDOSES; +				break; +			case Common::FR_FRA: +				bPtr = bundleNamesDOSFR; +				break; +			default: +				break; +			} +		} else if (g_cine->getPlatform() == Common::kPlatformAmiga) { +			if (g_cine->getFeatures() & GF_DEMO) +				bPtr = bundleNamesAmigaDemo; +			else +				bPtr = bundleNamesAmiga; +		} else if (g_cine->getPlatform() == Common::kPlatformAtariST) { +				bPtr = bundleNamesAtari; +		} + +		while (**bPtr) { +			loadPart(*bPtr);  			for (i = 0; i < numElementInPart; i++) {  				if (!strcmp(fileName, partBuffer[i].partName)) {  					return i;  				}  			} +			bPtr++;  		}  	} else {  		for (i = 0; i < numElementInPart; i++) { diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp index 631df16713..42f251707e 100644 --- a/engines/cine/prc.cpp +++ b/engines/cine/prc.cpp @@ -77,7 +77,8 @@ void loadPrc(const char *pPrcName) {  	}  	checkDataDisk(-1); -	if ((gameType == Cine::GID_FW) && (!strcmp(pPrcName, BOOT_PRC_NAME))) { +	if ((g_cine->getGameType() == Cine::GType_FW) && +		(!scumm_stricmp(pPrcName, BOOT_PRC_NAME) || !scumm_stricmp(pPrcName, "demo.prc"))) {  		scriptPtr = readFile(pPrcName);  	} else {  		scriptPtr = readBundleFile(findFileInBundle(pPrcName)); diff --git a/engines/cine/resource.cpp b/engines/cine/resource.cpp index 0601dceb52..fb5fcfb94e 100644 --- a/engines/cine/resource.cpp +++ b/engines/cine/resource.cpp @@ -94,7 +94,7 @@ byte *snd_loadBasesonEntry(const char *entryName) {  	int entryNum;  	byte *entryData = NULL; -	if (gameType == Cine::GID_OS) { +	if (g_cine->getGameType() == Cine::GType_OS) {  		entryNum = findFileInBundle((const char *)entryName);  		if (entryNum != -1)  			entryData = readBundleFile(entryNum); diff --git a/engines/cine/script.cpp b/engines/cine/script.cpp index f517f5b707..c26d1b165e 100644 --- a/engines/cine/script.cpp +++ b/engines/cine/script.cpp @@ -422,7 +422,7 @@ void setupOpcodes() {  		o1_changeDataDisk  	}; -	if (gameType == Cine::GID_FW) { +	if (g_cine->getGameType() == Cine::GType_FW) {  		_opcodeTable = opcodeTableFW;  		_numOpcodes = ARRAYSIZE(opcodeTableFW);  	} else { @@ -541,7 +541,7 @@ void addToBGList(int16 objIdx) {  	part = objectTable[objIdx].part; -	if (gameType == Cine::GID_OS) { +	if (g_cine->getGameType() == Cine::GType_OS) {  		drawSpriteRaw2(animDataTable[objectTable[objIdx].frame].ptr1, objectTable[objIdx].part, width, height, page2Raw, x, y);  	} else {  		drawSpriteRaw(animDataTable[objectTable[objIdx].frame].ptr1, animDataTable[objectTable[objIdx].frame].ptr2, width, height, page2Raw, x, y); @@ -1627,7 +1627,7 @@ void o1_compareGlobalVar() {  		debugC(5, kCineDebugScript, "Line: %d: compare globalVars[%d] and %d", _currentLine, varIdx, value); -		if (varIdx == 255 && (gameType == Cine::GID_FW)) {	// TODO: fix +		if (varIdx == 255 && (g_cine->getGameType() == Cine::GType_FW)) {	// TODO: fix  			_currentScriptElement->compareResult = 1;  		} else {  			_currentScriptElement->compareResult = compareVars(globalVars[varIdx], value); @@ -1717,6 +1717,12 @@ void o1_loadMusic() {  	const char *param = getNextString();  	debugC(5, kCineDebugScript, "Line: %d: loadMusic(%s)", _currentLine, param); + +	if (g_cine->getPlatform() == Common::kPlatformAmiga) { +		warning("STUB: o1_loadMusic"); +		return; +	} +  	g_sfxPlayer->load(param);  } diff --git a/engines/cine/sfx_player.cpp b/engines/cine/sfx_player.cpp index dbe48155ad..59b9c61041 100644 --- a/engines/cine/sfx_player.cpp +++ b/engines/cine/sfx_player.cpp @@ -63,7 +63,7 @@ bool SfxPlayer::load(const char *song) {  	}  	/* like the original PC version, skip introduction song (file doesn't exist) */ -	if (gameType == Cine::GID_OS && strncmp(song, "INTRO", 5) == 0) { +	if (g_cine->getGameType() == Cine::GType_OS && strncmp(song, "INTRO", 5) == 0) {  		return 0;  	} diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp index 53c923b4db..24be31d42c 100644 --- a/engines/cine/texte.cpp +++ b/engines/cine/texte.cpp @@ -57,7 +57,7 @@ void loadTextData(const char *pFileName, byte *pDestinationBuffer) {  	tempBuffer = pDestinationBuffer; -	if (gameType == Cine::GID_FW) { +	if (g_cine->getGameType() == Cine::GType_FW) {  		dataSize = dataSize / 0x4E;  		loadRelatedPalette(pFileName); diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 7d265049c6..73602be214 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -421,7 +421,7 @@ int16 getObjectUnderCursor(uint16 x, uint16 y) {  				if ((xdif >= 0) && ((treshold << 4) > xdif) && (ydif > 0) && (ydif < height)) {  					if (animDataTable[frame].ptr1) { -						if (gameType == Cine::GID_OS) +						if (g_cine->getGameType() == Cine::GType_OS)  							return currentHead->objIdx;  						if (currentHead->type == 0)	{ // use generated mask @@ -449,7 +449,7 @@ static commandeType currentSaveName[10];  int16 loadSaveDirectory(void) {  	Common::InSaveFile *fHandle; -	if (gameType == Cine::GID_FW) +	if (g_cine->getGameType() == Cine::GType_FW)  		fHandle = g_saveFileMan->openForLoading("FW.DIR");  	else  		fHandle = g_saveFileMan->openForLoading("OS.DIR"); @@ -601,7 +601,7 @@ int16 makeLoad(char *saveName) {  	g_sfxPlayer->stop();  	freeAnimDataTable();  	unloadAllMasks(); -	// if (gameType == Cine::GID_OS) { +	// if (g_cine->getGameType() == Cine::GType_OS) {  	// 	freeUnkList();  	// }  	freePrcLinkedList(); @@ -1090,7 +1090,7 @@ void makeSystemMenu(void) {  					if (selectedSave >= 0) {  						char saveNameBuffer[256]; -						if (gameType == Cine::GID_FW) +						if (g_cine->getGameType() == Cine::GType_FW)  							sprintf(saveNameBuffer, "FW.%1d", selectedSave);  						else  							sprintf(saveNameBuffer, "OS.%1d", selectedSave); @@ -1132,7 +1132,7 @@ void makeSystemMenu(void) {  					//makeTextEntryMenu("Veuillez entrer le Nom de la Sauvegarde .", ¤tSaveName[selectedSave], 120);  					sprintf(currentSaveName[selectedSave], "temporary save name"); -					if (gameType == Cine::GID_FW) +					if (g_cine->getGameType() == Cine::GType_FW)  						sprintf(saveFileName, "FW.%1d", selectedSave);  					else  						sprintf(saveFileName, "OS.%1d", selectedSave); @@ -1143,7 +1143,7 @@ void makeSystemMenu(void) {  						Common::OutSaveFile *fHandle; -						if (gameType == Cine::GID_FW) +						if (g_cine->getGameType() == Cine::GType_FW)  							fHandle = g_saveFileMan->openForSaving("FW.DIR");  						else  							fHandle = g_saveFileMan->openForSaving("OS.DIR"); @@ -1285,7 +1285,7 @@ int16 buildObjectListCommand(void) {  	int16 i;  	int16 j; -	assert(gameType == Cine::GID_FW); +	assert(g_cine->getGameType() == Cine::GType_FW);  	for (i = 0; i < 20; i++) {  		objectListCommand[i][0] = 0; @@ -1308,7 +1308,7 @@ int16 buildObjectListCommand2(int16 param) {  	int16 i;  	int16 j; -	assert(gameType == Cine::GID_OS); +	assert(g_cine->getGameType() == Cine::GType_OS);  	for (i = 0; i < 20; i++) {  		objectListCommand[i][0] = 0; @@ -1383,7 +1383,7 @@ void makeCommandLine(void) {  		getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); -		if (gameType == Cine::GID_FW) { +		if (g_cine->getGameType() == Cine::GType_FW) {  			si = selectSubObject(x, y + 8);  		} else {  			si = selectSubObject2(x, y + 8, -subObjectUseTable[playerCommand]); @@ -1393,7 +1393,7 @@ void makeCommandLine(void) {  			playerCommand = -1;  			strcpy(commandBuffer, "");  		} else { -			if (gameType == Cine::GID_OS) { +			if (g_cine->getGameType() == Cine::GType_OS) {  				if (si >= 8000) {  					si -= 8000;  					canUseOnObject = canUseOnItemTable[playerCommand]; @@ -1420,7 +1420,7 @@ void makeCommandLine(void) {  		}  	} -	if (gameType == Cine::GID_OS) { +	if (g_cine->getGameType() == Cine::GType_OS) {  		if (playerCommand != -1 && canUseOnObject != 0)	{ // call use on sub object  			int16 si; @@ -1971,7 +1971,7 @@ void makeActionMenu(void) {  	getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); -	if (gameType == Cine::GID_OS) { +	if (g_cine->getGameType() == Cine::GType_OS) {  		playerCommand = makeMenuChoice2(defaultActionCommand, 6, mouseX, mouseY, 70);  		if (playerCommand >= 8000) { @@ -2109,7 +2109,7 @@ uint16 executePlayerInput(void) {  		} else {  			if (mouseButton & 2) {  				if (!(mouseButton & 1)) { -					if (gameType == Cine::GID_OS) { +					if (g_cine->getGameType() == Cine::GType_OS) {  						playerCommand = makeMenuChoice2(defaultActionCommand, 6, mouseX, mouseY, 70);  						if (playerCommand >= 8000) { @@ -2343,7 +2343,7 @@ void drawSprite(overlayHeadElement *currentOverlay, byte *spritePtr,  	} else  #endif -	if (gameType == Cine::GID_OS) { +	if (g_cine->getGameType() == Cine::GType_OS) {  		drawSpriteRaw2(spritePtr, objectTable[currentOverlay->objIdx].part, width, height, page, x, y);  	} else {  		drawSpriteRaw(spritePtr, maskPtr, width, height, page, x, y); @@ -2676,7 +2676,7 @@ void drawOverlays(void) {  				y = objPtr->y;  				if (objPtr->frame >= 0) { -					if (gameType == Cine::GID_OS) { +					if (g_cine->getGameType() == Cine::GType_OS) {  						uint16 partVar1;  						uint16 partVar2;  						AnimData *pPart; @@ -3161,7 +3161,8 @@ void processSeqListElement(SeqListElement *element) {  		param1 = ptr1[1];  		param2 = ptr1[2]; -		assert(element->varC == 255); +		if (element->varC != 255) +			warning("processSeqListElement: varC = %d", element->varC);  		if (globalVars[VAR_MOUSE_X_POS] || globalVars[VAR_MOUSE_Y_POS]) {  			computeMove1(element, ptr1[4] + x, ptr1[5] + y, param1, param2, globalVars[VAR_MOUSE_X_POS], globalVars[VAR_MOUSE_Y_POS]); diff --git a/engines/cine/various.h b/engines/cine/various.h index b4fd60ade8..6b21d285a2 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -32,8 +32,6 @@  namespace Cine { -extern int gameType; -  typedef char commandeType[20];  void initLanguage(Common::Language lang); | 
