From 28be59194449ec980b43f10c39f79322818153b8 Mon Sep 17 00:00:00 2001 From: Kozmeker Date: Thu, 28 Nov 2024 19:29:35 +0100 Subject: [PATCH] small code cleanup --- Mafia2Libs/Controls/RenderOptions.cs | 6 +++--- Mafia2Libs/Forms/MapEditor.cs | 14 ++++++++------ .../Rendering/Graphics/RenderTypes/RenderModel.cs | 2 +- Mafia2Libs/Utils/Settings/ToolkitSettings.cs | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Mafia2Libs/Controls/RenderOptions.cs b/Mafia2Libs/Controls/RenderOptions.cs index 709cdc39..a784f258 100644 --- a/Mafia2Libs/Controls/RenderOptions.cs +++ b/Mafia2Libs/Controls/RenderOptions.cs @@ -37,7 +37,7 @@ private void LoadSettings() TexDirectoryBox.Text = ToolkitSettings.TexturePath; ExperimentalBox.Checked = ToolkitSettings.Experimental; Checkbox_EnableNavigation.Checked = ToolkitSettings.bNavigation; - Checkbox_EnableTranslokatorTint.Checked = ToolkitSettings.bTranslokator; + Checkbox_EnableTranslokatorTint.Checked = ToolkitSettings.bTranslokatorTint; UseMIPsBox.Checked = ToolkitSettings.UseMIPS; CheckBox_VSync.Checked = ToolkitSettings.VSync; } @@ -109,8 +109,8 @@ private void Button_EnableNavigation_CheckedChanged(object sender, EventArgs e) private void Button_EnableTranslokatorTint_CheckedChanged(object sender, EventArgs e) { - ToolkitSettings.bTranslokator = Checkbox_EnableTranslokatorTint.Checked; - ToolkitSettings.WriteKey("EnableTranslokator", "ModelViewer", ToolkitSettings.bTranslokator.ToString()); + ToolkitSettings.bTranslokatorTint = Checkbox_EnableTranslokatorTint.Checked; + ToolkitSettings.WriteKey("EnableTranslokator", "ModelViewer", ToolkitSettings.bTranslokatorTint.ToString()); } } } diff --git a/Mafia2Libs/Forms/MapEditor.cs b/Mafia2Libs/Forms/MapEditor.cs index 922d95c4..7e5d9fcd 100644 --- a/Mafia2Libs/Forms/MapEditor.cs +++ b/Mafia2Libs/Forms/MapEditor.cs @@ -2421,8 +2421,8 @@ private void EditLighting_Click(object sender, EventArgs e) private void TranslokatorTint_Click(object sender, EventArgs e) { - ToolkitSettings.bTranslokator = !ToolkitSettings.bTranslokator; - ToolkitSettings.WriteKey("EnableTranslokator", "ModelViewer", ToolkitSettings.bTranslokator.ToString()); + ToolkitSettings.bTranslokatorTint = !ToolkitSettings.bTranslokatorTint; + ToolkitSettings.WriteKey("EnableTranslokator", "ModelViewer", ToolkitSettings.bTranslokatorTint.ToString()); } private void Button_TestConvert_Click(object sender, EventArgs e) @@ -2742,8 +2742,10 @@ private void ActorEntryNewTRObjectButton_Click(object sender, EventArgs e) FrameObjectBase groupRef = SceneData.FrameResource.GetObjectByHash(actor.FrameNameHash); if (groupRef == null)//todo: once multisds is added, tweak this { - ToolkitAssert.Ensure(groupRef!= null,"Error: Actor's FrameName: " + actor.FrameName + "(" + actor.FrameNameHash.ToString() + ")" + " is not included in FrameResource Contents"); - return; + if (MessageBox.Show("There is no matching Frame: " + actor.FrameName + " in FrameResource contents. If you intend to reference Frame of this name, it is not present. Do you want to continue?", "Toolkit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } } TreeNode ogNode = dSceneTree.GetObjectGroupByActorType(translokatorRoot, actor.ActorTypeID); @@ -2756,7 +2758,7 @@ private void ActorEntryNewTRObjectButton_Click(object sender, EventArgs e) newOGNode.Tag = newOG; dSceneTree.AddToTree(newOGNode,translokatorRoot.Nodes[0]); ogNode = newOGNode; - Debug.WriteLine("New Translokator ObjectGroup:" + newOG.ActorType); + Log.WriteLine("New Translokator ObjectGroup:" + newOG.ActorType,LoggingTypes.MESSAGE,LogCategoryTypes.FUNCTION); } if (dSceneTree.ObjectGroupHasObject(ogNode, actor.FrameNameHash)) @@ -2771,7 +2773,7 @@ private void ActorEntryNewTRObjectButton_Click(object sender, EventArgs e) TreeNode objNode = new TreeNode(newObj.Name.ToString()); objNode.Tag = newObj; dSceneTree.AddToTree(objNode,ogNode); - Debug.WriteLine("New Translokator Object:" + newObj.Name.String); + Log.WriteLine("New Translokator Object:" + newObj.Name.String,LoggingTypes.MESSAGE,LogCategoryTypes.FUNCTION); } } diff --git a/Mafia2Libs/Rendering/Graphics/RenderTypes/RenderModel.cs b/Mafia2Libs/Rendering/Graphics/RenderTypes/RenderModel.cs index 937f2790..4282d0e7 100644 --- a/Mafia2Libs/Rendering/Graphics/RenderTypes/RenderModel.cs +++ b/Mafia2Libs/Rendering/Graphics/RenderTypes/RenderModel.cs @@ -410,7 +410,7 @@ public void RenderInstances(ID3D11DeviceContext deviceContext, Camera camera, ID { RenderModel.ModelPart segment = LODs[0].ModelParts[i]; - segment.Shader.SetShaderParameters(device, deviceContext, new MaterialParameters(segment.Material, ToolkitSettings.bTranslokator ? tint.Normalize() : startColor.Normalize())); + segment.Shader.SetShaderParameters(device, deviceContext, new MaterialParameters(segment.Material, ToolkitSettings.bTranslokatorTint ? tint.Normalize() : startColor.Normalize())); segment.Shader.SetSceneVariables(deviceContext, Transform, camera); segment.Shader.setHightLightInstance(deviceContext, selectionInstance.instanceRefID); diff --git a/Mafia2Libs/Utils/Settings/ToolkitSettings.cs b/Mafia2Libs/Utils/Settings/ToolkitSettings.cs index 683a0579..02f3a305 100644 --- a/Mafia2Libs/Utils/Settings/ToolkitSettings.cs +++ b/Mafia2Libs/Utils/Settings/ToolkitSettings.cs @@ -27,7 +27,7 @@ public class ToolkitSettings public static string TexturePath; public static bool Experimental; public static bool bNavigation; - public static bool bTranslokator; + public static bool bTranslokatorTint; public static bool UseMIPS; public static float FieldOfView; @@ -84,7 +84,7 @@ public static void ReadINI() float.TryParse(ReadKey("CameraSpeed", "ModelViewer", "100"), out CameraSpeed); bool.TryParse(ReadKey("EnableExperimental", "ModelViewer", "0"), out Experimental); bool.TryParse(ReadKey("EnableNavigation", "ModelViewer", "0"), out bNavigation); - bool.TryParse(ReadKey("EnableTranslokator", "ModelViewer", "1"), out bTranslokator); + bool.TryParse(ReadKey("EnableTranslokator", "ModelViewer", "1"), out bTranslokatorTint); float.TryParse(ReadKey("FieldOfView", "ModelViewer", "60"), out FieldOfView); bool.TryParse(ReadKey("Logging", "Misc", "True"), out LoggingEnabled); int.TryParse(ReadKey("Language", "Misc", "0"), out Language);