aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/scicore
diff options
context:
space:
mode:
authorFilippos Karapetis2009-03-30 07:53:32 +0000
committerFilippos Karapetis2009-03-30 07:53:32 +0000
commite130aecc4f2650d86a41ee4d963b66e5421226bb (patch)
tree60b3a461c58166145fe5ec262a15c1cf94271d78 /engines/sci/scicore
parent30473e313d8e4513a11dd29ea353db297d5223b4 (diff)
downloadscummvm-rg350-e130aecc4f2650d86a41ee4d963b66e5421226bb.tar.gz
scummvm-rg350-e130aecc4f2650d86a41ee4d963b66e5421226bb.tar.bz2
scummvm-rg350-e130aecc4f2650d86a41ee4d963b66e5421226bb.zip
Wrapped all the still WIP SCI32-specific code around appropriate ifdef blocks. SCI32 has fundamental differences from previous SCI versions (e.g. direct point addressing is no longer possible), most of SCI32 games use SVGA resolutions and currently a lot of SCI32 specific code is missing (like, for example, the newer string and array handling functions, the widget system etc). This has been done in the same manner as in the SCUMM and SAGA engines.
svn-id: r39750
Diffstat (limited to 'engines/sci/scicore')
-rw-r--r--engines/sci/scicore/decompressor.cpp4
-rw-r--r--engines/sci/scicore/decompressor.h4
-rw-r--r--engines/sci/scicore/resource.cpp23
-rw-r--r--engines/sci/scicore/resource.h2
-rw-r--r--engines/sci/scicore/vocab_debug.cpp3
5 files changed, 33 insertions, 3 deletions
diff --git a/engines/sci/scicore/decompressor.cpp b/engines/sci/scicore/decompressor.cpp
index 06eeb8fe89..6d6921c505 100644
--- a/engines/sci/scicore/decompressor.cpp
+++ b/engines/sci/scicore/decompressor.cpp
@@ -705,6 +705,8 @@ int DecompressorDCL::unpackDCL(byte* dest) {
return _dwWrote == _szUnpacked ? 0 : SCI_ERROR_DECOMPRESSION_INSANE;
}
+#ifdef ENABLE_SCI32
+
//----------------------------------------------
// STACpack/LZS decompressor for SCI32
// Based on Andre Beck's code from http://micky.ibh.de/~beck/stuff/lzs4i4l/
@@ -779,4 +781,6 @@ void DecompressorLZS::copyComp(int offs, int clen) {
putByte(_dest[hpos++]);
}
+#endif // #ifdef ENABLE_SCI32
+
} // End of namespace Sci
diff --git a/engines/sci/scicore/decompressor.h b/engines/sci/scicore/decompressor.h
index bdbfd3c823..9a566aa845 100644
--- a/engines/sci/scicore/decompressor.h
+++ b/engines/sci/scicore/decompressor.h
@@ -38,7 +38,9 @@ enum ResourceCompression {
kCompLZW1View, // Comp3 + view Post-processing
kCompLZW1Pic, // Comp3 + pic Post-processing
kCompDCL,
+#ifdef ENABLE_SCI32
kCompSTACpack // ? Used in SCI32
+#endif
};
//----------------------------------------------
// Base class for decompressors
@@ -179,6 +181,7 @@ protected:
int huffman_lookup(int *tree);
};
+#ifdef ENABLE_SCI32
//----------------------------------------------
// STACpack decompressor for SCI32
//----------------------------------------------
@@ -190,6 +193,7 @@ protected:
uint16 getCompLen();
void copyComp(int offs, int clen);
};
+#endif
} // End of namespace Sci
diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp
index e0f3b8c8de..392ea3b560 100644
--- a/engines/sci/scicore/resource.cpp
+++ b/engines/sci/scicore/resource.cpp
@@ -487,9 +487,11 @@ ResourceManager::ResourceManager(int version, int maxMemory) {
case SCI_VERSION_1_1:
debug("Resmgr: Detected SCI1.1");
break;
+#ifdef ENABLE_SCI32
case SCI_VERSION_32:
debug("Resmgr: Couldn't determine SCI version");
break;
+#endif
default:
debug("Resmgr: Couldn't determine SCI version");
break;
@@ -692,11 +694,14 @@ int ResourceManager::detectMapVersion() {
}
return SCI_VERSION_1;
}
+
+#ifdef ENABLE_SCI32
// late SCI1.1 and SCI32 maps have last directory entry set to 0xFF
// offset set to filesize and 4 more bytes
file.seek(off - 7, SEEK_SET);
if (file.readByte() == 0xFF && file.readUint16LE() == file.size())
return SCI_VERSION_32; // TODO : check if there is a difference between these maps
+#endif
return SCI_VERSION_AUTODETECT;
}
@@ -786,6 +791,8 @@ int ResourceManager::detectVolVersion() {
}
if (!bFailed)
return SCI_VERSION_1_1;
+
+#ifdef ENABLE_SCI32
//
// Check for SCI32 v2 format (Gabriel Knight 1 CD)
bFailed = false;
@@ -809,6 +816,7 @@ int ResourceManager::detectVolVersion() {
}
if (!bFailed)
return SCI_VERSION_32;
+#endif
// Failed to detect volume version
return SCI_VERSION_AUTODETECT;
@@ -1003,10 +1011,13 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
res->number = number;
res->id = resId;//res->number | (res->type << 16);
res->source = _mapVersion < SCI_VERSION_1_1 ? getVolume(map, off >> 28) : getVolume(map, 0);
- if (_mapVersion < SCI_VERSION_32)
- res->file_offset = _mapVersion < SCI_VERSION_1_1 ? off & 0x0FFFFFFF : off << 1;
- else
+#ifdef ENABLE_SCI32
+ if (_mapVersion >= SCI_VERSION_32)
res->file_offset = off; // in SCI32 it's a plain offset
+ else
+#endif
+ res->file_offset = _mapVersion < SCI_VERSION_1_1 ? off & 0x0FFFFFFF : off << 1;
+
}
}
}
@@ -1046,6 +1057,7 @@ int ResourceManager::readResourceInfo(Resource *res, Common::File *file,
szUnpacked = file->readUint16LE();
wCompression = file->readUint16LE();
break;
+#ifdef ENABLE_SCI32
case SCI_VERSION_32:
type = (ResourceType)(file->readByte() &0x7F);
number = file->readUint16LE();
@@ -1053,6 +1065,7 @@ int ResourceManager::readResourceInfo(Resource *res, Common::File *file,
szUnpacked = file->readUint32LE();
wCompression = file->readUint16LE();
break;
+#endif
default:
return SCI_ERROR_INVALID_RESMAP_ENTRY;
}
@@ -1085,9 +1098,11 @@ int ResourceManager::readResourceInfo(Resource *res, Common::File *file,
case 20:
compression = kCompDCL;
break;
+#ifdef ENABLE_SCI32
case 32:
compression = kCompSTACpack;
break;
+#endif
default:
compression = kCompUnknown;
}
@@ -1122,9 +1137,11 @@ int ResourceManager::decompress(Resource *res, Common::File *file) {
case kCompDCL:
dec = new DecompressorDCL;
break;
+#ifdef ENABLE_SCI32
case kCompSTACpack:
dec = new DecompressorLZS;
break;
+#endif
default:
warning("Resource %s #%d: Compression method %d not supported",
getResourceTypeName(res->type), res->number, compression);
diff --git a/engines/sci/scicore/resource.h b/engines/sci/scicore/resource.h
index 29cf38e265..75ad99f5b9 100644
--- a/engines/sci/scicore/resource.h
+++ b/engines/sci/scicore/resource.h
@@ -79,7 +79,9 @@ enum ResourceStatus {
#define SCI_VERSION_1_EARLY 5
#define SCI_VERSION_1_LATE 6
#define SCI_VERSION_1_1 7
+#ifdef ENABLE_SCI32
#define SCI_VERSION_32 8
+#endif
#define SCI_VERSION_LAST SCI_VERSION_1_LATE /* The last supported SCI version */
#define SCI_VERSION_1 SCI_VERSION_1_EARLY
diff --git a/engines/sci/scicore/vocab_debug.cpp b/engines/sci/scicore/vocab_debug.cpp
index 189024770d..deb2c2b2cf 100644
--- a/engines/sci/scicore/vocab_debug.cpp
+++ b/engines/sci/scicore/vocab_debug.cpp
@@ -569,8 +569,11 @@ char **vocabulary_get_knames(ResourceManager *resmgr, int *count) {
case SCI_VERSION_1_LATE:
return vocabulary_get_knames1(resmgr, count);
case SCI_VERSION_1_1:
+ return vocabulary_get_knames11(resmgr, count);
+#ifdef ENABLE_SCI32
case SCI_VERSION_32:
return vocabulary_get_knames11(resmgr, count);
+#endif
default:
return 0;
}