aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2014-04-27 21:15:46 +0300
committerFilippos Karapetis2014-04-27 21:20:02 +0300
commit16bbc100ddf15da2c321bf54cf1f66f580dcdc93 (patch)
tree7ef9f791deeadda342e01b731a824bb7443c0db8 /engines
parent4eba5032d817ea32e3f2f7be52826c2e40471852 (diff)
downloadscummvm-rg350-16bbc100ddf15da2c321bf54cf1f66f580dcdc93.tar.gz
scummvm-rg350-16bbc100ddf15da2c321bf54cf1f66f580dcdc93.tar.bz2
scummvm-rg350-16bbc100ddf15da2c321bf54cf1f66f580dcdc93.zip
MADS: Handle the missing sections in Phantom and Dragonsphere
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/resources.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp
index aef22d3734..b6caed7b0c 100644
--- a/engines/mads/resources.cpp
+++ b/engines/mads/resources.cpp
@@ -60,7 +60,7 @@ private:
/**
* Load the index of all the game's HAG files
*/
- void loadIndex();
+ void loadIndex(MADSEngine *vm);
/**
* Given a resource name, opens up the correct HAG file and returns whether
@@ -78,7 +78,7 @@ private:
*/
ResourceType getResourceType(const Common::String &resourceName) const;
public:
- HagArchive();
+ HagArchive(MADSEngine *vm);
virtual ~HagArchive();
// Archive implementation
@@ -90,8 +90,8 @@ public:
const char *const MADSCONCAT_STRING = "MADSCONCAT";
-HagArchive::HagArchive() {
- loadIndex();
+HagArchive::HagArchive(MADSEngine *vm) {
+ loadIndex(vm);
}
HagArchive::~HagArchive() {
@@ -146,13 +146,25 @@ Common::SeekableReadStream *HagArchive::createReadStreamForMember(const Common::
return nullptr;
}
-void HagArchive::loadIndex() {
+void HagArchive::loadIndex(MADSEngine *vm) {
Common::File hagFile;
for (int sectionIndex = -1; sectionIndex < 10; ++sectionIndex) {
if (sectionIndex == 0)
continue;
+ // Dragonsphere does not have some sections - skip them
+ if (vm->getGameID() == GType_Dragonsphere) {
+ if (sectionIndex == 7 || sectionIndex == 8)
+ continue;
+ }
+
+ // Phantom does not have some sections - skip them
+ if (vm->getGameID() == GType_Phantom) {
+ if (sectionIndex == 6 || sectionIndex == 7 || sectionIndex == 8)
+ continue;
+ }
+
Common::String filename = (sectionIndex == -1) ? "GLOBAL.HAG" :
Common::String::format("SECTION%d.HAG", sectionIndex);
if (!hagFile.open(filename))
@@ -275,7 +287,7 @@ ResourceType HagArchive::getResourceType(const Common::String &resourceName) con
/*------------------------------------------------------------------------*/
void Resources::init(MADSEngine *vm) {
- SearchMan.add("HAG", new HagArchive());
+ SearchMan.add("HAG", new HagArchive(vm));
}
Common::String Resources::formatName(RESPREFIX resType, int id, const Common::String &ext) {