예제 #1
0
        void DecodeFrameObject(int codec, byte[] src, int left, int top, int width, int height)
        {
            if ((height == 242) && (width == 384))
            {
                if (_specialBuffer == null)
                    _specialBuffer = new byte[242 * 384];
                _dst = _specialBuffer;
            }
            else if ((height > _vm.ScreenHeight) || (width > _vm.ScreenWidth))
                return;
            // FT Insane uses smaller frames to draw overlays with moving objects
            // Other .san files do have them as well but their purpose in unknown
            // and often it causes memory overdraw. So just skip those frames
            else if (!_insanity && ((height != _vm.ScreenHeight) || (width != _vm.ScreenWidth)))
                return;

            if ((height == 242) && (width == 384))
            {
                _width = width;
                _height = height;
            }
            else
            {
                _width = _vm.ScreenWidth;
                _height = _vm.ScreenHeight;
            }

            switch (codec)
            {
                case 1:
                case 3:
                    SmushDecodeCodec1(_dst, 0, src, 0, left, top, width, height, _vm.ScreenWidth);
                    break;
                case 37:
                    if (_codec37 == null)
                        _codec37 = new Codec37Decoder(width, height);
                    _codec37.Decode(_dst, src);
                    break;
                case 47:
                    if (_codec47 == null)
                        _codec47 = new Codec47Decoder(width, height);
                    _codec47.Decode(_dst, src);
                    break;
                default:
                    throw new InvalidOperationException(string.Format("Invalid codec for frame object : {0}", codec));
            }

            if (_storeFrame)
            {
                if (_frameBuffer == null)
                {
                    _frameBuffer = new byte[_width * _height];
                }
                Array.Copy(_dst, _frameBuffer, width * height);
                _storeFrame = false;
            }
        }
예제 #2
0
        void DecodeFrameObject(int codec, byte[] src, int left, int top, int width, int height)
        {
            if ((height == 242) && (width == 384))
            {
                if (_specialBuffer == null)
                {
                    _specialBuffer = new byte[242 * 384];
                }
                _dst = _specialBuffer;
            }
            else if ((height > _vm.ScreenHeight) || (width > _vm.ScreenWidth))
            {
                return;
            }
            // FT Insane uses smaller frames to draw overlays with moving objects
            // Other .san files do have them as well but their purpose in unknown
            // and often it causes memory overdraw. So just skip those frames
            else if (!_insanity && ((height != _vm.ScreenHeight) || (width != _vm.ScreenWidth)))
            {
                return;
            }

            if ((height == 242) && (width == 384))
            {
                _width  = width;
                _height = height;
            }
            else
            {
                _width  = _vm.ScreenWidth;
                _height = _vm.ScreenHeight;
            }

            switch (codec)
            {
            case 1:
            case 3:
                SmushDecodeCodec1(_dst, 0, src, 0, left, top, width, height, _vm.ScreenWidth);
                break;

            case 37:
                if (_codec37 == null)
                {
                    _codec37 = new Codec37Decoder(width, height);
                }
                _codec37.Decode(_dst, src);
                break;

            case 47:
                if (_codec47 == null)
                {
                    _codec47 = new Codec47Decoder(width, height);
                }
                _codec47.Decode(_dst, src);
                break;

            default:
                throw new InvalidOperationException(string.Format("Invalid codec for frame object : {0}", codec));
            }

            if (_storeFrame)
            {
                if (_frameBuffer == null)
                {
                    _frameBuffer = new byte[_width * _height];
                }
                Array.Copy(_dst, _frameBuffer, width * height);
                _storeFrame = false;
            }
        }