Exemple #1
0
        void RemoveBlastObject(BlastObject eo)
        {
            var vs = MainVirtScreen;

            int left_strip, right_strip;

            var r = eo.Rect;

            r.Clip(vs.Width, vs.Height);

            if (r.Width <= 0 || r.Height <= 0)
            {
                return;
            }

            left_strip  = r.Left / 8;
            right_strip = (r.Right + (vs.XStart % 8)) / 8;

            if (left_strip < 0)
            {
                left_strip = 0;
            }
            if (right_strip > Gdi.NumStrips - 1)
            {
                right_strip = Gdi.NumStrips - 1;
            }
            for (var i = left_strip; i <= right_strip; i++)
            {
                Gdi.ResetBackground(r.Top, r.Bottom, i);
            }

            MarkRectAsDirty(MainVirtScreen, r, Gdi.UsageBitRestored);
        }
 static BlastObject[] CreateBlastObjects()
 {
     var blastObjects = new BlastObject[200];
     for (int i = 0; i < blastObjects.Length; i++)
     {
         blastObjects[i] = new BlastObject();
     }
     return blastObjects;
 }
Exemple #3
0
        static BlastObject[] CreateBlastObjects()
        {
            var blastObjects = new BlastObject[200];

            for (int i = 0; i < blastObjects.Length; i++)
            {
                blastObjects[i] = new BlastObject();
            }
            return(blastObjects);
        }
Exemple #4
0
        void DrawBlastObject(BlastObject eo)
        {
            var objnum = GetObjectIndex(eo.Number);

            if (objnum == -1)
            {
                throw new NotSupportedException(string.Format("DrawBlastObject: GetObjectIndex on BlastObject {0} failed", eo.Number));
            }

            if (_objs[objnum].Images.Count == 0)
            {
                return;
            }

            var index = eo.Image >= _objs[objnum].Images.Count ? 0 : eo.Image < 0 ? 0 : eo.Image;
            var img   = _objs[objnum].Images[index];

            if (!img.IsBomp)
            {
                throw new NotSupportedException(string.Format("object {0} is not a blast object", eo.Number));
            }

            var bdd = new BompDrawData();

            bdd.Src = img.Data;
            bdd.Dst = new PixelNavigator(MainVirtScreen.Surfaces[0]);
            bdd.Dst.GoTo(MainVirtScreen.XStart, 0);
            bdd.X = eo.Rect.Left;
            bdd.Y = eo.Rect.Top;

            bdd.Width  = _objs[objnum].Width;
            bdd.Height = _objs[objnum].Height;

            bdd.ScaleX = eo.ScaleX;
            bdd.ScaleY = eo.ScaleY;

            if ((bdd.ScaleX != 255) || (bdd.ScaleY != 255))
            {
                bdd.ShadowMode = 0;
            }
            else
            {
                bdd.ShadowMode = eo.Mode;
            }
            bdd.ShadowPalette = _shadowPalette;

            bdd.DrawBomp();

            MarkRectAsDirty(MainVirtScreen, new Rect(bdd.X, bdd.X + bdd.Width, bdd.Y, bdd.Y + bdd.Height));
        }
        void DrawBlastObject(BlastObject eo)
        {
            var objnum = GetObjectIndex(eo.Number);
            if (objnum == -1)
                throw new NotSupportedException(string.Format("DrawBlastObject: GetObjectIndex on BlastObject {0} failed", eo.Number));

            if (_objs[objnum].Images.Count == 0)
                return;

            var index = eo.Image >= _objs[objnum].Images.Count ? 0 : eo.Image < 0 ? 0 : eo.Image;
            var img = _objs[objnum].Images[index];

            if (!img.IsBomp)
                throw new NotSupportedException(string.Format("object {0} is not a blast object", eo.Number));

            var bdd = new BompDrawData();
            bdd.Src = img.Data;
            bdd.Dst = new PixelNavigator(MainVirtScreen.Surfaces[0]);
            bdd.Dst.GoTo(MainVirtScreen.XStart, 0);
            bdd.X = eo.Rect.Left;
            bdd.Y = eo.Rect.Top;

            bdd.Width = _objs[objnum].Width;
            bdd.Height = _objs[objnum].Height;

            bdd.ScaleX = eo.ScaleX;
            bdd.ScaleY = eo.ScaleY;

            if ((bdd.ScaleX != 255) || (bdd.ScaleY != 255))
            {
                bdd.ShadowMode = 0;
            }
            else
            {
                bdd.ShadowMode = eo.Mode;
            }
            bdd.ShadowPalette = _shadowPalette;

            bdd.DrawBomp();

            MarkRectAsDirty(MainVirtScreen, new Rect(bdd.X, bdd.X + bdd.Width, bdd.Y, bdd.Y + bdd.Height));
        }
        void RemoveBlastObject(BlastObject eo)
        {
            var vs = MainVirtScreen;

            int left_strip, right_strip;

            var r = eo.Rect;

            r.Clip(vs.Width, vs.Height);

            if (r.Width <= 0 || r.Height <= 0)
                return;

            left_strip = r.Left / 8;
            right_strip = (r.Right + (vs.XStart % 8)) / 8;

            if (left_strip < 0)
                left_strip = 0;
            if (right_strip > Gdi.NumStrips - 1)
                right_strip = Gdi.NumStrips - 1;
            for (var i = left_strip; i <= right_strip; i++)
                Gdi.ResetBackground(r.Top, r.Bottom, i);

            MarkRectAsDirty(MainVirtScreen, r, Gdi.UsageBitRestored);
        }