Cleanup; moving things around a bit

svn-id: r19961
This commit is contained in:
Max Horn 2006-01-10 00:34:13 +00:00
parent a3f6c5d112
commit 713a646409
5 changed files with 117 additions and 83 deletions

View File

@ -687,7 +687,7 @@ void ScummEngine::initBGBuffers(int height) {
// Resize main virtual screen in V7 games. This is necessary
// because in V7, rooms may be higher than one screen, so we have
// to accomodate for that.
initVirtScreen(kMainVirtScreen, virtscr[0].topline, _screenWidth, height, 1, 1);
initVirtScreen(kMainVirtScreen, virtscr[0].topline, _screenWidth, height, true, true);
}
if (_heversion >= 70)

View File

@ -88,10 +88,6 @@ struct VirtScreen : Graphics::Surface {
/**
* Vertical position of the virtual screen. Tells how much the virtual
* screen is shifted along the y axis relative to the real screen.
* If you wonder why there is no horizontal position: there is none,
* because all virtual screens are always exactly as wide as the
* real screen. This might change in the future to allow smooth
* horizontal scrolling in V7-V8 games.
*/
uint16 topline;
@ -103,8 +99,8 @@ struct VirtScreen : Graphics::Surface {
uint16 xstart;
/**
* Flag indicating which tells whether this screen has a back buffer or
* not. This is yet another feature which is only used by the main screen.
* Flag indicating whether this screen has a back buffer or not. This is
* yet another feature which is only used by the main screen.
* Strictly spoken one could remove this variable and replace checks
* on it with checks on backBuf. But since some code needs to temporarily
* disable the backBuf (so it can abuse drawBitmap; see drawVerbBitmap()

View File

@ -2818,7 +2818,7 @@ void ScummEngine_v5::o5_oldRoomEffect() {
int byte_2FCCF = 0;
// For now, we force a redraw of the screen background. This
// Makes the Zak end credits work more or less correctly.
// way the Zak end credits seem to work mostly correct.
VirtScreen *vs = &virtscr[0];
restoreBG(Common::Rect(0,vs->topline, vs->w, vs->topline + vs->h));
vs->setDirtyRange(0, vs->h);

View File

@ -36,6 +36,13 @@
namespace Scumm {
#pragma mark -
#pragma mark --- "High level" message code ---
#pragma mark -
void ScummEngine::printString(int m, const byte *msg) {
switch (m) {
case 0:
@ -95,6 +102,95 @@ void ScummEngine::showMessageDialog(const byte *msg) {
VAR(VAR_KEYPRESS) = runDialog(dialog);
}
#pragma mark -
#pragma mark --- V6 blast text queue code ---
#pragma mark -
void ScummEngine_v6::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) {
BlastText &bt = _blastTextQueue[_blastTextQueuePos++];
assert(_blastTextQueuePos <= ARRAYSIZE(_blastTextQueue));
convertMessageToString(text, bt.text, sizeof(bt.text));
bt.xpos = x;
bt.ypos = y;
bt.color = color;
bt.charset = charset;
bt.center = center;
}
void ScummEngine_v6::drawBlastTexts() {
byte *buf;
int c;
int i;
for (i = 0; i < _blastTextQueuePos; i++) {
buf = _blastTextQueue[i].text;
_charset->_top = _blastTextQueue[i].ypos + _screenTop;
_charset->_right = _screenWidth - 1;
_charset->_center = _blastTextQueue[i].center;
_charset->setColor(_blastTextQueue[i].color);
_charset->_disableOffsX = _charset->_firstChar = true;
_charset->setCurID(_blastTextQueue[i].charset);
do {
_charset->_left = _blastTextQueue[i].xpos;
// Center text if necessary
if (_charset->_center) {
_charset->_left -= _charset->getStringWidth(0, buf) / 2;
if (_charset->_left < 0)
_charset->_left = 0;
}
do {
c = *buf++;
// FIXME: This is a workaround for bugs #864030 and #1399843:
// In COMI, some text contains ASCII character 11 = 0xB. It's
// not quite clear what it is good for; so for now we just ignore
// it, which seems to match the original engine (BTW, traditionally,
// this is a 'vertical tab').
if (c == 0x0B)
continue;
if (c != 0 && c != 0xFF && c != '\n') {
if (c & 0x80 && _useCJKMode) {
if (_language == Common::JA_JPN && !checkSJISCode(c)) {
c = 0x20; //not in S-JIS
} else {
c += *buf++ * 256;
}
}
_charset->printChar(c, true);
}
} while (c && c != '\n');
_charset->_top += _charset->getFontHeight();
} while (c);
_blastTextQueue[i].rect = _charset->_str;
}
}
void ScummEngine_v6::removeBlastTexts() {
int i;
for (i = 0; i < _blastTextQueuePos; i++) {
restoreBG(_blastTextQueue[i].rect);
}
_blastTextQueuePos = 0;
}
#pragma mark -
#pragma mark --- V7 subtitle queue code ---
#pragma mark -
#ifndef DISABLE_SCUMM_7_8
void ScummEngine_v7::processSubtitleQueue() {
for (int i = 0; i < _subtitleQueuePos; ++i) {
@ -135,6 +231,13 @@ void ScummEngine_v7::clearSubtitleQueue() {
}
#endif
#pragma mark -
#pragma mark --- Core message/subtitle code ---
#pragma mark -
bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) {
uint32 talk_sound_a = 0;
uint32 talk_sound_b = 0;
@ -817,6 +920,12 @@ int ScummEngine::convertStringMessage(byte *dst, int dstSize, int var) {
return 0;
}
#pragma mark -
#pragma mark --- Charset initialisation ---
#pragma mark -
#ifndef DISABLE_HE
void ScummEngine_v80he::initCharset(int charsetno) {
ScummEngine::initCharset(charsetno);
@ -843,82 +952,11 @@ void ScummEngine::initCharset(int charsetno) {
}
void ScummEngine_v6::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) {
BlastText &bt = _blastTextQueue[_blastTextQueuePos++];
assert(_blastTextQueuePos <= ARRAYSIZE(_blastTextQueue));
convertMessageToString(text, bt.text, sizeof(bt.text));
bt.xpos = x;
bt.ypos = y;
bt.color = color;
bt.charset = charset;
bt.center = center;
}
#pragma mark -
#pragma mark --- Translation/localization code ---
#pragma mark -
void ScummEngine_v6::drawBlastTexts() {
byte *buf;
int c;
int i;
for (i = 0; i < _blastTextQueuePos; i++) {
buf = _blastTextQueue[i].text;
_charset->_top = _blastTextQueue[i].ypos + _screenTop;
_charset->_right = _screenWidth - 1;
_charset->_center = _blastTextQueue[i].center;
_charset->setColor(_blastTextQueue[i].color);
_charset->_disableOffsX = _charset->_firstChar = true;
_charset->setCurID(_blastTextQueue[i].charset);
do {
_charset->_left = _blastTextQueue[i].xpos;
// Center text if necessary
if (_charset->_center) {
_charset->_left -= _charset->getStringWidth(0, buf) / 2;
if (_charset->_left < 0)
_charset->_left = 0;
}
do {
c = *buf++;
// FIXME: This is a workaround for bugs #864030 and #1399843:
// In COMI, some text contains ASCII character 11 = 0xB. It's
// not quite clear what it is good for; so for now we just ignore
// it, which seems to match the original engine (BTW, traditionally,
// this is a 'vertical tab').
if (c == 0x0B)
continue;
if (c != 0 && c != 0xFF && c != '\n') {
if (c & 0x80 && _useCJKMode) {
if (_language == Common::JA_JPN && !checkSJISCode(c)) {
c = 0x20; //not in S-JIS
} else {
c += *buf++ * 256;
}
}
_charset->printChar(c, true);
}
} while (c && c != '\n');
_charset->_top += _charset->getFontHeight();
} while (c);
_blastTextQueue[i].rect = _charset->_str;
}
}
void ScummEngine_v6::removeBlastTexts() {
int i;
for (i = 0; i < _blastTextQueuePos; i++) {
restoreBG(_blastTextQueue[i].rect);
}
_blastTextQueuePos = 0;
}
#ifndef DISABLE_SCUMM_7_8
static int indexCompare(const void *p1, const void *p2) {

View File

@ -723,7 +723,7 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) {
gdi.disableZBuffer();
twobufs = vs->hasTwoBuffers;
vs->hasTwoBuffers = 0;
vs->hasTwoBuffers = false;
xstrip = x / 8;
ydiff = y - vs->topline;