diff options
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/files.cpp | 14 | ||||
-rw-r--r-- | engines/access/inventory.cpp | 16 | ||||
-rw-r--r-- | engines/access/inventory.h | 4 |
3 files changed, 29 insertions, 5 deletions
diff --git a/engines/access/files.cpp b/engines/access/files.cpp index 5cf467077d..b1d6140e3e 100644 --- a/engines/access/files.cpp +++ b/engines/access/files.cpp @@ -111,7 +111,19 @@ void FileManager::loadScreen(Graphics::Surface *dest, int fileNum, int subfile) // Get the data for the screen, and copy it over byte *pSrc = handleFile(); - Common::copy(pSrc, pSrc + _filesize, (byte *)dest->getPixels()); + + if (dest != _vm->_screen) + dest->w = _vm->_screen->w; + + if (dest->w == dest->pitch) { + Common::copy(pSrc, pSrc + _filesize, (byte *)dest->getPixels()); + } else { + byte *pCurr = pSrc; + for (int y = 0; y < dest->h; ++y, pCurr += dest->w) { + byte *pDest = (byte *)dest->getBasePtr(0, y); + Common::copy(pCurr, pCurr + dest->w, pDest); + } + } delete[] pSrc; } diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp index 80336e4dcc..1bafdf56c3 100644 --- a/engines/access/inventory.cpp +++ b/engines/access/inventory.cpp @@ -90,8 +90,7 @@ int InventoryManager::newDisplayInv() { _vm->_timers.saveTimers(); if (room._tile && !_invRefreshFlag) { - _vm->_buffer1.copyTo(&_savedBuffer1); - screen.copyTo(&_savedScreen); + saveScreens(); } savedFields(); @@ -144,8 +143,7 @@ int InventoryManager::newDisplayInv() { } if (!room._tile && !_invRefreshFlag) { - _savedBuffer1.copyTo(&_vm->_buffer1); - _savedScreen.copyTo(_vm->_screen); + restoreScreens(); } else { screen.setBufferScan(); room.buildScreen(); @@ -310,5 +308,15 @@ int InventoryManager::coordIndexOf() { return -1; } +void InventoryManager::saveScreens() { + _vm->_buffer1.copyTo(&_savedBuffer1); + _vm->_screen->copyTo(&_savedScreen); +} + +void InventoryManager::restoreScreens() { + _vm->_buffer1.w = _vm->_buffer1.pitch; + _savedBuffer1.copyTo(&_vm->_buffer1); + _savedScreen.copyTo(_vm->_screen); +} } // End of namespace Access diff --git a/engines/access/inventory.h b/engines/access/inventory.h index cf8167d76c..255b6dce40 100644 --- a/engines/access/inventory.h +++ b/engines/access/inventory.h @@ -76,6 +76,10 @@ private: void freeInvCells(); int coordIndexOf(); + + void saveScreens(); + + void restoreScreens(); public: Common::Array<int> _inv; Common::StringArray _names; |