aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Frühwirth2018-05-07 16:24:35 +0200
committerAdrian Frühwirth2018-05-07 19:54:45 +0200
commit9ea943a81e73a18cce8ced74cf20303d0766a22d (patch)
tree57ef0f664e72f4e1f76c138fdeedb8bd18df0324
parent019eca0ae8fbc0ea39f5b36b9b68126ef9aa9227 (diff)
downloadscummvm-rg350-9ea943a81e73a18cce8ced74cf20303d0766a22d.tar.gz
scummvm-rg350-9ea943a81e73a18cce8ced74cf20303d0766a22d.tar.bz2
scummvm-rg350-9ea943a81e73a18cce8ced74cf20303d0766a22d.zip
DS: Use CLIP in VBlankHandler()
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index c6d7d62f22..041892aed6 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -2165,19 +2165,11 @@ void VBlankHandler(void) {
}
- subScTargetX = xCenter - ((subScreenWidth >> 1) << 8);
+ subScTargetX = xCenter - ((subScreenWidth >> 1) << 8);
subScTargetY = yCenter - ((subScreenHeight >> 1) << 8);
-
-
-
- if (subScTargetX < 0) subScTargetX = 0;
- if (subScTargetX > (gameWidth - subScreenWidth) << 8) subScTargetX = (gameWidth - subScreenWidth) << 8;
-
- if (subScTargetY < 0) subScTargetY = 0;
- if (subScTargetY > (gameHeight - subScreenHeight) << 8) subScTargetY = (gameHeight - subScreenHeight) << 8;
-
-
+ subScTargetX = CLIP(subScTargetX, 0, (gameWidth - subScreenWidth) << 8);
+ subScTargetY = CLIP(subScTargetY, 0, (gameHeight - subScreenHeight) << 8);
subScX += (subScTargetX - subScX) >> 2;
subScY += (subScTargetY - subScY) >> 2;