Ejemplo n.º 1
0
        private void ProcessLoadedTiles()
        {
            MapArea data  = null;
            var     index = 0;

            lock (mLoadedData)
            {
                if (mLoadedData.Count > 0)
                {
                    data = mLoadedData[0];
                    mLoadedData.RemoveAt(0);
                    index = data.IndexX + data.IndexY * 0xFF;
                    if (mAreas.ContainsKey(index))
                    {
                        data.Dispose();
                        return;
                    }
                }
            }

            if (data == null)
            {
                return;
            }

            var tile = new MapAreaRender(data.IndexX, data.IndexY);

            tile.AsyncLoaded(data);
            mAreas.Add(index, tile);
        }
Ejemplo n.º 2
0
        public void OnAsyncLoad(IO.Files.Terrain.MapChunk chunk, MapAreaRender parent)
        {
            mData        = chunk;
            mBoundingBox = chunk.BoundingBox;
            mModelBox    = chunk.ModelBox;
            mReferences  = new M2Instance[chunk.DoodadReferences.Length];
            for (var i = 0; i < mReferences.Length; ++i)
            {
                mReferences[i] = parent.AreaFile.DoodadInstances[chunk.DoodadReferences[i]];
            }

            for (var i = 0; i < mData.Layers.Length; ++i)
            {
                if ((mData.Layers[i].Flags & 0x40) != 0)
                {
                    mHasTexAnim = true;

                    var rotation = 0.0f;
                    if ((mData.Layers[i].Flags & 1) != 0)
                    {
                        rotation += (float)Math.PI / 4.0f;
                    }
                    if ((mData.Layers[i].Flags & 2) != 0)
                    {
                        rotation += (float)Math.PI / 2.0f;
                    }
                    if ((mData.Layers[i].Flags & 4) != 0)
                    {
                        rotation += (float)Math.PI;
                    }

                    var matrix = Matrix.RotationZ(rotation);
                    var dir    = Vector2.TransformCoordinate(new Vector2(0, 1), matrix);
                    mTexAnimDirections[i] = dir;

                    mTexAnimDirections[i].Normalize();
                    if ((mData.Layers[i].Flags & 8) != 0)
                    {
                        mTexAnimDirections[i] *= 1.2f;
                    }
                    else if ((mData.Layers[i].Flags & 0x10) != 0)
                    {
                        mTexAnimDirections[i] *= 1.44f;
                    }
                    else if ((mData.Layers[i].Flags & 0x20) != 0)
                    {
                        mTexAnimDirections[i] *= 1.728f;
                    }
                }
            }

            mIsAsyncLoaded = true;
            mParent        = new WeakReference <MapAreaRender>(parent);
        }
Ejemplo n.º 3
0
        public void OnAsyncLoad(IO.Files.Terrain.MapChunk chunk, MapAreaRender parent)
        {
            mData        = chunk;
            mBoundingBox = chunk.BoundingBox;
            mModelBox    = chunk.ModelBox;
            mReferences  = new M2Instance[chunk.DoodadReferences.Length];
            for (var i = 0; i < mReferences.Length; ++i)
            {
                mReferences[i] = parent.AreaFile.DoodadInstances[chunk.DoodadReferences[i]];
            }

            mAsyncLoaded = true;
        }
Ejemplo n.º 4
0
        private void ProcessLoadedTiles()
        {
            lock (mLoadedData)
            {
                foreach (var data in mLoadedData)
                {
                    var index = data.IndexX + data.IndexY * 0xFF;
                    if (mAreas.ContainsKey(index))
                    {
                        data.Dispose();
                        continue;
                    }

                    var tile = new MapAreaRender(data.IndexX, data.IndexY);
                    tile.AsyncLoaded(data);
                    mAreas.Add(index, tile);
                }

                mLoadedData.Clear();
            }
        }
Ejemplo n.º 5
0
        public void OnAsyncLoad(IO.Files.Terrain.MapChunk chunk, MapAreaRender parent)
        {
            mData = chunk;
            mBoundingBox = chunk.BoundingBox;
            mModelBox = chunk.ModelBox;
            mReferences = new M2Instance[chunk.DoodadReferences.Length];
            for (var i = 0; i < mReferences.Length; ++i)
                mReferences[i] = parent.AreaFile.DoodadInstances[chunk.DoodadReferences[i]];

            mAsyncLoaded = true;
        }
Ejemplo n.º 6
0
        private void ProcessLoadedTiles()
        {
            lock(mLoadedData)
            {
                foreach (var data in mLoadedData)
                {
                    var index = data.IndexX + data.IndexY * 0xFF;
                    if (mAreas.ContainsKey(index))
                    {
                        data.Dispose();
                        continue;
                    }

                    var tile = new MapAreaRender(data.IndexX, data.IndexY);
                    tile.AsyncLoaded(data);
                    mAreas.Add(index, tile);
                }

                mLoadedData.Clear();
            }
        }