In V7/V8 games, use the blast text system to render verbs (this fixes bug #1208956, but certainly will cause new regressions ;-)

svn-id: r18267
This commit is contained in:
Max Horn 2005-05-26 16:39:40 +00:00
parent 97f03369ec
commit 6e42068c8b
4 changed files with 60 additions and 6 deletions

View file

@ -1298,6 +1298,8 @@ protected:
virtual void translateText(const byte *text, byte *trans_buff); virtual void translateText(const byte *text, byte *trans_buff);
virtual void loadLanguageBundle(); virtual void loadLanguageBundle();
void playSpeech(const byte *ptr); void playSpeech(const byte *ptr);
virtual void drawVerb(int verb, int mode);
}; };
class ScummEngine_v8 : public ScummEngine_v7 { class ScummEngine_v8 : public ScummEngine_v7 {

View file

@ -1475,7 +1475,7 @@ void ScummEngine_v8::o8_getObjectImageHeight() {
void ScummEngine_v8::o8_getStringWidth() { void ScummEngine_v8::o8_getStringWidth() {
int charset = pop(); int charset = pop();
int oldID = _charset->getCurID(); int oldID = _charset->getCurID();
int width; int width;
const byte *msg = _scriptPointer; const byte *msg = _scriptPointer;
byte transBuf[512]; byte transBuf[512];

View file

@ -830,7 +830,7 @@ protected:
void checkExecVerbs(); void checkExecVerbs();
void verbMouseOver(int verb); void verbMouseOver(int verb);
int findVerbAtPos(int x, int y) const; int findVerbAtPos(int x, int y) const;
void drawVerb(int verb, int mode); virtual void drawVerb(int verb, int mode);
void runInputScript(int a, int cmd, int mode); void runInputScript(int a, int cmd, int mode);
void restoreVerbBG(int verb); void restoreVerbBG(int verb);
void drawVerbBitmap(int verb, int x, int y); void drawVerbBitmap(int verb, int x, int y);

View file

@ -486,6 +486,61 @@ int ScummEngine::findVerbAtPos(int x, int y) const {
return 0; return 0;
} }
void ScummEngine_v7::drawVerb(int verb, int mode) {
VerbSlot *vs;
if (!verb)
return;
vs = &_verbs[verb];
if (!vs->saveid && vs->curmode && vs->verbid) {
if (vs->type == kImageVerbType) {
drawVerbBitmap(verb, vs->curRect.left, vs->curRect.top);
return;
}
uint8 color = vs->color;
if (vs->curmode == 2)
color = vs->dimcolor;
else if (mode && vs->hicolor)
color = vs->hicolor;
const byte *msg = getResourceAddress(rtVerb, verb);
if (!msg)
return;
// Convert the message, and skip a few remaining 0xFF codes (they
// occur in FT; subtype 10, which is used for the speech associated
// with the string).
byte buf[384];
convertMessageToString(msg, buf, sizeof(buf));
msg = buf;
while (*msg == 0xFF)
msg += 4;
enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
// Set the specified charset id
_charset->setCurID(vs->charset_nr);
// Compute the text rect
vs->curRect.right = 0;
vs->curRect.bottom = 0;
while (*msg) {
const int charWidth = _charset->getCharWidth(*msg);
const int charHeight = _charset->getCharHeight(*msg);
vs->curRect.right += charWidth;
if (vs->curRect.bottom < charHeight)
vs->curRect.bottom = charHeight;
msg++;
}
vs->curRect.right += vs->curRect.left;
vs->curRect.bottom += vs->curRect.top;
vs->oldRect = vs->curRect;
}
}
void ScummEngine::drawVerb(int verb, int mode) { void ScummEngine::drawVerb(int verb, int mode) {
VerbSlot *vs; VerbSlot *vs;
bool tmp; bool tmp;
@ -527,7 +582,6 @@ void ScummEngine::drawVerb(int verb, int mode) {
return; return;
tmp = _charset->_center; tmp = _charset->_center;
_charset->_center = 0;
drawString(4, msg); drawString(4, msg);
_charset->_center = tmp; _charset->_center = tmp;
@ -546,9 +600,7 @@ void ScummEngine::restoreVerbBG(int verb) {
vs = &_verbs[verb]; vs = &_verbs[verb];
if (_gameId == GID_FT) { if (vs->oldRect.left != -1) {
restoreBG(vs->curRect, vs->bkcolor);
} else if (vs->oldRect.left != -1) {
restoreBG(vs->oldRect, vs->bkcolor); restoreBG(vs->oldRect, vs->bkcolor);
vs->oldRect.left = -1; vs->oldRect.left = -1;
} }