protected void RedefineBuiltinCursorFromChar(int index, int chr)
{
// Cursor image in both Loom versions are based on images from charset.
// This function is *only* supported for Loom!
if (_game.GameId != Scumm.IO.GameId.Loom)
throw new NotSupportedException("RedefineBuiltinCursorFromChar is *only* supported for Loom!");
if (index < 0 || index >= 4)
throw new ArgumentException("index");
// const int oldID = _charset->getCurID();
var ptr = _cursorImages[index];
if (_game.Version == 3)
{
_charset.SetCurID(0);
}
else if (_game.Version >= 4)
{
_charset.SetCurID(1);
}
var s = new Surface(_charset.GetCharWidth(chr), _charset.GetFontHeight(), PixelFormat.Indexed8, false);
var p = new PixelNavigator(s);
Gdi.Fill(new PixelNavigator(s), 123, s.Width, s.Height);
_charset.DrawChar(chr, s, 0, 0);
Array.Clear(ptr, 0, ptr.Length);
for (int h = 0; h < s.Height; h++)
{
for (int w = 0; w < s.Width; w++)
{
p.GoTo(w, h);
if (p.Read() != 123)
{
ptr[h] |= (ushort)(1 << (15 - w));
}
}
}
// _charset->setCurID(oldID);
}