Example #1
0
 private void ExtractLightData(BinaryReader reader)
 {
     reader.BaseStream.Seek(this.lightOffset, SeekOrigin.Begin);
     for (Int32 i = 0; i < (Int32)this.lightCount; i++)
     {
         BGLIGHT_DEF bGLIGHT_DEF = new BGLIGHT_DEF();
         bGLIGHT_DEF.ReadData(reader);
         this.lightList.Add(bGLIGHT_DEF);
     }
 }
Example #2
0
        public TileMap(int fieldMapNumber, List <Layer> layers, List <BGOVERLAY_DEF> overlayList, List <BGANIM_DEF> animList, List <BGLIGHT_DEF> lightList, int cameraIndex, uint factor)
        {
            Int32 minX, minY, maxX, maxY;

            TileMap.GetBounds(overlayList, cameraIndex, out minX, out minY, out maxX, out maxY);
            this.MinX       = minX;
            this.MinY       = minY;
            this.SizeX      = (maxX - minX) / 16 + 1;
            this.SizeY      = (maxY - minY) / 16 + 1;
            _fieldMapNumber = fieldMapNumber;
            _cameraIndex    = cameraIndex;
            _overlays       = new Dictionary <int, Overlay>();
            _animList       = animList;
            _lightList      = lightList;

            bool[] animationArray = new bool[overlayList.Count];
            for (var m = 0; m < animList.Count; m++)
            {
                BGANIM_DEF animation = animList[m];
                for (var n = 0; n < animation.frameList.Count; n++)
                {
                    int index = animation.frameList[n].target;
                    animationArray[index] = true;
                }
            }
            for (var m = 0; m < lightList.Count; m++)
            {
                BGLIGHT_DEF lightDef = lightList[m];
            }
            for (int i = 0; i < overlayList.Count; i++)
            {
                BGOVERLAY_DEF info = overlayList[i];
                if (info.camNdx != _cameraIndex)
                {
                    continue;
                }
                Layer   layer         = layers[i];
                bool    animationFlag = animationArray[i];
                bool    isLight       = false;
                Overlay overlay       = new Overlay(CopyBytesHelper.GetImageData(layer, info, factor), info, i, this.SizeX, this.SizeY, minX, minY, maxX, maxY, animationFlag);
                _overlays[i] = overlay;
            }

            TDMap = new TileDepthMap(_overlays, this.SizeX, this.SizeY);
        }