ICB: Switch detection from exe to game data. Added El Dorado to game entries

This commit is contained in:
Paweł Kołodziejski 2022-07-31 17:22:08 +02:00
parent 950e3f459e
commit f74192101c
No known key found for this signature in database
GPG Key ID: 0BDADC9E74440FF7
6 changed files with 195 additions and 44 deletions

View File

@ -21,66 +21,100 @@
#include "engines/advancedDetector.h" #include "engines/advancedDetector.h"
#include "engines/icb/detection.h"
namespace ICB { namespace ICB {
static const PlainGameDescriptor icbGames[] = { static const PlainGameDescriptor icbGames[] = {
{ "icb", "In Cold Blood" }, { "icb", "In Cold Blood" },
{ "eldorado", "The Road to El Dorado" },
{ nullptr, nullptr } { nullptr, nullptr }
}; };
static const char *directoryGlobs[] = { static const IcbGameDescription gameDescriptions[] = {
"engine",
"linc",
"demo",
nullptr
};
static const ADGameDescription gameDescriptions[] = {
{ {
// In Cold Blood {
// English GOG Version // In Cold Blood
"icb", // English GOG Version
"GOG", "icb",
AD_ENTRY1s("engine.exe", "0c4a7a5046ec13ccac89ab3f959cc217", 837632), "GOG",
Common::EN_ANY, AD_ENTRY2s("g/speech.clu", "ced60009bdffa9a1055863bf10d2e79e", 7683040, "g/g", "ebe9e5377ee9d231e7a7e33666eb517b", 63892),
Common::kPlatformWindows, Common::EN_ANY,
ADGF_UNSTABLE, Common::kPlatformWindows,
GUIO1(GUIO_NONE) ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ICB
}, },
{ {
// In Cold Blood {
// English Demo // In Cold Blood
"icb", // English Demo
"Demo", "icb",
AD_ENTRY1s("engine.exe", "94222e343795853b0aa59cb9876415ae", 827392), "Demo",
Common::EN_GRB, AD_ENTRY2s("g/speech.clu", "ced60009bdffa9a1055863bf10d2e79e", 7683040, "g/g", "f8e1a762cc25554846f6e45d59f55159", 54560),
Common::kPlatformWindows, Common::EN_GRB,
ADGF_DEMO | ADGF_UNSTABLE, Common::kPlatformWindows,
GUIO1(GUIO_NONE) ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ICB
}, },
{ {
// In Cold Blood {
// English Demo // In Cold Blood
"icb", // English Demo
"Demo", "icb",
AD_ENTRY1s("engine.exe", "d0702069d95423107463001b99a19e73", 939520), "Demo",
Common::EN_USA, AD_ENTRY2s("g/speech.clu", "ced60009bdffa9a1055863bf10d2e79e", 7683040, "g/g", "2b9a8ca8d7a1bd91701708535b171aa8", 62080),
Common::kPlatformWindows, Common::EN_USA,
ADGF_DEMO | ADGF_UNSTABLE, Common::kPlatformWindows,
GUIO1(GUIO_NONE) ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ICB
}, },
AD_TABLE_END_MARKER {
{
// The Road to El Dorado
// English
"eldorado",
"",
AD_ENTRY2s("g/speech.clu", "65acb862dcdef2a7a69b961760bd565e", 1927072, "g/g", "ed36c6fb807a3ececba1bbda94172842", 17704),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ELDORADO
},
{
{
// The Road to El Dorado
// Polish
"eldorado",
"",
AD_ENTRY2s("g/speech.clu", "b063eee3ae6e327c37149a8342700004", 2009640, "g/g", "1427ecf118fc37da4ebb2f29d16d3d9b", 18520),
Common::PL_POL,
Common::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NONE)
},
GType_ELDORADO
},
{ AD_TABLE_END_MARKER, GType_ICB }
}; };
class IcbMetaEngineDetection : public AdvancedMetaEngineDetection { class IcbMetaEngineDetection : public AdvancedMetaEngineDetection {
public: public:
IcbMetaEngineDetection() : AdvancedMetaEngineDetection(gameDescriptions, sizeof(ADGameDescription), icbGames) { IcbMetaEngineDetection() : AdvancedMetaEngineDetection(gameDescriptions, sizeof(IcbGameDescription), icbGames) {
_guiOptions = GUIO_NOMIDI; _guiOptions = GUIO_NOMIDI;
_maxScanDepth = 3; _flags = kADFlagMatchFullPaths;
_directoryGlobs = directoryGlobs;
} }
const char *getEngineName() const override { return "In Cold Blood Engine"; } const char *getEngineName() const override { return "In Cold Blood Engine"; }

41
engines/icb/detection.h Normal file
View File

@ -0,0 +1,41 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ICB_DETECTION_H
#define ICB_DETECTION_H
#include "engines/advancedDetector.h"
namespace ICB {
enum IcbGameType {
GType_ICB,
GType_ELDORADO
};
struct IcbGameDescription {
ADGameDescription desc;
IcbGameType gameType;
};
} // End of namespace ICB
#endif // ICB_DETECTION_H

View File

@ -38,18 +38,19 @@
#include "audio/mixer.h" #include "audio/mixer.h"
namespace ICB { namespace ICB {
IcbEngine *g_icb; IcbEngine *g_icb;
IcbEngine::IcbEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { IcbEngine::IcbEngine(OSystem *syst, const IcbGameDescription *gameDesc) : Engine(syst) {
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, 127); _mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, 127);
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_randomSource = new Common::RandomSource("icb"); _randomSource = new Common::RandomSource("icb");
g_icb = this; g_icb = this;
_gameDescription = &gameDesc->desc;
_gameType = gameDesc->gameType;
(void)_gameDescription; // silence warning (void)_gameDescription; // silence warning
} }
@ -133,6 +134,66 @@ Common::KeymapArray IcbEngine::initKeymapsIcb(const char *target) {
return Keymap::arrayOf(engineKeyMap); return Keymap::arrayOf(engineKeyMap);
} }
Common::KeymapArray IcbEngine::initKeymapsEldorado(const char *target) {
using namespace Common;
Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "eldorado", "The Road to El Dorado");
Action *act;
act = new Action(kStandardActionMoveUp, _("Up"));
act->setKeyEvent(KEYCODE_UP);
act->addDefaultInputMapping("JOY_UP");
engineKeyMap->addAction(act);
act = new Action(kStandardActionMoveDown, _("Down"));
act->setKeyEvent(KEYCODE_DOWN);
act->addDefaultInputMapping("JOY_DOWN");
engineKeyMap->addAction(act);
act = new Action(kStandardActionMoveLeft, _("Left"));
act->setKeyEvent(KEYCODE_LEFT);
act->addDefaultInputMapping("JOY_LEFT");
engineKeyMap->addAction(act);
act = new Action(kStandardActionMoveRight, _("Right"));
act->setKeyEvent(KEYCODE_RIGHT);
act->addDefaultInputMapping("JOY_RIGHT");
engineKeyMap->addAction(act);
act = new Action("BUSE", _("Interact"));
act->setKeyEvent(KeyState(KEYCODE_LCTRL));
act->addDefaultInputMapping("JOY_A");
engineKeyMap->addAction(act);
act = new Action("BINV", _("Inventory"));
act->setKeyEvent(KeyState(KEYCODE_RETURN));
act->addDefaultInputMapping("JOY_B");
engineKeyMap->addAction(act);
act = new Action("BCRU", _("Crouch"));
act->setKeyEvent(KeyState(KEYCODE_x));
act->addDefaultInputMapping("JOY_Y");
engineKeyMap->addAction(act);
act = new Action("BSID", _("Side Step"));
act->setKeyEvent(KeyState(KEYCODE_LSHIFT));
act->addDefaultInputMapping("JOY_RIGHT_TRIGGER");
engineKeyMap->addAction(act);
act = new Action("BRUN", _("Run"));
act->setKeyEvent(KeyState(KEYCODE_z));
act->addDefaultInputMapping("JOY_LEFT_TRIGGER");
engineKeyMap->addAction(act);
act = new Action("BPAS", _("Pause"));
act->setKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE));
act->addDefaultInputMapping("ESCAPE");
act->addDefaultInputMapping("JOY_BACK");
engineKeyMap->addAction(act);
return Keymap::arrayOf(engineKeyMap);
}
bool IcbEngine::hasFeature(EngineFeature f) const { bool IcbEngine::hasFeature(EngineFeature f) const {
return return
(f == kSupportsReturnToLauncher); (f == kSupportsReturnToLauncher);

View File

@ -30,24 +30,30 @@
#include "engines/advancedDetector.h" #include "engines/advancedDetector.h"
#include "engines/engine.h" #include "engines/engine.h"
#include "engines/icb/detection.h"
#include "common/random.h" #include "common/random.h"
namespace ICB { namespace ICB {
class IcbEngine : public Engine { class IcbEngine : public Engine {
public: public:
IcbEngine(OSystem *syst, const ADGameDescription *gameDesc); IcbEngine(OSystem *syst, const IcbGameDescription *gameDescIcb);
virtual ~IcbEngine(); virtual ~IcbEngine();
Common::RandomSource *getRandomSource() { return _randomSource; } Common::RandomSource *getRandomSource() { return _randomSource; }
static Common::Array<Common::Keymap *> initKeymapsIcb(const char *target); static Common::Array<Common::Keymap *> initKeymapsIcb(const char *target);
static Common::Array<Common::Keymap *> initKeymapsEldorado(const char *target);
bool hasFeature(EngineFeature f) const override; bool hasFeature(EngineFeature f) const override;
IcbGameType getGameType() { return _gameType; }
protected: protected:
// Engine APIs // Engine APIs
Common::Error run() override; Common::Error run() override;
private: private:
IcbGameType _gameType;
void initGfx(bool hwAccel, bool fullscreen); void initGfx(bool hwAccel, bool fullscreen);
void mainLoop(); void mainLoop();
Common::RandomSource *_randomSource; Common::RandomSource *_randomSource;

View File

@ -40,7 +40,8 @@ public:
}; };
Common::Error IcbMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { Common::Error IcbMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
*engine = new IcbEngine(syst, desc); const IcbGameDescription *gd = (const IcbGameDescription *)desc;
*engine = new IcbEngine(syst, gd);
return Common::kNoError; return Common::kNoError;
} }
@ -49,6 +50,8 @@ Common::KeymapArray IcbMetaEngine::initKeymaps(const char *target) const {
if (gameId == "icb") { if (gameId == "icb") {
return ICB::IcbEngine::initKeymapsIcb(target); return ICB::IcbEngine::initKeymapsIcb(target);
} else if (gameId == "eldorado") {
return ICB::IcbEngine::initKeymapsEldorado(target);
} }
return AdvancedMetaEngine::initKeymaps(target); return AdvancedMetaEngine::initKeymaps(target);

View File

@ -37,6 +37,7 @@
#include "engines/icb/mission.h" #include "engines/icb/mission.h"
#include "engines/icb/cluster_manager_pc.h" #include "engines/icb/cluster_manager_pc.h"
#include "engines/icb/configfile.h" #include "engines/icb/configfile.h"
#include "engines/icb/icb.h"
#include "common/str.h" #include "common/str.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -99,7 +100,12 @@ void ReadConfigFromIniFile() {
char configFile[1024]; char configFile[1024];
uint32 temp; uint32 temp;
sprintf(configFile, CONFIG_INI_FILENAME); if (g_icb->getGameType() == GType_ICB)
sprintf(configFile, "engine\\icb.ini");
else if (g_icb->getGameType() == GType_ELDORADO)
sprintf(configFile, "engine\\eldorado.ini");
else
assert(false);
ConfigFile config; ConfigFile config;
pxString filename = configFile; pxString filename = configFile;