moved blast text code to string.cpp

svn-id: r8282
This commit is contained in:
Max Horn 2003-06-02 23:18:52 +00:00
parent 457d6b1484
commit 35f29951eb
4 changed files with 69 additions and 69 deletions

View File

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

View File

@ -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);

View File

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

View File

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