From d273f58b3c3fcc22dee3c2761f397cdb6974eab7 Mon Sep 17 00:00:00 2001 From: Jussi Pitkanen Date: Tue, 14 Jun 2011 13:30:51 +0300 Subject: 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. --- engines/agi/loader_v1.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'engines/agi') 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) { -- cgit v1.2.3