コード例 #1
0
ファイル: LabGraphics.cs プロジェクト: cvogt/AlbLib
        public static RawImage GetFloor(int labdata, int floor)
        {
            LabData   ld        = LabData.GetLabData(labdata);
            FloorData floordata = ld.GetFloor(floor);

            int texture = floordata.Texture;

            return(GameData.Floors3D.Open(texture));
        }
コード例 #2
0
        public override bool Equals(object obj)
        {
            LabData other = obj as LabData;

            if (other == null)
            {
                return(false);
            }
            return(this.Scale1 == other.Scale1 && this.CameraHeight == other.CameraHeight && this.CameraAngle == other.CameraAngle && this.Background == other.Background && this.FogDistance == other.FogDistance && this.MaxLightStrength == other.MaxLightStrength && this.Scale2 == other.Scale2 && this.ViewDistance == other.ViewDistance && object.Equals(this.Objects, other.Objects) && object.Equals(this.Floors, other.Floors) && object.Equals(this.ObjectInfos, other.ObjectInfos) && object.Equals(this.Walls, other.Walls));
        }
コード例 #3
0
ファイル: LabGraphics.cs プロジェクト: cvogt/AlbLib
        public static RawImage GetObject(int labdata, int obj)
        {
            LabData    ld         = LabData.GetLabData(labdata);
            ObjectInfo objectdata = ld.GetObjectInfo(obj);

            int texture = objectdata.Texture;
            var img     = GameData.Objects3D.Open(texture);

            img.Width  = objectdata.TextureWidth;
            img.Height = objectdata.TextureHeight;
            return(img);
        }
コード例 #4
0
ファイル: LabGraphics.cs プロジェクト: cvogt/AlbLib
        public static RawImage GetWall(int labdata, int wall)
        {
            LabData  ld       = LabData.GetLabData(labdata);
            WallData walldata = ld.GetWall(wall);

            int texture = walldata.Texture;
            var bg      = GameData.Walls3D.Open(texture);

            bg.Width  = walldata.TextureWidth;
            bg.Height = walldata.TextureHeight;
            var plane = new GraphicPlane(bg.Width, bg.Height);

            plane.Background = bg;

            /*foreach(var ovrl in walldata.Overlays)
             * {
             *      var img = GameData.Overlays3D.Open(ovrl.Texture);
             *      img.Width = ovrl.TextureWidth;
             *      img.Height = ovrl.TextureHeight;
             *      plane.Objects.Add(new GraphicObject(img, new Point(ovrl.X, ovrl.Y)));
             * }*/
            plane.Bake();
            return((RawImage)plane.Background);
        }
コード例 #5
0
ファイル: LabData.cs プロジェクト: IllidanS4/AlbLib
 public static LabData GetLabData(int index)
 {
     if(labdatas[index] == null)
     {
         int fx, tx;
         if(!Common.E(index, out fx, out tx))return null;
         using(FileStream stream = new FileStream(Paths.LabDataN.Format(fx), FileMode.Open))
         {
             labdatas[index] = new LabData(XLDNavigator.ReadToIndex(stream, (short)tx));
         }
     }
     return labdatas[index];
 }
コード例 #6
0
        /// <summary>
        /// Combines all tiles to form a graphic plane.
        /// </summary>
        /// <returns>
        /// Newly created graphic plane.
        /// </returns>
        public GraphicPlane Combine(CombineArgs args)
        {
            if (this.Type == MapType.Map2D)
            {
                GraphicPlane plane = new GraphicPlane(this.Width * 16, this.Height * 16);
                plane.Palette = ImagePalette.GetFullPalette(this.Palette);
                foreach (Tile t in this.TileData)
                {
                    Point loc = new Point(t.X * 16, t.Y * 16);
                    if (args.ShowUnderlays)
                    {
                        RawImage ul = MapIcons.GetTileUnderlay(this.Tileset, t);
                        plane.Objects.Add(new GraphicObject(ul, loc));
                    }
                    if (!args.ShowHelpers && IsHelperTile(tilesid, t.Overlay))
                    {
                        continue;
                    }
                    if (args.ShowOverlays)
                    {
                        RawImage ol = MapIcons.GetTileOverlay(this.Tileset, t);
                        plane.Objects.Add(new GraphicObject(ol, loc));
                    }
                }
                if (args.ShowNPCs2D)
                {
                    foreach (NPC npc in UsedNPCs)
                    {
                        ImageBase img = NPCGraphics.GetNPCBig(npc.ObjectID)[6];
                        Point     loc = new Point(npc.X * 16, npc.Y * 16 - img.GetHeight() + 16);
                        plane.Objects.Add(new GraphicObject(img, loc));
                    }
                }
                return(plane);
            }
            else if (this.Type == MapType.Map3D)
            {
                MinimapType mt = MinimapType.Classic;
                LabData     ld = LabData.GetLabData(this.Labdata);

                GraphicPlane plane = new GraphicPlane(this.Width * 8, this.Height * 8);
                ImagePalette src   = ImagePalette.GetFullPalette(this.Palette);
                ImagePalette dest  = plane.Palette = new MinimapPalette(src);

                if (ld != null)
                {
                    if (args.ShowFloors)
                    {
                        //Floors
                        IndexedCache <RawImage> floorcache = new IndexedCache <RawImage>(i => Minimize(LabGraphics.GetFloor(this.Labdata, i), src, dest));
                        foreach (Block b in this.BlockData)
                        {
                            if (b.Floor != 0)
                            {
                                Point loc = new Point(b.X * 8, b.Y * 8);
                                plane.Objects.Add(new GraphicObject(floorcache[b.Floor], loc));
                            }
                        }
                    }

                    if (args.ShowWalls)
                    {
                        //Walls
                        foreach (Block b in this.BlockData)
                        {
                            if (b.IsWall && !ld.GetMinimapForm(b).VisibleOnMinimap)
                            {
                                WallForm form = WallForm.Close;
                                if (b.Y > 0 && BlockData[b.X, b.Y - 1].IsWall)
                                {
                                    form |= WallForm.OpenTop;
                                }
                                if (b.X < Width - 1 && BlockData[b.X + 1, b.Y].IsWall)
                                {
                                    form |= WallForm.OpenRight;
                                }
                                if (b.Y < Height - 1 && BlockData[b.X, b.Y + 1].IsWall)
                                {
                                    form |= WallForm.OpenBottom;
                                }
                                if (b.X > 0 && BlockData[b.X - 1, b.Y].IsWall)
                                {
                                    form |= WallForm.OpenLeft;
                                }
                                Point loc = new Point(b.X * 8, b.Y * 8);
                                plane.Objects.Add(new GraphicObject(AutoGFX.GetWall(form, mt), loc));
                            }
                        }
                    }
                }

                foreach (Block b in this.BlockData)
                {
                    Point loc = new Point(b.X * 8, (b.Y - 1) * 8);
                    if (args.ShowNPCs3D)
                    {
                        //NPCs
                        foreach (NPC npc in UsedNPCs)
                        {
                            if (npc.Positions[0].X == b.X && npc.Positions[0].Y == b.Y)
                            {
                                byte type = 0;
                                if (npc.Interaction == 2)
                                {
                                    type = 8;
                                }
                                else
                                {
                                    type = 17;
                                }
                                if (type != 0)
                                {
                                    plane.Objects.Add(new GraphicObject(AutoGFX.GetIcon(type, mt), loc));
                                }
                            }
                        }
                    }

                    if (args.ShowObjects)
                    {
                        //Objects
                        if (ld != null)
                        {
                            if (!b.IsEmpty)
                            {
                                byte type = ld.GetMinimapForm(b).MinimapType;
                                plane.Objects.Add(new GraphicObject(AutoGFX.GetIcon(type, mt), loc));
                            }
                        }
                    }

                    if (args.ShowGotoPoints)
                    {
                        //Goto-points
                        if (b.GotoPoint != null)
                        {
                            plane.Objects.Add(new GraphicObject(AutoGFX.GetIcon(18, mt), loc));
                        }
                    }
                }
                return(plane);
            }
            return(null);
        }