Ejemplo n.º 1
0
        public Cell(int aid, string CellData, int w, int h, Frames.MapFrame frame)
        {
            try
            {
                id = aid;
                Frame = frame;
                byte[] CellInfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                for (int i = CellData.Length - 1; i >= 0; i--)
                    CellInfo[i] = (byte)Program.Hash.IndexOf(CellData[i]);

                active = ((CellInfo[0] & 32) >> 5) != 0;
                if (!active)
                {
                    gID = 0;
                    return;
                }
                LoS = (CellInfo[0] & 1) != 0;
                grot = (CellInfo[1] & 48) >> 4;
                glvl = CellInfo[1] & 15;
                type = (CellInfo[2] & 56) >> 3;
                gID = ((CellInfo[0] & 24) << 6) + ((CellInfo[2] & 7) << 6) + CellInfo[3];
                ground = frame.getBitmap(gID, true);
                gslope = (CellInfo[4] & 60) >> 2;
                gflip = ((CellInfo[4] & 2) >> 1) != 0;
                o1ID = ((CellInfo[0] & 4) << 11) + ((CellInfo[4] & 1) << 12) + (CellInfo[5] << 6) + CellInfo[6];
                object1 = frame.getBitmap(o1ID, false);
                o1rot = (CellInfo[7] & 48) >> 4;
                o1flip = ((CellInfo[7] & 8) >> 3) != 0;
                o2flip = ((CellInfo[7] & 4) >> 2) != 0;
                o2interactive = Convert.ToBoolean((CellInfo[7] & 2) >> 1);
                o2ID = ((CellInfo[0] & 2) << 12) + ((CellInfo[7] & 1) << 12) + (CellInfo[8] << 6) + CellInfo[9];
                object2 = frame.getBitmap(o2ID, false);

                if (ground != null)
                {
                    if (gflip)
                        ground.RotateFlip(RotateFlipType.RotateNoneFlipX);

                    if (grot == 1)
                    {
                        ground.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        gflip = true;
                        grot = 0;
                    }
                    else if (grot == 2)
                        ground.RotateFlip(RotateFlipType.Rotate180FlipNone);
                    else if (grot == 3)
                        ground.RotateFlip(RotateFlipType.Rotate180FlipX);
                }

                if (object1 != null)
                {
                    if (o1flip)
                        object1.RotateFlip(RotateFlipType.RotateNoneFlipX);

                    if (o1rot == 1)
                    {
                        object1.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        o1flip = true;
                        o1rot = 0;
                    }
                    else if (o1rot == 2)
                        object1.RotateFlip(RotateFlipType.Rotate180FlipNone);
                    else if (o1rot == 3)
                        object1.RotateFlip(RotateFlipType.Rotate180FlipX);
                }

                if (object2 != null)
                {
                    if (o2flip)
                        object2.RotateFlip(RotateFlipType.RotateNoneFlipX);
                }

                pos = getPositionByCellID(id, glvl, w, h);
            }
            catch { }
        }