aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/charset-fontdata.cpp
diff options
context:
space:
mode:
authorTravis Howell2008-03-26 01:57:26 +0000
committerTravis Howell2008-03-26 01:57:26 +0000
commitdefe50eada0f5b7d6d7d8c2551e633450d0883a9 (patch)
tree1736557470fa725806046b015a24dddf38df81b0 /engines/agos/charset-fontdata.cpp
parent171a4d1bdb86df0debecf32244014ab6d858a6a0 (diff)
downloadscummvm-rg350-defe50eada0f5b7d6d7d8c2551e633450d0883a9.tar.gz
scummvm-rg350-defe50eada0f5b7d6d7d8c2551e633450d0883a9.tar.bz2
scummvm-rg350-defe50eada0f5b7d6d7d8c2551e633450d0883a9.zip
Always ignore invalid characters, when using charset data.
svn-id: r31236
Diffstat (limited to 'engines/agos/charset-fontdata.cpp')
-rw-r--r--engines/agos/charset-fontdata.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/engines/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp
index 6d281cf914..bdcf07eb01 100644
--- a/engines/agos/charset-fontdata.cpp
+++ b/engines/agos/charset-fontdata.cpp
@@ -1580,41 +1580,49 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
if (getGameType() == GType_FF || getGameType() == GType_PP) {
dst = getBackGround() + y * _dxSurfacePitch + x + window->textColumnOffset;
h = 13;
- w = feebleFontSize[chr - 0x20];
+ w = feebleFontSize[chr - 32];
- src = feeble_windowFont + (chr - 0x20) * 13;
+ // Ignore invalid characters
+ if (chr - 32 > 195)
+ return;
+
+ src = feeble_windowFont + (chr - 32) * 13;
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset;
h = 8;
w = 6;
+ // Ignore invalid characters
+ if (chr - 32 > 98)
+ return;
+
switch (_language) {
case Common::CZ_CZE:
- src = czech_simonFont + (chr - 0x20) * 8;
+ src = czech_simonFont + (chr - 32) * 8;
break;
case Common::RU_RUS:
- src = russian_simonFont + (chr - 0x20) * 8;
+ src = russian_simonFont + (chr - 32) * 8;
break;
case Common::PL_POL:
- src = polish_simonFont + (chr - 0x20) * 8;
+ src = polish_simonFont + (chr - 32) * 8;
break;
case Common::HB_ISR:
- src = hebrew_simonFont + (chr - 0x20) * 8;
+ src = hebrew_simonFont + (chr - 32) * 8;
break;
case Common::ES_ESP:
- src = spanish_simonFont + (chr - 0x20) * 8;
+ src = spanish_simonFont + (chr - 32) * 8;
break;
case Common::IT_ITA:
- src = italian_simonFont + (chr - 0x20) * 8;
+ src = italian_simonFont + (chr - 32) * 8;
break;
case Common::FR_FRA:
- src = french_simonFont + (chr - 0x20) * 8;
+ src = french_simonFont + (chr - 32) * 8;
break;
case Common::DE_DEU:
- src = german_simonFont + (chr - 0x20) * 8;
+ src = german_simonFont + (chr - 32) * 8;
break;
case Common::EN_ANY:
- src = english_simonFont + (chr - 0x20) * 8;
+ src = english_simonFont + (chr - 32) * 8;
break;
default:
error("windowDrawChar: Unknown language %d\n", _language);
@@ -1624,22 +1632,26 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
h = 8;
w = 6;
+ // Ignore invalid characters
+ if (chr - 32 > 98)
+ return;
+
// TODO: Add font tables for German
switch (_language) {
case Common::ES_ESP:
- src = spanish_commonFont + (chr - 0x20) * 8;
+ src = spanish_commonFont + (chr - 32) * 8;
break;
case Common::IT_ITA:
- src = italian_commonFont + (chr - 0x20) * 8;
+ src = italian_commonFont + (chr - 32) * 8;
break;
case Common::FR_FRA:
- src = french_commonFont + (chr - 0x20) * 8;
+ src = french_commonFont + (chr - 32) * 8;
break;
case Common::DE_DEU:
- src = english_commonFont + (chr - 0x20) * 8;
+ src = english_commonFont + (chr - 32) * 8;
break;
case Common::EN_ANY:
- src = english_commonFont + (chr - 0x20) * 8;
+ src = english_commonFont + (chr - 32) * 8;
break;
default:
error("windowDrawChar: Unknown language %d\n", _language);