void Struct10Setup(Struct10 s10)
{
int b, c, d, e, f, g, h;
byte t;
b = s10.Unk3;
f = s10.Active - 1;
t = s10.TableA[f];
e = numStepsTable[volumeLookupTable[t & 0x7F, b]];
if ((t & 0x80) != 0)
{
e = RandomNr(e);
}
if (e == 0)
e++;
s10.NumSteps = s10.SpeedLoMax = (ushort)e;
if (f != 2)
{
c = s10.MaxValue;
g = s10.StartValue;
t = s10.TableB[f];
d = LookupVolume(c, (t & 0x7F) - 31);
if ((t & 0x80) != 0)
{
d = RandomNr(d);
}
if (d + g > c)
{
h = c - g;
}
else
{
h = d;
if (d + g < 0)
h = -g;
}
h -= s10.CurVal;
}
else
{
h = 0;
}
s10.SpeedHi = (short)(h / e);
if (h < 0)
{
h = -h;
s10.Direction = -1;
}
else
{
s10.Direction = 1;
}
s10.SpeedLo = (ushort)(h % e);
s10.SpeedLoCounter = 0;
}