Convert old escapes to Unicode

Only does the ones below ASCII (0x00 - 0x1F), hopefully none of the high ones are important because they'll conflict with Unicode codepoints
This commit is contained in:
Pk11 2021-08-04 15:13:51 -05:00 committed by d0k3
parent 5a9e11b4bf
commit 26d2aefec3

View File

@ -69,12 +69,19 @@ static const u16 cp437_sorted_map[0x100] = {
0x25BC, 0x25C4, 0x25CB, 0x25D8, 0x25D9, 0x263A, 0x263B, 0x263C, 0x2640, 0x2642, 0x2660, 0x2663, 0x2665, 0x2666, 0x266A, 0x266B 0x25BC, 0x25C4, 0x25CB, 0x25D8, 0x25D9, 0x263A, 0x263B, 0x263C, 0x2640, 0x2642, 0x2660, 0x2663, 0x2665, 0x2666, 0x266A, 0x266B
}; };
// lookup table to convert the old CP-437 escapes to Unicode
static const u16 cp437_escapes[0x20] = {
0x0000, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C,
0x25BA, 0x25C4, 0x2195, 0x203C, 0x00B6, 0x00A7, 0x25AC, 0x21A8, 0x2191, 0x2193, 0x2192, 0x2190, 0x221F, 0x2194, 0x25B2, 0x25BC
};
#define PIXEL_OFFSET(x, y) (((x) * SCREEN_HEIGHT) + (SCREEN_HEIGHT - (y) - 1)) #define PIXEL_OFFSET(x, y) (((x) * SCREEN_HEIGHT) + (SCREEN_HEIGHT - (y) - 1))
u16 GetFontIndex(u16 c, bool use_ascii_lut) u16 GetFontIndex(u16 c, bool use_ascii_lut)
{ {
if (use_ascii_lut && c >= 0x20 && c <= 0x7F) return ascii_lut[c - 0x20]; if (c < 0x20) return GetFontIndex(cp437_escapes[c], use_ascii_lut);
else if (use_ascii_lut && c < 0x80) return ascii_lut[c - 0x20];
int left = 0; int left = 0;
int right = font_count; int right = font_count;