shithub: cstory

Download patch

ref: 111313ec7787e959f032b39f5150b93aaa9c8c30
parent: 7b2a3a20dc4f54b0f2a1dfe265bc19cfa48f5456
author: Clownacy <[email protected]>
date: Sun Mar 3 19:34:02 EST 2019

Fixed the Core's water not displaying properly

Also made PutFront ASM-accurate (with the exception of the black bars
stuff)

--- a/src/Back.cpp
+++ b/src/Back.cpp
@@ -208,32 +208,41 @@
 
 void PutFront(int fx, int fy)
 {
+	int x;
+	int y;
+	int xpos;
+	int ypos;
+	int x_1;
+	int x_2;
+	int y_1;
+	int y_2;
+
 	RECT rcWater[2] = {{0, 0, 32, 16}, {0, 16, 32, 48}};
 
 	switch (gBack.type)
 	{
 		case 3:
-			int x_1 = fx / 0x4000;
-			int x_2 = x_1 + (((WINDOW_WIDTH + 31) >> 5) + 1);
-			int y_1 = 0;
-			int y_2 = y_1 + 32;
+			x_1 = fx / 0x4000;
+			x_2 = x_1 + (((WINDOW_WIDTH + 31) >> 5) + 1);
+			y_1 = 0;
+			y_2 = y_1 + 32;
 			
-			for (int y = y_1; y < y_2; y++)
+			for (y = y_1; y < y_2; y++)
 			{
-				int ypos = (y * 0x20 * 0x200) / 0x200 - fy / 0x200 + gWaterY / 0x200;
+				ypos = (y * 0x20 * 0x200) / 0x200 - fy / 0x200 + gWaterY / 0x200;
 				
 				if (ypos < -32)
-					break;
+					continue;
 
 				if (ypos > WINDOW_HEIGHT)
 					break;
 					
-				for (int x = x_1; x < x_2; x++)
+				for (x = x_1; x < x_2; x++)
 				{
-					int xpos = (x * 0x20 * 0x200) / 0x200 - fx / 0x200;
+					xpos = (x * 0x20 * 0x200) / 0x200 - fx / 0x200;
 					PutBitmap3(&grcGame, xpos, ypos, &rcWater[1], SURFACE_ID_LEVEL_BACKGROUND);
 					if (!y)
-						PutBitmap3(&grcGame, xpos, ypos, rcWater, SURFACE_ID_LEVEL_BACKGROUND);
+						PutBitmap3(&grcGame, xpos, ypos, &rcWater[0], SURFACE_ID_LEVEL_BACKGROUND);
 				}
 			}