Skip to content

Commit

Permalink
Accurate FOV values
Browse files Browse the repository at this point in the history
	modified:   Sonic-06-Mod-Manager/Properties/AssemblyInfo.cs
	modified:   Sonic-06-Mod-Manager/Properties/Settings.Designer.cs
	modified:   Sonic-06-Mod-Manager/Properties/Settings.settings
	modified:   Sonic-06-Mod-Manager/app.config
	modified:   Sonic-06-Mod-Manager/src/Environment3/RushInterface.Designer.cs
	modified:   Sonic-06-Mod-Manager/src/Environment3/RushInterface.cs
	modified:   Sonic-06-Mod-Manager/src/UnifyPatcher.cs
	modified:   Sonic-06-Mod-Manager/src/UnifyProgram.cs
  • Loading branch information
HyperPolygon64 committed Mar 30, 2020
1 parent 87aece0 commit c1411f4
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Sonic-06-Mod-Manager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
[assembly: ComVisible(false)]
[assembly: Guid("277111e3-79d8-41b5-b0d7-7609dff6e36f")]
[assembly: AssemblyVersion("2.0.0.6")]
[assembly: AssemblyFileVersion("3.1.7.0")]
[assembly: AssemblyFileVersion("3.1.8.0")]
4 changes: 2 additions & 2 deletions Sonic-06-Mod-Manager/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Sonic-06-Mod-Manager/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<Value Profile="(Default)">70.0</Value>
</Setting>
<Setting Name="Tweak_FieldOfView" Type="System.Decimal" Scope="User">
<Value Profile="(Default)">90</Value>
<Value Profile="(Default)">0.785398185253143</Value>
</Setting>
<Setting Name="Tweak_AmyHammerRange" Type="System.Decimal" Scope="User">
<Value Profile="(Default)">50.0</Value>
Expand Down
2 changes: 1 addition & 1 deletion Sonic-06-Mod-Manager/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<value>70.0</value>
</setting>
<setting name="Tweak_FieldOfView" serializeAs="String">
<value>90</value>
<value>0.785398185253143</value>
</setting>
<setting name="Tweak_AmyHammerRange" serializeAs="String">
<value>50.0</value>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 30 additions & 17 deletions Sonic-06-Mod-Manager/src/Environment3/RushInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,13 +1118,18 @@ private void SectionButton_InstallMods_Click(object sender, EventArgs e) {
if (ListView_ModsList.Items[i].Checked) {
Label_Status.Text = $"Installing {ListView_ModsList.Items[i].Text}...";

// Install the specified mod
try { ModEngine.InstallMods(ListView_ModsList.Items[i].SubItems[6].Text, ListView_ModsList.Items[i].Text); }
catch (Exception ex) {
// Install the specified mod
#if !DEBUG
try {
#endif
ModEngine.InstallMods(ListView_ModsList.Items[i].SubItems[6].Text, ListView_ModsList.Items[i].Text);
#if !DEBUG
} catch (Exception ex) {
UnifyMessenger.UnifyMessage.ShowDialog($"An error occurred whilst installing your mods...\n\n{ex}",
"Installation failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
#endif

if (Properties.Settings.Default.General_SaveFileRedirection)
// Redirect save data from the specified mod
Expand All @@ -1138,24 +1143,31 @@ private void SectionButton_InstallMods_Click(object sender, EventArgs e) {
Label_Status.Text = $"Installing {mod.Text}...";

// Install the specified mod
try { ModEngine.InstallMods(mod.SubItems[6].Text, mod.Text); }
catch (Exception ex) {
#if !DEBUG
try {
#endif
ModEngine.InstallMods(mod.SubItems[6].Text, mod.Text);
#if !DEBUG
} catch (Exception ex) {
UnifyMessenger.UnifyMessage.ShowDialog($"An error occurred whilst installing your mods...\n\n{ex}",
"Installation failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
#endif

if (Properties.Settings.Default.General_SaveFileRedirection)
if (Properties.Settings.Default.General_SaveFileRedirection)
// Redirect save data from the specified mod
RedirectSaves(mod.SubItems[6].Text, mod.Text);
}
}


#if !DEBUG
try {
#endif
TweakEngine.ApplyTweaks(this); // Begin tweak application
InstallPatches(); // Begin patch installation
}
catch (Exception ex) {
#if !DEBUG
} catch (Exception ex) {
if (_debug) Console.WriteLine(ex.ToString());
if (ex is Win32Exception) {
UnifyMessenger.UnifyMessage.ShowDialog($"Sonic '06 Mod Manager requires Java to decompile Lua scripts. Please install Java and restart your computer...",
Expand All @@ -1167,6 +1179,7 @@ private void SectionButton_InstallMods_Click(object sender, EventArgs e) {
return;
}
}
#endif

// Check skipped list to ensure any errors occurred
if (ModEngine.skipped.Count != 0)
Expand Down Expand Up @@ -1942,27 +1955,27 @@ private void ComboBox_Tweaks_SelectedIndexChanged(object sender, EventArgs e) {
if (Literal.System(Properties.Settings.Default.Path_GameDirectory) == "Xbox 360") {
NumericUpDown_CameraDistance.Value = 350;
NumericUpDown_CameraHeight.Value = 32.5m;
NumericUpDown_FieldOfView.Value = 110;
NumericUpDown_FieldOfView.Value = 0.929929435253143m;

// PlayStation 3 does not support FOV changes
} else {
NumericUpDown_CameraDistance.Value = 450;
NumericUpDown_CameraHeight.Value = 32.5m;
NumericUpDown_FieldOfView.Value = 90;
NumericUpDown_FieldOfView.Value = 0.785398185253143m;
}

// Electronic Entertainment Expo
} else if (ComboBox_CameraType.SelectedIndex == 2) {
NumericUpDown_CameraDistance.Value = 550;
NumericUpDown_CameraHeight.Value = 70;
NumericUpDown_FieldOfView.Value = 90;
NumericUpDown_FieldOfView.Value = 0.785398185253143m;
}

// Retail
} else {
NumericUpDown_CameraDistance.Value = 650;
NumericUpDown_CameraHeight.Value = 70;
NumericUpDown_FieldOfView.Value = 90;
NumericUpDown_FieldOfView.Value = 0.785398185253143m;
}
}

Expand Down Expand Up @@ -2006,7 +2019,7 @@ private void Button_Tweaks_Default(object sender, EventArgs e) {
Properties.Settings.Default.Tweak_CameraType = 0;
Properties.Settings.Default.Tweak_CameraDistance = 650;
Properties.Settings.Default.Tweak_CameraHeight = 70;
Properties.Settings.Default.Tweak_FieldOfView = 90;
Properties.Settings.Default.Tweak_FieldOfView = 0.785398185253143m;
}

// Reset Camera Distance
Expand Down Expand Up @@ -2037,11 +2050,11 @@ private void Button_Tweaks_Default(object sender, EventArgs e) {
{
if (ComboBox_CameraType.SelectedIndex == 1) // Tokyo Game Show
if (isXbox360) // Xbox 360 supports FOV changes
Properties.Settings.Default.Tweak_FieldOfView = 110;
Properties.Settings.Default.Tweak_FieldOfView = 0.929929435253143m;
else // PlayStation 3 does not support FOV changes
Properties.Settings.Default.Tweak_FieldOfView = 90;
Properties.Settings.Default.Tweak_FieldOfView = 0.785398185253143m;
else // Retail
Properties.Settings.Default.Tweak_FieldOfView = 90;
Properties.Settings.Default.Tweak_FieldOfView = 0.785398185253143m;
}

// Reset Amy's Hammer Range
Expand Down
8 changes: 5 additions & 3 deletions Sonic-06-Mod-Manager/src/UnifyPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,8 @@ public static void ApplyTweaks(RushInterface rush) {
decimal cameraHeight = Properties.Settings.Default.Tweak_CameraHeight,
cameraDistance = Properties.Settings.Default.Tweak_CameraDistance,
hammerRange = Properties.Settings.Default.Tweak_AmyHammerRange,
fieldOfView = Properties.Settings.Default.Tweak_FieldOfView,
beginWithRings = Properties.Settings.Default.Tweak_BeginWithRings;
beginWithRings = Properties.Settings.Default.Tweak_BeginWithRings,
fieldOfView = Properties.Settings.Default.Tweak_FieldOfView;

bool forceMSAA = Properties.Settings.Default.Tweak_ForceMSAA,
tailsFlightLimit = Properties.Settings.Default.Tweak_TailsFlightLimit;
Expand Down Expand Up @@ -1450,7 +1450,9 @@ public static void Decompress(string filepath) {

public static void FieldOfView(string filepath, decimal fov) {
using (var stream = File.Open(filepath, FileMode.Open, FileAccess.Write)) {
stream.Position = 0x4F4D; stream.WriteByte(decimal.ToByte(fov));
stream.Position = 0x4F4C;
byte[] fov32 = BitConverter.GetBytes(decimal.ToSingle(fov));
for (int i = fov32.Length - 1; i >= 0; i--) stream.WriteByte(fov32[i]);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sonic-06-Mod-Manager/src/UnifyProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Unify.Environment3
{
static class Program
{
public static readonly string VersionNumber = "Version 3.17"; //-indev-{DateTime.Now.ToString("ddMMyy")}r1";
public static readonly string VersionNumber = "Version 3.18"; //-indev-{DateTime.Now.ToString("ddMMyy")}r1";

public static string ApplicationData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
_7Zip = $"{ApplicationData}\\Unify\\Tools\\7z.exe",
Expand Down

0 comments on commit c1411f4

Please sign in to comment.