aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2005-04-03 22:10:10 +0000
committerMax Horn2005-04-03 22:10:10 +0000
commit1419f0d5ef32d8ae811b567616070cf916792320 (patch)
tree31e668a14cdf23dfb026e49003a67327ef9d6fec /scumm
parenteda317924ec0573d5c2a8407feaa8dafb6d4a9bc (diff)
downloadscummvm-rg350-1419f0d5ef32d8ae811b567616070cf916792320.tar.gz
scummvm-rg350-1419f0d5ef32d8ae811b567616070cf916792320.tar.bz2
scummvm-rg350-1419f0d5ef32d8ae811b567616070cf916792320.zip
Split readResTypeList into a normal and a GF_OLD_BUNDLE version; added comments to many of the GF_ feature flags; removed GF_DRAWOBJ_OTHER_ORDER (it was only use by Sam&Max, I switched that to a direct check for Sam&Max)
svn-id: r17362
Diffstat (limited to 'scumm')
-rw-r--r--scumm/intern.h1
-rw-r--r--scumm/object.cpp3
-rw-r--r--scumm/resource.cpp34
-rw-r--r--scumm/resource_v3.cpp30
-rw-r--r--scumm/scumm.cpp14
-rw-r--r--scumm/scumm.h39
6 files changed, 82 insertions, 39 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 944276c7ae..f27b314e35 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -215,6 +215,7 @@ public:
ScummEngine_v3old(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]);
protected:
+ void readResTypeList(int id, uint32 tag, const char *name);
void readIndexFile();
void initRoomSubBlocks();
void loadRoomObjects();
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 262a5c5793..9d7464ccac 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -400,7 +400,8 @@ void ScummEngine::drawRoomObjects(int arg) {
int i;
const int mask = (_version <= 2) ? 0x8 : 0xF;
- if (_features & GF_DRAWOBJ_OTHER_ORDER) {
+ if (_gameId == GID_SAMNMAX) {
+ // In Sam & Max, objects are drawn in reverse order.
for (i = 1; i < _numLocalObjects; i++)
if (_objs[i].obj_nr > 0)
drawRoomObject(i, arg);
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 3c54c6b95b..489f5636a3 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -34,8 +34,9 @@
namespace Scumm {
+extern const char *resTypeFromId(int id);
+
static uint16 newTag2Old(uint32 newTag);
-static const char *resTypeFromId(int id);
static const byte *findResourceSmall(uint32 tag, const byte *searchin);
@@ -520,37 +521,14 @@ void ScummEngine::readResTypeList(int id, uint32 tag, const char *name) {
if (_version == 8)
num = _fileHandle->readUint32LE();
- else if (!(_features & GF_OLD_BUNDLE))
- num = _fileHandle->readUint16LE();
else
- num = _fileHandle->readByte();
+ num = _fileHandle->readUint16LE();
- if (_features & GF_OLD_BUNDLE) {
- if (num >= 0xFF) {
- error("Too many %ss (%d) in directory", name, num);
- }
- } else {
- if (num != res.num[id]) {
- error("Invalid number of %ss (%d) in directory", name, num);
- }
+ if (num != res.num[id]) {
+ error("Invalid number of %ss (%d) in directory", name, num);
}
- if (_features & GF_OLD_BUNDLE) {
- if (id == rtRoom) {
- for (i = 0; i < num; i++)
- res.roomno[id][i] = i;
- _fileHandle->seek(num, SEEK_CUR);
- } else {
- for (i = 0; i < num; i++)
- res.roomno[id][i] = _fileHandle->readByte();
- }
- for (i = 0; i < num; i++) {
- res.roomoffs[id][i] = _fileHandle->readUint16LE();
- if (res.roomoffs[id][i] == 0xFFFF)
- res.roomoffs[id][i] = 0xFFFFFFFF;
- }
-
- } else if (_features & GF_SMALL_HEADER) {
+ if (_features & GF_SMALL_HEADER) {
for (i = 0; i < num; i++) {
res.roomno[id][i] = _fileHandle->readByte();
res.roomoffs[id][i] = _fileHandle->readUint32LE();
diff --git a/scumm/resource_v3.cpp b/scumm/resource_v3.cpp
index 31a1f7a4e7..7f19ac0352 100644
--- a/scumm/resource_v3.cpp
+++ b/scumm/resource_v3.cpp
@@ -26,6 +26,36 @@
namespace Scumm {
+extern const char *resTypeFromId(int id);
+
+
+void ScummEngine_v3old::readResTypeList(int id, uint32 tag, const char *name) {
+ int num;
+ int i;
+
+ debug(9, "readResTypeList(%s,%s,%s)", resTypeFromId(id), tag2str(TO_BE_32(tag)), name);
+
+ num = _fileHandle->readByte();
+
+ if (num >= 0xFF) {
+ error("Too many %ss (%d) in directory", name, num);
+ }
+
+ if (id == rtRoom) {
+ for (i = 0; i < num; i++)
+ res.roomno[id][i] = i;
+ _fileHandle->seek(num, SEEK_CUR);
+ } else {
+ for (i = 0; i < num; i++)
+ res.roomno[id][i] = _fileHandle->readByte();
+ }
+ for (i = 0; i < num; i++) {
+ res.roomoffs[id][i] = _fileHandle->readUint16LE();
+ if (res.roomoffs[id][i] == 0xFFFF)
+ res.roomoffs[id][i] = 0xFFFFFFFF;
+ }
+}
+
void ScummEngine_v3old::readIndexFile() {
int magic = 0;
debug(9, "readIndexFile()");
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index 6d19ea5a64..4ea428f87d 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -168,19 +168,19 @@ static const ScummGameSettings scumm_settings[] = {
GF_NEW_OPCODES | GF_USE_KEY, 0, 0},
{"samnmax", "Sam & Max", GID_SAMNMAX, 6, 0, 30, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, 0, 0},
+ GF_NEW_OPCODES | GF_USE_KEY, 0, 0},
{"samnmax-alt", "Sam & Max (alt)", GID_SAMNMAX, 6, 0, 30, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, "samnmax", "samnmax.sm0"},
+ GF_NEW_OPCODES | GF_USE_KEY, "samnmax", "samnmax.sm0"},
{"samnmaxMac", "Sam & Max (Mac)", GID_SAMNMAX, 6, 0, 30, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, "samnmax", "Sam & Max Data"},
+ GF_NEW_OPCODES | GF_USE_KEY, "samnmax", "Sam & Max Data"},
{"samdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 0, 30, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, 0, 0},
+ GF_NEW_OPCODES | GF_USE_KEY, 0, 0},
{"samdemoMac", "Sam & Max (Mac Demo)", GID_SAMNMAX, 6, 0, 30, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, "samdemo", "Sam & Max Demo Data"},
+ GF_NEW_OPCODES | GF_USE_KEY, "samdemo", "Sam & Max Demo Data"},
{"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 0, 30, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, 0, "snmdemo.sm0"},
+ GF_NEW_OPCODES | GF_USE_KEY, 0, "snmdemo.sm0"},
{"snmidemo", "Sam & Max (Interactive WIP Demo)", GID_SAMNMAX, 6, 0, 30, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, 0, 0},
+ GF_NEW_OPCODES | GF_USE_KEY, 0, 0},
// {"test", "Test demo game", GID_SAMNMAX, 6, 0, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE, GF_NEW_OPCODES, 0, 0},
diff --git a/scumm/scumm.h b/scumm/scumm.h
index cca3416350..65648c4e49 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -72,22 +72,55 @@ enum {
KEY_ALL_SKIP = 3457 // WinCE
};
-/** SCUMM feature flags. */
+/**
+ * SCUMM feature flags define for every game which specific set of engine
+ * features are used by that game.
+ * Note that some of them could be replaced by checks for the SCUMM version.
+ */
enum GameFeatures {
+ /** Games with the new stack based opcodes (ScummEngine_v6 and subclasses). */
GF_NEW_OPCODES = 1 << 0,
+
+ /** Games with the new camera system (ScummEngine_v7 and subclasses). */
GF_NEW_CAMERA = 1 << 1,
+
+ /** Games with the AKOS custome system (ScummEngine_v7 and subclasses, HE games). */
GF_NEW_COSTUMES = 1 << 2,
+
+ /** Games with digital IMUSE (ScummEngine_v7 and subclasses). */
GF_DIGI_IMUSE = 1 << 3,
+
+ /** Games using XOR encrypted data files. */
GF_USE_KEY = 1 << 4,
- GF_DRAWOBJ_OTHER_ORDER = 1 << 5,
+
+ /** Small header games (ScummEngine_v4 and subclasses). */
GF_SMALL_HEADER = 1 << 6,
+
+ /** Small name games (ScummEngine_v3 and subclasses). */
GF_SMALL_NAMES = 1 << 7,
+
+ /** Old bundle games (ScummEngine_v3old and subclasses). */
GF_OLD_BUNDLE = 1 << 8,
+
+ /** EGA games. */
GF_16COLOR = 1 << 9,
+
+ /** VGA versions of V3 games. */
GF_OLD256 = 1 << 10,
+
+ /** Games which have Audio CD tracks. */
GF_AUDIOTRACKS = 1 << 11,
+
+ /** Games without actor scaling (ScummEngine_v3 and subclasses). */
GF_NO_SCALING = 1 << 12,
+
+ /**
+ * Games using only very few local variables in scripts.
+ * Apparently that is only the case for 256 color version of Indy3.
+ */
GF_FEW_LOCALS = 1 << 13,
+
+ /** Games made by Humongous Entertainment. */
GF_HUMONGOUS = 1 << 14,
GF_MULTIPLE_VERSIONS = 1 << 15,
@@ -668,7 +701,7 @@ protected:
bool openResourceFile(const char *filename, byte encByte);
void loadPtrToResource(int type, int i, const byte *ptr);
- void readResTypeList(int id, uint32 tag, const char *name);
+ virtual void readResTypeList(int id, uint32 tag, const char *name);
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
byte *createResource(int type, int index, uint32 size);
int loadResource(int type, int i);