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
This commit is contained in:
parent
749d75cdcb
commit
71bbdbfae4
5 changed files with 16 additions and 45 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue