├── .gitignore ├── README.md ├── WWActorEdit.sln ├── WWActorEdit.suo └── WWActorEdit ├── Forms ├── EnvironmentLightingEditorForm.Designer.cs ├── EnvironmentLightingEditorForm.cs ├── EnvironmentLightingEditorForm.resx ├── ExceptionForm.cs ├── ExceptionForm.designer.cs ├── ExceptionForm.resx ├── ExceptionHandler.cs ├── ExitEditor.Designer.cs ├── ExitEditor.cs ├── ExitEditor.resx ├── FloatConverter.Designer.cs ├── FloatConverter.cs ├── FloatConverter.resx ├── InvalidRoomNumber.Designer.cs ├── InvalidRoomNumber.cs ├── InvalidRoomNumber.resx ├── SpawnpointEditor.Designer.cs ├── SpawnpointEditor.cs └── SpawnpointEditor.resx ├── Kazari ├── Common.cs ├── DZB │ └── DZB.cs ├── DZx │ ├── ACTR.cs │ ├── ACTRControl.Designer.cs │ ├── ACTRControl.cs │ ├── ACTRControl.resx │ ├── DZx.cs │ ├── Generic.cs │ ├── IDZRChunkElement.cs │ ├── LGTV.cs │ ├── MULT.cs │ ├── MULTControl.cs │ ├── MULTControl.designer.cs │ ├── MULTControl.resx │ ├── RPPN.cs │ ├── RPPNControl.Designer.cs │ ├── RPPNControl.cs │ ├── RPPNControl.resx │ ├── SHIP.cs │ ├── SHIPControl.Designer.cs │ ├── SHIPControl.cs │ ├── SHIPControl.resx │ ├── TGDR.cs │ ├── TGDRControl.Designer.cs │ ├── TGDRControl.cs │ ├── TGDRControl.resx │ ├── TRES.cs │ ├── TRESControl.cs │ ├── TRESControl.designer.cs │ └── TRESControl.resx ├── Helpers.cs ├── HexEditBox.cs ├── J3Dx │ └── J3Dx.cs ├── RARC.cs └── RARCPacker.cs ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── OpenTK.GLControl.dll ├── OpenTK.dll ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── Source ├── DZS │ └── FileFormat.cs ├── FSHelpers.cs └── StickyWindow.cs ├── WindViewer.csproj ├── ZeldaArc.cs └── windviewer.ico /.gitignore: -------------------------------------------------------------------------------- 1 | WWActorEdit.userprefs 2 | WWActorEdit/obj/ 3 | WWActorEdit/bin/ 4 | WWActorEdit/WWActorEdit.csproj.user -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #About 2 | 3 | Wind Viewer is a level viewer and editor for Zelda: Wind Waker and (to an extent) Twilight Princess. 4 | 5 | ![WindViewer](http://i.imgur.com/ajQe1Xt.jpg) 6 | 7 | Original author: [xDaniel](http://magicstone.de/dzd/) 8 | 9 | 10 | #Compiling the Project# 11 | WindViewer is written using Visual Studios 2012. This means the project solutions are **incompatible with previous versions**. To solve this issue, you can get the Virtual Studios 2012 Service Pack 1 to enable compatibility with Visual Studios 2010. Other versions will require modifying the Solution file to open. 12 | 13 | 14 | # Useful Threads: # 15 | 16 | * Original Thread: https://www.the-gcn.com/topic/721-wind-waker-hacking-thread/ 17 | 18 | * Recent activity thread: http://jul.rustedlogic.net/thread.php?id=13745 19 | 20 | # Documentation: # 21 | 22 | * Our Wiki: https://github.com/pho/WindViewer/wiki 23 | 24 | * http://wiki.spinout182.com/w/Zelda_GCN:_DZx_files 25 | 26 | * http://www.behance.net/gallery/dzb-File-Format-Reverse-Engineering/6493035 27 | 28 | * http://tcrf.net/The_Legend_of_Zelda:_The_Wind_Waker 29 | 30 | * http://tcrf.net/Talk:The_Legend_of_Zelda:_The_Wind_Waker 31 | 32 | * http://www.amnoid.de/gc/ ( RARC and Yaz0 specs) 33 | 34 | # Chat: # 35 | 36 | We've been checking out HipChat. You can join us here: https://www.hipchat.com/gbubSdvIA 37 | -------------------------------------------------------------------------------- /WWActorEdit.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindViewer", "WWActorEdit\WindViewer.csproj", "{0178193B-922C-4CAE-99B6-9979B77840DD}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3237B68E-DDAF-4EE3-99B8-8F4AC5314894}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {0178193B-922C-4CAE-99B6-9979B77840DD}.Debug|x86.ActiveCfg = Debug|x86 15 | {0178193B-922C-4CAE-99B6-9979B77840DD}.Debug|x86.Build.0 = Debug|x86 16 | {0178193B-922C-4CAE-99B6-9979B77840DD}.Release|x86.ActiveCfg = Release|x86 17 | {0178193B-922C-4CAE-99B6-9979B77840DD}.Release|x86.Build.0 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(MonoDevelopProperties) = preSolution 23 | StartupItem = WWActorEdit\WWActorEdit.csproj 24 | Policies = $0 25 | $0.TextStylePolicy = $1 26 | $1.FileWidth = 120 27 | $1.inheritsSet = VisualStudio 28 | $1.inheritsScope = text/plain 29 | $1.scope = text/x-csharp 30 | $0.CSharpFormattingPolicy = $2 31 | $2.IndentSwitchBody = True 32 | $2.BeforeMethodDeclarationParentheses = False 33 | $2.BeforeMethodCallParentheses = False 34 | $2.BeforeConstructorDeclarationParentheses = False 35 | $2.BeforeDelegateDeclarationParentheses = False 36 | $2.NewParentheses = False 37 | $2.SpacesBeforeBrackets = False 38 | $2.inheritsSet = Mono 39 | $2.inheritsScope = text/x-csharp 40 | $2.scope = text/x-csharp 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /WWActorEdit.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pho/WindViewer/badcc60891e893631652192252ea016e0de2e037/WWActorEdit.suo -------------------------------------------------------------------------------- /WWActorEdit/Forms/EnvironmentLightingEditorForm.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 | 164, 17 122 | 123 | 124 | 17, 17 125 | 126 | 127 | 164, 17 128 | 129 | 130 | 42 131 | 132 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/ExceptionForm.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.Windows.Forms; 9 | 10 | namespace WWActorEdit 11 | { 12 | public partial class ExceptionForm : Form 13 | { 14 | string ExceptionType = string.Empty; 15 | string ExceptionMessage = string.Empty; 16 | string ContinueExitMessage = string.Empty; 17 | string ApplicationStatus = string.Empty; 18 | string ExceptionStackTrace = string.Empty; 19 | 20 | public ExceptionForm(Exception Ex, bool Continue) 21 | { 22 | InitializeComponent(); 23 | 24 | ExceptionType += string.Format("{0} in an instance of {1}", Ex.GetType().FullName, Ex.TargetSite.DeclaringType.FullName); 25 | 26 | ExceptionMessage += string.Format("The application has raised {0}. ", PrefixString(ExceptionType)); 27 | if (Ex.Message != string.Empty) 28 | ExceptionMessage += string.Format("The exception message is as follows: {0}.", Ex.Message.TrimEnd('.', ',', '?', '!')); 29 | else 30 | ExceptionMessage += "The exception does not contain a message."; 31 | 32 | if (Ex.InnerException != null) 33 | { 34 | ExceptionMessage += string.Format("\n\nThe exception also contains an inner {0} ", Ex.InnerException.GetType().FullName); 35 | if (Ex.InnerException.Message != string.Empty) 36 | ExceptionMessage += string.Format("with the following message: {0}.", Ex.InnerException.Message.TrimEnd('.', ',', '?')); 37 | else 38 | ExceptionMessage += "without a message."; 39 | } 40 | 41 | if (Continue == true) 42 | ContinueExitMessage += "To resume the application execution, please press the 'Continue' button.\n"; 43 | ContinueExitMessage += "To exit the application, please press the 'Exit' button.\nClick the 'Details' button to see more information about this error."; 44 | 45 | ApplicationStatus = string.Format("{0} v{1}; assembly version {2}; raised on {3} UTC", Application.ProductName, Application.ProductVersion.ToString(), 46 | System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), 47 | DateTime.UtcNow.ToString(System.Globalization.DateTimeFormatInfo.InvariantInfo)); 48 | 49 | if (Ex.InnerException != null && Ex.InnerException.StackTrace != null) 50 | ExceptionStackTrace += string.Format("Inner Stack Trace:\r\n{0}\r\n", Ex.InnerException.StackTrace); 51 | ExceptionStackTrace += string.Format("Stack Trace:\r\n{0}", Ex.StackTrace); 52 | 53 | this.Text = string.Format("Exception - {0}", Ex.GetType().FullName); 54 | lblException.Text = string.Format("{0}\n\n{1}", ExceptionMessage, ContinueExitMessage); 55 | lblStatusInfo.Text = ApplicationStatus; 56 | txtDetails.Text = ExceptionStackTrace; 57 | 58 | btnContinue.Enabled = Continue; 59 | 60 | System.Media.SystemSounds.Exclamation.Play(); 61 | } 62 | 63 | private void btnDetails_Click(object sender, EventArgs e) 64 | { 65 | btnDetails.Enabled = false; 66 | txtDetails.Visible = true; 67 | 68 | this.Height += txtDetails.Height; 69 | } 70 | 71 | private void ExceptionForm_KeyDown(object sender, KeyEventArgs e) 72 | { 73 | if (e.Control && e.KeyCode == Keys.C) 74 | { 75 | string Spacer = Environment.NewLine + "----------------------------------------" + Environment.NewLine; 76 | Clipboard.SetText(string.Format("{0}{1}{2}{3}{4}{5}{6}{7}", ExceptionType, Spacer, lblStatusInfo.Text, Spacer, ExceptionMessage, Spacer, ExceptionStackTrace, Spacer)); 77 | } 78 | } 79 | 80 | public static string PrefixString(string Str) 81 | { 82 | return string.Format("a{0} {1}", (IsVowel(Str.ToLower()[0]) ? "n" : ""), Str); 83 | } 84 | 85 | public static bool IsVowel(char Letter) 86 | { 87 | return (Letter == 'e' || Letter == 'a' || Letter == 'o' || Letter == 'i' || Letter == 'u'); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/ExceptionForm.designer.cs: -------------------------------------------------------------------------------- 1 | namespace WWActorEdit 2 | { 3 | partial class ExceptionForm 4 | { 5 | /// 6 | /// Erforderliche Designervariable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Verwendete Ressourcen bereinigen. 12 | /// 13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls 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 Vom Windows Form-Designer generierter Code 24 | 25 | /// 26 | /// Erforderliche Methode für die Designerunterstützung. 27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.lblException = new System.Windows.Forms.Label(); 32 | this.btnDetails = new System.Windows.Forms.Button(); 33 | this.btnExit = new System.Windows.Forms.Button(); 34 | this.btnContinue = new System.Windows.Forms.Button(); 35 | this.lblStatusInfo = new System.Windows.Forms.Label(); 36 | this.txtDetails = new System.Windows.Forms.TextBox(); 37 | this.SuspendLayout(); 38 | // 39 | // lblException 40 | // 41 | this.lblException.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 42 | | System.Windows.Forms.AnchorStyles.Right))); 43 | this.lblException.Location = new System.Drawing.Point(12, 10); 44 | this.lblException.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); 45 | this.lblException.Name = "lblException"; 46 | this.lblException.Size = new System.Drawing.Size(570, 183); 47 | this.lblException.TabIndex = 0; 48 | this.lblException.Text = "Exception message"; 49 | // 50 | // btnDetails 51 | // 52 | this.btnDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 53 | this.btnDetails.Location = new System.Drawing.Point(507, 219); 54 | this.btnDetails.Name = "btnDetails"; 55 | this.btnDetails.Size = new System.Drawing.Size(75, 27); 56 | this.btnDetails.TabIndex = 3; 57 | this.btnDetails.Text = "&Details >>"; 58 | this.btnDetails.UseVisualStyleBackColor = true; 59 | this.btnDetails.Click += new System.EventHandler(this.btnDetails_Click); 60 | // 61 | // btnExit 62 | // 63 | this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 64 | this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel; 65 | this.btnExit.Location = new System.Drawing.Point(426, 219); 66 | this.btnExit.Name = "btnExit"; 67 | this.btnExit.Size = new System.Drawing.Size(75, 27); 68 | this.btnExit.TabIndex = 2; 69 | this.btnExit.Text = "E&xit"; 70 | this.btnExit.UseVisualStyleBackColor = true; 71 | // 72 | // btnContinue 73 | // 74 | this.btnContinue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 75 | this.btnContinue.DialogResult = System.Windows.Forms.DialogResult.OK; 76 | this.btnContinue.Location = new System.Drawing.Point(345, 219); 77 | this.btnContinue.Name = "btnContinue"; 78 | this.btnContinue.Size = new System.Drawing.Size(75, 27); 79 | this.btnContinue.TabIndex = 1; 80 | this.btnContinue.Text = "&Continue"; 81 | this.btnContinue.UseVisualStyleBackColor = true; 82 | // 83 | // lblStatusInfo 84 | // 85 | this.lblStatusInfo.AutoSize = true; 86 | this.lblStatusInfo.Location = new System.Drawing.Point(12, 197); 87 | this.lblStatusInfo.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); 88 | this.lblStatusInfo.Name = "lblStatusInfo"; 89 | this.lblStatusInfo.Size = new System.Drawing.Size(124, 15); 90 | this.lblStatusInfo.TabIndex = 4; 91 | this.lblStatusInfo.Text = "Application status info"; 92 | // 93 | // txtDetails 94 | // 95 | this.txtDetails.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 96 | | System.Windows.Forms.AnchorStyles.Right))); 97 | this.txtDetails.Location = new System.Drawing.Point(15, 253); 98 | this.txtDetails.Multiline = true; 99 | this.txtDetails.Name = "txtDetails"; 100 | this.txtDetails.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 101 | this.txtDetails.Size = new System.Drawing.Size(567, 252); 102 | this.txtDetails.TabIndex = 4; 103 | this.txtDetails.Visible = false; 104 | // 105 | // ExceptionForm 106 | // 107 | this.AcceptButton = this.btnContinue; 108 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; 109 | this.CancelButton = this.btnExit; 110 | this.ClientSize = new System.Drawing.Size(594, 260); 111 | this.ControlBox = false; 112 | this.Controls.Add(this.txtDetails); 113 | this.Controls.Add(this.lblStatusInfo); 114 | this.Controls.Add(this.btnContinue); 115 | this.Controls.Add(this.btnExit); 116 | this.Controls.Add(this.btnDetails); 117 | this.Controls.Add(this.lblException); 118 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 119 | this.KeyPreview = true; 120 | this.MaximizeBox = false; 121 | this.MinimizeBox = false; 122 | this.Name = "ExceptionForm"; 123 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 124 | this.Text = "Exception dialog"; 125 | this.TopMost = true; 126 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ExceptionForm_KeyDown); 127 | this.ResumeLayout(false); 128 | this.PerformLayout(); 129 | 130 | } 131 | 132 | #endregion 133 | 134 | private System.Windows.Forms.Label lblException; 135 | private System.Windows.Forms.Button btnDetails; 136 | private System.Windows.Forms.Button btnExit; 137 | private System.Windows.Forms.Button btnContinue; 138 | private System.Windows.Forms.Label lblStatusInfo; 139 | private System.Windows.Forms.TextBox txtDetails; 140 | } 141 | } -------------------------------------------------------------------------------- /WWActorEdit/Forms/ExceptionForm.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 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/ExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace WWActorEdit 8 | { 9 | class ExceptionHandler 10 | { 11 | public ExceptionHandler() 12 | { 13 | Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); 14 | Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic); 15 | AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 16 | } 17 | 18 | void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) 19 | { 20 | #if !DEBUG 21 | ProcessForm(e.Exception); 22 | #endif 23 | } 24 | 25 | void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 26 | { 27 | #if !DEBUG 28 | ProcessForm((Exception)e.ExceptionObject, false); 29 | #endif 30 | } 31 | 32 | void ProcessForm(Exception Ex, bool Continue = true) 33 | { 34 | ExceptionForm ExForm = new ExceptionForm(Ex, Continue); 35 | 36 | try 37 | { 38 | DialogResult Result = ExForm.ShowDialog(); 39 | 40 | switch (Result) 41 | { 42 | case DialogResult.OK: 43 | break; 44 | case DialogResult.Cancel: 45 | Environment.Exit(0); 46 | break; 47 | } 48 | } 49 | finally 50 | { 51 | ExForm.Dispose(); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/ExitEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Windows.Forms; 10 | using Blue.Windows; 11 | using WWActorEdit.Kazari.DZx; 12 | 13 | namespace WWActorEdit.Forms 14 | { 15 | public partial class ExitEditor : Form 16 | { 17 | private MainForm _mainForm; 18 | private DZSFormat _data; 19 | 20 | //Change this and then call UpdateSCLSControlsFromFile to update the UI. 21 | private SclsChunk _sclsChunk; 22 | 23 | //Used for "dockable" WinForms 24 | private StickyWindow _stickyWindow; 25 | 26 | public ExitEditor(MainForm mainForm) 27 | { 28 | InitializeComponent(); 29 | _mainForm = mainForm; 30 | _stickyWindow = new StickyWindow(this); 31 | } 32 | 33 | /// 34 | /// Call this when you want to read the current _sclsChunk and update 35 | /// the UI controls. 36 | /// 37 | private void UpdateSclsControlsFromFile() 38 | { 39 | sclsDestName.Text = _sclsChunk.DestinationName; 40 | sclsRoomIndex.Value = _sclsChunk.DestinationRoomNumber; 41 | sclsSpawnIndex.Value = _sclsChunk.SpawnNumber; 42 | sclsExitTypeIndex.Value = _sclsChunk.ExitType; 43 | 44 | //Probably padding but I'd rather remove it once implemented than implement later... 45 | sclsPaddingIndex.Value = _sclsChunk.UnknownPadding; 46 | } 47 | 48 | 49 | 50 | 51 | /// 52 | /// This is temporary until we replace out the main form's version of the DZS loading stuff. 53 | /// Sorry! 54 | /// 55 | /// 56 | private void LoadDZSForStage(ZeldaArc stage) 57 | { 58 | int srcOffset = 0; 59 | _data = new DZSFormat(stage.DZRs[0].FileEntry.GetFileData(), ref srcOffset); 60 | 61 | List sclsChunks = _data.GetChunksOfType(DZSChunkTypes.SCLS); 62 | if (sclsChunks == null) 63 | return; 64 | 65 | for (int i = 0; i < sclsChunks.Count; i++) 66 | { 67 | SclsChunk exitChunk = (SclsChunk) sclsChunks[i]; 68 | sclsDropdown.Items.Add("[" + i + "] - " + exitChunk.DestinationName); 69 | } 70 | 71 | sclsDropdown.SelectedIndex = 0; 72 | _sclsChunk = (SclsChunk) sclsChunks[sclsDropdown.SelectedIndex]; 73 | UpdateSclsControlsFromFile(); 74 | } 75 | 76 | private void RoomExitEditor_Load(object sender, EventArgs e) 77 | { 78 | ZeldaArc stage = _mainForm.Rooms[0]; 79 | if (stage == null) 80 | { 81 | Console.WriteLine("Load a Stage first!"); 82 | return; 83 | } 84 | 85 | LoadDZSForStage(stage); 86 | } 87 | 88 | /// 89 | /// Called when the user changes the scls Dropdown. 90 | /// 91 | /// 92 | /// 93 | private void sclsDropdown_SelectedIndexChanged(object sender, EventArgs e) 94 | { 95 | List sclsChunks = _data.GetChunksOfType(DZSChunkTypes.SCLS); 96 | _sclsChunk = (SclsChunk) sclsChunks[sclsDropdown.SelectedIndex]; 97 | UpdateSclsControlsFromFile(); 98 | } 99 | 100 | /// 101 | /// Called when any of the numeric input boxes change on the Exit Editor. 102 | /// 103 | private void sclsIndex_ValueChanged(object sender, EventArgs e) 104 | { 105 | if (sender == sclsRoomIndex) 106 | _sclsChunk.DestinationRoomNumber = (byte)sclsRoomIndex.Value; 107 | 108 | if (sender == sclsSpawnIndex) 109 | _sclsChunk.SpawnNumber = (byte) sclsSpawnIndex.Value; 110 | 111 | if (sender == sclsExitTypeIndex) 112 | _sclsChunk.ExitType = (byte) sclsExitTypeIndex.Value; 113 | 114 | if (sender == sclsPaddingIndex) 115 | _sclsChunk.UnknownPadding = (byte) sclsPaddingIndex.Value; 116 | } 117 | 118 | /// 119 | /// Called when the user changes the text of the destination name. 120 | /// 121 | private void sclsDestName_TextChanged(object sender, EventArgs e) 122 | { 123 | _sclsChunk.DestinationName = sclsDestName.Text; 124 | } 125 | 126 | private void saveButton_Click(object sender, EventArgs e) 127 | { 128 | //OH BOY D:< 129 | 130 | 131 | foreach (DZSChunkHeader chunk in _data.ChunkHeaders) 132 | { 133 | if (chunk.Tag == "SCLS") 134 | { 135 | //By creating the file this way we can still write to it while it's open in another program (ie: 136 | //a hex editor) and then the hex editor can notice the change and reload. 137 | FileStream fs = File.Open(chunk.Tag, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite); 138 | BinaryWriter bw = new BinaryWriter(fs); 139 | 140 | for (int i = 0; i < chunk.ElementCount; i++) 141 | { 142 | chunk.ChunkElements[i].WriteData(bw); 143 | } 144 | 145 | bw.Close(); 146 | fs.Close(); 147 | } 148 | } 149 | } 150 | 151 | /// 152 | /// Close the form when the user clicks Cancel. 153 | /// 154 | private void cancelButton_Click(object sender, EventArgs e) 155 | { 156 | Close(); 157 | } 158 | 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/ExitEditor.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 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/FloatConverter.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WWActorEdit.Forms 2 | { 3 | partial class FloatConverter 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.label1 = new System.Windows.Forms.Label(); 32 | this.floatValue = new System.Windows.Forms.TextBox(); 33 | this.label2 = new System.Windows.Forms.Label(); 34 | this.hexValue = new System.Windows.Forms.TextBox(); 35 | this.SuspendLayout(); 36 | // 37 | // label1 38 | // 39 | this.label1.AutoSize = true; 40 | this.label1.Location = new System.Drawing.Point(12, 15); 41 | this.label1.Name = "label1"; 42 | this.label1.Size = new System.Drawing.Size(74, 13); 43 | this.label1.TabIndex = 0; 44 | this.label1.Text = "Floating Point:"; 45 | // 46 | // floatValue 47 | // 48 | this.floatValue.Location = new System.Drawing.Point(219, 12); 49 | this.floatValue.Name = "floatValue"; 50 | this.floatValue.Size = new System.Drawing.Size(100, 20); 51 | this.floatValue.TabIndex = 1; 52 | this.floatValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 53 | this.floatValue.TextChanged += new System.EventHandler(this.floatValue_Changed); 54 | // 55 | // label2 56 | // 57 | this.label2.AutoSize = true; 58 | this.label2.Location = new System.Drawing.Point(12, 41); 59 | this.label2.Name = "label2"; 60 | this.label2.Size = new System.Drawing.Size(71, 13); 61 | this.label2.TabIndex = 2; 62 | this.label2.Text = "Hexadecimal:"; 63 | // 64 | // hexValue 65 | // 66 | this.hexValue.Location = new System.Drawing.Point(219, 38); 67 | this.hexValue.Name = "hexValue"; 68 | this.hexValue.Size = new System.Drawing.Size(100, 20); 69 | this.hexValue.TabIndex = 3; 70 | this.hexValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 71 | this.hexValue.TextChanged += new System.EventHandler(this.hexValue_Changed); 72 | // 73 | // FloatConverter 74 | // 75 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 76 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 77 | this.ClientSize = new System.Drawing.Size(331, 72); 78 | this.Controls.Add(this.hexValue); 79 | this.Controls.Add(this.label2); 80 | this.Controls.Add(this.floatValue); 81 | this.Controls.Add(this.label1); 82 | this.Name = "FloatConverter"; 83 | this.Text = "Float Converter"; 84 | this.ResumeLayout(false); 85 | this.PerformLayout(); 86 | 87 | } 88 | 89 | #endregion 90 | 91 | private System.Windows.Forms.Label label1; 92 | private System.Windows.Forms.TextBox floatValue; 93 | private System.Windows.Forms.Label label2; 94 | private System.Windows.Forms.TextBox hexValue; 95 | } 96 | } -------------------------------------------------------------------------------- /WWActorEdit/Forms/FloatConverter.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.Windows.Forms; 9 | 10 | namespace WWActorEdit.Forms 11 | { 12 | public partial class FloatConverter : Form 13 | { 14 | public FloatConverter() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private bool _supressEvents; 20 | 21 | private void floatValue_Changed(object sender, EventArgs e) 22 | { 23 | if(_supressEvents) 24 | return; 25 | 26 | float tryFloat; 27 | if (float.TryParse(floatValue.Text, out tryFloat)) 28 | { 29 | //Convert it to Hexadecimal and Byteswap it. 30 | byte[] floatBytes = BitConverter.GetBytes(tryFloat); 31 | Array.Reverse(floatBytes); 32 | 33 | //Build our Hex string 34 | string hexString = BitConverter.ToString(floatBytes).Replace("-", " "); 35 | 36 | //Now update the Hex output 37 | _supressEvents = true; 38 | hexValue.Text = hexString; 39 | _supressEvents = false; 40 | 41 | } 42 | else 43 | { 44 | _supressEvents = true; 45 | hexValue.Text = string.Empty; 46 | _supressEvents = false; 47 | } 48 | } 49 | 50 | private void hexValue_Changed(object sender, EventArgs e) 51 | { 52 | if (_supressEvents) 53 | return; 54 | 55 | //Figure out if it's a hex string without spaces 56 | if (hexValue.Text.Length == 8) 57 | { 58 | //See if it contains spaces, if so it's /NOT/ a whole hex string. 59 | int spaceIndex = hexValue.Text.IndexOf(' '); 60 | if (spaceIndex == -1) 61 | { 62 | //Hey they didn't have any spaces, guess it's a whole hex string (sans spaces) 63 | HexToFloat(hexValue.Text); 64 | } 65 | } 66 | else if (hexValue.Text.Length == 11) 67 | { 68 | //Ensure there's actually spaces in this one (otherwise 11 digits of 0 works...) 69 | int spaceIndex = hexValue.Text.IndexOf(' '); 70 | if (spaceIndex != -1) 71 | { 72 | string hexString = hexValue.Text.Replace(" ", ""); 73 | HexToFloat(hexString); 74 | } 75 | } 76 | else 77 | { 78 | _supressEvents = true; 79 | floatValue.Text = string.Empty; 80 | _supressEvents = false; 81 | } 82 | } 83 | 84 | /// 85 | /// Usage: Pass this a hex string without spaces (ie: "40000000") and it will 86 | /// update the float for you because it is nice. 87 | /// 88 | /// 89 | private void HexToFloat(string hexString) 90 | { 91 | byte[] bytes = StringToByteArray(hexString); 92 | 93 | //Reverse it into little-endian 94 | Array.Reverse(bytes); 95 | 96 | //Then try and convert it to floats. 97 | float value = BitConverter.ToSingle(bytes, 0); 98 | 99 | _supressEvents = true; 100 | floatValue.Text = value.ToString(); 101 | _supressEvents = false; 102 | } 103 | 104 | public static byte[] StringToByteArray(string hex) 105 | { 106 | return Enumerable.Range(0, hex.Length) 107 | .Where(x => x % 2 == 0) 108 | .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) 109 | .ToArray(); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/FloatConverter.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 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/InvalidRoomNumber.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WWActorEdit 2 | { 3 | partial class InvalidRoomNumber 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.DescriptionLabel = new System.Windows.Forms.Label(); 32 | this.numDesc = new System.Windows.Forms.Label(); 33 | this.roomNumberSelector = new System.Windows.Forms.NumericUpDown(); 34 | this.btnClose = new System.Windows.Forms.Button(); 35 | ((System.ComponentModel.ISupportInitialize)(this.roomNumberSelector)).BeginInit(); 36 | this.SuspendLayout(); 37 | // 38 | // DescriptionLabel 39 | // 40 | this.DescriptionLabel.Location = new System.Drawing.Point(12, 9); 41 | this.DescriptionLabel.Name = "DescriptionLabel"; 42 | this.DescriptionLabel.Size = new System.Drawing.Size(276, 41); 43 | this.DescriptionLabel.TabIndex = 0; 44 | this.DescriptionLabel.Text = "Failed to determine room number from file name. Expected: Room.arc or R_00" + 45 | ", got: blahblahbllah.arc\r\n"; 46 | this.DescriptionLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; 47 | // 48 | // numDesc 49 | // 50 | this.numDesc.AutoSize = true; 51 | this.numDesc.Location = new System.Drawing.Point(12, 55); 52 | this.numDesc.Name = "numDesc"; 53 | this.numDesc.Size = new System.Drawing.Size(144, 13); 54 | this.numDesc.TabIndex = 1; 55 | this.numDesc.Text = "Enter Manual Room Number:"; 56 | // 57 | // roomNumberSelector 58 | // 59 | this.roomNumberSelector.Location = new System.Drawing.Point(168, 53); 60 | this.roomNumberSelector.Name = "roomNumberSelector"; 61 | this.roomNumberSelector.Size = new System.Drawing.Size(120, 20); 62 | this.roomNumberSelector.TabIndex = 2; 63 | // 64 | // btnClose 65 | // 66 | this.btnClose.Location = new System.Drawing.Point(108, 86); 67 | this.btnClose.Name = "btnClose"; 68 | this.btnClose.Size = new System.Drawing.Size(75, 23); 69 | this.btnClose.TabIndex = 3; 70 | this.btnClose.Text = "Ok"; 71 | this.btnClose.UseVisualStyleBackColor = true; 72 | this.btnClose.Click += new System.EventHandler(this.btnClose_Click); 73 | // 74 | // InvalidRoomNumber 75 | // 76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 78 | this.ClientSize = new System.Drawing.Size(300, 121); 79 | this.Controls.Add(this.btnClose); 80 | this.Controls.Add(this.roomNumberSelector); 81 | this.Controls.Add(this.numDesc); 82 | this.Controls.Add(this.DescriptionLabel); 83 | this.Name = "InvalidRoomNumber"; 84 | this.Text = "Invalid Room Number"; 85 | ((System.ComponentModel.ISupportInitialize)(this.roomNumberSelector)).EndInit(); 86 | this.ResumeLayout(false); 87 | this.PerformLayout(); 88 | 89 | } 90 | 91 | #endregion 92 | 93 | public System.Windows.Forms.Label DescriptionLabel; 94 | private System.Windows.Forms.Label numDesc; 95 | private System.Windows.Forms.Button btnClose; 96 | public System.Windows.Forms.NumericUpDown roomNumberSelector; 97 | 98 | } 99 | } -------------------------------------------------------------------------------- /WWActorEdit/Forms/InvalidRoomNumber.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.Windows.Forms; 9 | 10 | namespace WWActorEdit 11 | { 12 | public partial class InvalidRoomNumber : Form 13 | { 14 | public InvalidRoomNumber() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void btnClose_Click(object sender, EventArgs e) 20 | { 21 | Close(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/InvalidRoomNumber.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 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/SpawnpointEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Runtime.Remoting.Channels; 9 | using System.Text; 10 | using System.Windows.Forms; 11 | using Blue.Windows; 12 | using OpenTK; 13 | 14 | namespace WWActorEdit.Forms 15 | { 16 | public partial class SpawnpointEditor : Form 17 | { 18 | private MainForm _mainForm; 19 | private DZSFormat _data; 20 | private PlyrChunk _plyrChunk; 21 | 22 | //Used for "dockable" WinForms 23 | private StickyWindow _stickyWindow; 24 | 25 | public SpawnpointEditor(MainForm parent) 26 | { 27 | InitializeComponent(); 28 | _mainForm = parent; 29 | _stickyWindow = new StickyWindow(this); 30 | } 31 | 32 | 33 | 34 | private void SpawnpointEditor_Load(object sender, EventArgs e) 35 | { 36 | ZeldaArc stage = _mainForm.Rooms[0]; 37 | if (stage == null) 38 | { 39 | Console.WriteLine("Load a Stage first!"); 40 | return; 41 | } 42 | 43 | LoadDZSForStage(stage); 44 | } 45 | 46 | private void LoadDZSForStage(ZeldaArc stage) 47 | { 48 | int srcOffset = 0; 49 | _data = new DZSFormat(stage.DZRs[0].FileEntry.GetFileData(), ref srcOffset); 50 | 51 | List plyrChunks = _data.GetChunksOfType(DZSChunkTypes.PLYR); 52 | if (plyrChunks == null) 53 | return; 54 | 55 | for (int i = 0; i < plyrChunks.Count; i++) 56 | { 57 | PlyrChunk plyrChunk = (PlyrChunk)plyrChunks[i]; 58 | spawnDropdown.Items.Add("[" + i + "] - " + plyrChunk.Name); 59 | } 60 | 61 | spawnDropdown.SelectedIndex = 0; 62 | _plyrChunk = (PlyrChunk)plyrChunks[spawnDropdown.SelectedIndex]; 63 | UpdateUIControlsFromFile(); 64 | } 65 | 66 | private void UpdateUIControlsFromFile() 67 | { 68 | spawnName.Text = _plyrChunk.Name; 69 | spawnEventIndex.Value = _plyrChunk.EventIndex; 70 | spawnUnknown1.Value = _plyrChunk.Unknown1; 71 | spawnType.Value = _plyrChunk.SpawnType; 72 | spawnRoomNum.Value = _plyrChunk.RoomNumber; 73 | spawnPosX.Value = (decimal)_plyrChunk.Position.X; 74 | spawnPosY.Value = (decimal) _plyrChunk.Position.Y; 75 | spawnPosZ.Value = (decimal) _plyrChunk.Position.Z; 76 | 77 | Vector3 rot = _plyrChunk.Rotation.ToDegrees(); 78 | spawnRotX.Value = (decimal) rot.X; 79 | spawnRotY.Value = (decimal) rot.Y; 80 | spawnRotZ.Value = (decimal) rot.Z; 81 | } 82 | 83 | private void spawnDropdown_SelectedIndexChanged(object sender, EventArgs e) 84 | { 85 | List plyrChunks = _data.GetChunksOfType(DZSChunkTypes.PLYR); 86 | _plyrChunk = (PlyrChunk)plyrChunks[spawnDropdown.SelectedIndex]; 87 | UpdateUIControlsFromFile(); 88 | } 89 | 90 | /// 91 | /// Called when any of the Numeric boxes change value. 92 | /// 93 | private void spawnIndex_ValueChanged(object sender, EventArgs e) 94 | { 95 | if (sender == spawnEventIndex) 96 | _plyrChunk.EventIndex = (byte) spawnEventIndex.Value; 97 | if (sender == spawnUnknown1) 98 | _plyrChunk.Unknown1 = (byte) spawnUnknown1.Value; 99 | if (sender == spawnType) 100 | _plyrChunk.SpawnType = (byte) spawnType.Value; 101 | if (sender == spawnRoomNum) 102 | _plyrChunk.RoomNumber = (byte) spawnRoomNum.Value; 103 | 104 | if (sender == spawnPosX) 105 | _plyrChunk.Position.X = (float) spawnPosX.Value; 106 | if (sender == spawnPosY) 107 | _plyrChunk.Position.Y = (float) spawnPosY.Value; 108 | if (sender == spawnPosZ) 109 | _plyrChunk.Position.Z = (float) spawnPosZ.Value; 110 | 111 | Vector3 curRot = _plyrChunk.Rotation.ToDegrees(); 112 | if (sender == spawnRotX) 113 | curRot.X = (float) spawnRotX.Value; 114 | if (sender == spawnRotY) 115 | curRot.Y = (float) spawnRotY.Value; 116 | if (sender == spawnRotZ) 117 | curRot.Z = (float) spawnRotZ.Value; 118 | 119 | _plyrChunk.Rotation.SetDegrees(curRot); 120 | } 121 | 122 | private void button4_Click(object sender, EventArgs e) 123 | { 124 | //OH BOY D:< 125 | 126 | 127 | foreach (DZSChunkHeader chunk in _data.ChunkHeaders) 128 | { 129 | if (chunk.Tag == "PLYR") 130 | { 131 | //By creating the file this way we can still write to it while it's open in another program (ie: 132 | //a hex editor) and then the hex editor can notice the change and reload. 133 | FileStream fs = File.Open(chunk.Tag, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite); 134 | BinaryWriter bw = new BinaryWriter(fs); 135 | 136 | for (int i = 0; i < chunk.ElementCount; i++) 137 | { 138 | chunk.ChunkElements[i].WriteData(bw); 139 | } 140 | 141 | bw.Close(); 142 | fs.Close(); 143 | } 144 | } 145 | } 146 | 147 | 148 | private void button3_Click(object sender, EventArgs e) 149 | { 150 | Close(); 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /WWActorEdit/Forms/SpawnpointEditor.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 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/Common.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace WWActorEdit.Kazari 7 | { 8 | public class Common 9 | { 10 | // 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/ACTR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using OpenTK; 8 | using OpenTK.Graphics; 9 | using OpenTK.Graphics.OpenGL; 10 | 11 | namespace WWActorEdit.Kazari.DZx 12 | { 13 | public class ACTR : IDZxChunkElement 14 | { 15 | string _Name; 16 | uint _Parameters; 17 | Vector3 _Position, _Rotation; 18 | ushort _Unknown; 19 | 20 | public string Name { get { return _Name; } set { _Name = value; HasChanged = true; } } 21 | public uint Parameters { get { return _Parameters; } set { _Parameters = value; HasChanged = true; } } 22 | public Vector3 Position { get { return _Position; } set { _Position = value; HasChanged = true; } } 23 | public Vector3 Rotation { get { return _Rotation; } set { _Rotation = value; HasChanged = true; } } 24 | public ushort Unknown { get { return _Unknown; } set { _Unknown = value; HasChanged = true; } } 25 | 26 | public RARC.FileEntry ParentFile { get; set; } 27 | public int Offset { get; set; } 28 | 29 | bool _HasChanged; 30 | public bool HasChanged { get { return _HasChanged; } set { _HasChanged = value; Node.ForeColor = (value == true ? System.Drawing.Color.Red : System.Drawing.SystemColors.WindowText); } } 31 | 32 | public bool Highlight { get; set; } 33 | public System.Drawing.Color RenderColor { get; set; } 34 | 35 | public TreeNode Node { get; set; } 36 | 37 | public int GLID { get; set; } 38 | 39 | public J3Dx.J3Dx MatchedModel { get; set; } 40 | public DZB.DZB MatchedCollision { get; set; } 41 | 42 | public ACTR(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color), ZeldaArc ParentZA = null) 43 | { 44 | ParentFile = FE; 45 | 46 | byte[] SrcData = ParentFile.GetFileData(); 47 | 48 | Offset = SrcOffset; 49 | 50 | _Name = Helpers.ReadString(SrcData, SrcOffset, 8); 51 | _Parameters = Helpers.Read32(SrcData, SrcOffset + 8); 52 | _Position = new Vector3( 53 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x0C)), 54 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x10)), 55 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x14))); 56 | _Rotation = new Vector3( 57 | ((short)Helpers.Read16(SrcData, SrcOffset + 0x18) / 182.04444444444444f).Clamp(-180, 179), 58 | ((short)Helpers.Read16(SrcData, SrcOffset + 0x1A) / 182.04444444444444f).Clamp(-180, 179), 59 | ((short)Helpers.Read16(SrcData, SrcOffset + 0x1C) / 182.04444444444444f).Clamp(-180, 179)); 60 | _Unknown = Helpers.Read16(SrcData, SrcOffset + 0x1E); 61 | 62 | SrcOffset += 0x20; 63 | 64 | RenderColor = Color; 65 | 66 | Node = Helpers.CreateTreeNode(string.Format("{0:X6}: {1}", Offset, _Name), this); 67 | ParentNode.BackColor = RenderColor; 68 | ParentNode.Nodes.Add(Node); 69 | 70 | GLID = GL.GenLists(1); 71 | GL.NewList(GLID, ListMode.Compile); 72 | 73 | if (ParentZA != null) 74 | { 75 | MatchedModel = ParentZA.J3Dxs.Find(x => x.FileEntry.FileName.StartsWith(_Name)); 76 | MatchedCollision = ParentZA.DZBs.Find(x => x.Name.StartsWith(_Name)); 77 | } 78 | 79 | Helpers.DrawFramedCube(new Vector3d(15, 15, 15)); 80 | GL.EndList(); 81 | } 82 | 83 | public void StoreChanges() 84 | { 85 | byte[] Data = ParentFile.GetFileData(); 86 | 87 | Helpers.WriteString(ref Data, Offset, _Name, 8); 88 | Helpers.Overwrite32(ref Data, Offset + 0x08, _Parameters); 89 | Helpers.Overwrite32(ref Data, Offset + 0x0C, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.X), 0)); 90 | Helpers.Overwrite32(ref Data, Offset + 0x10, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Y), 0)); 91 | Helpers.Overwrite32(ref Data, Offset + 0x14, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Z), 0)); 92 | Helpers.Overwrite16(ref Data, Offset + 0x18, (ushort)(_Rotation.X * 182.04444444444444f)); 93 | Helpers.Overwrite16(ref Data, Offset + 0x1A, (ushort)(_Rotation.Y * 182.04444444444444f)); 94 | Helpers.Overwrite16(ref Data, Offset + 0x1C, (ushort)(_Rotation.Z * 182.04444444444444f)); 95 | Helpers.Overwrite16(ref Data, Offset + 0x1E, _Unknown); 96 | 97 | ParentFile.SetFileData(Data); 98 | } 99 | 100 | public void Render() 101 | { 102 | GL.PushMatrix(); 103 | GL.Translate(_Position); 104 | GL.Rotate(_Rotation.Z, 0, 0, 1); 105 | GL.Rotate(_Rotation.Y, 0, 1, 0); 106 | GL.Rotate(_Rotation.X, 1, 0, 0); 107 | GL.Color4((Highlight ? System.Drawing.Color.Red : RenderColor)); 108 | if (MatchedModel != null) MatchedModel.Render(); 109 | if (MatchedCollision != null) MatchedCollision.Render(); 110 | if (GL.IsList(GLID) == true) GL.CallList(GLID); 111 | GL.PopMatrix(); 112 | } 113 | 114 | public Control EditControl { get; set; } 115 | 116 | public void ShowControl(Panel Parent) 117 | { 118 | Parent.FindForm().SuspendLayout(); 119 | 120 | EditControl = new ACTRControl(this); 121 | EditControl.Parent = Parent; 122 | 123 | Parent.ClientSize = EditControl.Size; 124 | EditControl.Dock = DockStyle.Fill; 125 | 126 | Parent.Visible = true; 127 | 128 | Parent.FindForm().ResumeLayout(); 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/ACTRControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace WWActorEdit.Kazari.DZx 11 | { 12 | public partial class ACTRControl : UserControl 13 | { 14 | ACTR Actor; 15 | 16 | public ACTRControl(ACTR ThisActor) 17 | { 18 | InitializeComponent(); 19 | 20 | Actor = ThisActor; 21 | 22 | this.SuspendLayout(); 23 | UpdateControl(); 24 | this.ResumeLayout(); 25 | } 26 | 27 | void UpdateControl() 28 | { 29 | AttachDetachEvents(false); 30 | 31 | textBox1.Text = Actor.Name; 32 | textBox2.Text = Actor.Parameters.ToString("X8"); 33 | numericUpDown1.Value = (decimal)Actor.Position.X; 34 | numericUpDown2.Value = (decimal)Actor.Position.Y; 35 | numericUpDown3.Value = (decimal)Actor.Position.Z; 36 | numericUpDown4.Value = (decimal)Actor.Rotation.X; 37 | numericUpDown5.Value = (decimal)Actor.Rotation.Y; 38 | numericUpDown6.Value = (decimal)Actor.Rotation.Z; 39 | textBox3.Text = Actor.Unknown.ToString("X4"); 40 | 41 | AttachDetachEvents(true); 42 | } 43 | 44 | void AttachDetachEvents(bool Attach) 45 | { 46 | if (Attach == true) 47 | { 48 | textBox1.TextChanged += new EventHandler(textBox1_TextChanged); 49 | textBox2.TextChanged += new EventHandler(textBox2_TextChanged); 50 | numericUpDown1.ValueChanged += new EventHandler(numericUpDown1_ValueChanged); 51 | numericUpDown2.ValueChanged += new EventHandler(numericUpDown2_ValueChanged); 52 | numericUpDown3.ValueChanged += new EventHandler(numericUpDown3_ValueChanged); 53 | numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged); 54 | numericUpDown5.ValueChanged += new EventHandler(numericUpDown5_ValueChanged); 55 | numericUpDown6.ValueChanged += new EventHandler(numericUpDown6_ValueChanged); 56 | textBox3.TextChanged += new EventHandler(textBox3_TextChanged); 57 | } 58 | else 59 | { 60 | textBox1.TextChanged -= new EventHandler(textBox1_TextChanged); 61 | textBox2.TextChanged -= new EventHandler(textBox2_TextChanged); 62 | numericUpDown1.ValueChanged -= new EventHandler(numericUpDown1_ValueChanged); 63 | numericUpDown2.ValueChanged -= new EventHandler(numericUpDown2_ValueChanged); 64 | numericUpDown3.ValueChanged -= new EventHandler(numericUpDown3_ValueChanged); 65 | numericUpDown4.ValueChanged -= new EventHandler(numericUpDown4_ValueChanged); 66 | numericUpDown5.ValueChanged -= new EventHandler(numericUpDown5_ValueChanged); 67 | numericUpDown6.ValueChanged -= new EventHandler(numericUpDown6_ValueChanged); 68 | textBox3.TextChanged -= new EventHandler(textBox3_TextChanged); 69 | } 70 | } 71 | 72 | private void textBox1_TextChanged(object sender, EventArgs e) 73 | { 74 | Actor.Name = textBox1.Text; 75 | } 76 | 77 | private void textBox2_TextChanged(object sender, EventArgs e) 78 | { 79 | if (textBox2.TextLength == textBox2.MaxLength) 80 | Actor.Parameters = uint.Parse(textBox2.Text, System.Globalization.NumberStyles.HexNumber); 81 | } 82 | 83 | private void numericUpDown1_ValueChanged(object sender, EventArgs e) 84 | { 85 | Actor.Position = new OpenTK.Vector3((float)numericUpDown1.Value, Actor.Position.Y, Actor.Position.Z); 86 | } 87 | 88 | private void numericUpDown2_ValueChanged(object sender, EventArgs e) 89 | { 90 | Actor.Position = new OpenTK.Vector3(Actor.Position.X, (float)numericUpDown2.Value, Actor.Position.Z); 91 | } 92 | 93 | private void numericUpDown3_ValueChanged(object sender, EventArgs e) 94 | { 95 | Actor.Position = new OpenTK.Vector3(Actor.Position.X, Actor.Position.Y, (float)numericUpDown3.Value); 96 | } 97 | 98 | private void numericUpDown4_ValueChanged(object sender, EventArgs e) 99 | { 100 | Actor.Rotation = new OpenTK.Vector3((float)numericUpDown4.Value, Actor.Rotation.Y, Actor.Rotation.Z); 101 | } 102 | 103 | private void numericUpDown5_ValueChanged(object sender, EventArgs e) 104 | { 105 | Actor.Rotation = new OpenTK.Vector3(Actor.Rotation.X, (float)numericUpDown5.Value, Actor.Rotation.Z); 106 | } 107 | 108 | private void numericUpDown6_ValueChanged(object sender, EventArgs e) 109 | { 110 | Actor.Rotation = new OpenTK.Vector3(Actor.Rotation.X, Actor.Rotation.Y, (float)numericUpDown6.Value); 111 | } 112 | 113 | private void textBox3_TextChanged(object sender, EventArgs e) 114 | { 115 | if (textBox3.TextLength == textBox3.MaxLength) 116 | Actor.Unknown = ushort.Parse(textBox3.Text, System.Globalization.NumberStyles.HexNumber); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/ACTRControl.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 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/DZx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using OpenTK; 8 | using OpenTK.Graphics; 9 | using OpenTK.Graphics.OpenGL; 10 | 11 | namespace WWActorEdit.Kazari.DZx 12 | { 13 | public class DZx 14 | { 15 | public List Chunks { get { return _Chunks; } } 16 | public RARC.FileEntry FileEntry { get; set; } 17 | TreeNode Root; 18 | 19 | List _Chunks; 20 | 21 | ZeldaArc ParentZA; 22 | 23 | public DZx(RARC.FileEntry FE, TreeNode TN, ZeldaArc PZA = null) 24 | { 25 | Root = TN; 26 | FileEntry = FE; 27 | ParentZA = PZA; 28 | Load(); 29 | } 30 | 31 | public void Load() 32 | { 33 | int Offset = 0; 34 | 35 | uint ChunkCount = Helpers.Read32(FileEntry.GetFileData(), Offset); 36 | if (ChunkCount == 0) return; 37 | 38 | TreeNode NewNode = Helpers.CreateTreeNode(FileEntry.FileName, null, string.Format("Size: {0:X6}\n{1} chunks", FileEntry.DataSize, ChunkCount)); 39 | 40 | _Chunks = new List(); 41 | 42 | Offset += 4; 43 | for (int i = 0; i < ChunkCount; i++) 44 | _Chunks.Add(new FileChunk(FileEntry, ref Offset, NewNode, ParentZA)); 45 | 46 | NewNode.Expand(); 47 | Root.Nodes.Add(NewNode); 48 | } 49 | 50 | public void Render() 51 | { 52 | foreach (object Obj in _Chunks) 53 | { 54 | ((FileChunk)Obj).Render(); 55 | } 56 | } 57 | 58 | public void Clear() 59 | { 60 | foreach (object Obj in _Chunks) 61 | { 62 | foreach (IDZxChunkElement C in ((FileChunk)Obj).Data) 63 | if (GL.IsList(C.GLID) == true) GL.DeleteLists(C.GLID, 1); 64 | } 65 | } 66 | 67 | public class FileChunk 68 | { 69 | public string Tag; 70 | public uint Elements, Offset; 71 | public object[] Data; 72 | 73 | public FileChunk(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, ZeldaArc ParentZA = null) 74 | { 75 | byte[] SrcData = FE.GetFileData(); 76 | 77 | Tag = Helpers.ReadString(SrcData, SrcOffset, 4); 78 | Elements = Helpers.Read32(SrcData, SrcOffset + 4); 79 | Offset = Helpers.Read32(SrcData, SrcOffset + 8); 80 | 81 | Data = new object[Elements]; 82 | 83 | TreeNode NewNode = Helpers.CreateTreeNode(Tag, this, string.Format("Offset: {0:X6}\n{1} elements", Offset, Elements)); 84 | 85 | int ReadOffset = (int)Offset; 86 | for (int i = 0; i < Elements; i++) 87 | { 88 | switch (Tag) 89 | { 90 | /* Typically in DZR */ 91 | case "ACTR": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); continue; 92 | case "TGOB": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); continue; 93 | case "PLYR": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Orange); continue; 94 | case "PPNT": /* Found in DmSpot0's Stage DZS for some reason... */ 95 | case "RPPN": Data[i] = new RPPN(FE, ref ReadOffset, NewNode, System.Drawing.Color.LightSkyBlue); continue; 96 | case "SHIP": Data[i] = new SHIP(FE, ref ReadOffset, NewNode, System.Drawing.Color.BlueViolet); continue; 97 | case "TGDR": 98 | case "DOOR": 99 | case "Door": Data[i] = new TGDR(FE, ref ReadOffset, NewNode, System.Drawing.Color.HotPink, ParentZA); continue; 100 | case "LGTV": Data[i] = new LGTV(FE, ref ReadOffset, NewNode, System.Drawing.Color.DarkGray); continue; /* ????? */ 101 | 102 | /* Typically in DZS */ 103 | case "MULT": Data[i] = new MULT(FE, ref ReadOffset, NewNode, System.Drawing.Color.LightGray); continue; 104 | case "TRES": Data[i] = new TRES(FE, ref ReadOffset, NewNode, System.Drawing.Color.SaddleBrown); continue; 105 | //case "EnvR": Data[i] = new EnvRChunk(FE, ref ReadOffset, NewNode, System.Drawing.Color.DarkSlateGray); continue; 106 | } 107 | 108 | switch (Tag.Substring(0, 3)) 109 | { 110 | case "ACT": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); break; 111 | case "PLY": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Orange); break; 112 | case "SCO": Data[i] = new TGDR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Yellow, ParentZA); break; 113 | case "TRE": Data[i] = new TRES(FE, ref ReadOffset, NewNode, System.Drawing.Color.SaddleBrown); break; 114 | default: Data[i] = new Generic(FE, ref ReadOffset, NewNode); NewNode.Tag = Data[i]; break; 115 | } 116 | } 117 | 118 | ParentNode.Nodes.Add(NewNode); 119 | 120 | SrcOffset += 12; 121 | } 122 | 123 | public void Render() 124 | { 125 | GL.PushAttrib(AttribMask.AllAttribBits); 126 | GL.Disable(EnableCap.Texture2D); 127 | foreach (IDZxChunkElement Chunk in Data.Where(C => C != null)) 128 | Chunk.Render(); 129 | GL.PopAttrib(); 130 | } 131 | 132 | public override string ToString() 133 | { 134 | return string.Format("Tag: {0}, Elements: {1:X8}, Offset: {2:X8}", Tag, Elements, Offset); 135 | } 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/Generic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace WWActorEdit.Kazari.DZx 8 | { 9 | public class Generic : IDZxChunkElement 10 | { 11 | public RARC.FileEntry ParentFile { get; set; } 12 | public int Offset { get; set; } 13 | 14 | bool _HasChanged; 15 | public bool HasChanged { get { return _HasChanged; } set { _HasChanged = value; Node.ForeColor = (value == true ? System.Drawing.Color.Red : System.Drawing.SystemColors.WindowText); } } 16 | 17 | public bool Highlight { get; set; } 18 | 19 | public TreeNode Node { get; set; } 20 | 21 | public int GLID { get; set; } 22 | 23 | public Generic(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode) 24 | { 25 | ParentFile = FE; 26 | Node = ParentNode; 27 | 28 | Offset = SrcOffset; 29 | } 30 | 31 | public void StoreChanges() 32 | { 33 | byte[] Data = ParentFile.GetFileData(); 34 | 35 | // 36 | 37 | ParentFile.SetFileData(Data); 38 | } 39 | 40 | public void Render() 41 | { 42 | // 43 | } 44 | 45 | public Control EditControl { get; set; } 46 | 47 | public void ShowControl(Panel Parent) 48 | { 49 | Parent.FindForm().SuspendLayout(); 50 | 51 | EditControl = new HexEditBox(); 52 | SetupHexBox((HexEditBox)EditControl); 53 | 54 | EditControl.Parent = Parent; 55 | 56 | Parent.ClientSize = EditControl.Size; 57 | EditControl.Dock = DockStyle.Fill; 58 | 59 | Parent.Visible = true; 60 | 61 | Parent.FindForm().ResumeLayout(); 62 | } 63 | 64 | private void SetupHexBox(HexEditBox hexEditBox1) 65 | { 66 | hexEditBox1.BackColor = System.Drawing.SystemColors.Window; 67 | hexEditBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; 68 | hexEditBox1.BytesPerLine = 16; 69 | hexEditBox1.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 70 | 71 | hexEditBox1.SetData(ParentFile.GetFileData()); 72 | hexEditBox1.AllowEdit = false; 73 | hexEditBox1.OffsetBytes = 4; 74 | hexEditBox1.ShowOffsetPrefix = true; 75 | hexEditBox1.BaseOffset = Offset; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/IDZRChunkElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace WWActorEdit.Kazari.DZx 8 | { 9 | public interface IDZxChunkElement 10 | { 11 | RARC.FileEntry ParentFile { get; set; } 12 | bool Highlight { get; set; } 13 | int Offset { get; set; } 14 | bool HasChanged { get; set; } 15 | int GLID { get; set; } 16 | Control EditControl { get; set; } 17 | void ShowControl(Panel Parent); 18 | void Render(); 19 | void StoreChanges(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/LGTV.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using OpenTK; 8 | using OpenTK.Graphics; 9 | using OpenTK.Graphics.OpenGL; 10 | 11 | namespace WWActorEdit.Kazari.DZx 12 | { 13 | public class LGTV : IDZxChunkElement 14 | { 15 | Vector3 _Unknown1, _Unknown2; 16 | uint _Unknown3; 17 | 18 | public Vector3 Unknown1 { get { return _Unknown1; } set { _Unknown1 = value; HasChanged = true; } } 19 | public Vector3 Unknown2 { get { return _Unknown2; } set { _Unknown2 = value; HasChanged = true; } } 20 | public uint Unknown3 { get { return _Unknown3; } set { _Unknown3 = value; HasChanged = true; } } 21 | 22 | public RARC.FileEntry ParentFile { get; set; } 23 | public int Offset { get; set; } 24 | 25 | bool _HasChanged; 26 | public bool HasChanged { get { return _HasChanged; } set { _HasChanged = value; } } 27 | 28 | public bool Highlight { get; set; } 29 | public System.Drawing.Color RenderColor { get; set; } 30 | 31 | public TreeNode Node { get; set; } 32 | 33 | public int GLID { get; set; } 34 | 35 | public LGTV(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color)) 36 | { 37 | ParentFile = FE; 38 | 39 | byte[] SrcData = ParentFile.GetFileData(); 40 | 41 | Offset = SrcOffset; 42 | 43 | _Unknown1 = new Vector3( 44 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset)), 45 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04)), 46 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x08))); 47 | _Unknown2 = new Vector3( 48 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x0C)), 49 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x10)), 50 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x14))); 51 | _Unknown3 = Helpers.Read32(SrcData, SrcOffset + 0x18); 52 | 53 | SrcOffset += 0x1C; 54 | 55 | RenderColor = Color; 56 | 57 | Node = Helpers.CreateTreeNode(string.Format("{0:X6}", Offset), this, string.Format("{0}\n{1}\n0x{2:X8}", _Unknown1, _Unknown2, _Unknown3)); 58 | ParentNode.BackColor = RenderColor; 59 | ParentNode.Nodes.Add(Node); 60 | } 61 | 62 | public void StoreChanges() 63 | { 64 | // 65 | } 66 | 67 | public void Render() 68 | { 69 | // 70 | } 71 | 72 | public Control EditControl { get; set; } 73 | 74 | public void ShowControl(Panel Parent) 75 | { 76 | // 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/MULT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using OpenTK; 8 | using OpenTK.Graphics; 9 | using OpenTK.Graphics.OpenGL; 10 | 11 | namespace WWActorEdit.Kazari.DZx 12 | { 13 | public class MULT : IDZxChunkElement 14 | { 15 | Vector2 _Translation; 16 | float _Rotation; 17 | byte _RoomNumber; 18 | byte _Unknown2; 19 | 20 | public Vector2 Translation { get { return _Translation; } set { _Translation = value; HasChanged = true; } } 21 | public float Rotation { get { return _Rotation; } set { _Rotation = value; HasChanged = true; } } 22 | public byte RoomNumber { get { return _RoomNumber; } set { _RoomNumber = value; HasChanged = true; } } 23 | public byte Unknown2 { get { return _Unknown2; } set { _Unknown2 = value; HasChanged = true; } } 24 | 25 | public RARC.FileEntry ParentFile { get; set; } 26 | public int Offset { get; set; } 27 | 28 | bool _HasChanged; 29 | public bool HasChanged { get { return _HasChanged; } set { _HasChanged = value; Node.ForeColor = (value == true ? System.Drawing.Color.Red : System.Drawing.SystemColors.WindowText); } } 30 | 31 | public bool Highlight { get; set; } 32 | public System.Drawing.Color RenderColor { get; set; } 33 | 34 | public TreeNode Node { get; set; } 35 | 36 | public int GLID { get; set; } 37 | 38 | public MULT(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color)) 39 | { 40 | ParentFile = FE; 41 | 42 | byte[] SrcData = ParentFile.GetFileData(); 43 | 44 | Offset = SrcOffset; 45 | 46 | _Translation = new Vector2( 47 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset)), 48 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04))); 49 | _Rotation = ((short)(Helpers.Read16(SrcData, SrcOffset + 0x08)) / 182.04444444444444f).Clamp(-180, 179); 50 | _RoomNumber = SrcData[SrcOffset + 0x0A]; 51 | _Unknown2 = SrcData[SrcOffset + 0x0B]; 52 | 53 | SrcOffset += 0x0C; 54 | 55 | RenderColor = Color; 56 | 57 | Node = Helpers.CreateTreeNode(string.Format("{0:X6}: {1}", Offset, new Vector2(_Translation.X / 100000, _Translation.Y / 100000)), this, string.Format("{0}", _Translation)); 58 | ParentNode.BackColor = RenderColor; 59 | ParentNode.Nodes.Add(Node); 60 | 61 | GLID = GL.GenLists(1); 62 | GL.NewList(GLID, ListMode.Compile); 63 | Helpers.DrawFramedCube(new Vector3d(15, 15, 15)); 64 | GL.EndList(); 65 | } 66 | 67 | public void StoreChanges() 68 | { 69 | byte[] Data = ParentFile.GetFileData(); 70 | 71 | Helpers.Overwrite32(ref Data, Offset, BitConverter.ToUInt32(BitConverter.GetBytes(_Translation.X), 0)); 72 | Helpers.Overwrite32(ref Data, Offset + 0x04, BitConverter.ToUInt32(BitConverter.GetBytes(_Translation.Y), 0)); 73 | Helpers.Overwrite16(ref Data, Offset + 0x08, (ushort)(_Rotation * 182.04444444444444f)); 74 | Helpers.Overwrite8(ref Data, Offset + 0x0A, _RoomNumber); 75 | Helpers.Overwrite8(ref Data, Offset + 0x0B, _Unknown2); 76 | 77 | ParentFile.SetFileData(Data); 78 | } 79 | 80 | public void Render() 81 | { 82 | GL.PushMatrix(); 83 | GL.Translate(new OpenTK.Vector3(_Translation.X, 0, _Translation.Y)); 84 | GL.Rotate(_Rotation, 0, 1, 0); 85 | GL.Color4((Highlight ? System.Drawing.Color.Red : RenderColor)); 86 | if (GL.IsList(GLID) == true) GL.CallList(GLID); 87 | GL.PopMatrix(); 88 | } 89 | 90 | public Control EditControl { get; set; } 91 | 92 | public void ShowControl(Panel Parent) 93 | { 94 | Parent.FindForm().SuspendLayout(); 95 | 96 | EditControl = new MULTControl(this); 97 | EditControl.Parent = Parent; 98 | 99 | Parent.ClientSize = EditControl.Size; 100 | EditControl.Dock = DockStyle.Fill; 101 | 102 | Parent.Visible = true; 103 | 104 | Parent.FindForm().ResumeLayout(); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/MULTControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | using OpenTK; 11 | using OpenTK.Graphics; 12 | using OpenTK.Graphics.OpenGL; 13 | 14 | namespace WWActorEdit.Kazari.DZx 15 | { 16 | public partial class MULTControl : UserControl 17 | { 18 | MULT Actor; 19 | 20 | public MULTControl(MULT ThisActor) 21 | { 22 | InitializeComponent(); 23 | 24 | Actor = ThisActor; 25 | 26 | this.SuspendLayout(); 27 | UpdateControl(); 28 | this.ResumeLayout(); 29 | } 30 | 31 | void UpdateControl() 32 | { 33 | AttachDetachEvents(false); 34 | 35 | numericUpDown1.Value = (decimal)Actor.Translation.X; 36 | numericUpDown2.Value = (decimal)Actor.Translation.Y; 37 | numericUpDown3.Value = (decimal)Actor.Rotation; 38 | numericUpDown4.Value = (decimal)Actor.RoomNumber; 39 | numericUpDown5.Value = (decimal)Actor.Unknown2; 40 | 41 | AttachDetachEvents(true); 42 | } 43 | 44 | void AttachDetachEvents(bool Attach) 45 | { 46 | if (Attach == true) 47 | { 48 | numericUpDown1.ValueChanged += new EventHandler(numericUpDown1_ValueChanged); 49 | numericUpDown2.ValueChanged += new EventHandler(numericUpDown2_ValueChanged); 50 | numericUpDown3.ValueChanged += new EventHandler(numericUpDown3_ValueChanged); 51 | numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged); 52 | numericUpDown5.ValueChanged += new EventHandler(numericUpDown5_ValueChanged); 53 | 54 | } 55 | else 56 | { 57 | numericUpDown1.ValueChanged -= new EventHandler(numericUpDown1_ValueChanged); 58 | numericUpDown2.ValueChanged -= new EventHandler(numericUpDown2_ValueChanged); 59 | numericUpDown3.ValueChanged -= new EventHandler(numericUpDown3_ValueChanged); 60 | numericUpDown4.ValueChanged -= new EventHandler(numericUpDown4_ValueChanged); 61 | numericUpDown5.ValueChanged -= new EventHandler(numericUpDown5_ValueChanged); 62 | } 63 | } 64 | 65 | private void numericUpDown1_ValueChanged(object sender, EventArgs e) 66 | { 67 | Actor.Translation = new Vector2((float)numericUpDown1.Value, Actor.Translation.Y); 68 | } 69 | 70 | private void numericUpDown2_ValueChanged(object sender, EventArgs e) 71 | { 72 | Actor.Translation = new Vector2(Actor.Translation.X, (float)numericUpDown2.Value); 73 | } 74 | 75 | private void numericUpDown3_ValueChanged(object sender, EventArgs e) 76 | { 77 | Actor.Rotation = (float)numericUpDown3.Value; 78 | } 79 | 80 | private void numericUpDown4_ValueChanged(object sender, EventArgs e) 81 | { 82 | Actor.RoomNumber = (byte)numericUpDown4.Value; 83 | } 84 | 85 | private void numericUpDown5_ValueChanged(object sender, EventArgs e) 86 | { 87 | Actor.Unknown2 = (byte)numericUpDown5.Value; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/MULTControl.designer.cs: -------------------------------------------------------------------------------- 1 | namespace WWActorEdit.Kazari.DZx 2 | { 3 | partial class MULTControl 4 | { 5 | /// 6 | /// Erforderliche Designervariable. bleh 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Verwendete Ressourcen bereinigen. 12 | /// 13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls 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 Vom Komponenten-Designer generierter Code 24 | 25 | /// 26 | /// Erforderliche Methode für die Designerunterstützung. 27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.label2 = new System.Windows.Forms.Label(); 32 | this.label3 = new System.Windows.Forms.Label(); 33 | this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); 34 | this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); 35 | this.label4 = new System.Windows.Forms.Label(); 36 | this.label5 = new System.Windows.Forms.Label(); 37 | this.numericUpDown5 = new System.Windows.Forms.NumericUpDown(); 38 | this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); 39 | this.numericUpDown4 = new System.Windows.Forms.NumericUpDown(); 40 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); 41 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); 42 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit(); 43 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit(); 44 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit(); 45 | this.SuspendLayout(); 46 | // 47 | // label2 48 | // 49 | this.label2.AutoSize = true; 50 | this.label2.Location = new System.Drawing.Point(3, 114); 51 | this.label2.Name = "label2"; 52 | this.label2.Size = new System.Drawing.Size(56, 13); 53 | this.label2.TabIndex = 1; 54 | this.label2.Text = "Unknown:"; 55 | // 56 | // label3 57 | // 58 | this.label3.AutoSize = true; 59 | this.label3.Location = new System.Drawing.Point(3, 5); 60 | this.label3.Name = "label3"; 61 | this.label3.Size = new System.Drawing.Size(47, 13); 62 | this.label3.TabIndex = 4; 63 | this.label3.Text = "Position:"; 64 | // 65 | // numericUpDown1 66 | // 67 | this.numericUpDown1.DecimalPlaces = 6; 68 | this.numericUpDown1.Location = new System.Drawing.Point(72, 3); 69 | this.numericUpDown1.Maximum = new decimal(new int[] { 70 | 999999, 71 | 0, 72 | 0, 73 | 0}); 74 | this.numericUpDown1.Minimum = new decimal(new int[] { 75 | 1000000, 76 | 0, 77 | 0, 78 | -2147483648}); 79 | this.numericUpDown1.Name = "numericUpDown1"; 80 | this.numericUpDown1.Size = new System.Drawing.Size(105, 20); 81 | this.numericUpDown1.TabIndex = 5; 82 | this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); 83 | // 84 | // numericUpDown2 85 | // 86 | this.numericUpDown2.DecimalPlaces = 6; 87 | this.numericUpDown2.Location = new System.Drawing.Point(72, 29); 88 | this.numericUpDown2.Maximum = new decimal(new int[] { 89 | 999999, 90 | 0, 91 | 0, 92 | 0}); 93 | this.numericUpDown2.Minimum = new decimal(new int[] { 94 | 1000000, 95 | 0, 96 | 0, 97 | -2147483648}); 98 | this.numericUpDown2.Name = "numericUpDown2"; 99 | this.numericUpDown2.Size = new System.Drawing.Size(105, 20); 100 | this.numericUpDown2.TabIndex = 6; 101 | this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged); 102 | // 103 | // label4 104 | // 105 | this.label4.AutoSize = true; 106 | this.label4.Location = new System.Drawing.Point(5, 61); 107 | this.label4.Name = "label4"; 108 | this.label4.Size = new System.Drawing.Size(50, 13); 109 | this.label4.TabIndex = 8; 110 | this.label4.Text = "Rotation:"; 111 | // 112 | // label5 113 | // 114 | this.label5.AutoSize = true; 115 | this.label5.Location = new System.Drawing.Point(5, 87); 116 | this.label5.Name = "label5"; 117 | this.label5.Size = new System.Drawing.Size(38, 13); 118 | this.label5.TabIndex = 13; 119 | this.label5.Text = "Room:"; 120 | // 121 | // numericUpDown5 122 | // 123 | this.numericUpDown5.Hexadecimal = true; 124 | this.numericUpDown5.Location = new System.Drawing.Point(72, 112); 125 | this.numericUpDown5.Maximum = new decimal(new int[] { 126 | 255, 127 | 0, 128 | 0, 129 | 0}); 130 | this.numericUpDown5.Name = "numericUpDown5"; 131 | this.numericUpDown5.Size = new System.Drawing.Size(105, 20); 132 | this.numericUpDown5.TabIndex = 15; 133 | // 134 | // numericUpDown3 135 | // 136 | this.numericUpDown3.DecimalPlaces = 2; 137 | this.numericUpDown3.Location = new System.Drawing.Point(72, 61); 138 | this.numericUpDown3.Maximum = new decimal(new int[] { 139 | 17999, 140 | 0, 141 | 0, 142 | 131072}); 143 | this.numericUpDown3.Minimum = new decimal(new int[] { 144 | 180, 145 | 0, 146 | 0, 147 | -2147483648}); 148 | this.numericUpDown3.Name = "numericUpDown3"; 149 | this.numericUpDown3.Size = new System.Drawing.Size(105, 20); 150 | this.numericUpDown3.TabIndex = 17; 151 | // 152 | // numericUpDown4 153 | // 154 | this.numericUpDown4.Hexadecimal = true; 155 | this.numericUpDown4.Location = new System.Drawing.Point(72, 87); 156 | this.numericUpDown4.Maximum = new decimal(new int[] { 157 | 255, 158 | 0, 159 | 0, 160 | 0}); 161 | this.numericUpDown4.Name = "numericUpDown4"; 162 | this.numericUpDown4.Size = new System.Drawing.Size(105, 20); 163 | this.numericUpDown4.TabIndex = 16; 164 | // 165 | // MULTControl 166 | // 167 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 168 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 169 | this.Controls.Add(this.numericUpDown3); 170 | this.Controls.Add(this.numericUpDown4); 171 | this.Controls.Add(this.numericUpDown5); 172 | this.Controls.Add(this.label5); 173 | this.Controls.Add(this.label4); 174 | this.Controls.Add(this.numericUpDown2); 175 | this.Controls.Add(this.numericUpDown1); 176 | this.Controls.Add(this.label3); 177 | this.Controls.Add(this.label2); 178 | this.DoubleBuffered = true; 179 | this.Name = "MULTControl"; 180 | this.Size = new System.Drawing.Size(180, 234); 181 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); 182 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); 183 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit(); 184 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); 185 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit(); 186 | this.ResumeLayout(false); 187 | this.PerformLayout(); 188 | 189 | } 190 | 191 | #endregion 192 | 193 | private System.Windows.Forms.Label label2; 194 | private System.Windows.Forms.Label label3; 195 | private System.Windows.Forms.NumericUpDown numericUpDown1; 196 | private System.Windows.Forms.NumericUpDown numericUpDown2; 197 | private System.Windows.Forms.Label label4; 198 | private System.Windows.Forms.Label label5; 199 | private System.Windows.Forms.NumericUpDown numericUpDown5; 200 | private System.Windows.Forms.NumericUpDown numericUpDown3; 201 | private System.Windows.Forms.NumericUpDown numericUpDown4; 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/MULTControl.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 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/RPPN.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using OpenTK; 8 | using OpenTK.Graphics; 9 | using OpenTK.Graphics.OpenGL; 10 | 11 | namespace WWActorEdit.Kazari.DZx 12 | { 13 | public class RPPN : IDZxChunkElement 14 | { 15 | uint _Unknown; 16 | Vector3 _Position; 17 | 18 | public uint Unknown { get { return _Unknown; } set { _Unknown = value; HasChanged = true; } } 19 | public Vector3 Position { get { return _Position; } set { _Position = value; HasChanged = true; } } 20 | 21 | public RARC.FileEntry ParentFile { get; set; } 22 | public int Offset { get; set; } 23 | 24 | bool _HasChanged; 25 | public bool HasChanged { get { return _HasChanged; } set { _HasChanged = value; Node.ForeColor = (value == true ? System.Drawing.Color.Red : System.Drawing.SystemColors.WindowText); } } 26 | 27 | public bool Highlight { get; set; } 28 | public System.Drawing.Color RenderColor { get; set; } 29 | 30 | public TreeNode Node { get; set; } 31 | 32 | public int GLID { get; set; } 33 | 34 | public RPPN(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color)) 35 | { 36 | ParentFile = FE; 37 | 38 | byte[] SrcData = ParentFile.GetFileData(); 39 | 40 | Offset = SrcOffset; 41 | 42 | _Unknown = Helpers.Read32(SrcData, SrcOffset); 43 | _Position = new Vector3( 44 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04)), 45 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x08)), 46 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x0C))); 47 | 48 | SrcOffset += 0x10; 49 | 50 | RenderColor = Color; 51 | 52 | Node = Helpers.CreateTreeNode(string.Format("{0}", _Position), this); 53 | ParentNode.BackColor = RenderColor; 54 | ParentNode.Nodes.Add(Node); 55 | 56 | GLID = GL.GenLists(1); 57 | GL.NewList(GLID, ListMode.Compile); 58 | Helpers.DrawFramedSphere(new Vector3d(0, 0, 0), 25.0f, 10); 59 | GL.EndList(); 60 | } 61 | 62 | public void StoreChanges() 63 | { 64 | byte[] Data = ParentFile.GetFileData(); 65 | 66 | Helpers.Overwrite32(ref Data, Offset, _Unknown); 67 | Helpers.Overwrite32(ref Data, Offset + 0x04, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.X), 0)); 68 | Helpers.Overwrite32(ref Data, Offset + 0x08, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Y), 0)); 69 | Helpers.Overwrite32(ref Data, Offset + 0x0C, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Z), 0)); 70 | 71 | ParentFile.SetFileData(Data); 72 | } 73 | 74 | public void Render() 75 | { 76 | GL.PushMatrix(); 77 | GL.Translate(_Position); 78 | GL.Color4((Highlight ? System.Drawing.Color.Red : RenderColor)); 79 | if (GL.IsList(GLID) == true) GL.CallList(GLID); 80 | GL.PopMatrix(); 81 | } 82 | 83 | public Control EditControl { get; set; } 84 | 85 | public void ShowControl(Panel Parent) 86 | { 87 | Parent.FindForm().SuspendLayout(); 88 | 89 | EditControl = new RPPNControl(this); 90 | EditControl.Parent = Parent; 91 | 92 | Parent.ClientSize = EditControl.Size; 93 | EditControl.Dock = DockStyle.Fill; 94 | 95 | Parent.Visible = true; 96 | 97 | Parent.FindForm().ResumeLayout(); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/RPPNControl.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WWActorEdit.Kazari.DZx 2 | { 3 | partial class RPPNControl 4 | { 5 | /// 6 | /// Erforderliche Designervariable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Verwendete Ressourcen bereinigen. 12 | /// 13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls 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 Vom Komponenten-Designer generierter Code 24 | 25 | /// 26 | /// Erforderliche Methode für die Designerunterstützung. 27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.textBox1 = new System.Windows.Forms.TextBox(); 32 | this.label3 = new System.Windows.Forms.Label(); 33 | this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); 34 | this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); 35 | this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); 36 | this.label5 = new System.Windows.Forms.Label(); 37 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); 38 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); 39 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // textBox1 43 | // 44 | this.textBox1.Location = new System.Drawing.Point(65, 3); 45 | this.textBox1.MaxLength = 7; 46 | this.textBox1.Name = "textBox1"; 47 | this.textBox1.Size = new System.Drawing.Size(112, 20); 48 | this.textBox1.TabIndex = 2; 49 | this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); 50 | // 51 | // label3 52 | // 53 | this.label3.AutoSize = true; 54 | this.label3.Location = new System.Drawing.Point(3, 31); 55 | this.label3.Name = "label3"; 56 | this.label3.Size = new System.Drawing.Size(47, 13); 57 | this.label3.TabIndex = 4; 58 | this.label3.Text = "Position:"; 59 | // 60 | // numericUpDown1 61 | // 62 | this.numericUpDown1.DecimalPlaces = 6; 63 | this.numericUpDown1.Location = new System.Drawing.Point(65, 29); 64 | this.numericUpDown1.Maximum = new decimal(new int[] { 65 | 999999, 66 | 0, 67 | 0, 68 | 0}); 69 | this.numericUpDown1.Minimum = new decimal(new int[] { 70 | 1000000, 71 | 0, 72 | 0, 73 | -2147483648}); 74 | this.numericUpDown1.Name = "numericUpDown1"; 75 | this.numericUpDown1.Size = new System.Drawing.Size(112, 20); 76 | this.numericUpDown1.TabIndex = 5; 77 | this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); 78 | // 79 | // numericUpDown2 80 | // 81 | this.numericUpDown2.DecimalPlaces = 6; 82 | this.numericUpDown2.Location = new System.Drawing.Point(65, 55); 83 | this.numericUpDown2.Maximum = new decimal(new int[] { 84 | 999999, 85 | 0, 86 | 0, 87 | 0}); 88 | this.numericUpDown2.Minimum = new decimal(new int[] { 89 | 1000000, 90 | 0, 91 | 0, 92 | -2147483648}); 93 | this.numericUpDown2.Name = "numericUpDown2"; 94 | this.numericUpDown2.Size = new System.Drawing.Size(112, 20); 95 | this.numericUpDown2.TabIndex = 6; 96 | this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged); 97 | // 98 | // numericUpDown3 99 | // 100 | this.numericUpDown3.DecimalPlaces = 6; 101 | this.numericUpDown3.Location = new System.Drawing.Point(65, 81); 102 | this.numericUpDown3.Maximum = new decimal(new int[] { 103 | 999999, 104 | 0, 105 | 0, 106 | 0}); 107 | this.numericUpDown3.Minimum = new decimal(new int[] { 108 | 1000000, 109 | 0, 110 | 0, 111 | -2147483648}); 112 | this.numericUpDown3.Name = "numericUpDown3"; 113 | this.numericUpDown3.Size = new System.Drawing.Size(112, 20); 114 | this.numericUpDown3.TabIndex = 7; 115 | this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged); 116 | // 117 | // label5 118 | // 119 | this.label5.AutoSize = true; 120 | this.label5.Location = new System.Drawing.Point(3, 6); 121 | this.label5.Name = "label5"; 122 | this.label5.Size = new System.Drawing.Size(56, 13); 123 | this.label5.TabIndex = 13; 124 | this.label5.Text = "Unknown:"; 125 | // 126 | // RPPNControl 127 | // 128 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 129 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 130 | this.Controls.Add(this.label5); 131 | this.Controls.Add(this.numericUpDown3); 132 | this.Controls.Add(this.numericUpDown2); 133 | this.Controls.Add(this.numericUpDown1); 134 | this.Controls.Add(this.label3); 135 | this.Controls.Add(this.textBox1); 136 | this.DoubleBuffered = true; 137 | this.Name = "RPPNControl"; 138 | this.Size = new System.Drawing.Size(180, 104); 139 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); 140 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); 141 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); 142 | this.ResumeLayout(false); 143 | this.PerformLayout(); 144 | 145 | } 146 | 147 | #endregion 148 | 149 | private System.Windows.Forms.TextBox textBox1; 150 | private System.Windows.Forms.Label label3; 151 | private System.Windows.Forms.NumericUpDown numericUpDown1; 152 | private System.Windows.Forms.NumericUpDown numericUpDown2; 153 | private System.Windows.Forms.NumericUpDown numericUpDown3; 154 | private System.Windows.Forms.Label label5; 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/RPPNControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace WWActorEdit.Kazari.DZx 11 | { 12 | public partial class RPPNControl : UserControl 13 | { 14 | RPPN Point; 15 | 16 | public RPPNControl(RPPN ThisPoint) 17 | { 18 | InitializeComponent(); 19 | 20 | Point = ThisPoint; 21 | 22 | this.SuspendLayout(); 23 | UpdateControl(); 24 | this.ResumeLayout(); 25 | } 26 | 27 | void UpdateControl() 28 | { 29 | AttachDetachEvents(false); 30 | 31 | textBox1.Text = Point.Unknown.ToString("X8"); 32 | numericUpDown1.Value = (decimal)Point.Position.X; 33 | numericUpDown2.Value = (decimal)Point.Position.Y; 34 | numericUpDown3.Value = (decimal)Point.Position.Z; 35 | 36 | AttachDetachEvents(true); 37 | } 38 | 39 | void AttachDetachEvents(bool Attach) 40 | { 41 | if (Attach == true) 42 | { 43 | textBox1.TextChanged += new EventHandler(textBox1_TextChanged); 44 | numericUpDown1.ValueChanged += new EventHandler(numericUpDown1_ValueChanged); 45 | numericUpDown2.ValueChanged += new EventHandler(numericUpDown2_ValueChanged); 46 | numericUpDown3.ValueChanged += new EventHandler(numericUpDown3_ValueChanged); 47 | } 48 | else 49 | { 50 | textBox1.TextChanged -= new EventHandler(textBox1_TextChanged); 51 | numericUpDown1.ValueChanged -= new EventHandler(numericUpDown1_ValueChanged); 52 | numericUpDown2.ValueChanged -= new EventHandler(numericUpDown2_ValueChanged); 53 | numericUpDown3.ValueChanged -= new EventHandler(numericUpDown3_ValueChanged); 54 | } 55 | } 56 | 57 | private void textBox1_TextChanged(object sender, EventArgs e) 58 | { 59 | if (textBox1.TextLength == textBox1.MaxLength) 60 | Point.Unknown = uint.Parse(textBox1.Text, System.Globalization.NumberStyles.HexNumber); 61 | } 62 | 63 | private void numericUpDown1_ValueChanged(object sender, EventArgs e) 64 | { 65 | Point.Position = new OpenTK.Vector3((float)numericUpDown1.Value, Point.Position.Y, Point.Position.Z); 66 | } 67 | 68 | private void numericUpDown2_ValueChanged(object sender, EventArgs e) 69 | { 70 | Point.Position = new OpenTK.Vector3(Point.Position.X, (float)numericUpDown2.Value, Point.Position.Z); 71 | } 72 | 73 | private void numericUpDown3_ValueChanged(object sender, EventArgs e) 74 | { 75 | Point.Position = new OpenTK.Vector3(Point.Position.X, Point.Position.Y, (float)numericUpDown3.Value); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/RPPNControl.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 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/SHIP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using OpenTK; 8 | using OpenTK.Graphics; 9 | using OpenTK.Graphics.OpenGL; 10 | 11 | namespace WWActorEdit.Kazari.DZx 12 | { 13 | public class SHIP : IDZxChunkElement 14 | { 15 | uint _Unknown; 16 | Vector3 _Position; 17 | 18 | public uint Unknown { get { return _Unknown; } set { _Unknown = value; HasChanged = true; } } 19 | public Vector3 Position { get { return _Position; } set { _Position = value; HasChanged = true; } } 20 | 21 | public RARC.FileEntry ParentFile { get; set; } 22 | public int Offset { get; set; } 23 | 24 | bool _HasChanged; 25 | public bool HasChanged { get { return _HasChanged; } set { _HasChanged = value; Node.ForeColor = (value == true ? System.Drawing.Color.Red : System.Drawing.SystemColors.WindowText); } } 26 | 27 | public bool Highlight { get; set; } 28 | public System.Drawing.Color RenderColor { get; set; } 29 | 30 | public TreeNode Node { get; set; } 31 | 32 | public int GLID { get; set; } 33 | 34 | public SHIP(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color)) 35 | { 36 | ParentFile = FE; 37 | 38 | byte[] SrcData = ParentFile.GetFileData(); 39 | 40 | Offset = SrcOffset; 41 | 42 | _Position = new Vector3( 43 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset)), 44 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04)), 45 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x08))); 46 | _Unknown = Helpers.Read32(SrcData, SrcOffset + 0x0C); 47 | 48 | SrcOffset += 0x10; 49 | 50 | RenderColor = Color; 51 | 52 | Node = Helpers.CreateTreeNode(string.Format("{0:X6}: 0x{1:X8}", Offset, _Unknown), this); 53 | ParentNode.BackColor = RenderColor; 54 | ParentNode.Nodes.Add(Node); 55 | 56 | GLID = GL.GenLists(1); 57 | GL.NewList(GLID, ListMode.Compile); 58 | Helpers.DrawFramedSphere(new Vector3d(0, 0, 0), 25.0f, 10); 59 | GL.EndList(); 60 | } 61 | 62 | public void StoreChanges() 63 | { 64 | byte[] Data = ParentFile.GetFileData(); 65 | 66 | Helpers.Overwrite32(ref Data, Offset, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.X), 0)); 67 | Helpers.Overwrite32(ref Data, Offset + 0x04, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Y), 0)); 68 | Helpers.Overwrite32(ref Data, Offset + 0x08, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Z), 0)); 69 | Helpers.Overwrite32(ref Data, Offset + 0x0C, _Unknown); 70 | 71 | ParentFile.SetFileData(Data); 72 | } 73 | 74 | public void Render() 75 | { 76 | GL.PushMatrix(); 77 | GL.Translate(_Position); 78 | GL.Color4((Highlight ? System.Drawing.Color.Red : RenderColor)); 79 | if (GL.IsList(GLID) == true) GL.CallList(GLID); 80 | GL.PopMatrix(); 81 | } 82 | 83 | public Control EditControl { get; set; } 84 | 85 | public void ShowControl(Panel Parent) 86 | { 87 | Parent.FindForm().SuspendLayout(); 88 | 89 | EditControl = new SHIPControl(this); 90 | EditControl.Parent = Parent; 91 | 92 | Parent.ClientSize = EditControl.Size; 93 | EditControl.Dock = DockStyle.Fill; 94 | 95 | Parent.Visible = true; 96 | 97 | Parent.FindForm().ResumeLayout(); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/SHIPControl.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WWActorEdit.Kazari.DZx 2 | { 3 | partial class SHIPControl 4 | { 5 | /// 6 | /// Erforderliche Designervariable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Verwendete Ressourcen bereinigen. 12 | /// 13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls 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 Vom Komponenten-Designer generierter Code 24 | 25 | /// 26 | /// Erforderliche Methode für die Designerunterstützung. 27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.textBox1 = new System.Windows.Forms.TextBox(); 32 | this.label3 = new System.Windows.Forms.Label(); 33 | this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); 34 | this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); 35 | this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); 36 | this.label5 = new System.Windows.Forms.Label(); 37 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); 38 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); 39 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // textBox1 43 | // 44 | this.textBox1.Location = new System.Drawing.Point(65, 81); 45 | this.textBox1.MaxLength = 7; 46 | this.textBox1.Name = "textBox1"; 47 | this.textBox1.Size = new System.Drawing.Size(112, 20); 48 | this.textBox1.TabIndex = 2; 49 | this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); 50 | // 51 | // label3 52 | // 53 | this.label3.AutoSize = true; 54 | this.label3.Location = new System.Drawing.Point(3, 5); 55 | this.label3.Name = "label3"; 56 | this.label3.Size = new System.Drawing.Size(47, 13); 57 | this.label3.TabIndex = 4; 58 | this.label3.Text = "Position:"; 59 | // 60 | // numericUpDown1 61 | // 62 | this.numericUpDown1.DecimalPlaces = 6; 63 | this.numericUpDown1.Location = new System.Drawing.Point(65, 3); 64 | this.numericUpDown1.Maximum = new decimal(new int[] { 65 | 999999, 66 | 0, 67 | 0, 68 | 0}); 69 | this.numericUpDown1.Minimum = new decimal(new int[] { 70 | 1000000, 71 | 0, 72 | 0, 73 | -2147483648}); 74 | this.numericUpDown1.Name = "numericUpDown1"; 75 | this.numericUpDown1.Size = new System.Drawing.Size(112, 20); 76 | this.numericUpDown1.TabIndex = 5; 77 | this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); 78 | // 79 | // numericUpDown2 80 | // 81 | this.numericUpDown2.DecimalPlaces = 6; 82 | this.numericUpDown2.Location = new System.Drawing.Point(65, 29); 83 | this.numericUpDown2.Maximum = new decimal(new int[] { 84 | 999999, 85 | 0, 86 | 0, 87 | 0}); 88 | this.numericUpDown2.Minimum = new decimal(new int[] { 89 | 1000000, 90 | 0, 91 | 0, 92 | -2147483648}); 93 | this.numericUpDown2.Name = "numericUpDown2"; 94 | this.numericUpDown2.Size = new System.Drawing.Size(112, 20); 95 | this.numericUpDown2.TabIndex = 6; 96 | this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged); 97 | // 98 | // numericUpDown3 99 | // 100 | this.numericUpDown3.DecimalPlaces = 6; 101 | this.numericUpDown3.Location = new System.Drawing.Point(65, 55); 102 | this.numericUpDown3.Maximum = new decimal(new int[] { 103 | 999999, 104 | 0, 105 | 0, 106 | 0}); 107 | this.numericUpDown3.Minimum = new decimal(new int[] { 108 | 1000000, 109 | 0, 110 | 0, 111 | -2147483648}); 112 | this.numericUpDown3.Name = "numericUpDown3"; 113 | this.numericUpDown3.Size = new System.Drawing.Size(112, 20); 114 | this.numericUpDown3.TabIndex = 7; 115 | this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged); 116 | // 117 | // label5 118 | // 119 | this.label5.AutoSize = true; 120 | this.label5.Location = new System.Drawing.Point(3, 84); 121 | this.label5.Name = "label5"; 122 | this.label5.Size = new System.Drawing.Size(56, 13); 123 | this.label5.TabIndex = 13; 124 | this.label5.Text = "Unknown:"; 125 | // 126 | // SHIPControl 127 | // 128 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 129 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 130 | this.Controls.Add(this.label5); 131 | this.Controls.Add(this.numericUpDown3); 132 | this.Controls.Add(this.numericUpDown2); 133 | this.Controls.Add(this.numericUpDown1); 134 | this.Controls.Add(this.label3); 135 | this.Controls.Add(this.textBox1); 136 | this.DoubleBuffered = true; 137 | this.Name = "SHIPControl"; 138 | this.Size = new System.Drawing.Size(180, 104); 139 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); 140 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); 141 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); 142 | this.ResumeLayout(false); 143 | this.PerformLayout(); 144 | 145 | } 146 | 147 | #endregion 148 | 149 | private System.Windows.Forms.TextBox textBox1; 150 | private System.Windows.Forms.Label label3; 151 | private System.Windows.Forms.NumericUpDown numericUpDown1; 152 | private System.Windows.Forms.NumericUpDown numericUpDown2; 153 | private System.Windows.Forms.NumericUpDown numericUpDown3; 154 | private System.Windows.Forms.Label label5; 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/SHIPControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace WWActorEdit.Kazari.DZx 11 | { 12 | public partial class SHIPControl : UserControl 13 | { 14 | SHIP Ship; 15 | 16 | public SHIPControl(SHIP ThisShip) 17 | { 18 | InitializeComponent(); 19 | 20 | Ship = ThisShip; 21 | 22 | this.SuspendLayout(); 23 | UpdateControl(); 24 | this.ResumeLayout(); 25 | } 26 | 27 | void UpdateControl() 28 | { 29 | AttachDetachEvents(false); 30 | 31 | numericUpDown1.Value = (decimal)Ship.Position.X; 32 | numericUpDown2.Value = (decimal)Ship.Position.Y; 33 | numericUpDown3.Value = (decimal)Ship.Position.Z; 34 | textBox1.Text = Ship.Unknown.ToString("X8"); 35 | 36 | AttachDetachEvents(true); 37 | } 38 | 39 | void AttachDetachEvents(bool Attach) 40 | { 41 | if (Attach == true) 42 | { 43 | numericUpDown1.ValueChanged += new EventHandler(numericUpDown1_ValueChanged); 44 | numericUpDown2.ValueChanged += new EventHandler(numericUpDown2_ValueChanged); 45 | numericUpDown3.ValueChanged += new EventHandler(numericUpDown3_ValueChanged); 46 | textBox1.TextChanged += new EventHandler(textBox1_TextChanged); 47 | } 48 | else 49 | { 50 | numericUpDown1.ValueChanged -= new EventHandler(numericUpDown1_ValueChanged); 51 | numericUpDown2.ValueChanged -= new EventHandler(numericUpDown2_ValueChanged); 52 | numericUpDown3.ValueChanged -= new EventHandler(numericUpDown3_ValueChanged); 53 | textBox1.TextChanged -= new EventHandler(textBox1_TextChanged); 54 | } 55 | } 56 | 57 | private void numericUpDown1_ValueChanged(object sender, EventArgs e) 58 | { 59 | Ship.Position = new OpenTK.Vector3((float)numericUpDown1.Value, Ship.Position.Y, Ship.Position.Z); 60 | } 61 | 62 | private void numericUpDown2_ValueChanged(object sender, EventArgs e) 63 | { 64 | Ship.Position = new OpenTK.Vector3(Ship.Position.X, (float)numericUpDown2.Value, Ship.Position.Z); 65 | } 66 | 67 | private void numericUpDown3_ValueChanged(object sender, EventArgs e) 68 | { 69 | Ship.Position = new OpenTK.Vector3(Ship.Position.X, Ship.Position.Y, (float)numericUpDown3.Value); 70 | } 71 | 72 | private void textBox1_TextChanged(object sender, EventArgs e) 73 | { 74 | if (textBox1.TextLength == textBox1.MaxLength) 75 | Ship.Unknown = uint.Parse(textBox1.Text, System.Globalization.NumberStyles.HexNumber); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/SHIPControl.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 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/TGDR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using OpenTK; 8 | using OpenTK.Graphics; 9 | using OpenTK.Graphics.OpenGL; 10 | 11 | namespace WWActorEdit.Kazari.DZx 12 | { 13 | public class TGDR : IDZxChunkElement 14 | { 15 | string _Name; 16 | uint _Parameters; 17 | Vector3 _Position; 18 | ushort _Unknown1; 19 | double _RotationY; 20 | ushort _Unknown2; 21 | ushort _Unknown3; 22 | uint _Unknown4; 23 | 24 | public string Name { get { return _Name; } set { _Name = value; HasChanged = true; } } 25 | public uint Parameters { get { return _Parameters; } set { _Parameters = value; HasChanged = true; } } 26 | public Vector3 Position { get { return _Position; } set { _Position = value; HasChanged = true; } } 27 | public ushort Unknown1 { get { return _Unknown1; } set { _Unknown1 = value; HasChanged = true; } } 28 | public double RotationY { get { return _RotationY; } set { _RotationY = value; HasChanged = true; } } 29 | public ushort Unknown2 { get { return _Unknown2; } set { _Unknown2 = value; HasChanged = true; } } 30 | public ushort Unknown3 { get { return _Unknown3; } set { _Unknown3 = value; HasChanged = true; } } 31 | public uint Unknown4 { get { return _Unknown4; } set { _Unknown4 = value; HasChanged = true; } } 32 | 33 | public RARC.FileEntry ParentFile { get; set; } 34 | public int Offset { get; set; } 35 | 36 | bool _HasChanged; 37 | public bool HasChanged { get { return _HasChanged; } set { _HasChanged = value; Node.ForeColor = (value == true ? System.Drawing.Color.Red : System.Drawing.SystemColors.WindowText); } } 38 | 39 | public bool Highlight { get; set; } 40 | public System.Drawing.Color RenderColor { get; set; } 41 | 42 | public TreeNode Node { get; set; } 43 | 44 | public int GLID { get; set; } 45 | 46 | public J3Dx.J3Dx MatchedModel { get; set; } 47 | public DZB.DZB MatchedCollision { get; set; } 48 | 49 | public TGDR(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color), ZeldaArc ParentZA = null) 50 | { 51 | ParentFile = FE; 52 | 53 | byte[] SrcData = ParentFile.GetFileData(); 54 | 55 | Offset = SrcOffset; 56 | 57 | _Name = Helpers.ReadString(SrcData, SrcOffset, 8); 58 | _Parameters = Helpers.Read32(SrcData, SrcOffset + 8); 59 | _Position = new Vector3( 60 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x0C)), 61 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x10)), 62 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x14))); 63 | 64 | _Unknown1 = Helpers.Read16(SrcData, SrcOffset + 0x18); 65 | _RotationY = ((short)Helpers.Read16(SrcData, SrcOffset + 0x1A) / 182.04444444444444).Clamp(-180, 179); 66 | _Unknown2 = Helpers.Read16(SrcData, SrcOffset + 0x1C); 67 | 68 | _Unknown3 = Helpers.Read16(SrcData, SrcOffset + 0x1E); 69 | _Unknown4 = Helpers.Read32(SrcData, SrcOffset + 0x20); 70 | 71 | SrcOffset += 0x24; 72 | 73 | RenderColor = Color; 74 | 75 | Node = Helpers.CreateTreeNode(string.Format("{0:X6}: {1}", Offset, _Name), this); 76 | ParentNode.BackColor = RenderColor; 77 | ParentNode.Nodes.Add(Node); 78 | 79 | GLID = GL.GenLists(1); 80 | GL.NewList(GLID, ListMode.Compile); 81 | 82 | if (ParentZA != null) 83 | { 84 | MatchedModel = ParentZA.J3Dxs.Find(x => x.FileEntry.FileName.StartsWith(_Name)); 85 | MatchedCollision = ParentZA.DZBs.Find(x => x.Name.StartsWith(_Name)); 86 | } 87 | 88 | Helpers.DrawFramedCube(new Vector3d(15, 15, 15)); 89 | GL.EndList(); 90 | } 91 | 92 | public void StoreChanges() 93 | { 94 | byte[] Data = ParentFile.GetFileData(); 95 | 96 | Helpers.WriteString(ref Data, Offset, _Name, 8); 97 | Helpers.Overwrite32(ref Data, Offset + 0x08, _Parameters); 98 | Helpers.Overwrite32(ref Data, Offset + 0x0C, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.X), 0)); 99 | Helpers.Overwrite32(ref Data, Offset + 0x10, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Y), 0)); 100 | Helpers.Overwrite32(ref Data, Offset + 0x14, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Z), 0)); 101 | Helpers.Overwrite16(ref Data, Offset + 0x18, _Unknown1); 102 | Helpers.Overwrite16(ref Data, Offset + 0x1A, (ushort)(_RotationY * 182.04444444444444f)); 103 | Helpers.Overwrite16(ref Data, Offset + 0x1C, _Unknown2); 104 | Helpers.Overwrite16(ref Data, Offset + 0x1E, _Unknown3); 105 | Helpers.Overwrite32(ref Data, Offset + 0x20, _Unknown4); 106 | 107 | ParentFile.SetFileData(Data); 108 | } 109 | 110 | public void Render() 111 | { 112 | GL.PushMatrix(); 113 | GL.Translate(_Position); 114 | GL.Rotate(_RotationY, 0, 1, 0); 115 | GL.Color4((Highlight ? System.Drawing.Color.Red : RenderColor)); 116 | if (MatchedModel != null) MatchedModel.Render(); 117 | if (MatchedCollision != null) MatchedCollision.Render(); 118 | if (GL.IsList(GLID) == true) GL.CallList(GLID); 119 | GL.PopMatrix(); 120 | } 121 | 122 | public Control EditControl { get; set; } 123 | 124 | public void ShowControl(Panel Parent) 125 | { 126 | Parent.FindForm().SuspendLayout(); 127 | 128 | EditControl = new TGDRControl(this); 129 | EditControl.Parent = Parent; 130 | 131 | Parent.ClientSize = EditControl.Size; 132 | EditControl.Dock = DockStyle.Fill; 133 | 134 | Parent.Visible = true; 135 | 136 | Parent.FindForm().ResumeLayout(); 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/TGDRControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace WWActorEdit.Kazari.DZx 11 | { 12 | public partial class TGDRControl : UserControl 13 | { 14 | TGDR Door; 15 | 16 | public TGDRControl(TGDR ThisDoor) 17 | { 18 | InitializeComponent(); 19 | 20 | Door = ThisDoor; 21 | 22 | this.SuspendLayout(); 23 | UpdateControl(); 24 | this.ResumeLayout(); 25 | } 26 | 27 | void UpdateControl() 28 | { 29 | AttachDetachEvents(false); 30 | 31 | textBox1.Text = Door.Name; 32 | textBox2.Text = Door.Parameters.ToString("X8"); 33 | numericUpDown1.Value = (decimal)Door.Position.X; 34 | numericUpDown2.Value = (decimal)Door.Position.Y; 35 | numericUpDown3.Value = (decimal)Door.Position.Z; 36 | textBox3.Text = Door.Unknown1.ToString("X4"); 37 | numericUpDown4.Value = (decimal)Door.RotationY; 38 | textBox4.Text = Door.Unknown2.ToString("X4"); 39 | textBox5.Text = Door.Unknown3.ToString("X4"); 40 | textBox6.Text = Door.Unknown4.ToString("X8"); 41 | 42 | AttachDetachEvents(true); 43 | } 44 | 45 | void AttachDetachEvents(bool Attach) 46 | { 47 | if (Attach == true) 48 | { 49 | textBox1.TextChanged += new EventHandler(textBox1_TextChanged); 50 | textBox2.TextChanged += new EventHandler(textBox2_TextChanged); 51 | numericUpDown1.ValueChanged += new EventHandler(numericUpDown1_ValueChanged); 52 | numericUpDown2.ValueChanged += new EventHandler(numericUpDown2_ValueChanged); 53 | numericUpDown3.ValueChanged += new EventHandler(numericUpDown3_ValueChanged); 54 | textBox3.TextChanged += new EventHandler(textBox3_TextChanged); 55 | numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged); 56 | textBox4.TextChanged += new EventHandler(textBox4_TextChanged); 57 | textBox5.TextChanged += new EventHandler(textBox5_TextChanged); 58 | textBox6.TextChanged += new EventHandler(textBox6_TextChanged); 59 | } 60 | else 61 | { 62 | textBox1.TextChanged -= new EventHandler(textBox1_TextChanged); 63 | textBox2.TextChanged -= new EventHandler(textBox2_TextChanged); 64 | numericUpDown1.ValueChanged -= new EventHandler(numericUpDown1_ValueChanged); 65 | numericUpDown2.ValueChanged -= new EventHandler(numericUpDown2_ValueChanged); 66 | numericUpDown3.ValueChanged -= new EventHandler(numericUpDown3_ValueChanged); 67 | textBox3.TextChanged -= new EventHandler(textBox3_TextChanged); 68 | numericUpDown4.ValueChanged -= new EventHandler(numericUpDown4_ValueChanged); 69 | textBox4.TextChanged -= new EventHandler(textBox4_TextChanged); 70 | textBox5.TextChanged -= new EventHandler(textBox5_TextChanged); 71 | textBox6.TextChanged -= new EventHandler(textBox6_TextChanged); 72 | } 73 | } 74 | 75 | private void textBox1_TextChanged(object sender, EventArgs e) 76 | { 77 | Door.Name = textBox1.Text; 78 | } 79 | 80 | private void textBox2_TextChanged(object sender, EventArgs e) 81 | { 82 | if (textBox2.TextLength == textBox2.MaxLength) 83 | Door.Parameters = uint.Parse(textBox2.Text, System.Globalization.NumberStyles.HexNumber); 84 | } 85 | 86 | private void numericUpDown1_ValueChanged(object sender, EventArgs e) 87 | { 88 | Door.Position = new OpenTK.Vector3((float)numericUpDown1.Value, Door.Position.Y, Door.Position.Z); 89 | } 90 | 91 | private void numericUpDown2_ValueChanged(object sender, EventArgs e) 92 | { 93 | Door.Position = new OpenTK.Vector3(Door.Position.X, (float)numericUpDown2.Value, Door.Position.Z); 94 | } 95 | 96 | private void numericUpDown3_ValueChanged(object sender, EventArgs e) 97 | { 98 | Door.Position = new OpenTK.Vector3(Door.Position.X, Door.Position.Y, (float)numericUpDown3.Value); 99 | } 100 | 101 | private void textBox3_TextChanged(object sender, EventArgs e) 102 | { 103 | if (textBox3.TextLength == textBox3.MaxLength) 104 | Door.Unknown1 = ushort.Parse(textBox3.Text, System.Globalization.NumberStyles.HexNumber); 105 | } 106 | 107 | private void numericUpDown4_ValueChanged(object sender, EventArgs e) 108 | { 109 | Door.RotationY = (double)numericUpDown4.Value; 110 | } 111 | 112 | void textBox4_TextChanged(object sender, EventArgs e) 113 | { 114 | if (textBox4.TextLength == textBox4.MaxLength) 115 | Door.Unknown2 = ushort.Parse(textBox4.Text, System.Globalization.NumberStyles.HexNumber); 116 | } 117 | 118 | void textBox5_TextChanged(object sender, EventArgs e) 119 | { 120 | if (textBox5.TextLength == textBox5.MaxLength) 121 | Door.Unknown3 = ushort.Parse(textBox5.Text, System.Globalization.NumberStyles.HexNumber); 122 | } 123 | 124 | void textBox6_TextChanged(object sender, EventArgs e) 125 | { 126 | if (textBox6.TextLength == textBox6.MaxLength) 127 | Door.Unknown4 = uint.Parse(textBox6.Text, System.Globalization.NumberStyles.HexNumber); 128 | } 129 | 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/TGDRControl.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 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/TRES.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using OpenTK; 8 | using OpenTK.Graphics; 9 | using OpenTK.Graphics.OpenGL; 10 | 11 | namespace WWActorEdit.Kazari.DZx 12 | { 13 | public class TRES : IDZxChunkElement 14 | { 15 | string _Name; 16 | byte _Contents; 17 | Vector3 _Position; 18 | ushort _ChestType; 19 | float _Rotation; 20 | 21 | public string Name { get { return _Name; } set { _Name = value; HasChanged = true; } } 22 | public ushort ChestType { get { return _ChestType; } set { _ChestType = value; HasChanged = true; } } 23 | public Vector3 Position { get { return _Position; } set { _Position = value; HasChanged = true; } } 24 | public float Rotation { get { return _Rotation; } set { _Rotation = value; HasChanged = true; } } 25 | public byte Contents { get { return _Contents; } set { _Contents = value; HasChanged = true; } } 26 | 27 | public RARC.FileEntry ParentFile { get; set; } 28 | public int Offset { get; set; } 29 | 30 | bool _HasChanged; 31 | public bool HasChanged { get { return _HasChanged; } set { _HasChanged = value; Node.ForeColor = (value == true ? System.Drawing.Color.Red : System.Drawing.SystemColors.WindowText); } } 32 | 33 | public bool Highlight { get; set; } 34 | public System.Drawing.Color RenderColor { get; set; } 35 | 36 | public TreeNode Node { get; set; } 37 | 38 | public int GLID { get; set; } 39 | 40 | public J3Dx.J3Dx MatchedModel { get; set; } 41 | public DZB.DZB MatchedCollision { get; set; } 42 | 43 | public TRES(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color), ZeldaArc ParentZA = null) 44 | { 45 | ParentFile = FE; 46 | 47 | byte[] SrcData = ParentFile.GetFileData(); 48 | 49 | Offset = SrcOffset; 50 | 51 | _Name = Helpers.ReadString(SrcData, SrcOffset, 8); 52 | _ChestType = Helpers.Read16(SrcData, SrcOffset + 0x09); 53 | _Position = new Vector3( 54 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x0C)), 55 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x10)), 56 | Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x14))); 57 | _Rotation = ((short)(Helpers.Read16(SrcData, SrcOffset + 0x1A)) / 182.04444444444444f).Clamp(-180, 179); 58 | _Contents = Helpers.Read8(SrcData, SrcOffset + 0x1C); 59 | 60 | SrcOffset += 0x20; 61 | 62 | RenderColor = Color; 63 | 64 | Node = Helpers.CreateTreeNode(string.Format("{0:X6}: {1}", Offset, _Name), this); 65 | ParentNode.BackColor = RenderColor; 66 | ParentNode.Nodes.Add(Node); 67 | 68 | GLID = GL.GenLists(1); 69 | GL.NewList(GLID, ListMode.Compile); 70 | 71 | if (ParentZA != null) 72 | { 73 | MatchedModel = ParentZA.J3Dxs.Find(x => x.FileEntry.FileName.StartsWith(_Name)); 74 | MatchedCollision = ParentZA.DZBs.Find(x => x.Name.StartsWith(_Name)); 75 | } 76 | 77 | Helpers.DrawFramedCube(new Vector3d(15, 15, 15)); 78 | GL.EndList(); 79 | } 80 | 81 | public void StoreChanges() 82 | { 83 | byte[] Data = ParentFile.GetFileData(); 84 | 85 | Helpers.WriteString(ref Data, Offset, _Name, 8); 86 | Helpers.Overwrite16(ref Data, Offset + 0x09, _ChestType); 87 | Helpers.Overwrite32(ref Data, Offset + 0x0C, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.X), 0)); 88 | Helpers.Overwrite32(ref Data, Offset + 0x10, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Y), 0)); 89 | Helpers.Overwrite32(ref Data, Offset + 0x14, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Z), 0)); 90 | Helpers.Overwrite16(ref Data, Offset + 0x1A, (ushort)(_Rotation * 182.04444444444444f)); 91 | Helpers.Overwrite8(ref Data, Offset + 0x1C, _Contents); 92 | 93 | ParentFile.SetFileData(Data); 94 | } 95 | 96 | public void Render() 97 | { 98 | GL.PushMatrix(); 99 | GL.Translate(_Position); 100 | GL.Rotate(_Rotation, 0, 1, 0); 101 | GL.Color4((Highlight ? System.Drawing.Color.Red : RenderColor)); 102 | if (MatchedModel != null) MatchedModel.Render(); 103 | if (MatchedCollision != null) MatchedCollision.Render(); 104 | if (GL.IsList(GLID) == true) GL.CallList(GLID); 105 | GL.PopMatrix(); 106 | } 107 | 108 | public Control EditControl { get; set; } 109 | 110 | public void ShowControl(Panel Parent) 111 | { 112 | Parent.FindForm().SuspendLayout(); 113 | 114 | EditControl = new TRESControl(this); 115 | EditControl.Parent = Parent; 116 | 117 | Parent.ClientSize = EditControl.Size; 118 | EditControl.Dock = DockStyle.Fill; 119 | 120 | Parent.Visible = true; 121 | 122 | Parent.FindForm().ResumeLayout(); 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/TRESControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace WWActorEdit.Kazari.DZx 11 | { 12 | public partial class TRESControl : UserControl 13 | { 14 | TRES Actor; 15 | 16 | public TRESControl(TRES ThisActor) 17 | { 18 | InitializeComponent(); 19 | 20 | Actor = ThisActor; 21 | 22 | this.SuspendLayout(); 23 | UpdateControl(); 24 | this.ResumeLayout(); 25 | } 26 | 27 | void UpdateControl() 28 | { 29 | AttachDetachEvents(false); 30 | 31 | textBox1.Text = Actor.Name; 32 | textBox2.Text = Actor.ChestType.ToString("X4"); 33 | numericUpDown1.Value = (decimal)Actor.Position.X; 34 | numericUpDown2.Value = (decimal)Actor.Position.Y; 35 | numericUpDown3.Value = (decimal)Actor.Position.Z; 36 | numericUpDown4.Value = (decimal)Actor.Rotation; 37 | numericUpDown5.Value = (decimal)Actor.Contents; 38 | 39 | AttachDetachEvents(true); 40 | } 41 | 42 | void AttachDetachEvents(bool Attach) 43 | { 44 | if (Attach == true) 45 | { 46 | textBox1.TextChanged += new EventHandler(textBox1_TextChanged); 47 | textBox2.TextChanged += new EventHandler(textBox2_TextChanged); 48 | numericUpDown1.ValueChanged += new EventHandler(numericUpDown1_ValueChanged); 49 | numericUpDown2.ValueChanged += new EventHandler(numericUpDown2_ValueChanged); 50 | numericUpDown3.ValueChanged += new EventHandler(numericUpDown3_ValueChanged); 51 | numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged); 52 | numericUpDown5.ValueChanged += new EventHandler(numericUpDown5_ValueChanged); 53 | } 54 | else 55 | { 56 | textBox1.TextChanged -= new EventHandler(textBox1_TextChanged); 57 | textBox2.TextChanged -= new EventHandler(textBox2_TextChanged); 58 | numericUpDown1.ValueChanged -= new EventHandler(numericUpDown1_ValueChanged); 59 | numericUpDown2.ValueChanged -= new EventHandler(numericUpDown2_ValueChanged); 60 | numericUpDown3.ValueChanged -= new EventHandler(numericUpDown3_ValueChanged); 61 | numericUpDown4.ValueChanged -= new EventHandler(numericUpDown4_ValueChanged); 62 | numericUpDown5.ValueChanged -= new EventHandler(numericUpDown5_ValueChanged); 63 | } 64 | } 65 | 66 | private void textBox1_TextChanged(object sender, EventArgs e) 67 | { 68 | Actor.Name = textBox1.Text; 69 | } 70 | 71 | private void textBox2_TextChanged(object sender, EventArgs e) 72 | { 73 | if (textBox2.TextLength == textBox2.MaxLength) 74 | Actor.ChestType = ushort.Parse(textBox2.Text, System.Globalization.NumberStyles.HexNumber); 75 | } 76 | 77 | private void numericUpDown1_ValueChanged(object sender, EventArgs e) 78 | { 79 | Actor.Position = new OpenTK.Vector3((float)numericUpDown1.Value, Actor.Position.Y, Actor.Position.Z); 80 | } 81 | 82 | private void numericUpDown2_ValueChanged(object sender, EventArgs e) 83 | { 84 | Actor.Position = new OpenTK.Vector3(Actor.Position.X, (float)numericUpDown2.Value, Actor.Position.Z); 85 | } 86 | 87 | private void numericUpDown3_ValueChanged(object sender, EventArgs e) 88 | { 89 | Actor.Position = new OpenTK.Vector3(Actor.Position.X, Actor.Position.Y, (float)numericUpDown3.Value); 90 | } 91 | 92 | private void numericUpDown4_ValueChanged(object sender, EventArgs e) 93 | { 94 | Actor.Rotation = (float)numericUpDown4.Value; 95 | } 96 | 97 | private void numericUpDown5_ValueChanged(object sender, EventArgs e) 98 | { 99 | Actor.Contents = (byte)numericUpDown5.Value; 100 | } 101 | 102 | private void label2_Click(object sender, EventArgs e) 103 | { 104 | 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /WWActorEdit/Kazari/DZx/TRESControl.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 | -------------------------------------------------------------------------------- /WWActorEdit/OpenTK.GLControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pho/WindViewer/badcc60891e893631652192252ea016e0de2e037/WWActorEdit/OpenTK.GLControl.dll -------------------------------------------------------------------------------- /WWActorEdit/OpenTK.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pho/WindViewer/badcc60891e893631652192252ea016e0de2e037/WWActorEdit/OpenTK.dll -------------------------------------------------------------------------------- /WWActorEdit/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace WWActorEdit 7 | { 8 | static class Program 9 | { 10 | public static ExceptionHandler ExHandler; 11 | 12 | [STAThread] 13 | static void Main() 14 | { 15 | ExHandler = new ExceptionHandler(); 16 | Application.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; 17 | 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new MainForm()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /WWActorEdit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die mit einer Assembly verknüpft sind. 8 | [assembly: AssemblyTitle("Wind Viewer")] 9 | [assembly: AssemblyDescription("Zelda: Wind Waker level viewer and editor")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Wind Viewer")] 13 | [assembly: AssemblyCopyright("2012 by xdaniel, et al.")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar 18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("5ce26765-817c-4175-a535-212215844f01")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 33 | // übernehmen, indem Sie "*" eingeben: 34 | [assembly: AssemblyVersion("1.0.*")] 35 | //[assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WWActorEdit/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.235 5 | // 6 | // Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn 7 | // der Code neu generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WWActorEdit.Properties 12 | { 13 | 14 | 15 | /// 16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. 17 | /// 18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse 19 | // über ein Tool wie ResGen oder Visual Studio automatisch generiert. 20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen 21 | // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WWActorEdit.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle 56 | /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /WWActorEdit/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 | -------------------------------------------------------------------------------- /WWActorEdit/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.235 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 WWActorEdit.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /WWActorEdit/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WWActorEdit/Source/FSHelpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Xml.Schema; 7 | using WWActorEdit.Kazari; 8 | 9 | namespace WWActorEdit.Source 10 | { 11 | /// 12 | /// FileSystem Helpers. These help with converting from Little Endian to Big Endian. 13 | /// 14 | class FSHelpers 15 | { 16 | #region Writing 17 | public static void Write8(BinaryWriter bWriter, byte value) 18 | { 19 | bWriter.Write(value); 20 | } 21 | 22 | public static void Write16(BinaryWriter bWriter, ushort value) 23 | { 24 | ushort swappedValue = (ushort) ((value & 0XFFU) << 8 | (value & 0xFF00U) >> 8); 25 | bWriter.Write(swappedValue); 26 | } 27 | 28 | public static void Write32(BinaryWriter bWriter, int value) 29 | { 30 | int swappedValue = (int) ((value & 0x000000FFU) << 24 | (value & 0x0000FF00U) << 8 | 31 | (value & 0x00FF0000U) >> 8 | (value & 0xFF000000U) >> 24); 32 | bWriter.Write(swappedValue); 33 | } 34 | 35 | public static void WriteString(BinaryWriter bWriter, string str, int length) 36 | { 37 | byte[] stringAsBytes = new byte[length]; 38 | 39 | for (int i = 0; i < length; i++) 40 | { 41 | if (i < str.Length) 42 | { 43 | stringAsBytes[i] = (byte) str[i]; 44 | } 45 | else 46 | { 47 | stringAsBytes[i] = 0; 48 | } 49 | } 50 | 51 | bWriter.Write(stringAsBytes); 52 | } 53 | 54 | public static void WriteArray(BinaryWriter binaryWriter, byte[] value) 55 | { 56 | binaryWriter.Write(value); 57 | } 58 | 59 | public static void WriteFloat(BinaryWriter binaryWriter, float value) 60 | { 61 | byte[] reversed = BitConverter.GetBytes(value); 62 | Array.Reverse(reversed); 63 | 64 | binaryWriter.Write(reversed); 65 | } 66 | #endregion 67 | 68 | /// 69 | /// Used to easily convert "0xFFFFFF" into 3 bytes, each with the value of FF. 70 | /// 71 | /// Value of bytes in Hexadecimal format, ie: 0xFF or 0xFF00FF 72 | /// Number of bytes in length, ie: 1 or 3. 73 | /// The first "length" worth of bytes when converted to an int. 74 | public static byte[] ToBytes(uint value, int length) 75 | { 76 | byte[] fullLength = BitConverter.GetBytes(value); 77 | 78 | byte[] clippedBytes = new byte[length]; 79 | for (int i = 0; i < length; i++) 80 | clippedBytes[i] = fullLength[i]; 81 | 82 | //If we're running on a Little Endian machine (most of them...) we need to reverse the Array order 83 | //So that we don't turn 0x800000 into 0 0 128, but instead 128 0 0. 84 | if (BitConverter.IsLittleEndian) 85 | Array.Reverse(clippedBytes); 86 | 87 | return clippedBytes; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /WWActorEdit/ZeldaArc.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.Windows.Forms; 9 | using System.IO; 10 | using System.Text.RegularExpressions; 11 | using System.Reflection; 12 | using System.Globalization; 13 | 14 | using OpenTK; 15 | using OpenTK.Graphics; 16 | using OpenTK.Graphics.OpenGL; 17 | 18 | using WWActorEdit.Kazari; 19 | using WWActorEdit.Kazari.DZx; 20 | using WWActorEdit.Kazari.DZB; 21 | using WWActorEdit.Kazari.J3Dx; 22 | 23 | namespace WWActorEdit 24 | { 25 | public class ZeldaArc 26 | { 27 | public RARC Archive { get; private set; } 28 | public List DZRs { get; private set; } 29 | public List DZSs { get; private set; } 30 | public List DZBs { get; private set; } 31 | public List J3Dxs { get; private set; } 32 | 33 | public Vector3 GlobalTranslation { get; set; } 34 | public float GlobalRotation { get; set; } 35 | public int RoomNumber { get; set; } 36 | 37 | public string Filename { get; private set; } 38 | 39 | public ZeldaArc(string File, TreeView TV, bool IgnoreModels = false) 40 | { 41 | Archive = new RARC(File); 42 | DZRs = new List(); 43 | DZSs = new List(); 44 | DZBs = new List(); 45 | J3Dxs = new List(); 46 | 47 | TreeNode NewNode = Helpers.CreateTreeNode(Archive.Filename, null); 48 | PopulateFileList(NewNode, Archive.Root, IgnoreModels); 49 | //TV.Nodes[TV.Nodes.Count - 1].Expand(); 50 | //TV.SelectedNode = TV.Nodes[TV.Nodes.Count - 1]; 51 | TV.Nodes.Add(NewNode); 52 | 53 | Filename = File; 54 | } 55 | 56 | public void Clear() 57 | { 58 | foreach (DZx D in DZRs) D.Clear(); 59 | foreach (DZx D in DZSs) D.Clear(); 60 | foreach (DZB D in DZBs) D.Clear(); 61 | foreach (J3Dx M in J3Dxs) M.Clear(); 62 | } 63 | 64 | public void Save() 65 | { 66 | foreach (DZx D in DZRs) 67 | { 68 | if (D.FileEntry.IsCompressed == true) continue; 69 | 70 | foreach (DZx.FileChunk C in D.Chunks) 71 | foreach (IDZxChunkElement CE in C.Data) 72 | if (CE.HasChanged == true) CE.StoreChanges(); 73 | 74 | D.FileEntry.BaseRARC.Save(); 75 | } 76 | 77 | foreach (DZx D in DZSs) 78 | { 79 | if (D.FileEntry.IsCompressed == true) continue; 80 | 81 | foreach (DZx.FileChunk C in D.Chunks) 82 | foreach (IDZxChunkElement CE in C.Data) 83 | if (CE.HasChanged == true) CE.StoreChanges(); 84 | 85 | D.FileEntry.BaseRARC.Save(); 86 | } 87 | 88 | foreach (DZB D in DZBs) 89 | { 90 | // unimplemented! 91 | } 92 | 93 | foreach (J3Dx J in J3Dxs) 94 | { 95 | // unimplemented! 96 | } 97 | } 98 | 99 | private void PopulateFileList(TreeNode TN, RARC.FileNode ParentFN, bool IgnoreModels) 100 | { 101 | foreach (RARC.FileNode ChildFN in ParentFN.ChildNodes) 102 | PopulateFileList(TN, ChildFN, IgnoreModels); 103 | 104 | foreach (RARC.FileEntry FE in ParentFN.Files) 105 | { 106 | if (J3Dx.ValidExtensions.Contains(Path.GetExtension(FE.FileName)) && IgnoreModels == false) 107 | J3Dxs.Add(new J3Dx(FE, TN)); 108 | 109 | else if (Path.GetExtension(FE.FileName) == ".dzr") 110 | DZRs.Add(new DZx(FE, TN, this)); 111 | 112 | else if (Path.GetExtension(FE.FileName) == ".dzs") 113 | DZSs.Add(new DZx(FE, TN, this)); 114 | 115 | else if (Path.GetExtension(FE.FileName) == ".dzb") 116 | DZBs.Add(new DZB(FE, TN)); 117 | } 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /WWActorEdit/windviewer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pho/WindViewer/badcc60891e893631652192252ea016e0de2e037/WWActorEdit/windviewer.ico --------------------------------------------------------------------------------