From 0c2ab20663c12464e923608a73d851c019006238 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 19 Aug 2009 08:30:15 +0000 Subject: Implemented proper character selection of Lands of Lore PC98. svn-id: r43531 --- engines/kyra/lol.h | 4 ++ engines/kyra/screen.cpp | 19 +++++++ engines/kyra/sequences_lol.cpp | 109 ++++++++++++++++++++++++++++++----------- engines/kyra/staticres.cpp | 11 +++++ 4 files changed, 115 insertions(+), 28 deletions(-) diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 1c89a7a1eb..7a112cfd8f 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -366,6 +366,10 @@ private: static const CharacterPrev _charPreviews[]; + // PC98 specific data + static const uint16 _charPosXPC98[]; + static const uint8 _charNamesPC98[][11]; + WSAMovie_v2 *_chargenWSA; static const uint8 _chargenFrameTableTalkie[]; static const uint8 _chargenFrameTableFloppy[]; diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index f5570acd72..b50bc7a1e6 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -562,6 +562,12 @@ void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) { assert(x >= 0 && x < SCREEN_W && y >= 0 && y < SCREEN_H); if (pageNum == 0 || pageNum == 1) addDirtyRect(x, y, 1, 1); + + if (_use16ColorMode) { + color &= 0x0F; + color |= (color << 4); + } + _pagePtrs[pageNum][y * SCREEN_W + x] = color; } @@ -954,6 +960,11 @@ void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum, clearOverlayRect(pageNum, x1, y1, x2-x1+1, y2-y1+1); + if (_use16ColorMode) { + color &= 0x0F; + color |= (color << 4); + } + if (xored) { for (; y1 <= y2; ++y1) { for (int x = x1; x <= x2; ++x) @@ -1035,6 +1046,11 @@ void Screen::drawClippedLine(int x1, int y1, int x2, int y2, int color) { void Screen::drawLine(bool vertical, int x, int y, int length, int color) { uint8 *ptr = getPagePtr(_curPage) + y * SCREEN_W + x; + if (_use16ColorMode) { + color &= 0x0F; + color |= (color << 4); + } + if (vertical) { assert((y + length) <= SCREEN_H); int currLine = 0; @@ -2974,6 +2990,9 @@ byte *Screen::getOverlayPtr(int page) { if (_vm->gameFlags().gameID == GI_KYRA2) { if (page == 12 || page == 13) return _sjisOverlayPtrs[3]; + } else if (_vm->gameFlags().gameID == GI_LOL) { + if (page == 4 || page == 5) + return _sjisOverlayPtrs[3]; } return 0; diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index 54a882d9e2..3b061e5062 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -289,18 +289,56 @@ int LoLEngine::chooseCharacter() { _screen->setFont(Screen::FID_9_FNT); _screen->_curPage = 2; - for (int i = 0; i < 4; ++i) - _screen->fprintStringIntro("%s", _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120, _charPreviews[i].name); + if (_flags.platform == Common::kPlatformPC98) { + _screen->fillRect(17, 29, 94, 97, 17); + _screen->fillRect(68, 167, 310, 199, 17); + _screen->drawClippedLine(68, 166, 311, 166, 238); + _screen->drawClippedLine(68, 166, 68, 199, 238); + _screen->drawClippedLine(311, 166, 311, 199, 238); - for (int i = 0; i < 4; ++i) { - _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 48, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[0]); - _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 56, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[1]); - _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 64, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[2]); - } + _screen->_curPage = 4; + _screen->fillRect(17, 29, 94, 97, 17); + _screen->_curPage = 2; + + for (int i = 0; i < 4; ++i) { + _screen->printText((const char *)_charNamesPC98[i], _charPosXPC98[i], 168, 0xC1, 0x00); + + // Since our SJIS font does not support ASCII digits currently, we have to use the + // digits from the SJIS range, which looks different to the original. + for (int j = 0; j < 3; ++j) { + uint8 buffer[5]; + snprintf((char *)buffer, 5, "%2d", _charPreviews[i].attrib[j]); + + buffer[3] = buffer[1] - '0' + 0x4F; + buffer[2] = 0x82; + if (buffer[0] != ' ') { + buffer[1] = buffer[0] - '0' + 0x4F; + buffer[0] = 0x82; + } else { + buffer[1] = 0x40; + buffer[0] = 0x81; + } + buffer[4] = 0x00; + + _screen->printText((const char *)buffer, _charPosXPC98[i] + 16, 176 + j * 8, 0x81, 0x00); + } + } + + _screen->printText(_tim->getCTableEntry(51), 72, 176, 0x81, 0x00); + _screen->printText(_tim->getCTableEntry(53), 72, 184, 0x81, 0x00); + _screen->printText(_tim->getCTableEntry(55), 72, 192, 0x81, 0x00); + } else { + for (int i = 0; i < 4; ++i) { + _screen->fprintStringIntro("%s", _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120, _charPreviews[i].name); + _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 48, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[0]); + _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 56, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[1]); + _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 64, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[2]); + } - _screen->fprintStringIntro("%s", 36, 173, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(51)); - _screen->fprintStringIntro("%s", 36, 181, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(53)); - _screen->fprintStringIntro("%s", 36, 189, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(55)); + _screen->fprintStringIntro("%s", 36, 173, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(51)); + _screen->fprintStringIntro("%s", 36, 181, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(53)); + _screen->fprintStringIntro("%s", 36, 189, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(55)); + } _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK); _screen->_curPage = 0; @@ -337,6 +375,8 @@ int LoLEngine::chooseCharacter() { } else { break; } + + delay(10); } if (shouldQuit()) @@ -363,11 +403,13 @@ void LoLEngine::kingSelectionIntro() { _screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK); int y = 38; - _screen->fprintStringIntro("%s", 8, y, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(57)); - _screen->fprintStringIntro("%s", 8, y + 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(58)); - _screen->fprintStringIntro("%s", 8, y + 20, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(59)); - _screen->fprintStringIntro("%s", 8, y + 30, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(60)); - _screen->fprintStringIntro("%s", 8, y + 40, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(61)); + if (_flags.platform == Common::kPlatformPC98) { + for (int i = 0; i < 5; ++i) + _screen->printText(_tim->getCTableEntry(57 + i), 16, 32 + i * 8, 0xC1, 0x00); + } else { + for (int i = 0; i < 5; ++i) + _screen->fprintStringIntro("%s", 8, y + i * 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(57 + i)); + } _sound->voicePlay("KING01", &_speechHandle); @@ -405,8 +447,13 @@ void LoLEngine::kingSelectionReminder() { _screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK); int y = 48; - _screen->fprintStringIntro("%s", 8, y, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(62)); - _screen->fprintStringIntro("%s", 8, y + 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(63)); + if (_flags.platform == Common::kPlatformPC98) { + _screen->printText(_tim->getCTableEntry(62), 16, 32, 0xC1, 0x00); + _screen->printText(_tim->getCTableEntry(63), 16, 40, 0xC1, 0x00); + } else { + _screen->fprintStringIntro("%s", 8, y, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(62)); + _screen->fprintStringIntro("%s", 8, y + 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(63)); + } _sound->voicePlay("KING02", &_speechHandle); @@ -540,13 +587,17 @@ int LoLEngine::selectionCharInfo(int character) { static const uint8 charSelectInfoIdx[] = { 0x1D, 0x22, 0x27, 0x2C }; const int idx = charSelectInfoIdx[character]; - _screen->fprintStringIntro("%s", 50, 127, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+0)); - _screen->fprintStringIntro("%s", 50, 137, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+1)); - _screen->fprintStringIntro("%s", 50, 147, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+2)); - _screen->fprintStringIntro("%s", 50, 157, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+3)); - _screen->fprintStringIntro("%s", 50, 167, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+4)); + if (_flags.platform == Common::kPlatformPC98) { + for (int i = 0; i < 5; ++i) + _screen->printText(_tim->getCTableEntry(idx+i), 60, 128 + i * 8, 0x41, 0x00); + + _screen->printText(_tim->getCTableEntry(69), 112, 168, 0x01, 0x00); + } else { + for (int i = 0; i < 5; ++i) + _screen->fprintStringIntro("%s", 50, 127 + i * 10, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+i)); - _screen->fprintStringIntro("%s", 100, 168, 0x32, 0x00, 0xCF, 0x20, _tim->getCTableEntry(69)); + _screen->fprintStringIntro("%s", 100, 168, 0x32, 0x00, 0xCF, 0x20, _tim->getCTableEntry(69)); + } selectionCharInfoIntro(vocFilename); if (_charSelectionInfoResult == -1) { @@ -568,11 +619,13 @@ int LoLEngine::selectionCharInfo(int character) { _screen->copyRegion(48, 127, 48, 160, 272, 35, 4, 0, Screen::CR_NO_P_CHECK); _screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK); - _screen->fprintStringIntro("%s", 3, 28, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(64)); - _screen->fprintStringIntro("%s", 3, 38, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(65)); - _screen->fprintStringIntro("%s", 3, 48, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(66)); - _screen->fprintStringIntro("%s", 3, 58, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(67)); - _screen->fprintStringIntro("%s", 3, 68, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(68)); + if (_flags.platform == Common::kPlatformPC98) { + for (int i = 0; i < 5; ++i) + _screen->printText(_tim->getCTableEntry(64+i), 16, 32 + i * 8, 0xC1, 0x00); + } else { + for (int i = 0; i < 5; ++i) + _screen->fprintStringIntro("%s", 3, 28 + i * 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(64+i)); + } resetSkipFlag(); kingSelectionOutro(); diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 51288f31df..4f3824479d 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -3196,6 +3196,17 @@ const LoLEngine::CharacterPrev LoLEngine::_charPreviews[] = { { "Conrad", 0x10F, 0x7F, { 0x0A, 0x0C, 0x0A } } }; +const uint16 LoLEngine::_charPosXPC98[] = { + 92, 152, 212, 268 +}; + +const uint8 LoLEngine::_charNamesPC98[][11] = { + { 0x83, 0x41, 0x83, 0x4E, 0x83, 0x56, 0x83, 0x46, 0x83, 0x8B, 0x00 }, + { 0x83, 0x7D, 0x83, 0x43, 0x83, 0x50, 0x83, 0x8B, 0x00, 0x00, 0x00 }, + { 0x83, 0x4C, 0x81, 0x5B, 0x83, 0x89, 0x83, 0x93, 0x00, 0x00, 0x00 }, + { 0x83, 0x52, 0x83, 0x93, 0x83, 0x89, 0x83, 0x62, 0x83, 0x68, 0x00 } +}; + const uint8 LoLEngine::_chargenFrameTableTalkie[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x04, 0x03, 0x02, 0x01, -- cgit v1.2.3