コード例 #1
0
 public void TsbSave_Click(object sender, EventArgs e)
 {
     E_Sound.StopMusic();
     E_Sound.StopPreview();
     E_Globals.HideCursor      = true;
     E_Globals.ScreenShotTimer = (ClientDataBase.GetTickCount() + 500);
     E_Globals.MakeCache       = true;
 }
コード例 #2
0
        public void BtnDelete_Click(object sender, EventArgs e)
        {
            int tmpindex = 0;

            ClientDataBase.ClearResource(E_Globals.Editorindex);

            tmpindex = lstIndex.SelectedIndex;
            lstIndex.Items.RemoveAt(E_Globals.Editorindex - 1);
            lstIndex.Items.Insert(E_Globals.Editorindex - 1, E_Globals.Editorindex + ": " + Types.Resource[E_Globals.Editorindex].Name);
            lstIndex.SelectedIndex = tmpindex;

            E_Editors.ResourceEditorInit();
        }
コード例 #3
0
ファイル: frmNPC.cs プロジェクト: xFuRiiOuS/OrionPlusSharp
        public void BtnDelete_Click(object sender, EventArgs e)
        {
            int tmpindex = 0;

            if (E_Globals.Editorindex <= 0)
            {
                return;
            }

            ClientDataBase.ClearNpc(E_Globals.Editorindex);

            tmpindex = lstIndex.SelectedIndex;
            lstIndex.Items.RemoveAt(E_Globals.Editorindex - 1);
            lstIndex.Items.Insert(E_Globals.Editorindex - 1, E_Globals.Editorindex + ": " + Types.Npc[E_Globals.Editorindex].Name);
            lstIndex.SelectedIndex = tmpindex;

            E_Editors.NpcEditorInit();
        }
コード例 #4
0
ファイル: FrmAnimation.cs プロジェクト: goossin/toclone
        public void BtnDelete_Click(object sender, EventArgs e)
        {
            int tmpindex = 0;

            if (E_Globals.Editorindex == 0 || E_Globals.Editorindex > Constants.MAX_ANIMATIONS)
            {
                return;
            }

            ClientDataBase.ClearAnimation(E_Globals.Editorindex);

            tmpindex = lstIndex.SelectedIndex;
            lstIndex.Items.RemoveAt(E_Globals.Editorindex - 1);
            lstIndex.Items.Insert(E_Globals.Editorindex - 1, E_Globals.Editorindex + ": " + Types.Animation[E_Globals.Editorindex].Name);
            lstIndex.SelectedIndex = tmpindex;

            E_Editors.AnimationEditorInit();
        }
コード例 #5
0
        public static void GameLoop()
        {
            Point    dest      = new Point(frmMapEditor.Default.PointToScreen(frmMapEditor.Default.picScreen.Location).X, frmMapEditor.Default.PointToScreen(frmMapEditor.Default.picScreen.Location).Y);
            Graphics g         = frmMapEditor.Default.picScreen.CreateGraphics();
            int      starttime = 0;
            int      Tick      = 0;
            int      fogtmr    = 0;
            int      FrameTime;
            int      tmr500      = 0;
            int      tmpfps      = 0;
            int      rendercount = 0;

            starttime = ClientDataBase.GetTickCount();

            do
            {
                if (E_Globals.GameDestroyed == true)
                {
                    ProjectData.EndApp();
                }

                UpdateUI();

                if (E_Globals.GameStarted == true)
                {
                    Tick = ClientDataBase.GetTickCount();

                    // update animation editor
                    if (E_Globals.Editor == E_Globals.EDITOR_ANIMATION)
                    {
                        E_Graphics.EditorAnim_DrawAnim();
                    }

                    if (E_Globals.Editor == E_Projectiles.EDITOR_PROJECTILE)
                    {
                        E_Graphics.Draw_ProjectilePreview();
                    }

                    FrameTime = Tick;
                    if (E_Globals.InMapEditor && !E_Globals.GettingMap)
                    {
                        //Calculate FPS
                        if (starttime < Tick)
                        {
                            E_Globals.FPS = tmpfps;

                            frmMapEditor.Default.tsCurFps.Text = "Current FPS: " + E_Globals.FPS;
                            tmpfps    = 0;
                            starttime = (ClientDataBase.GetTickCount() + 1000);
                        }
                        tmpfps++;

                        lock (E_Types.MapLock)
                        {
                            // fog scrolling
                            if (fogtmr < Tick)
                            {
                                if (E_Globals.CurrentFogSpeed > 0)
                                {
                                    //move
                                    E_Globals.fogOffsetX--;
                                    E_Globals.fogOffsetY--;
                                    FileSystem.Reset();
                                    if (E_Globals.fogOffsetX < -256)
                                    {
                                        E_Globals.fogOffsetX = 0;
                                    }
                                    if (E_Globals.fogOffsetY < -256)
                                    {
                                        E_Globals.fogOffsetY = 0;
                                    }
                                    fogtmr = Tick + 255 - E_Globals.CurrentFogSpeed;
                                }
                            }

                            if (tmr500 < Tick)
                            {
                                // animate waterfalls
                                switch (E_AutoTiles.waterfallFrame)
                                {
                                case 0:
                                    E_AutoTiles.waterfallFrame = 1;
                                    break;

                                case 1:
                                    E_AutoTiles.waterfallFrame = 2;
                                    break;

                                case 2:
                                    E_AutoTiles.waterfallFrame = 0;
                                    break;
                                }
                                // animate autotiles
                                switch (E_AutoTiles.autoTileFrame)
                                {
                                case 0:
                                    E_AutoTiles.autoTileFrame = 1;
                                    break;

                                case 1:
                                    E_AutoTiles.autoTileFrame = 2;
                                    break;

                                case 2:
                                    E_AutoTiles.autoTileFrame = 0;
                                    break;
                                }

                                tmr500 = Tick + 500;
                            }

                            E_Weather.ProcessWeather();

                            if (E_Sound.FadeInSwitch == true)
                            {
                                E_Sound.FadeIn();
                            }

                            if (E_Sound.FadeOutSwitch == true)
                            {
                                E_Sound.FadeOut();
                            }

                            if (rendercount < Tick)
                            {
                                //Auctual Game Loop Stuff :/
                                E_Graphics.Render_Graphics();
                                rendercount = Tick + 32;
                            }

                            //Do we need this?
                            //Application.DoEvents();

                            E_Graphics.EditorMap_DrawTileset();

                            if (E_Globals.TakeScreenShot)
                            {
                                if (E_Globals.ScreenShotTimer < Tick)
                                {
                                    SFML.Graphics.Image screenshot = E_Graphics.GameWindow.Capture();

                                    if (!System.IO.Directory.Exists(Application.StartupPath + "\\Data\\Screenshots"))
                                    {
                                        System.IO.Directory.CreateDirectory(Application.StartupPath + "\\Data\\Screenshots");
                                    }
                                    screenshot.SaveToFile(Application.StartupPath + "\\Data\\Screenshots\\Map" + System.Convert.ToString(E_Types.Map.mapNum) + ".png");

                                    E_Globals.HideCursor     = false;
                                    E_Globals.TakeScreenShot = false;
                                }
                            }

                            if (E_Globals.MakeCache)
                            {
                                if (E_Globals.ScreenShotTimer < Tick)
                                {
                                    SFML.Graphics.Image screenshot = E_Graphics.GameWindow.Capture();

                                    if (!System.IO.Directory.Exists(Application.StartupPath + "\\Data\\Cache"))
                                    {
                                        System.IO.Directory.CreateDirectory(Application.StartupPath + "\\Data\\Cache");
                                    }
                                    screenshot.SaveToFile(Application.StartupPath + "\\Data\\Cache\\Map" + System.Convert.ToString(E_Types.Map.mapNum) + ".png");

                                    E_Globals.HideCursor = false;
                                    E_Globals.MakeCache  = false;
                                    E_Editors.MapEditorSend();
                                }
                            }
                        }
                    }
                }

                // This should be the only one we need?
                Application.DoEvents();
                //Do we need to pause the thread? without it we gain like 200+ fps
                //Thread.Sleep(1);
                // Lets Yield Instead
                Thread.Yield();
            } while (true);
        }
コード例 #6
0
        internal static void Main()
        {
            //check if we are in the right place...
            if (!System.IO.Directory.Exists(Application.StartupPath + "\\Data"))
            {
                MessageBox.Show("Run Editor from inside the Client folder!");
                ProjectData.EndApp();
            }

            if (E_Globals.GameStarted == true)
            {
                return;
            }

            SFML.Portable.Activate();

            //Strings.Init(1, "English")

            ClientDataBase.ClearTempTile();

            // set values for directional blocking arrows
            E_Globals.DirArrowX[1] = (byte)12;             // up
            E_Globals.DirArrowY[1] = (byte)0;
            E_Globals.DirArrowX[2] = (byte)12;             // down
            E_Globals.DirArrowY[2] = (byte)23;
            E_Globals.DirArrowX[3] = (byte)0;              // left
            E_Globals.DirArrowY[3] = (byte)12;
            E_Globals.DirArrowX[4] = (byte)23;             // right
            E_Globals.DirArrowY[4] = (byte)12;

            ClientDataBase.CheckTilesets();
            ClientDataBase.CheckCharacters();
            ClientDataBase.CheckPaperdolls();
            ClientDataBase.CheckAnimations();
            E_Items.CheckItems();
            ClientDataBase.CheckResources();
            ClientDataBase.CheckSkillIcons();
            ClientDataBase.CheckFaces();
            ClientDataBase.CheckFog();
            ClientDataBase.CacheMusic();
            ClientDataBase.CacheSound();

            E_Housing.CheckFurniture();
            E_Projectiles.CheckProjectiles();

            E_Graphics.InitGraphics();

            E_AutoTiles.Autotile = new E_AutoTiles.AutotileRec[E_Types.Map.MaxX + 1, E_Types.Map.MaxY + 1];

            for (var X = 0; X <= E_Types.Map.MaxX; X++)
            {
                for (var Y = 0; Y <= E_Types.Map.MaxY; Y++)
                {
                    E_AutoTiles.Autotile[(int)X, (int)Y].Layer = new E_AutoTiles.QuarterTileRec[(int)Enums.LayerType.Count];
                    for (var i = 0; i <= (int)Enums.LayerType.Count - 1; i++)
                    {
                        E_AutoTiles.Autotile[(int)X, (int)Y].Layer[(int)i].srcX        = new int[5];
                        E_AutoTiles.Autotile[(int)X, (int)Y].Layer[(int)i].srcY        = new int[5];
                        E_AutoTiles.Autotile[(int)X, (int)Y].Layer[(int)i].QuarterTile = new E_AutoTiles.PointRec[5];
                    }
                }
            }

            //'Housing
            E_Housing.House       = new E_Housing.HouseRec[E_Housing.MAX_HOUSES + 1];
            E_Housing.HouseConfig = new E_Housing.HouseRec[E_Housing.MAX_HOUSES + 1];

            //quests
            E_Quest.Quest = new E_Quest.QuestRec[E_Quest.MAX_QUESTS + 1];
            E_Quest.ClearQuests();

            E_Types.Map.Npc = new int[Constants.MAX_MAP_NPCS + 1];

            Types.Item = new Types.ItemRec[Constants.MAX_ITEMS + 1];
            for (var i = 0; i <= Constants.MAX_ITEMS; i++)
            {
                for (var x = 0; x <= (int)Enums.StatType.Count - 1; x++)
                {
                    Types.Item[(int)i].Add_Stat = new byte[(int)x + 1];
                }
                for (var x = 0; x <= (int)Enums.StatType.Count - 1; x++)
                {
                    Types.Item[(int)i].Stat_Req = new byte[(int)x + 1];
                }

                Types.Item[(int)i].FurnitureBlocks = new int[4, 4];
                Types.Item[(int)i].FurnitureFringe = new int[4, 4];
            }

            Types.Npc = new Types.NpcRec[Constants.MAX_NPCS + 1];
            for (var i = 0; i <= Constants.MAX_NPCS; i++)
            {
                for (var x = 0; x <= (int)Enums.StatType.Count - 1; x++)
                {
                    Types.Npc[(int)i].Stat = new byte[(int)x + 1];
                }

                Types.Npc[(int)i].DropChance    = new int[6];
                Types.Npc[(int)i].DropItem      = new int[6];
                Types.Npc[(int)i].DropItemValue = new int[6];

                Types.Npc[(int)i].Skill = new byte[7];
            }

            E_Types.MapNpc = new E_Types.MapNpcRec[Constants.MAX_MAP_NPCS + 1];
            for (var i = 0; i <= Constants.MAX_MAP_NPCS; i++)
            {
                for (var x = 0; x <= (int)Enums.VitalType.Count - 1; x++)
                {
                    E_Types.MapNpc[(int)i].Vital = new int[(int)x + 1];
                }
            }

            Types.Shop = new Types.ShopRec[Constants.MAX_SHOPS + 1];
            for (var i = 0; i <= Constants.MAX_SHOPS; i++)
            {
                for (var x = 0; x <= Constants.MAX_TRADES; x++)
                {
                    Types.Shop[(int)i].TradeItem = new Types.TradeItemRec[(int)x + 1];
                }
            }

            Types.Animation = new Types.AnimationRec[Constants.MAX_ANIMATIONS + 1];
            for (var i = 0; i <= Constants.MAX_ANIMATIONS; i++)
            {
                for (var x = 0; x <= 1; x++)
                {
                    Types.Animation[(int)i].Sprite = new int[(int)x + 1];
                }
                for (var x = 0; x <= 1; x++)
                {
                    Types.Animation[(int)i].Frames = new int[(int)x + 1];
                }
                for (var x = 0; x <= 1; x++)
                {
                    Types.Animation[(int)i].LoopCount = new int[(int)x + 1];
                }
                for (var x = 0; x <= 1; x++)
                {
                    Types.Animation[(int)i].LoopTime = new int[(int)x + 1];
                }
            }

            //craft
            E_Crafting.ClearRecipes();

            //pets
            E_Pets.ClearPets();

            // load options
            if (File.Exists(Application.StartupPath + "\\Data\\Config.xml"))
            {
                LoadOptions();
            }
            else
            {
                CreateOptions();
            }

            E_NetworkConfig.InitNetwork();

            E_Globals.GameDestroyed = false;
            E_Globals.GameStarted   = true;

            FrmLogin.Default.Visible = true;

            GameLoop();
        }
コード例 #7
0
        internal static void HandleMapProjectile(ref byte[] data)
        {
            int        i      = 0;
            ByteStream buffer = new ByteStream(data);

            i = buffer.ReadInt32();

            MapProjectiles[i].ProjectileNum = buffer.ReadInt32();
            MapProjectiles[i].Owner         = buffer.ReadInt32();
            MapProjectiles[i].OwnerType     = (byte)(buffer.ReadInt32());
            MapProjectiles[i].dir           = (byte)(buffer.ReadInt32());
            MapProjectiles[i].X             = buffer.ReadInt32();
            MapProjectiles[i].Y             = buffer.ReadInt32();
            MapProjectiles[i].Range         = 0;
            MapProjectiles[i].Timer         = System.Convert.ToInt32(System.Convert.ToInt32(ClientDataBase.GetTickCount()) + 60000);

            buffer.Dispose();
        }
コード例 #8
0
ファイル: frmMapEditor.cs プロジェクト: goossin/toclone
        public void BtnSetSize_Click(object sender, EventArgs e)
        {
            int X  = 0;
            int x2 = 0;
            int i  = 0;
            int Y  = 0;
            int y2 = 0;

            Types.TileRec[,] tempArr;

            if (nudMaxX.Value < E_Globals.SCREEN_MAPX)
            {
                nudMaxX.Value = E_Globals.SCREEN_MAPX;
            }
            if (nudMaxY.Value < E_Globals.SCREEN_MAPY)
            {
                nudMaxY.Value = E_Globals.SCREEN_MAPY;
            }

            E_Globals.GettingMap = true;

            // set the data before changing it
            tempArr = new Types.TileRec[E_Types.Map.MaxX + 1, E_Types.Map.MaxY + 1];
            for (X = 0; X <= E_Types.Map.MaxX; X++)
            {
                for (Y = 0; Y <= E_Types.Map.MaxY; Y++)
                {
                    tempArr[X, Y].Layer = new Types.TileDataRec[(int)Enums.LayerType.Count];

                    tempArr[X, Y].Data1    = E_Types.Map.Tile[X, Y].Data1;
                    tempArr[X, Y].Data2    = E_Types.Map.Tile[X, Y].Data2;
                    tempArr[X, Y].Data3    = E_Types.Map.Tile[X, Y].Data3;
                    tempArr[X, Y].DirBlock = E_Types.Map.Tile[X, Y].DirBlock;
                    tempArr[X, Y].Type     = E_Types.Map.Tile[X, Y].Type;

                    for (i = 1; i <= (int)Enums.LayerType.Count - 1; i++)
                    {
                        tempArr[X, Y].Layer[i].AutoTile = E_Types.Map.Tile[X, Y].Layer[i].AutoTile;
                        tempArr[X, Y].Layer[i].Tileset  = E_Types.Map.Tile[X, Y].Layer[i].Tileset;
                        tempArr[X, Y].Layer[i].X        = E_Types.Map.Tile[X, Y].Layer[i].X;
                        tempArr[X, Y].Layer[i].Y        = E_Types.Map.Tile[X, Y].Layer[i].Y;
                    }
                }
            }

            x2 = E_Types.Map.MaxX;
            y2 = E_Types.Map.MaxY;
            // change the data
            E_Types.Map.MaxX = (byte)nudMaxX.Value;
            E_Types.Map.MaxY = (byte)nudMaxY.Value;

            E_Types.Map.Tile     = new Types.TileRec[E_Types.Map.MaxX + 1, E_Types.Map.MaxY + 1];
            E_AutoTiles.Autotile = new E_AutoTiles.AutotileRec[E_Types.Map.MaxX + 1, E_Types.Map.MaxY + 1];

            if (x2 > E_Types.Map.MaxX)
            {
                x2 = E_Types.Map.MaxX;
            }
            if (y2 > E_Types.Map.MaxY)
            {
                y2 = E_Types.Map.MaxY;
            }

            for (X = 0; X <= E_Types.Map.MaxX; X++)
            {
                for (Y = 0; Y <= E_Types.Map.MaxY; Y++)
                {
                    Array.Resize(ref E_Types.Map.Tile[X, Y].Layer, (int)Enums.LayerType.Count);

                    Array.Resize(ref E_AutoTiles.Autotile[X, Y].Layer, (int)Enums.LayerType.Count);

                    if (X <= x2)
                    {
                        if (Y <= y2)
                        {
                            E_Types.Map.Tile[X, Y].Data1    = tempArr[X, Y].Data1;
                            E_Types.Map.Tile[X, Y].Data2    = tempArr[X, Y].Data2;
                            E_Types.Map.Tile[X, Y].Data3    = tempArr[X, Y].Data3;
                            E_Types.Map.Tile[X, Y].DirBlock = tempArr[X, Y].DirBlock;
                            E_Types.Map.Tile[X, Y].Type     = tempArr[X, Y].Type;

                            for (i = 1; i <= (int)Enums.LayerType.Count - 1; i++)
                            {
                                E_Types.Map.Tile[X, Y].Layer[i].AutoTile = tempArr[X, Y].Layer[i].AutoTile;
                                E_Types.Map.Tile[X, Y].Layer[i].Tileset  = tempArr[X, Y].Layer[i].Tileset;
                                E_Types.Map.Tile[X, Y].Layer[i].X        = tempArr[X, Y].Layer[i].X;
                                E_Types.Map.Tile[X, Y].Layer[i].Y        = tempArr[X, Y].Layer[i].Y;
                            }
                        }
                    }
                }
            }
            E_AutoTiles.InitAutotiles();
            ClientDataBase.ClearTempTile();
            //MapEditorSend()

            E_Globals.GettingMap = false;
        }
コード例 #9
0
ファイル: frmMapEditor.cs プロジェクト: goossin/toclone
 public void TsbScreenShot_Click(object sender, EventArgs e)
 {
     E_Globals.HideCursor      = true;
     E_Globals.ScreenShotTimer = System.Convert.ToInt32(System.Convert.ToInt32(ClientDataBase.GetTickCount()) + 1000);
     E_Globals.TakeScreenShot  = true;
 }
コード例 #10
0
ファイル: frmItem.cs プロジェクト: goossin/toclone
        public void NudFurniture_ValueChanged(object sender, EventArgs e)
        {
            if (E_Globals.Editorindex == 0 || E_Globals.Editorindex > Constants.MAX_ITEMS)
            {
                return;
            }

            Types.Item[E_Globals.Editorindex].Data2 = (int)nudFurniture.Value;

            if (E_Graphics.FurnitureGFXInfo[(int)nudFurniture.Value].IsLoaded == false)
            {
                E_Graphics.LoadTexture((int)nudFurniture.Value, (byte)10);
            }

            //seeying we still use it, lets update timer
            E_Graphics.FurnitureGFXInfo[(int)nudFurniture.Value].TextureTimer = System.Convert.ToInt32(System.Convert.ToInt32(ClientDataBase.GetTickCount()) + 100000);

            if (nudFurniture.Value > 0 && nudFurniture.Value <= E_Housing.NumFurniture)
            {
                Types.Item[E_Globals.Editorindex].FurnitureWidth  = System.Convert.ToInt32((double)E_Graphics.FurnitureGFXInfo[(int)nudFurniture.Value].width / 32);
                Types.Item[E_Globals.Editorindex].FurnitureHeight = System.Convert.ToInt32((double)E_Graphics.FurnitureGFXInfo[(int)nudFurniture.Value].height / 32);
                if (Types.Item[E_Globals.Editorindex].FurnitureHeight > 1)
                {
                    Types.Item[E_Globals.Editorindex].FurnitureHeight = Types.Item[E_Globals.Editorindex].FurnitureHeight - 1;
                }
            }
            else
            {
                Types.Item[E_Globals.Editorindex].FurnitureWidth  = 1;
                Types.Item[E_Globals.Editorindex].FurnitureHeight = 1;
            }

            E_Items.EditorItem_DrawFurniture();
        }
コード例 #11
0
        internal static void EditorItem_DrawFurniture()
        {
            int       Furniturenum = 0;
            Rectangle sRECT        = new Rectangle();
            Rectangle dRECT        = new Rectangle();

            Furniturenum = (int)FrmItem.Default.nudFurniture.Value;

            if (Furniturenum < 1 || Furniturenum > E_Housing.NumFurniture)
            {
                E_Graphics.EditorItem_Furniture.Clear(E_Graphics.ToSFMLColor(FrmItem.Default.picFurniture.BackColor));
                E_Graphics.EditorItem_Furniture.Display();
                return;
            }

            if (E_Graphics.FurnitureGFXInfo[Furniturenum].IsLoaded == false)
            {
                E_Graphics.LoadTexture(Furniturenum, (byte)10);
            }

            //seeying we still use it, lets update timer
            E_Graphics.FurnitureGFXInfo[Furniturenum].TextureTimer = System.Convert.ToInt32(System.Convert.ToInt32(ClientDataBase.GetTickCount()) + 100000);

            // rect for source
            sRECT.Y      = 0;
            sRECT.Height = E_Graphics.FurnitureGFXInfo[Furniturenum].height;
            sRECT.X      = 0;
            sRECT.Width  = E_Graphics.FurnitureGFXInfo[Furniturenum].width;

            // same for destination as source
            dRECT = sRECT;

            E_Graphics.EditorItem_Furniture.Clear(E_Graphics.ToSFMLColor(FrmItem.Default.picFurniture.BackColor));

            E_Graphics.RenderSprite(E_Graphics.FurnitureSprite[Furniturenum], E_Graphics.EditorItem_Furniture, dRECT.X, dRECT.Y, sRECT.X, sRECT.Y, sRECT.Width, sRECT.Height);

            if (FrmItem.Default.optSetBlocks.Checked == true)
            {
                for (var X = 0; X <= 3; X++)
                {
                    for (var Y = 0; Y <= 3; Y++)
                    {
                        if (X <= ((double)E_Graphics.FurnitureGFXInfo[Furniturenum].width / 32) - 1)
                        {
                            if (Y <= ((double)E_Graphics.FurnitureGFXInfo[Furniturenum].height / 32) - 1)
                            {
                                if (Types.Item[E_Globals.Editorindex].FurnitureBlocks[(int)X, (int)Y] == 1)
                                {
                                    E_Text.DrawText(System.Convert.ToInt32(X * 32 + 8), System.Convert.ToInt32(Y * 32 + 8), "X", SFML.Graphics.Color.Red, SFML.Graphics.Color.Black, E_Graphics.EditorItem_Furniture);
                                }
                                else
                                {
                                    E_Text.DrawText(System.Convert.ToInt32(X * 32 + 8), System.Convert.ToInt32(Y * 32 + 8), "O", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.EditorItem_Furniture);
                                }
                            }
                        }
                    }
                }
            }
            else if (FrmItem.Default.optSetFringe.Checked == true)
            {
                for (var X = 0; X <= 3; X++)
                {
                    for (var Y = 0; Y <= 3; Y++)
                    {
                        if (X <= ((double)E_Graphics.FurnitureGFXInfo[Furniturenum].width / 32) - 1)
                        {
                            if (Y <= ((double)E_Graphics.FurnitureGFXInfo[Furniturenum].height / 32))
                            {
                                if (Types.Item[E_Globals.Editorindex].FurnitureFringe[(int)X, (int)Y] == 1)
                                {
                                    E_Text.DrawText(System.Convert.ToInt32(X * 32 + 8), System.Convert.ToInt32(Y * 32 + 8), "O", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.EditorItem_Furniture);
                                }
                            }
                        }
                    }
                }
            }
            E_Graphics.EditorItem_Furniture.Display();
        }
コード例 #12
0
ファイル: E_Housing.cs プロジェクト: goossin/toclone
        internal static void DrawFurniture(int index, int Layer)
        {
            int i       = 0;
            int ItemNum = 0;
            int X       = 0;
            int Y       = 0;
            int Width   = 0;
            int Height  = 0;
            int X1      = 0;
            int Y1      = 0;

            ItemNum = Furniture[index].ItemNum;

            if (Types.Item[ItemNum].Type != (int)Enums.ItemType.Furniture)
            {
                return;
            }

            i = Types.Item[ItemNum].Data2;

            if (E_Graphics.FurnitureGFXInfo[i].IsLoaded == false)
            {
                E_Graphics.LoadTexture(i, (byte)10);
            }

            //seeying we still use it, lets update timer
            E_Graphics.SkillIconsGFXInfo[i].TextureTimer = System.Convert.ToInt32(System.Convert.ToInt32(ClientDataBase.GetTickCount()) + 100000);

            Width  = Types.Item[ItemNum].FurnitureWidth;
            Height = Types.Item[ItemNum].FurnitureHeight;

            if (Width > 4)
            {
                Width = 4;
            }
            if (Height > 4)
            {
                Height = 4;
            }
            if (i <= 0 || i > NumFurniture)
            {
                return;
            }

            // make sure it's not out of map
            if (Furniture[index].X > E_Types.Map.MaxX)
            {
                return;
            }
            if (Furniture[index].Y > E_Types.Map.MaxY)
            {
                return;
            }

            for (X1 = 0; X1 <= Width - 1; X1++)
            {
                for (Y1 = 0; Y1 <= Height; Y1++)
                {
                    if (Types.Item[Furniture[index].ItemNum].FurnitureFringe[X1, Y1] == Layer)
                    {
                        // Set base x + y, then the offset due to size
                        X = (Furniture[index].X * 32) + (X1 * 32);
                        Y = (Furniture[index].Y * 32 - (Height * 32)) + (Y1 * 32);
                        X = E_Graphics.ConvertMapX(X);
                        Y = E_Graphics.ConvertMapY(Y);

                        Sprite tmpSprite = new Sprite(E_Graphics.FurnitureGFX[i])
                        {
                            TextureRect = new IntRect(0 + (X1 * 32), 0 + (Y1 * 32), 32, 32),
                            Position    = new Vector2f(X, Y)
                        };
                        E_Graphics.GameWindow.Draw(tmpSprite);
                    }
                }
            }
        }
コード例 #13
0
ファイル: E_Weather.cs プロジェクト: goossin/toclone
        public static void ProcessWeather()
        {
            int i = 0;
            int x;

            if (E_Globals.CurrentWeather > 0)
            {
                if (E_Globals.CurrentWeather == (int)Enums.WeatherType.Rain || E_Globals.CurrentWeather == (int)Enums.WeatherType.Storm)
                {
                    PlayWeatherSound("Rain.ogg", true);
                }
                x = ClientDataBase.Rand(1, 101 - E_Globals.CurrentWeatherIntensity);
                if (x == 1)
                {
                    //Add a new particle
                    for (i = 1; i <= MAX_WEATHER_PARTICLES; i++)
                    {
                        if (WeatherParticle[i].InUse == 0)
                        {
                            if (ClientDataBase.Rand(1, 3) == 1)
                            {
                                WeatherParticle[i].InUse    = 1;
                                WeatherParticle[i].type     = E_Globals.CurrentWeather;
                                WeatherParticle[i].Velocity = ClientDataBase.Rand(8, 14);
                                WeatherParticle[i].X        = (E_Globals.TileView.Left * 32) - 32;
                                WeatherParticle[i].Y        = (E_Globals.TileView.Top * 32) + ClientDataBase.Rand(-32, (int)E_Graphics.GameWindow.Size.Y);
                            }
                            else
                            {
                                WeatherParticle[i].InUse    = 1;
                                WeatherParticle[i].type     = E_Globals.CurrentWeather;
                                WeatherParticle[i].Velocity = ClientDataBase.Rand(10, 15);
                                WeatherParticle[i].X        = (E_Globals.TileView.Left * 32) + ClientDataBase.Rand(-32, (int)E_Graphics.GameWindow.Size.X);
                                WeatherParticle[i].Y        = (E_Globals.TileView.Top * 32) - 32;
                            }
                            //Exit For
                        }
                    }
                }
            }
            else
            {
                StopWeatherSound();
            }
            if (E_Globals.CurrentWeather == (int)Enums.WeatherType.Storm)
            {
                x = ClientDataBase.Rand(1, 400 - E_Globals.CurrentWeatherIntensity);
                if (x == 1)
                {
                    //Draw Thunder
                    E_Globals.DrawThunder = ClientDataBase.Rand(15, 22);
                    E_Sound.PlayExtraSound("Thunder.ogg");
                }
            }
            for (i = 1; i <= MAX_WEATHER_PARTICLES; i++)
            {
                if (WeatherParticle[i].InUse == 1)
                {
                    if (WeatherParticle[i].X > E_Globals.TileView.Right * 32 || WeatherParticle[i].Y > E_Globals.TileView.Bottom * 32)
                    {
                        WeatherParticle[i].InUse = 0;
                    }
                    else
                    {
                        WeatherParticle[i].X = WeatherParticle[i].X + WeatherParticle[i].Velocity;
                        WeatherParticle[i].Y = WeatherParticle[i].Y + WeatherParticle[i].Velocity;
                    }
                }
            }
        }
コード例 #14
0
ファイル: E_Weather.cs プロジェクト: goossin/toclone
        internal static void DrawFog()
        {
            int fogNum = 0;

            //If InMapEditor Then Exit Sub

            fogNum = E_Globals.CurrentFog;
            if (fogNum <= 0 || fogNum > E_Graphics.NumFogs)
            {
                return;
            }

            int horz = 0;
            int vert = 0;

            for (var x = E_Globals.TileView.Left; x <= E_Globals.TileView.Right + 1; x++)
            {
                for (var y = E_Globals.TileView.Top; y <= E_Globals.TileView.Bottom + 1; y++)
                {
                    if (E_Graphics.IsValidMapPoint(System.Convert.ToInt32(x), System.Convert.ToInt32(y)))
                    {
                        horz = System.Convert.ToInt32(-x);
                        vert = System.Convert.ToInt32(-y);
                    }
                }
            }

            if (E_Graphics.FogGFXInfo[fogNum].IsLoaded == false)
            {
                E_Graphics.LoadTexture(fogNum, (byte)8);
            }

            //seeying we still use it, lets update timer
            E_Graphics.FogGFXInfo[fogNum].TextureTimer = System.Convert.ToInt32(System.Convert.ToInt32(ClientDataBase.GetTickCount()) + 100000);

            Sprite tmpSprite = default(Sprite);

            tmpSprite = new Sprite(E_Graphics.FogGFX[fogNum])
            {
                Color       = new SFML.Graphics.Color(255, 255, 255, (byte)E_Globals.CurrentFogOpacity),
                TextureRect = new IntRect(0, 0, (int)E_Graphics.GameWindow.Size.X + 200, (int)E_Graphics.GameWindow.Size.Y + 200),
                Position    = new Vector2f((float)((horz * 2.5) + 50), (float)((vert * 3.5) + 50)),
                Scale       = (new Vector2f((float)((E_Graphics.GameWindow.Size.X + 200) / E_Graphics.FogGFXInfo[fogNum].width), (float)((E_Graphics.GameWindow.Size.Y + 200) / E_Graphics.FogGFXInfo[fogNum].height)))
            };

            E_Graphics.GameWindow.Draw(tmpSprite);             //
        }