void DoTransitionEffect(int a)
{
int[] delta = new int[16]; // Offset applied during each iteration
int[] tab_2 = new int[16];
int i, j;
int bottom;
int l, t, r, b;
var height = Math.Min(MainVirtScreen.Height, ScreenHeight);
var delay = VariableFadeDelay.HasValue ? Variables[VariableFadeDelay.Value] * FadeDelay : PictureDelay;
for (i = 0; i < 16; i++)
{
delta[i] = transitionEffects[a].deltaTable[i];
j = transitionEffects[a].stripTable[i];
if (j == 24)
j = height / 8 - 1;
tab_2[i] = j;
}
bottom = height / 8;
for (j = 0; j < transitionEffects[a].numOfIterations; j++)
{
for (i = 0; i < 4; i++)
{
l = tab_2[i * 4];
t = tab_2[i * 4 + 1];
r = tab_2[i * 4 + 2];
b = tab_2[i * 4 + 3];
if (t == b)
{
while (l <= r)
{
if (l >= 0 && l < Gdi.NumStrips && t < bottom)
{
MainVirtScreen.TDirty[l] = ScreenTop + t * 8;
MainVirtScreen.BDirty[l] = ScreenTop + (b + 1) * 8;
}
l++;
}
}
else
{
if (l < 0 || l >= Gdi.NumStrips || b <= t)
continue;
if (b > bottom)
b = bottom;
if (t < 0)
t = 0;
MainVirtScreen.TDirty[l] = ScreenTop + t * 8;
MainVirtScreen.BDirty[l] = ScreenTop + (b + 1) * 8;
}
UpdateDirtyScreen(MainVirtScreen);
}
for (i = 0; i < 16; i++)
tab_2[i] += delta[i];
// Draw the current state to the screen and wait a few secs so the
// user can watch the effect taking place.
WaitForTimer(delay);
}
}