shithub: cstory

Download patch

ref: a3fd87e581ecc7304fa681575c9a2f551bf42d7f
parent: b4e651398ab79063f26d2d2aa785703f89d00c12
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Nov 15 15:53:31 EST 2019

Clean-up Ending.cpp

--- a/src/Ending.cpp
+++ b/src/Ending.cpp
@@ -23,9 +23,11 @@
 ILLUSTRATION Illust;
 
 // Update casts
-void ActionStripper()
+void ActionStripper(void)
 {
-	for (int s = 0; s < MAX_STRIP; s++)
+	int s;
+
+	for (s = 0; s < MAX_STRIP; ++s)
 	{
 		// Move up
 		if (Strip[s].flag & 0x80 && Credit.mode)
@@ -37,11 +39,12 @@
 }
 
 // Draw casts
-void PutStripper()
+void PutStripper(void)
 {
 	RECT rc;
+	int s;
 
-	for (int s = 0; s < MAX_STRIP; s++)
+	for (s = 0; s < MAX_STRIP; ++s)
 	{
 		if (Strip[s].flag & 0x80)
 		{
@@ -48,15 +51,15 @@
 			// Draw text
 			rc.left = 0;
 			rc.right = 320;
-			rc.top = s * 0x10;
-			rc.bottom = rc.top + 0x10;
+			rc.top = s * 16;
+			rc.bottom = rc.top + 16;
 
 			PutBitmap3(&grcFull, (Strip[s].x / 0x200) + ((WINDOW_WIDTH - 320) / 2), (Strip[s].y / 0x200), &rc, SURFACE_ID_CREDIT_CAST);
 
 			// Draw character
-			rc.left = 24 * (Strip[s].cast % 13);
+			rc.left = (Strip[s].cast % 13) * 24;
 			rc.right = rc.left + 24;
-			rc.top = 24 * (Strip[s].cast / 13);
+			rc.top = (Strip[s].cast / 13) * 24;
 			rc.bottom = rc.top + 24;
 
 			PutBitmap3(&grcFull, (Strip[s].x / 0x200) + ((WINDOW_WIDTH - 320) / 2) - 24, (Strip[s].y / 0x200) - 8, &rc, SURFACE_ID_CASTS);
@@ -70,7 +73,7 @@
 	RECT rc;
 	int s;
 
-	for (s = 0; s < MAX_STRIP; s++)
+	for (s = 0; s < MAX_STRIP; ++s)
 		if (!(Strip[s].flag & 0x80))
 			break;
 
@@ -87,8 +90,8 @@
 	// Draw text
 	rc.left = 0;
 	rc.right = 320;
-	rc.top = s * 0x10;
-	rc.bottom = rc.top + 0x10;
+	rc.top = s * 16;
+	rc.bottom = rc.top + 16;
 
 	CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
 	PutText2(0, rc.top, text, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST);
@@ -95,18 +98,19 @@
 }
 
 // Regenerate cast text
-void RestoreStripper()
+void RestoreStripper(void)
 {
 	RECT rc;
+	int s;
 
-	for (int s = 0; s < MAX_STRIP; s++)
+	for (s = 0; s < MAX_STRIP; ++s)
 	{
 		if (Strip[s].flag & 0x80)
 		{
 			rc.left = 0;
 			rc.right = 320;
-			rc.top = s * 0x10;
-			rc.bottom = rc.top + 0x10;
+			rc.top = s * 16;
+			rc.bottom = rc.top + 16;
 
 			CortBox2(&rc, 0, SURFACE_ID_CREDIT_CAST);
 			PutText2(0, rc.top, Strip[s].str, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_CREDIT_CAST);
@@ -115,16 +119,16 @@
 }
 
 // Handle the illustration
-void ActionIllust()
+void ActionIllust(void)
 {
 	switch (Illust.act_no)
 	{
 		case 0: // Off-screen to the left
-			Illust.x = -0x14000;
+			Illust.x = -160 * 0x200;
 			break;
 
 		case 1: // Move in from the left
-			Illust.x += 0x5000;
+			Illust.x += 40 * 0x200;
 			if (Illust.x > 0)
 				Illust.x = 0;
 			break;
@@ -131,14 +135,14 @@
 
 		case 2: // Move out from the right
 			Illust.x -= 0x5000;
-			if (Illust.x < -0x14000)
-				Illust.x = -0x14000;
+			if (Illust.x < -160 * 0x200)
+				Illust.x = -160 * 0x200;
 			break;
 	}
 }
 
 // Draw illustration
-void PutIllust()
+void PutIllust(void)
 {
 	RECT rcIllust = {0, 0, 160, 240};
 #if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
@@ -159,7 +163,7 @@
 }
 
 // Initialize and release credits
-void InitCreditScript()
+void InitCreditScript(void)
 {
 	// Clear script state and casts
 	memset(&Credit, 0, sizeof(CREDIT));
@@ -166,9 +170,9 @@
 	memset(Strip, 0, sizeof(Strip));
 }
 
-void ReleaseCreditScript()
+void ReleaseCreditScript(void)
 {
-	if (Credit.pData)
+	if (Credit.pData != NULL)
 	{
 		// Free script data
 		free(Credit.pData);
@@ -179,10 +183,10 @@
 const char *credit_script = "Credit.tsc";
 
 // Start playing credits
-BOOL StartCreditScript()
+BOOL StartCreditScript(void)
 {
 	// Clear previously existing credits data
-	if (Credit.pData)
+	if (Credit.pData != NULL)
 	{
 		free(Credit.pData);
 		Credit.pData = NULL;
@@ -221,7 +225,7 @@
 	Credit.offset = 0;
 	Credit.wait = 0;
 	Credit.mode = 1;
-	Illust.x = -0x14000;
+	Illust.x = -160 * 0x200;
 	Illust.act_no = 0;
 
 	// Modify cliprect
@@ -243,7 +247,7 @@
 }
 
 // Update credits
-void ActionCredit()
+void ActionCredit(void)
 {
 	if (Credit.offset >= Credit.size)
 		return;
@@ -258,11 +262,12 @@
 		case 2:
 			if (--Credit.wait <= 0)
 				Credit.mode = 1;
+			break;
 	}
 }
 
 // Parse credits
-void ActionCredit_Read()
+void ActionCredit_Read(void)
 {
 	int a, b, len;
 	char text[40];
@@ -429,7 +434,7 @@
 }
 
 // Slide illustration off-screen
-void CutCreditIllust()
+void CutCreditIllust(void)
 {
 	Illust.act_no = 2;
 }
@@ -437,8 +442,10 @@
 // Scene of the island falling
 int Scene_DownIsland(HWND hWnd, int mode)
 {
+	int wait;
+
 	// Setup background
-	RECT rc_frame = {(WINDOW_WIDTH - 160) / 2, (WINDOW_HEIGHT - 80) / 2, (WINDOW_WIDTH + 160) / 2, (WINDOW_HEIGHT + 80) / 2};
+	RECT rc_frame = {(WINDOW_WIDTH / 2) - 80, (WINDOW_HEIGHT / 2) - 40, (WINDOW_WIDTH / 2) + 80, (WINDOW_HEIGHT / 2) + 40};
 	RECT rc_sky = {0, 0, 160, 80};
 	RECT rc_ground = {160, 48, 320, 80};
 
@@ -446,10 +453,10 @@
 	RECT rc_sprite = {160, 0, 200, 24};
 
 	ISLAND_SPRITE sprite;
-	sprite.x = 0x15000;
-	sprite.y = 0x8000;
+	sprite.x = 168 * 0x200;
+	sprite.y = 64 * 0x200;
 
-	for (int wait = 0; wait < 900; wait++)
+	for (wait = 0; wait < 900; ++wait)
 	{
 		// Get pressed keys
 		GetTrg();
@@ -500,9 +507,9 @@
 
 		// Draw scene
 		CortBox(&grcFull, 0);
-		PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 80 + (WINDOW_HEIGHT - 240) / 2, &rc_sky, SURFACE_ID_LEVEL_SPRITESET_1);
-		PutBitmap3(&rc_frame, sprite.x / 0x200 - 20 + (WINDOW_WIDTH - 320) / 2, sprite.y / 512 - 12 + (WINDOW_HEIGHT - 240) / 2, &rc_sprite, SURFACE_ID_LEVEL_SPRITESET_1);
-		PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, SURFACE_ID_LEVEL_SPRITESET_1);
+		PutBitmap3(&rc_frame, 80 + ((WINDOW_WIDTH - 320) / 2), 80 + ((WINDOW_HEIGHT - 240) / 2), &rc_sky, SURFACE_ID_LEVEL_SPRITESET_1);
+		PutBitmap3(&rc_frame, (sprite.x / 0x200) - 20 + ((WINDOW_WIDTH - 320) / 2), (sprite.y / 0x200) - 12 + ((WINDOW_HEIGHT - 240) / 2), &rc_sprite, SURFACE_ID_LEVEL_SPRITESET_1);
+		PutBitmap3(&rc_frame, 80 + ((WINDOW_WIDTH - 320) / 2), 128 + ((WINDOW_HEIGHT - 240) / 2), &rc_ground, SURFACE_ID_LEVEL_SPRITESET_1);
 		PutTimeCounter(16, 8);
 
 		// Draw window
--- a/src/Ending.h
+++ b/src/Ending.h
@@ -37,19 +37,19 @@
 
 #define MAX_STRIP ((WINDOW_HEIGHT / 16) + 1)
 
-void ActionStripper();
-void PutStripper();
+void ActionStripper(void);
+void PutStripper(void);
 void SetStripper(int x, int y, const char *text, int cast);
-void RestoreStripper();
-void ActionIllust();
-void PutIllust();
+void RestoreStripper(void);
+void ActionIllust(void);
+void PutIllust(void);
 void ReloadIllust(int a);
-void InitCreditScript();
-void ReleaseCreditScript();
-BOOL StartCreditScript();
-void ActionCredit();
-void ActionCredit_Read();
+void InitCreditScript(void);
+void ReleaseCreditScript(void);
+BOOL StartCreditScript(void);
+void ActionCredit(void);
+void ActionCredit_Read(void);
 int GetScriptNumber(const char *text);
 void SetCreditIllust(int a);
-void CutCreditIllust();
+void CutCreditIllust(void);
 int Scene_DownIsland(HWND hWnd, int mode);