From 8fa5f43bed1936e6938d73cf88ffc587c9cef264 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 2 Jun 2006 02:35:04 +0000 Subject: Improve Hebrew support svn-id: r22825 --- engines/simon/charset.cpp | 8 +++--- engines/simon/items.cpp | 66 ++++++++++++++++++++++++++++------------------ engines/simon/saveload.cpp | 22 +++++++++++----- 3 files changed, 59 insertions(+), 37 deletions(-) diff --git a/engines/simon/charset.cpp b/engines/simon/charset.cpp index 8a3b331970..5f40e2f688 100644 --- a/engines/simon/charset.cpp +++ b/engines/simon/charset.cpp @@ -408,7 +408,7 @@ void SimonEngine::windowPutChar(WindowBlock *window, byte c, byte b) { } else if (c == 13 || c == 10) { video_putchar_newline(window); } else if ((c == 1 && _language != Common::HB_ISR) || (c == 8)) { - if (_language == Common::HB_ISR) { //Hebrew + if (_language == Common::HB_ISR) { if (b >= 64 && b < 91) width = _hebrewCharWidths [b - 64]; @@ -446,13 +446,13 @@ void SimonEngine::windowPutChar(WindowBlock *window, byte c, byte b) { window->textRow--; } - if (_language == Common::HB_ISR) { //Hebrew + if (_language == Common::HB_ISR) { if (c >= 64 && c < 91) width = _hebrewCharWidths [c - 64]; - window->textColumnOffset -= width; + window->textColumnOffset -= width; if (window->textColumnOffset >= width) { - window->textColumn++; window->textColumnOffset += 8; + window->textColumn++; } video_putchar_drawchar(window, (window->width + window->x - window->textColumn) * 8, window->textRow * 8 + window->y, c); window->textLength++; diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp index 39c09c7b22..a6dde7dedd 100644 --- a/engines/simon/items.cpp +++ b/engines/simon/items.cpp @@ -1406,16 +1406,8 @@ void SimonEngine::o1_screenTextPObj() { // 177: inventory descriptions uint vgaSpriteId = getVarOrByte(); uint color = getVarOrByte(); - const char *string_ptr = NULL; - TextLocation *tl = NULL; - char buf[256]; SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2); - if (subObject != NULL && subObject->objectFlags & kOFText) { - string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]); - tl = getTextLocation(vgaSpriteId); - } - if (getFeatures() & GF_TALKIE) { if (subObject != NULL && subObject->objectFlags & kOFVoice) { uint offs = getOffsetOfChild2Param(subObject, kOFVoice); @@ -1426,13 +1418,28 @@ void SimonEngine::o1_screenTextPObj() { } } - if (subObject != NULL && (subObject->objectFlags & kOFText) && _subtitles) { + if (subObject != NULL && subObject->objectFlags & kOFText && _subtitles) { + const char *stringPtr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]); + TextLocation *tl = getTextLocation(vgaSpriteId); + char buf[256]; + int j, k; + if (subObject->objectFlags & kOFNumber) { - sprintf(buf, "%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], string_ptr); - string_ptr = buf; + if (_language == Common::HB_ISR) { + j = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)]; + k = (j % 10) * 10; + k += j / 10; + if (!(j % 10)) + sprintf(buf,"0%d%s", k, stringPtr); + else + sprintf(buf,"%d%s", k, stringPtr); + } else { + sprintf(buf,"%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], stringPtr); + } + stringPtr = buf; } - if (string_ptr != NULL) - printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width); + if (stringPtr != NULL) + printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width); } } @@ -1704,16 +1711,8 @@ void SimonEngine::o2_screenTextPObj() { // 177: inventory descriptions uint vgaSpriteId = getVarOrByte(); uint color = getVarOrByte(); - const char *string_ptr = NULL; - TextLocation *tl = NULL; - char buf[256]; SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2); - if (subObject != NULL && subObject->objectFlags & kOFText) { - string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]); - tl = getTextLocation(vgaSpriteId); - } - if (getFeatures() & GF_TALKIE) { if (subObject != NULL && subObject->objectFlags & kOFVoice) { uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)]; @@ -1768,13 +1767,28 @@ void SimonEngine::o2_screenTextPObj() { } - if (subObject != NULL && (subObject->objectFlags & kOFText) && _subtitles) { + if (subObject != NULL && subObject->objectFlags & kOFText && _subtitles) { + const char *stringPtr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]); + TextLocation *tl = getTextLocation(vgaSpriteId); + char buf[256]; + int j, k; + if (subObject->objectFlags & kOFNumber) { - sprintf(buf, "%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], string_ptr); - string_ptr = buf; + if (_language == Common::HB_ISR) { + j = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)]; + k = (j % 10) * 10; + k += j / 10; + if (!(j % 10)) + sprintf(buf,"0%d%s", k, stringPtr); + else + sprintf(buf,"%d%s", k, stringPtr); + } else { + sprintf(buf,"%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], stringPtr); + } + stringPtr = buf; } - if (string_ptr != NULL) - printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width); + if (stringPtr != NULL) + printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width); } } diff --git a/engines/simon/saveload.cpp b/engines/simon/saveload.cpp index 5359c04ba0..b813090630 100644 --- a/engines/simon/saveload.cpp +++ b/engines/simon/saveload.cpp @@ -60,7 +60,7 @@ int SimonEngine::displaySaveGameList(int curpos, bool load, char *dst) { showMessageFormat("\xC"); - memset(dst, 0, 18 * 6); + memset(dst, 0, 108); slot = curpos; @@ -70,10 +70,18 @@ int SimonEngine::displaySaveGameList(int curpos, bool load, char *dst) { in->read(dst, 18); delete in; + last_slot = slot; - if (slot < 10) + if (slot < 10) { showMessageFormat(" "); - showMessageFormat("%d", slot); + } else if (_language == Common::HB_ISR) { + last_slot = (slot % 10) * 10; + last_slot += slot / 10; + } + + if (_language == Common::HB_ISR && !(slot % 10)) + showMessageFormat("0"); + showMessageFormat("%d", last_slot); showMessageFormat(".%s\n", dst); dst += 18; slot++; @@ -240,7 +248,7 @@ restart:; window->textRow = unk132_result; - if (_language == Common::HB_ISR) { //Hebrew + if (_language == Common::HB_ISR) { // init x offset with a 2 character savegame number + a period (18 pix) window->textColumn = 3; window->textColumnOffset = 6; @@ -257,7 +265,7 @@ restart:; // now process entire savegame name to get correct x offset for cursor name_len = 0; while (name[name_len]) { - if (_language == Common::HB_ISR) { //Hebrew + if (_language == Common::HB_ISR) { byte width = 6; if (name[name_len] >= 64 && name[name_len] < 91) width = _hebrewCharWidths [name[name_len] - 64]; @@ -322,7 +330,7 @@ restart:; name_len--; m = name[name_len]; - if (_language == Common::HB_ISR) //Hebrew + if (_language == Common::HB_ISR) x = 8; else x = (name[name_len] == 'i' || name[name_len] == 'l') ? 1 : 8; @@ -432,7 +440,7 @@ void SimonEngine::clearCharacter(WindowBlock *window, int x, byte b) { old_text = window->text_color; window->text_color = window->fill_color; - if (_language == Common::HB_ISR) { //Hebrew + if (_language == Common::HB_ISR) { x = 128; } else { x += 120; -- cgit v1.2.3