shithub: cstory

Download patch

ref: 59aeae07f85c2f8adc15c0fa4dd76f7c810173e5
parent: 69eed6a9662a4e41d2bdc6674a218b1d39a123f1
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sun Sep 27 16:57:24 EDT 2020

More documentation

--- a/src/Ending.cpp
+++ b/src/Ending.cpp
@@ -18,6 +18,13 @@
 #include "Stage.h"
 #include "TextScr.h"
 
+enum CREDIT_MODE
+{
+	CREDIT_MODE_STOP,
+	CREDIT_MODE_SCROLL_READ,
+	CREDIT_MODE_SCROLL_WAIT
+};
+
 enum ILLUSTRATION_ACTION
 {
 	ILLUSTRATION_ACTION_IDLE,
@@ -31,7 +38,7 @@
 	char *pData;
 	int offset;
 	int wait;
-	int mode;
+	CREDIT_MODE mode;
 	int start_x;
 };
 
@@ -68,10 +75,10 @@
 	for (s = 0; s < MAX_STRIP; ++s)
 	{
 		// Move up
-		if (Strip[s].flag & 0x80 && Credit.mode)
+		if (Strip[s].flag & 0x80 && Credit.mode != CREDIT_MODE_STOP)
 			Strip[s].y -= 0x100;
 		// Get removed when off-screen
-		if (Strip[s].y <= -0x2000)
+		if (Strip[s].y <= -16 * 0x200)
 			Strip[s].flag = 0;
 	}
 }
@@ -265,7 +272,7 @@
 	// Reset credits
 	Credit.offset = 0;
 	Credit.wait = 0;
-	Credit.mode = 1;
+	Credit.mode = CREDIT_MODE_SCROLL_READ;
 	Illust.x = -160 * 0x200;
 	Illust.act_no = ILLUSTRATION_ACTION_IDLE;
 
@@ -327,11 +334,12 @@
 
 				// Copy the text to the cast text
 				memcpy(text, &Credit.pData[Credit.offset], len);
-				text[len] = 0;
+				text[len] = '\0';
 
 				// Get cast ID
 				Credit.offset = a;
-				len = GetScriptNumber(&Credit.pData[++Credit.offset]);
+				Credit.offset += 1;
+				len = GetScriptNumber(&Credit.pData[Credit.offset]);
 
 				// Create cast object
 				SetStripper(Credit.start_x, (WINDOW_HEIGHT + 8) * 0x200, text, len);
@@ -344,7 +352,7 @@
 				Credit.offset += 1;
 				Credit.wait = GetScriptNumber(&Credit.pData[Credit.offset]);
 				Credit.offset += 4;
-				Credit.mode = 2;
+				Credit.mode = CREDIT_MODE_SCROLL_WAIT;
 				return;
 
 			case '+': // Change casts x-position
@@ -354,7 +362,7 @@
 				return;
 
 			case '/': // Stop credits
-				Credit.mode = 0;
+				Credit.mode = CREDIT_MODE_STOP;
 				return;
 
 			case '!': // Change music
@@ -456,13 +464,13 @@
 	// Update script, or if waiting, decrement the wait value
 	switch (Credit.mode)
 	{
-		case 1:
+		case CREDIT_MODE_SCROLL_READ:
 			ActionCredit_Read();
 			break;
 
-		case 2:
+		case CREDIT_MODE_SCROLL_WAIT:
 			if (--Credit.wait <= 0)
-				Credit.mode = 1;
+				Credit.mode = CREDIT_MODE_SCROLL_READ;
 			break;
 	}
 }
@@ -519,7 +527,7 @@
 		{
 			case 0:
 				// Move down
-				sprite.y += 0x33;
+				sprite.y += 0x200 / 10;
 				break;
 
 			case 1:
@@ -526,17 +534,17 @@
 				if (wait < 350)
 				{
 					// Move down at normal speed
-					sprite.y += 0x33;
+					sprite.y += 0x200 / 10;
 				}
 				else if (wait < 500)
 				{
 					// Move down slower
-					sprite.y += 0x19;
+					sprite.y += 0x200 / 20;
 				}
 				else if (wait < 600)
 				{
 					// Move down slow
-					sprite.y += 0xC;
+					sprite.y += 0x200 / 40;
 				}
 				else if (wait == 750)
 				{