shithub: cstory

Download patch

ref: 71199c7693133816999542cd1152d57c7fd1327d
parent: b1090cd8f90ac49646b4269a86a056dedba59f00
parent: dce5e215c804efc4cd58c2e98d87be7da9f610b4
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Sep 3 17:58:40 EDT 2020

Merge branch 'accurate' into portable

--- a/src/ArmsItem.h
+++ b/src/ArmsItem.h
@@ -4,7 +4,7 @@
 
 // Limits for the amount of weapons and items
 #define ARMS_MAX 8
-#define ITEM_MAX 0x20
+#define ITEM_MAX 32
 
 // "Arms" is a synonym of "weapon" here
 // "Code" means "ID" here
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -689,12 +689,11 @@
 
 	if (!LoadGenericData())
 	{
-#ifdef JAPANESE
-		Backend_ShowMessageBox("エラー", "汎用ファイルが読めない");
-#else
+	#if !defined(JAPANESE) && defined(FIX_BUGS) // The Aeon Genesis translation didn't translate this
 		Backend_ShowMessageBox("Error", "Couldn't read general purpose files");
-#endif
-
+	#else
+		Backend_ShowMessageBox("エラー", "汎用ファイルが読めない");
+	#endif
 		return FALSE;
 	}
 
@@ -704,12 +703,11 @@
 
 	if (!LoadNpcTable(path.c_str()))
 	{
-#ifdef JAPANESE
-		Backend_ShowMessageBox("エラー", "NPCテーブルが読めない");
-#else
+	#if !defined(JAPANESE) && defined(FIX_BUGS) // The Aeon Genesis translation didn't translate this
 		Backend_ShowMessageBox("Error", "Couldn't read the NPC table");
-#endif
-
+	#else
+		Backend_ShowMessageBox("エラー", "NPCテーブルが読めない");
+	#endif
 		return FALSE;
 	}
 
--- a/src/Input.h
+++ b/src/Input.h
@@ -8,7 +8,7 @@
 	BOOL bRight;
 	BOOL bUp;
 	BOOL bDown;
-	BOOL bButton[32];	// The original `Input.cpp` assumed there were 32 buttons (because of DirectInput's `DIJOYSTATE` struct)
+	BOOL bButton[32]; // 32 is the number of buttons in DirectInput's `DIJOYSTATE` struct
 };
 
 void ReleaseDirectInput(void);
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -246,12 +246,11 @@
 	InitFlags();
 	if (!TransferStage(13, 200, 10, 8))
 	{
-#ifdef JAPANESE
-		Backend_ShowMessageBox("エラー", "ステージの読み込みに失敗");
-#else
+	#if !defined(JAPANESE) && defined(FIX_BUGS) // The Aeon Genesis translation didn't translate this
 		Backend_ShowMessageBox("Error", "Failed to load stage");
-#endif
-
+	#else
+		Backend_ShowMessageBox("エラー", "ステージの読み込みに失敗");
+	#endif
 		return FALSE;
 	}
 
--- a/src/SelStage.cpp
+++ b/src/SelStage.cpp
@@ -13,7 +13,7 @@
 #include "Sound.h"
 #include "TextScr.h"
 
-PERMIT_STAGE gPermitStage[8];
+PERMIT_STAGE gPermitStage[STAGE_MAX];
 
 int gSelectedStage;
 int gStageSelectTitleY;
@@ -27,7 +27,7 @@
 {
 	int i = 0;
 
-	while (i < 8)
+	while (i < STAGE_MAX)
 	{
 		if (gPermitStage[i].index == index)
 			break;
@@ -38,7 +38,7 @@
 		++i;
 	}
 
-	if (i == 8)
+	if (i == STAGE_MAX)
 		return FALSE;
 
 	gPermitStage[i].index = index;
@@ -51,18 +51,18 @@
 {
 	int i;
 
-	for (i = 0; i < 8; ++i)
+	for (i = 0; i < STAGE_MAX; ++i)
 		if (gPermitStage[i].index == index)
 			break;
 
 #ifdef FIX_BUGS
-	if (i == 8)
+	if (i == STAGE_MAX)
 #else
-	if (i == 32)
+	if (i == 32) // Same value as 'ITEM_MAX'
 #endif
 		return FALSE;
 
-	for (++i; i < 8; ++i)
+	for (++i; i < STAGE_MAX; ++i)
 		gPermitStage[i - 1] = gPermitStage[i];
 
 	gPermitStage[i - 1].index = 0;
@@ -140,11 +140,14 @@
 
 		PutBitmap3(&rcView, stage_x + (gSelectedStage * 40), (WINDOW_HEIGHT / 2) - 56, &rcCur[flash / 2 % 2], SURFACE_ID_TEXT_BOX);
 
-		for (i = 0; i < 8; ++i)
+		for (i = 0; i < STAGE_MAX; ++i)
 		{
 			if (gPermitStage[i].index == 0)
 				break;
 
+			// Interestingly, there's code for reading multiple rows of icons
+			// from the 'StageImage.pbm' file when there are more than 8 stages,
+			// despite only 6 icons ever being used.
 			rcStage.left = (gPermitStage[i].index % 8) * 32;
 			rcStage.right = rcStage.left + 32;
 			rcStage.top = (gPermitStage[i].index / 8) * 16;
--- a/src/SelStage.h
+++ b/src/SelStage.h
@@ -2,6 +2,8 @@
 
 #include "WindowsWrapper.h"
 
+#define STAGE_MAX 8 // Note that Cave Story only has 5 stages
+
 typedef struct PERMIT_STAGE
 {
 	int index;
@@ -8,7 +10,7 @@
 	int event;
 } PERMIT_STAGE;
 
-extern PERMIT_STAGE gPermitStage[8];
+extern PERMIT_STAGE gPermitStage[STAGE_MAX];
 
 extern int gSelectedStage;
 extern int gStageSelectTitleY;
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -741,12 +741,11 @@
 
 						if (!TransferStage(z, w, x, y))
 						{
-							#ifdef JAPANESE
-							Backend_ShowMessageBox("エラー", "ステージの読み込みに失敗");
-							#else
+						#if !defined(JAPANESE) && defined(FIX_BUGS) // The Aeon Genesis translation didn't translate this
 							Backend_ShowMessageBox("Error", "Failed to load stage");
-							#endif
-
+						#else
+							Backend_ShowMessageBox("エラー", "ステージの読み込みに失敗");
+						#endif
 							return enum_ESCRETURN_exit;
 						}
 					}
@@ -1323,14 +1322,13 @@
 					else
 					{
 						char str_0[0x40];
-						#ifdef JAPANESE
-						sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
-						Backend_ShowMessageBox("エラー", str_0);
-						#else
+					#if !defined(JAPANESE) && defined(FIX_BUGS) // The Aeon Genesis translation didn't translate this
 						sprintf(str_0, "Unknown code:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
 						Backend_ShowMessageBox("Error", str_0);
-						#endif
-
+					#else
+						sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
+						Backend_ShowMessageBox("エラー", str_0);
+					#endif
 						return enum_ESCRETURN_exit;
 					}
 				}