protected void RedrawBGAreas()
{
if (_game.GameId != GameId.Pass && _game.Version >= 4 && _game.Version <= 6)
{
// Starting with V4 games (with the exception of the PASS demo), text
// is drawn over the game graphics (as opposed to be drawn in a
// separate region of the screen). So, when scrolling in one of these
// games (pre-new camera system), if actor text is visible (as indicated
// by the _hasMask flag), we first remove it before proceeding.
if (_camera.CurrentPosition.X != _camera.LastPosition.X && _charset.HasMask)
{
StopTalk();
}
}
// Redraw parts of the background which are marked as dirty.
if (!_fullRedraw && _bgNeedsRedraw)
{
for (int i = 0; i != Gdi.NumStrips; i++)
{
if (Gdi.TestGfxUsageBit(_screenStartStrip + i, Gdi.UsageBitDirty))
{
RedrawBGStrip(i, 1);
}
}
}
int val = 0;
if (_game.Version >= 7)
{
var diff = Camera.CurrentPosition.X / 8 - Camera.LastPosition.X / 8;
if (_fullRedraw || Math.Abs(diff) >= Gdi.NumStrips)
{
_bgNeedsRedraw = false;
RedrawBGStrip(0, Gdi.NumStrips);
}
else if (diff > 0)
{
val = -diff;
RedrawBGStrip(Gdi.NumStrips - diff, diff);
}
else if (diff < 0)
{
val = -diff;
RedrawBGStrip(0, -diff);
}
}
else
{
var diff = _camera.CurrentPosition.X - _camera.LastPosition.X;
if (!_fullRedraw && diff == 8)
{
val = -1;
RedrawBGStrip(Gdi.NumStrips - 1, 1);
}
else if (!_fullRedraw && diff == -8)
{
val = +1;
RedrawBGStrip(0, 1);
}
else if (_fullRedraw || diff != 0)
{
if (Game.Version <= 5)
{
ClearFlashlight();
}
_bgNeedsRedraw = false;
RedrawBGStrip(0, Gdi.NumStrips);
}
}
DrawRoomObjects(val);
_bgNeedsRedraw = false;
}