aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2011-03-19 14:20:15 +1100
committerstrangerke2011-03-21 08:07:12 +0100
commit2a374fb360903acdcd7a50c3321684ba93138b72 (patch)
tree1c561df1589312cee06b0359c163905c037c70a2
parent5e2eab6e4fff391022ef355a6df6050f7190bc0a (diff)
downloadscummvm-rg350-2a374fb360903acdcd7a50c3321684ba93138b72.tar.gz
scummvm-rg350-2a374fb360903acdcd7a50c3321684ba93138b72.tar.bz2
scummvm-rg350-2a374fb360903acdcd7a50c3321684ba93138b72.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.cpp21
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);
}
}
}