SCI: Add a workaround for the large text boxes in Freddy Pharkas CD

Fixes bug #3575276 - "SCI: Freddy Pharkas: Text sometimes drawn/erased
incorrectly"
This commit is contained in:
Filippos Karapetis 2012-10-08 22:37:47 +03:00
parent 25bf42516c
commit a73e3f44ad

View File

@ -380,17 +380,50 @@ Window *GfxPorts::addWindow(const Common::Rect &dims, const Common::Rect *restor
int16 oldtop = pwnd->dims.top;
int16 oldleft = pwnd->dims.left;
if (wmprect.top > pwnd->dims.top)
// WORKAROUND: We also adjust the restore rect when adjusting the window
// rect.
// SSCI does not do this. It wasn't necessary in the original interpreter,
// but it is needed for Freddy Pharkas CD. This version does not normally
// have text, but we allow this by modifying the text/speech setting
// according to what is set in the ScummVM GUI (refer to syncIngameAudioOptions()
// in sci.cpp). Since the text used in Freddy Pharkas CD is quite large in
// some cases, it ends up being offset in order to fit inside the screen,
// but the associated restore rect isn't adjusted accordingly, leading to
// artifacts being left on screen when some text boxes are removed. The
// fact that the restore rect wasn't ever adjusted doesn't make sense, and
// adjusting it shouldn't have any negative side-effects (it *should* be
// adjusted, normally, but SCI doesn't do it). The big text boxes are still
// odd-looking, because the text rect is drawn outside the text window rect,
// but at least there aren't any leftover textbox artifacts left when the
// boxes are removed. Adjusting the text window rect would require more
// invasive changes than this one, thus it's not really worth the effort
// for a feature that was not present in the original game, and its
// implementation is buggy in the first place.
// Adjusting the restore rect properly fixes bug #3575276.
if (wmprect.top > pwnd->dims.top) {
pwnd->dims.moveTo(pwnd->dims.left, wmprect.top);
if (restoreRect)
pwnd->restoreRect.moveTo(pwnd->restoreRect.left, wmprect.top);
}
if (wmprect.bottom < pwnd->dims.bottom)
if (wmprect.bottom < pwnd->dims.bottom) {
pwnd->dims.moveTo(pwnd->dims.left, wmprect.bottom - pwnd->dims.bottom + pwnd->dims.top);
if (restoreRect)
pwnd->restoreRect.moveTo(pwnd->restoreRect.left, wmprect.bottom - pwnd->restoreRect.bottom + pwnd->restoreRect.top);
}
if (wmprect.right < pwnd->dims.right)
if (wmprect.right < pwnd->dims.right) {
pwnd->dims.moveTo(wmprect.right + pwnd->dims.left - pwnd->dims.right, pwnd->dims.top);
if (restoreRect)
pwnd->restoreRect.moveTo(wmprect.right + pwnd->restoreRect.left - pwnd->restoreRect.right, pwnd->restoreRect.top);
}
if (wmprect.left > pwnd->dims.left)
if (wmprect.left > pwnd->dims.left) {
pwnd->dims.moveTo(wmprect.left, pwnd->dims.top);
if (restoreRect)
pwnd->restoreRect.moveTo(wmprect.left, pwnd->restoreRect.top);
}
pwnd->rect.moveTo(pwnd->rect.left + pwnd->dims.left - oldleft, pwnd->rect.top + pwnd->dims.top - oldtop);