Skip to content

Commit

Permalink
small code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kozmeker committed Nov 28, 2024
1 parent 9a680a8 commit 28be591
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Mafia2Libs/Controls/RenderOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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());
}
}
}
14 changes: 8 additions & 6 deletions Mafia2Libs/Forms/MapEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -2742,8 +2742,10 @@ private void ActorEntryNewTRObjectButton_Click(object sender, EventArgs e)
FrameObjectBase groupRef = SceneData.FrameResource.GetObjectByHash<FrameObjectBase>(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);
Expand All @@ -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))
Expand All @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Mafia2Libs/Rendering/Graphics/RenderTypes/RenderModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Mafia2Libs/Utils/Settings/ToolkitSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 28be591

Please sign in to comment.