diff options
author | Paul Gilbert | 2011-03-19 14:20:15 +1100 |
---|---|---|
committer | Paul Gilbert | 2011-03-19 14:20:15 +1100 |
commit | 8246758e7eb8b43c13173f2ec1714a3ed622cb0c (patch) | |
tree | acf6710a0a4f1bc1f69118fc9759bcc879aae1a0 | |
parent | 9dad957454f2d4f7e8c7949e46d252346fbdd66b (diff) | |
download | scummvm-rg350-8246758e7eb8b43c13173f2ec1714a3ed622cb0c.tar.gz scummvm-rg350-8246758e7eb8b43c13173f2ec1714a3ed622cb0c.tar.bz2 scummvm-rg350-8246758e7eb8b43c13173f2ec1714a3ed622cb0c.zip |
TSAGE: Implement original engine scene scrolling optimisations
Wide screens are broken into 160x100 chunks. When scrolling, sections of the scene which have already been previously decoded for display can be reused, rather than re-decoding them from scratch
-rw-r--r-- | engines/tsage/scenes.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index fab5afff71..a1dfe0b2ce 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -360,19 +360,20 @@ void Scene::refreshBackground(int xAmount, int yAmount) { _enabledSections[xp * 16 + yp] = 0xffff; } else { // Check if the section is already loaded -// if (_enabledSections[xp * 16 + yp] || ((xAmount == 0) && (yAmount == 0))) { + if ((_enabledSections[xp * 16 + yp] == 0xffff) || ((xAmount == 0) && (yAmount == 0))) { + // Chunk isn't loaded, so load it in Graphics::Surface s = _backSurface.lockSurface(); GfxSurface::loadScreenSection(s, xp - xHalfOffset, yp - yHalfOffset, xp, yp); _backSurface.unlockSurface(); changedFlag = true; -/* } else { - int yv = _enabledSections[xp * 16 + yp] == ((xp - xHalfOffset) << 4) ? 0 : 1; - if (yv != (yp - yHalfOffset)) { + } else { + int yv = (_enabledSections[xp * 16 + yp] == ((xp - xHalfOffset) << 4)) ? 0 : 1; + if (yv | (yp - yHalfOffset)) { // Copy an existing 160x100 screen section previously loaded - int xSectionSrc = xp - xHalfOffset; - int ySectionSrc = yp - yHalfOffset; - int xSectionDest = _enabledSections[xp * 16 + yp] >> 4; - int ySectionDest = _enabledSections[xp * 16 + yp] & 0xffff; + int xSectionDest = xp - xHalfOffset; + int ySectionDest = yp - yHalfOffset; + int xSectionSrc = _enabledSections[xp * 16 + yp] >> 4; + int ySectionSrc = _enabledSections[xp * 16 + yp] & 0xf; Rect srcBounds(xSectionSrc * 160, ySectionSrc * 100, (xSectionSrc + 1) * 160, (ySectionSrc + 1) * 100); @@ -381,10 +382,10 @@ void Scene::refreshBackground(int xAmount, int yAmount) { _backSurface.copyFrom(_backSurface, srcBounds, destBounds); } - }*/ + } _enabledSections[xp * 16 + yp] = - ((xp - xHalfOffset) << 4) && (yp - yHalfOffset); + ((xp - xHalfOffset) << 4) | (yp - yHalfOffset); } } } |