shithub: cstory

Download patch

ref: 525cf58b7f487af0ba7b4560a707360fa3233e15
parent: 26bcbdbef7fdfbe83d9d63f6daff81a44a588ad6
parent: 4498e5d71adf77caa8d456fd1f9183a6ac37559a
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Feb 8 16:31:56 EST 2019

Merge branch 'master' of https://github.com/cuckydev/Cave-Story-Engine-2

binary files a/build/Profile - Copy.dat /dev/null differ
--- a/src/Ending.cpp
+++ b/src/Ending.cpp
@@ -40,7 +40,7 @@
 		{
 			//Draw text
 			RECT rc = {0, 16 * s, 320, 16 * s + 16};
-			PutBitmap3(&grcFull, Strip[s].x / 0x200, Strip[s].y / 0x200, &rc, SURFACE_ID_CREDIT_CAST);
+			PutBitmap3(&grcFull, (Strip[s].x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, Strip[s].y / 0x200, &rc, SURFACE_ID_CREDIT_CAST);
 			
 			//Draw character
 			rc.left = 24 * (Strip[s].cast % 13);
@@ -47,7 +47,7 @@
 			rc.right = rc.left + 24;
 			rc.top = 24 * (Strip[s].cast / 13);
 			rc.bottom = rc.top + 24;
-			PutBitmap3(&grcFull, Strip[s].x / 0x200 - 24, Strip[s].y / 0x200 - 8, &rc, SURFACE_ID_CASTS);
+			PutBitmap3(&grcFull, (Strip[s].x + ((WINDOW_WIDTH - 320) << 8)) / 0x200 - 24, Strip[s].y / 0x200 - 8, &rc, SURFACE_ID_CASTS);
 		}
 	}
 }
@@ -116,7 +116,8 @@
 void PutIllust()
 {
 	RECT rcIllust = {0, 0, 160, 240};
-	PutBitmap3(&grcFull, Illust.x / 0x200, 0, &rcIllust, SURFACE_ID_CREDITS_IMAGE);
+	RECT rcClip = {(WINDOW_WIDTH - 320) / 2, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
+	PutBitmap3(&rcClip, (Illust.x + ((WINDOW_WIDTH - 320) << 8)) / 0x200, (WINDOW_HEIGHT - 240) / 2, &rcIllust, SURFACE_ID_CREDITS_IMAGE);
 }
 
 //Load illustration
@@ -183,7 +184,10 @@
 	Illust.act_no = 0;
 	
 	//Modify cliprect
-	grcGame.left = 160;
+	grcGame.left = WINDOW_WIDTH / 2;
+	grcGame.right = ((WINDOW_WIDTH - 320) / 2) + 320;
+	grcGame.top = (WINDOW_HEIGHT - 240) / 2;
+	grcGame.bottom = ((WINDOW_HEIGHT - 240) / 2) + 240;
 	
 	//Reload casts
 	if (!ReloadBitmap_File("casts", SURFACE_ID_CASTS))
--- a/src/Frame.cpp
+++ b/src/Frame.cpp
@@ -22,12 +22,15 @@
 	const int num_x = ((WINDOW_WIDTH + 0xF) >> 4) + 1;
 	const int num_y = ((WINDOW_HEIGHT + 0xF) >> 4) + 1;
 	
-	if (map_w >= num_x)
+	if (map_w >= num_x || g_GameFlags & 8)
 	{
 		if (gFrame.x <= -0x200)
 			gFrame.x = 0;
-		if (gFrame.x > ((((map_w - 1) << 4) - WINDOW_WIDTH)) << 9)
-			gFrame.x = (((map_w - 1) << 4) - WINDOW_WIDTH) << 9;
+		if (gFrame.x > ((((map_w - 1) << 4) - ((g_GameFlags & 8) ? 320 : WINDOW_WIDTH))) << 9)
+			gFrame.x = (((map_w - 1) << 4) - ((g_GameFlags & 8) ? 320 : WINDOW_WIDTH)) << 9;
+		
+		if (g_GameFlags & 8)
+			gFrame.x -= ((WINDOW_WIDTH - 320) / 2) << 9;
 	}
 	else
 	{
@@ -34,12 +37,15 @@
 		gFrame.x = (((map_w - 1) << 4) - WINDOW_WIDTH) << 8;
 	}
 	
-	if (map_l >= num_y)
+	if (map_l >= num_y || g_GameFlags & 8)
 	{
 		if (gFrame.y <= -0x200)
 			gFrame.y = 0;
-		if (gFrame.y > ((((map_l - 1) << 4) - WINDOW_HEIGHT)) << 9)
-			gFrame.y = (((map_l - 1) << 4) - WINDOW_HEIGHT) << 9;
+		if (gFrame.y > ((((map_l - 1) << 4) - ((g_GameFlags & 8) ? 240 : WINDOW_HEIGHT))) << 9)
+			gFrame.y = (((map_l - 1) << 4) - ((g_GameFlags & 8) ? 240 : WINDOW_HEIGHT)) << 9;
+		
+		if (g_GameFlags & 8)
+			gFrame.y += ((WINDOW_HEIGHT - 240) / 2) << 9;
 	}
 	else
 	{
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -114,7 +114,7 @@
 	SetFadeMask();
 	
 	//Reset cliprect and flags
-	grcGame.left = 0;
+	grcGame = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
 	g_GameFlags = 3;
 	
 	CutNoise();
@@ -290,7 +290,7 @@
 	}
 	
 	//Reset cliprect, flags, and give the player the nikumaru counter
-	grcGame.left = 0;
+	grcGame = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
 	g_GameFlags = 0;
 	gMC.equip |= 0x100;
 	
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -14,6 +14,7 @@
 #include "Frame.h"
 #include "MycParam.h"
 #include "Flags.h"
+#include "Ending.h"
 #include "Profile.h"
 #include "Map.h"
 #include "MiniMap.h"
@@ -1208,6 +1209,23 @@
 						z = GetTextScriptNo(gTS.p_read + 4);
 						SetNumberTextScript(z);
 						gTS.p_read += 8;
+					}
+					else if (IS_COMMAND('C','R','E'))
+					{
+						g_GameFlags |= 8;
+						StartCreditScript();
+						gTS.p_read += 4;
+					}
+					else if (IS_COMMAND('S','I','L'))
+					{
+						z = GetTextScriptNo(gTS.p_read + 4);
+						SetCreditIllust(z);
+						gTS.p_read += 8;
+					}
+					else if (IS_COMMAND('C','I','L'))
+					{
+						CutCreditIllust();
+						gTS.p_read += 4;
 					}
 					else if (IS_COMMAND('E','S','C'))
 					{