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 | |
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')
-rw-r--r-- | scumm/script_v6.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 68 | ||||
-rw-r--r-- | scumm/scumm.h | 2 | ||||
-rw-r--r-- | scumm/string.cpp | 66 |
4 files changed, 69 insertions, 69 deletions
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index ceab65697f..2a87fff543 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -2479,7 +2479,7 @@ void Scumm_v6::o6_kernelSetFunctions() { break; case 16: case 17:{ - byte *message = getStringAddressVar(VAR_STRING2DRAW); + const byte *message = getStringAddressVar(VAR_STRING2DRAW); if (_gameId == GID_DIG) { byte buf_input[300], buf_output[300], buf_trans[300], *ptr = buf_input; char *t_ptr = (char *)ptr; diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index c26a6ac3de..171b56e64b 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -546,79 +546,13 @@ void Scumm_v8::decodeParseString(int m, int n) { } break; // case 0xD2: // SO_PRINT_WRAP Set print wordwrap -// error("decodeParseString: SO_PRINT_MUMBLE"); +// error("decodeParseString: SO_PRINT_WRAP"); // break; default: error("decodeParseString: default case 0x%x", b); } } -void Scumm::enqueueText(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; -} - void Scumm_v8::o8_mod() { int a = pop(); push(pop() % a); diff --git a/scumm/scumm.h b/scumm/scumm.h index a0912a5d7b..2ac5feac38 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -911,7 +911,7 @@ protected: int _blastTextQueuePos; BlastText _blastTextQueue[32]; // FIXME - how many blast texts can there be at once? - void enqueueText(byte *text, int x, int y, byte color, byte charset, bool center); + void enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center); void drawBlastTexts(); void removeBlastTexts(); 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; |