Skip to content

Commit

Permalink
ACCESS: Implement printText()
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Aug 31, 2014
1 parent b39d7df commit 9d3460e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 26 deletions.
29 changes: 29 additions & 0 deletions engines/access/access.cpp
Expand Up @@ -296,6 +296,35 @@ void AccessEngine::speakText(ASurface *s, Common::Array<Common::String> msgArr)
}
}

void AccessEngine::printText(ASurface *s, Common::String &msg) {
Common::String line;
int width = 0;
while (true) {
bool lastLine = _fonts._font2.getLine(msg, s->_maxChars * 6, line, width);

// Set font colors
_fonts._font2._fontColors[0] = 0;
_fonts._font2._fontColors[1] = 28;
_fonts._font2._fontColors[2] = 29;
_fonts._font2._fontColors[3] = 30;

_fonts._font2.drawString(s, line, s->_printOrg);
s->_printOrg = Common::Point(s->_printStart.x, s->_printOrg.y + 9);

if (lastLine)
break;

_events->waitKeyMouse();
_buffer2.copyBuffer(s);
s->_printOrg.y = s->_printStart.y;

if (lastLine)
break;
}
_events->waitKeyMouse();
}


void AccessEngine::plotList() {
_player->calcPlayer();
plotList1();
Expand Down
8 changes: 6 additions & 2 deletions engines/access/access.h
Expand Up @@ -113,8 +113,6 @@ class AccessEngine : public Engine {
*/
void doRoom();

void speakText(ASurface *s, Common::Array<Common::String>msgArr);

/**
* Support method that generates a savegame name
* @param slot Slot number
Expand Down Expand Up @@ -270,6 +268,12 @@ class AccessEngine : public Engine {

void freeChar();

/**
* Draw a string on a given surface and update text positioning
*/
void printText(ASurface *s, Common::String &msg);
void speakText(ASurface *s, Common::Array<Common::String>msgArr);

/**
* Load a savegame
*/
Expand Down
33 changes: 18 additions & 15 deletions engines/access/amazon/amazon_game.cpp
Expand Up @@ -231,23 +231,26 @@ void AmazonEngine::loadEstablish(int sub) {
_establishGroup = 0;

_eseg = _files->loadFile(_estTable[oldGroup]);
} else {
_eseg = _files->loadFile("ETEXT.DAT");
}
_establishCtrlTblOfs = READ_LE_UINT16(_eseg->data());

_establishCtrlTblOfs = READ_LE_UINT16(_eseg->data());
int ofs = _establishCtrlTblOfs + (sub * 2);
int idx = READ_LE_UINT16(_eseg->data() + ofs);
_narateFile = READ_LE_UINT16(_eseg->data() + idx);
_txtPages = READ_LE_UINT16(_eseg->data() + idx + 2);

int ofs = _establishCtrlTblOfs + (sub * 2);
int idx = READ_LE_UINT16(_eseg->data() + ofs);
_narateFile = READ_LE_UINT16(_eseg->data() + idx);
_txtPages = READ_LE_UINT16(_eseg->data() + idx + 2);

if (!_txtPages)
return;
if (!_txtPages)
return;

_sndSubFile = READ_LE_UINT16(_eseg->data() + idx + 4);
for (int i = 0; i < _txtPages; ++i)
_countTbl[i] = READ_LE_UINT16(_eseg->data() + idx + 6 + (2 * i));
_sndSubFile = READ_LE_UINT16(_eseg->data() + idx + 4);
for (int i = 0; i < _txtPages; ++i)
_countTbl[i] = READ_LE_UINT16(_eseg->data() + idx + 6 + (2 * i));
} else {
_establishGroup = 0;
_narateFile = 0;
_txtPages = 0;
_sndSubFile = 0;
_eseg = _files->loadFile("ETEXT.DAT");
}
}

void AmazonEngine::doEstablish(int esatabIndex, int sub) {
Expand Down Expand Up @@ -279,7 +282,7 @@ void AmazonEngine::doEstablish(int esatabIndex, int sub) {
_printEnd = 155;
if (_txtPages == 0) {
Common::String msg((const char *)_eseg->data() + msgOffset);
_fonts._font2.printText(_screen, msg);
printText(_screen, msg);
} else {
Common::Array<Common::String> msgArr;
for (int i = 0; i < _txtPages; ++i) {
Expand Down
4 changes: 0 additions & 4 deletions engines/access/font.cpp
Expand Up @@ -159,10 +159,6 @@ 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
4 changes: 0 additions & 4 deletions engines/access/font.h
Expand Up @@ -85,10 +85,6 @@ class Font {
*/
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 {
Expand Down
2 changes: 1 addition & 1 deletion engines/access/scripts.cpp
Expand Up @@ -795,7 +795,7 @@ void Scripts::cmdDead() {

Common::String &msg = de._msg;
_vm->_printEnd = 180;
_vm->_fonts._font2.printText(_vm->_screen, msg);
_vm->printText(_vm->_screen, msg);
_vm->_screen->forceFadeOut();

_vm->_sound->newMusic(0, 1);
Expand Down

0 comments on commit 9d3460e

Please sign in to comment.