示例#1
0
        private unsafe HuedTile[][][] GetTilesFromBlock(StaticTile *staticTiles, int count)
        {
            if (TileMatrix.m_Lists == null)
            {
                TileMatrix.m_Lists = new TileList[8][];
                for (int index1 = 0; index1 < 8; ++index1)
                {
                    TileMatrix.m_Lists[index1] = new TileList[8];
                    for (int index2 = 0; index2 < 8; ++index2)
                    {
                        TileMatrix.m_Lists[index1][index2] = new TileList();
                    }
                }
            }
            TileList[][] tileListArray  = TileMatrix.m_Lists;
            StaticTile * staticTilePtr1 = staticTiles;

            for (StaticTile *staticTilePtr2 = staticTiles + count; staticTilePtr1 < staticTilePtr2; ++staticTilePtr1)
            {
                tileListArray[(int)staticTilePtr1->x & 7][(int)staticTilePtr1->y & 7].Add(new HuedTile(*staticTilePtr1));
            }
            HuedTile[][][] huedTileArray = new HuedTile[8][][];
            for (int index1 = 0; index1 < 8; ++index1)
            {
                huedTileArray[index1] = new HuedTile[8][];
                for (int index2 = 0; index2 < 8; ++index2)
                {
                    huedTileArray[index1][index2] = tileListArray[index1][index2].ToArray();
                }
            }
            return(huedTileArray);
        }
示例#2
0
 private StaticItem(HuedTile tile, int influence, int serial)
 {
     this.m_ID            = (short)tile.itemId;
     this.m_Z             = tile.z;
     this.m_RealID        = this.m_ID;
     this.m_Hue           = Hues.GetItemHue((int)this.m_ID, (int)tile.hueId);
     this.m_Height        = Map.GetItemHeight(tile.itemId);
     this.m_SortInfluence = influence;
     this.Serial          = serial;
     this.m_vPool         = VertexConstructor.Create();
 }
示例#3
0
        public static StaticItem Instantiate(HuedTile tile, int influence, int serial)
        {
            if (StaticItem.m_InstancePool.Count <= 0)
            {
                return(new StaticItem(tile, influence, serial));
            }
            StaticItem staticItem = (StaticItem)StaticItem.m_InstancePool.Dequeue();

            staticItem.m_RealID        = (short)tile.itemId;
            staticItem.m_ID            = staticItem.m_RealID;
            staticItem.m_Z             = tile.z;
            staticItem.m_Hue           = Hues.GetItemHue((int)staticItem.m_ID, (int)tile.hueId);
            staticItem.m_Height        = Map.GetItemHeight(tile.itemId);
            staticItem.m_SortInfluence = influence;
            staticItem.Serial          = serial;
            staticItem.m_LastImage     = (Texture)null;
            staticItem.m_LastImageHue  = (IHue)null;
            staticItem.m_LastImageID   = (short)0;
            staticItem.m_fAlpha        = 0.0f;
            staticItem.m_bDraw         = false;
            staticItem.m_bInit         = false;
            return(staticItem);
        }
示例#4
0
        private static unsafe void Load(int x, int y, int w, int h, int world, Texture tex)
        {
            if (GRadar.m_Colors == null)
            {
                GRadar.LoadColors();
            }
            if (GRadar.m_StrongReferences == null || GRadar.m_StrongReferences.Length != w * h)
            {
                GRadar.m_StrongReferences = new MapBlock[w * h];
            }
            if (GRadar.m_Guarded == null || GRadar.m_Guarded.Length != w * h * 64)
            {
                GRadar.m_Guarded = new BitArray(w * h * 64);
            }
            else
            {
                GRadar.m_Guarded.SetAll(false);
            }
            Region[] guardedRegions = Region.GuardedRegions;
            int      num1           = x * 8;
            int      num2           = y * 8;
            int      num3           = w * 8;
            int      num4           = h * 8;

            for (int index1 = 0; index1 < guardedRegions.Length; ++index1)
            {
                Region      region = guardedRegions[index1];
                RegionWorld world1 = region.World;
                bool        flag   = false;
                switch (world1)
                {
                case RegionWorld.Britannia:
                    flag = world == 0 || world == 1;
                    break;

                case RegionWorld.Felucca:
                    flag = world == 0;
                    break;

                case RegionWorld.Trammel:
                    flag = world == 1;
                    break;

                case RegionWorld.Ilshenar:
                    flag = world == 2;
                    break;

                case RegionWorld.Malas:
                    flag = world == 3;
                    break;

                case RegionWorld.Tokuno:
                    flag = world == 4;
                    break;
                }
                if (flag)
                {
                    int num5 = region.X - num1;
                    int num6 = region.Y - num2;
                    if (num5 < num3 && num6 < num4 && (num5 > -region.Width && num6 > -region.Height))
                    {
                        int num7 = num5 + region.Width;
                        int num8 = num6 + region.Height;
                        if (num5 < 0)
                        {
                            num5 = 0;
                        }
                        if (num6 < 0)
                        {
                            num6 = 0;
                        }
                        for (int index2 = num5; index2 < num7 && index2 < num3; ++index2)
                        {
                            for (int index3 = num6; index3 < num8 && index3 < num4; ++index3)
                            {
                                GRadar.m_Guarded[index3 * num3 + index2] = true;
                            }
                        }
                    }
                }
            }
            TileMatrix matrix   = Map.GetMatrix(world);
            LockData   lockData = tex.Lock(LockFlags.WriteOnly);
            int        num9     = lockData.Pitch >> 1;

            fixed(short *numPtr1 = GRadar.m_Colors)
            {
                for (int index1 = 0; index1 < w; ++index1)
                {
                    short *numPtr2 = (short *)((IntPtr)lockData.pvSrc + (index1 << 3) * 2);
                    for (int index2 = 0; index2 < h; ++index2)
                    {
                        MapBlock block = matrix.GetBlock(x + index1, y + index2);
                        GRadar.m_StrongReferences[index2 * w + index1] = block;
                        HuedTile[][][] huedTileArray = block == null ? matrix.EmptyStaticBlock : block.m_StaticTiles;
                        Tile[]         tileArray     = block == null ? matrix.InvalidLandBlock : block.m_LandTiles;
                        int            index3        = 0;
                        int            num5          = 0;
                        while (index3 < 8)
                        {
                            for (int index4 = 0; index4 < 8; ++index4)
                            {
                                int num6   = -255;
                                int num7   = -255;
                                int index5 = 0;
                                int num8   = 0;
                                for (int index6 = 0; index6 < huedTileArray[index4][index3].Length; ++index6)
                                {
                                    HuedTile huedTile = huedTileArray[index4][index3][index6];
                                    int      num10    = 16384 + (int)huedTile.itemId;
                                    switch (num10)
                                    {
                                    case 16385:
                                    case 22422:
                                    case 24996:
                                    case 24984:
                                    case 25020:
                                    case 24985:
                                        goto case 16385;

                                    default:
                                        int num11 = (int)huedTile.z;
                                        int num12 = num11 + (int)Map.GetItemHeight(huedTile.itemId);
                                        if (num12 > num6 || num11 > num7 && num12 >= num6)
                                        {
                                            num6   = num12;
                                            num7   = num11;
                                            index5 = num10;
                                            num8   = (int)huedTile.hueId;
                                            goto case 16385;
                                        }
                                        else
                                        {
                                            goto case 16385;
                                        }
                                    }
                                }
                                if ((int)tileArray[num5 + index4].z > num6 && tileArray[num5 + index4].Visible)
                                {
                                    index5 = (int)tileArray[num5 + index4].landId;
                                    num8   = 0;
                                }
                                numPtr2[index4] = num8 != 0 ? (short)Hues.Load(num8 & 16383 | 32768).Pixel((ushort)numPtr1[index5]) : numPtr1[index5];
                            }
                            numPtr2 += num9;
                            ++index3;
                            num5 += 8;
                        }
                    }
                }
                ArrayList items = Engine.Multis.Items;

                for (int index1 = 0; index1 < items.Count; ++index1)
                {
                    Item obj = (Item)items[index1];
                    if (obj.InWorld)
                    {
                        CustomMultiEntry customMulti = CustomMultiLoader.GetCustomMulti(obj.Serial, obj.Revision);
                        Multi            multi       = (Multi)null;
                        if (customMulti != null)
                        {
                            multi = customMulti.Multi;
                        }
                        if (multi == null)
                        {
                            multi = obj.Multi;
                        }
                        if (multi != null)
                        {
                            short[][] radar = multi.Radar;
                            if (radar != null)
                            {
                                int xMin;
                                int yMin;
                                int xMax;
                                int yMax;
                                multi.GetBounds(out xMin, out yMin, out xMax, out yMax);
                                int index2 = 0;
                                int num5   = obj.Y - (y << 3) + yMin;
                                while (index2 < radar.Length)
                                {
                                    if (num5 >= 0 && num5 < h << 3)
                                    {
                                        short * numPtr2  = (short *)((IntPtr)lockData.pvSrc + (num5 * num9) * 2);
                                        short[] numArray = radar[index2];
                                        int     index3   = 0;
                                        int     index4   = obj.X - (x << 3) + xMin;
                                        while (index3 < numArray.Length)
                                        {
                                            if (index4 >= 0 && index4 < w << 3 && (int)numArray[index3] != 0)
                                            {
                                                numPtr2[index4] = numPtr1[16384 + (int)numArray[index3]];
                                            }
                                            ++index3;
                                            ++index4;
                                        }
                                    }
                                    ++index2;
                                    ++num5;
                                }
                            }
                        }
                    }
                }
            }

            tex.Unlock();
        }