Skip to content

Commit

Permalink
ACCESS: Stub for printText method
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 25, 2014
1 parent 707a01c commit 33cdeb7
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 39 deletions.
22 changes: 12 additions & 10 deletions engines/access/access.cpp
Expand Up @@ -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;
Expand All @@ -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];
}
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions engines/access/asurface.h
Expand Up @@ -52,6 +52,9 @@ class ASurface : public Graphics::Surface {
static int _orgX2, _orgY2;
static int _lColor;

Common::Point _printOrg;
Common::Point _printStart;

static void init();
public:
virtual ~ASurface();
Expand Down
32 changes: 16 additions & 16 deletions engines/access/bubble_box.cpp
Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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) {
Expand All @@ -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);
}

Expand All @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions engines/access/font.cpp
Expand Up @@ -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() {
Expand Down
7 changes: 5 additions & 2 deletions engines/access/font.h
Expand Up @@ -84,14 +84,17 @@ class Font {
* 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;
Expand Down
22 changes: 11 additions & 11 deletions engines/access/scripts.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = "";
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 33cdeb7

Please sign in to comment.