diff options
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/access.cpp | 22 | ||||
-rw-r--r-- | engines/access/asurface.h | 3 | ||||
-rw-r--r-- | engines/access/bubble_box.cpp | 32 | ||||
-rw-r--r-- | engines/access/font.cpp | 4 | ||||
-rw-r--r-- | engines/access/font.h | 7 | ||||
-rw-r--r-- | engines/access/scripts.cpp | 22 |
6 files changed, 51 insertions, 39 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index cea5a73818..32a4e6cc8f 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -285,10 +285,10 @@ void AccessEngine::speakText(int idx) { _fonts._font2._fontColors[2] = 29; _fonts._font2._fontColors[3] = 30; - _fonts._font2.drawString(_screen, line, _fonts._printOrg); - _fonts._printOrg = Common::Point(_fonts._printStart.x, _fonts._printOrg.y + 9); + _fonts._font2.drawString(_screen, line, _screen->_printOrg); + _screen->_printOrg = Common::Point(_screen->_printStart.x, _screen->_printOrg.y + 9); - if ((_fonts._printOrg.y > _printEnd) && (!lastLine)) { + if ((_screen->_printOrg.y > _printEnd) && (!lastLine)) { while (true) { _sound->_soundTable[0]._data = _sound->loadSound(_narateFile + 99, _sndSubFile); _sound->_soundPriority[0] = 1; @@ -312,7 +312,7 @@ void AccessEngine::speakText(int idx) { } } _buffer2.copyBuffer(_screen); - _fonts._printOrg.y = _fonts._printStart.y; + _screen->_printOrg.y = _screen->_printStart.y; ++curPage; soundsLeft = _countTbl[curPage]; } @@ -369,17 +369,19 @@ void AccessEngine::doEstablish(int esatabIndex, int sub) { _fonts._charFor._hi = 32; _bubbleBox->_maxChars = 37; - _fonts._printOrg = _fonts._printStart = Common::Point(48, 35); + _screen->_printOrg = _screen->_printStart = Common::Point(48, 35); loadEstablish(sub); _et = sub; warning("CHECKME: Use of di"); - int idx = READ_LE_UINT16(_eseg + (sub * 2) + 2); + uint16 msgOffset = READ_LE_UINT16(_eseg + (sub * 2) + 2); + Common::String msg((const char *)_eseg + msgOffset); _printEnd = 155; - if (_txtPages == 0) - warning("TODO: printText()"); - else - speakText(idx); + if (_txtPages == 0) { + _fonts._font2.printText(_screen, msg); + } else { +// speakText(msg); + } _screen->forceFadeOut(); _screen->clearScreen(); diff --git a/engines/access/asurface.h b/engines/access/asurface.h index f5e5f48e7b..262d41400a 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -52,6 +52,9 @@ public: static int _orgX2, _orgY2; static int _lColor; + Common::Point _printOrg; + Common::Point _printStart; + static void init(); public: virtual ~ASurface(); diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp index a709fbd92d..56d7157e8d 100644 --- a/engines/access/bubble_box.cpp +++ b/engines/access/bubble_box.cpp @@ -74,8 +74,8 @@ void BubbleBox::placeBubble1(const Common::String &msg) { void BubbleBox::calcBubble(const Common::String &msg) { // Save points - Common::Point printOrg = _vm->_fonts._printOrg; - Common::Point printStart = _vm->_fonts._printStart; + Common::Point printOrg = _vm->_screen->_printOrg; + Common::Point printStart = _vm->_screen->_printStart; // Figure out maximum width allowed if (_type == TYPE_4) { @@ -96,12 +96,12 @@ void BubbleBox::calcBubble(const Common::String &msg) { lastLine = _vm->_fonts._font2.getLine(s, _maxChars * 6, line, width); _vm->_fonts._printMaxX = MAX(width, _vm->_fonts._printMaxX); - _vm->_fonts._printOrg.y += 6; - _vm->_fonts._printOrg.x = _vm->_fonts._printStart.x; + _vm->_screen->_printOrg.y += 6; + _vm->_screen->_printOrg.x = _vm->_screen->_printStart.x; } while (!lastLine); if (_type == TYPE_4) - ++_vm->_fonts._printOrg.y += 6; + ++_vm->_screen->_printOrg.y += 6; // Determine the width for the area width = (((_vm->_fonts._printMaxX >> 4) + 1) << 4) + 5; @@ -110,7 +110,7 @@ void BubbleBox::calcBubble(const Common::String &msg) { bounds.setWidth(width); // Determine the height for area - int y = _vm->_fonts._printOrg.y + 6; + int y = _vm->_screen->_printOrg.y + 6; if (_type == TYPE_4) y += 6; int height = y - bounds.top; @@ -124,8 +124,8 @@ void BubbleBox::calcBubble(const Common::String &msg) { _bubbles.push_back(bounds); // Restore points - _vm->_fonts._printOrg = printOrg; - _vm->_fonts._printStart = printStart; + _vm->_screen->_printOrg = printOrg; + _vm->_screen->_printStart = printStart; } void BubbleBox::printBubble(const Common::String &msg) { @@ -147,16 +147,16 @@ void BubbleBox::printBubble(const Common::String &msg) { font2._fontColors[2] = 28; font2._fontColors[3] = 29; - int xp = _vm->_fonts._printOrg.x; + int xp = _vm->_screen->_printOrg.x; if (_type == TYPE_4) xp = (_bounds.width() - width) / 2 + _bounds.left - 4; // Draw the text - font2.drawString(_vm->_screen, line, Common::Point(xp, _vm->_fonts._printOrg.y)); + font2.drawString(_vm->_screen, line, Common::Point(xp, _vm->_screen->_printOrg.y)); // Move print position - _vm->_fonts._printOrg.y += 6; - _vm->_fonts._printOrg.x = _vm->_fonts._printStart.x; + _vm->_screen->_printOrg.y += 6; + _vm->_screen->_printOrg.x = _vm->_screen->_printStart.x; } while (!lastLine); } @@ -175,8 +175,8 @@ void BubbleBox::doBox(int item, int box) { // Save state information FontVal charSet = fonts._charSet; FontVal charFor = fonts._charFor; - Common::Point printOrg = fonts._printOrg; - Common::Point printStart = fonts._printStart; + Common::Point printOrg = screen._printOrg; + Common::Point printStart = screen._printStart; int charCol = _charCol; int rowOff = _rowOff; @@ -260,8 +260,8 @@ void BubbleBox::doBox(int item, int box) { // Restore positional state fonts._charSet = charSet; fonts._charFor = charFor; - fonts._printOrg = printOrg; - fonts._printStart = printStart; + screen._printOrg = printOrg; + screen._printStart = printStart; _charCol = charCol; _rowOff = rowOff; _vm->_screen->restoreScreen(); diff --git a/engines/access/font.cpp b/engines/access/font.cpp index 75add4129c..ba17f19211 100644 --- a/engines/access/font.cpp +++ b/engines/access/font.cpp @@ -159,6 +159,10 @@ int Font::drawChar(ASurface *s, char c, Common::Point &pt) { return ch.w; } +void Font::printText(ASurface *s, const Common::String &msg) { + error("TODO: printText"); +} + /*------------------------------------------------------------------------*/ FontManager::FontManager() { diff --git a/engines/access/font.h b/engines/access/font.h index a32dd6b695..9285d323d1 100644 --- a/engines/access/font.h +++ b/engines/access/font.h @@ -84,14 +84,17 @@ public: * Draw a character on a given surface */ int drawChar(ASurface *s, char c, Common::Point &pt); + + /** + * Draw a string on a given surface and update text positioning + */ + void printText(ASurface *s, const Common::String &msg); }; class FontManager { public: FontVal _charSet; FontVal _charFor; - Common::Point _printOrg; - Common::Point _printStart; int _printMaxX; Font _font1; Font _font2; diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 6ee8eb0da5..d6f65a69c9 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -185,8 +185,8 @@ void Scripts::cmdPrint() { } void Scripts::printString(const Common::String &msg) { - _vm->_fonts._printOrg = Common::Point(20, 42); - _vm->_fonts._printStart = Common::Point(20, 42); + _vm->_screen->_printOrg = Common::Point(20, 42); + _vm->_screen->_printStart = Common::Point(20, 42); _vm->_timers[PRINT_TIMER]._timer = 50; _vm->_timers[PRINT_TIMER]._initTm = 50; ++_vm->_timers[PRINT_TIMER]._flag; @@ -488,8 +488,8 @@ void Scripts::CMDSETCYCLE() { error("TODO CMDSETCYCLE"); } void Scripts::CMDCYCLE() { error("TODO CMDCYCLE"); } void Scripts::cmdCharSpeak() { - _vm->_fonts._printOrg = _charsOrg; - _vm->_fonts._printStart = _charsOrg; + _vm->_screen->_printOrg = _charsOrg; + _vm->_screen->_printStart = _charsOrg; byte v; Common::String tmpStr = ""; @@ -501,8 +501,8 @@ void Scripts::cmdCharSpeak() { } void Scripts::cmdTexSpeak() { - _vm->_fonts._printOrg = _texsOrg; - _vm->_fonts._printStart = _texsOrg; + _vm->_screen->_printOrg = _texsOrg; + _vm->_screen->_printStart = _texsOrg; _vm->_bubbleBox->_maxChars = 20; byte v; @@ -542,8 +542,8 @@ void Scripts::cmdTexChoice() { _vm->_fonts._charFor._hi = 255; _vm->_bubbleBox->_maxChars = 20; - _vm->_fonts._printOrg = _texsOrg; - _vm->_fonts._printStart = _texsOrg; + _vm->_screen->_printOrg = _texsOrg; + _vm->_screen->_printStart = _texsOrg; _vm->_bubbleBox->clearBubbles(); _vm->_bubbleBox->_bubblePtr = Common::String("RESPONSE 1").c_str(); @@ -559,7 +559,7 @@ void Scripts::cmdTexChoice() { Common::Rect responseCoords[2]; responseCoords[0] = _vm->_bubbleBox->_bounds; responseCoords[1] = Common::Rect(0, 0, 0, 0); - _vm->_fonts._printOrg.y = _vm->_bubbleBox->_bounds.bottom + 11; + _vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + 11; findNull(); @@ -575,7 +575,7 @@ void Scripts::cmdTexChoice() { _vm->_bubbleBox->calcBubble(tmpStr); _vm->_bubbleBox->printBubble(tmpStr); responseCoords[1] = _vm->_bubbleBox->_bounds; - _vm->_fonts._printOrg.y = _vm->_bubbleBox->_bounds.bottom + 11; + _vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + 11; } findNull(); @@ -590,7 +590,7 @@ void Scripts::cmdTexChoice() { _vm->_bubbleBox->calcBubble(tmpStr); _vm->_bubbleBox->printBubble(tmpStr); termResponse2 = _vm->_bubbleBox->_bounds; - _vm->_fonts._printOrg.y = _vm->_bubbleBox->_bounds.bottom + 11; + _vm->_screen->_printOrg.y = _vm->_bubbleBox->_bounds.bottom + 11; } findNull(); |