protected void FadeOut(int effect)
{
_mainVirtScreen.SetDirtyRange(0, 0);
if (Game.Version < 7)
Camera.LastPosition.X = Camera.CurrentPosition.X;
if (Game.Version == 3 && _game.Platform == Platform.FMTowns)
Gdi.Fill(TextSurface,
new Rect(0, MainVirtScreen.TopLine * _textSurfaceMultiplier,
_textSurface.Pitch, (MainVirtScreen.TopLine + MainVirtScreen.Height) * _textSurfaceMultiplier), 0);
if ((Game.Version == 7 || _screenEffectFlag) && effect != 0)
{
// Fill screen 0 with black
var pixNav = new PixelNavigator(_mainVirtScreen.Surfaces[0]);
pixNav.OffsetX(_mainVirtScreen.XStart);
Gdi.Fill(pixNav, 0, _mainVirtScreen.Width, _mainVirtScreen.Height);
// Fade to black with the specified effect, if any.
switch (effect)
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
DoTransitionEffect(effect - 1);
break;
case 128:
UnkScreenEffect6();
break;
case 129:
// Just blit screen 0 to the display (i.e. display will be black)
_mainVirtScreen.SetDirtyRange(0, _mainVirtScreen.Height);
UpdateDirtyScreen(_mainVirtScreen);
if (_townsScreen != null)
_townsScreen.Update();
break;
default:
throw new NotImplementedException(string.Format("fadeOut: case {0}", effect));
}
}
// Update the palette at the end (once we faded to black) to avoid
// some nasty effects when the palette is changed
UpdatePalette();
_screenEffectFlag = false;
}