Skip to content

Commit

Permalink
Merge pull request #6 from FFXIV-CombatReborn/DevIcWa
Browse files Browse the repository at this point in the history
Resolve Issue around logic on HeightCameraSettings and reset function of it
  • Loading branch information
IncognitoWater authored Jul 7, 2024
2 parents 949d417 + 222fa2b commit 9b8605d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Configuration : IPluginConfiguration
[JsonIgnore] public static readonly float ZoomMaxDefault = 20f;
[JsonIgnore] public static readonly float AngleMinDefault = -1.483529806f;
[JsonIgnore] public static readonly float AngleMaxDefault = 0.7853981853f;
[JsonIgnore] public static readonly float HeightCamPositionDefault = 0.0f;
[JsonIgnore] public static readonly float LookAtHeightOffsetDefault = 0.0f;

public int Version { get; set; }

Expand All @@ -29,7 +29,7 @@ public class Configuration : IPluginConfiguration
public float ZoomMin = ZoomMinDefault;
public float ZoomMax = ZoomMaxDefault;

public float HeightCamPosition = HeightCamPositionDefault;
public float LookAtHeightOffset = LookAtHeightOffsetDefault;


// Add any other properties or methods here.
Expand Down
4 changes: 3 additions & 1 deletion EasyZoomRebornPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ ITextureProvider textureProvider
Marshal.StructureToPtr(Configuration.FovMax, FovMax, true);
Marshal.StructureToPtr(Configuration.ZoomMin, ZoomMin, true);
Marshal.StructureToPtr(Configuration.ZoomMax, ZoomMax, true);
Marshal.StructureToPtr(Configuration.LookAtHeightOffset,LookAtHeightOffset,true);

Hook();
}
Expand All @@ -143,6 +144,7 @@ private void ClientState_OnLogin()
Marshal.StructureToPtr(Configuration.FovMax, FovMax, true);
Marshal.StructureToPtr(Configuration.ZoomMin, ZoomMin, true);
Marshal.StructureToPtr(Configuration.ZoomMax, ZoomMax, true);
Marshal.StructureToPtr(Configuration.LookAtHeightOffset,LookAtHeightOffset,true);
}
private static GameCamera* Cam => CameraManager->worldCamera;

Expand All @@ -155,7 +157,7 @@ private void ClientState_OnLogin()
public static IntPtr AngleMin => (IntPtr)(&Cam->minVRotation);
public static IntPtr AngleMax => (IntPtr)(&Cam->maxVRotation);

public static IntPtr HeightCamPosition => (IntPtr)(&Cam->lookAtHeightOffset);
public static IntPtr LookAtHeightOffset => (IntPtr)(&Cam->lookAtHeightOffset);


public static IntPtr ZeroFloat;
Expand Down
10 changes: 5 additions & 5 deletions SettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ public void DrawGeneralTab()
EasyZoomRebornPlugin.Configuration.Save();
}

if (ImGui.DragScalar("Camera Height", ImGuiDataType.Float, HeightCamPosition, 0.05f, MinFloatHeight, MaxFloatHeight, Marshal.PtrToStructure<float>(HeightCamPosition).ToString(), ImGuiSliderFlags.Logarithmic))
if (ImGui.DragScalar("Look At Height Offset", ImGuiDataType.Float, LookAtHeightOffset, 0.05f, MinFloatHeight, MaxFloatHeight, Marshal.PtrToStructure<float>(LookAtHeightOffset).ToString(), ImGuiSliderFlags.Logarithmic))
{
EasyZoomRebornPlugin.Configuration.HeightCamPosition = Marshal.PtrToStructure<float>(HeightCamPosition);
EasyZoomRebornPlugin.Configuration.LookAtHeightOffset = Marshal.PtrToStructure<float>(LookAtHeightOffset);
EasyZoomRebornPlugin.Configuration.Save();
}
if (ImGui.IsItemHovered() && ImGui.IsMouseDown(ImGuiMouseButton.Right))
{
Marshal.StructureToPtr(HeightCamPositionDefault, HeightCamPosition, true);
EasyZoomRebornPlugin.Configuration.HeightCamPosition = Marshal.PtrToStructure<float>(HeightCamPosition);
Marshal.StructureToPtr(LookAtHeightOffsetDefault, LookAtHeightOffset, true);
EasyZoomRebornPlugin.Configuration.LookAtHeightOffset = Marshal.PtrToStructure<float>(LookAtHeightOffset);
EasyZoomRebornPlugin.Configuration.Save();
}
ImGui.Spacing();
Expand Down Expand Up @@ -177,7 +177,7 @@ public static void OpenUrl(string url)
public SettingsWindow(string name) : base(name)
{
Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollWithMouse;
Size = new Vector2(400 * _scale, 300 *_scale);
Size = new Vector2(480 * _scale, 300 *_scale);
}
}
}

0 comments on commit 9b8605d

Please sign in to comment.