ACCESS: Implement printText()

This commit is contained in:
Strangerke 2014-08-31 02:18:02 +02:00
parent b39d7df7cb
commit 9d3460e9f7
6 changed files with 54 additions and 26 deletions

View file

@ -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() { void AccessEngine::plotList() {
_player->calcPlayer(); _player->calcPlayer();
plotList1(); plotList1();

View file

@ -113,8 +113,6 @@ protected:
*/ */
void doRoom(); void doRoom();
void speakText(ASurface *s, Common::Array<Common::String>msgArr);
/** /**
* Support method that generates a savegame name * Support method that generates a savegame name
* @param slot Slot number * @param slot Slot number
@ -270,6 +268,12 @@ public:
void freeChar(); 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 * Load a savegame
*/ */

View file

@ -231,23 +231,26 @@ void AmazonEngine::loadEstablish(int sub) {
_establishGroup = 0; _establishGroup = 0;
_eseg = _files->loadFile(_estTable[oldGroup]); _eseg = _files->loadFile(_estTable[oldGroup]);
_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);
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));
} else { } else {
_establishGroup = 0;
_narateFile = 0;
_txtPages = 0;
_sndSubFile = 0;
_eseg = _files->loadFile("ETEXT.DAT"); _eseg = _files->loadFile("ETEXT.DAT");
} }
_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);
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));
} }
void AmazonEngine::doEstablish(int esatabIndex, int sub) { void AmazonEngine::doEstablish(int esatabIndex, int sub) {
@ -279,7 +282,7 @@ void AmazonEngine::doEstablish(int esatabIndex, int sub) {
_printEnd = 155; _printEnd = 155;
if (_txtPages == 0) { if (_txtPages == 0) {
Common::String msg((const char *)_eseg->data() + msgOffset); Common::String msg((const char *)_eseg->data() + msgOffset);
_fonts._font2.printText(_screen, msg); printText(_screen, msg);
} else { } else {
Common::Array<Common::String> msgArr; Common::Array<Common::String> msgArr;
for (int i = 0; i < _txtPages; ++i) { for (int i = 0; i < _txtPages; ++i) {

View file

@ -159,10 +159,6 @@ int Font::drawChar(ASurface *s, char c, Common::Point &pt) {
return ch.w; return ch.w;
} }
void Font::printText(ASurface *s, const Common::String &msg) {
error("TODO: printText");
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
FontManager::FontManager() { FontManager::FontManager() {

View file

@ -85,10 +85,6 @@ public:
*/ */
int drawChar(ASurface *s, char c, Common::Point &pt); 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 { class FontManager {

View file

@ -795,7 +795,7 @@ void Scripts::cmdDead() {
Common::String &msg = de._msg; Common::String &msg = de._msg;
_vm->_printEnd = 180; _vm->_printEnd = 180;
_vm->_fonts._font2.printText(_vm->_screen, msg); _vm->printText(_vm->_screen, msg);
_vm->_screen->forceFadeOut(); _vm->_screen->forceFadeOut();
_vm->_sound->newMusic(0, 1); _vm->_sound->newMusic(0, 1);