From 384fd4b8334d88c828185c309952a046f4625fea Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 12 Feb 2007 04:18:19 +0000 Subject: Add Quietust's patch to fix subtitles glitches in Amiga AGA/CD32 versions of Simon the Sorcerer 1. svn-id: r25506 --- engines/agos/charset.cpp | 63 ++++++++++++++++++++++-------------------------- engines/agos/res_ami.cpp | 21 +++++++++++++++- engines/agos/string.cpp | 1 + 3 files changed, 50 insertions(+), 35 deletions(-) (limited to 'engines/agos') diff --git a/engines/agos/charset.cpp b/engines/agos/charset.cpp index bba6ade9a5..4b318a3784 100644 --- a/engines/agos/charset.cpp +++ b/engines/agos/charset.cpp @@ -305,63 +305,58 @@ void AGOSEngine::renderStringAmiga(uint vga_sprite_id, uint color, uint width, u dst_org = dst; int delta = 0; while ((chr = *txt++) != 0) { - int tmp = chr; + int img_width = 1; if (chr == 10) { dst += width * 10; dst_org = dst; delta = 0; - } else if ((tmp -= '!') < 0) { - delta += 6; - if (delta > 8) { - delta -= 8; - dst_org++; - } + } else if ((signed char)(chr -= '!') < 0) { + img_width = 7; } else { const byte *img = simon_agaFont + chr * 41; - int img_width = img[40]; - int mdelta = 8 - delta; + img_width = img[40]; byte *cur_dst = dst_org; for (int row = 0; row < 10; row++) { int col = color; for (int plane = 0; plane < 3; plane++) { chr = img[plane] >> delta; if (chr) { - if (col & 1) *(cur_dst + charsize * 0) |= chr; - if (col & 2) *(cur_dst + charsize * 1) |= chr; - if (col & 4) *(cur_dst + charsize * 2) |= chr; - if (col & 8) *(cur_dst + charsize * 3) |= chr; + if (col & 1) cur_dst[charsize * 0] |= chr; + if (col & 2) cur_dst[charsize * 1] |= chr; + if (col & 4) cur_dst[charsize * 2] |= chr; + if (col & 8) cur_dst[charsize * 3] |= chr; } - chr = img[plane] << mdelta; - if ((mdelta >= img_width) && (chr)) { - if (col & 1) *(cur_dst + charsize * 0 + 1) |= chr; - if (col & 2) *(cur_dst + charsize * 1 + 1) |= chr; - if (col & 4) *(cur_dst + charsize * 2 + 1) |= chr; - if (col & 8) *(cur_dst + charsize * 3 + 1) |= chr; + chr = img[plane] << (8 - delta); + if (((8 - delta) < img_width) && (chr)) { + if (col & 1) cur_dst[charsize * 0 + 1] |= chr; + if (col & 2) cur_dst[charsize * 1 + 1] |= chr; + if (col & 4) cur_dst[charsize * 2 + 1] |= chr; + if (col & 8) cur_dst[charsize * 3 + 1] |= chr; } col++; } chr = img[3] >> delta; if (chr) { - *(cur_dst + charsize * 0) |= chr; - *(cur_dst + charsize * 1) |= chr; - *(cur_dst + charsize * 2) |= chr; - *(cur_dst + charsize * 3) |= chr; + cur_dst[charsize * 0] |= chr; + cur_dst[charsize * 1] |= chr; + cur_dst[charsize * 2] |= chr; + cur_dst[charsize * 3] |= chr; } - chr = img[3] << mdelta; - if ((mdelta >= img_width) && (chr)) { - *(cur_dst + charsize * 0 + 1) |= chr; - *(cur_dst + charsize * 1 + 1) |= chr; - *(cur_dst + charsize * 2 + 1) |= chr; - *(cur_dst + charsize * 3 + 1) |= chr; + chr = img[3] << (8 - delta); + if (((8 - delta) < img_width) && (chr)) { + cur_dst[charsize * 0 + 1] |= chr; + cur_dst[charsize * 1 + 1] |= chr; + cur_dst[charsize * 2 + 1] |= chr; + cur_dst[charsize * 3 + 1] |= chr; } cur_dst += width; img += 4; } - delta += img_width - 1; - if (delta > 8) { - delta -= 8; - dst_org++; - } + } + delta += img_width - 1; + if (delta >= 8) { + delta -= 8; + dst_org++; } } } diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp index 714c4fc727..556875e740 100644 --- a/engines/agos/res_ami.cpp +++ b/engines/agos/res_ami.cpp @@ -75,6 +75,21 @@ static void bitplanetochunky(uint16 *w, uint8 colorDepth, uint8 *&dst) { } } +static void bitplanetochunkytext(uint16 *w, uint8 colorDepth, uint8 *&dst) { + for (int j = 0; j < 16; j++) { + byte color = 0; + for (int p = 0; p < colorDepth; ++p) { + if (w[p] & 0x8000) { + color |= 1 << p; + } + w[p] <<= 1; + } + if (color) + color |= 0xC0; + *dst++ = color; + } +} + static void convertcompressedclip(const byte *src, byte *dst, uint8 colorDepth, int height, int width) { const byte *plane[kMaxColorDepth]; byte *uncptr[kMaxColorDepth]; @@ -143,7 +158,11 @@ byte *AGOSEngine::convertclip(VC10_state *state, byte flags) { for (j = 0; j < colorDepth; ++j) { w[j] = READ_BE_UINT16(src + j * length * 2); } - bitplanetochunky(w, colorDepth, dst); + if (state->palette == 0xC0) { + bitplanetochunkytext(w, colorDepth, dst); + } else { + bitplanetochunky(w, colorDepth, dst); + } src += 2; } else { for (j = 0; j < colorDepth; ++j) { diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index 78acffa57e..ca376da718 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -465,6 +465,7 @@ void AGOSEngine::printScreenText(uint vgaSpriteId, uint color, const char *strin renderString(1, color, width, height, convertedString); } else { if (getPlatform() == Common::kPlatformAmiga) { + color = color * 3 + 1; renderStringAmiga(vgaSpriteId, color, width, height, convertedString); } else { color = color * 3 + 192; -- cgit v1.2.3