aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-10-03 14:02:14 +0000
committerTravis Howell2006-10-03 14:02:14 +0000
commitab573e0c62c38c70eebcfa42f10321fbc7ab5e09 (patch)
tree52598750f0915e6f57ca5e091a098dbb26795703 /engines
parent1dc5670022ba328cdeb202838bf91ac73cd88432 (diff)
downloadscummvm-rg350-ab573e0c62c38c70eebcfa42f10321fbc7ab5e09.tar.gz
scummvm-rg350-ab573e0c62c38c70eebcfa42f10321fbc7ab5e09.tar.bz2
scummvm-rg350-ab573e0c62c38c70eebcfa42f10321fbc7ab5e09.zip
Cleanup
svn-id: r24099
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.cpp13
-rw-r--r--engines/agos/agos.h6
-rw-r--r--engines/agos/res.cpp84
3 files changed, 46 insertions, 57 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index d607a3bb4d..6d8ca880ba 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -1362,30 +1362,29 @@ TextLocation *AGOSEngine::getTextLocation(uint a) {
return NULL;
}
-void AGOSEngine::loadZone(uint vga_res) {
+void AGOSEngine::loadZone(uint zoneNum) {
VgaPointersEntry *vpe;
- uint32 size;
- CHECK_BOUNDS(vga_res, _vgaBufferPointers);
+ CHECK_BOUNDS(zoneNum, _vgaBufferPointers);
- vpe = _vgaBufferPointers + vga_res;
+ vpe = _vgaBufferPointers + zoneNum;
if (vpe->vgaFile1 != NULL)
return;
// Loading order is important
// due to resource managment
- loadVGAFile(vga_res * 2, 2, size);
+ loadVGAFile(zoneNum, 2);
vpe->vgaFile2 = _block;
vpe->vgaFile2End = _blockEnd;
- loadVGAFile(vga_res * 2, 1, size);
+ loadVGAFile(zoneNum, 1);
vpe->vgaFile1 = _block;
vpe->vgaFile1End = _blockEnd;
vpe->sfxFile = NULL;
if (!(getFeatures() & GF_ZLIBCOMP)) {
- loadVGAFile(vga_res * 2, 3, size);
+ loadVGAFile(zoneNum, 3);
vpe->sfxFile = _block;
vpe->sfxFileEnd = _blockEnd;
}
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index c4ee2312c8..8e9c5e785d 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -728,7 +728,7 @@ protected:
void set_video_mode_internal(uint16 mode, uint16 vga_res_id);
- void loadZone(uint vga_res);
+ void loadZone(uint zoneNum);
void loadSprite(uint windowNum, uint vga_res, uint vga_sprite_id, uint x, uint y, uint palette);
void playSpeech(uint speech_id, uint vga_sprite_id);
@@ -1136,8 +1136,8 @@ protected:
byte *getBackGround();
byte *getScaleBuf();
- byte *loadVGAFile(uint id, uint type, uint32 &dstSize);
- void loadSimonVGAFile(uint vga_id);
+ void loadVGAFile(uint id, uint type);
+ void loadSimonVGAFile(uint id);
int init();
int go();
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 7e1655e985..a0dfa8d86b 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -554,24 +554,24 @@ static bool decrunchFile(byte *src, byte *dst, uint32 size) {
#undef SD_TYPE_LITERAL
#undef SD_TYPE_MATCH
-void AGOSEngine::loadSimonVGAFile(uint vga_id) {
+void AGOSEngine::loadSimonVGAFile(uint id) {
uint32 offs, size;
if (getFeatures() & GF_OLD_BUNDLE) {
File in;
char filename[15];
- if (vga_id == 23)
- vga_id = 112;
- if (vga_id == 328)
- vga_id = 119;
+ if (id == 23)
+ id = 112;
+ else if (id == 328)
+ id = 119;
if (getPlatform() == Common::kPlatformAmiga) {
if (getFeatures() & GF_TALKIE)
- sprintf(filename, "0%d.out", vga_id);
+ sprintf(filename, "0%d.out", id);
else
- sprintf(filename, "0%d.pkd", vga_id);
+ sprintf(filename, "0%d.pkd", id);
} else {
- sprintf(filename, "0%d.VGA", vga_id);
+ sprintf(filename, "0%d.VGA", id);
}
in.open(filename);
@@ -591,18 +591,18 @@ void AGOSEngine::loadSimonVGAFile(uint vga_id) {
}
in.close();
} else {
- offs = _gameOffsetsPtr[vga_id];
+ offs = _gameOffsetsPtr[id];
- size = _gameOffsetsPtr[vga_id + 1] - offs;
+ size = _gameOffsetsPtr[id + 1] - offs;
readGameFile(_vgaBufferPointers[11].vgaFile2, offs, size);
}
}
-byte *AGOSEngine::loadVGAFile(uint id, uint type, uint32 &dstSize) {
+void AGOSEngine::loadVGAFile(uint id, uint type) {
File in;
char filename[15];
byte *dst = NULL;
- uint32 file, offs, srcSize;
+ uint32 file, offs, srcSize, dstSize;
uint extraBuffer = 0;
if (getGameType() == GType_PP) {
@@ -618,11 +618,7 @@ byte *AGOSEngine::loadVGAFile(uint id, uint type, uint32 &dstSize) {
}
if (getFeatures() & GF_ZLIBCOMP) {
- if (getPlatform() == Common::kPlatformAmiga) {
- loadOffsets((const char*)"gfxindex.dat", id / 2 * 3 + type, file, offs, srcSize, dstSize);
- } else {
- loadOffsets((const char*)"graphics.vga", id / 2 * 3 + type, file, offs, srcSize, dstSize);
- }
+ loadOffsets(getFileName(GAME_GFXIDXFILE), id * 3 + type, file, offs, srcSize, dstSize);
if (getPlatform() == Common::kPlatformAmiga)
sprintf(filename, "GFX%d.VGA", file);
@@ -634,52 +630,46 @@ byte *AGOSEngine::loadVGAFile(uint id, uint type, uint32 &dstSize) {
} else if (getFeatures() & GF_OLD_BUNDLE) {
if (getPlatform() == Common::kPlatformAmiga) {
if (getFeatures() & GF_TALKIE)
- sprintf(filename, "%.3d%d.out", id / 2, type);
+ sprintf(filename, "%.3d%d.out", id, type);
else
- sprintf(filename, "%.3d%d.pkd", id / 2, type);
+ sprintf(filename, "%.3d%d.pkd", id, type);
} else {
if (getGameType() == GType_ELVIRA || getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
- sprintf(filename, "%.2d%d.VGA", id / 2, type);
+ sprintf(filename, "%.2d%d.VGA", id, type);
} else {
- sprintf(filename, "%.3d%d.VGA", id / 2, type);
+ sprintf(filename, "%.3d%d.VGA", id, type);
}
}
in.open(filename);
- if (in.isOpen() == false) {
- if (type == 3)
- return NULL;
- else
- error("loadVGAFile: Can't load %s", filename);
- }
-
- dstSize = srcSize = in.size();
- if (getFeatures() & GF_CRUNCHED) {
- byte *srcBuffer = (byte *)malloc(srcSize);
- if (in.read(srcBuffer, srcSize) != srcSize)
- error("loadVGAFile: Read failed");
-
- dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4);
- dst = allocBlock (dstSize + extraBuffer);
- decrunchFile(srcBuffer, dst, srcSize);
- free(srcBuffer);
- } else {
- dst = allocBlock(dstSize + extraBuffer);
- if (in.read(dst, dstSize) != dstSize)
- error("loadVGAFile: Read failed");
+ if (in.isOpen() == true) {
+ dstSize = srcSize = in.size();
+ if (getFeatures() & GF_CRUNCHED) {
+ byte *srcBuffer = (byte *)malloc(srcSize);
+ if (in.read(srcBuffer, srcSize) != srcSize)
+ error("loadVGAFile: Read failed");
+
+ dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4);
+ dst = allocBlock (dstSize + extraBuffer);
+ decrunchFile(srcBuffer, dst, srcSize);
+ free(srcBuffer);
+ } else {
+ dst = allocBlock(dstSize + extraBuffer);
+ if (in.read(dst, dstSize) != dstSize)
+ error("loadVGAFile: Read failed");
+ }
+ in.close();
+ } else if (type != 3) {
+ error("loadVGAFile: Can't load %s", filename);
}
- in.close();
} else {
- id += (type - 1);
+ id = id * 2 + (type - 1);
offs = _gameOffsetsPtr[id];
dstSize = _gameOffsetsPtr[id + 1] - offs;
dst = allocBlock(dstSize + extraBuffer);
readGameFile(dst, offs, dstSize);
}
-
- dstSize += extraBuffer;
- return dst;
}
static const char *dimpSoundList[32] = {