├── .gitattributes ├── .gitignore ├── COPYING ├── CREDITS.md ├── LICENSE ├── README.md ├── Screenshots └── TricksterMap_2018-05-13_02-19-06.png ├── TricksterMap.sln ├── TricksterMap ├── App.config ├── CompressedFileLoader.cs ├── ConfigLayerCollisionForm.Designer.cs ├── ConfigLayerCollisionForm.cs ├── ConfigLayerCollisionForm.resx ├── Create │ ├── CreatePointObject.Designer.cs │ ├── CreatePointObject.cs │ ├── CreatePointObject.resx │ ├── CreateRangeObject.Designer.cs │ ├── CreateRangeObject.cs │ └── CreateRangeObject.resx ├── Data │ ├── ConfigLayer.cs │ ├── EffectObject.cs │ ├── MapDataInfo.cs │ ├── PointObject.cs │ ├── RangeObject.cs │ └── TileData.cs ├── Extensions.cs ├── LvCtl.cs ├── MDIParent.Designer.cs ├── MDIParent.cs ├── MDIParent.resx ├── MapDataLoader.cs ├── MapSaveHelper.cs ├── NearestNeighborPictureBox.cs ├── PointObjectForm.Designer.cs ├── PointObjectForm.cs ├── PointObjectForm.resx ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RangeObjectForm.Designer.cs ├── RangeObjectForm.cs ├── RangeObjectForm.resx ├── Strings.Designer.cs ├── Strings.resx ├── Strings.zh.Designer.cs ├── Strings.zh.resx ├── TileReader.cs ├── TileViewForm.Designer.cs ├── TileViewForm.cs ├── TileViewForm.resx ├── TricksterMap.csproj └── packages.config └── _config.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # Benchmark Results 46 | BenchmarkDotNet.Artifacts/ 47 | 48 | # .NET Core 49 | project.lock.json 50 | project.fragment.lock.json 51 | artifacts/ 52 | **/Properties/launchSettings.json 53 | 54 | *_i.c 55 | *_p.c 56 | *_i.h 57 | *.ilk 58 | *.meta 59 | *.obj 60 | *.pch 61 | *.pdb 62 | *.pgc 63 | *.pgd 64 | *.rsp 65 | *.sbr 66 | *.tlb 67 | *.tli 68 | *.tlh 69 | *.tmp 70 | *.tmp_proj 71 | *.log 72 | *.vspscc 73 | *.vssscc 74 | .builds 75 | *.pidb 76 | *.svclog 77 | *.scc 78 | 79 | # Chutzpah Test files 80 | _Chutzpah* 81 | 82 | # Visual C++ cache files 83 | ipch/ 84 | *.aps 85 | *.ncb 86 | *.opendb 87 | *.opensdf 88 | *.sdf 89 | *.cachefile 90 | *.VC.db 91 | *.VC.VC.opendb 92 | 93 | # Visual Studio profiler 94 | *.psess 95 | *.vsp 96 | *.vspx 97 | *.sap 98 | 99 | # TFS 2012 Local Workspace 100 | $tf/ 101 | 102 | # Guidance Automation Toolkit 103 | *.gpState 104 | 105 | # ReSharper is a .NET coding add-in 106 | _ReSharper*/ 107 | *.[Rr]e[Ss]harper 108 | *.DotSettings.user 109 | 110 | # JustCode is a .NET coding add-in 111 | .JustCode 112 | 113 | # TeamCity is a build add-in 114 | _TeamCity* 115 | 116 | # DotCover is a Code Coverage Tool 117 | *.dotCover 118 | 119 | # AxoCover is a Code Coverage Tool 120 | .axoCover/* 121 | !.axoCover/settings.json 122 | 123 | # Visual Studio code coverage results 124 | *.coverage 125 | *.coveragexml 126 | 127 | # NCrunch 128 | _NCrunch_* 129 | .*crunch*.local.xml 130 | nCrunchTemp_* 131 | 132 | # MightyMoose 133 | *.mm.* 134 | AutoTest.Net/ 135 | 136 | # Web workbench (sass) 137 | .sass-cache/ 138 | 139 | # Installshield output folder 140 | [Ee]xpress/ 141 | 142 | # DocProject is a documentation generator add-in 143 | DocProject/buildhelp/ 144 | DocProject/Help/*.HxT 145 | DocProject/Help/*.HxC 146 | DocProject/Help/*.hhc 147 | DocProject/Help/*.hhk 148 | DocProject/Help/*.hhp 149 | DocProject/Help/Html2 150 | DocProject/Help/html 151 | 152 | # Click-Once directory 153 | publish/ 154 | 155 | # Publish Web Output 156 | *.[Pp]ublish.xml 157 | *.azurePubxml 158 | # Note: Comment the next line if you want to checkin your web deploy settings, 159 | # but database connection strings (with potential passwords) will be unencrypted 160 | *.pubxml 161 | *.publishproj 162 | 163 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 164 | # checkin your Azure Web App publish settings, but sensitive information contained 165 | # in these scripts will be unencrypted 166 | PublishScripts/ 167 | 168 | # NuGet Packages 169 | *.nupkg 170 | # The packages folder can be ignored because of Package Restore 171 | **/packages/* 172 | # except build/, which is used as an MSBuild target. 173 | !**/packages/build/ 174 | # Uncomment if necessary however generally it will be regenerated when needed 175 | #!**/packages/repositories.config 176 | # NuGet v3's project.json files produces more ignorable files 177 | *.nuget.props 178 | *.nuget.targets 179 | 180 | # Microsoft Azure Build Output 181 | csx/ 182 | *.build.csdef 183 | 184 | # Microsoft Azure Emulator 185 | ecf/ 186 | rcf/ 187 | 188 | # Windows Store app package directories and files 189 | AppPackages/ 190 | BundleArtifacts/ 191 | Package.StoreAssociation.xml 192 | _pkginfo.txt 193 | *.appx 194 | 195 | # Visual Studio cache files 196 | # files ending in .cache can be ignored 197 | *.[Cc]ache 198 | # but keep track of directories ending in .cache 199 | !*.[Cc]ache/ 200 | 201 | # Others 202 | ClientBin/ 203 | ~$* 204 | *~ 205 | *.dbmdl 206 | *.dbproj.schemaview 207 | *.jfm 208 | *.pfx 209 | *.publishsettings 210 | orleans.codegen.cs 211 | 212 | # Since there are multiple workflows, uncomment next line to ignore bower_components 213 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 214 | #bower_components/ 215 | 216 | # RIA/Silverlight projects 217 | Generated_Code/ 218 | 219 | # Backup & report files from converting an old project file 220 | # to a newer Visual Studio version. Backup files are not needed, 221 | # because we have git ;-) 222 | _UpgradeReport_Files/ 223 | Backup*/ 224 | UpgradeLog*.XML 225 | UpgradeLog*.htm 226 | 227 | # SQL Server files 228 | *.mdf 229 | *.ldf 230 | *.ndf 231 | 232 | # Business Intelligence projects 233 | *.rdl.data 234 | *.bim.layout 235 | *.bim_*.settings 236 | 237 | # Microsoft Fakes 238 | FakesAssemblies/ 239 | 240 | # GhostDoc plugin setting file 241 | *.GhostDoc.xml 242 | 243 | # Node.js Tools for Visual Studio 244 | .ntvs_analysis.dat 245 | node_modules/ 246 | 247 | # Typescript v1 declaration files 248 | typings/ 249 | 250 | # Visual Studio 6 build log 251 | *.plg 252 | 253 | # Visual Studio 6 workspace options file 254 | *.opt 255 | 256 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 257 | *.vbw 258 | 259 | # Visual Studio LightSwitch build output 260 | **/*.HTMLClient/GeneratedArtifacts 261 | **/*.DesktopClient/GeneratedArtifacts 262 | **/*.DesktopClient/ModelManifest.xml 263 | **/*.Server/GeneratedArtifacts 264 | **/*.Server/ModelManifest.xml 265 | _Pvt_Extensions 266 | 267 | # Paket dependency manager 268 | .paket/paket.exe 269 | paket-files/ 270 | 271 | # FAKE - F# Make 272 | .fake/ 273 | 274 | # JetBrains Rider 275 | .idea/ 276 | *.sln.iml 277 | 278 | # CodeRush 279 | .cr/ 280 | 281 | # Python Tools for Visual Studio (PTVS) 282 | __pycache__/ 283 | *.pyc 284 | 285 | # Cake - Uncomment if you are using it 286 | # tools/** 287 | # !tools/packages.config 288 | 289 | # Tabs Studio 290 | *.tss 291 | 292 | # Telerik's JustMock configuration file 293 | *.jmconfig 294 | 295 | # BizTalk build output 296 | *.btp.cs 297 | *.btm.cs 298 | *.odx.cs 299 | *.xsd.cs 300 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright © 2018 Raymonf (raymonf@outlook.com) 2 | This work is free. You can redistribute it and/or modify it under the 3 | terms of the Do What The Fuck You Want To Public License, Version 2, 4 | as published by Sam Hocevar. See the COPYING file for more details. -------------------------------------------------------------------------------- /CREDITS.md: -------------------------------------------------------------------------------- 1 | # Credits 2 | (In no particular order) 3 | 4 | * Ruthstrom - Reverse engineering the formats, 1:1 help 5 | * kinakomoti/きなこもち - Reverse engineering the formats, 1:1 help 6 | * Hrksoft - Reverse engineering the formats 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TricksterMap 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/0vc5mwjjxs026985/branch/master?svg=true)](https://ci.appveyor.com/project/Raymonf/trickstermap/branch/master) 4 | 5 | **[Compiled binaries are available on AppVeyor](https://ci.appveyor.com/project/Raymonf/trickstermap/build/artifacts)** 6 | 7 | ## Introduction 8 | 9 | This is a project written in C# whose end goal is to be able to read and write map data files for a game called Trickster Online. The project was designed with at least partial localization support in mind, and an example (low-quality) Chinese localization exists. 10 | 11 | It uses Windows Forms. Feel free to yell at me for that. 12 | 13 | ## Current Features: 14 | 15 | * Point object details 16 | * Collision data view 17 | * Tile data view (currently somewhat broken) 18 | * Point object editor 19 | * Range object viewer/editor 20 | 21 | ## Planned Features: 22 | 23 | * Full map view 24 | * Collision data editor 25 | * Probably some more stuff 26 | 27 | ## Screenshot(s) 28 | 29 | ![Megalopolis Square/map_sq00.md3](/Screenshots/TricksterMap_2018-05-13_02-19-06.png?raw=true "Megalopolis Square/map_sq00.md3") 30 | 31 | ## Credits 32 | 33 | This would not be possible without the amazing work of a few Japanese developers, in which some of whom are listed in [CREDITS.md](/CREDITS.md). 34 | 35 | ## Contributions 36 | 37 | Any contributions are welcome, including localizations, code, and even just screenshots. 38 | -------------------------------------------------------------------------------- /Screenshots/TricksterMap_2018-05-13_02-19-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raymonf/TricksterMap/6118106fcf7274f6a93470224ba310ae03559b1f/Screenshots/TricksterMap_2018-05-13_02-19-06.png -------------------------------------------------------------------------------- /TricksterMap.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27428.2015 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TricksterMap", "TricksterMap\TricksterMap.csproj", "{71A3C82F-0E6F-415C-BD25-7A2B25A86B84}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {71A3C82F-0E6F-415C-BD25-7A2B25A86B84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {71A3C82F-0E6F-415C-BD25-7A2B25A86B84}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {71A3C82F-0E6F-415C-BD25-7A2B25A86B84}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {71A3C82F-0E6F-415C-BD25-7A2B25A86B84}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {3F8C7A1E-EFCB-4F57-B0C1-4301F45B2152} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /TricksterMap/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /TricksterMap/CompressedFileLoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Ionic.Zlib; 8 | 9 | namespace TricksterMap 10 | { 11 | public class CompressedFileLoader 12 | { 13 | public static byte[] Decompress(Stream stream, bool skipType = false) 14 | { 15 | using (var reader = new BinaryReader(stream)) 16 | { 17 | if (!skipType) 18 | { 19 | var type = reader.ReadInt32(); 20 | } 21 | 22 | var realSize = reader.ReadInt32(); 23 | var compressedSize = reader.ReadInt32(); 24 | 25 | var decompressed = ZlibStream.UncompressBuffer(reader.ReadBytes(compressedSize)); 26 | 27 | if (decompressed.Length != realSize) 28 | { 29 | throw new Exception("Decompressed size does not match the header's value."); 30 | } 31 | 32 | return decompressed; 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /TricksterMap/ConfigLayerCollisionForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TricksterMap 2 | { 3 | partial class ConfigLayerCollisionForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.type3Picture = new TricksterMap.NearestNeighborPictureBox(); 32 | this.type2Picture = new TricksterMap.NearestNeighborPictureBox(); 33 | this.collisionPicture = new TricksterMap.NearestNeighborPictureBox(); 34 | this.LegendPictureBox = new System.Windows.Forms.PictureBox(); 35 | ((System.ComponentModel.ISupportInitialize)(this.type3Picture)).BeginInit(); 36 | ((System.ComponentModel.ISupportInitialize)(this.type2Picture)).BeginInit(); 37 | ((System.ComponentModel.ISupportInitialize)(this.collisionPicture)).BeginInit(); 38 | ((System.ComponentModel.ISupportInitialize)(this.LegendPictureBox)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // type3Picture 42 | // 43 | this.type3Picture.BackColor = System.Drawing.Color.Transparent; 44 | this.type3Picture.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; 45 | this.type3Picture.Dock = System.Windows.Forms.DockStyle.Fill; 46 | this.type3Picture.Location = new System.Drawing.Point(0, 0); 47 | this.type3Picture.Name = "type3Picture"; 48 | this.type3Picture.Size = new System.Drawing.Size(800, 450); 49 | this.type3Picture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 50 | this.type3Picture.TabIndex = 2; 51 | this.type3Picture.TabStop = false; 52 | // 53 | // type2Picture 54 | // 55 | this.type2Picture.BackColor = System.Drawing.Color.Transparent; 56 | this.type2Picture.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; 57 | this.type2Picture.Dock = System.Windows.Forms.DockStyle.Fill; 58 | this.type2Picture.Location = new System.Drawing.Point(0, 0); 59 | this.type2Picture.Name = "type2Picture"; 60 | this.type2Picture.Size = new System.Drawing.Size(800, 450); 61 | this.type2Picture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 62 | this.type2Picture.TabIndex = 1; 63 | this.type2Picture.TabStop = false; 64 | // 65 | // collisionPicture 66 | // 67 | this.collisionPicture.BackColor = System.Drawing.Color.Transparent; 68 | this.collisionPicture.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; 69 | this.collisionPicture.Dock = System.Windows.Forms.DockStyle.Fill; 70 | this.collisionPicture.Location = new System.Drawing.Point(0, 0); 71 | this.collisionPicture.Name = "collisionPicture"; 72 | this.collisionPicture.Size = new System.Drawing.Size(800, 450); 73 | this.collisionPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 74 | this.collisionPicture.TabIndex = 0; 75 | this.collisionPicture.TabStop = false; 76 | // 77 | // LegendPictureBox 78 | // 79 | this.LegendPictureBox.BackColor = System.Drawing.Color.Transparent; 80 | this.LegendPictureBox.Location = new System.Drawing.Point(0, 0); 81 | this.LegendPictureBox.Name = "LegendPictureBox"; 82 | this.LegendPictureBox.Size = new System.Drawing.Size(100, 50); 83 | this.LegendPictureBox.TabIndex = 3; 84 | this.LegendPictureBox.TabStop = false; 85 | // 86 | // ConfigLayerCollisionForm 87 | // 88 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 89 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 90 | this.ClientSize = new System.Drawing.Size(800, 450); 91 | this.Controls.Add(this.LegendPictureBox); 92 | this.Controls.Add(this.type3Picture); 93 | this.Controls.Add(this.type2Picture); 94 | this.Controls.Add(this.collisionPicture); 95 | this.Name = "ConfigLayerCollisionForm"; 96 | this.Text = "Config Layer - Collision Data"; 97 | this.Load += new System.EventHandler(this.ConfigLayerCollisionForm_Load); 98 | ((System.ComponentModel.ISupportInitialize)(this.type3Picture)).EndInit(); 99 | ((System.ComponentModel.ISupportInitialize)(this.type2Picture)).EndInit(); 100 | ((System.ComponentModel.ISupportInitialize)(this.collisionPicture)).EndInit(); 101 | ((System.ComponentModel.ISupportInitialize)(this.LegendPictureBox)).EndInit(); 102 | this.ResumeLayout(false); 103 | 104 | } 105 | 106 | #endregion 107 | 108 | public NearestNeighborPictureBox collisionPicture; 109 | public NearestNeighborPictureBox type2Picture; 110 | public NearestNeighborPictureBox type3Picture; 111 | private System.Windows.Forms.PictureBox LegendPictureBox; 112 | } 113 | } -------------------------------------------------------------------------------- /TricksterMap/ConfigLayerCollisionForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Drawing.Drawing2D; 7 | using System.Drawing.Text; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | using TricksterMap.Data; 13 | 14 | namespace TricksterMap 15 | { 16 | public partial class ConfigLayerCollisionForm : Form 17 | { 18 | public Color WalkableColor = Color.FromArgb(128, 0, 200, 0); 19 | public Color NotWalkableColor = Color.FromArgb(128, 0, 0, 0); 20 | 21 | string font = Strings.PreferredFont; 22 | Color textColor = Color.Black; 23 | Color backgroundColor = Color.FromArgb(160, 255, 255, 255); 24 | 25 | public ConfigLayerCollisionForm() 26 | { 27 | InitializeComponent(); 28 | 29 | this.SetFonts(); 30 | } 31 | 32 | public void LoadType3(ConfigLayer layer) 33 | { 34 | var iTotal = 0; 35 | 36 | Bitmap pic = new Bitmap(layer.X, layer.Y); 37 | 38 | for (int iY = 0; iY < layer.Y; iY++) 39 | { 40 | for (int iX = 0; iX < layer.X; iX++) 41 | { 42 | pic.SetPixel(iX, iY, layer.Data[iTotal] == 0x0 ? Color.FromArgb(100, 0, 0, 200) : Color.FromArgb(0, 0, 0, 0)); 43 | iTotal++; 44 | } 45 | } 46 | 47 | type3Picture.Image = pic; 48 | } 49 | 50 | public void LoadType2(ConfigLayer layer) 51 | { 52 | var iTotal = 0; 53 | 54 | Bitmap pic = new Bitmap(layer.X, layer.Y); 55 | 56 | for (int iY = 0; iY < layer.Y; iY++) 57 | { 58 | for (int iX = 0; iX < layer.X; iX++) 59 | { 60 | pic.SetPixel(iX, iY, layer.Data[iTotal] == 0x0 ? Color.FromArgb(100, 200, 0, 0) : Color.FromArgb(0, 0, 0, 0)); 61 | iTotal++; 62 | } 63 | } 64 | 65 | type2Picture.Image = pic; 66 | } 67 | 68 | public void LoadCollisionData(ConfigLayer layer) 69 | { 70 | CreateLegend(layer); 71 | 72 | var iTotal = 0; 73 | 74 | Bitmap collision = new Bitmap(layer.X, layer.Y); 75 | 76 | for (int iY = 0; iY < layer.Y; iY++) 77 | { 78 | for (int iX = 0; iX < layer.X; iX++) 79 | { 80 | collision.SetPixel(iX, iY, layer.Data[iTotal] == 0x0 ? WalkableColor : NotWalkableColor); 81 | iTotal++; 82 | } 83 | } 84 | 85 | collisionPicture.Image = collision; 86 | } 87 | 88 | public void CreateLegend(ConfigLayer layer) 89 | { 90 | Bitmap bmp = new Bitmap(512, 96); 91 | Graphics g = Graphics.FromImage(bmp); 92 | 93 | g.SmoothingMode = SmoothingMode.AntiAlias; 94 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; 95 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; 96 | g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; 97 | 98 | var fontObject = new Font(font, 12); 99 | 100 | using (var brush = new SolidBrush(backgroundColor)) 101 | { 102 | var walkSize = g.MeasureString(Strings.Walkable, fontObject); 103 | var notWalkSize = g.MeasureString(Strings.NotWalkable, fontObject); 104 | var boxWidth = Math.Max(walkSize.Width, notWalkSize.Width); // get larger 105 | 106 | g.FillRectangle(brush, 0, 0, boxWidth + 32, bmp.Height); 107 | } 108 | 109 | g.DrawRectangle(new Pen(WalkableColor, 10), 10, 10, 10, 10); 110 | g.DrawString(Strings.Walkable, fontObject, new SolidBrush(textColor), 30, 6); 111 | 112 | g.DrawRectangle(new Pen(NotWalkableColor, 10), 10, 34, 10, 10); 113 | g.DrawString(Strings.NotWalkable, fontObject, new SolidBrush(textColor), 30, 30); 114 | 115 | g.DrawString(String.Format(Strings.XSize, layer.X), fontObject, new SolidBrush(textColor), 2, 52); 116 | g.DrawString(String.Format(Strings.YSize, layer.Y), fontObject, new SolidBrush(textColor), 2, 70); 117 | 118 | g.Flush(); 119 | 120 | LegendPictureBox.Size = bmp.Size; 121 | LegendPictureBox.Image = bmp; 122 | } 123 | 124 | private void ConfigLayerCollisionForm_Load(object sender, EventArgs e) 125 | { 126 | type2Picture.Parent = collisionPicture; 127 | type2Picture.BringToFront(); 128 | type3Picture.Parent = type2Picture; 129 | type3Picture.BringToFront(); 130 | LegendPictureBox.Parent = type3Picture; 131 | LegendPictureBox.BringToFront(); 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /TricksterMap/ConfigLayerCollisionForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TricksterMap/Create/CreatePointObject.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TricksterMap.Create 2 | { 3 | partial class CreatePointObject 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.cmbType = new System.Windows.Forms.ComboBox(); 32 | this.lblType = new System.Windows.Forms.Label(); 33 | this.lblId = new System.Windows.Forms.Label(); 34 | this.txtId = new System.Windows.Forms.TextBox(); 35 | this.txtMapId = new System.Windows.Forms.TextBox(); 36 | this.lblMapId = new System.Windows.Forms.Label(); 37 | this.txtX = new System.Windows.Forms.TextBox(); 38 | this.lblX = new System.Windows.Forms.Label(); 39 | this.txtY = new System.Windows.Forms.TextBox(); 40 | this.lblY = new System.Windows.Forms.Label(); 41 | this.btnCreate = new System.Windows.Forms.Button(); 42 | this.SuspendLayout(); 43 | // 44 | // cmbType 45 | // 46 | this.cmbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 47 | this.cmbType.FormattingEnabled = true; 48 | this.cmbType.Location = new System.Drawing.Point(139, 53); 49 | this.cmbType.Name = "cmbType"; 50 | this.cmbType.Size = new System.Drawing.Size(161, 24); 51 | this.cmbType.TabIndex = 1; 52 | // 53 | // lblType 54 | // 55 | this.lblType.AutoSize = true; 56 | this.lblType.Location = new System.Drawing.Point(27, 56); 57 | this.lblType.Name = "lblType"; 58 | this.lblType.Size = new System.Drawing.Size(40, 17); 59 | this.lblType.TabIndex = 2; 60 | this.lblType.Text = "Type"; 61 | // 62 | // lblId 63 | // 64 | this.lblId.AutoSize = true; 65 | this.lblId.Location = new System.Drawing.Point(27, 28); 66 | this.lblId.Name = "lblId"; 67 | this.lblId.Size = new System.Drawing.Size(21, 17); 68 | this.lblId.TabIndex = 4; 69 | this.lblId.Text = "ID"; 70 | // 71 | // txtId 72 | // 73 | this.txtId.Location = new System.Drawing.Point(139, 25); 74 | this.txtId.Name = "txtId"; 75 | this.txtId.Size = new System.Drawing.Size(161, 22); 76 | this.txtId.TabIndex = 5; 77 | // 78 | // txtMapId 79 | // 80 | this.txtMapId.Location = new System.Drawing.Point(139, 83); 81 | this.txtMapId.Name = "txtMapId"; 82 | this.txtMapId.Size = new System.Drawing.Size(161, 22); 83 | this.txtMapId.TabIndex = 7; 84 | // 85 | // lblMapId 86 | // 87 | this.lblMapId.AutoSize = true; 88 | this.lblMapId.Location = new System.Drawing.Point(27, 86); 89 | this.lblMapId.Name = "lblMapId"; 90 | this.lblMapId.Size = new System.Drawing.Size(52, 17); 91 | this.lblMapId.TabIndex = 6; 92 | this.lblMapId.Text = "Map ID"; 93 | // 94 | // txtX 95 | // 96 | this.txtX.Location = new System.Drawing.Point(139, 111); 97 | this.txtX.Name = "txtX"; 98 | this.txtX.Size = new System.Drawing.Size(161, 22); 99 | this.txtX.TabIndex = 9; 100 | // 101 | // lblX 102 | // 103 | this.lblX.AutoSize = true; 104 | this.lblX.Location = new System.Drawing.Point(27, 114); 105 | this.lblX.Name = "lblX"; 106 | this.lblX.Size = new System.Drawing.Size(17, 17); 107 | this.lblX.TabIndex = 8; 108 | this.lblX.Text = "X"; 109 | // 110 | // txtY 111 | // 112 | this.txtY.Location = new System.Drawing.Point(139, 139); 113 | this.txtY.Name = "txtY"; 114 | this.txtY.Size = new System.Drawing.Size(161, 22); 115 | this.txtY.TabIndex = 11; 116 | // 117 | // lblY 118 | // 119 | this.lblY.AutoSize = true; 120 | this.lblY.Location = new System.Drawing.Point(27, 142); 121 | this.lblY.Name = "lblY"; 122 | this.lblY.Size = new System.Drawing.Size(17, 17); 123 | this.lblY.TabIndex = 10; 124 | this.lblY.Text = "Y"; 125 | // 126 | // btnCreate 127 | // 128 | this.btnCreate.Location = new System.Drawing.Point(225, 188); 129 | this.btnCreate.Name = "btnCreate"; 130 | this.btnCreate.Size = new System.Drawing.Size(75, 28); 131 | this.btnCreate.TabIndex = 12; 132 | this.btnCreate.Text = "Create"; 133 | this.btnCreate.UseVisualStyleBackColor = true; 134 | this.btnCreate.Click += new System.EventHandler(this.CreateAndExit); 135 | // 136 | // CreatePointObject 137 | // 138 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 139 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 140 | this.ClientSize = new System.Drawing.Size(326, 232); 141 | this.Controls.Add(this.btnCreate); 142 | this.Controls.Add(this.txtY); 143 | this.Controls.Add(this.lblY); 144 | this.Controls.Add(this.txtX); 145 | this.Controls.Add(this.lblX); 146 | this.Controls.Add(this.txtMapId); 147 | this.Controls.Add(this.lblMapId); 148 | this.Controls.Add(this.txtId); 149 | this.Controls.Add(this.lblId); 150 | this.Controls.Add(this.lblType); 151 | this.Controls.Add(this.cmbType); 152 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 153 | this.MaximumSize = new System.Drawing.Size(344, 279); 154 | this.MinimumSize = new System.Drawing.Size(344, 279); 155 | this.Name = "CreatePointObject"; 156 | this.ShowIcon = false; 157 | this.ShowInTaskbar = false; 158 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 159 | this.Text = "Create Point Object"; 160 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CreatePointObject_FormClosing); 161 | this.Load += new System.EventHandler(this.CreatePointObject_Load); 162 | this.ResumeLayout(false); 163 | this.PerformLayout(); 164 | 165 | } 166 | 167 | #endregion 168 | private System.Windows.Forms.Label lblType; 169 | private System.Windows.Forms.Label lblId; 170 | private System.Windows.Forms.Label lblMapId; 171 | private System.Windows.Forms.Label lblX; 172 | private System.Windows.Forms.Label lblY; 173 | public System.Windows.Forms.ComboBox cmbType; 174 | public System.Windows.Forms.TextBox txtId; 175 | public System.Windows.Forms.TextBox txtMapId; 176 | public System.Windows.Forms.TextBox txtX; 177 | public System.Windows.Forms.TextBox txtY; 178 | public System.Windows.Forms.Button btnCreate; 179 | } 180 | } -------------------------------------------------------------------------------- /TricksterMap/Create/CreatePointObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using TricksterMap.Data; 11 | 12 | namespace TricksterMap.Create 13 | { 14 | public partial class CreatePointObject : Form 15 | { 16 | public MapDataInfo Map = null; 17 | public PointObjectForm PointListForm = null; 18 | public Dictionary types = new Dictionary(); 19 | public bool isEditing = false; 20 | 21 | public CreatePointObject() 22 | { 23 | InitializeComponent(); 24 | 25 | foreach (var type in PointObject.ValidTypes) 26 | { 27 | var typeName = PointObject.GetTypeNameFromId(type); 28 | 29 | types.Add(typeName, type); 30 | 31 | cmbType.Items.Add(typeName); 32 | } 33 | 34 | if (PointObject.ValidTypes.Length > 0) 35 | { 36 | cmbType.SelectedIndex = 0; 37 | } 38 | 39 | Text = Strings.CreatePointObject; 40 | lblId.Text = Strings.ID; 41 | lblMapId.Text = Strings.MapID; 42 | lblType.Text = Strings.Type; 43 | lblX.Text = Strings.XPos; 44 | lblY.Text = Strings.YPos; 45 | btnCreate.Text = Strings.Create; 46 | 47 | this.SetFonts(); 48 | } 49 | 50 | private void CreatePointObject_Load(object sender, EventArgs e) 51 | { 52 | 53 | } 54 | 55 | public int GetTypeIdFromName(string name) 56 | { 57 | if (types.ContainsKey(name)) 58 | { 59 | return types[name]; 60 | } 61 | 62 | return -1; 63 | } 64 | 65 | private void AddObject() 66 | { 67 | var id = int.Parse(txtId.Text); 68 | var typeId = GetTypeIdFromName(cmbType.Text); 69 | 70 | // Portals, respawns, and none should have ID 0 71 | if (typeId == 0x01 || typeId == 0x02) 72 | { 73 | id = 0; 74 | } 75 | else 76 | { 77 | // Check for a duplicate ID 78 | if (Map.PointObjects.Exists(p => p.Type == typeId && p.Id == id)) 79 | { 80 | MessageBox.Show("Duplicate ID found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 81 | return; 82 | } 83 | } 84 | 85 | var point = new PointObject() 86 | { 87 | Id = id, 88 | Type = typeId, 89 | MapId = int.Parse(txtMapId.Text), 90 | X = int.Parse(txtX.Text), 91 | Y = int.Parse(txtY.Text) 92 | }; 93 | 94 | Map.PointObjects.Add(point); 95 | PointListForm.RepopulateData(); 96 | } 97 | 98 | private void CreateAndExit(object sender, EventArgs e) 99 | { 100 | isEditing = false; 101 | AddObject(); 102 | Close(); 103 | } 104 | 105 | private void CreatePointObject_FormClosing(object sender, FormClosingEventArgs e) 106 | { 107 | if (isEditing) 108 | { 109 | CreateAndExit(sender, e); 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /TricksterMap/Create/CreatePointObject.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TricksterMap/Create/CreateRangeObject.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TricksterMap.Create 2 | { 3 | partial class CreateRangeObject 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btnCreate = new System.Windows.Forms.Button(); 32 | this.txtY1 = new System.Windows.Forms.TextBox(); 33 | this.lblY1 = new System.Windows.Forms.Label(); 34 | this.txtX1 = new System.Windows.Forms.TextBox(); 35 | this.lblX1 = new System.Windows.Forms.Label(); 36 | this.txtMapId = new System.Windows.Forms.TextBox(); 37 | this.lblMapId = new System.Windows.Forms.Label(); 38 | this.txtId = new System.Windows.Forms.TextBox(); 39 | this.lblId = new System.Windows.Forms.Label(); 40 | this.lblType = new System.Windows.Forms.Label(); 41 | this.cmbType = new System.Windows.Forms.ComboBox(); 42 | this.txtY2 = new System.Windows.Forms.TextBox(); 43 | this.lblY2 = new System.Windows.Forms.Label(); 44 | this.txtX2 = new System.Windows.Forms.TextBox(); 45 | this.lblX2 = new System.Windows.Forms.Label(); 46 | this.SuspendLayout(); 47 | // 48 | // btnCreate 49 | // 50 | this.btnCreate.Location = new System.Drawing.Point(225, 238); 51 | this.btnCreate.Name = "btnCreate"; 52 | this.btnCreate.Size = new System.Drawing.Size(75, 28); 53 | this.btnCreate.TabIndex = 23; 54 | this.btnCreate.Text = "Create"; 55 | this.btnCreate.UseVisualStyleBackColor = true; 56 | this.btnCreate.Click += new System.EventHandler(this.CreateAndExit); 57 | // 58 | // txtY1 59 | // 60 | this.txtY1.Location = new System.Drawing.Point(139, 135); 61 | this.txtY1.Name = "txtY1"; 62 | this.txtY1.Size = new System.Drawing.Size(161, 22); 63 | this.txtY1.TabIndex = 22; 64 | // 65 | // lblY1 66 | // 67 | this.lblY1.AutoSize = true; 68 | this.lblY1.Location = new System.Drawing.Point(27, 138); 69 | this.lblY1.Name = "lblY1"; 70 | this.lblY1.Size = new System.Drawing.Size(25, 17); 71 | this.lblY1.TabIndex = 21; 72 | this.lblY1.Text = "Y1"; 73 | // 74 | // txtX1 75 | // 76 | this.txtX1.Location = new System.Drawing.Point(139, 107); 77 | this.txtX1.Name = "txtX1"; 78 | this.txtX1.Size = new System.Drawing.Size(161, 22); 79 | this.txtX1.TabIndex = 20; 80 | // 81 | // lblX1 82 | // 83 | this.lblX1.AutoSize = true; 84 | this.lblX1.Location = new System.Drawing.Point(27, 110); 85 | this.lblX1.Name = "lblX1"; 86 | this.lblX1.Size = new System.Drawing.Size(25, 17); 87 | this.lblX1.TabIndex = 19; 88 | this.lblX1.Text = "X1"; 89 | // 90 | // txtMapId 91 | // 92 | this.txtMapId.Location = new System.Drawing.Point(139, 79); 93 | this.txtMapId.Name = "txtMapId"; 94 | this.txtMapId.Size = new System.Drawing.Size(161, 22); 95 | this.txtMapId.TabIndex = 18; 96 | // 97 | // lblMapId 98 | // 99 | this.lblMapId.AutoSize = true; 100 | this.lblMapId.Location = new System.Drawing.Point(27, 82); 101 | this.lblMapId.Name = "lblMapId"; 102 | this.lblMapId.Size = new System.Drawing.Size(52, 17); 103 | this.lblMapId.TabIndex = 17; 104 | this.lblMapId.Text = "Map ID"; 105 | // 106 | // txtId 107 | // 108 | this.txtId.Location = new System.Drawing.Point(139, 21); 109 | this.txtId.Name = "txtId"; 110 | this.txtId.Size = new System.Drawing.Size(161, 22); 111 | this.txtId.TabIndex = 16; 112 | // 113 | // lblId 114 | // 115 | this.lblId.AutoSize = true; 116 | this.lblId.Location = new System.Drawing.Point(27, 24); 117 | this.lblId.Name = "lblId"; 118 | this.lblId.Size = new System.Drawing.Size(21, 17); 119 | this.lblId.TabIndex = 15; 120 | this.lblId.Text = "ID"; 121 | // 122 | // lblType 123 | // 124 | this.lblType.AutoSize = true; 125 | this.lblType.Location = new System.Drawing.Point(27, 52); 126 | this.lblType.Name = "lblType"; 127 | this.lblType.Size = new System.Drawing.Size(40, 17); 128 | this.lblType.TabIndex = 14; 129 | this.lblType.Text = "Type"; 130 | // 131 | // cmbType 132 | // 133 | this.cmbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 134 | this.cmbType.FormattingEnabled = true; 135 | this.cmbType.Location = new System.Drawing.Point(139, 49); 136 | this.cmbType.Name = "cmbType"; 137 | this.cmbType.Size = new System.Drawing.Size(161, 24); 138 | this.cmbType.TabIndex = 13; 139 | // 140 | // txtY2 141 | // 142 | this.txtY2.Location = new System.Drawing.Point(139, 191); 143 | this.txtY2.Name = "txtY2"; 144 | this.txtY2.Size = new System.Drawing.Size(161, 22); 145 | this.txtY2.TabIndex = 27; 146 | // 147 | // lblY2 148 | // 149 | this.lblY2.AutoSize = true; 150 | this.lblY2.Location = new System.Drawing.Point(27, 194); 151 | this.lblY2.Name = "lblY2"; 152 | this.lblY2.Size = new System.Drawing.Size(25, 17); 153 | this.lblY2.TabIndex = 26; 154 | this.lblY2.Text = "Y2"; 155 | // 156 | // txtX2 157 | // 158 | this.txtX2.Location = new System.Drawing.Point(139, 163); 159 | this.txtX2.Name = "txtX2"; 160 | this.txtX2.Size = new System.Drawing.Size(161, 22); 161 | this.txtX2.TabIndex = 25; 162 | // 163 | // lblX2 164 | // 165 | this.lblX2.AutoSize = true; 166 | this.lblX2.Location = new System.Drawing.Point(27, 166); 167 | this.lblX2.Name = "lblX2"; 168 | this.lblX2.Size = new System.Drawing.Size(25, 17); 169 | this.lblX2.TabIndex = 24; 170 | this.lblX2.Text = "X2"; 171 | // 172 | // CreateRangeObject 173 | // 174 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 175 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 176 | this.ClientSize = new System.Drawing.Size(326, 288); 177 | this.Controls.Add(this.txtY2); 178 | this.Controls.Add(this.lblY2); 179 | this.Controls.Add(this.txtX2); 180 | this.Controls.Add(this.lblX2); 181 | this.Controls.Add(this.btnCreate); 182 | this.Controls.Add(this.txtY1); 183 | this.Controls.Add(this.lblY1); 184 | this.Controls.Add(this.txtX1); 185 | this.Controls.Add(this.lblX1); 186 | this.Controls.Add(this.txtMapId); 187 | this.Controls.Add(this.lblMapId); 188 | this.Controls.Add(this.txtId); 189 | this.Controls.Add(this.lblId); 190 | this.Controls.Add(this.lblType); 191 | this.Controls.Add(this.cmbType); 192 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 193 | this.MaximumSize = new System.Drawing.Size(344, 335); 194 | this.MinimumSize = new System.Drawing.Size(344, 335); 195 | this.Name = "CreateRangeObject"; 196 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 197 | this.Text = "Create Range Object"; 198 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CreateRangeObject_FormClosing); 199 | this.ResumeLayout(false); 200 | this.PerformLayout(); 201 | 202 | } 203 | 204 | #endregion 205 | 206 | public System.Windows.Forms.Button btnCreate; 207 | public System.Windows.Forms.TextBox txtY1; 208 | private System.Windows.Forms.Label lblY1; 209 | public System.Windows.Forms.TextBox txtX1; 210 | private System.Windows.Forms.Label lblX1; 211 | public System.Windows.Forms.TextBox txtMapId; 212 | private System.Windows.Forms.Label lblMapId; 213 | public System.Windows.Forms.TextBox txtId; 214 | private System.Windows.Forms.Label lblId; 215 | private System.Windows.Forms.Label lblType; 216 | public System.Windows.Forms.ComboBox cmbType; 217 | public System.Windows.Forms.TextBox txtY2; 218 | private System.Windows.Forms.Label lblY2; 219 | public System.Windows.Forms.TextBox txtX2; 220 | private System.Windows.Forms.Label lblX2; 221 | } 222 | } -------------------------------------------------------------------------------- /TricksterMap/Create/CreateRangeObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using TricksterMap.Data; 11 | 12 | namespace TricksterMap.Create 13 | { 14 | public partial class CreateRangeObject : Form 15 | { 16 | public MapDataInfo Map = null; 17 | public RangeObjectForm RangeListForm = null; 18 | public Dictionary types = new Dictionary(); 19 | public bool isEditing = false; 20 | 21 | public CreateRangeObject() 22 | { 23 | InitializeComponent(); 24 | 25 | foreach (var type in RangeObject.ValidTypes) 26 | { 27 | var typeName = RangeObject.GetTypeNameFromId(type); 28 | 29 | types.Add(typeName, type); 30 | 31 | cmbType.Items.Add(typeName); 32 | } 33 | 34 | if (RangeObject.ValidTypes.Length > 0) 35 | { 36 | cmbType.SelectedIndex = 0; 37 | } 38 | 39 | Text = Strings.CreateRangeObject; 40 | lblId.Text = Strings.ID; 41 | lblMapId.Text = Strings.MapID; 42 | lblType.Text = Strings.Type; 43 | lblX1.Text = Strings.X1Pos; 44 | lblY1.Text = Strings.Y1Pos; 45 | lblX2.Text = Strings.X2Pos; 46 | lblY2.Text = Strings.Y2Pos; 47 | btnCreate.Text = Strings.Create; 48 | 49 | this.SetFonts(); 50 | } 51 | 52 | private void CreateRangeObject_Load(object sender, EventArgs e) 53 | { 54 | 55 | } 56 | 57 | public int GetTypeIdFromName(string name) 58 | { 59 | if (types.ContainsKey(name)) 60 | { 61 | return types[name]; 62 | } 63 | 64 | return -1; 65 | } 66 | 67 | private void AddObject() 68 | { 69 | var id = int.Parse(txtId.Text); 70 | var typeId = GetTypeIdFromName(cmbType.Text); 71 | 72 | var point = new RangeObject() 73 | { 74 | Id = id, 75 | Type = typeId, 76 | Destination = int.Parse(txtMapId.Text), 77 | X1 = int.Parse(txtX1.Text), 78 | Y1 = int.Parse(txtY1.Text), 79 | X2 = int.Parse(txtX2.Text), 80 | Y2 = int.Parse(txtY2.Text) 81 | }; 82 | 83 | Map.RangeObjects.Add(point); 84 | RangeListForm.RepopulateData(); 85 | } 86 | 87 | private void CreateAndExit(object sender, EventArgs e) 88 | { 89 | isEditing = false; 90 | AddObject(); 91 | Close(); 92 | } 93 | 94 | private void CreateRangeObject_FormClosing(object sender, FormClosingEventArgs e) 95 | { 96 | if (isEditing) 97 | { 98 | CreateAndExit(sender, e); 99 | } 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /TricksterMap/Create/CreateRangeObject.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TricksterMap/Data/ConfigLayer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TricksterMap.Data 8 | { 9 | public class ConfigLayer 10 | { 11 | /// 12 | /// The layer's type 13 | /// 14 | public int Type { get; set; } 15 | 16 | /// 17 | /// The layer's X size 18 | /// 19 | public int X { get; set; } 20 | 21 | /// 22 | /// The layer's Y size 23 | /// 24 | public int Y { get; set; } 25 | 26 | /// 27 | /// The layer's X BPP (bits per pixel) 28 | /// Probably 0x10/16bpp 29 | /// 30 | public int BppX { get; set; } 31 | 32 | /// 33 | /// The layer's Y BPP (bits per pixel) 34 | /// Probably 0x10/16bpp 35 | /// 36 | public int BppY { get; set; } 37 | 38 | /// 39 | /// Actual layer data 40 | /// 41 | public byte[] Data { get; set; } 42 | 43 | public string GetTypeName() 44 | { 45 | switch(Type) 46 | { 47 | case 0x1: 48 | // Setting where players can walk and where they can't 49 | return Strings.CollisionData; 50 | case 0x2: 51 | // Example: O/X points at Paradise 52 | return Strings.SpecialEffects; 53 | case 0x3: 54 | // Soil value? 55 | return Strings.GroundType; 56 | case 0x4: 57 | // Setting height differences? 58 | return Strings.HeightData; 59 | } 60 | 61 | return String.Format(Strings.UnknownType, Type); 62 | } 63 | 64 | public string GetValueName(byte b) 65 | { 66 | switch(b) 67 | { 68 | case 0: 69 | return Strings.Walkable; 70 | case 1: 71 | return Strings.NotWalkable; 72 | } 73 | 74 | return String.Format(Strings.UnknownType, (int)b); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /TricksterMap/Data/EffectObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TricksterMap.Data 8 | { 9 | public class EffectObject 10 | { 11 | public int Id { get; set; } = 0; 12 | public int X { get; set; } 13 | public int Y { get; set; } 14 | public int Param4 { get; set; } 15 | public int EffectName1 { get; set; } 16 | public int EffectName2 { get; set; } 17 | public int EffectName3 { get; set; } 18 | public int Param9 { get; set; } 19 | public int Param10 { get; set; } 20 | public int Param11 { get; set; } 21 | public int Param12 { get; set; } 22 | public int Param13 { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /TricksterMap/Data/MapDataInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TricksterMap.Data 8 | { 9 | public class MapDataInfo 10 | { 11 | #region Header 12 | 13 | /// 14 | /// 0x012F or 0x012E 15 | /// 0x012F = Data files are compressed 16 | /// 17 | public int Version { get; set; } 18 | 19 | /// 20 | /// Bits per pixel for the tile data 21 | /// 22 | public int TileBpp { get; set; } = 0x10; 23 | 24 | /// 25 | /// Unknown 26 | /// 27 | public int Param3 { get; set; } = 0; 28 | 29 | /// 30 | /// Unknown 31 | /// 32 | public int Param4 { get; set; } = 0; 33 | 34 | /// 35 | /// Total size of related files of the map (sum of MD3 + BAC + TIL + LYR), not including EFF file. The size may not match in some cases. 36 | /// 37 | public int MapSizeSum { get; set; } = 0; 38 | 39 | /// 40 | /// Unknown 41 | /// 42 | public int Param6 { get; set; } 43 | 44 | /// 45 | /// Unknown 46 | /// 47 | public int Param7 { get; set; } 48 | 49 | /// 50 | /// Map size X (pixels) 51 | /// 52 | public int MapSizeX { get; set; } 53 | 54 | /// 55 | /// Map size Y (pixels) 56 | /// 57 | public int MapSizeY { get; set; } 58 | 59 | /// 60 | /// Image size X (pixels) 61 | /// 62 | public int TileSizeX { get; set; } 63 | 64 | /// 65 | /// Image size Y (pixels) 66 | /// 67 | public int TileSizeY { get; set; } 68 | 69 | /// 70 | /// Tile count X (unconfirmed) 71 | /// 72 | public int TileCountX { get; set; } 73 | 74 | /// 75 | /// Tile count Y (unconfirmed) 76 | /// 77 | public int TileCountY { get; set; } 78 | 79 | /// 80 | /// Unknown 81 | /// 82 | public int Param14 { get; set; } 83 | 84 | /// 85 | /// Number of data blocks in the lyr file 86 | /// 87 | public int LyrDataCount { get; set; } 88 | 89 | /// 90 | /// Number of image groups in the til file 91 | /// 92 | public int TileGroupCount { get; set; } 93 | 94 | /// 95 | /// Unknown 96 | /// 97 | public int Param21 { get; set; } = 0; 98 | 99 | /// 100 | /// Unknown 101 | /// 102 | public int Param22 { get; set; } = 0; 103 | 104 | /// 105 | /// Unknown 106 | /// 107 | public int Param23 { get; set; } = 0; 108 | 109 | #endregion 110 | 111 | #region Vectors 112 | 113 | /// 114 | /// List of config layers 115 | /// We probably won't touch this but we'll need it when we're rebuilding the MD3 file 116 | /// 117 | public List ConfigLayers { get; set; } = new List(); 118 | 119 | /// 120 | /// Range object list (TODO) 121 | /// 122 | public List RangeObjects { get; set; } = new List(); 123 | 124 | /// 125 | /// Point object list (TODO) 126 | /// 127 | public List PointObjects { get; set; } = new List(); 128 | 129 | /// 130 | /// Effect object list (TODO) 131 | /// 132 | public List EffectObjects { get; set; } = new List(); 133 | 134 | #endregion 135 | 136 | #region Temporary Data 137 | 138 | public int BacFileSize { get; set; } = 0; 139 | public int TilFileSize { get; set; } = 0; 140 | public int LyrFileSize { get; set; } = 0; 141 | 142 | #endregion 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /TricksterMap/Data/PointObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TricksterMap.Data 8 | { 9 | public class PointObject 10 | { 11 | public static int[] ValidTypes = 12 | { 13 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x07, 0x09, 0x0A, 0x0D 14 | }; 15 | 16 | /// 17 | /// Position Id / PosId 18 | /// 19 | public int Id { get; set; } 20 | 21 | /// 22 | /// Type of point object 23 | /// 24 | public int Type { get; set; } 25 | 26 | /// 27 | /// Map ID (for portals only) 28 | /// 29 | public int MapId { get; set; } 30 | 31 | /// 32 | /// X position 33 | /// 34 | public int X { get; set; } 35 | 36 | /// 37 | /// Y position 38 | /// 39 | public int Y { get; set; } 40 | 41 | /// 42 | /// Options (unconfirmed, is this always 0?) 43 | /// 44 | public int Options { get; set; } = 0; 45 | 46 | /// 47 | /// Gets the name of the point object's type 48 | /// 49 | /// Name of the object's type 50 | public string GetTypeName() 51 | { 52 | return GetTypeNameFromId(Type); 53 | } 54 | 55 | /// 56 | /// Gets the name of a point object's type 57 | /// 58 | /// Name of an object's type 59 | public static string GetTypeNameFromId(int Type) 60 | { 61 | switch (Type) 62 | { 63 | case 0x00: 64 | return Strings.None; 65 | case 0x01: 66 | return Strings.Portal; 67 | case 0x02: 68 | return Strings.RespawnLocation; 69 | case 0x03: 70 | return Strings.MonsterSpawnPoint; 71 | case 0x04: 72 | return Strings.GeneralNPC; 73 | case 0x05: 74 | return Strings.ShopNPC; 75 | case 0x07: 76 | return Strings.TeleportItemSpawn; 77 | case 0x09: 78 | return Strings.TeleportNPCSpawn; 79 | case 0x0A: 80 | return Strings.SkillNPC; 81 | case 0x0D: 82 | return Strings.NORIEntity; 83 | } 84 | 85 | return String.Format(Strings.UnknownType, Type); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /TricksterMap/Data/RangeObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TricksterMap.Data 8 | { 9 | public class RangeObject 10 | { 11 | public static int[] ValidTypes = 12 | { 13 | 0x00, 0x01, 0x02, 0x05, 0x06, 0x09, 0x0A 14 | }; 15 | 16 | /// 17 | /// Range object type 18 | /// 19 | public int Type { get; set; } 20 | 21 | /// 22 | /// Range object ID 23 | /// 24 | public int Id { get; set; } 25 | 26 | /// 27 | /// Warp portal destination ZoneID 28 | /// 29 | public int Destination { get; set; } 30 | 31 | public int X1 { get; set; } 32 | public int Y1 { get; set; } 33 | 34 | public int X2 { get; set; } 35 | public int Y2 { get; set; } 36 | 37 | /// 38 | /// Options (unconfirmed, is this always 0?) 39 | /// 40 | public int Options { get; set; } = 0; 41 | 42 | /// 43 | /// Gets the name of the range object's type 44 | /// 45 | /// Name of the object's type 46 | public string GetTypeName() 47 | { 48 | return GetTypeNameFromId(Type); 49 | } 50 | 51 | /// 52 | /// Gets the name of a range object's type 53 | /// 54 | /// Name of the object's type 55 | public static string GetTypeNameFromId(int Type) 56 | { 57 | switch (Type) 58 | { 59 | case 0x00: 60 | // The range in which a user can enter a portal from, maybe? 61 | return Strings.PortalEntranceRange; 62 | case 0x01: 63 | return Strings.SetDebris; 64 | case 0x02: 65 | return Strings.MonsterMovementRange; 66 | case 0x05: 67 | return Strings.MonsterGatherRange; 68 | case 0x06: 69 | return Strings.NPCMovementRange; 70 | case 0x09: 71 | return Strings.MonsterSpawnRange; 72 | case 0x0A: 73 | return Strings.GvGSpawnRange; 74 | } 75 | 76 | return String.Format(Strings.UnknownType, Type); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /TricksterMap/Data/TileData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace TricksterMap.Data 9 | { 10 | public class TileData 11 | { 12 | public int Address { get; set; } 13 | public int TilesX { get; set; } 14 | public int TilesY { get; set; } 15 | public List Bitmaps { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TricksterMap/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace TricksterMap 10 | { 11 | public static class Extensions 12 | { 13 | public static void SetFont(Control.ControlCollection controls) 14 | { 15 | foreach (var control in controls) 16 | { 17 | if (control is Control.ControlCollection collection) 18 | { 19 | SetFont(collection); 20 | } 21 | else if (control is TableLayoutPanel panel) 22 | { 23 | SetFont(panel.Controls); 24 | } 25 | else if (control is Control c) 26 | { 27 | c.Font = new Font(Strings.PreferredFont, c.Font.Size); 28 | } 29 | } 30 | } 31 | 32 | public static void SetFonts(this Form form) 33 | { 34 | SetFont(form.Controls); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TricksterMap/LvCtl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace TricksterMap 9 | { 10 | public static class LvCtl 11 | { 12 | static List LVs = new List(); 13 | 14 | delegate string StringFrom(string s); 15 | 16 | static Dictionary funx = new Dictionary(); 17 | 18 | public static void registerLV(ListView lv) 19 | { 20 | if (!LVs.Contains(lv) && lv is ListView) 21 | { 22 | LVs.Add(lv); 23 | lv.ColumnClick += Lv_ColumnClick; 24 | 25 | funx.Add("", stringFromString); 26 | for (int i = 0; i < lv.Columns.Count; i++) 27 | { 28 | if (lv.Columns[i].Text == null) continue; 29 | string n = lv.Columns[i].Text.ToString(); 30 | if (n == "") continue; 31 | if (n.Contains("__date")) funx.Add(n, stringFromDate); 32 | if (n.Contains("__int")) funx.Add(n, stringFromInt); 33 | else funx.Add(n, stringFromString); 34 | } 35 | 36 | } 37 | } 38 | 39 | static string stringFromString(string s) 40 | { 41 | return s; 42 | } 43 | static string stringFromInt(string s) 44 | { 45 | int i = 0; 46 | int.TryParse(s, out i); 47 | return i.ToString("00000"); 48 | } 49 | static string stringFromDate(string s) 50 | { 51 | DateTime dt = Convert.ToDateTime(s); 52 | return dt.ToString("yyyy.MM.dd HH.mm.ss"); 53 | } 54 | 55 | private static void Lv_ColumnClick(object sender, ColumnClickEventArgs e) 56 | { 57 | ListView lv = sender as ListView; 58 | if (lv == null) return; 59 | 60 | 61 | int c = e.Column; 62 | string nt = lv.Columns[c].Text.ToString(); 63 | string n = nt.Replace("__", "§").Split('§')[0]; 64 | 65 | bool asc = (lv.Text == null) || (lv.Text.ToString() != c + ""); 66 | var items = lv.Items.Cast().ToList(); 67 | var sorted = asc ? 68 | items.OrderByDescending(x => funx[nt](c < x.SubItems.Count ? 69 | x.SubItems[c].Text : "")).ToList() : 70 | items.OrderBy(x => funx[nt](c < x.SubItems.Count ? 71 | x.SubItems[c].Text : "")).ToList(); 72 | lv.Items.Clear(); 73 | lv.Items.AddRange(sorted.ToArray()); 74 | if (asc) lv.Text = c + ""; else lv.Text = null; 75 | } 76 | 77 | public static void unRegisterLV(ListView lv) 78 | { 79 | if (LVs.Contains(lv) && lv is ListView) 80 | { 81 | LVs.Remove(lv); 82 | lv.ColumnClick -= Lv_ColumnClick; 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /TricksterMap/MDIParent.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TricksterMap 2 | { 3 | partial class MDIParent 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MDIParent)); 32 | this.menuStrip = new System.Windows.Forms.MenuStrip(); 33 | this.fileMenu = new System.Windows.Forms.ToolStripMenuItem(); 34 | this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 35 | this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 36 | this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); 37 | this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 38 | this.languageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 39 | this.tabControl1 = new System.Windows.Forms.TabControl(); 40 | this.menuStrip.SuspendLayout(); 41 | this.SuspendLayout(); 42 | // 43 | // menuStrip 44 | // 45 | this.menuStrip.AllowMerge = false; 46 | this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); 47 | this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 48 | this.fileMenu, 49 | this.languageToolStripMenuItem}); 50 | this.menuStrip.Location = new System.Drawing.Point(0, 0); 51 | this.menuStrip.Name = "menuStrip"; 52 | this.menuStrip.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2); 53 | this.menuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; 54 | this.menuStrip.Size = new System.Drawing.Size(843, 27); 55 | this.menuStrip.TabIndex = 0; 56 | this.menuStrip.Text = "MenuStrip"; 57 | // 58 | // fileMenu 59 | // 60 | this.fileMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 61 | this.openToolStripMenuItem, 62 | this.saveAsToolStripMenuItem, 63 | this.toolStripSeparator3, 64 | this.exitToolStripMenuItem}); 65 | this.fileMenu.ImageTransparentColor = System.Drawing.SystemColors.ActiveBorder; 66 | this.fileMenu.Name = "fileMenu"; 67 | this.fileMenu.Size = new System.Drawing.Size(45, 24); 68 | this.fileMenu.Text = "&File"; 69 | // 70 | // openToolStripMenuItem 71 | // 72 | this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image"))); 73 | this.openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; 74 | this.openToolStripMenuItem.Name = "openToolStripMenuItem"; 75 | this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); 76 | this.openToolStripMenuItem.Size = new System.Drawing.Size(216, 26); 77 | this.openToolStripMenuItem.Text = "&Open"; 78 | this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenFile); 79 | // 80 | // saveAsToolStripMenuItem 81 | // 82 | this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; 83 | this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(216, 26); 84 | this.saveAsToolStripMenuItem.Text = "Save As"; 85 | this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); 86 | // 87 | // toolStripSeparator3 88 | // 89 | this.toolStripSeparator3.Name = "toolStripSeparator3"; 90 | this.toolStripSeparator3.Size = new System.Drawing.Size(213, 6); 91 | // 92 | // exitToolStripMenuItem 93 | // 94 | this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; 95 | this.exitToolStripMenuItem.Size = new System.Drawing.Size(216, 26); 96 | this.exitToolStripMenuItem.Text = "E&xit"; 97 | this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolsStripMenuItem_Click); 98 | // 99 | // languageToolStripMenuItem 100 | // 101 | this.languageToolStripMenuItem.Name = "languageToolStripMenuItem"; 102 | this.languageToolStripMenuItem.Size = new System.Drawing.Size(91, 24); 103 | this.languageToolStripMenuItem.Text = "Language"; 104 | // 105 | // tabControl1 106 | // 107 | this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; 108 | this.tabControl1.Location = new System.Drawing.Point(0, 27); 109 | this.tabControl1.Name = "tabControl1"; 110 | this.tabControl1.SelectedIndex = 0; 111 | this.tabControl1.Size = new System.Drawing.Size(843, 531); 112 | this.tabControl1.TabIndex = 2; 113 | // 114 | // MDIParent 115 | // 116 | this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); 117 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 118 | this.ClientSize = new System.Drawing.Size(843, 558); 119 | this.Controls.Add(this.tabControl1); 120 | this.Controls.Add(this.menuStrip); 121 | this.MainMenuStrip = this.menuStrip; 122 | this.Margin = new System.Windows.Forms.Padding(4); 123 | this.Name = "MDIParent"; 124 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 125 | this.Text = "Trickster Map Data"; 126 | this.Load += new System.EventHandler(this.MDIParent_Load); 127 | this.menuStrip.ResumeLayout(false); 128 | this.menuStrip.PerformLayout(); 129 | this.ResumeLayout(false); 130 | this.PerformLayout(); 131 | 132 | } 133 | #endregion 134 | 135 | 136 | private System.Windows.Forms.MenuStrip menuStrip; 137 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; 138 | private System.Windows.Forms.ToolStripMenuItem fileMenu; 139 | private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; 140 | private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; 141 | private System.Windows.Forms.ToolStripMenuItem languageToolStripMenuItem; 142 | private System.Windows.Forms.TabControl tabControl1; 143 | private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; 144 | } 145 | } 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /TricksterMap/MDIParent.cs: -------------------------------------------------------------------------------- 1 | using TricksterMap.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.IO; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | using System.Globalization; 13 | using System.Reflection; 14 | using System.Threading; 15 | 16 | namespace TricksterMap 17 | { 18 | public partial class MDIParent : Form 19 | { 20 | MapDataInfo Map = null; 21 | bool ChangedLanguage = false; 22 | 23 | public MDIParent() 24 | { 25 | InitializeComponent(); 26 | 27 | fileMenu.Text = Strings.File; 28 | openToolStripMenuItem.Text = Strings.FileOpen; 29 | saveAsToolStripMenuItem.Text = Strings.SaveAs; 30 | exitToolStripMenuItem.Text = Strings.FileExit; 31 | languageToolStripMenuItem.Text = Strings.Language; 32 | 33 | this.SetFonts(); 34 | } 35 | 36 | private void OpenMap(string fileName) 37 | { 38 | using (var fileStream = File.Open(fileName, FileMode.Open)) 39 | { 40 | using (var reader = new BinaryReader(fileStream)) 41 | { 42 | var mapInfo = MapDataLoader.Load(reader); 43 | 44 | tabControl1.TabPages.Clear(); 45 | 46 | var page = new TabPage() 47 | { 48 | Text = String.Format(Strings.CollisionFormTitle, fileName) 49 | }; 50 | 51 | var collisionForm = new ConfigLayerCollisionForm 52 | { 53 | TopLevel = false, 54 | FormBorderStyle = FormBorderStyle.None, 55 | Dock = DockStyle.Fill, 56 | Visible = true 57 | }; 58 | 59 | // Load the collision data from the layer 60 | page.Controls.Add(collisionForm); 61 | tabControl1.TabPages.Add(page); 62 | 63 | 64 | foreach (var layer in mapInfo.ConfigLayers) 65 | { 66 | if (layer.Type == 1) 67 | { 68 | collisionForm.LoadCollisionData(layer); 69 | } 70 | else if (layer.Type == 2) 71 | { 72 | Console.WriteLine("Type 2"); 73 | collisionForm.LoadType2(layer); 74 | } 75 | else if (layer.Type == 3) 76 | { 77 | Console.WriteLine("Type 3"); 78 | collisionForm.LoadType3(layer); 79 | } 80 | else if (layer.Type == 4) 81 | { 82 | Console.WriteLine("Type 4"); 83 | collisionForm.LoadType2(layer); 84 | } 85 | } 86 | 87 | var pointPage = new TabPage() 88 | { 89 | Text = String.Format(Strings.PointObjectView, fileName) 90 | }; 91 | 92 | var pointForm = new PointObjectForm 93 | { 94 | Map = mapInfo, 95 | TopLevel = false, 96 | FormBorderStyle = FormBorderStyle.None, 97 | Dock = DockStyle.Fill, 98 | Visible = true 99 | }; 100 | 101 | pointForm.RepopulateData(); 102 | pointPage.Controls.Add(pointForm); 103 | tabControl1.TabPages.Add(pointPage); 104 | 105 | var rangePage = new TabPage() 106 | { 107 | Text = String.Format(Strings.RangeObjectView, fileName) 108 | }; 109 | 110 | var rangeForm = new RangeObjectForm 111 | { 112 | TopLevel = false, 113 | FormBorderStyle = FormBorderStyle.None, 114 | Dock = DockStyle.Fill, 115 | Visible = true, 116 | Map = mapInfo 117 | }; 118 | 119 | rangeForm.RepopulateData(); 120 | rangePage.Controls.Add(rangeForm); 121 | tabControl1.TabPages.Add(rangePage); 122 | 123 | // At this point, we need to grab the tile data 124 | var tileData = TileReader.Read(mapInfo, File.Open(fileName.Replace(".md3", ".til"), FileMode.Open)); 125 | var tiles = new List(); 126 | 127 | foreach (var tile in tileData) 128 | { 129 | var bmp = new Bitmap(tile.TilesX * mapInfo.TileSizeX, tile.TilesY * mapInfo.TileSizeY); 130 | 131 | var tileIndex = 0; 132 | using (var g = Graphics.FromImage(bmp)) 133 | { 134 | for (int i = 0; i < tile.TilesY; i++) 135 | { 136 | for (int j = 0; j < tile.TilesX; j++) 137 | { 138 | g.DrawImage(tile.Bitmaps[tileIndex], j * mapInfo.TileSizeX, i * mapInfo.TileSizeY, mapInfo.TileSizeX, mapInfo.TileSizeY); 139 | g.DrawString((tileIndex + 1).ToString(), new Font("Arial", 10), Brushes.Black, j * mapInfo.TileSizeX, i * mapInfo.TileSizeY); 140 | //Console.WriteLine("{0}: ({1}, {2})", tileIndex + 1, j, i); 141 | tileIndex++; 142 | } 143 | } 144 | } 145 | 146 | tiles.Add(bmp); 147 | } 148 | 149 | if (tiles.Count > 0) 150 | { 151 | var tilePage = new TabPage() 152 | { 153 | Text = String.Format(Strings.TileView, fileName.Replace(".md3", ".til")) 154 | }; 155 | 156 | var tileViewForm = new TileViewForm 157 | { 158 | TopLevel = false, 159 | FormBorderStyle = FormBorderStyle.None, 160 | Dock = DockStyle.Fill, 161 | Visible = true, 162 | Map = mapInfo, 163 | tiles = tiles 164 | }; 165 | 166 | tileViewForm.Populate(); 167 | tilePage.Controls.Add(tileViewForm); 168 | tabControl1.TabPages.Add(tilePage); 169 | } 170 | 171 | // Get filesizes for temporary stuff 172 | mapInfo.BacFileSize = (int)new FileInfo(fileName.Replace(".md3", ".bac")).Length; 173 | mapInfo.TilFileSize = (int)new FileInfo(fileName.Replace(".md3", ".til")).Length; 174 | mapInfo.LyrFileSize = (int)new FileInfo(fileName.Replace(".md3", ".lyr")).Length; 175 | 176 | Text = String.Format("TricksterMap - {0}", fileName); 177 | Map = mapInfo; 178 | } 179 | } 180 | } 181 | 182 | private void OpenFile(object sender, EventArgs e) 183 | { 184 | OpenFileDialog openFileDialog = new OpenFileDialog 185 | { 186 | Filter = Strings.OpenType + "|*.md3|All Files (*.*)|*.*" 187 | }; 188 | 189 | if (openFileDialog.ShowDialog(this) == DialogResult.OK) 190 | { 191 | OpenMap(openFileDialog.FileName); 192 | } 193 | } 194 | 195 | private void ExitToolsStripMenuItem_Click(object sender, EventArgs e) 196 | { 197 | Close(); 198 | } 199 | 200 | public IEnumerable GetSupportedCultures() 201 | { 202 | CultureInfo[] culture = CultureInfo.GetCultures(CultureTypes.AllCultures); 203 | string exeLocation = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)); 204 | return culture.Where(cultureInfo => Directory.Exists(Path.Combine(exeLocation, cultureInfo.Name))); 205 | } 206 | 207 | private void MDIParent_Load(object sender, EventArgs e) 208 | { 209 | var cultures = GetSupportedCultures(); 210 | 211 | foreach(var culture in cultures) 212 | { 213 | var lang = new ToolStripMenuItem($"{(culture.TwoLetterISOLanguageName == "iv" ? "English" : culture.NativeName)}"); 214 | 215 | lang.Click += (object s, EventArgs ea) => 216 | { 217 | ChangedLanguage = true; 218 | Thread.CurrentThread.CurrentCulture = culture; 219 | Thread.CurrentThread.CurrentUICulture = culture; 220 | new MDIParent().Show(); 221 | Close(); 222 | }; 223 | 224 | languageToolStripMenuItem.DropDownItems.Add(lang); 225 | } 226 | } 227 | 228 | protected override void OnFormClosing(FormClosingEventArgs e) 229 | { 230 | base.OnFormClosing(e); 231 | 232 | if (e.CloseReason != CloseReason.WindowsShutDown && !ChangedLanguage) 233 | { 234 | Application.Exit(); 235 | } 236 | } 237 | 238 | #pragma warning disable IDE1006 // Naming Styles 239 | private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) 240 | #pragma warning restore IDE1006 // Naming Styles 241 | { 242 | if( Map == null) 243 | { 244 | return; 245 | } 246 | 247 | SaveFileDialog saveDialog = new SaveFileDialog 248 | { 249 | Filter = Strings.OpenType + "|*.md3|All Files (*.*)|*.*" 250 | }; 251 | 252 | if (saveDialog.ShowDialog(this) == DialogResult.OK) 253 | { 254 | MapSaveHelper.Save(saveDialog.FileName, Map); 255 | } 256 | } 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /TricksterMap/MDIParent.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 125 | 126 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 127 | YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJYSURBVDhPvZFbSBNQHIf30ENPFmlRCEWWhD0MA0Oqh5Ck 128 | m6KUZoWRJpS3LhiKbVPbvE53c+pKh7lN19RptTIMK4RCkQgtdZSYmgVFpZgZKnn7GptokkEP0R9+L+ec 129 | 7zs/zhH8l8kpMSPTWriSbyJPZ0WiNDK/9XcTnawjLF7lhC6IKsh0yFKyDUQllyCoN2tYLo218j/ekiAp 130 | JTxRRWh8oUvQ22VkcrTOmR8jFqaHDFhNKmzm7GUlYQlqQuO0BMcWI6irVDMxUr0Env1UyrQ9ieqKfKrK 131 | cjGUZKIvzOC6UkyxPHWptMaoYOKLcQGec8D0isEeu2x+E9wsl/P9o34BbqpXOPPAWkCDRc6dqlyshiws 132 | ehkm3VVuaNMoU4vRKUQuWZU+l7F3Rc7aAy1SbNVqZgdkMJi9NG8da/0S6EmGV4l01kZwKSYEgUGXxbe+ 133 | fHiv5G6NiraHStehX6u/jIL2cGZag5h8FMCbSiHnTx9wCcq1Ur6+ljHYmo7NomSuXwrdcS6wM8YBnmCm 134 | LYTJ5v2MNe5huH4HsnhvTgZ6uN6iVJ3OcJeIW2YFHU8dTXqSHIKz0HGKuWdHmHpyiPGmvYzY/Phc40N7 135 | zmoig7zw2+bmEugKxHQ3Z3DbXAB9GfDCUff5MaZaghl/HMBogz9DViEfjFuxK92Rxm7Bd7vn4k8U5aVS 136 | Z8rHfi+Bdo1gIW3KFTTLV3I/cxW1aWsxpHpy7fImIg9vxt9346JAk52CRnqOPFE0kovHnQ9zJiKQowd3 137 | sW+3kJ1Cb3y8PNm4wYN1a9xY7z5f/d+MQPATMS7uX9kMtOAAAAAASUVORK5CYII= 138 | 139 | 140 | 141 | 51 142 | 143 | -------------------------------------------------------------------------------- /TricksterMap/MapDataLoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using TricksterMap.Data; 8 | 9 | namespace TricksterMap 10 | { 11 | public class MapDataLoader 12 | { 13 | static string ByteArrayToString(byte[] ba) 14 | { 15 | return BitConverter.ToString(ba).Replace("-", " ").ToUpper(); 16 | } 17 | 18 | public static MapDataInfo Load(BinaryReader reader) 19 | { 20 | var mapData = new MapDataInfo(); 21 | 22 | var signature = Encoding.ASCII.GetString(reader.ReadBytes(4)); 23 | if (signature != "MDN_") 24 | { 25 | throw new InvalidDataException(Strings.InvalidMapFileError); 26 | } 27 | 28 | mapData.Version = reader.ReadInt32(); 29 | mapData.TileBpp = reader.ReadInt32(); 30 | mapData.Param3 = reader.ReadInt32(); 31 | mapData.Param4 = reader.ReadInt32(); 32 | mapData.MapSizeSum = reader.ReadInt32(); 33 | mapData.Param6 = reader.ReadInt32(); 34 | mapData.Param7 = reader.ReadInt32(); 35 | mapData.MapSizeX = reader.ReadInt32(); 36 | mapData.MapSizeY = reader.ReadInt32(); 37 | mapData.TileSizeX = reader.ReadInt32(); 38 | mapData.TileSizeY = reader.ReadInt32(); 39 | mapData.TileCountX = reader.ReadInt32(); 40 | mapData.TileCountY = reader.ReadInt32(); 41 | mapData.Param14 = reader.ReadInt32(); 42 | mapData.LyrDataCount = reader.ReadInt32(); 43 | mapData.TileGroupCount = reader.ReadInt32(); 44 | 45 | var layerCount = reader.ReadInt32(); 46 | Console.WriteLine("layerCount = {0}", layerCount); 47 | 48 | var rangeCount = reader.ReadInt32(); 49 | Console.WriteLine("rangeCount = {0}", rangeCount); 50 | 51 | var pointCount = reader.ReadInt32(); 52 | Console.WriteLine("pointCount = {0}", pointCount); 53 | 54 | var effectCount = reader.ReadInt32(); 55 | Console.WriteLine("effectCount = {0}", effectCount); 56 | 57 | mapData.Param21 = reader.ReadInt32(); 58 | mapData.Param22 = reader.ReadInt32(); 59 | mapData.Param23 = reader.ReadInt32(); 60 | 61 | for (var i = 0; i < layerCount; i++) 62 | { 63 | var layer = new ConfigLayer() 64 | { 65 | Type = reader.ReadInt32(), 66 | X = reader.ReadInt32(), 67 | Y = reader.ReadInt32(), 68 | BppX = reader.ReadInt32(), 69 | BppY = reader.ReadInt32() 70 | }; 71 | 72 | layer.Data = reader.ReadBytes(layer.X * layer.Y); 73 | 74 | Console.WriteLine("X: {0} / Y: {1} / Total length: {2} ( {2:X} )", layer.X, layer.Y, layer.X * layer.Y); 75 | Console.WriteLine("Type: {0}", layer.Type); 76 | Console.WriteLine("Config layer {0} length: {1:X}", i + 1, layer.Data.Length); 77 | 78 | mapData.ConfigLayers.Add(layer); 79 | } 80 | 81 | Console.WriteLine("Reading rangeData"); 82 | 83 | var rangeData = reader.ReadBytes(32 * rangeCount); 84 | 85 | for (var i = 0; i < rangeCount; i++) 86 | { 87 | var obj = rangeData.Skip(i * 32).Take(32).ToArray(); 88 | 89 | using (var range = new BinaryReader(new MemoryStream(obj))) 90 | { 91 | mapData.RangeObjects.Add(new RangeObject() 92 | { 93 | Type = range.ReadInt32(), 94 | Id = range.ReadInt32(), 95 | Destination = range.ReadInt32(), 96 | X1 = range.ReadInt32(), 97 | Y1 = range.ReadInt32(), 98 | X2 = range.ReadInt32(), 99 | Y2 = range.ReadInt32(), 100 | Options = range.ReadInt32() 101 | }); 102 | } 103 | } 104 | 105 | Console.WriteLine("Reading pointData"); 106 | 107 | var pointData = reader.ReadBytes(24 * pointCount); 108 | 109 | for (var i = 0; i < pointCount; i++) 110 | { 111 | var pointBytes = pointData.Skip(i * 24).Take(24).ToArray(); 112 | 113 | using (var pointReader = new BinaryReader(new MemoryStream(pointBytes))) 114 | { 115 | mapData.PointObjects.Add(new PointObject() 116 | { 117 | Id = pointReader.ReadInt32(), 118 | Type = pointReader.ReadInt32(), 119 | MapId = pointReader.ReadInt32(), 120 | X = pointReader.ReadInt32(), 121 | Y = pointReader.ReadInt32(), 122 | Options = pointReader.ReadInt32() 123 | }); 124 | } 125 | } 126 | 127 | 128 | Console.WriteLine("Reading effectData"); 129 | 130 | var effectData = reader.ReadBytes(52 * effectCount); 131 | 132 | for (int i = 0; i < effectCount; i++) 133 | { 134 | var effect = effectData.Skip(i * 52).Take(52).ToArray(); 135 | mapData.EffectObjects.Add(effect); 136 | Console.WriteLine(ByteArrayToString(effect)); 137 | } 138 | 139 | return mapData; 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /TricksterMap/MapSaveHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using TricksterMap.Data; 8 | 9 | namespace TricksterMap 10 | { 11 | public class MapSaveHelper 12 | { 13 | private static byte[] GetPointObjectBytes(MapDataInfo Map) 14 | { 15 | using (var ms = new MemoryStream()) 16 | { 17 | using (var bw = new BinaryWriter(ms)) 18 | { 19 | foreach (var point in Map.PointObjects) 20 | { 21 | bw.Write(point.Id); 22 | bw.Write(point.Type); 23 | bw.Write(point.MapId); 24 | bw.Write(point.X); 25 | bw.Write(point.Y); 26 | bw.Write(point.Options); 27 | } 28 | 29 | return ms.ToArray(); 30 | } 31 | } 32 | } 33 | 34 | private static byte[] GetRangeObjectBytes(MapDataInfo Map) 35 | { 36 | using (var ms = new MemoryStream()) 37 | { 38 | using (var bw = new BinaryWriter(ms)) 39 | { 40 | foreach (var range in Map.RangeObjects) 41 | { 42 | bw.Write(range.Type); 43 | bw.Write(range.Id); 44 | bw.Write(range.Destination); 45 | bw.Write(range.X1); 46 | bw.Write(range.Y1); 47 | bw.Write(range.X2); 48 | bw.Write(range.Y2); 49 | bw.Write(range.Options); 50 | } 51 | 52 | return ms.ToArray(); 53 | } 54 | } 55 | } 56 | 57 | private static byte[] GetConfigLayerBytes(MapDataInfo Map) 58 | { 59 | using (var ms = new MemoryStream()) 60 | { 61 | using (var bw = new BinaryWriter(ms)) 62 | { 63 | foreach (var layer in Map.ConfigLayers) 64 | { 65 | // Header 66 | bw.Write(layer.Type); 67 | bw.Write(layer.X); 68 | bw.Write(layer.Y); 69 | bw.Write(layer.BppX); 70 | bw.Write(layer.BppY); 71 | 72 | // Data 73 | bw.Write(layer.Data); 74 | } 75 | 76 | return ms.ToArray(); 77 | } 78 | } 79 | } 80 | 81 | private static byte[] GetEffectObjectBytes(MapDataInfo Map) 82 | { 83 | using (var ms = new MemoryStream()) 84 | { 85 | using (var bw = new BinaryWriter(ms)) 86 | { 87 | foreach (var effect in Map.EffectObjects) 88 | { 89 | bw.Write(effect); 90 | } 91 | 92 | return ms.ToArray(); 93 | } 94 | } 95 | } 96 | 97 | public static void Save(string filename, MapDataInfo map) 98 | { 99 | var layers = GetConfigLayerBytes(map); 100 | var ranges = GetRangeObjectBytes(map); 101 | var points = GetPointObjectBytes(map); 102 | var effects = GetEffectObjectBytes(map); 103 | 104 | // Header is 96 bytes long 105 | const int md3HeaderSize = 96; 106 | var md3Size = md3HeaderSize + layers.Length + points.Length + ranges.Length + effects.Length; 107 | var totalSize = md3Size + map.BacFileSize + map.TilFileSize + map.LyrFileSize; 108 | 109 | var file = File.OpenWrite(filename); 110 | 111 | using (var w = new BinaryWriter(file)) 112 | { 113 | w.Write('M'); 114 | w.Write('D'); 115 | w.Write('N'); 116 | w.Write('_'); 117 | w.Write(map.Version); 118 | w.Write(map.TileBpp); 119 | w.Write(map.Param3); 120 | w.Write(map.Param4); 121 | 122 | // todo? 123 | w.Write(totalSize); // Total size of MD3 + BAC + TIL + LYR 124 | 125 | w.Write(map.Param6); 126 | w.Write(map.Param7); 127 | w.Write(map.MapSizeX); 128 | w.Write(map.MapSizeY); 129 | w.Write(map.TileSizeX); 130 | w.Write(map.TileSizeY); 131 | w.Write(map.TileCountX); 132 | w.Write(map.TileCountY); 133 | w.Write(map.Param14); 134 | w.Write(map.LyrDataCount); 135 | w.Write(map.TileGroupCount); 136 | w.Write(map.ConfigLayers.Count); 137 | w.Write(map.RangeObjects.Count); 138 | w.Write(map.PointObjects.Count); 139 | w.Write(map.EffectObjects.Count); 140 | w.Write(map.Param21); 141 | w.Write(map.Param22); 142 | w.Write(map.Param23); 143 | 144 | w.Write(layers); 145 | w.Write(ranges); 146 | w.Write(points); 147 | w.Write(effects); 148 | } 149 | 150 | file.Close(); 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /TricksterMap/NearestNeighborPictureBox.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing.Drawing2D; 2 | using System.Windows.Forms; 3 | 4 | namespace TricksterMap 5 | { 6 | // https://stackoverflow.com/a/13484101 7 | /// 8 | /// Inherits from PictureBox; adds Interpolation Mode Setting 9 | /// 10 | public class NearestNeighborPictureBox : PictureBox 11 | { 12 | protected override void OnPaint(PaintEventArgs paintEventArgs) 13 | { 14 | paintEventArgs.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor; 15 | paintEventArgs.Graphics.PixelOffsetMode = PixelOffsetMode.Half; 16 | base.OnPaint(paintEventArgs); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /TricksterMap/PointObjectForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TricksterMap 2 | { 3 | partial class PointObjectForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 32 | this.pointList = new System.Windows.Forms.ListView(); 33 | this.idHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 34 | this.typeHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 35 | this.mapIdHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 36 | this.xPosHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 37 | this.yPosHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 38 | this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); 39 | this.btnCreate = new System.Windows.Forms.Button(); 40 | this.btnDelete = new System.Windows.Forms.Button(); 41 | this.btnEdit = new System.Windows.Forms.Button(); 42 | this.tableLayoutPanel1.SuspendLayout(); 43 | this.tableLayoutPanel2.SuspendLayout(); 44 | this.SuspendLayout(); 45 | // 46 | // tableLayoutPanel1 47 | // 48 | this.tableLayoutPanel1.ColumnCount = 1; 49 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 50 | this.tableLayoutPanel1.Controls.Add(this.pointList, 0, 0); 51 | this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1); 52 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 53 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 54 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 55 | this.tableLayoutPanel1.RowCount = 2; 56 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 90F)); 57 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 58 | this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 450); 59 | this.tableLayoutPanel1.TabIndex = 0; 60 | // 61 | // pointList 62 | // 63 | this.pointList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 64 | this.idHeader, 65 | this.typeHeader, 66 | this.mapIdHeader, 67 | this.xPosHeader, 68 | this.yPosHeader}); 69 | this.pointList.Dock = System.Windows.Forms.DockStyle.Fill; 70 | this.pointList.FullRowSelect = true; 71 | this.pointList.Location = new System.Drawing.Point(3, 3); 72 | this.pointList.MultiSelect = false; 73 | this.pointList.Name = "pointList"; 74 | this.pointList.Size = new System.Drawing.Size(794, 399); 75 | this.pointList.TabIndex = 3; 76 | this.pointList.UseCompatibleStateImageBehavior = false; 77 | this.pointList.View = System.Windows.Forms.View.Details; 78 | this.pointList.DoubleClick += new System.EventHandler(this.pointList_DoubleClick); 79 | // 80 | // idHeader 81 | // 82 | this.idHeader.Text = "ID"; 83 | this.idHeader.Width = 80; 84 | // 85 | // typeHeader 86 | // 87 | this.typeHeader.Text = "Type"; 88 | this.typeHeader.Width = 140; 89 | // 90 | // mapIdHeader 91 | // 92 | this.mapIdHeader.Text = "Map ID"; 93 | this.mapIdHeader.Width = 100; 94 | // 95 | // xPosHeader 96 | // 97 | this.xPosHeader.Text = "X"; 98 | this.xPosHeader.Width = 100; 99 | // 100 | // yPosHeader 101 | // 102 | this.yPosHeader.Text = "Y"; 103 | this.yPosHeader.Width = 100; 104 | // 105 | // tableLayoutPanel2 106 | // 107 | this.tableLayoutPanel2.ColumnCount = 3; 108 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); 109 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); 110 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); 111 | this.tableLayoutPanel2.Controls.Add(this.btnCreate, 0, 0); 112 | this.tableLayoutPanel2.Controls.Add(this.btnDelete, 2, 0); 113 | this.tableLayoutPanel2.Controls.Add(this.btnEdit, 1, 0); 114 | this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 115 | this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 408); 116 | this.tableLayoutPanel2.Name = "tableLayoutPanel2"; 117 | this.tableLayoutPanel2.RowCount = 1; 118 | this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 119 | this.tableLayoutPanel2.Size = new System.Drawing.Size(794, 39); 120 | this.tableLayoutPanel2.TabIndex = 4; 121 | // 122 | // btnCreate 123 | // 124 | this.btnCreate.Dock = System.Windows.Forms.DockStyle.Fill; 125 | this.btnCreate.Location = new System.Drawing.Point(3, 3); 126 | this.btnCreate.Name = "btnCreate"; 127 | this.btnCreate.Size = new System.Drawing.Size(258, 33); 128 | this.btnCreate.TabIndex = 0; 129 | this.btnCreate.Text = "Create"; 130 | this.btnCreate.UseVisualStyleBackColor = true; 131 | this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click); 132 | // 133 | // btnDelete 134 | // 135 | this.btnDelete.Dock = System.Windows.Forms.DockStyle.Fill; 136 | this.btnDelete.Location = new System.Drawing.Point(531, 3); 137 | this.btnDelete.Name = "btnDelete"; 138 | this.btnDelete.Size = new System.Drawing.Size(260, 33); 139 | this.btnDelete.TabIndex = 1; 140 | this.btnDelete.Text = "Delete"; 141 | this.btnDelete.UseVisualStyleBackColor = true; 142 | this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); 143 | // 144 | // btnEdit 145 | // 146 | this.btnEdit.Dock = System.Windows.Forms.DockStyle.Fill; 147 | this.btnEdit.Location = new System.Drawing.Point(267, 3); 148 | this.btnEdit.Name = "btnEdit"; 149 | this.btnEdit.Size = new System.Drawing.Size(258, 33); 150 | this.btnEdit.TabIndex = 2; 151 | this.btnEdit.Text = "Edit"; 152 | this.btnEdit.UseVisualStyleBackColor = true; 153 | this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click); 154 | // 155 | // PointObjectForm 156 | // 157 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 158 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 159 | this.ClientSize = new System.Drawing.Size(800, 450); 160 | this.Controls.Add(this.tableLayoutPanel1); 161 | this.Name = "PointObjectForm"; 162 | this.Text = "Point Object Data"; 163 | this.Load += new System.EventHandler(this.PointObjectForm_Load); 164 | this.tableLayoutPanel1.ResumeLayout(false); 165 | this.tableLayoutPanel2.ResumeLayout(false); 166 | this.ResumeLayout(false); 167 | 168 | } 169 | 170 | #endregion 171 | 172 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 173 | public System.Windows.Forms.ListView pointList; 174 | private System.Windows.Forms.ColumnHeader idHeader; 175 | private System.Windows.Forms.ColumnHeader typeHeader; 176 | private System.Windows.Forms.ColumnHeader mapIdHeader; 177 | private System.Windows.Forms.ColumnHeader xPosHeader; 178 | private System.Windows.Forms.ColumnHeader yPosHeader; 179 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; 180 | private System.Windows.Forms.Button btnDelete; 181 | private System.Windows.Forms.Button btnCreate; 182 | private System.Windows.Forms.Button btnEdit; 183 | } 184 | } -------------------------------------------------------------------------------- /TricksterMap/PointObjectForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using TricksterMap.Create; 11 | using TricksterMap.Data; 12 | 13 | namespace TricksterMap 14 | { 15 | public partial class PointObjectForm : Form 16 | { 17 | public MapDataInfo Map = null; 18 | public Dictionary types = new Dictionary(); 19 | 20 | public PointObjectForm() 21 | { 22 | InitializeComponent(); 23 | 24 | // Initialize localization 25 | idHeader.Text = Strings.ID; 26 | typeHeader.Text = Strings.Type; 27 | mapIdHeader.Text = Strings.MapID; 28 | xPosHeader.Text = Strings.XPos; 29 | yPosHeader.Text = Strings.YPos; 30 | 31 | btnCreate.Text = Strings.Create; 32 | btnDelete.Text = Strings.Delete; 33 | btnEdit.Text = Strings.Edit; 34 | 35 | foreach (var type in PointObject.ValidTypes) 36 | { 37 | var typeName = PointObject.GetTypeNameFromId(type); 38 | 39 | types.Add(typeName, type); 40 | } 41 | } 42 | 43 | public void RepopulateData() 44 | { 45 | pointList.Items.Clear(); 46 | 47 | foreach (var point in Map.PointObjects) 48 | { 49 | pointList.Items.Add(new ListViewItem(new string[] { point.Id.ToString(), point.GetTypeName(), point.MapId.ToString(), point.X.ToString(), point.Y.ToString() })); 50 | } 51 | } 52 | 53 | #pragma warning disable IDE1006 // Naming Styles 54 | private void btnCreate_Click(object sender, EventArgs e) 55 | #pragma warning restore IDE1006 // Naming Styles 56 | { 57 | var createForm = new CreatePointObject() 58 | { 59 | Map = Map, 60 | PointListForm = this 61 | }; 62 | 63 | createForm.ShowDialog(); 64 | } 65 | 66 | #pragma warning disable IDE1006 // Naming Styles 67 | private void btnDelete_Click(object sender, EventArgs e) 68 | #pragma warning restore IDE1006 // Naming Styles 69 | { 70 | if (pointList.SelectedIndices.Count > 0) 71 | { 72 | Map.PointObjects.RemoveAt(pointList.Items.IndexOf(pointList.SelectedItems[0])); 73 | pointList.SelectedItems[0].Remove(); 74 | } 75 | } 76 | 77 | #pragma warning disable IDE1006 // Naming Styles 78 | private void btnEdit_Click(object sender, EventArgs e) 79 | #pragma warning restore IDE1006 // Naming Styles 80 | { 81 | EditSelectedItem(); 82 | } 83 | 84 | private void PointObjectForm_Load(object sender, EventArgs e) 85 | { 86 | this.SetFonts(); 87 | } 88 | 89 | #pragma warning disable IDE1006 // Naming Styles 90 | private void pointList_DoubleClick(object sender, EventArgs e) 91 | #pragma warning restore IDE1006 // Naming Styles 92 | { 93 | EditSelectedItem(); 94 | } 95 | 96 | private void EditSelectedItem() 97 | { 98 | if (pointList.SelectedIndices.Count > 0) 99 | { 100 | var index = pointList.Items.IndexOf(pointList.SelectedItems[0]); 101 | 102 | var point = Map.PointObjects[index]; 103 | 104 | Map.PointObjects.RemoveAt(index); 105 | pointList.SelectedItems[0].Remove(); 106 | 107 | var createForm = new CreatePointObject() 108 | { 109 | Map = Map, 110 | PointListForm = this, 111 | isEditing = true 112 | }; 113 | 114 | createForm.Text = Strings.EditPointObject; 115 | createForm.btnCreate.Text = Strings.Edit; 116 | createForm.txtId.Text = point.Id.ToString(); 117 | createForm.txtMapId.Text = point.MapId.ToString(); 118 | createForm.txtX.Text = point.X.ToString(); 119 | createForm.txtY.Text = point.Y.ToString(); 120 | createForm.cmbType.SelectedIndex = createForm.cmbType.FindStringExact(point.GetTypeName()); 121 | 122 | createForm.ShowDialog(); 123 | } 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /TricksterMap/PointObjectForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TricksterMap/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace TricksterMap 10 | { 11 | static class Program 12 | { 13 | /// 14 | /// The main entry point for the application. 15 | /// 16 | [STAThread] 17 | static void Main() 18 | { 19 | if (Environment.OSVersion.Version.Major <= 6) 20 | { 21 | SetProcessDPIAware(); 22 | } 23 | 24 | Application.EnableVisualStyles(); 25 | Application.SetCompatibleTextRenderingDefault(false); 26 | new MDIParent().Show(); 27 | Application.Run(); 28 | } 29 | 30 | [System.Runtime.InteropServices.DllImport("user32.dll")] 31 | private static extern bool SetProcessDPIAware(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /TricksterMap/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("md3-2")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("md3-2")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("71a3c82f-0e6f-415c-bd25-7a2b25a86b84")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /TricksterMap/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TricksterMap.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TricksterMap.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /TricksterMap/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /TricksterMap/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TricksterMap.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /TricksterMap/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TricksterMap/RangeObjectForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TricksterMap 2 | { 3 | partial class RangeObjectForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 32 | this.pointList = new System.Windows.Forms.ListView(); 33 | this.idHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 34 | this.typeHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 35 | this.mapIdHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 36 | this.x1PosHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 37 | this.y1PosHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 38 | this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); 39 | this.btnCreate = new System.Windows.Forms.Button(); 40 | this.btnDelete = new System.Windows.Forms.Button(); 41 | this.btnEdit = new System.Windows.Forms.Button(); 42 | this.x2PosHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 43 | this.y2PosHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 44 | this.tableLayoutPanel1.SuspendLayout(); 45 | this.tableLayoutPanel2.SuspendLayout(); 46 | this.SuspendLayout(); 47 | // 48 | // tableLayoutPanel1 49 | // 50 | this.tableLayoutPanel1.ColumnCount = 1; 51 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 52 | this.tableLayoutPanel1.Controls.Add(this.pointList, 0, 0); 53 | this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1); 54 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 55 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 56 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 57 | this.tableLayoutPanel1.RowCount = 2; 58 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 90F)); 59 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 60 | this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 450); 61 | this.tableLayoutPanel1.TabIndex = 0; 62 | // 63 | // pointList 64 | // 65 | this.pointList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 66 | this.idHeader, 67 | this.typeHeader, 68 | this.mapIdHeader, 69 | this.x1PosHeader, 70 | this.y1PosHeader, 71 | this.x2PosHeader, 72 | this.y2PosHeader}); 73 | this.pointList.Dock = System.Windows.Forms.DockStyle.Fill; 74 | this.pointList.FullRowSelect = true; 75 | this.pointList.Location = new System.Drawing.Point(3, 3); 76 | this.pointList.MultiSelect = false; 77 | this.pointList.Name = "pointList"; 78 | this.pointList.Size = new System.Drawing.Size(794, 399); 79 | this.pointList.TabIndex = 3; 80 | this.pointList.UseCompatibleStateImageBehavior = false; 81 | this.pointList.View = System.Windows.Forms.View.Details; 82 | this.pointList.DoubleClick += new System.EventHandler(this.RangeList_DoubleClick); 83 | // 84 | // idHeader 85 | // 86 | this.idHeader.Text = "ID"; 87 | this.idHeader.Width = 80; 88 | // 89 | // typeHeader 90 | // 91 | this.typeHeader.Text = "Type"; 92 | this.typeHeader.Width = 140; 93 | // 94 | // mapIdHeader 95 | // 96 | this.mapIdHeader.Text = "Map ID"; 97 | this.mapIdHeader.Width = 100; 98 | // 99 | // x1PosHeader 100 | // 101 | this.x1PosHeader.Text = "X1"; 102 | this.x1PosHeader.Width = 100; 103 | // 104 | // y1PosHeader 105 | // 106 | this.y1PosHeader.Text = "Y1"; 107 | this.y1PosHeader.Width = 100; 108 | // 109 | // tableLayoutPanel2 110 | // 111 | this.tableLayoutPanel2.ColumnCount = 3; 112 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); 113 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); 114 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); 115 | this.tableLayoutPanel2.Controls.Add(this.btnCreate, 0, 0); 116 | this.tableLayoutPanel2.Controls.Add(this.btnDelete, 2, 0); 117 | this.tableLayoutPanel2.Controls.Add(this.btnEdit, 1, 0); 118 | this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 119 | this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 408); 120 | this.tableLayoutPanel2.Name = "tableLayoutPanel2"; 121 | this.tableLayoutPanel2.RowCount = 1; 122 | this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 123 | this.tableLayoutPanel2.Size = new System.Drawing.Size(794, 39); 124 | this.tableLayoutPanel2.TabIndex = 4; 125 | // 126 | // btnCreate 127 | // 128 | this.btnCreate.Dock = System.Windows.Forms.DockStyle.Fill; 129 | this.btnCreate.Location = new System.Drawing.Point(3, 3); 130 | this.btnCreate.Name = "btnCreate"; 131 | this.btnCreate.Size = new System.Drawing.Size(258, 33); 132 | this.btnCreate.TabIndex = 0; 133 | this.btnCreate.Text = "Create"; 134 | this.btnCreate.UseVisualStyleBackColor = true; 135 | this.btnCreate.Click += new System.EventHandler(this.BtnCreate_Click); 136 | // 137 | // btnDelete 138 | // 139 | this.btnDelete.Dock = System.Windows.Forms.DockStyle.Fill; 140 | this.btnDelete.Location = new System.Drawing.Point(531, 3); 141 | this.btnDelete.Name = "btnDelete"; 142 | this.btnDelete.Size = new System.Drawing.Size(260, 33); 143 | this.btnDelete.TabIndex = 1; 144 | this.btnDelete.Text = "Delete"; 145 | this.btnDelete.UseVisualStyleBackColor = true; 146 | this.btnDelete.Click += new System.EventHandler(this.BtnDelete_Click); 147 | // 148 | // btnEdit 149 | // 150 | this.btnEdit.Dock = System.Windows.Forms.DockStyle.Fill; 151 | this.btnEdit.Location = new System.Drawing.Point(267, 3); 152 | this.btnEdit.Name = "btnEdit"; 153 | this.btnEdit.Size = new System.Drawing.Size(258, 33); 154 | this.btnEdit.TabIndex = 2; 155 | this.btnEdit.Text = "Edit"; 156 | this.btnEdit.UseVisualStyleBackColor = true; 157 | this.btnEdit.Click += new System.EventHandler(this.BtnEdit_Click); 158 | // 159 | // x2PosHeader 160 | // 161 | this.x2PosHeader.Text = "X2"; 162 | this.x2PosHeader.Width = 100; 163 | // 164 | // y2PosHeader 165 | // 166 | this.y2PosHeader.Text = "Y2"; 167 | this.y2PosHeader.Width = 100; 168 | // 169 | // RangeObjectForm 170 | // 171 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 172 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 173 | this.ClientSize = new System.Drawing.Size(800, 450); 174 | this.Controls.Add(this.tableLayoutPanel1); 175 | this.Name = "RangeObjectForm"; 176 | this.Text = "Range Object Data"; 177 | this.Load += new System.EventHandler(this.RangeObjectForm_Load); 178 | this.tableLayoutPanel1.ResumeLayout(false); 179 | this.tableLayoutPanel2.ResumeLayout(false); 180 | this.ResumeLayout(false); 181 | 182 | } 183 | 184 | #endregion 185 | 186 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 187 | public System.Windows.Forms.ListView pointList; 188 | private System.Windows.Forms.ColumnHeader idHeader; 189 | private System.Windows.Forms.ColumnHeader typeHeader; 190 | private System.Windows.Forms.ColumnHeader mapIdHeader; 191 | private System.Windows.Forms.ColumnHeader x1PosHeader; 192 | private System.Windows.Forms.ColumnHeader y1PosHeader; 193 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; 194 | private System.Windows.Forms.Button btnDelete; 195 | private System.Windows.Forms.Button btnCreate; 196 | private System.Windows.Forms.Button btnEdit; 197 | private System.Windows.Forms.ColumnHeader x2PosHeader; 198 | private System.Windows.Forms.ColumnHeader y2PosHeader; 199 | } 200 | } -------------------------------------------------------------------------------- /TricksterMap/RangeObjectForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using TricksterMap.Create; 11 | using TricksterMap.Data; 12 | 13 | namespace TricksterMap 14 | { 15 | public partial class RangeObjectForm : Form 16 | { 17 | public MapDataInfo Map = null; 18 | public Dictionary types = new Dictionary(); 19 | 20 | public RangeObjectForm() 21 | { 22 | InitializeComponent(); 23 | 24 | // Initialize localization 25 | idHeader.Text = Strings.ID; 26 | typeHeader.Text = Strings.Type; 27 | mapIdHeader.Text = Strings.MapID; 28 | x1PosHeader.Text = Strings.X1Pos; 29 | y1PosHeader.Text = Strings.Y1Pos; 30 | x2PosHeader.Text = Strings.X2Pos; 31 | y2PosHeader.Text = Strings.Y2Pos; 32 | 33 | btnCreate.Text = Strings.Create; 34 | btnDelete.Text = Strings.Delete; 35 | btnEdit.Text = Strings.Edit; 36 | 37 | foreach (var type in RangeObject.ValidTypes) 38 | { 39 | var typeName = RangeObject.GetTypeNameFromId(type); 40 | 41 | types.Add(typeName, type); 42 | } 43 | } 44 | 45 | public void RepopulateData() 46 | { 47 | pointList.Items.Clear(); 48 | 49 | foreach (var point in Map.RangeObjects) 50 | { 51 | pointList.Items.Add(new ListViewItem(new string[] { point.Id.ToString(), point.GetTypeName(), point.Destination.ToString(), point.X1.ToString(), point.Y1.ToString(), point.X2.ToString(), point.Y2.ToString() })); 52 | } 53 | } 54 | 55 | private void BtnCreate_Click(object sender, EventArgs e) 56 | { 57 | var createForm = new CreateRangeObject() 58 | { 59 | Map = Map, 60 | RangeListForm = this 61 | }; 62 | 63 | createForm.ShowDialog(); 64 | } 65 | 66 | private void BtnDelete_Click(object sender, EventArgs e) 67 | { 68 | if (pointList.SelectedIndices.Count > 0) 69 | { 70 | Map.RangeObjects.RemoveAt(pointList.Items.IndexOf(pointList.SelectedItems[0])); 71 | pointList.SelectedItems[0].Remove(); 72 | } 73 | } 74 | 75 | private void BtnEdit_Click(object sender, EventArgs e) 76 | { 77 | EditSelectedItem(); 78 | } 79 | 80 | private void RangeObjectForm_Load(object sender, EventArgs e) 81 | { 82 | this.SetFonts(); 83 | } 84 | 85 | private void RangeList_DoubleClick(object sender, EventArgs e) 86 | { 87 | EditSelectedItem(); 88 | } 89 | 90 | private void EditSelectedItem() 91 | { 92 | if (pointList.SelectedIndices.Count > 0) 93 | { 94 | var index = pointList.Items.IndexOf(pointList.SelectedItems[0]); 95 | 96 | var range = Map.RangeObjects[index]; 97 | 98 | Map.RangeObjects.RemoveAt(index); 99 | pointList.SelectedItems[0].Remove(); 100 | 101 | var createForm = new CreateRangeObject() 102 | { 103 | Map = Map, 104 | RangeListForm = this, 105 | isEditing = true 106 | }; 107 | 108 | createForm.Text = Strings.EditRangeObject; 109 | createForm.btnCreate.Text = Strings.Edit; 110 | createForm.txtId.Text = range.Id.ToString(); 111 | createForm.txtMapId.Text = range.Destination.ToString(); 112 | createForm.txtX1.Text = range.X1.ToString(); 113 | createForm.txtY1.Text = range.Y1.ToString(); 114 | createForm.txtX2.Text = range.X2.ToString(); 115 | createForm.txtY2.Text = range.Y2.ToString(); 116 | createForm.cmbType.SelectedIndex = createForm.cmbType.FindStringExact(range.GetTypeName()); 117 | 118 | createForm.ShowDialog(); 119 | } 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /TricksterMap/RangeObjectForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TricksterMap/Strings.zh.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raymonf/TricksterMap/6118106fcf7274f6a93470224ba310ae03559b1f/TricksterMap/Strings.zh.Designer.cs -------------------------------------------------------------------------------- /TricksterMap/Strings.zh.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Config Layer 122 | {0} is the map filename 123 | 124 | 125 | 檔案 126 | Menu name 127 | 128 | 129 | 結束 130 | Menu item (File > Exit) 131 | 132 | 133 | 開啟檔案 134 | Menu item (File > Open) 135 | 136 | 137 | NPC(一般) 138 | 139 | 140 | 無效的Trickster地圖資源文件。 141 | Used when the user specifies an invalid file. 142 | 143 | 144 | 地圖ID 145 | 146 | 147 | 怪物孵化點 148 | 149 | 150 | 151 | 無用 152 | 153 | 154 | NORI 實體 155 | 156 | 157 | 不能通過的部分 158 | 159 | 160 | Trickster地圖資源文件 (*.md3) 161 | Open file type 162 | 163 | 164 | 重生點 165 | 166 | 167 | NPC(商店) 168 | 169 | 170 | 傳送位置(物品) 171 | 172 | 173 | 傳送位置(NPC) 174 | 175 | 176 | 類型 177 | 178 | 179 | 能通過的部分 180 | 181 | 182 | X位置 183 | 184 | 185 | Y位置 186 | 187 | 188 | 未知類型({0}) 189 | 190 | 191 | 碰撞數據 192 | 193 | 194 | 土壤類型 195 | 196 | 197 | GvG生成區 198 | 199 | 200 | 高度數據 201 | 202 | 203 | 怪物聚集範圍 204 | 205 | 206 | 怪物移動範圍 207 | 208 | 209 | 怪物孵化區 210 | 211 | 212 | NPC移動範圍 213 | 214 | 215 | 傳送門 216 | 217 | 218 | 進入傳送門範圍 219 | The range in which a user can enter a portal from 220 | 221 | 222 | Microsoft JhengHei UI 223 | Used for rendering text 224 | 225 | 226 | 等級要求 227 | Erroneously named SetDebris; will check the PortalInfo table. 228 | 229 | 230 | NPC(技能商店) 231 | 232 | 233 | 特殊效果 234 | 235 | 236 | X大小:{0} 237 | X size, for the colliison data legend 238 | 239 | 240 | Y大小:{0} 241 | Y size, for the collision data legend 242 | 243 | 244 | 新增 245 | 246 | 247 | 新增 Point Object 248 | 249 | 250 | 刪除 251 | 252 | 253 | 編輯 254 | 255 | 256 | 編輯 Point Object 257 | 258 | 259 | ID 260 | 261 | 262 | 地圖控制({0}) 263 | {0} is the filename 264 | 265 | 266 | {1} 之 {0} 267 | 268 | 269 | Point Object 數據 270 | 271 | 272 | 另存為... 273 | Map control form button 274 | 275 | 276 | 平鋪顯示 277 | 278 | 279 | 語言 280 | 281 | 282 | Range Object 數據 283 | 284 | 285 | 新增 Range Object 286 | 287 | 288 | 編輯 Range Object 289 | 290 | 291 | X1 292 | 293 | 294 | X2 295 | 296 | 297 | Y1 298 | 299 | 300 | Y2 301 | 302 | -------------------------------------------------------------------------------- /TricksterMap/TileReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using TricksterMap.Data; 9 | 10 | namespace TricksterMap 11 | { 12 | public class TileReader 13 | { 14 | public static List Read(MapDataInfo map, Stream stream) 15 | { 16 | // 0x0000E0F0 is the magic number for compressed til files 17 | // Keep in mind that this is little endian 18 | if (stream.ReadByte() == 0xF0 && stream.ReadByte() == 0xE0) 19 | { 20 | // Decompress 21 | stream.Seek(0, SeekOrigin.Begin); 22 | return ParseData(CompressedFileLoader.Decompress(stream), map); 23 | } 24 | 25 | stream.Seek(0, SeekOrigin.Begin); 26 | return ParseData(GetBytesFromStream(stream), map); 27 | } 28 | 29 | private static byte[] GetBytesFromStream(Stream input) 30 | { 31 | using (MemoryStream ms = new MemoryStream()) 32 | { 33 | input.CopyTo(ms); 34 | return ms.ToArray(); 35 | } 36 | } 37 | 38 | private static List ParseData(byte[] data, MapDataInfo map) 39 | { 40 | var tiles = new List(); 41 | 42 | var groupCount = map.TileGroupCount; 43 | var countX = map.TileCountX; 44 | var countY = map.TileCountY; 45 | var tileSizeX = map.TileSizeX; 46 | var tileSizeY = map.TileSizeY; 47 | 48 | Console.WriteLine("groupCount = {0}", groupCount); 49 | 50 | using (var memoryStream = new MemoryStream(data)) 51 | { 52 | using (var reader = new BinaryReader(memoryStream)) 53 | { 54 | var addresses = new List(); 55 | 56 | // i = group base address 57 | for (var i = 0; i < groupCount; i++) 58 | { 59 | var address = reader.ReadInt32(); 60 | addresses.Add(address); 61 | Console.WriteLine(address); 62 | } 63 | 64 | foreach (var address in addresses) 65 | { 66 | // Seek to the address header location 67 | memoryStream.Seek(address + (4 * groupCount), SeekOrigin.Begin); 68 | 69 | var groupSize = reader.ReadInt32(); 70 | var xSize = reader.ReadInt32(); 71 | var ySize = reader.ReadInt32(); 72 | 73 | var bmps = new List(); 74 | 75 | var sizePerTile = (tileSizeX * tileSizeY * (map.TileBpp / 8)); 76 | for (int i = 0; i < groupSize / sizePerTile; i++) 77 | { 78 | using (var bmpStream = new MemoryStream()) 79 | { 80 | var writer = new BinaryWriter(bmpStream); 81 | 82 | var headerSize = 54; 83 | var totalSize = headerSize + sizePerTile; 84 | 85 | writer.Write('B'); 86 | writer.Write('M'); 87 | writer.Write(totalSize); 88 | writer.Write(0); 89 | writer.Write(headerSize); 90 | writer.Write(headerSize - 14); // DIB header size 91 | writer.Write(tileSizeX); 92 | writer.Write(tileSizeY); 93 | writer.Write((short)1); 94 | writer.Write((short)map.TileBpp); 95 | writer.Write(0); // No compression 96 | writer.Write(sizePerTile); 97 | writer.Write(0); 98 | writer.Write(0); 99 | writer.Write(0); 100 | writer.Write(0); 101 | writer.Write(reader.ReadBytes(2048)); 102 | 103 | int paddingSize = totalSize % 4; 104 | for (int p = 0; p < paddingSize; p++) 105 | { 106 | writer.Write(0x0); 107 | } 108 | 109 | bmpStream.Seek(0, SeekOrigin.Begin); 110 | bmps.Add((Bitmap)Image.FromStream(bmpStream)); 111 | 112 | writer.Dispose(); 113 | } 114 | } 115 | 116 | tiles.Add(new TileData() 117 | { 118 | Address = address, 119 | TilesX = xSize, 120 | TilesY = ySize, 121 | Bitmaps = bmps 122 | }); 123 | } 124 | } 125 | } 126 | 127 | return tiles; 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /TricksterMap/TileViewForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TricksterMap 2 | { 3 | partial class TileViewForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 32 | this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); 33 | this.btnBack = new System.Windows.Forms.Button(); 34 | this.btnForward = new System.Windows.Forms.Button(); 35 | this.lblInfo = new System.Windows.Forms.Label(); 36 | this.mapPicture = new System.Windows.Forms.PictureBox(); 37 | this.tableLayoutPanel1.SuspendLayout(); 38 | this.tableLayoutPanel2.SuspendLayout(); 39 | ((System.ComponentModel.ISupportInitialize)(this.mapPicture)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // tableLayoutPanel1 43 | // 44 | this.tableLayoutPanel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; 45 | this.tableLayoutPanel1.ColumnCount = 1; 46 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 47 | this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1); 48 | this.tableLayoutPanel1.Controls.Add(this.mapPicture, 0, 0); 49 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 50 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 51 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 52 | this.tableLayoutPanel1.RowCount = 2; 53 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 90F)); 54 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); 55 | this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 450); 56 | this.tableLayoutPanel1.TabIndex = 0; 57 | // 58 | // tableLayoutPanel2 59 | // 60 | this.tableLayoutPanel2.ColumnCount = 3; 61 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); 62 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40F)); 63 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); 64 | this.tableLayoutPanel2.Controls.Add(this.btnBack, 0, 0); 65 | this.tableLayoutPanel2.Controls.Add(this.btnForward, 2, 0); 66 | this.tableLayoutPanel2.Controls.Add(this.lblInfo, 1, 0); 67 | this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 68 | this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 408); 69 | this.tableLayoutPanel2.Name = "tableLayoutPanel2"; 70 | this.tableLayoutPanel2.RowCount = 1; 71 | this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 72 | this.tableLayoutPanel2.Size = new System.Drawing.Size(794, 39); 73 | this.tableLayoutPanel2.TabIndex = 0; 74 | // 75 | // btnBack 76 | // 77 | this.btnBack.Dock = System.Windows.Forms.DockStyle.Fill; 78 | this.btnBack.Location = new System.Drawing.Point(3, 3); 79 | this.btnBack.Name = "btnBack"; 80 | this.btnBack.Size = new System.Drawing.Size(232, 33); 81 | this.btnBack.TabIndex = 0; 82 | this.btnBack.Text = "<"; 83 | this.btnBack.UseVisualStyleBackColor = true; 84 | this.btnBack.Click += new System.EventHandler(this.btnBack_Click); 85 | // 86 | // btnForward 87 | // 88 | this.btnForward.Dock = System.Windows.Forms.DockStyle.Fill; 89 | this.btnForward.Location = new System.Drawing.Point(558, 3); 90 | this.btnForward.Name = "btnForward"; 91 | this.btnForward.Size = new System.Drawing.Size(233, 33); 92 | this.btnForward.TabIndex = 1; 93 | this.btnForward.Text = ">"; 94 | this.btnForward.UseVisualStyleBackColor = true; 95 | this.btnForward.Click += new System.EventHandler(this.btnForward_Click); 96 | // 97 | // lblInfo 98 | // 99 | this.lblInfo.AutoSize = true; 100 | this.lblInfo.Dock = System.Windows.Forms.DockStyle.Fill; 101 | this.lblInfo.Location = new System.Drawing.Point(241, 0); 102 | this.lblInfo.Name = "lblInfo"; 103 | this.lblInfo.Size = new System.Drawing.Size(311, 39); 104 | this.lblInfo.TabIndex = 2; 105 | this.lblInfo.Text = "Images"; 106 | this.lblInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 107 | // 108 | // mapPicture 109 | // 110 | this.mapPicture.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; 111 | this.mapPicture.Dock = System.Windows.Forms.DockStyle.Fill; 112 | this.mapPicture.Location = new System.Drawing.Point(3, 3); 113 | this.mapPicture.Name = "mapPicture"; 114 | this.mapPicture.Size = new System.Drawing.Size(794, 399); 115 | this.mapPicture.TabIndex = 1; 116 | this.mapPicture.TabStop = false; 117 | // 118 | // MapViewForm 119 | // 120 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 121 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 122 | this.ClientSize = new System.Drawing.Size(800, 450); 123 | this.Controls.Add(this.tableLayoutPanel1); 124 | this.Name = "MapViewForm"; 125 | this.Text = "Tile Viewer"; 126 | this.Load += new System.EventHandler(this.MapViewForm_Load); 127 | this.tableLayoutPanel1.ResumeLayout(false); 128 | this.tableLayoutPanel2.ResumeLayout(false); 129 | this.tableLayoutPanel2.PerformLayout(); 130 | ((System.ComponentModel.ISupportInitialize)(this.mapPicture)).EndInit(); 131 | this.ResumeLayout(false); 132 | 133 | } 134 | 135 | #endregion 136 | 137 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 138 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; 139 | private System.Windows.Forms.Button btnBack; 140 | private System.Windows.Forms.Button btnForward; 141 | private System.Windows.Forms.Label lblInfo; 142 | public System.Windows.Forms.PictureBox mapPicture; 143 | } 144 | } -------------------------------------------------------------------------------- /TricksterMap/TileViewForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using TricksterMap.Data; 11 | 12 | namespace TricksterMap 13 | { 14 | public partial class TileViewForm : Form 15 | { 16 | public MapDataInfo Map = null; 17 | public List tiles = null; 18 | int i = 0; 19 | 20 | public TileViewForm() 21 | { 22 | InitializeComponent(); 23 | 24 | this.SetFonts(); 25 | } 26 | 27 | private void MapViewForm_Load(object sender, EventArgs e) 28 | { 29 | 30 | } 31 | 32 | public void Populate() 33 | { 34 | if (tiles.Count > 0) 35 | { 36 | i = 0; 37 | 38 | lblInfo.Text = String.Format(Strings.NumOfNum, (i + 1), tiles.Count); 39 | 40 | mapPicture.BackgroundImage = tiles[0]; 41 | } 42 | else 43 | { 44 | Close(); 45 | } 46 | } 47 | 48 | #pragma warning disable IDE1006 // Naming Styles 49 | private void btnForward_Click(object sender, EventArgs e) 50 | #pragma warning restore IDE1006 // Naming Styles 51 | { 52 | if (tiles.Count > 0) 53 | { 54 | if (i >= tiles.Count - 1) 55 | { 56 | i = 0; 57 | } 58 | else 59 | { 60 | i++; 61 | } 62 | 63 | lblInfo.Text = String.Format(Strings.NumOfNum, (i + 1), tiles.Count); 64 | 65 | mapPicture.BackgroundImage = tiles[i]; 66 | } 67 | } 68 | 69 | #pragma warning disable IDE1006 // Naming Styles 70 | private void btnBack_Click(object sender, EventArgs e) 71 | #pragma warning restore IDE1006 // Naming Styles 72 | { 73 | if (tiles.Count > 0) 74 | { 75 | if (i <= 0) 76 | { 77 | i = tiles.Count - 1; 78 | } 79 | else 80 | { 81 | i--; 82 | } 83 | 84 | lblInfo.Text = String.Format(Strings.NumOfNum, (i + 1), tiles.Count); 85 | 86 | mapPicture.BackgroundImage = tiles[i]; 87 | } 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /TricksterMap/TileViewForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TricksterMap/TricksterMap.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {71A3C82F-0E6F-415C-BD25-7A2B25A86B84} 8 | Exe 9 | TricksterMap 10 | TricksterMap 11 | v4.8 12 | 512 13 | true 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | ..\packages\Ionic.Zlib.1.9.1.5\lib\Ionic.Zlib.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | Form 58 | 59 | 60 | ConfigLayerCollisionForm.cs 61 | 62 | 63 | Form 64 | 65 | 66 | CreatePointObject.cs 67 | 68 | 69 | Form 70 | 71 | 72 | CreateRangeObject.cs 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | Component 86 | 87 | 88 | Form 89 | 90 | 91 | RangeObjectForm.cs 92 | 93 | 94 | True 95 | True 96 | Strings.zh.resx 97 | 98 | 99 | Form 100 | 101 | 102 | TileViewForm.cs 103 | 104 | 105 | Form 106 | 107 | 108 | MDIParent.cs 109 | 110 | 111 | Form 112 | 113 | 114 | PointObjectForm.cs 115 | 116 | 117 | 118 | 119 | True 120 | True 121 | Strings.resx 122 | 123 | 124 | 125 | ConfigLayerCollisionForm.cs 126 | 127 | 128 | CreatePointObject.cs 129 | 130 | 131 | CreateRangeObject.cs 132 | 133 | 134 | RangeObjectForm.cs 135 | 136 | 137 | TileViewForm.cs 138 | 139 | 140 | MDIParent.cs 141 | 142 | 143 | PointObjectForm.cs 144 | 145 | 146 | ResXFileCodeGenerator 147 | Resources.Designer.cs 148 | Designer 149 | 150 | 151 | True 152 | Resources.resx 153 | True 154 | 155 | 156 | ResXFileCodeGenerator 157 | Strings.Designer.cs 158 | 159 | 160 | ResXFileCodeGenerator 161 | Strings.zh.Designer.cs 162 | 163 | 164 | 165 | SettingsSingleFileGenerator 166 | Settings.Designer.cs 167 | 168 | 169 | True 170 | Settings.settings 171 | True 172 | 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /TricksterMap/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman --------------------------------------------------------------------------------