Community
SCI Programming => SCI Development Tools => Topic started by: lskovlun on May 05, 2021, 01:38:33 PM

So today I learned why Sierra's DISSOLVE algorithm (aka dpOPEN_CHECKBOARD) works. Shame on me for not realizing earlier, but I'm not a graphics guy. It is described here in terms of Wolfenstein 3D, but it is easy to see that it is the same thing.
https://fabiensanglard.net/fizzlefade/index.php

Similar in technique, at least. You be the judge exactly how similar.
word i, j, x, y, rand = 1234;
rand &= RANDMASK; //#define RANDMASK 0x240
for (j = 0; j < 64; j++)
{
for (i = 0; i < 16; i++)
{
if (rand & 1)
rand = (rand / 2) ^ RANDMASK;
else
rand /= 2;
x = rand % 40;
y = rand / 40;
//reveal or black out rect (x * 8, y * 8, (x * 8) + 8, (y * 8) + 8)
}
}
long rndval = 1;
short x, y;
do
{
y = rndval & 0x000FF; //Y = low 8 bits
x = (rndval & 0x1FF00) >> 8; //X = High 9 bits
unsigned lsb = rndval & 1;
rndval >>= 1;
if (lsb) rndval ^= 0x00012000;
//black out pixel (x, y)
} while (rndval != 1);