internal static void DrawResource(int resource, int dx, int dy, Rectangle rec) { if (resource < 1 || resource > C_Graphics.NumResources) { return; } int x = 0; int y = 0; int width; int height; x = C_Graphics.ConvertMapX(dx); y = C_Graphics.ConvertMapY(dy); width = rec.Right - rec.Left; height = rec.Bottom - rec.Top; if (rec.Width < 0 || rec.Height < 0) { return; } if (C_Graphics.ResourcesGfxInfo[resource].IsLoaded == false) { C_Graphics.LoadTexture(resource, (byte)5); } //seeying we still use it, lets update timer ref var with_1 = ref C_Graphics.ResourcesGfxInfo[resource];
internal static void DrawNpcName(int mapNpcNum) { int textX = 0; int textY = 0; Color color = new Color(); Color backcolor = new Color(); int npcNum = 0; npcNum = C_Maps.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(C_Graphics.ConvertMapX(C_Maps.MapNpc[mapNpcNum].X * C_Constants.PicX) + C_Maps.MapNpc[mapNpcNum].XOffset + (C_Constants.PicX / 2) - (double)GetTextWidth(Types.Npc[npcNum].Name.Trim()) / 2); if (Types.Npc[npcNum].Sprite <1 || Types.Npc[npcNum].Sprite> C_Graphics.NumCharacters) { textY = C_Graphics.ConvertMapY(C_Maps.MapNpc[mapNpcNum].Y * C_Constants.PicY) + C_Maps.MapNpc[mapNpcNum].YOffset - 16; } else { textY = System.Convert.ToInt32(C_Graphics.ConvertMapY(C_Maps.MapNpc[mapNpcNum].Y * C_Constants.PicY) + C_Maps.MapNpc[mapNpcNum].YOffset - ((double)C_Graphics.CharacterGfxInfo[Types.Npc[npcNum].Sprite].Height / 4) + 16); } // Draw name DrawText(textX, textY, Types.Npc[npcNum].Name.Trim(), color, backcolor, C_Graphics.GameWindow); }
public static void UpdateUi() { if (ReloadFrmMain == true) { ReloadFrmMain = false; } if (C_Variables.UpdateNews == true) { FrmMenu.Default.lblNews.Text = C_Variables.News; FrmMenu.Default.Text = C_Constants.GameName; FrmGame.Default.Text = C_Constants.GameName; C_Variables.UpdateNews = false; } if (PnlRegisterVisible != FrmMenu.Default.pnlRegister.Visible) { FrmMenu.Default.pnlRegister.Visible = PnlRegisterVisible; FrmMenu.Default.pnlRegister.BringToFront(); } if (DrawChar == true) { FrmMenu.Default.DrawCharacter(); DrawChar = false; } if (PnlCharCreateVisible != FrmMenu.Default.pnlNewChar.Visible) { FrmMenu.Default.pnlNewChar.Visible = PnlCharCreateVisible; FrmMenu.Default.pnlNewChar.BringToFront(); DrawChar = true; } if (Lblnextcharleft != FrmMenu.Default.lblNextChar.Left) { FrmMenu.Default.lblNextChar.Left = Lblnextcharleft; } if (!ReferenceEquals(Cmbclass, null)) { FrmMenu.Default.cmbClass.Items.Clear(); for (var i = 1; i <= (Cmbclass.Length - 1); i++) { FrmMenu.Default.cmbClass.Items.Add(Cmbclass[(int)i]); } FrmMenu.Default.cmbClass.SelectedIndex = 0; FrmMenu.Default.rdoMale.Checked = true; FrmMenu.Default.txtCharName.Focus(); Cmbclass = null; } if (PnlLoginVisible != FrmMenu.Default.pnlLogin.Visible) { FrmMenu.Default.pnlLogin.Visible = PnlLoginVisible; if (PnlLoginVisible) { FrmMenu.Default.txtLogin.Focus(); } } if (PnlCreditsVisible != FrmMenu.Default.pnlCredits.Visible) { FrmMenu.Default.pnlCredits.Visible = PnlCreditsVisible; } if (Frmmenuvisible != FrmMenu.Default.Visible) { FrmMenu.Default.Visible = Frmmenuvisible; } if (DrawCharSelect) { FrmMenu.Default.DrawCharacterSelect(); DrawCharSelect = false; } if (PnlCharSelectVisible != FrmMenu.Default.pnlCharSelect.Visible) { FrmMenu.Default.pnlCharSelect.Visible = PnlCharSelectVisible; if (PnlCharSelectVisible) { DrawCharSelect = true; } } if (Frmmaingamevisible != FrmGame.Default.Visible) { FrmGame.Default.Visible = Frmmaingamevisible; } if (C_Crafting.InitCrafting == true) { C_Crafting.CraftingInit(); C_Crafting.InitCrafting = false; } if (NeedToOpenShop == true) { C_GameLogic.OpenShop(NeedToOpenShopNum); NeedToOpenShop = false; NeedToOpenShopNum = 0; PnlShopVisible = true; } if (NeedToOpenBank == true) { C_Banks.InBank = System.Convert.ToInt32(true); PnlBankVisible = true; C_Banks.DrawBank(); NeedToOpenBank = false; } if (NeedToOpenTrade == true) { C_Trade.InTrade = true; PnlTradeVisible = true; NeedToOpenTrade = false; } if (NeedtoCloseTrade == true) { C_Trade.InTrade = false; PnlTradeVisible = false; NeedtoCloseTrade = false; } if (NeedtoUpdateTrade == true) { C_Trade.DrawTrade(); NeedtoUpdateTrade = false; } if (UpdateCharacterPanel == true) { UpdateCharacterPanel = false; } if (Pnlloadvisible != FrmMenu.Default.pnlLoad.Visible) { FrmMenu.Default.pnlLoad.Visible = Pnlloadvisible; } if (UpdateMapnames == true) { int x = 0; FrmAdmin.Default.lstMaps.Items.Clear(); for (x = 1; x <= Constants.MAX_MAPS; x++) { FrmAdmin.Default.lstMaps.Items.Add(x.ToString()); FrmAdmin.Default.lstMaps.Items[x - 1].SubItems.Add(C_Types.MapNames[x]); } UpdateMapnames = false; } if (Adminvisible == true) { FrmAdmin.Default.Visible = !FrmAdmin.Default.Visible; Adminvisible = false; } if (C_Quest.UpdateQuestChat == true) { C_Variables.DialogMsg1 = "Quest: " + Microsoft.VisualBasic.Strings.Trim(C_Quest.Quest[C_Quest.QuestNum].Name); C_Variables.DialogMsg2 = C_Quest.QuestMessage; C_Variables.DialogType = C_Constants.DialogueTypeQuest; if (C_Quest.QuestNumForStart > 0 && C_Quest.QuestNumForStart <= C_Quest.MaxQuests) { C_Quest.QuestAcceptTag = C_Quest.QuestNumForStart; } C_Variables.UpdateDialog = true; C_Quest.UpdateQuestChat = false; } if (C_Quest.UpdateQuestWindow == true) { C_Quest.LoadQuestlogBox(); C_Quest.UpdateQuestWindow = false; } if (C_Variables.UpdateDialog == true) { if (C_Variables.DialogType == C_Constants.DialogueTypeBuyhome || C_Variables.DialogType == C_Constants.DialogueTypeVisit) //house offer & visit { C_Variables.DialogButton1Text = "Accept"; C_Variables.DialogButton2Text = "Decline"; DialogPanelVisible = true; } else if (C_Variables.DialogType == C_Constants.DialogueTypeParty || C_Variables.DialogType == C_Constants.DialogueTypeTrade) { C_Variables.DialogButton1Text = "Accept"; C_Variables.DialogButton2Text = "Decline"; DialogPanelVisible = true; } else if (C_Variables.DialogType == C_Constants.DialogueTypeQuest) { C_Variables.DialogButton1Text = "Accept"; C_Variables.DialogButton2Text = "Ok"; if (C_Quest.QuestAcceptTag > 0) { C_Variables.DialogButton2Text = "Decline"; } DialogPanelVisible = true; } C_Variables.UpdateDialog = false; } if (C_EventSystem.EventChat == true) { PnlEventChatVisible = true; C_EventSystem.EventChat = false; } if (C_Variables.ShowRClick == true) { RClickname = C_Types.Player[C_Variables.MyTarget].Name; RClickX = C_Graphics.ConvertMapX(C_Variables.CurX * C_Constants.PicX); RClickY = C_Graphics.ConvertMapY(C_Variables.CurY * C_Constants.PicY); PnlRClickVisible = true; C_Variables.ShowRClick = false; } if (InitMapEditor == true) { FrmEditor_MapEditor.Default.MapEditorInit(); InitMapEditor = false; } if (InitMapProperties == true) { FrmEditor_MapEditor.Default.MapPropertiesInit(); InitMapProperties = false; } if (C_EventSystem.InitEventEditorForm == true) { FrmEditor_Events.Default.InitEventEditorForm(); // populate form // set the tabs if (FrmEditor_Events.Default.tabPages != null && FrmEditor_Events.Default.tabPages.TabPages != null) { FrmEditor_Events.Default.tabPages.TabPages.Clear(); for (var i = 1; i <= C_EventSystem.TmpEvent.PageCount; i++) { FrmEditor_Events.Default.tabPages.TabPages.Add(Conversion.Str(i)); } // items FrmEditor_Events.Default.cmbHasItem.Items.Clear(); FrmEditor_Events.Default.cmbHasItem.Items.Add("None"); for (var i = 1; i <= Constants.MAX_ITEMS; i++) { FrmEditor_Events.Default.cmbHasItem.Items.Add(i + ": " + Microsoft.VisualBasic.Strings.Trim(Types.Item[(int)i].Name)); } // variables FrmEditor_Events.Default.cmbPlayerVar.Items.Clear(); FrmEditor_Events.Default.cmbPlayerVar.Items.Add("None"); for (var i = 1; i <= C_EventSystem.MaxVariables; i++) { FrmEditor_Events.Default.cmbPlayerVar.Items.Add(i + ". " + C_EventSystem.Variables[(int)i]); } // variables FrmEditor_Events.Default.cmbPlayerSwitch.Items.Clear(); FrmEditor_Events.Default.cmbPlayerSwitch.Items.Add("None"); for (var i = 1; i <= C_EventSystem.MaxSwitches; i++) { FrmEditor_Events.Default.cmbPlayerSwitch.Items.Add(i + ". " + C_EventSystem.Switches[(int)i]); } // name FrmEditor_Events.Default.txtName.Text = C_EventSystem.TmpEvent.Name; // enable delete button if (C_EventSystem.TmpEvent.PageCount > 1) { FrmEditor_Events.Default.btnDeletePage.Enabled = true; } else { FrmEditor_Events.Default.btnDeletePage.Enabled = false; } FrmEditor_Events.Default.btnPastePage.Enabled = false; // Load page 1 to start off with C_EventSystem.CurPageNum = 1; C_EventSystem.EventEditorLoadPage(C_EventSystem.CurPageNum); FrmEditor_Events.Default.nudShowTextFace.Maximum = C_Graphics.NumFaces; FrmEditor_Events.Default.nudShowChoicesFace.Maximum = C_Graphics.NumFaces; // show the editor FrmEditor_Events.Default.Show(); C_EventSystem.InitEventEditorForm = false; } } if (OptionsVisible == true) { // show in GUI if (C_Types.Options.Music == 1) { FrmOptions.Default.optMOn.Checked = true; } else { FrmOptions.Default.optMOff.Checked = true; } if (C_Types.Options.Music == 1) { FrmOptions.Default.optSOn.Checked = true; } else { FrmOptions.Default.optSOff.Checked = true; } FrmOptions.Default.lblVolume.Text = "Volume: " + System.Convert.ToString(C_Types.Options.Volume); FrmOptions.Default.scrlVolume.Value = (int)C_Types.Options.Volume; FrmOptions.Default.cmbScreenSize.SelectedIndex = C_Types.Options.ScreenSize; if (C_Types.Options.VSync == 1) { FrmOptions.Default.chkVSync.Checked = true; } else { FrmOptions.Default.chkVSync.Checked = false; } if (C_Types.Options.UnlockFPS == 1) { FrmOptions.Default.checkBox1.Checked = true; } else { FrmOptions.Default.checkBox1.Checked = false; } if (C_Types.Options.ShowNpcBar == 1) { FrmOptions.Default.chkNpcBars.Checked = true; } else { FrmOptions.Default.chkNpcBars.Checked = false; } FrmOptions.Default.Visible = true; OptionsVisible = false; } }
internal static void DrawPlayerName(int index) { int textX = 0; int textY = 0; Color color = new Color(); Color backcolor = new Color(); string name = ""; // Check access level if (C_Player.GetPlayerPk(index) == 0) { switch (C_Player.GetPlayerAccess(index)) { case (int)Enums.AdminType.Player: color = SFML.Graphics.Color.Red; backcolor = SFML.Graphics.Color.Black; break; case (int)Enums.AdminType.Monitor: color = SFML.Graphics.Color.Black; backcolor = SFML.Graphics.Color.White; break; case (int)Enums.AdminType.Mapper: color = SFML.Graphics.Color.Cyan; backcolor = SFML.Graphics.Color.Black; break; case (int)Enums.AdminType.Developer: color = SFML.Graphics.Color.Green; backcolor = SFML.Graphics.Color.Black; break; case (int)Enums.AdminType.Creator: color = SFML.Graphics.Color.Yellow; backcolor = SFML.Graphics.Color.Black; break; } } else { color = SFML.Graphics.Color.Red; } name = C_Types.Player[index].Name.Trim(); // calc pos textX = System.Convert.ToInt32(C_Graphics.ConvertMapX(C_Player.GetPlayerX(index) * C_Constants.PicX) + C_Types.Player[index].XOffset + (C_Constants.PicX / 2)); textX = System.Convert.ToInt32(textX - ((double)GetTextWidth(name.Trim()) / 2)); if (C_Player.GetPlayerSprite(index) < 1 || C_Player.GetPlayerSprite(index) > C_Graphics.NumCharacters) { textY = C_Graphics.ConvertMapY(C_Player.GetPlayerY(index) * C_Constants.PicY) + C_Types.Player[index].YOffset - 16; } else { // Determine location for text textY = System.Convert.ToInt32(C_Graphics.ConvertMapY(C_Player.GetPlayerY(index) * C_Constants.PicY) + C_Types.Player[index].YOffset - ((double)C_Graphics.CharacterGfxInfo[C_Player.GetPlayerSprite(index)].Height / 4) + 16); } // Draw name DrawText(textX, textY, name.Trim(), color, backcolor, C_Graphics.GameWindow); }
public static void DrawMapAttributes() { int X = 0; int y = 0; int tX = 0; int tY = 0; if (ReferenceEquals(FrmEditor_MapEditor.Default.tabpages.SelectedTab, FrmEditor_MapEditor.Default.tpAttributes)) { for (X = C_Variables.TileView.Left; X <= C_Variables.TileView.Right; X++) { for (y = C_Variables.TileView.Top; y <= C_Variables.TileView.Bottom; y++) { if (C_Graphics.IsValidMapPoint(X, y)) { ref var with_1 = ref C_Maps.Map.Tile[X, y]; tX = System.Convert.ToInt32(((C_Graphics.ConvertMapX(X * C_Constants.PicX)) - 4) + (C_Constants.PicX * 0.5)); tY = System.Convert.ToInt32(((C_Graphics.ConvertMapY(y * C_Constants.PicY)) - 7) + (C_Constants.PicY * 0.5)); if (with_1.Type == (byte)Enums.TileType.Blocked) { DrawText(tX, tY, "B", Color.Red, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Warp) { DrawText(tX, tY, "W", Color.Blue, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Item) { DrawText(tX, tY, "I", Color.White, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.NpcAvoid) { DrawText(tX, tY, "N", Color.White, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Key) { DrawText(tX, tY, "K", Color.White, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.KeyOpen) { DrawText(tX, tY, "KO", Color.White, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Resource) { DrawText(tX, tY, "R", Color.Green, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Door) { DrawText(tX, tY, "D", Color.Black, Color.Red, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.NpcSpawn) { DrawText(tX, tY, "S", Color.Yellow, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Shop) { DrawText(tX, tY, "SH", Color.Blue, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Bank) { DrawText(tX, tY, "BA", Color.Blue, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Heal) { DrawText(tX, tY, "H", Color.Green, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Trap) { DrawText(tX, tY, "T", Color.Red, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.House) { DrawText(tX, tY, "H", Color.Green, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Craft) { DrawText(tX, tY, "C", Color.Green, Color.Black, C_Graphics.GameWindow); } else if (with_1.Type == (byte)Enums.TileType.Light) { DrawText(tX, tY, "L", Color.Yellow, Color.Black, C_Graphics.GameWindow); } } } } }
internal static void DrawEventName(int index) { int textX = 0; int textY = 0; Color color = new Color(); Color backcolor = new Color(); string name = ""; color = SFML.Graphics.Color.Yellow; backcolor = SFML.Graphics.Color.Black; name = C_Maps.Map.MapEvents[index].Name.Trim(); // calc pos textX = System.Convert.ToInt32(C_Graphics.ConvertMapX(C_Maps.Map.MapEvents[index].X * C_Constants.PicX) + C_Maps.Map.MapEvents[index].XOffset + (C_Constants.PicX / 2) - GetTextWidth(name.Trim()) / 2); if (C_Maps.Map.MapEvents[index].GraphicType == 0) { textY = C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - 16; } else if (C_Maps.Map.MapEvents[index].GraphicType == 1) { if (C_Maps.Map.MapEvents[index].GraphicNum <1 || C_Maps.Map.MapEvents[index].GraphicNum> C_Graphics.NumCharacters) { textY = C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - 16; } else { // Determine location for text textY = System.Convert.ToInt32(C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - (C_Graphics.CharacterGfxInfo[C_Maps.Map.MapEvents[index].GraphicNum].Height / 4) + 16); } } else if (C_Maps.Map.MapEvents[index].GraphicType == 2) { if (C_Maps.Map.MapEvents[index].GraphicY2 > 0) { textX = textX + (C_Maps.Map.MapEvents[index].GraphicY2 * C_Constants.PicY) / 2 - 16; textY = C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - (C_Maps.Map.MapEvents[index].GraphicY2 * C_Constants.PicY) + 16; } else { textY = C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - 32 + 16; } } // Draw name DrawText(textX, textY, name.Trim(), color, backcolor, C_Graphics.GameWindow); //For i = 1 To MaxQuests // 'check if the npc is the starter to any quest: [!] symbol // 'can accept the quest as a new one // If Player(MyIndex).PlayerQuest(i).Status = QuestStatusType.NotStarted OrElse Player(MyIndex).PlayerQuest(i).Status = QuestStatusType.Repeatable OrElse (Player(MyIndex).PlayerQuest(i).Status = QuestStatusType.Completed AndAlso Quest(i).Repeat = 1) Then // 'the npc gives this quest // If Map.MapEvents(Index).questnum = i Then // Name = "[!]" // TextX = ConvertMapX(Map.MapEvents(Index).X * PicX) + Map.MapEvents(Index).XOffset + (PicX \ 2) - GetTextWidth((Trim$("[!]"))) + 8 // TextY = TextY - 16 // If Quest(i).Repeat = 1 Then // DrawText(TextX, TextY, Trim$(Name), Color.White, backcolor, GameWindow) // Else // DrawText(TextX, TextY, Trim$(Name), color, backcolor, GameWindow) // End If // Exit For // End If // ElseIf Player(MyIndex).PlayerQuest(i).Status = QuestStatusType.Started Then // If Map.MapEvents(Index).questnum = i Then // Name = "[*]" // TextX = ConvertMapX(Map.MapEvents(Index).X * PicX) + Map.MapEvents(Index).XOffset + (PicX \ 2) - GetTextWidth((Trim$("[*]"))) + 8 // TextY = TextY - 16 // DrawText(TextX, TextY, Trim$(Name), color, backcolor, GameWindow) // Exit For // End If // End If //Next }
internal static void DrawChatBubble(int index) { List <string> theArray = default(List <string>); int x = 0; int y = 0; int i = 0; int maxWidth = 0; int x2 = 0; int y2 = 0; if (C_Variables.ChatBubble[index].TargetType == (byte)Enums.TargetType.Player) { // it's a player if (C_Player.GetPlayerMap((C_Variables.ChatBubble[index].Target)) == C_Player.GetPlayerMap(C_Variables.Myindex)) { // it's on our map - get co-ords x = C_Graphics.ConvertMapX((C_Types.Player[C_Variables.ChatBubble[index].Target].X * 32) + C_Types.Player[C_Variables.ChatBubble[index].Target].XOffset) + 16; y = C_Graphics.ConvertMapY((C_Types.Player[C_Variables.ChatBubble[index].Target].Y * 32) + C_Types.Player[C_Variables.ChatBubble[index].Target].YOffset) - 40; } } else if (C_Variables.ChatBubble[index].TargetType == (byte)Enums.TargetType.Npc) { // it's on our map - get co-ords x = C_Graphics.ConvertMapX((C_Maps.MapNpc[C_Variables.ChatBubble[index].Target].X * 32) + C_Maps.MapNpc[C_Variables.ChatBubble[index].Target].XOffset) + 16; y = C_Graphics.ConvertMapY((C_Maps.MapNpc[C_Variables.ChatBubble[index].Target].Y * 32) + C_Maps.MapNpc[C_Variables.ChatBubble[index].Target].YOffset) - 40; } else if (C_Variables.ChatBubble[index].TargetType == (byte)Enums.TargetType.Event) { x = C_Graphics.ConvertMapX((C_Maps.Map.MapEvents[C_Variables.ChatBubble[index].Target].X * 32) + C_Maps.Map.MapEvents[C_Variables.ChatBubble[index].Target].XOffset) + 16; y = C_Graphics.ConvertMapY((C_Maps.Map.MapEvents[C_Variables.ChatBubble[index].Target].Y * 32) + C_Maps.Map.MapEvents[C_Variables.ChatBubble[index].Target].YOffset) - 40; } // word wrap the text theArray = WordWrap(System.Convert.ToString(C_Variables.ChatBubble[index].Msg), C_Constants.ChatBubbleWidth, WrapMode.Font, WrapType.Smart, 13); // find max width for (i = 0; i <= theArray.Count - 1; i++) { if (GetTextWidth(theArray[i]) > maxWidth) { maxWidth = GetTextWidth(theArray[i]); } } // calculate the new position x2 = x - (maxWidth / 2); y2 = y - (theArray.Count * 12); // render bubble - top left C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 - 9, y2 - 5, 0, 0, 9, 5, 9, 5); // top right C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 + maxWidth, y2 - 5, 119, 0, 9, 5, 9, 5); // top C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2, y2 - 5, 10, 0, maxWidth, 5, 5, 5); // bottom left C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 - 9, y, 0, 19, 9, 6, 9, 6); // bottom right C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 + maxWidth, y, 119, 19, 9, 6, 9, 6); // bottom - left half C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2, y, 10, 19, System.Convert.ToSingle((maxWidth / 2) - 5), 6, 9, 6); // bottom - right half C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 + (maxWidth / 2) + 6, y, 10, 19, System.Convert.ToSingle((maxWidth / 2) - 5), 6, 9, 6); // left C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 - 9, y2, 0, 6, 9, theArray.Count * 12, 9, 1); // right C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 + maxWidth, y2, 119, 6, 9, theArray.Count * 12, 9, 1); // center C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2, y2, 9, 5, maxWidth, theArray.Count * 12, 1, 1); // little pointy bit C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x - 5, y, 58, 19, 11, 11, 11, 11); // render each line centralised for (i = 0; i <= theArray.Count - 1; i++) { DrawText((int)(x - ((double)GetTextWidth(theArray[i]) / 2)), y2, theArray[i], C_Graphics.ToSfmlColor(System.Drawing.ColorTranslator.FromOle(Information.QBColor((int)(C_Variables.ChatBubble[index].Colour)))), Color.Black, C_Graphics.GameWindow); y2 = y2 + 12; } // check if it's timed out - close it if so if (C_Variables.ChatBubble[index].Timer + 5000 < C_General.GetTickCount()) { C_Variables.ChatBubble[index].Active = false; } }
public static void DrawActionMsg(int index) { int x = 0; int y = 0; int i = 0; int time = 0; // how long we want each message to appear switch (C_Types.ActionMsg[index].Type) { case (int)Enums.ActionMsgType.Static: time = 1500; if (C_Types.ActionMsg[index].Y > 0) { x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) - 2; } else { x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) + 18; } break; case (int)Enums.ActionMsgType.Scroll: time = 1500; if (C_Types.ActionMsg[index].Y > 0) { x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = (int)(C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) - 2 - (C_Types.ActionMsg[index].Scroll * 0.6)); C_Types.ActionMsg[index].Scroll = C_Types.ActionMsg[index].Scroll + 1; } else { x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = (int)(C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) + 18 + (C_Types.ActionMsg[index].Scroll * 0.6)); C_Types.ActionMsg[index].Scroll = C_Types.ActionMsg[index].Scroll + 1; } break; case (int)Enums.ActionMsgType.Screen: time = 3000; // This will kill any action screen messages that there in the system for (i = byte.MaxValue; i >= 1; i--) { if (C_Types.ActionMsg[i].Type == (int)Enums.ActionMsgType.Screen) { if (i != index) { C_GameLogic.ClearActionMsg((byte)index); index = i; } } } x = (int)((FrmGame.Default.picscreen.Width / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8)); y = 425; break; } x = C_Graphics.ConvertMapX(x); y = C_Graphics.ConvertMapY(y); if (C_General.GetTickCount() < C_Types.ActionMsg[index].Created + time) { DrawText(x, y, C_Types.ActionMsg[index].Message, GetSfmlColor((byte)(C_Types.ActionMsg[index].Color)), Color.Black, C_Graphics.GameWindow); } else { C_GameLogic.ClearActionMsg((byte)index); } }
internal static void DrawWeather() { int i = 0; int spriteLeft = 0; for (i = 1; i <= MaxWeatherParticles; i++) { if (System.Convert.ToBoolean(WeatherParticle[i].InUse)) { if (WeatherParticle[i].Type == (int)Enums.WeatherType.Storm) { spriteLeft = 0; } else { spriteLeft = WeatherParticle[i].Type - 1; } C_Graphics.RenderSprite(C_Graphics.WeatherSprite, C_Graphics.GameWindow, C_Graphics.ConvertMapX(WeatherParticle[i].X), C_Graphics.ConvertMapY(WeatherParticle[i].Y), spriteLeft * 32, 0, 32, 32); } } }