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); }
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 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); } } } }
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 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); } } }