ref: 5b33d0280dae5a4639f07bb5fb375704db3b7b8f
parent: a6408b330f0e9aa49c013a9281713089f736d3d6
parent: f47ffea5770bb5df235831eea2ab924ac273f2bc
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Sep 11 20:30:03 EDT 2020
Merge branch 'accurate' into portable
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -507,7 +507,7 @@
RenderBackend_Blit(surf[surf_no], &rcWork, framebuffer, x * mag, y * mag, FALSE);
}
-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 RenderBackend_Rect rcWork;
@@ -652,17 +652,34 @@
// Get font size
size_t 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 <SAT is used, a
+ // texture is regenerated, or when the game prints the name of the
+ // map. This causes the font to render with incorrect spacing.
+ // There's really not much of a solution to this, especially when
+ // you consider that the English translation was specifically built
+ // around the broken spacing.
+
switch (mag)
{
#ifdef JAPANESE
case 1:
height = 12;
- width = 12;
+ width = 6 * 2;
break;
case 2:
height = 20;
- width = 20;
+ width = 10 * 2;
break;
#else
case 1:
--- a/src/Draw.h
+++ b/src/Draw.h
@@ -53,7 +53,7 @@
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(unsigned long col);
void CortBox(const RECT *rect, unsigned long col);
void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no);
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -1365,7 +1365,15 @@
memcpy(str, &gTS.data[gTS.p_read], y);
str[y] = '\0';
+ // 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)));