TWINE: added game variant detection by gameId

This commit is contained in:
Martin Gerhardy 2020-10-25 20:42:48 +01:00
parent 94e18f53ff
commit f8210aac82
4 changed files with 16 additions and 8 deletions

View File

@ -26,8 +26,8 @@
namespace TwinE {
enum TwineGameType {
GType_LBA = (1 << 1),
GType_LBA2 = (1 << 2)
GType_LBA = 1,
GType_LBA2 = 2
};
} // End of namespace TwinE

View File

@ -47,7 +47,14 @@ public:
bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override {
if (desc) {
*engine = new TwinE::TwinEEngine(syst, desc->language, desc->flags);
TwineGameType gameType = TwineGameType::GType_LBA;
const Common::String gameId = desc->gameId;
if (gameId == "lba") {
gameType = TwineGameType::GType_LBA;
} else if (gameId == "lba2") {
gameType = TwineGameType::GType_LBA2;
}
*engine = new TwinE::TwinEEngine(syst, desc->language, desc->flags, gameType);
}
return desc != nullptr;
}

View File

@ -66,8 +66,8 @@
namespace TwinE {
TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flags)
: Engine(system), _gameLang(language), _gameFlags(flags), _rnd("twine") {
TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flags, TwineGameType gameType)
: Engine(system), _gameType(gameType), _gameLang(language), _gameFlags(flags), _rnd("twine") {
// Add default file directories
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "fla");

View File

@ -158,16 +158,17 @@ private:
int32 saveFreezedTime = 0;
ActorMoveStruct loopMovePtr; // mainLoopVar1
PauseToken _pauseToken;
TwineGameType _gameType;
public:
TwinEEngine(OSystem *system, Common::Language language, uint32 flags);
TwinEEngine(OSystem *system, Common::Language language, uint32 flagsTwineGameType, TwineGameType gameType);
~TwinEEngine() override;
Common::Error run() override;
bool hasFeature(EngineFeature f) const override;
bool isLBA1() const { return _gameFlags & TwineGameType::GType_LBA;};
bool isLBA2() const { return _gameFlags & TwineGameType::GType_LBA2;};
bool isLBA1() const { return _gameType == TwineGameType::GType_LBA; };
bool isLBA2() const { return _gameType == TwineGameType::GType_LBA2; };
Actor *_actor;
Animations *_animations;