aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-04-11 20:05:37 +0000
committerMax Horn2003-04-11 20:05:37 +0000
commit51b430b088ce805d14ed61f9e38a5e12ea8825e9 (patch)
tree67d47550330de048b9dada3cb51c5f3af7397857 /scumm
parentfd28237eb8ed92b08369db1f2d73f2216f01b029 (diff)
downloadscummvm-rg350-51b430b088ce805d14ed61f9e38a5e12ea8825e9.tar.gz
scummvm-rg350-51b430b088ce805d14ed61f9e38a5e12ea8825e9.tar.bz2
scummvm-rg350-51b430b088ce805d14ed61f9e38a5e12ea8825e9.zip
factored out some common code
svn-id: r6974
Diffstat (limited to 'scumm')
-rw-r--r--scumm/intern.h2
-rw-r--r--scumm/resource_v3.cpp43
2 files changed, 19 insertions, 26 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 4f9d704c87..6572844138 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -178,6 +178,8 @@ protected:
void readIndexFile();
void loadCharset(int no);
void readMAXS();
+
+ void readGlobalObjects();
};
class Scumm_v4 : public Scumm_v3 {
diff --git a/scumm/resource_v3.cpp b/scumm/resource_v3.cpp
index 5ab645c503..84ba140027 100644
--- a/scumm/resource_v3.cpp
+++ b/scumm/resource_v3.cpp
@@ -59,18 +59,7 @@ void Scumm_v3::readIndexFile() {
_palManipIntermediatePal = 0; // Will allocate when needed
_fileHandle.readUint16LE(); /* version magic number */
- int num = _fileHandle.readUint16LE();
- assert(num == _numGlobalObjects);
- for (int i = 0; i != num; i++) {
- uint32 bits = _fileHandle.readByte();
- byte tmp;
- bits |= _fileHandle.readByte() << 8;
- bits |= _fileHandle.readByte() << 16;
- _classData[i] = bits;
- tmp = _fileHandle.readByte();
- _objectOwnerTable[i] = tmp & OF_OWNER_MASK;
- _objectStateTable[i] = tmp >> OF_STATE_SHL;
- }
+ readGlobalObjects();
readResTypeList(rtRoom, MKID('ROOM'), "room");
readResTypeList(rtCostume, MKID('COST'), "costume");
readResTypeList(rtScript, MKID('SCRP'), "script");
@@ -81,7 +70,6 @@ void Scumm_v3::readIndexFile() {
uint16 blocktype;
uint32 itemsize;
int numblock = 0;
- int num, i;
debug(9, "readIndexFile()");
@@ -160,19 +148,7 @@ void Scumm_v3::readIndexFile() {
break;
case 0x4F30: // 'O0'
- num = _fileHandle.readUint16LE();
- assert(num == _numGlobalObjects);
- for (i = 0; i != num; i++) {
- uint32 bits = _fileHandle.readByte();
- byte tmp;
- bits |= _fileHandle.readByte() << 8;
- bits |= _fileHandle.readByte() << 16;
- _classData[i] = bits;
- tmp = _fileHandle.readByte();
- _objectOwnerTable[i] = tmp & OF_OWNER_MASK;
- _objectStateTable[i] = tmp >> OF_STATE_SHL;
- }
-
+ readGlobalObjects();
break;
default:
@@ -231,3 +207,18 @@ void Scumm_v3::readMAXS() {
_shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later
allocateArrays();
}
+
+void Scumm_v3::readGlobalObjects() {
+ int num = _fileHandle.readUint16LE();
+ assert(num == _numGlobalObjects);
+ for (int i = 0; i != num; i++) {
+ uint32 bits = _fileHandle.readByte();
+ byte tmp;
+ bits |= _fileHandle.readByte() << 8;
+ bits |= _fileHandle.readByte() << 16;
+ _classData[i] = bits;
+ tmp = _fileHandle.readByte();
+ _objectOwnerTable[i] = tmp & OF_OWNER_MASK;
+ _objectStateTable[i] = tmp >> OF_STATE_SHL;
+ }
+}