diff options
-rw-r--r-- | scumm/resource_v7he.cpp | 4 | ||||
-rw-r--r-- | scumm/scumm.cpp | 11 | ||||
-rw-r--r-- | scumm/scumm.h | 1 |
3 files changed, 10 insertions, 6 deletions
diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp index b0f0f38613..5ec64c8e02 100644 --- a/scumm/resource_v7he.cpp +++ b/scumm/resource_v7he.cpp @@ -1682,7 +1682,7 @@ void ScummEngine_v99he::readMAXS(int blockSize) { _numImages = _fileHandle->readUint16LE(); _numSprites = _fileHandle->readUint16LE(); _numLocalScripts = _fileHandle->readUint16LE(); - _fileHandle->readUint16LE(); // heap related + _HEHeapSize = _fileHandle->readUint16LE(); // heap related _numPalettes = _fileHandle->readUint16LE(); _numUnk = _fileHandle->readUint16LE(); _numTalkies = _fileHandle->readUint16LE(); @@ -1713,7 +1713,7 @@ void ScummEngine_v90he::readMAXS(int blockSize) { _numImages = _fileHandle->readUint16LE(); _numSprites = _fileHandle->readUint16LE(); _numLocalScripts = _fileHandle->readUint16LE(); - _fileHandle->readUint16LE(); // heap releated + _HEHeapSize = _fileHandle->readUint16LE(); _numNewNames = 10; _objectRoomTable = (byte *)calloc(_numGlobalObjects, 1); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 2c0e38084f..73565c4087 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1418,12 +1418,15 @@ int ScummEngine::init(GameDetector &detector) { else res._maxHeapThreshold = gVars->memory[kMemScummOldCostGames]; #else - // Since the new costumes are very big, we increase the heap limit, to avoid having - // to constantly reload stuff from the data files. - if (_features & GF_NEW_COSTUMES) + if (_heversion >= 90 && _HEHeapSize) { + res._maxHeapThreshold = _HEHeapSize * 1024; + } else if (_features & GF_NEW_COSTUMES) { + // Since the new costumes are very big, we increase the heap limit, to avoid having + // to constantly reload stuff from the data files. res._maxHeapThreshold = 2500000; - else + } else { res._maxHeapThreshold = 550000; + } #endif res._minHeapThreshold = 400000; diff --git a/scumm/scumm.h b/scumm/scumm.h index 7c8bce7c0e..38abf37b16 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -502,6 +502,7 @@ protected: int _numNewNames, _numGlobalScripts; int _numRoomVariables; int _numPalettes, _numSprites, _numTalkies, _numUnk; + int _HEHeapSize; public: int _numLocalScripts, _numImages, _numRooms, _numScripts, _numSounds; // Used by HE games int _numCostumes; // FIXME - should be protected, used by Actor::remapActorPalette |