From 4078182ee8750bb3c2038521635494a4c6e5bc4c Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 8 Sep 2020 04:20:17 +0100 Subject: [PATCH 1/4] Add a bugfix for the blinking text cursor --- src/TextScr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 7e5dad44..db8eb8c5 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -1363,7 +1363,11 @@ int TextScriptProc(void) memcpy(str, &gTS.data[gTS.p_read], y); str[y] = '\0'; - gTS.p_write = x; + #ifdef FIX_BUGS + gTS.p_write = y; + #else + gTS.p_write = x; // This is way out of bounds, causing the blinking cursor to render offscreen + #endif // Print text PutText2(0, 0, str, RGB(0xFF, 0xFF, 0xFE), (SurfaceID)(SURFACE_ID_TEXT_LINE1 + (gTS.line % 4))); From 0324d1532b185fd149a809ab24ff9bb0554884eb Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 10 Sep 2020 21:29:25 +0100 Subject: [PATCH 2/4] Apply SurfaceID type --- src/Draw.cpp | 2 +- src/Draw.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Draw.cpp b/src/Draw.cpp index bea72ee7..9ae8dfd4 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -635,7 +635,7 @@ void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID su backbuffer->Blt(&rcSet, surf[surf_no], &rcWork, DDBLT_WAIT, NULL); } -void Surface2Surface(int x, int y, const RECT *rect, int to, int from) +void Surface2Surface(int x, int y, const RECT *rect, SurfaceID to, SurfaceID from) { static RECT rcWork; static RECT rcSet; diff --git a/src/Draw.h b/src/Draw.h index 80538220..61234437 100644 --- a/src/Draw.h +++ b/src/Draw.h @@ -54,7 +54,7 @@ BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem void BackupSurface(SurfaceID surf_no, const RECT *rect); void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no); void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no); -void Surface2Surface(int x, int y, const RECT *rect, int to, int from); +void Surface2Surface(int x, int y, const RECT *rect, SurfaceID to, SurfaceID from); unsigned long GetCortBoxColor(COLORREF col); void CortBox(const RECT *rect, unsigned long col); void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no); From f54dc8ce055dcb952cfef3803c3ef70994016d06 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Fri, 11 Sep 2020 23:35:56 +0100 Subject: [PATCH 3/4] Ramble about the broken font sizes --- src/Draw.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Draw.cpp b/src/Draw.cpp index 9ae8dfd4..7e7b57ad 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -817,6 +817,23 @@ void InitTextObject(const char *name) // Get font size unsigned int width, height; + // Let me tell you why these font sizes are unfortunate... + // 6x12 is a good font size - fonts use high-quality bitmaps at that + // size, and it works with Cave Story's internal assumption that + // characters are spaced 6 pixels apart. + // The sad part is the 10x20 size: you might be wondering why Pixel + // didn't use 12x24 instead. Well, that's because fonts don't use + // bitmaps at that size - instead you get ugly low-res vector + // renders. So, Pixel had to use 10x20 instead. But there's a + // problem: this means the characters are spaced 5 pixels apart + // instead. This normally isn't a problem because the game usually + // hardcodes it, but this isn't the case when either Date: Fri, 11 Sep 2020 23:59:04 +0100 Subject: [PATCH 4/4] Remove a bugfix It can't be saved... --- src/TextScr.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/TextScr.cpp b/src/TextScr.cpp index db8eb8c5..76316012 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -1363,11 +1363,15 @@ int TextScriptProc(void) memcpy(str, &gTS.data[gTS.p_read], y); str[y] = '\0'; - #ifdef FIX_BUGS - gTS.p_write = y; - #else - gTS.p_write = x; // This is way out of bounds, causing the blinking cursor to render offscreen - #endif + // This should have been 'y', not 'x'. This mistake causes the blinking + // cursor to render offscreen. Even if this were fixed, the broken font + // spacing (see InitTextObject in Draw.cpp) would likely cause it to + // still appear in the wrong place anyway. + //#ifdef FIX_BUGS + // gTS.p_write = y; + //#else + gTS.p_write = x; + //#endif // Print text PutText2(0, 0, str, RGB(0xFF, 0xFF, 0xFE), (SurfaceID)(SURFACE_ID_TEXT_LINE1 + (gTS.line % 4)));