2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
2007-05-30 21:56:52 +00:00
|
|
|
* 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.
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
2006-02-11 12:44:16 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-05-01 09:07:31 +00:00
|
|
|
// Game detection, general game parameters
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 16:20:35 +00:00
|
|
|
#include "saga/saga.h"
|
2004-12-22 19:34:41 +00:00
|
|
|
|
2005-10-14 04:28:20 +00:00
|
|
|
#include "common/config-manager.h"
|
2006-10-02 22:21:57 +00:00
|
|
|
#include "common/advancedDetector.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2007-04-27 23:11:12 +00:00
|
|
|
#include "saga/displayinfo.h"
|
2005-07-19 19:05:52 +00:00
|
|
|
#include "saga/rscfile.h"
|
2004-08-06 01:39:17 +00:00
|
|
|
#include "saga/interface.h"
|
2004-08-11 23:42:02 +00:00
|
|
|
#include "saga/scene.h"
|
2006-05-13 10:30:38 +00:00
|
|
|
#include "saga/sagaresnames.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2006-03-09 14:33:07 +00:00
|
|
|
namespace Saga {
|
2007-01-21 20:24:38 +00:00
|
|
|
struct SAGAGameDescription {
|
|
|
|
Common::ADGameDescription desc;
|
|
|
|
|
|
|
|
int gameType;
|
|
|
|
int gameId;
|
|
|
|
uint32 features;
|
|
|
|
int startSceneNumber;
|
|
|
|
const GameResourceDescription *resourceDescription;
|
|
|
|
int fontsCount;
|
|
|
|
const GameFontDescription *fontDescriptions;
|
|
|
|
const GameSoundInfo *voiceInfo;
|
|
|
|
const GameSoundInfo *sfxInfo;
|
|
|
|
const GameSoundInfo *musicInfo;
|
|
|
|
int patchesCount;
|
|
|
|
const GamePatchDescription *patchDescriptions;
|
|
|
|
};
|
|
|
|
|
|
|
|
const bool SagaEngine::isBigEndian() const { return (_gameDescription->features & GF_BIG_ENDIAN_DATA) != 0; }
|
|
|
|
const bool SagaEngine::isMacResources() const { return (getPlatform() == Common::kPlatformMacintosh); }
|
|
|
|
const GameResourceDescription *SagaEngine::getResourceDescription() { return _gameDescription->resourceDescription; }
|
|
|
|
const GameSoundInfo *SagaEngine::getVoiceInfo() const { return _gameDescription->voiceInfo; }
|
|
|
|
const GameSoundInfo *SagaEngine::getSfxInfo() const { return _gameDescription->sfxInfo; }
|
|
|
|
const GameSoundInfo *SagaEngine::getMusicInfo() const { return _gameDescription->musicInfo; }
|
|
|
|
|
|
|
|
const GameFontDescription *SagaEngine::getFontDescription(int index) {
|
|
|
|
assert(index < _gameDescription->fontsCount);
|
|
|
|
return &_gameDescription->fontDescriptions[index];
|
|
|
|
}
|
|
|
|
int SagaEngine::getFontsCount() const { return _gameDescription->fontsCount; }
|
|
|
|
|
|
|
|
int SagaEngine::getGameId() const { return _gameDescription->gameId; }
|
|
|
|
int SagaEngine::getGameType() const { return _gameDescription->gameType; }
|
2007-07-13 16:37:37 +00:00
|
|
|
|
|
|
|
uint32 SagaEngine::getFeatures() const {
|
|
|
|
uint32 result = _gameDescription->features;
|
|
|
|
|
|
|
|
if (_gf_wyrmkeep)
|
|
|
|
result |= GF_WYRMKEEP;
|
|
|
|
|
|
|
|
if (_gf_compressed_sounds)
|
|
|
|
result |= GF_COMPRESSED_SOUNDS;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-01-21 20:24:38 +00:00
|
|
|
Common::Language SagaEngine::getLanguage() const { return _gameDescription->desc.language; }
|
|
|
|
Common::Platform SagaEngine::getPlatform() const { return _gameDescription->desc.platform; }
|
|
|
|
int SagaEngine::getGameNumber() const { return _gameNumber; }
|
|
|
|
int SagaEngine::getStartSceneNumber() const { return _gameDescription->startSceneNumber; }
|
|
|
|
|
|
|
|
int SagaEngine::getPatchesCount() const { return _gameDescription->patchesCount; }
|
|
|
|
const GamePatchDescription *SagaEngine::getPatchDescriptions() const { return _gameDescription->patchDescriptions; }
|
|
|
|
const Common::ADGameFileDescription *SagaEngine::getFilesDescriptions() const { return _gameDescription->desc.filesDescriptions; }
|
|
|
|
|
2006-03-09 14:33:07 +00:00
|
|
|
}
|
|
|
|
|
2007-01-24 23:13:00 +00:00
|
|
|
static const PlainGameDescriptor sagaGames[] = {
|
2007-01-29 23:25:51 +00:00
|
|
|
{"saga", "SAGA Engine game"},
|
2006-03-09 14:33:07 +00:00
|
|
|
{"ite", "Inherit the Earth: Quest for the Orb"},
|
|
|
|
{"ihnm", "I Have No Mouth and I Must Scream"},
|
|
|
|
{0, 0}
|
|
|
|
};
|
|
|
|
|
2007-01-29 23:25:51 +00:00
|
|
|
static const Common::ADObsoleteGameID obsoleteGameIDsTable[] = {
|
|
|
|
{"ite", "saga", Common::kPlatformUnknown},
|
|
|
|
{"ihnm", "saga", Common::kPlatformUnknown},
|
|
|
|
{0, 0, Common::kPlatformUnknown}
|
|
|
|
};
|
|
|
|
|
2007-04-27 22:39:31 +00:00
|
|
|
#include "saga/detection_tables.h"
|
2006-08-26 11:33:15 +00:00
|
|
|
|
2007-01-24 23:13:00 +00:00
|
|
|
static const Common::ADParams detectionParams = {
|
|
|
|
// Pointer to ADGameDescription or its superset structure
|
|
|
|
(const byte *)Saga::gameDescriptions,
|
|
|
|
// Size of that superset structure
|
|
|
|
sizeof(Saga::SAGAGameDescription),
|
|
|
|
// Number of bytes to compute MD5 sum for
|
|
|
|
5000,
|
|
|
|
// List of all engine targets
|
|
|
|
sagaGames,
|
|
|
|
// Structure for autoupgrading obsolete targets
|
2007-01-29 23:25:51 +00:00
|
|
|
obsoleteGameIDsTable,
|
2007-01-28 07:31:26 +00:00
|
|
|
// Name of single gameid (optional)
|
|
|
|
"saga",
|
2007-02-04 03:10:27 +00:00
|
|
|
// List of files for file-based fallback detection (optional)
|
|
|
|
0,
|
2007-02-13 23:37:44 +00:00
|
|
|
// Fallback callback
|
|
|
|
0,
|
2007-01-28 07:31:26 +00:00
|
|
|
// Flags
|
2007-02-13 13:17:46 +00:00
|
|
|
Common::kADFlagAugmentPreferredTarget
|
2007-01-24 23:13:00 +00:00
|
|
|
};
|
|
|
|
|
2007-02-13 14:55:11 +00:00
|
|
|
ADVANCED_DETECTOR_DEFINE_PLUGIN(SAGA, Saga::SagaEngine, detectionParams);
|
2006-03-09 14:33:07 +00:00
|
|
|
|
2006-07-31 13:41:21 +00:00
|
|
|
REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment");
|
2006-03-09 14:33:07 +00:00
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
namespace Saga {
|
2006-10-02 22:21:57 +00:00
|
|
|
|
2006-11-12 03:23:29 +00:00
|
|
|
bool SagaEngine::initGame() {
|
2007-06-12 12:22:25 +00:00
|
|
|
Common::EncapsulatedADGameDesc encapsulatedDesc = Common::AdvancedDetector::detectBestMatchingGame(detectionParams);
|
|
|
|
_gameDescription = (const SAGAGameDescription *)(encapsulatedDesc.realDesc);
|
|
|
|
|
2007-02-13 23:37:44 +00:00
|
|
|
if (_gameDescription == 0)
|
2007-01-25 21:16:57 +00:00
|
|
|
return false;
|
2007-01-24 23:13:00 +00:00
|
|
|
|
2007-04-27 23:11:12 +00:00
|
|
|
_displayClip.right = getDisplayInfo().logicalWidth;
|
|
|
|
_displayClip.bottom = getDisplayInfo().logicalHeight;
|
2006-12-19 13:50:34 +00:00
|
|
|
|
2007-07-13 16:37:37 +00:00
|
|
|
if (Common::File::exists("graphics/credit3n.dlt")) {
|
|
|
|
_gf_wyrmkeep = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If a compressed sound file is found in the game's directory, set the compressed flag to true
|
2007-08-01 14:19:55 +00:00
|
|
|
if (_gameDescription->gameType == GType_ITE) {
|
|
|
|
if (Common::File::exists("sounds.cmp") || Common::File::exists("soundsd.cmp") ||
|
|
|
|
Common::File::exists("voices.cmp") || Common::File::exists("voicesd.cmp") ||
|
|
|
|
Common::File::exists("inherit the earth voices.cmp")) {
|
|
|
|
_gf_compressed_sounds = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (Common::File::exists("voicess.cmp") || Common::File::exists("voices1.cmp") ||
|
|
|
|
Common::File::exists("voices2.cmp") || Common::File::exists("voices3.cmp") ||
|
|
|
|
Common::File::exists("voices4.cmp") || Common::File::exists("voices5.cmp") ||
|
|
|
|
Common::File::exists("voices6.cmp") || Common::File::exists("voicesd.cmp")) {
|
|
|
|
_gf_compressed_sounds = true;
|
|
|
|
}
|
|
|
|
}
|
2007-07-13 16:37:37 +00:00
|
|
|
|
2006-12-19 13:50:34 +00:00
|
|
|
return _resource->createContexts();
|
2006-11-12 03:23:29 +00:00
|
|
|
}
|
2006-10-02 22:21:57 +00:00
|
|
|
|
2007-04-27 23:11:12 +00:00
|
|
|
const GameDisplayInfo &SagaEngine::getDisplayInfo() {
|
|
|
|
return _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
int SagaEngine::getDisplayWidth() const {
|
|
|
|
const GameDisplayInfo &di = _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo;
|
|
|
|
return di.logicalWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
int SagaEngine::getDisplayHeight() const {
|
|
|
|
const GameDisplayInfo &di = _gameDescription->gameType == GType_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo;
|
|
|
|
return di.logicalHeight;
|
|
|
|
}
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
} // End of namespace Saga
|