diff options
-rw-r--r-- | engines/agos/agos.cpp | 10 | ||||
-rw-r--r-- | engines/agos/agos.h | 1 | ||||
-rw-r--r-- | engines/agos/debug.cpp | 26 | ||||
-rw-r--r-- | engines/agos/feeble.cpp | 1 |
4 files changed, 25 insertions, 13 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 465b6e0786..73a37e42ef 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -165,6 +165,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) _numMusic = 0; _numSFX = 0; _numSpeech = 0; + _numZone = 0; _numBitArray1 = 0; _numBitArray2 = 0; @@ -732,6 +733,8 @@ void AGOSEngine_PuzzlePack::setupGame() { _numTextBoxes = 40; _numVars = 2048; + _numZone = 450; + AGOSEngine::setupGame(); } #endif @@ -766,6 +769,7 @@ void AGOSEngine_Simon2::setupGame() { _numMusic = 93; _numSFX = 222; _numSpeech = 11997; + _numZone = 140; AGOSEngine::setupGame(); } @@ -792,6 +796,7 @@ void AGOSEngine_Simon1::setupGame() { _numMusic = 34; _numSFX = 127; _numSpeech = 3623; + _numZone = 164; AGOSEngine::setupGame(); } @@ -812,6 +817,7 @@ void AGOSEngine_Waxworks::setupGame() { _numVars = 255; _numMusic = 26; + _numZone = 155; AGOSEngine::setupGame(); } @@ -831,6 +837,7 @@ void AGOSEngine_Elvira2::setupGame() { _numVars = 255; _numMusic = 9; + _numZone = 99; AGOSEngine::setupGame(); } @@ -847,6 +854,7 @@ void AGOSEngine_Elvira1::setupGame() { _numVars = 512; _numMusic = 14; + _numZone = 74; AGOSEngine::setupGame(); } @@ -860,6 +868,8 @@ void AGOSEngine_PN::setupGame() { _vgaPeriod = 50; _numVars = 256; + _numZone = 26; + AGOSEngine::setupGame(); } diff --git a/engines/agos/agos.h b/engines/agos/agos.h index ec979abc20..cf75842cdd 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -257,6 +257,7 @@ protected: uint8 _numMusic, _numSFX; uint16 _numSpeech; + uint16 _numZone; uint8 _numBitArray1, _numBitArray2, _numBitArray3, _numItemStore; uint16 _numVars; diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp index 18c4736031..841ac6bb1a 100644 --- a/engines/agos/debug.cpp +++ b/engines/agos/debug.cpp @@ -297,20 +297,18 @@ void AGOSEngine::dumpVgaScriptAlways(const byte *ptr, uint16 res, uint16 id) { } void AGOSEngine::dumpAllVgaImageFiles() { - uint8 start = (getGameType() == GType_PN) ? 0 : 2; - uint16 end = (getGameType() == GType_PN) ? 26 : 450; + const uint8 start = (getGameType() == GType_PN) ? 0 : 2; - for (int z = start; z < end; z++) { + for (int z = start; z < _numZone; z++) { loadZone(z, false); dumpVgaBitmaps(z); } } void AGOSEngine::dumpAllVgaScriptFiles() { - uint8 start = (getGameType() == GType_PN) ? 0 : 2; - uint16 end = (getGameType() == GType_PN) ? 26 : 450; + const uint8 start = (getGameType() == GType_PN) ? 0 : 2; - for (int z = start; z < end; z++) { + for (int z = start; z < _numZone; z++) { uint16 zoneNum = (getGameType() == GType_PN) ? 0 : z; loadZone(z, false); @@ -516,7 +514,7 @@ void AGOSEngine::dumpBitmap(const char *filename, const byte *offs, uint16 w, ui dst += w; src += w; } - } else if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && w == 320 && (h == 134 || h == 200)) { + } else if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && w == 320 && (h == 134 || h == 135 || h == 200)) { for (j = 0; j != h; j++) { uint16 count = w / 8; @@ -620,7 +618,7 @@ void AGOSEngine::palLoad(byte *pal, const byte *vga1, int a, int b) { void AGOSEngine::dumpVgaBitmaps(uint16 zoneNum) { uint16 width, height, flags; - uint32 offs, curOffs = 0; + uint32 offs, offsEnd; const byte *p2; byte pal[768]; @@ -636,7 +634,11 @@ void AGOSEngine::dumpVgaBitmaps(uint16 zoneNum) { memset(pal, 0, sizeof(pal)); palLoad(pal, vga1, 0, 0); - for (int i = 1; ; i++) { + offsEnd = readUint32Wrapper(vga2 + 8); + for (uint i = 1; ; i++) { + if ((i * 8) >= offsEnd) + break; + p2 = vga2 + i * 8; offs = readUint32Wrapper(p2); @@ -650,10 +652,8 @@ void AGOSEngine::dumpVgaBitmaps(uint16 zoneNum) { } debug(1, "Zone %d: Image %d. Offs= %d Width=%d, Height=%d, Flags=0x%X", zoneNum, i, offs, width, height, flags); - if (offs < curOffs || offs >= imageBlockSize || width == 0 || height == 0) - return; - - curOffs = offs; + if (offs >= imageBlockSize || width == 0 || height == 0) + break; /* dump bitmap */ char buf[40]; diff --git a/engines/agos/feeble.cpp b/engines/agos/feeble.cpp index e9a91e3b76..4608969667 100644 --- a/engines/agos/feeble.cpp +++ b/engines/agos/feeble.cpp @@ -69,6 +69,7 @@ void AGOSEngine_Feeble::setupGame() { _numVars = 255; _numSpeech = 10000; + _numZone = 450; AGOSEngine::setupGame(); } |