diff options
author | Max Horn | 2003-06-02 23:18:52 +0000 |
---|---|---|
committer | Max Horn | 2003-06-02 23:18:52 +0000 |
commit | 35f29951eb2a0ba3e97c10ee5e84007064221a02 (patch) | |
tree | ebcb03c4f933e1791b2c945fc92862d90bf8d7ba /scumm/string.cpp | |
parent | 457d6b1484cf202f6a3fa1a1b54accfc5e6a5e18 (diff) | |
download | scummvm-rg350-35f29951eb2a0ba3e97c10ee5e84007064221a02.tar.gz scummvm-rg350-35f29951eb2a0ba3e97c10ee5e84007064221a02.tar.bz2 scummvm-rg350-35f29951eb2a0ba3e97c10ee5e84007064221a02.zip |
moved blast text code to string.cpp
svn-id: r8282
Diffstat (limited to 'scumm/string.cpp')
-rw-r--r-- | scumm/string.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/scumm/string.cpp b/scumm/string.cpp index 4724394d38..5d89378cc3 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -736,6 +736,72 @@ void Scumm::initCharset(int charsetno) { _charsetColorMap[i] = _charsetData[_charset->getCurID()][i]; } +void Scumm::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) { + BlastText &bt = _blastTextQueue[_blastTextQueuePos++]; + assert(_blastTextQueuePos <= 32); + + strcpy((char *)bt.text, (const char *)text); + bt.xpos = x; + bt.ypos = y; + bt.color = color; + bt.charset = charset; + bt.center = center; +} + +void Scumm::drawBlastTexts() { + // FIXME + + byte *buf; + byte c; + int i; + + _charset->_ignoreCharsetMask = true; + for (i = 0; i < _blastTextQueuePos; i++) { + + buf = _blastTextQueue[i].text; + + _charset->_top = _blastTextQueue[i].ypos; + _charset->_startLeft = _charset->_left = _blastTextQueue[i].xpos; + _charset->_right = _screenWidth - 1; + _charset->_center = _blastTextQueue[i].center; + _charset->setColor(_blastTextQueue[i].color); + _charset->_disableOffsX = _charset->_firstChar = true; + _charset->setCurID(_blastTextQueue[i].charset); + _charset->_nextLeft = _blastTextQueue[i].xpos; + _charset->_nextTop = _blastTextQueue[i].ypos; + + // Center text if necessary + if (_charset->_center) { + _charset->_nextLeft -= _charset->getStringWidth(0, buf) >> 1; + if (_charset->_nextLeft < 0) + _charset->_nextLeft = 0; + } + + do { + c = *buf++; + if (c != 0 && c != 0xFF) { + _charset->_left = _charset->_nextLeft; + _charset->_top = _charset->_nextTop; + _charset->printChar(c); + _charset->_nextLeft = _charset->_left; + _charset->_nextTop = _charset->_top; + } + } while (c); + + _blastTextQueue[i].rect = _charset->_str; + } + _charset->_ignoreCharsetMask = false; +} + +void Scumm::removeBlastTexts() { + int i; + + for (i = 0; i < _blastTextQueuePos; i++) { + restoreBG(_blastTextQueue[i].rect); + } + _blastTextQueuePos = 0; +} + int indexCompare(const void *p1, const void *p2) { const LangIndexNode *i1 = (const LangIndexNode *) p1; const LangIndexNode *i2 = (const LangIndexNode *) p2; |