From fbe4373b079b8d6365dce679d6601b44b32e788a Mon Sep 17 00:00:00 2001 From: dexy Date: Thu, 31 Oct 2019 19:11:10 +1100 Subject: [PATCH] Deleted ancient MapForm files --- MapForm.Designer.cs | 847 ------------------------------ MapForm.cs | 1206 ------------------------------------------- MapForm.resx | 132 ----- 3 files changed, 2185 deletions(-) delete mode 100644 MapForm.Designer.cs delete mode 100644 MapForm.cs delete mode 100644 MapForm.resx diff --git a/MapForm.Designer.cs b/MapForm.Designer.cs deleted file mode 100644 index 6aeb6af..0000000 --- a/MapForm.Designer.cs +++ /dev/null @@ -1,847 +0,0 @@ -namespace CodeWalker -{ - partial class MapForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MapForm)); - this.MapComboBox = new System.Windows.Forms.ComboBox(); - this.LoadingLabel = new System.Windows.Forms.Label(); - this.MainPanel = new System.Windows.Forms.Panel(); - this.MainPanelHideButton = new System.Windows.Forms.Button(); - this.MainTabControl = new System.Windows.Forms.TabControl(); - this.ToolsTabPage = new System.Windows.Forms.TabPage(); - this.ResetMarkersButton = new System.Windows.Forms.Button(); - this.ClearMarkersButton = new System.Windows.Forms.Button(); - this.GoToButton = new System.Windows.Forms.Button(); - this.LocatorStatusLabel = new System.Windows.Forms.Label(); - this.ShowLocatorCheckBox = new System.Windows.Forms.CheckBox(); - this.label5 = new System.Windows.Forms.Label(); - this.LocateTextBox = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.AddMarkersButton = new System.Windows.Forms.Button(); - this.MultiFindTextBox = new System.Windows.Forms.TextBox(); - this.MarkersTabPage = new System.Windows.Forms.TabPage(); - this.GoToSelectedMarkerButton = new System.Windows.Forms.Button(); - this.CopyMarkersButton = new System.Windows.Forms.Button(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); - this.MarkersListView = new System.Windows.Forms.ListView(); - this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.OptionsTabPage = new System.Windows.Forms.TabPage(); - this.LocatorStyleComboBox = new System.Windows.Forms.ComboBox(); - this.label6 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.SmoothingUpDown = new System.Windows.Forms.NumericUpDown(); - this.label2 = new System.Windows.Forms.Label(); - this.ZoomSpeedUpDown = new System.Windows.Forms.NumericUpDown(); - this.MarkerStyleComboBox = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.CalibrateTabPage = new System.Windows.Forms.TabPage(); - this.label11 = new System.Windows.Forms.Label(); - this.UnitsPerTexelYTextBox = new System.Windows.Forms.TextBox(); - this.CalibrationErrorLabel = new System.Windows.Forms.Label(); - this.CalibrateButton = new System.Windows.Forms.Button(); - this.CalibrationPointsTextBox = new System.Windows.Forms.TextBox(); - this.label10 = new System.Windows.Forms.Label(); - this.SetCoordButton = new System.Windows.Forms.Button(); - this.label12 = new System.Windows.Forms.Label(); - this.WorldCoordTextBox = new System.Windows.Forms.TextBox(); - this.TextureFileLabel = new System.Windows.Forms.Label(); - this.TextureNameLabel = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.UnitsPerTexelXTextBox = new System.Windows.Forms.TextBox(); - this.SetOriginButton = new System.Windows.Forms.Button(); - this.label8 = new System.Windows.Forms.Label(); - this.TextureOriginTextBox = new System.Windows.Forms.TextBox(); - this.label7 = new System.Windows.Forms.Label(); - this.TextureCoordTextBox = new System.Windows.Forms.TextBox(); - this.MainPanelShowButton = new System.Windows.Forms.Button(); - this.SelectionPanel = new System.Windows.Forms.Panel(); - this.SelectionPositionTextBox = new System.Windows.Forms.TextBox(); - this.SelectionNameTextBox = new System.Windows.Forms.TextBox(); - this.MainPanel.SuspendLayout(); - this.MainTabControl.SuspendLayout(); - this.ToolsTabPage.SuspendLayout(); - this.MarkersTabPage.SuspendLayout(); - this.OptionsTabPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.SmoothingUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.ZoomSpeedUpDown)).BeginInit(); - this.CalibrateTabPage.SuspendLayout(); - this.SelectionPanel.SuspendLayout(); - this.SuspendLayout(); - // - // MapComboBox - // - this.MapComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.MapComboBox.FormattingEnabled = true; - this.MapComboBox.Location = new System.Drawing.Point(12, 12); - this.MapComboBox.Name = "MapComboBox"; - this.MapComboBox.Size = new System.Drawing.Size(82, 21); - this.MapComboBox.TabIndex = 0; - this.MapComboBox.SelectedIndexChanged += new System.EventHandler(this.MapComboBox_SelectedIndexChanged); - // - // LoadingLabel - // - this.LoadingLabel.AutoSize = true; - this.LoadingLabel.BackColor = System.Drawing.Color.Transparent; - this.LoadingLabel.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LoadingLabel.ForeColor = System.Drawing.Color.White; - this.LoadingLabel.Location = new System.Drawing.Point(315, 52); - this.LoadingLabel.Name = "LoadingLabel"; - this.LoadingLabel.Size = new System.Drawing.Size(166, 18); - this.LoadingLabel.TabIndex = 1; - this.LoadingLabel.Text = "Loading texture..."; - this.LoadingLabel.Visible = false; - // - // MainPanel - // - this.MainPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.MainPanel.BackColor = System.Drawing.Color.Silver; - this.MainPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.MainPanel.Controls.Add(this.MainPanelHideButton); - this.MainPanel.Controls.Add(this.MainTabControl); - this.MainPanel.Location = new System.Drawing.Point(607, 2); - this.MainPanel.Name = "MainPanel"; - this.MainPanel.Size = new System.Drawing.Size(240, 619); - this.MainPanel.TabIndex = 2; - this.MainPanel.Visible = false; - // - // MainPanelHideButton - // - this.MainPanelHideButton.Location = new System.Drawing.Point(198, 7); - this.MainPanelHideButton.Name = "MainPanelHideButton"; - this.MainPanelHideButton.Size = new System.Drawing.Size(31, 23); - this.MainPanelHideButton.TabIndex = 0; - this.MainPanelHideButton.Text = ">>"; - this.MainPanelHideButton.UseVisualStyleBackColor = true; - this.MainPanelHideButton.Click += new System.EventHandler(this.MainPanelHideButton_Click); - // - // MainTabControl - // - this.MainTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.MainTabControl.Controls.Add(this.ToolsTabPage); - this.MainTabControl.Controls.Add(this.MarkersTabPage); - this.MainTabControl.Controls.Add(this.OptionsTabPage); - this.MainTabControl.Controls.Add(this.CalibrateTabPage); - this.MainTabControl.Location = new System.Drawing.Point(-1, 36); - this.MainTabControl.Name = "MainTabControl"; - this.MainTabControl.SelectedIndex = 0; - this.MainTabControl.Size = new System.Drawing.Size(240, 582); - this.MainTabControl.TabIndex = 1; - // - // ToolsTabPage - // - this.ToolsTabPage.Controls.Add(this.ResetMarkersButton); - this.ToolsTabPage.Controls.Add(this.ClearMarkersButton); - this.ToolsTabPage.Controls.Add(this.GoToButton); - this.ToolsTabPage.Controls.Add(this.LocatorStatusLabel); - this.ToolsTabPage.Controls.Add(this.ShowLocatorCheckBox); - this.ToolsTabPage.Controls.Add(this.label5); - this.ToolsTabPage.Controls.Add(this.LocateTextBox); - this.ToolsTabPage.Controls.Add(this.label4); - this.ToolsTabPage.Controls.Add(this.AddMarkersButton); - this.ToolsTabPage.Controls.Add(this.MultiFindTextBox); - this.ToolsTabPage.Location = new System.Drawing.Point(4, 22); - this.ToolsTabPage.Name = "ToolsTabPage"; - this.ToolsTabPage.Size = new System.Drawing.Size(232, 556); - this.ToolsTabPage.TabIndex = 2; - this.ToolsTabPage.Text = "Tools"; - this.ToolsTabPage.UseVisualStyleBackColor = true; - // - // ResetMarkersButton - // - this.ResetMarkersButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.ResetMarkersButton.Location = new System.Drawing.Point(149, 507); - this.ResetMarkersButton.Name = "ResetMarkersButton"; - this.ResetMarkersButton.Size = new System.Drawing.Size(83, 23); - this.ResetMarkersButton.TabIndex = 9; - this.ResetMarkersButton.Text = "Reset markers"; - this.ResetMarkersButton.UseVisualStyleBackColor = true; - this.ResetMarkersButton.Click += new System.EventHandler(this.ResetMarkersButton_Click); - // - // ClearMarkersButton - // - this.ClearMarkersButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.ClearMarkersButton.Location = new System.Drawing.Point(149, 478); - this.ClearMarkersButton.Name = "ClearMarkersButton"; - this.ClearMarkersButton.Size = new System.Drawing.Size(83, 23); - this.ClearMarkersButton.TabIndex = 8; - this.ClearMarkersButton.Text = "Clear markers"; - this.ClearMarkersButton.UseVisualStyleBackColor = true; - this.ClearMarkersButton.Click += new System.EventHandler(this.ClearMarkersButton_Click); - // - // GoToButton - // - this.GoToButton.Location = new System.Drawing.Point(189, 48); - this.GoToButton.Name = "GoToButton"; - this.GoToButton.Size = new System.Drawing.Size(43, 22); - this.GoToButton.TabIndex = 7; - this.GoToButton.Text = "Go to"; - this.GoToButton.UseVisualStyleBackColor = true; - this.GoToButton.Click += new System.EventHandler(this.GoToButton_Click); - // - // LocatorStatusLabel - // - this.LocatorStatusLabel.AutoSize = true; - this.LocatorStatusLabel.Location = new System.Drawing.Point(3, 72); - this.LocatorStatusLabel.Name = "LocatorStatusLabel"; - this.LocatorStatusLabel.Size = new System.Drawing.Size(193, 13); - this.LocatorStatusLabel.TabIndex = 6; - this.LocatorStatusLabel.Text = "Enter coord above or drag the marker..."; - // - // ShowLocatorCheckBox - // - this.ShowLocatorCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.ShowLocatorCheckBox.AutoSize = true; - this.ShowLocatorCheckBox.Checked = true; - this.ShowLocatorCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.ShowLocatorCheckBox.Location = new System.Drawing.Point(101, 32); - this.ShowLocatorCheckBox.Name = "ShowLocatorCheckBox"; - this.ShowLocatorCheckBox.Size = new System.Drawing.Size(88, 17); - this.ShowLocatorCheckBox.TabIndex = 5; - this.ShowLocatorCheckBox.Text = "Show marker"; - this.ShowLocatorCheckBox.UseVisualStyleBackColor = true; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(3, 33); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(79, 13); - this.label5.TabIndex = 4; - this.label5.Text = "Locate: X, Y, Z"; - // - // LocateTextBox - // - this.LocateTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.LocateTextBox.Location = new System.Drawing.Point(0, 49); - this.LocateTextBox.Name = "LocateTextBox"; - this.LocateTextBox.Size = new System.Drawing.Size(189, 20); - this.LocateTextBox.TabIndex = 3; - this.LocateTextBox.Text = "0, 0, 0"; - this.LocateTextBox.TextChanged += new System.EventHandler(this.LocateTextBox_TextChanged); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(3, 142); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(122, 13); - this.label4.TabIndex = 2; - this.label4.Text = "Multi-find: X, Y, Z, Name"; - // - // AddMarkersButton - // - this.AddMarkersButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.AddMarkersButton.Location = new System.Drawing.Point(0, 478); - this.AddMarkersButton.Name = "AddMarkersButton"; - this.AddMarkersButton.Size = new System.Drawing.Size(75, 23); - this.AddMarkersButton.TabIndex = 1; - this.AddMarkersButton.Text = "Add markers"; - this.AddMarkersButton.UseVisualStyleBackColor = true; - this.AddMarkersButton.Click += new System.EventHandler(this.AddMarkersButton_Click); - // - // MultiFindTextBox - // - this.MultiFindTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.MultiFindTextBox.Location = new System.Drawing.Point(0, 158); - this.MultiFindTextBox.MaxLength = 999999; - this.MultiFindTextBox.Multiline = true; - this.MultiFindTextBox.Name = "MultiFindTextBox"; - this.MultiFindTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.MultiFindTextBox.Size = new System.Drawing.Size(232, 314); - this.MultiFindTextBox.TabIndex = 0; - // - // MarkersTabPage - // - this.MarkersTabPage.Controls.Add(this.GoToSelectedMarkerButton); - this.MarkersTabPage.Controls.Add(this.CopyMarkersButton); - this.MarkersTabPage.Controls.Add(this.checkBox1); - this.MarkersTabPage.Controls.Add(this.MarkersListView); - this.MarkersTabPage.Location = new System.Drawing.Point(4, 22); - this.MarkersTabPage.Name = "MarkersTabPage"; - this.MarkersTabPage.Padding = new System.Windows.Forms.Padding(3); - this.MarkersTabPage.Size = new System.Drawing.Size(232, 556); - this.MarkersTabPage.TabIndex = 0; - this.MarkersTabPage.Text = "Markers"; - this.MarkersTabPage.UseVisualStyleBackColor = true; - // - // GoToSelectedMarkerButton - // - this.GoToSelectedMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.GoToSelectedMarkerButton.Location = new System.Drawing.Point(141, 494); - this.GoToSelectedMarkerButton.Name = "GoToSelectedMarkerButton"; - this.GoToSelectedMarkerButton.Size = new System.Drawing.Size(91, 23); - this.GoToSelectedMarkerButton.TabIndex = 3; - this.GoToSelectedMarkerButton.Text = "Go to selected"; - this.GoToSelectedMarkerButton.UseVisualStyleBackColor = true; - this.GoToSelectedMarkerButton.Click += new System.EventHandler(this.GoToSelectedMarkerButton_Click); - // - // CopyMarkersButton - // - this.CopyMarkersButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.CopyMarkersButton.Location = new System.Drawing.Point(0, 494); - this.CopyMarkersButton.Name = "CopyMarkersButton"; - this.CopyMarkersButton.Size = new System.Drawing.Size(75, 23); - this.CopyMarkersButton.TabIndex = 2; - this.CopyMarkersButton.Text = "Copy list"; - this.CopyMarkersButton.UseVisualStyleBackColor = true; - this.CopyMarkersButton.Click += new System.EventHandler(this.CopyMarkersButton_Click); - // - // checkBox1 - // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(3, 3); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(78, 17); - this.checkBox1.TabIndex = 1; - this.checkBox1.Text = "Visible only"; - this.checkBox1.UseVisualStyleBackColor = true; - // - // MarkersListView - // - this.MarkersListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.MarkersListView.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.MarkersListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader4, - this.columnHeader1, - this.columnHeader2, - this.columnHeader3}); - this.MarkersListView.FullRowSelect = true; - this.MarkersListView.HideSelection = false; - this.MarkersListView.Location = new System.Drawing.Point(0, 26); - this.MarkersListView.Name = "MarkersListView"; - this.MarkersListView.Size = new System.Drawing.Size(232, 462); - this.MarkersListView.TabIndex = 0; - this.MarkersListView.UseCompatibleStateImageBehavior = false; - this.MarkersListView.View = System.Windows.Forms.View.Details; - this.MarkersListView.DoubleClick += new System.EventHandler(this.MarkersListView_DoubleClick); - // - // columnHeader4 - // - this.columnHeader4.Text = "Name"; - this.columnHeader4.Width = 230; - // - // columnHeader1 - // - this.columnHeader1.Text = "X"; - this.columnHeader1.Width = 75; - // - // columnHeader2 - // - this.columnHeader2.Text = "Y"; - this.columnHeader2.Width = 75; - // - // columnHeader3 - // - this.columnHeader3.Text = "Z"; - this.columnHeader3.Width = 75; - // - // OptionsTabPage - // - this.OptionsTabPage.Controls.Add(this.LocatorStyleComboBox); - this.OptionsTabPage.Controls.Add(this.label6); - this.OptionsTabPage.Controls.Add(this.label3); - this.OptionsTabPage.Controls.Add(this.SmoothingUpDown); - this.OptionsTabPage.Controls.Add(this.label2); - this.OptionsTabPage.Controls.Add(this.ZoomSpeedUpDown); - this.OptionsTabPage.Controls.Add(this.MarkerStyleComboBox); - this.OptionsTabPage.Controls.Add(this.label1); - this.OptionsTabPage.Location = new System.Drawing.Point(4, 22); - this.OptionsTabPage.Name = "OptionsTabPage"; - this.OptionsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.OptionsTabPage.Size = new System.Drawing.Size(232, 556); - this.OptionsTabPage.TabIndex = 1; - this.OptionsTabPage.Text = "Options"; - this.OptionsTabPage.UseVisualStyleBackColor = true; - // - // LocatorStyleComboBox - // - this.LocatorStyleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.LocatorStyleComboBox.FormattingEnabled = true; - this.LocatorStyleComboBox.Location = new System.Drawing.Point(79, 33); - this.LocatorStyleComboBox.Name = "LocatorStyleComboBox"; - this.LocatorStyleComboBox.Size = new System.Drawing.Size(150, 21); - this.LocatorStyleComboBox.TabIndex = 7; - this.LocatorStyleComboBox.SelectedIndexChanged += new System.EventHandler(this.LocatorStyleComboBox_SelectedIndexChanged); - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(3, 36); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(70, 13); - this.label6.TabIndex = 6; - this.label6.Text = "Locator style:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(3, 88); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(60, 13); - this.label3.TabIndex = 5; - this.label3.Text = "Smoothing:"; - // - // SmoothingUpDown - // - this.SmoothingUpDown.DecimalPlaces = 2; - this.SmoothingUpDown.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this.SmoothingUpDown.Location = new System.Drawing.Point(79, 86); - this.SmoothingUpDown.Maximum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.SmoothingUpDown.Name = "SmoothingUpDown"; - this.SmoothingUpDown.Size = new System.Drawing.Size(150, 20); - this.SmoothingUpDown.TabIndex = 4; - this.SmoothingUpDown.Value = new decimal(new int[] { - 5, - 0, - 0, - 65536}); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 62); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(69, 13); - this.label2.TabIndex = 3; - this.label2.Text = "Zoom speed:"; - // - // ZoomSpeedUpDown - // - this.ZoomSpeedUpDown.DecimalPlaces = 2; - this.ZoomSpeedUpDown.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this.ZoomSpeedUpDown.Location = new System.Drawing.Point(79, 60); - this.ZoomSpeedUpDown.Maximum = new decimal(new int[] { - 5, - 0, - 0, - 0}); - this.ZoomSpeedUpDown.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 131072}); - this.ZoomSpeedUpDown.Name = "ZoomSpeedUpDown"; - this.ZoomSpeedUpDown.Size = new System.Drawing.Size(150, 20); - this.ZoomSpeedUpDown.TabIndex = 2; - this.ZoomSpeedUpDown.Value = new decimal(new int[] { - 15, - 0, - 0, - 65536}); - // - // MarkerStyleComboBox - // - this.MarkerStyleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.MarkerStyleComboBox.FormattingEnabled = true; - this.MarkerStyleComboBox.Location = new System.Drawing.Point(79, 6); - this.MarkerStyleComboBox.Name = "MarkerStyleComboBox"; - this.MarkerStyleComboBox.Size = new System.Drawing.Size(150, 21); - this.MarkerStyleComboBox.TabIndex = 1; - this.MarkerStyleComboBox.SelectedIndexChanged += new System.EventHandler(this.MarkerStyleComboBox_SelectedIndexChanged); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(3, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(67, 13); - this.label1.TabIndex = 0; - this.label1.Text = "Marker style:"; - // - // CalibrateTabPage - // - this.CalibrateTabPage.Controls.Add(this.label11); - this.CalibrateTabPage.Controls.Add(this.UnitsPerTexelYTextBox); - this.CalibrateTabPage.Controls.Add(this.CalibrationErrorLabel); - this.CalibrateTabPage.Controls.Add(this.CalibrateButton); - this.CalibrateTabPage.Controls.Add(this.CalibrationPointsTextBox); - this.CalibrateTabPage.Controls.Add(this.label10); - this.CalibrateTabPage.Controls.Add(this.SetCoordButton); - this.CalibrateTabPage.Controls.Add(this.label12); - this.CalibrateTabPage.Controls.Add(this.WorldCoordTextBox); - this.CalibrateTabPage.Controls.Add(this.TextureFileLabel); - this.CalibrateTabPage.Controls.Add(this.TextureNameLabel); - this.CalibrateTabPage.Controls.Add(this.label9); - this.CalibrateTabPage.Controls.Add(this.UnitsPerTexelXTextBox); - this.CalibrateTabPage.Controls.Add(this.SetOriginButton); - this.CalibrateTabPage.Controls.Add(this.label8); - this.CalibrateTabPage.Controls.Add(this.TextureOriginTextBox); - this.CalibrateTabPage.Controls.Add(this.label7); - this.CalibrateTabPage.Controls.Add(this.TextureCoordTextBox); - this.CalibrateTabPage.Location = new System.Drawing.Point(4, 22); - this.CalibrateTabPage.Name = "CalibrateTabPage"; - this.CalibrateTabPage.Size = new System.Drawing.Size(232, 556); - this.CalibrateTabPage.TabIndex = 3; - this.CalibrateTabPage.Text = "Calibrate"; - this.CalibrateTabPage.UseVisualStyleBackColor = true; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(0, 155); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(87, 13); - this.label11.TabIndex = 32; - this.label11.Text = "Units per texel Y:"; - // - // UnitsPerTexelYTextBox - // - this.UnitsPerTexelYTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.UnitsPerTexelYTextBox.Location = new System.Drawing.Point(93, 152); - this.UnitsPerTexelYTextBox.Name = "UnitsPerTexelYTextBox"; - this.UnitsPerTexelYTextBox.Size = new System.Drawing.Size(139, 20); - this.UnitsPerTexelYTextBox.TabIndex = 31; - this.UnitsPerTexelYTextBox.Text = "1"; - // - // CalibrationErrorLabel - // - this.CalibrationErrorLabel.Location = new System.Drawing.Point(6, 488); - this.CalibrationErrorLabel.Name = "CalibrationErrorLabel"; - this.CalibrationErrorLabel.Size = new System.Drawing.Size(226, 36); - this.CalibrationErrorLabel.TabIndex = 30; - this.CalibrationErrorLabel.Text = "No calibration performed"; - this.CalibrationErrorLabel.Visible = false; - // - // CalibrateButton - // - this.CalibrateButton.Location = new System.Drawing.Point(157, 462); - this.CalibrateButton.Name = "CalibrateButton"; - this.CalibrateButton.Size = new System.Drawing.Size(75, 23); - this.CalibrateButton.TabIndex = 29; - this.CalibrateButton.Text = "Calibrate"; - this.CalibrateButton.UseVisualStyleBackColor = true; - this.CalibrateButton.Visible = false; - this.CalibrateButton.Click += new System.EventHandler(this.CalibrateButton_Click); - // - // CalibrationPointsTextBox - // - this.CalibrationPointsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.CalibrationPointsTextBox.Location = new System.Drawing.Point(0, 374); - this.CalibrationPointsTextBox.Multiline = true; - this.CalibrationPointsTextBox.Name = "CalibrationPointsTextBox"; - this.CalibrationPointsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.CalibrationPointsTextBox.Size = new System.Drawing.Size(232, 82); - this.CalibrationPointsTextBox.TabIndex = 28; - this.CalibrationPointsTextBox.Visible = false; - // - // label10 - // - this.label10.Location = new System.Drawing.Point(3, 236); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(226, 135); - this.label10.TabIndex = 27; - this.label10.Text = resources.GetString("label10.Text"); - // - // SetCoordButton - // - this.SetCoordButton.Location = new System.Drawing.Point(157, 184); - this.SetCoordButton.Name = "SetCoordButton"; - this.SetCoordButton.Size = new System.Drawing.Size(68, 23); - this.SetCoordButton.TabIndex = 26; - this.SetCoordButton.Text = "Set coord"; - this.SetCoordButton.UseVisualStyleBackColor = true; - this.SetCoordButton.Click += new System.EventHandler(this.SetCoordButton_Click); - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(0, 63); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(68, 13); - this.label12.TabIndex = 25; - this.label12.Text = "World coord:"; - // - // WorldCoordTextBox - // - this.WorldCoordTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.WorldCoordTextBox.Location = new System.Drawing.Point(93, 60); - this.WorldCoordTextBox.Name = "WorldCoordTextBox"; - this.WorldCoordTextBox.Size = new System.Drawing.Size(139, 20); - this.WorldCoordTextBox.TabIndex = 24; - this.WorldCoordTextBox.Text = "0, 0"; - // - // TextureFileLabel - // - this.TextureFileLabel.AutoSize = true; - this.TextureFileLabel.Location = new System.Drawing.Point(2, 28); - this.TextureFileLabel.Name = "TextureFileLabel"; - this.TextureFileLabel.Size = new System.Drawing.Size(59, 13); - this.TextureFileLabel.TabIndex = 23; - this.TextureFileLabel.Text = "Texture file"; - // - // TextureNameLabel - // - this.TextureNameLabel.AutoSize = true; - this.TextureNameLabel.Location = new System.Drawing.Point(2, 9); - this.TextureNameLabel.Name = "TextureNameLabel"; - this.TextureNameLabel.Size = new System.Drawing.Size(72, 13); - this.TextureNameLabel.TabIndex = 22; - this.TextureNameLabel.Text = "Texture name"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(0, 132); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(87, 13); - this.label9.TabIndex = 21; - this.label9.Text = "Units per texel X:"; - // - // UnitsPerTexelXTextBox - // - this.UnitsPerTexelXTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.UnitsPerTexelXTextBox.Location = new System.Drawing.Point(93, 129); - this.UnitsPerTexelXTextBox.Name = "UnitsPerTexelXTextBox"; - this.UnitsPerTexelXTextBox.Size = new System.Drawing.Size(139, 20); - this.UnitsPerTexelXTextBox.TabIndex = 20; - this.UnitsPerTexelXTextBox.Text = "1"; - // - // SetOriginButton - // - this.SetOriginButton.Location = new System.Drawing.Point(81, 184); - this.SetOriginButton.Name = "SetOriginButton"; - this.SetOriginButton.Size = new System.Drawing.Size(68, 23); - this.SetOriginButton.TabIndex = 19; - this.SetOriginButton.Text = "Set origin"; - this.SetOriginButton.UseVisualStyleBackColor = true; - this.SetOriginButton.Click += new System.EventHandler(this.SetOriginButton_Click); - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(0, 109); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(74, 13); - this.label8.TabIndex = 18; - this.label8.Text = "Texture origin:"; - // - // TextureOriginTextBox - // - this.TextureOriginTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.TextureOriginTextBox.Location = new System.Drawing.Point(93, 106); - this.TextureOriginTextBox.Name = "TextureOriginTextBox"; - this.TextureOriginTextBox.Size = new System.Drawing.Size(139, 20); - this.TextureOriginTextBox.TabIndex = 17; - this.TextureOriginTextBox.Text = "0, 0"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(0, 86); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(76, 13); - this.label7.TabIndex = 16; - this.label7.Text = "Texture coord:"; - // - // TextureCoordTextBox - // - this.TextureCoordTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.TextureCoordTextBox.Location = new System.Drawing.Point(93, 83); - this.TextureCoordTextBox.Name = "TextureCoordTextBox"; - this.TextureCoordTextBox.Size = new System.Drawing.Size(139, 20); - this.TextureCoordTextBox.TabIndex = 15; - this.TextureCoordTextBox.Text = "0, 0"; - // - // MainPanelShowButton - // - this.MainPanelShowButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.MainPanelShowButton.Location = new System.Drawing.Point(806, 10); - this.MainPanelShowButton.Name = "MainPanelShowButton"; - this.MainPanelShowButton.Size = new System.Drawing.Size(31, 23); - this.MainPanelShowButton.TabIndex = 3; - this.MainPanelShowButton.Text = "<<"; - this.MainPanelShowButton.UseVisualStyleBackColor = true; - this.MainPanelShowButton.Click += new System.EventHandler(this.MainPanelShowButton_Click); - // - // SelectionPanel - // - this.SelectionPanel.BackColor = System.Drawing.Color.White; - this.SelectionPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.SelectionPanel.Controls.Add(this.SelectionPositionTextBox); - this.SelectionPanel.Controls.Add(this.SelectionNameTextBox); - this.SelectionPanel.Location = new System.Drawing.Point(12, 73); - this.SelectionPanel.Name = "SelectionPanel"; - this.SelectionPanel.Size = new System.Drawing.Size(180, 42); - this.SelectionPanel.TabIndex = 4; - this.SelectionPanel.Visible = false; - // - // SelectionPositionTextBox - // - this.SelectionPositionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.SelectionPositionTextBox.BackColor = System.Drawing.Color.White; - this.SelectionPositionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.SelectionPositionTextBox.Location = new System.Drawing.Point(3, 22); - this.SelectionPositionTextBox.Name = "SelectionPositionTextBox"; - this.SelectionPositionTextBox.ReadOnly = true; - this.SelectionPositionTextBox.Size = new System.Drawing.Size(172, 13); - this.SelectionPositionTextBox.TabIndex = 1; - // - // SelectionNameTextBox - // - this.SelectionNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.SelectionNameTextBox.BackColor = System.Drawing.Color.White; - this.SelectionNameTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.SelectionNameTextBox.Location = new System.Drawing.Point(3, 3); - this.SelectionNameTextBox.Name = "SelectionNameTextBox"; - this.SelectionNameTextBox.ReadOnly = true; - this.SelectionNameTextBox.Size = new System.Drawing.Size(172, 13); - this.SelectionNameTextBox.TabIndex = 0; - // - // MapForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64))))); - this.ClientSize = new System.Drawing.Size(849, 623); - this.Controls.Add(this.MainPanelShowButton); - this.Controls.Add(this.MainPanel); - this.Controls.Add(this.LoadingLabel); - this.Controls.Add(this.MapComboBox); - this.Controls.Add(this.SelectionPanel); - this.DoubleBuffered = true; - this.Name = "MapForm"; - this.Text = "Map - CodeWalker by dexyfex"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MapForm_FormClosing); - this.ResizeBegin += new System.EventHandler(this.MapForm_ResizeBegin); - this.ResizeEnd += new System.EventHandler(this.MapForm_ResizeEnd); - this.ClientSizeChanged += new System.EventHandler(this.MapForm_ClientSizeChanged); - this.SizeChanged += new System.EventHandler(this.MapForm_SizeChanged); - this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MapForm_MouseDown); - this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MapForm_MouseMove); - this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MapForm_MouseUp); - this.MainPanel.ResumeLayout(false); - this.MainTabControl.ResumeLayout(false); - this.ToolsTabPage.ResumeLayout(false); - this.ToolsTabPage.PerformLayout(); - this.MarkersTabPage.ResumeLayout(false); - this.MarkersTabPage.PerformLayout(); - this.OptionsTabPage.ResumeLayout(false); - this.OptionsTabPage.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.SmoothingUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.ZoomSpeedUpDown)).EndInit(); - this.CalibrateTabPage.ResumeLayout(false); - this.CalibrateTabPage.PerformLayout(); - this.SelectionPanel.ResumeLayout(false); - this.SelectionPanel.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ComboBox MapComboBox; - private System.Windows.Forms.Label LoadingLabel; - private System.Windows.Forms.Panel MainPanel; - private System.Windows.Forms.Button MainPanelHideButton; - private System.Windows.Forms.Button MainPanelShowButton; - private System.Windows.Forms.TabControl MainTabControl; - private System.Windows.Forms.TabPage MarkersTabPage; - private System.Windows.Forms.TabPage OptionsTabPage; - private System.Windows.Forms.ComboBox MarkerStyleComboBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ListView MarkersListView; - private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.ColumnHeader columnHeader2; - private System.Windows.Forms.ColumnHeader columnHeader3; - private System.Windows.Forms.ColumnHeader columnHeader4; - private System.Windows.Forms.CheckBox checkBox1; - private System.Windows.Forms.Button CopyMarkersButton; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.NumericUpDown ZoomSpeedUpDown; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.NumericUpDown SmoothingUpDown; - private System.Windows.Forms.TabPage ToolsTabPage; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Button AddMarkersButton; - private System.Windows.Forms.TextBox MultiFindTextBox; - private System.Windows.Forms.TextBox LocateTextBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.CheckBox ShowLocatorCheckBox; - private System.Windows.Forms.ComboBox LocatorStyleComboBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label LocatorStatusLabel; - private System.Windows.Forms.Button GoToButton; - private System.Windows.Forms.TabPage CalibrateTabPage; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.TextBox WorldCoordTextBox; - private System.Windows.Forms.Label TextureFileLabel; - private System.Windows.Forms.Label TextureNameLabel; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.TextBox UnitsPerTexelXTextBox; - private System.Windows.Forms.Button SetOriginButton; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.TextBox TextureOriginTextBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.TextBox TextureCoordTextBox; - private System.Windows.Forms.Button SetCoordButton; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Button CalibrateButton; - private System.Windows.Forms.TextBox CalibrationPointsTextBox; - private System.Windows.Forms.Label CalibrationErrorLabel; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.TextBox UnitsPerTexelYTextBox; - private System.Windows.Forms.Button ClearMarkersButton; - private System.Windows.Forms.Button ResetMarkersButton; - private System.Windows.Forms.Button GoToSelectedMarkerButton; - private System.Windows.Forms.Panel SelectionPanel; - private System.Windows.Forms.TextBox SelectionPositionTextBox; - private System.Windows.Forms.TextBox SelectionNameTextBox; - } -} \ No newline at end of file diff --git a/MapForm.cs b/MapForm.cs deleted file mode 100644 index bd5845d..0000000 --- a/MapForm.cs +++ /dev/null @@ -1,1206 +0,0 @@ -using SlimDX; -using SlimDX.Direct3D9; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.IO; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace CodeWalker -{ - public partial class MapForm : Form - { - - Vector3 TargetViewCenter = new Vector3(0.0f); - Vector3 CurrentViewCenter = new Vector3(0.0f); - float TargetZoom = 1.0f; - float CurrentZoom = 1.0f; - - - volatile bool LoadingImages = false; - List Images; - MapImage CurrentMap = null; - - List Icons; - MapIcon MarkerIcon = null; - MapIcon LocatorIcon = null; - MapMarker LocatorMarker = null; - MapMarker GrabbedMarker = null; - MapMarker SelectedMarker = null; - MapMarker MousedMarker = null; - List Markers = new List(); - List RenderMarkers = new List(); - - bool Resizing = false; - bool MouseButtonDown = false; - Point MouseDownPoint; - Point MouseLastPoint; - - volatile bool NeedsUpdate = false; - - Direct3D d3d = null; - Device device = null; - Sprite sprite = null; - - Stopwatch FrameTimer = new Stopwatch(); - - Size OldSize; - - public MapForm() - { - InitializeComponent(); - - - Icons = new List(); - AddIcon("Google Marker", "icon_google_marker_64x64.png", 64, 64, 11.0f, 40.0f, 1.0f); - AddIcon("Glokon Marker", "icon_glokon_normal_32x32.png", 32, 32, 11.0f, 32.0f, 1.0f); - AddIcon("Glokon Debug", "icon_glokon_debug_32x32.png", 32, 32, 11.5f, 32.0f, 1.0f); - MarkerIcon = Icons[1]; - LocatorIcon = Icons[2]; - foreach (MapIcon icon in Icons) - { - MarkerStyleComboBox.Items.Add(icon); - LocatorStyleComboBox.Items.Add(icon); - } - MarkerStyleComboBox.SelectedItem = MarkerIcon; - LocatorStyleComboBox.SelectedItem = LocatorIcon; - LocatorMarker = new MapMarker(); - LocatorMarker.Icon = LocatorIcon; - LocatorMarker.IsMovable = true; - - - ////for google map calibration... - //var game_1_x = 1972.606; //var map_1_lng = -60.8258056640625; - //var game_1_y = 3817.044; //var map_1_lat = 72.06379257078102; - //var game_2_x = -1154.11; //var map_2_lng = -72.1417236328125; - //var game_2_y = -2715.203; //var map_2_lat = 48.41572128171852; - - ////reference point: - //501.4398, 5603.9600, 795.9738, 0x4CC3BAFC, cs1_10_redeye - - //origin in 8192x8192 textures is at approx: - //3755.2, 5525.5 - - float ox = 3755.2f; - float oy = 5525.5f; - float uptx = 1.517952f; //this seems pretty close... - float upty = -1.517952f; - - Images = new List(); - AddImage("Satellite", "gtav_satellite_8192x8192.jpg", 8192, 8192, ox, oy, uptx, upty); - AddImage("Roads", "gtav_roadmap_8192x8192.jpg", 8192, 8192, ox, oy, uptx, upty); - AddImage("Atlas", "gtav_atlas_8192x8192.jpg", 8192, 8192, ox, oy, uptx, upty); - foreach (MapImage mi in Images) - { - MapComboBox.Items.Add(mi); - } - - InitializeDevice(); - - if (Images.Count > 0) - { - MapImage mi = Images[0]; - MapComboBox.SelectedItem = mi; - TargetViewCenter = mi.Origin; - CurrentViewCenter = mi.Origin; - } - - this.MouseWheel += MapForm_MouseMove; - - FrameTimer.Restart(); - SlimDX.Windows.MessagePump.Run(this, new SlimDX.Windows.MainLoop(SlimDX_Render)); - } - - private void MapForm_FormClosing(object sender, FormClosingEventArgs e) - { - DisposeDevice(); - - if (d3d != null) - { - d3d.Dispose(); - d3d = null; - } - } - - - - public void InitializeDevice() - { - if (WindowState == FormWindowState.Minimized) return; - - PresentParameters presentParams = new PresentParameters - { - BackBufferWidth = ClientSize.Width, - BackBufferHeight = ClientSize.Height, - DeviceWindowHandle = Handle, - PresentFlags = PresentFlags.None, - Multisample = MultisampleType.None, - BackBufferCount = 0, - PresentationInterval = PresentInterval.One, // VSYNC ON - SwapEffect = SwapEffect.Discard, - BackBufferFormat = Format.X8R8G8B8, - Windowed = true, - EnableAutoDepthStencil = false, - }; - - if (d3d == null) - { - d3d = new Direct3D(); - } - - device = new Device(d3d, 0, DeviceType.Hardware, Handle, CreateFlags.HardwareVertexProcessing, presentParams); - device.Viewport = new Viewport(0, 0, ClientSize.Width, ClientSize.Height); - - sprite = new Sprite(device); - - if (Icons != null) - { - foreach (MapIcon icon in Icons) - { - LoadIconTexture(icon); - } - } - - if ((CurrentMap != null) && (CurrentMap.Tex == null)) - { - LoadImageTexture(CurrentMap); - } - } - - public void DisposeDevice() - { - if (device == null) return; - - if (Icons != null) - { - foreach (MapIcon icon in Icons) - { - if (icon.Tex != null) - { - icon.Tex.Dispose(); - icon.Tex = null; - } - } - } - - foreach (MapImage img in Images) - { - if (img.Tex != null) - { - img.Tex.Dispose(); - img.Tex = null; - } - } - - if ((CurrentMap != null) && (CurrentMap.Tex != null)) - { - CurrentMap.Tex.Dispose(); - CurrentMap.Tex = null; - } - - sprite.Dispose(); - sprite = null; - - device.Dispose(); - device = null; - } - - private void HandleWindowResize() - { - DisposeDevice(); - InitializeDevice(); //this really shouldn't be necessary! - - - //sprite.Dispose(); - //sprite = null; - - //device.Reset(); - - //sprite = new Sprite(device); - } - - - private void MapForm_ResizeBegin(object sender, EventArgs e) - { - OldSize = Size; - Resizing = true; - } - private void MapForm_ResizeEnd(object sender, EventArgs e) - { - Resizing = false; - if ((OldSize != Size) && (!LoadingImages)) - { - HandleWindowResize(); - } - } - private void MapForm_SizeChanged(object sender, EventArgs e) - { - - } - private void MapForm_ClientSizeChanged(object sender, EventArgs e) - { - if ((!Resizing) && (!LoadingImages)) - { - HandleWindowResize(); - } - } - - - private void MapForm_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - MouseButtonDown = true; - } - MouseDownPoint = e.Location; - MouseLastPoint = MouseDownPoint; - - if (MouseButtonDown) - { - if (MousedMarker != null) - { - if (MousedMarker.IsMovable) - { - GrabbedMarker = MousedMarker; - } - else - { - SelectedMarker = MousedMarker; - SelectionNameTextBox.Text = SelectedMarker.Name; - SelectionPositionTextBox.Text = SelectedMarker.Get3DWorldPosString(); - UpdateSelectionPanel(); - SelectionPanel.Visible = true; - } - } - else - { - GrabbedMarker = null; - //SelectedMarker = null; - //SelectionPanel.Visible = false; - } - } - } - private void MapForm_MouseUp(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - MouseButtonDown = false; - - GrabbedMarker = null; - - if ((e.Location == MouseDownPoint) && (MousedMarker == null)) - { - //was clicked. but not on a marker... deselect and hide the panel - - SelectedMarker = null; - SelectionPanel.Visible = false; - } - } - } - private void MapForm_MouseMove(object sender, MouseEventArgs e) - { - if (e.Delta != 0) - { - float zoomfac = 1.0f + 0.1f*((float)ZoomSpeedUpDown.Value); - float oldzoom = TargetZoom; - float newzoom = oldzoom * (e.Delta > 0 ? zoomfac : 1.0f / zoomfac); - - if (newzoom < 1e-2f) newzoom = 1e-2f; - if (newzoom > 1e4f) newzoom = 1e4f; - - //figure out the new target center based on current mouse pos - float w = ClientSize.Width; - float h = ClientSize.Height; - float mx = MouseLastPoint.X - w * 0.5f; - float my = MouseLastPoint.Y - h * 0.5f; - - Vector3 mpold = new Vector3(mx, my, 0.0f) / oldzoom; - Vector3 mpnew = new Vector3(mx, my, 0.0f) / newzoom; - Vector3 mpdelt = mpnew - mpold; - - TargetViewCenter -= mpdelt; - TargetZoom = newzoom; - - - NeedsUpdate = true; - } - if (MouseButtonDown) - { - float dx = (e.X - MouseLastPoint.X) / CurrentZoom; - float dy = (e.Y - MouseLastPoint.Y) / CurrentZoom; - - if (GrabbedMarker == null) - { - //pan the view. - TargetViewCenter.X -= dx; - TargetViewCenter.Y -= dy; - NeedsUpdate = true; - } - else - { - //move the grabbed marker... - float uptx = (CurrentMap != null) ? CurrentMap.UnitsPerTexelX : 1.0f; - float upty = (CurrentMap != null) ? CurrentMap.UnitsPerTexelY : 1.0f; - Vector3 wpos = GrabbedMarker.WorldPos; - wpos.X += dx*uptx; - wpos.Y += dy*upty; - GrabbedMarker.WorldPos = wpos; - UpdateMarkerTexturePos(GrabbedMarker); - - if (GrabbedMarker == LocatorMarker) - { - LocateTextBox.Text = LocatorMarker.ToString(); - WorldCoordTextBox.Text = LocatorMarker.Get2DWorldPosString(); - TextureCoordTextBox.Text = LocatorMarker.Get2DTexturePosString(); - } - - } - } - - - if (NeedsUpdate) - { - //limit to the texture. - float tvcmaxx = 8192.0f; - float tvcminx = 0.0f; - float tvcmaxy = 8192.0f; - float tvcminy = 0.0f; - if (!((TargetViewCenter.X > tvcmaxx) && (TargetViewCenter.X < tvcminx))) - { - if (TargetViewCenter.X > tvcmaxx) TargetViewCenter.X = tvcmaxx; - if (TargetViewCenter.X < tvcminx) TargetViewCenter.X = tvcminx; - } - if (!((TargetViewCenter.Y > tvcmaxy) && (TargetViewCenter.Y < tvcminy))) - { - if (TargetViewCenter.Y > tvcmaxy) TargetViewCenter.Y = tvcmaxy; - if (TargetViewCenter.Y < tvcminy) TargetViewCenter.Y = tvcminy; - } - } - - - MouseLastPoint = e.Location; - - MousedMarker = FindMousedMarker(); - - if (MousedMarker != null) - { - if (MousedMarker.IsMovable) - { - Cursor = Cursors.SizeAll; - } - else - { - Cursor = Cursors.Hand; - } - } - else - { - Cursor = Cursors.Default; - } - } - - - - - - private void SlimDX_Render() - { - if (device == null) - { - return; - } - if (LoadingImages) - { - return; - } - - - device.Clear(ClearFlags.Target, new Color4(BackColor), 1.0f, 0); - device.BeginScene(); - device.SetRenderState(RenderState.AlphaBlendEnable, true); - device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha); - device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha); - if (NeedsUpdate) - { - } - - if ((CurrentMap != null) && (CurrentMap.Tex != null)) - { - float smooth = 1.0f - (((float)SmoothingUpDown.Value)*0.9f); - float elapsed = (float)Math.Min(FrameTimer.Elapsed.TotalSeconds, 0.1); - CurrentZoom = CurrentZoom + (TargetZoom - CurrentZoom) * smooth; - CurrentViewCenter = CurrentViewCenter + (TargetViewCenter - CurrentViewCenter) * smooth; - - float w = ClientSize.Width; - float h = ClientSize.Height; - - - Matrix scale = Matrix.Scaling(CurrentZoom, CurrentZoom, 0.0f); - Matrix trans = Matrix.Translation(-CurrentViewCenter); - Matrix offset = Matrix.Translation(w * 0.5f, h * 0.5f, 0.0f); - Matrix matrix = Matrix.Multiply(Matrix.Multiply(trans, scale), offset); - - sprite.Begin(SpriteFlags.None); - sprite.Transform = matrix; - sprite.Draw(CurrentMap.Tex, Color.White); - sprite.End(); - - - sprite.Begin(SpriteFlags.None); - sprite.Transform = Matrix.Identity; - - - - //sort by Y to make markers look correct - RenderMarkers.Clear(); - RenderMarkers.AddRange(Markers); - RenderMarkers.Sort((m1, m2) => m1.TexturePos.Y.CompareTo(m2.TexturePos.Y)); - - - - //draw all the markers - foreach (MapMarker m in RenderMarkers) - { - if ((m.Icon != null) && (m.Icon.Tex != null)) - { - UpdateMarkerScreenPos(m); - - sprite.Transform = GetMarkerRenderMatrix(m); - sprite.Draw(m.Icon.Tex, Color.White); - } - } - - //draw the locator marker - MapIcon locic = LocatorMarker.Icon; - if ((ShowLocatorCheckBox.Checked) && (locic != null) && (locic.Tex != null)) - { - UpdateMarkerScreenPos(LocatorMarker); - - sprite.Transform = GetMarkerRenderMatrix(LocatorMarker); - sprite.Draw(locic.Tex, Color.White); - } - - - sprite.End(); - - } - - device.EndScene(); - device.Present(); - - - - if (SelectedMarker != null) - { - UpdateSelectionPanel(); - } - - - FrameTimer.Restart(); - } - - private void UpdateSelectionPanel() - { - - - int ox = -90; - int oy = -76; - - int px = (int)Math.Round(SelectedMarker.ScreenPos.X, MidpointRounding.AwayFromZero) + ox; - int py = (int)Math.Round(SelectedMarker.ScreenPos.Y, MidpointRounding.AwayFromZero) + oy; - - int sx = SelectionPanel.Width; - int sy = SelectionPanel.Height; - - SelectionPanel.SetBounds(px, py, sx, sy); - - } - - - - private void MapComboBox_SelectedIndexChanged(object sender, EventArgs e) - { - MapImage mi = MapComboBox.SelectedItem as MapImage; - if ((mi != null) && (mi != CurrentMap) && (device != null)) - { - SetIsLoading(true); - if ((CurrentMap != null) && (CurrentMap.Tex != null)) - { - CurrentMap.Tex.Dispose(); - CurrentMap.Tex = null; - } - - if (mi.Tex == null) - { - LoadImageTexture(mi); - } - else - { - SetIsLoading(false); - } - - CurrentMap = mi; - NeedsUpdate = true; - - if (CurrentMap != null) - { - TextureNameLabel.Text = CurrentMap.Name; - TextureFileLabel.Text = CurrentMap.Filepath; - TextureOriginTextBox.Text = string.Format("{0}, {1}", CurrentMap.Origin.X, CurrentMap.Origin.Y); - UnitsPerTexelXTextBox.Text = CurrentMap.UnitsPerTexelX.ToString(); - UnitsPerTexelYTextBox.Text = CurrentMap.UnitsPerTexelY.ToString(); - if (LocatorMarker != null) - { - UpdateMarkerTexturePos(LocatorMarker); - WorldCoordTextBox.Text = LocatorMarker.Get2DWorldPosString(); - TextureCoordTextBox.Text = LocatorMarker.Get2DTexturePosString(); - } - } - else - { - TextureNameLabel.Text = "(No texture)"; - TextureFileLabel.Text = "(No texture)"; - } - } - } - - - private void MainPanelShowButton_Click(object sender, EventArgs e) - { - MainPanel.Visible = true; - MainPanelShowButton.Visible = false; - } - private void MainPanelHideButton_Click(object sender, EventArgs e) - { - MainPanel.Visible = false; - MainPanelShowButton.Visible = true; - } - - private void MarkerStyleComboBox_SelectedIndexChanged(object sender, EventArgs e) - { - MapIcon icon = MarkerStyleComboBox.SelectedItem as MapIcon; - if (icon != MarkerIcon) - { - MarkerIcon = icon; - - foreach (MapMarker m in Markers) - { - m.Icon = icon; - } - } - } - private void LocatorStyleComboBox_SelectedIndexChanged(object sender, EventArgs e) - { - MapIcon icon = LocatorStyleComboBox.SelectedItem as MapIcon; - if (icon != LocatorIcon) - { - LocatorIcon = icon; - LocatorMarker.Icon = icon; - } - } - - - - private void LocateTextBox_TextChanged(object sender, EventArgs e) - { - if (GrabbedMarker == LocatorMarker) return; //don't try to update the marker if it's being dragged - if (LocatorMarker == null) return; //this shouldn't happen, but anyway - - LocatorMarker.Parse(LocateTextBox.Text); - - UpdateMarkerTexturePos(LocatorMarker); - } - private void GoToButton_Click(object sender, EventArgs e) - { - GoToMarker(LocatorMarker); - } - - - private void AddMarkersButton_Click(object sender, EventArgs e) - { - string[] lines = MultiFindTextBox.Text.Split('\n'); - foreach (string line in lines) - { - AddMarker(line); - } - } - - private void ClearMarkersButton_Click(object sender, EventArgs e) - { - Markers.Clear(); - MarkersListView.Items.Clear(); - } - private void ResetMarkersButton_Click(object sender, EventArgs e) - { - Markers.Clear(); - MarkersListView.Items.Clear(); - AddDefaultMarkers(); - } - - - - private void SetOriginButton_Click(object sender, EventArgs e) - { - if (CurrentMap == null) return; - - TextureOriginTextBox.Text = TextureCoordTextBox.Text; - - string[] comps = TextureOriginTextBox.Text.Split(','); - if (comps.Length > 1) - { - Vector3 origin = new Vector3(0.0f); - float.TryParse(comps[0].Trim(), out origin.X); - float.TryParse(comps[1].Trim(), out origin.Y); - CurrentMap.Origin = origin; - - RecalculateAllMarkers(); - - LocatorMarker.WorldPos = new Vector3(0.0f);//force to the world origin - LocatorMarker.TexturePos = origin; - GrabbedMarker = LocatorMarker; //don't force the marker update when updating textbox.. - LocateTextBox.Text = "0, 0, 0"; - GrabbedMarker = null; - WorldCoordTextBox.Text = LocatorMarker.Get2DWorldPosString(); - TextureCoordTextBox.Text = LocatorMarker.Get2DTexturePosString(); - } - - } - private void SetCoordButton_Click(object sender, EventArgs e) - { - if (CurrentMap == null) return; - - string[] comps = WorldCoordTextBox.Text.Split(','); - if (comps.Length > 1) - { - Vector3 coord = new Vector3(0.0f); - float.TryParse(comps[0].Trim(), out coord.X); - float.TryParse(comps[1].Trim(), out coord.Y); - - //assume the entered coord is the world coord for the locator's tex coord. - //find the appropriate scaling factor to make it so. - - float tdx = LocatorMarker.TexturePos.X - CurrentMap.Origin.X; //texel dist from origin - float tdy = LocatorMarker.TexturePos.Y - CurrentMap.Origin.Y; - float tdl = (float)Math.Sqrt(tdx * tdx + tdy * tdy); - - float wcl = (float)Math.Sqrt(coord.X * coord.X + coord.Y * coord.Y); - - float upt = wcl / tdl; - float uptx = upt * Math.Sign(tdx * coord.X); - float upty = upt * Math.Sign(tdy * coord.Y); - - CurrentMap.UnitsPerTexelX = uptx; - CurrentMap.UnitsPerTexelY = upty; - - RecalculateAllMarkers(); - - LocatorMarker.WorldPos = coord; - GrabbedMarker = LocatorMarker; //don't force the marker update when updating textbox.. - LocateTextBox.Text = LocatorMarker.ToString(); - GrabbedMarker = null; - WorldCoordTextBox.Text = LocatorMarker.Get2DWorldPosString(); - TextureCoordTextBox.Text = LocatorMarker.Get2DTexturePosString(); - UnitsPerTexelXTextBox.Text = uptx.ToString(); - UnitsPerTexelYTextBox.Text = upty.ToString(); - } - - } - - private void CalibrateButton_Click(object sender, EventArgs e) - { - MessageBox.Show("Not yet implemented..."); - } - - private void CopyMarkersButton_Click(object sender, EventArgs e) - { - MessageBox.Show("Still need to build this function."); - } - - - - private void RecalculateAllMarkers() - { - //updates marker world coords based off current tex coord - - if (LocatorMarker != null) - { - LocatorMarker.WorldPos = GetWorldCoordFromTextureCoord(LocatorMarker.TexturePos); - } - - foreach (MapMarker marker in Markers) - { - marker.WorldPos = GetWorldCoordFromTextureCoord(marker.TexturePos); - } - - } - - - private Vector3 GetTextureCoordFromWorldCoord(Vector3 world) - { - if (CurrentMap != null) - { - float tx = world.X / CurrentMap.UnitsPerTexelX; - float ty = world.Y / CurrentMap.UnitsPerTexelY; - return CurrentMap.Origin + new Vector3(tx, ty, 1.0f); - } - else - { - return new Vector3(0.0f); - } - } - private Vector3 GetWorldCoordFromTextureCoord(Vector3 coord) - { - if (CurrentMap != null) - { - Vector3 tv = (coord - CurrentMap.Origin); - tv.X *= CurrentMap.UnitsPerTexelX; - tv.Y *= CurrentMap.UnitsPerTexelY; - return tv; - } - else - { - return new Vector3(0.0f); - } - } - - private Vector3 GetTextureCoordFromScreenCoord(Vector3 screen) - { - return new Vector3(0.0f); - } - private Vector3 GetScreenCoordFromTextureCoord(Vector3 coord) - { - float w = ClientSize.Width; - float h = ClientSize.Height; - - Vector3 centerdisttx = coord - CurrentViewCenter; - Vector3 centerdistpx = centerdisttx * CurrentZoom; - Vector3 screenpos = centerdistpx + new Vector3(w*0.5f, h*0.5f, 0.0f); - screenpos.Z = 0.0f; - - return screenpos; - } - - private Vector3 GetWorldCoordFromScreenCoord(Vector3 screen) - { - return GetWorldCoordFromTextureCoord(GetTextureCoordFromScreenCoord(screen)); - } - private Vector3 GetScreenCoordFromWorldCoord(Vector3 world) - { - return GetScreenCoordFromTextureCoord(GetTextureCoordFromWorldCoord(world)); - } - - private void UpdateMarkerTexturePos(MapMarker marker) - { - marker.TexturePos = GetTextureCoordFromWorldCoord(marker.WorldPos); - } - private void UpdateMarkerScreenPos(MapMarker marker) - { - marker.ScreenPos = GetScreenCoordFromTextureCoord(marker.TexturePos); - } - private void UpdateMarkerTexAndScreenPos(MapMarker marker) - { - marker.TexturePos = GetTextureCoordFromWorldCoord(marker.WorldPos); - marker.ScreenPos = GetScreenCoordFromTextureCoord(marker.TexturePos); - } - - private Matrix GetMarkerRenderMatrix(MapMarker marker) - { - float sx = 1.0f, sy = 1.0f; - MapIcon ic = marker.Icon; - int icw = ic.TexWidth; - int ich = ic.TexHeight; - if (icw > ich) //shrink square vertically - { - sy = ((float)ich) / ((float)icw); - } - else //shrink square horizontally - { - sx = ((float)icw) / ((float)ich); - } - - sx *= ic.Scale; - sy *= ic.Scale; - - - float px = marker.ScreenPos.X - ic.Center.X * ic.Scale; - float py = marker.ScreenPos.Y - ic.Center.Y*ic.Scale; - - px = (float)Math.Round(px, MidpointRounding.AwayFromZero); //snap to pixels... - py = (float)Math.Round(py, MidpointRounding.AwayFromZero); - - - Matrix scale = Matrix.Scaling(sx, sy, 0.0f); - Matrix trans = Matrix.Translation(px, py, 0.0f); - - return Matrix.Multiply(scale, trans); - } - - private MapMarker FindMousedMarker() - { - - float mx = MouseLastPoint.X; - float my = MouseLastPoint.Y; - - if (ShowLocatorCheckBox.Checked) - { - if (IsMapMarkerUnderPoint(LocatorMarker, mx, my)) - { - return LocatorMarker; - } - } - - //search backwards through the render markers (front to back) - for (int i = RenderMarkers.Count - 1; i >= 0; i--) - { - MapMarker m = RenderMarkers[i]; - if (IsMapMarkerUnderPoint(m, mx, my)) - { - return m; - } - } - - return null; - } - private bool IsMapMarkerUnderPoint(MapMarker marker, float x, float y) - { - float dx = x - marker.ScreenPos.X; - float dy = y - marker.ScreenPos.Y; - float mcx = marker.Icon.Center.X; - float mcy = marker.Icon.Center.Y; - bool bx = ((dx >= -mcx) && (dx <= mcx)); - bool by = ((dy <= 0.0f) && (dy >= -mcy)); - return (bx && by); - } - - - private void GoToMarker(MapMarker m) - { - //adjust the target to account for the main panel... - Vector3 view = m.TexturePos; - view.X += ((float)(MainPanel.Width + 4) * 0.5f) / CurrentZoom; - - TargetViewCenter = view; - } - - - private void AddMarker(string markerstr) - { - MapMarker m = new MapMarker(); - m.Parse(markerstr.Trim()); - m.Icon = MarkerIcon; - - UpdateMarkerTexturePos(m); - - Markers.Add(m); - - //////sort by Y - ////Markers.Sort((m1, m2) => m1.TexturePos.Y.CompareTo(m2.TexturePos.Y)); - - ListViewItem lvi = new ListViewItem(new string[] { m.Name, m.WorldPos.X.ToString(), m.WorldPos.Y.ToString(), m.WorldPos.Z.ToString() }); - lvi.Tag = m; - MarkersListView.Items.Add(lvi); - } - private void AddDefaultMarkers() - { - - AddMarker("1972.606, 3817.044, 0.0, Trevor Bed"); - AddMarker("94.5723, -1290.082, 0.0, Strip Club Bed"); - AddMarker("-1151.746, -1518.136, 0.0, Trevor City Bed"); - AddMarker("-2052.0, 3237.0, 0.0, Zancudo UFO"); - AddMarker("2490.0, 3777.0, 0.0, Hippy UFO"); - AddMarker("760.4618, 7392.8032, -126.0774, Sea UFO"); - AddMarker("501.4398, 5603.96, 0.0, RedEye"); - AddMarker("-1154.11, -2715.203, 0.0, Flight School"); - AddMarker("-1370.625, 56.1227, 0.0, Golf"); - AddMarker("-1109.213, 4914.744, 0.0, Altruist Cult"); - AddMarker("-1633.087, 4736.784, 0.0, Deal Gone Wrong"); - AddMarker("51.3909, 5957.7568, 209.614, cs1_10_clue_moon02"); - AddMarker("400.7087, 5714.5645, 605.0978, cs1_10_clue_rain01"); - AddMarker("703.442, 6329.8936, 76.4973, cs1_10_clue_rain02"); - AddMarker("228.7844, 5370.585, 577.2613, cs1_10_clue_moon01"); - AddMarker("366.4871, 5518.0742, 704.3185, cs1_10_clue_mountain01"); - - - } - - - private MapIcon AddIcon(string name, string filename, int texw, int texh, float centerx, float centery, float scale) - { - string filepath = "maps\\" + filename; - try - { - MapIcon mi = new MapIcon(name, filepath, texw, texh, centerx, centery, scale); - Icons.Add(mi); - return mi; - } - catch (Exception ex) - { - MessageBox.Show("Could not load map icon " + filepath + " for " + name + "!\n\n" + ex.ToString()); - } - return null; - } - private MapImage AddImage(string name, string filename, int texw, int texh, float origx, float origy, float uppx, float uppy) - { - string filepath = "maps\\" + filename; - try - { - MapImage mi = new MapImage(name, filepath, texw, texh, origx, origy, uppx, uppy); - Images.Add(mi); - return mi; - } - catch (Exception ex) - { - MessageBox.Show("Could not load map image " + filepath + " for " + name + " map!\n\n" + ex.ToString()); - } - return null; - } - - private void LoadImageTexture(MapImage mi) - { - SetIsLoading(true); - - Task.Run(() => - { - try - { - if (device != null) - { - mi.Tex = Texture.FromFile(device, mi.Filepath); - } - } - catch (Exception ex) - { - MessageBox.Show("Could not load map image " + mi.Filepath + " for " + mi.Name + " map!\n\n" + ex.ToString()); - } - - LoadCurrentImageComplete(); - }); - } - private void LoadIconTexture(MapIcon mi) - { - try - { - if (device != null) - { - mi.Tex = Texture.FromFile(device, mi.Filepath); - } - } - catch (Exception ex) - { - MessageBox.Show("Could not load map icon " + mi.Filepath + " for " + mi.Name + "!\n\n" + ex.ToString()); - } - } - - private void LoadCurrentImageComplete() - { - try - { - if (InvokeRequired) - { - Invoke(new Action(() => { LoadCurrentImageComplete(); })); - } - else - { - SetIsLoading(false); - } - } - catch { } - } - private void LoadImagesComplete() - { - try - { - if (InvokeRequired) - { - Invoke(new Action(() => { LoadImagesComplete(); })); - } - else - { - if (Images.Count > 0) - { - foreach (MapImage mi in Images) - { - MapComboBox.Items.Add(mi); - } - CurrentMap = Images[0]; - MapComboBox.SelectedItem = CurrentMap; - } - SetIsLoading(false); - } - } - catch { } - } - private void SetIsLoading(bool loading) - { - LoadingImages = loading; - LoadingLabel.Visible = loading; - MapComboBox.Enabled = !loading; - } - - private void GoToSelectedMarkerButton_Click(object sender, EventArgs e) - { - if (MarkersListView.SelectedItems.Count == 1) - { - MapMarker m = MarkersListView.SelectedItems[0].Tag as MapMarker; - if (m != null) - { - GoToMarker(m); - } - } - } - - private void MarkersListView_DoubleClick(object sender, EventArgs e) - { - //go to the marker.. - if (MarkersListView.SelectedItems.Count == 1) - { - MapMarker m = MarkersListView.SelectedItems[0].Tag as MapMarker; - if (m != null) - { - GoToMarker(m); - } - } - } - } - - - public class MapImage - { - public string Name { get; set; } - public string Filepath { get; set; } - public Texture Tex { get; set; } - public Vector3 Origin { get; set; } //in image pixels - public float UnitsPerTexelX { get; set; } //world units per image pixel - public float UnitsPerTexelY { get; set; } //world units per image pixel - public int TexWidth { get; set; } - public int TexHeight { get; set; } - - public MapImage(string name, string filepath, int texw, int texh, float origx, float origy, float uppx, float uppy) - { - Name = name; - Filepath = filepath; - TexWidth = texw; - TexHeight = texh; - Origin = new Vector3(origx, origy, 0.0f); - UnitsPerTexelX = uppx; - UnitsPerTexelY = uppy; - - if (!File.Exists(filepath)) - { - throw new Exception("File not found."); - } - } - - public override string ToString() - { - return Name; - } - - } - - public class MapIcon - { - public string Name { get; set; } - public string Filepath { get; set; } - public Texture Tex { get; set; } - public Vector3 Center { get; set; } //in image pixels - public float Scale { get; set; } //screen pixels per icon pixel - public int TexWidth { get; set; } - public int TexHeight { get; set; } - - public MapIcon(string name, string filepath, int texw, int texh, float centerx, float centery, float scale) - { - Name = name; - Filepath = filepath; - TexWidth = texw; - TexHeight = texh; - Center = new Vector3(centerx, centery, 0.0f); - Scale = scale; - - if (!File.Exists(filepath)) - { - throw new Exception("File not found."); - } - } - - public override string ToString() - { - return Name; - } - } - - public class MapMarker - { - public MapIcon Icon { get; set; } - public Vector3 WorldPos { get; set; } //actual world pos - public Vector3 TexturePos { get; set; } //position in the current texture (temp) - public Vector3 ScreenPos { get; set; } //position on screen (updated per frame if needed) - public string Name { get; set; } - public List Properties { get; set; } //additional data - public bool IsMovable { get; set; } - - public void Parse(string s) - { - Vector3 p = new Vector3(0.0f); - string[] ss = s.Split(','); - if (ss.Length > 1) - { - float.TryParse(ss[0].Trim(), out p.X); - float.TryParse(ss[1].Trim(), out p.Y); - } - if (ss.Length > 2) - { - float.TryParse(ss[2].Trim(), out p.Z); - } - if (ss.Length > 3) - { - Name = ss[3].Trim(); - } - else - { - Name = string.Empty; - } - for (int i = 4; i < ss.Length; i++) - { - if (Properties == null) Properties = new List(); - Properties.Add(ss[i].Trim()); - } - WorldPos = p; - } - - public override string ToString() - { - string cstr = string.Format("{0}, {1}, {2}", WorldPos.X, WorldPos.Y, WorldPos.Z); - if (!string.IsNullOrEmpty(Name)) - { - cstr += ", " + Name; - if (Properties != null) - { - foreach (string prop in Properties) - { - cstr += ", " + prop; - } - } - } - return cstr; - } - - public string Get2DWorldPosString() - { - return string.Format("{0}, {1}", WorldPos.X, WorldPos.Y); - } - public string Get3DWorldPosString() - { - return string.Format("{0}, {1}, {2}", WorldPos.X, WorldPos.Y, WorldPos.Z); - } - - public string Get2DTexturePosString() - { - return string.Format("{0}, {1}", TexturePos.X, TexturePos.Y); - } - - } - -} diff --git a/MapForm.resx b/MapForm.resx deleted file mode 100644 index c45a600..0000000 --- a/MapForm.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - To use the calibrator, first position the locator marker where the exact world center should be, and click Set origin. -Then choose a known coordinate and move the locator marker there. -Enter the known coordinate's world x, y position into the World coord text box and press the Set coord button to calculate the Units per texel X and Y. - - -Alternatively, enter calibration points below (format: xw, yw, xt, yt): - -The aim of the map calibration is to find the most accurate texture origin and units per texel. -The texture origin is the coordinates (in pixels) of where the world's origin (0,0,0) is in the texture. -Units per texel is how big each pixel in the texture is, when measured in world units. - - \ No newline at end of file