ACCESS: Fix loading of inventory screen background

This commit is contained in:
Paul Gilbert 2014-08-24 14:42:26 -04:00
parent 6774dd4246
commit e53417f91a
3 changed files with 29 additions and 5 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -76,6 +76,10 @@ private:
void freeInvCells();
int coordIndexOf();
void saveScreens();
void restoreScreens();
public:
Common::Array<int> _inv;
Common::StringArray _names;