aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorJussi Pitkanen2011-06-14 13:30:51 +0300
committerEugene Sandulenko2011-08-13 23:26:56 +0100
commitd273f58b3c3fcc22dee3c2761f397cdb6974eab7 (patch)
tree7d063164c4644f4017fda1a9147a8a54a525e28b /engines/agi
parent41dccce00cdd3c5e3692b2e8eb22de1ef0b9c1e1 (diff)
downloadscummvm-rg350-d273f58b3c3fcc22dee3c2761f397cdb6974eab7.tar.gz
scummvm-rg350-d273f58b3c3fcc22dee3c2761f397cdb6974eab7.tar.bz2
scummvm-rg350-d273f58b3c3fcc22dee3c2761f397cdb6974eab7.zip
AGI: AgiLoader_v1: Precalculate final resource offsets
That is, calculate the final offsets when loading the resource directories, and when loading the resource simply seek into the disk image file.
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/loader_v1.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/engines/agi/loader_v1.cpp b/engines/agi/loader_v1.cpp
index ed667f9b98..6a7ab6c61f 100644
--- a/engines/agi/loader_v1.cpp
+++ b/engines/agi/loader_v1.cpp
@@ -82,7 +82,7 @@ int AgiLoader_v1::loadDir(AgiDir *agid, int offset, int num) {
int sec = (BASE_SECTOR + (((b0 & 0xF) << 8) | b1)) >> 1;
int off = ((b1 & 0x1) << 8) | b2;
agid[i].volume = 0;
- agid[i].offset = (sec << 16) | off;
+ agid[i].offset = SECTOR_OFFSET(sec) + off;
}
}
@@ -117,11 +117,8 @@ uint8 *AgiLoader_v1::loadVolRes(struct AgiDir *agid) {
if (agid->offset == _EMPTY)
return NULL;
- int sec = agid->offset >> 16;
- int off = agid->offset & 0xFFFF;
-
fp.open(_filenameDisk0);
- fp.seek(SECTOR_OFFSET(sec) + off, SEEK_SET);
+ fp.seek(agid->offset, SEEK_SET);
int signature = fp.readUint16BE();
if (signature != 0x1234) {