aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2004-04-04 20:20:09 +0000
committerMax Horn2004-04-04 20:20:09 +0000
commit71bbdbfae41545f68713642bb9f395cb234bb60c (patch)
tree578af5fcad20139cd775a45ac10248dd1b8a2302 /scumm
parent749d75cdcbfe0dfc9aa73e37648d81e28ecb7098 (diff)
downloadscummvm-rg350-71bbdbfae41545f68713642bb9f395cb234bb60c.tar.gz
scummvm-rg350-71bbdbfae41545f68713642bb9f395cb234bb60c.tar.bz2
scummvm-rg350-71bbdbfae41545f68713642bb9f395cb234bb60c.zip
Removed CharsetRenderer::_mask (this was used to optimize charset mask handling). This shouldn't cause any noticable slowdowns, but allows us to get rid of two nasty hacks, and fixes bug #895355 (DIG: Subtitles sometimes stay on the screen), maybe also others
svn-id: r13464
Diffstat (limited to 'scumm')
-rw-r--r--scumm/camera.cpp17
-rw-r--r--scumm/charset.h6
-rw-r--r--scumm/gfx.cpp23
-rw-r--r--scumm/saveload.cpp2
-rw-r--r--scumm/string.cpp13
5 files changed, 16 insertions, 45 deletions
diff --git a/scumm/camera.cpp b/scumm/camera.cpp
index d6e0b17b65..6411e7d202 100644
--- a/scumm/camera.cpp
+++ b/scumm/camera.cpp
@@ -338,23 +338,6 @@ void ScummEngine::cameraMoved() {
#else
virtscr[0].xstart = _screenStartStrip * 8;
#endif
-
- if (_charset->_hasMask && _version > 3) {
- int dx = camera._cur.x - camera._last.x;
- int dy = camera._cur.y - camera._last.y;
-
- // Fixes subtitle glitches during room scrolling in two cut scenes
- // When talking to Rusty for first time
- // When sleeping in straw at Blacksmith's Guild.
- if ((_gameId == GID_LOOM256 || _gameId == GID_PASS) && dx)
- _charset->_mask.left -= 8;
- else if (dx || dy) {
- _charset->_mask.left -= dx;
- _charset->_mask.right -= dx;
- _charset->_mask.top -= dy;
- _charset->_mask.bottom -= dy;
- }
- }
}
void ScummEngine::panCameraTo(int x, int y) {
diff --git a/scumm/charset.h b/scumm/charset.h
index 4a7e1009d9..95b6ee0178 100644
--- a/scumm/charset.h
+++ b/scumm/charset.h
@@ -33,12 +33,6 @@ struct VirtScreen;
class CharsetRenderer {
public:
- /**
- * Charset mask - rectangle covering the parts of the screen which are
- * currently (partially) masked.
- */
- Common::Rect _mask;
-
Common::Rect _str;
int _nextLeft, _nextTop;
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 75275c485e..a08c021aa7 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -608,10 +608,20 @@ void ScummEngine::restoreBG(Common::Rect rect, byte backColor) {
void CharsetRenderer::restoreCharsetBg() {
if (_hasMask) {
- _vm->restoreBG(_mask);
+ // Restore background on the whole text area. To do this, we simply
+ // pass a large rect to restoreBG, and then rely on it clipping that
+ // rect. Also, restoreBG() will use findVirtScreen(rect.top) to
+ // determine the virtual screen on which to operate. This is fine
+ // for us, since we pass in rect.top, so in older games, the text
+ // display area is used; in newer games, the main virtscreen gets
+ // restored. That's exactly what we need.
+ //
+ // Of course this will break down if one of the older games (with
+ // multiple virtual screens in use) draw text outside the text virtual
+ // screen (verbs are excluded, they are handled in a special fashion).
+ // But I have no indication that this does ever happen.
+ _vm->restoreBG(Common::Rect(5000, 5000));
_hasMask = false;
- _mask.top = _mask.left = 32767;
- _mask.right = _mask.bottom = 0;
_str.left = -1;
_left = -1;
}
@@ -622,14 +632,10 @@ void CharsetRenderer::restoreCharsetBg() {
void CharsetRenderer::clearCharsetMask() {
memset(_vm->getResourceAddress(rtBuffer, 9), 0, _vm->gdi._imgBufOffs[1]);
- _mask.top = _mask.left = 32767;
- _mask.right = _mask.bottom = 0;
}
bool CharsetRenderer::hasCharsetMask(int left, int top, int right, int bottom) {
- Common::Rect rect(left, top, right, bottom);
-
- return _hasMask && rect.intersects(_mask);
+ return _hasMask;
}
byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
@@ -1652,6 +1658,7 @@ void Gdi::draw8Col(byte *dst, const byte *src, int height) {
src += _vm->_screenWidth;
} while (--height);
}
+
void Gdi::clear8Col(byte *dst, int height)
{
do {
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index e174aadf4c..486542b104 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -265,8 +265,6 @@ bool ScummEngine::loadState(int slot, bool compat, SaveFileManager *mgr) {
_completeScreenRedraw = true;
// Reset charset mask
- _charset->_mask.top = _charset->_mask.left = 32767;
- _charset->_mask.right = _charset->_mask.bottom = 0;
_charset->_hasMask = false;
// With version 22, we replaced the scale items with scale slots. So when
diff --git a/scumm/string.cpp b/scumm/string.cpp
index 386173f84f..7853777494 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -142,10 +142,6 @@ void ScummEngine::CHARSET_1() {
for (i = 0; i < 4; i++)
_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
- if (_keepText) {
- _charset->_str = _charset->_mask;
- }
-
if (_talkDelay)
return;
@@ -166,12 +162,6 @@ void ScummEngine::CHARSET_1() {
if (!_keepText) {
if (_version <= 3 && _gameId != GID_LOOM) {
_charset->_hasMask = true;
- _charset->_mask.left = _string[0].xpos;
- _charset->_mask.top = _string[0].ypos;
- _charset->_mask.bottom = _string[0].ypos + 8;
- _charset->_mask.right = _screenWidth;
- if (_string[0].ypos <= 16) // If we are cleaning the text line, clean 2 lines.
- _charset->_mask.bottom = 16;
}
_charset->restoreCharsetBg();
}
@@ -321,9 +311,9 @@ void ScummEngine::CHARSET_1() {
_charsetBufPos = buffer - _charsetBuffer;
_charset->_hasMask = (_charset->_str.left != -1);
- _charset->_mask = _charset->_str;
}
+
void ScummEngine::drawString(int a, const byte *msg) {
byte buf[256];
byte *space;
@@ -450,7 +440,6 @@ void ScummEngine::drawString(int a, const byte *msg) {
if (_version >= 7) {
_charset->_hasMask = true;
- _charset->_mask.extend(_charset->_str);
}
}