From 9ea943a81e73a18cce8ced74cf20303d0766a22d Mon Sep 17 00:00:00 2001 From: Adrian Frühwirth Date: Mon, 7 May 2018 16:24:35 +0200 Subject: DS: Use CLIP in VBlankHandler() --- backends/platform/ds/arm9/source/dsmain.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'backends') 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; -- cgit v1.2.3