aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agos/agos.h1
-rw-r--r--engines/agos/string.cpp37
2 files changed, 33 insertions, 5 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 3c03ea7be4..405ee3622c 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -848,6 +848,7 @@ protected:
void skipSpeech();
+ const char *getPixelLength(const char *string, uint16 maxWidth, uint16 &pixels);
bool printNameOf(Item *item, uint x, uint y);
bool printTextOf(uint a, uint x, uint y);
void printVerbOf(uint hitarea_id);
diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp
index aa34d7a163..a466be796f 100644
--- a/engines/agos/string.cpp
+++ b/engines/agos/string.cpp
@@ -333,6 +333,32 @@ void AGOSEngine::loadTextIntoMem(uint16 stringId) {
error("loadTextIntoMem: didn't find %d", stringId);
}
+static const byte polish_charWidth[226] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 2, 8, 7, 6,10, 8, 2,
+ 4, 4, 7, 6, 3, 4, 2, 3, 6, 4,
+ 6, 6, 7, 6, 6, 6, 6, 6, 2, 8,
+ 6, 9, 7, 6, 6, 8, 7, 8, 8, 7,
+ 6, 9, 8, 2, 6, 7, 6,10, 8, 9,
+ 7, 9, 7, 7, 8, 8, 8,12, 8, 8,
+ 7, 6, 7, 6, 4, 7, 7, 7, 7, 6,
+ 7, 7, 4, 7, 6, 2, 3, 6, 2,10,
+ 6, 7, 7, 7, 5, 6, 4, 6, 6,10,
+ 6, 6, 6, 0, 0, 0, 0, 0, 8, 6,
+ 7, 7, 7, 7, 7, 6, 7, 7, 7, 4,
+ 4, 3, 8, 8, 7, 0, 0, 7, 7, 7,
+ 6, 6, 6, 9, 8, 0, 0, 0, 0, 0,
+ 7, 3, 7, 6, 6, 8, 0, 0, 6, 0,
+ 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 7
+};
+
static const byte charWidth[226] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -359,14 +385,15 @@ static const byte charWidth[226] = {
0, 0, 0, 0, 0, 7
};
-const char *getPixelLength(const char *string, uint16 maxWidth, uint16 &pixels) {
+const char *AGOSEngine::getPixelLength(const char *string, uint16 maxWidth, uint16 &pixels) {
pixels = 0;
while (*string != 0) {
byte chr = *string;
- if ((pixels + charWidth[chr]) > maxWidth)
+ uint8 len = (_language == Common::PL_POL) ? polish_charWidth[chr] : charWidth[chr];
+ if ((pixels + len) > maxWidth)
break;
- pixels += charWidth[chr];
+ pixels += len;
string++;
}
@@ -559,7 +586,7 @@ void AGOSEngine_Feeble::printScreenText(uint vgaSpriteId, uint color, const char
}
while (*string2 != ' ') {
byte chr = *string2;
- pixels -= charWidth[chr];
+ pixels -= (_language == Common::PL_POL) ? polish_charWidth[chr] : charWidth[chr];
string2--;
}
spaces = (width - pixels) / 12;
@@ -609,7 +636,7 @@ void AGOSEngine_Feeble::printInteractText(uint16 num, const char *string) {
}
while (*string2 != ' ') {
byte chr = *string2;
- pixels -= charWidth[chr];
+ pixels -= (_language == Common::PL_POL) ? polish_charWidth[chr] : charWidth[chr];
string2--;
}
if (w == 0xFFFF)