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(); }
public void OptItem_CheckedChanged(object sender, EventArgs e) { E_Editors.ClearAttributeDialogue(); pnlAttributes.Visible = true; fraMapItem.Visible = true; scrlMapItem.Maximum = Constants.MAX_ITEMS; scrlMapItem.Value = 1; lblMapItem.Text = Types.Item[scrlMapItem.Value].Name.Trim() + " x" + System.Convert.ToString(scrlMapItemValue.Value); E_Graphics.EditorMap_DrawMapItem(); }
public void NudSprite_ValueChanged(object sender, EventArgs e) { if (E_Globals.Editorindex <= 0) { return; } Types.Npc[E_Globals.Editorindex].Sprite = (int)nudSprite.Value; E_Graphics.EditorNpc_DrawSprite(); }
public void OptKey_CheckedChanged(object sender, EventArgs e) { E_Editors.ClearAttributeDialogue(); pnlAttributes.Visible = true; fraMapKey.Visible = true; scrlMapKey.Maximum = Constants.MAX_ITEMS; scrlMapKey.Value = 1; chkMapKey.Checked = true; E_Graphics.EditorMap_DrawKey(); lblMapKey.Text = "Item: " + Types.Item[scrlMapKey.Value].Name.Trim(); }
internal static void DrawEventName(int index) { int TextX = 0; int TextY = 0; SFML.Graphics.Color color = new SFML.Graphics.Color(); SFML.Graphics.Color backcolor = new SFML.Graphics.Color(); string Name = ""; if (E_Globals.InMapEditor) { return; } color = SFML.Graphics.Color.Yellow; backcolor = SFML.Graphics.Color.Black; Name = E_Types.Map.MapEvents[index].Name.Trim(); // calc pos TextX = System.Convert.ToInt32(E_Graphics.ConvertMapX(E_Types.Map.MapEvents[index].X * E_Globals.PIC_X) + E_Types.Map.MapEvents[index].XOffset + (E_Globals.PIC_X / 2) - (double)GetTextWidth(Name.Trim()) / 2); if (E_Types.Map.MapEvents[index].GraphicType == 0) { TextY = E_Graphics.ConvertMapY(E_Types.Map.MapEvents[index].Y * E_Globals.PIC_Y) + E_Types.Map.MapEvents[index].YOffset - 16; } else if (E_Types.Map.MapEvents[index].GraphicType == 1) { if (E_Types.Map.MapEvents[index].GraphicNum <1 || E_Types.Map.MapEvents[index].GraphicNum> E_Graphics.NumCharacters) { TextY = E_Graphics.ConvertMapY(E_Types.Map.MapEvents[index].Y * E_Globals.PIC_Y) + E_Types.Map.MapEvents[index].YOffset - 16; } else { // Determine location for text TextY = System.Convert.ToInt32(E_Graphics.ConvertMapY(E_Types.Map.MapEvents[index].Y * E_Globals.PIC_Y) + E_Types.Map.MapEvents[index].YOffset - ((double)E_Graphics.CharacterGFXInfo[E_Types.Map.MapEvents[index].GraphicNum].height / 4) + 16); } } else if (E_Types.Map.MapEvents[index].GraphicType == 2) { if (E_Types.Map.MapEvents[index].GraphicY2 > 0) { TextY = E_Graphics.ConvertMapY(E_Types.Map.MapEvents[index].Y * E_Globals.PIC_Y) + E_Types.Map.MapEvents[index].YOffset - (E_Types.Map.MapEvents[index].GraphicY2 * E_Globals.PIC_Y) + 16; } else { TextY = E_Graphics.ConvertMapY(E_Types.Map.MapEvents[index].Y * E_Globals.PIC_Y) + E_Types.Map.MapEvents[index].YOffset - 32 + 16; } } // Draw name DrawText(TextX, TextY, Name.Trim(), color, backcolor, E_Graphics.GameWindow); }
public override void DrawParticles(RenderWindow gameWindow) { foreach (ProjectileBullet proj in projectiles) { if (E_Graphics.ProjectileSprite.Count() > 0) { if (!E_Graphics.ProjectileGFXInfo[picture].IsLoaded) { E_Graphics.LoadTexture(picture, 11); } E_Graphics.RenderSprite(E_Graphics.ProjectileSprite[picture], gameWindow, proj.x, proj.y, 0, 0, E_Graphics.ProjectileGFXInfo[picture].width, E_Graphics.ProjectileGFXInfo[picture].height); } } }
public void ScrlMapItem_Scroll(object sender, ScrollEventArgs e) { if (Types.Item[scrlMapItem.Value].Type == (byte)Enums.ItemType.Currency || Types.Item[scrlMapItem.Value].Stackable == 1) { scrlMapItemValue.Enabled = true; } else { scrlMapItemValue.Value = 1; scrlMapItemValue.Enabled = false; } E_Graphics.EditorMap_DrawMapItem(); lblMapItem.Text = "Item: " + System.Convert.ToString(scrlMapItem.Value) + ". " + Types.Item[scrlMapItem.Value].Name.Trim() + " x" + System.Convert.ToString(scrlMapItemValue.Value); }
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); // }
public override void InitializeEmitter() { if (!E_Graphics.ProjectileGFXInfo[picture].IsLoaded) { E_Graphics.LoadTexture(picture, 11); } int height = frmProjectile.Default.picProjectilePreview.Height; int width = frmProjectile.Default.picProjectilePreview.Width; projectiles = new List <ProjectileBullet>(); projectiles.Add(new ProjectileBullet()); projectiles[0].x = (width / 2) + (int)E_Graphics.ProjectileSprite[picture].Texture.Size.X / 2; projectiles[0].y = (height / 2) + (int)E_Graphics.ProjectileSprite[picture].Texture.Size.Y / 2; projectiles[0].dir = (byte)frmProjectile.Default.PreviewDirectionDropdown.SelectedIndex; }
internal static void DrawNPCName(int MapNpcNum) { int TextX = 0; int TextY = 0; SFML.Graphics.Color color = new SFML.Graphics.Color(); SFML.Graphics.Color backcolor = new SFML.Graphics.Color(); int npcNum = 0; npcNum = E_Types.MapNpc[MapNpcNum].Num; if (Types.Npc[npcNum].Behaviour == ((byte)0)) // attack on sight { color = SFML.Graphics.Color.Red; backcolor = SFML.Graphics.Color.Black; } // attack when attacked + guard else if ((Types.Npc[npcNum].Behaviour == ((byte)1)) || (Types.Npc[npcNum].Behaviour == ((byte)4))) { color = SFML.Graphics.Color.Green; backcolor = SFML.Graphics.Color.Black; } // friendly + shopkeeper + quest else if (((Types.Npc[npcNum].Behaviour == ((byte)2)) || (Types.Npc[npcNum].Behaviour == ((byte)3))) || (Types.Npc[npcNum].Behaviour == ((byte)5))) { color = SFML.Graphics.Color.Yellow; backcolor = SFML.Graphics.Color.Black; } TextX = System.Convert.ToInt32(E_Graphics.ConvertMapX(E_Types.MapNpc[MapNpcNum].X * E_Globals.PIC_X) + E_Types.MapNpc[MapNpcNum].XOffset + (E_Globals.PIC_X / 2) - (double)GetTextWidth(Types.Npc[npcNum].Name.Trim()) / 2); if (Types.Npc[npcNum].Sprite <1 || Types.Npc[npcNum].Sprite> E_Graphics.NumCharacters) { TextY = E_Graphics.ConvertMapY(E_Types.MapNpc[MapNpcNum].Y * E_Globals.PIC_Y) + E_Types.MapNpc[MapNpcNum].YOffset - 16; } else { TextY = System.Convert.ToInt32(E_Graphics.ConvertMapY(E_Types.MapNpc[MapNpcNum].Y * E_Globals.PIC_Y) + E_Types.MapNpc[MapNpcNum].YOffset - ((double)E_Graphics.CharacterGFXInfo[Types.Npc[npcNum].Sprite].height / 4) + 16); } // Draw name DrawText(TextX, TextY, Types.Npc[npcNum].Name.Trim(), color, backcolor, E_Graphics.GameWindow); }
internal static void DrawWeather() { int i = 0; int SpriteLeft = 0; //If InMapEditor Then Exit Sub for (i = 1; i <= MAX_WEATHER_PARTICLES; i++) { if (System.Convert.ToBoolean(WeatherParticle[i].InUse)) { if (WeatherParticle[i].type == (int)Enums.WeatherType.Storm) { SpriteLeft = 0; } else { SpriteLeft = WeatherParticle[i].type - 1; } E_Graphics.RenderSprite(E_Graphics.WeatherSprite, E_Graphics.GameWindow, E_Graphics.ConvertMapX(WeatherParticle[i].X), E_Graphics.ConvertMapY(WeatherParticle[i].Y), SpriteLeft * 32, 0, 32, 32); } } }
public void ScrlExhaustedPic_Scroll(object sender, EventArgs e) { E_Graphics.EditorResource_DrawSprite(); Types.Resource[E_Globals.Editorindex].ExhaustedImage = (int)nudExhaustedPic.Value; }
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); } } } }
public void ScrlMapKey_Scroll(object sender, ScrollEventArgs e) { lblMapKey.Text = "Item: " + Types.Item[scrlMapKey.Value].Name.Trim(); E_Graphics.EditorMap_DrawKey(); }
internal static void DrawMapAttributes() { if (E_Globals.SelectedTab == 2) { int X = 0; int y = 0; int tX = 0; int tY = 0; RectangleShape rec = new RectangleShape(); rec.OutlineColor = new SFML.Graphics.Color(SFML.Graphics.Color.White); rec.OutlineThickness = (float)(0.6F); rec.Size = new Vector2f(E_Globals.PIC_X, E_Globals.PIC_X); for (X = E_Globals.TileView.Left; X <= E_Globals.TileView.Right; X++) { for (y = E_Globals.TileView.Top; y <= E_Globals.TileView.Bottom; y++) { if (E_Graphics.IsValidMapPoint(X, y)) { tX = System.Convert.ToInt32(((E_Graphics.ConvertMapX(X * E_Globals.PIC_X)) - 4) + (E_Globals.PIC_X * 0.5)); tY = System.Convert.ToInt32(((E_Graphics.ConvertMapY(y * E_Globals.PIC_Y)) - 7) + (E_Globals.PIC_Y * 0.5)); //rec.OutlineColor = new SFML.Graphics.Color(SFML.Graphics.Color.White); //rec.OutlineThickness = (float) (0.6F); //rec.Size = new Vector2f(E_Globals.PIC_X, E_Globals.PIC_X); rec.Position = new Vector2f(E_Graphics.ConvertMapX((X)*E_Globals.PIC_X), E_Graphics.ConvertMapY((y) * E_Globals.PIC_Y)); if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Blocked) { rec.FillColor = SFML.Graphics.Color.Red; E_Graphics.GameWindow.Draw(rec); DrawText(tX, tY, "B", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Warp) { DrawText(tX, tY, "W", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Item) { DrawText(tX, tY, "I", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.NpcAvoid) { DrawText(tX, tY, "N", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Key) { DrawText(tX, tY, "K", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.KeyOpen) { DrawText(tX, tY, "KO", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Resource) { DrawText(tX, tY, "R", SFML.Graphics.Color.Green, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Door) { DrawText(tX, tY, "D", SFML.Graphics.Color.Black, SFML.Graphics.Color.Red, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.NpcSpawn) { rec.FillColor = SFML.Graphics.Color.Yellow; E_Graphics.GameWindow.Draw(rec); DrawText(tX, tY, "S", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Shop) { DrawText(tX, tY, "SH", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Bank) { DrawText(tX, tY, "BA", SFML.Graphics.Color.Blue, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Heal) { DrawText(tX, tY, "H", SFML.Graphics.Color.Green, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Trap) { DrawText(tX, tY, "T", SFML.Graphics.Color.Red, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.House) { DrawText(tX, tY, "H", SFML.Graphics.Color.Green, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Craft) { DrawText(tX, tY, "C", SFML.Graphics.Color.Green, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } else if (E_Types.Map.Tile[X, y].Type == (byte)Enums.TileType.Light) { DrawText(tX, tY, "L", SFML.Graphics.Color.Yellow, SFML.Graphics.Color.Black, E_Graphics.GameWindow); } } } } } }
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(); }
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(); }
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); }
public void NudIcon_Scroll(object sender, EventArgs e) { Types.Skill[E_Globals.Editorindex].Icon = (int)nudIcon.Value; E_Graphics.EditorSkill_BltIcon(); }