summaryrefslogtreecommitdiff
path: root/Plugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Plugin.cs')
-rwxr-xr-xPlugin.cs84
1 files changed, 72 insertions, 12 deletions
diff --git a/Plugin.cs b/Plugin.cs
index a1722d9..ca042e1 100755
--- a/Plugin.cs
+++ b/Plugin.cs
@@ -539,8 +539,12 @@ namespace NewCamera
private List<nint> jiggleBones = new List<nint>();
private bool attachToChest = false;
+ private bool toggleAttachToChest = false;
private bool swapChestSides = false;
private float chestMoveScale = 0.25f;
+ private bool setChestIndex = false;
+ private int chestBoneIndex1 = 0;
+ private int chestBoneIndex2 = 1;
private nint chestBone1 = 0x0;
private nint chestBone2 = 0x0;
@@ -1510,7 +1514,7 @@ namespace NewCamera
}
// PadLx/y is read in WritePadInputHook().
- if (buttonWasDown(Button.L2) && buttonWasDown(Button.R2)) // Left stick zoom.
+ if ((buttonWasDown(Button.L2) && buttonWasDown(Button.R2)) || toggleAttachToChest)
{
if (player != null && attachToChest && chestBone1 != 0x0 && chestBone2 != 0x0)
{
@@ -1520,11 +1524,11 @@ namespace NewCamera
ref Vector3 jiggle1 = ref MemoryUtil.GetRef<Vector3>((swapChestSides ? chestBone2 : chestBone1) + 0xD0);
ref Vector3 jiggle2 = ref MemoryUtil.GetRef<Vector3>((swapChestSides ? chestBone1 : chestBone2) + 0xD0);
float scale = (Int16.MaxValue / adjustedSpeed / chestMoveScale);
- jiggle1 -= (right * (PadLx / scale)) + (up * (PadLy / scale));
- jiggle2 -= (right * (PadRx / scale)) + (up * (PadRy / scale));
+ jiggle1 -= (right * (PadRx / scale)) + (up * (PadRy / scale));
+ jiggle2 -= (right * (PadLx / scale)) + (up * (PadLy / scale));
lockCameraLook = true;
}
- else
+ else // Left stick zoom.
{
float Ly = PadLy / (Int16.MaxValue / adjustedZoomSpeed(deltaTime));
cameraFov = Math.Clamp(cameraFov - Ly, 1.0f, 179.0f);
@@ -2665,24 +2669,35 @@ namespace NewCamera
if (!jiggleBones.Contains(jiggleData))
{
jiggleBones.Add(jiggleData);
- if (part == Armor.Body)
+ int jiggleIndex = jiggleBones.Count() - 1;
+ if (setChestIndex)
+ {
+ if (jiggleIndex == chestBoneIndex1)
+ {
+ chestBone1 = jiggleData;
+ }
+ if (jiggleIndex == chestBoneIndex2)
+ {
+ chestBone2 = jiggleData;
+ }
+ }
+ else if (part == Armor.Body)
{
// Guess that chest bones are the last jiggle bones on the body.
if (chestBone1 == 0x0)
{
chestBone1 = jiggleData;
+ chestBoneIndex1 = jiggleIndex;
}
else
{
if (chestBone2 != 0x0)
{
- chestBone2 = chestBone1;
- chestBone1 = jiggleData;
- }
- else
- {
- chestBone2 = jiggleData;
+ chestBone1 = chestBone2;
+ chestBoneIndex1 = chestBoneIndex2;
}
+ chestBone2 = jiggleData;
+ chestBoneIndex2 = jiggleIndex;
}
}
}
@@ -3277,7 +3292,13 @@ namespace NewCamera
}
ImGui.PopID(); // Left Leg.
ImGui.Separator();
- ImGui.Checkbox("Attach to Chest", ref attachToChest);
+ if (ImGui.Checkbox("Attach to Chest", ref attachToChest))
+ {
+ if (!attachToChest)
+ {
+ toggleAttachToChest = false;
+ }
+ }
if (ImGui.BeginItemTooltip())
{
ImGui.Text("While in Free Camera, hold LT + RT and move your joysticks (armor has to have jiggle physics).");
@@ -3288,9 +3309,48 @@ namespace NewCamera
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);
}
ImGui.SameLine();
+ ImGui.Checkbox("Toggle", ref toggleAttachToChest);
+ ImGui.SameLine();
ImGui.Checkbox("Swap Sides", ref swapChestSides);
ImGui.SetNextItemWidth(width * 0.35f);
ImGui.DragFloat("Strength", ref chestMoveScale, 0.001f);
+ ImGui.Checkbox("Set Index", ref setChestIndex);
+ ImGui.SameLine();
+ if (!setChestIndex)
+ {
+ ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);
+ }
+ if (setChestIndex && chestBone1 == 0x0)
+ {
+ ImGui.PushStyleColor(ImGuiCol.Text, 0xFF0000FF);
+ }
+ ImGui.SetNextItemWidth(width * 0.17f);
+ if (ImGui.InputInt("##Index 1", ref chestBoneIndex1, 1))
+ {
+ if (chestBoneIndex1 < 0) chestBoneIndex1 = 0;
+ }
+ if (setChestIndex && chestBone1 == 0x0)
+ {
+ ImGui.PopStyleColor();
+ }
+ ImGui.SameLine();
+ if (setChestIndex && chestBone2 == 0x0)
+ {
+ ImGui.PushStyleColor(ImGuiCol.Text, 0xFF0000FF);
+ }
+ ImGui.SetNextItemWidth(width * 0.17f);
+ if (ImGui.InputInt("##Index 2", ref chestBoneIndex2, 1))
+ {
+ if (chestBoneIndex2 < 0) chestBoneIndex2 = 0;
+ }
+ if (setChestIndex && chestBone2 == 0x0)
+ {
+ ImGui.PopStyleColor();
+ }
+ if (!setChestIndex)
+ {
+ ImGui.PopStyleVar();
+ }
if (!attachToChest)
{
ImGui.PopStyleVar();