Merge branch 'accurate' into portable

This commit is contained in:
Clownacy 2020-09-12 00:30:03 +01:00
commit 5b33d0280d
3 changed files with 29 additions and 4 deletions

View file

@ -507,7 +507,7 @@ void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID su
RenderBackend_Blit(surf[surf_no], &rcWork, framebuffer, x * mag, y * mag, FALSE); 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; static RenderBackend_Rect rcWork;
@ -652,17 +652,34 @@ void InitTextObject(const char *name)
// Get font size // Get font size
size_t width, height; 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) switch (mag)
{ {
#ifdef JAPANESE #ifdef JAPANESE
case 1: case 1:
height = 12; height = 12;
width = 12; width = 6 * 2;
break; break;
case 2: case 2:
height = 20; height = 20;
width = 20; width = 10 * 2;
break; break;
#else #else
case 1: case 1:

View file

@ -53,7 +53,7 @@ BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem
void BackupSurface(SurfaceID surf_no, const RECT *rect); void BackupSurface(SurfaceID surf_no, const RECT *rect);
void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no); 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 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); unsigned long GetCortBoxColor(unsigned long col);
void CortBox(const RECT *rect, unsigned long col); void CortBox(const RECT *rect, unsigned long col);
void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no); void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no);

View file

@ -1365,7 +1365,15 @@ int TextScriptProc(void)
memcpy(str, &gTS.data[gTS.p_read], y); memcpy(str, &gTS.data[gTS.p_read], y);
str[y] = '\0'; 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; gTS.p_write = x;
//#endif
// Print text // Print text
PutText2(0, 0, str, RGB(0xFF, 0xFF, 0xFE), (SurfaceID)(SURFACE_ID_TEXT_LINE1 + (gTS.line % 4))); PutText2(0, 0, str, RGB(0xFF, 0xFF, 0xFE), (SurfaceID)(SURFACE_ID_TEXT_LINE1 + (gTS.line % 4)));