From 111313ec7787e959f032b39f5150b93aaa9c8c30 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 4 Mar 2019 00:34:02 +0000 Subject: [PATCH] Fixed the Core's water not displaying properly Also made PutFront ASM-accurate (with the exception of the black bars stuff) --- src/Back.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Back.cpp b/src/Back.cpp index 3dbca733..99d10b8d 100644 --- a/src/Back.cpp +++ b/src/Back.cpp @@ -208,32 +208,41 @@ void PutBack(int fx, int fy) 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); } }