shithub: cstory

Download patch

ref: 07935c2e2063393a226a64e52fea2a2826565f53
parent: 2165a4ebb1bb3333c5632f8d9740d7fc633d2832
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Mar 7 13:59:23 EST 2019

Added fix for the camera during the credits

Fixes the flying-Balrog scene (and also the Flying Dragon one?)

--- a/src/Frame.cpp
+++ b/src/Frame.cpp
@@ -17,35 +17,57 @@
 	GetMapData(0, &map_w, &map_l);
 
 #if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240	// TODO - Really need to make this a compiler flag
-	// Widescreen/tallscreen-safe behaviour
-	if (map_w * 0x10 < WINDOW_WIDTH)
+	if (g_GameFlags & 8)
 	{
-		gFrame.x = -((WINDOW_WIDTH - map_w * 0x10) * 0x200 / 2);
-	}
-	else
-	{
-		gFrame.x += (*gFrame.tgt_x - (WINDOW_WIDTH * 0x100) - gFrame.x) / gFrame.wait;
+		// Use the original camera boundaries during the credits
+		gFrame.x += (*gFrame.tgt_x - (320 * 0x100) - gFrame.x) / gFrame.wait;
+		gFrame.y += (*gFrame.tgt_y - (240 * 0x100) - gFrame.y) / gFrame.wait;
 
 		if (gFrame.x / 0x200 < 0)
 			gFrame.x = 0;
+		if (gFrame.y / 0x200 < 0)
+			gFrame.y = 0;
 
-		if (gFrame.x > ((map_w - 1) * 0x10 - WINDOW_WIDTH) * 0x200)
-			gFrame.x = ((map_w - 1) * 0x10 - WINDOW_WIDTH) * 0x200;
-	}
+		if (gFrame.x > ((map_w - 1) * 0x10 - 320) * 0x200)
+			gFrame.x = ((map_w - 1) * 0x10 - 320) * 0x200;
+		if (gFrame.y > ((map_l - 1) * 0x10 - 240) * 0x200)
+			gFrame.y = ((map_l - 1) * 0x10 - 240) * 0x200;
 
-	if (map_l * 0x10 < WINDOW_HEIGHT)
-	{
-		gFrame.y = -((WINDOW_HEIGHT - map_l * 0x10) * 0x200 / 2);
+		gFrame.x -= ((WINDOW_WIDTH - 320) / 2) * 0x200;
+		gFrame.y -= ((WINDOW_HEIGHT - 240) / 2) * 0x200;
 	}
 	else
 	{
-		gFrame.y += (*gFrame.tgt_y - (WINDOW_HEIGHT * 0x100) - gFrame.y) / gFrame.wait;
+		// Widescreen/tallscreen-safe behaviour
+		if (map_w * 0x10 < WINDOW_WIDTH)
+		{
+			gFrame.x = -((WINDOW_WIDTH - map_w * 0x10) * 0x200 / 2);
+		}
+		else
+		{
+			gFrame.x += (*gFrame.tgt_x - (WINDOW_WIDTH * 0x100) - gFrame.x) / gFrame.wait;
 
-		if (gFrame.y / 0x200 < 0)
-			gFrame.y = 0;
+			if (gFrame.x / 0x200 < 0)
+				gFrame.x = 0;
 
-		if (gFrame.y > ((map_l - 1) * 0x10 - WINDOW_HEIGHT) * 0x200)
-			gFrame.y = ((map_l - 1) * 0x10 - WINDOW_HEIGHT) * 0x200;
+			if (gFrame.x > ((map_w - 1) * 0x10 - WINDOW_WIDTH) * 0x200)
+				gFrame.x = ((map_w - 1) * 0x10 - WINDOW_WIDTH) * 0x200;
+		}
+
+		if (map_l * 0x10 < WINDOW_HEIGHT)
+		{
+			gFrame.y = -((WINDOW_HEIGHT - map_l * 0x10) * 0x200 / 2);
+		}
+		else
+		{
+			gFrame.y += (*gFrame.tgt_y - (WINDOW_HEIGHT * 0x100) - gFrame.y) / gFrame.wait;
+
+			if (gFrame.y / 0x200 < 0)
+				gFrame.y = 0;
+
+			if (gFrame.y > ((map_l - 1) * 0x10 - WINDOW_HEIGHT) * 0x200)
+				gFrame.y = ((map_l - 1) * 0x10 - WINDOW_HEIGHT) * 0x200;
+		}
 	}
 #else
 	// Vanilla behaviour