diff --git a/patches/net/minecraft/client/Minecraft.java.patch b/patches/net/minecraft/client/Minecraft.java.patch index 98a1da52..8ac6969a 100644 --- a/patches/net/minecraft/client/Minecraft.java.patch +++ b/patches/net/minecraft/client/Minecraft.java.patch @@ -225,7 +225,7 @@ + * The minecriftVerString will be automatically updated by the build scripts, do not modify here. + * Modify minecriftversion.py in root minecrift dir. + */ -+ public final String minecriftVerString = "Minecrift 1.7.10 R2-d21"; ++ public final String minecriftVerString = "Minecrift 1.7.10 R2"; + /* end version */ + /** END MINECRIFT */ + @@ -1182,7 +1182,29 @@ var9 = Mouse.getEventButton(); KeyBinding.setKeyBindState(var9 - 100, Mouse.getEventButtonState()); -@@ -1838,6 +2324,11 @@ +@@ -1808,6 +2294,12 @@ + + if (var4 != 0) + { ++ /** MINECRIFT **/ ++ if ((this.vrSettings.useVrComfort == VRSettings.VR_COMFORT_PITCHANDYAW || this.vrSettings.useVrComfort == VRSettings.VR_COMFORT_YAW) && ++ this.vrSettings.useKeyBindingForComfortYaw) { ++ this.lookaimController.triggerYawTransition(var4 > 0 ? true : false); ++ } ++ else { + this.thePlayer.inventory.changeCurrentItem(var4); + + if (this.gameSettings.noclip) +@@ -1824,6 +2316,8 @@ + + this.gameSettings.noclipRate += (float)var4 * 0.25F; + } ++ } ++ /** END MINECRIFT **/ + } + + if (this.currentScreen == null) +@@ -1838,6 +2332,11 @@ this.currentScreen.handleMouseInput(); } } @@ -1194,7 +1216,7 @@ } if (this.leftClickCounter > 0) -@@ -1889,6 +2380,10 @@ +@@ -1889,6 +2388,10 @@ } else { @@ -1205,7 +1227,7 @@ if (Keyboard.getEventKey() == 1) { this.displayInGameMenu(); -@@ -1932,10 +2427,12 @@ +@@ -1932,10 +2435,12 @@ this.gameSettings.saveOptions(); } @@ -1219,7 +1241,7 @@ if (Keyboard.getEventKey() == 61) { -@@ -1975,6 +2472,11 @@ +@@ -1975,6 +2480,11 @@ } } } @@ -1231,7 +1253,7 @@ } for (var9 = 0; var9 < 9; ++var9) -@@ -2070,6 +2572,12 @@ +@@ -2070,6 +2580,12 @@ this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.getIsKeyPressed() && this.inGameHasFocus); } @@ -1244,7 +1266,7 @@ if (this.theWorld != null) { -@@ -2164,7 +2672,11 @@ +@@ -2164,7 +2680,11 @@ this.mcProfiler.endStartSection("pendingConnection"); this.myNetworkManager.processReceivedPackets(); } @@ -1257,7 +1279,7 @@ this.mcProfiler.endSection(); this.systemTime = getSystemTime(); } -@@ -2174,6 +2686,15 @@ +@@ -2174,6 +2694,15 @@ */ public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) { @@ -1273,7 +1295,7 @@ this.loadWorld((WorldClient)null); System.gc(); ISaveHandler var4 = this.saveLoader.getSaveLoader(folderName, false); -@@ -2207,37 +2728,81 @@ +@@ -2207,37 +2736,81 @@ this.loadingScreen.displaySavingString(I18n.format("menu.loadingLevel", new Object[0])); @@ -1378,7 +1400,7 @@ /** * unloads the current world first -@@ -2252,6 +2817,13 @@ +@@ -2252,6 +2825,13 @@ */ public void loadWorld(WorldClient worldClientIn, String loadingMessage) { @@ -1392,7 +1414,7 @@ if (worldClientIn == null) { NetHandlerPlayClient var3 = this.getNetHandler(); -@@ -2264,6 +2836,23 @@ +@@ -2264,6 +2844,23 @@ if (this.theIntegratedServer != null) { this.theIntegratedServer.initiateShutdown(); @@ -1416,7 +1438,7 @@ } this.theIntegratedServer = null; -@@ -2290,6 +2879,15 @@ +@@ -2290,6 +2887,15 @@ this.mcResourcePackRepository.func_148529_f(); this.setServerData((ServerData)null); this.integratedServerIsRunning = false; @@ -1432,7 +1454,7 @@ } this.mcSoundHandler.stopSounds(); -@@ -2406,10 +3004,12 @@ +@@ -2406,10 +3012,12 @@ return this.thePlayer != null ? this.thePlayer.sendQueue : null; } @@ -1446,7 +1468,7 @@ public static boolean isFancyGraphicsEnabled() { -@@ -2437,107 +3037,117 @@ +@@ -2437,107 +3045,117 @@ Item var2; int var5; @@ -1663,7 +1685,7 @@ if (var1) { -@@ -2810,11 +3420,18 @@ +@@ -2810,11 +3428,18 @@ playerSnooper.addStatToSnooper("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); } @@ -1682,7 +1704,7 @@ for (int var0 = 16384; var0 > 0; var0 >>= 1) { GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, var0, var0, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -@@ -2822,12 +3439,14 @@ +@@ -2822,12 +3447,14 @@ if (var1 != 0) { @@ -1697,7 +1719,7 @@ /** * Returns whether snooping is enabled or not. -@@ -3134,4 +3753,1051 @@ +@@ -3134,4 +3761,1051 @@ } } } diff --git a/src/com/mtbs3d/minecrift/api/IBodyAimController.java b/src/com/mtbs3d/minecrift/api/IBodyAimController.java index a516b094..e6b16073 100644 --- a/src/com/mtbs3d/minecrift/api/IBodyAimController.java +++ b/src/com/mtbs3d/minecrift/api/IBodyAimController.java @@ -53,4 +53,6 @@ public interface IBodyAimController extends IBasePlugin { */ public double ratchetingYawTransitionPercent(); public double ratchetingPitchTransitionPercent(); + + public void triggerYawTransition(boolean isPositive); } diff --git a/src/com/mtbs3d/minecrift/control/Aim.java b/src/com/mtbs3d/minecrift/control/Aim.java index 4fae8ea5..67aa1790 100644 --- a/src/com/mtbs3d/minecrift/control/Aim.java +++ b/src/com/mtbs3d/minecrift/control/Aim.java @@ -37,11 +37,13 @@ public void updateAim(int aimType, float aimPitchAdd, float aimYawAdd, float aim configureComfortMode(); + + // *** Pitch *** + float headPitch = this.mc.headTracker.getHeadPitchDegrees(EyeType.ovrEye_Center); float headPitchDelta = headPitch - this.prevHeadPitch; this.prevHeadPitch = headPitch; - //Pitch if (holdCenter) { aimPitch = headPitch; } @@ -162,11 +164,13 @@ else if( this.mc.vrSettings.allowMousePitchInput ) // No keyhole with allow boolean pitchGood = aimPitch != 90 && aimPitch != -90; + + // *** Yaw *** + float headYaw = this.mc.headTracker.getHeadYawDegrees(EyeType.ovrEye_Center); float headYawDelta = headYaw - this.prevHeadYaw; this.prevHeadYaw = headYaw; - // Yaw if (holdCenter) { aimYaw = headYaw; } @@ -200,9 +204,19 @@ else if (aimYaw < keyholeYawLeft) } // Only accrue controller yaw *delta* while touching the edge of the keyhole... - if( pitchGood && aimYawAdd != 0 ) + if( pitchGood && aimYawAdd != 0) { aimYaw += aimYawAdd; + + // If we are using cycle left / cycle right key mapping for yaw control, + // don't accrue any additional yaw here... + if(this.mc.vrSettings.useKeyBindingForComfortYaw && aimYaw > keyholeYawRight) { + aimYaw = keyholeYawRight; + } + else if(this.mc.vrSettings.useKeyBindingForComfortYaw && aimYaw < keyholeYawLeft) { + aimYaw = keyholeYawLeft; + } + if( aimYaw > keyholeYawRight ) { if (aimYawAdd > 0 || aimType != VRSettings.AIM_TYPE_LOOSE) @@ -245,7 +259,6 @@ else if( aimYaw < keyholeYawLeft ) discreteYaw.update(0, currentTimeSecs); bodyYaw = (float)discreteYaw.getCurrent(this.mc.PredictedDisplayTimeSeconds); bodyYaw -= (!this.mc.vrSettings.crosshairHeadRelative ? 0 : headYawDelta); - updatedYaw = true; } bodyYaw %= 360; @@ -294,6 +307,10 @@ static public double getYawTransitionPercent() { return discreteYaw._percent; } + static public void triggerYawChange(boolean isPositive) { + discreteYaw.triggerChange(isPositive); + } + static public double getPitchTransitionPercent() { return discretePitch._percent; } diff --git a/src/com/mtbs3d/minecrift/control/DiscreteAngle.java b/src/com/mtbs3d/minecrift/control/DiscreteAngle.java index 0ca35ff8..d424031a 100644 --- a/src/com/mtbs3d/minecrift/control/DiscreteAngle.java +++ b/src/com/mtbs3d/minecrift/control/DiscreteAngle.java @@ -92,6 +92,15 @@ else if (_state == DiscreteAngleState.TRACKING && _delta <= -_trigger) } } + public void triggerChange(boolean isPositive) { + if (isPositive) { + _delta += _trigger; + } + else { + _delta -= _trigger; + } + } + public double getCurrent(double currentTimeSecs) { double angle = _currentReported; diff --git a/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java b/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java index 52c899e7..1eb826aa 100644 --- a/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java +++ b/src/com/mtbs3d/minecrift/gui/GuiLocomotionSettings.java @@ -20,7 +20,7 @@ public class GuiLocomotionSettings extends BaseGuiSettings implements GuiEventEx VRSettings.VrOptions.DUMMY, VRSettings.VrOptions.DUMMY, VRSettings.VrOptions.USE_VR_COMFORT, - VRSettings.VrOptions.DUMMY, + VRSettings.VrOptions.VR_COMFORT_USE_KEY_BINDING_FOR_YAW, VRSettings.VrOptions.VR_COMFORT_TRANSITION_LINEAR, VRSettings.VrOptions.VR_COMFORT_TRANSITION_ANGLE_DEGS, VRSettings.VrOptions.VR_COMFORT_TRANSITION_TIME_SECS, @@ -99,7 +99,15 @@ private boolean getEnabledState(VRSettings.VrOptions var8) (s == VRSettings.VrOptions.VR_COMFORT_TRANSITION_ANGLE_DEGS.getEnumString() || s == VRSettings.VrOptions.VR_COMFORT_TRANSITION_TIME_SECS.getEnumString() || s == VRSettings.VrOptions.VR_COMFORT_TRANSITION_BLANKING_MODE.getEnumString() || - s == VRSettings.VrOptions.VR_COMFORT_TRANSITION_LINEAR.getEnumString())) + s == VRSettings.VrOptions.VR_COMFORT_TRANSITION_LINEAR.getEnumString() || + s == VRSettings.VrOptions.VR_COMFORT_USE_KEY_BINDING_FOR_YAW.getEnumString())) + { + return false; + } + + if ((this.guivrSettings.useVrComfort != this.guivrSettings.VR_COMFORT_YAW && + this.guivrSettings.useVrComfort != this.guivrSettings.VR_COMFORT_PITCHANDYAW) && + s == VRSettings.VrOptions.VR_COMFORT_USE_KEY_BINDING_FOR_YAW.getEnumString()) { return false; } @@ -147,6 +155,7 @@ else if (par1GuiButton.id == ID_GENERIC_DEFAULTS) vr.movementQuantisation = 0; vr.inertiaFactor = VRSettings.INERTIA_NORMAL; vr.allowPitchAffectsHeightWhileFlying = false; + vr.useKeyBindingForComfortYaw = false; Minecraft.getMinecraft().gameSettings.viewBobbing = true; Minecraft.getMinecraft().gameSettings.saveOptions(); @@ -290,6 +299,17 @@ protected String[] getTooltipLines(String displayString, int buttonId) " ON: (Recommended) Pitch input affects elevation", " while flying. An enjoyable travel experience!" }; + case VR_COMFORT_USE_KEY_BINDING_FOR_YAW: + return new String[]{ + "Determines how a comfort mode yaw transition (player", + "turn to the left or right) is triggered.", + " Crosshair: (Default) Moving the crosshair to the edge", + " of the keyhole will trigger a yaw", + " transition.", + " Key: The 'Cycle Item Left / Right' key or", + " controller binding wil instead be used to", + " trigger a yaw transition." + }; default: return null; } diff --git a/src/com/mtbs3d/minecrift/provider/MCController.java b/src/com/mtbs3d/minecrift/provider/MCController.java index 9541be22..70f18401 100644 --- a/src/com/mtbs3d/minecrift/provider/MCController.java +++ b/src/com/mtbs3d/minecrift/provider/MCController.java @@ -558,4 +558,9 @@ public void loadDefaults() { ProfileManager.loadControllerDefaults(); loadBindings(); } + + @Override + public void triggerYawTransition(boolean isPositive) { + this.joyAim.triggerYawChange(isPositive); + } } diff --git a/src/com/mtbs3d/minecrift/provider/MCHydra.java b/src/com/mtbs3d/minecrift/provider/MCHydra.java index e8e9da41..06a03d44 100644 --- a/src/com/mtbs3d/minecrift/provider/MCHydra.java +++ b/src/com/mtbs3d/minecrift/provider/MCHydra.java @@ -794,4 +794,9 @@ public void saveOptions() { public void loadDefaults() { } + + @Override + public void triggerYawTransition(boolean isPositive) { + this.discreteYaw.triggerChange(isPositive); + } } diff --git a/src/com/mtbs3d/minecrift/provider/MCMouse.java b/src/com/mtbs3d/minecrift/provider/MCMouse.java index 36e5c8dd..63316c41 100644 --- a/src/com/mtbs3d/minecrift/provider/MCMouse.java +++ b/src/com/mtbs3d/minecrift/provider/MCMouse.java @@ -156,4 +156,9 @@ public void saveOptions() { public void loadDefaults() { } + + @Override + public void triggerYawTransition(boolean isPositive) { + this.aim.triggerYawChange(isPositive); + } } diff --git a/src/com/mtbs3d/minecrift/settings/VRSettings.java b/src/com/mtbs3d/minecrift/settings/VRSettings.java index 43dc122b..f883efc5 100644 --- a/src/com/mtbs3d/minecrift/settings/VRSettings.java +++ b/src/com/mtbs3d/minecrift/settings/VRSettings.java @@ -225,6 +225,7 @@ public class VRSettings public static final String LEGACY_OPTIONS_VR_BACKUP_FILENAME = "optionsvr.bak"; public boolean allowAvatarIK = false; public boolean hideGui = true; + public boolean useKeyBindingForComfortYaw = false; private Minecraft mc; @@ -862,6 +863,11 @@ public void loadOptions(JSONObject theProfiles) this.allowForwardPlusStrafe = optionTokens[1].equals("true"); } + if (optionTokens[0].equals("useKeyBindingForComfortYaw")) + { + this.useKeyBindingForComfortYaw = optionTokens[1].equals("true"); + } + if (optionTokens[0].equals("vrComfortTransitionLinear")) { this.vrComfortTransitionLinear = optionTokens[1].equals("true"); @@ -1274,6 +1280,8 @@ else if (this.inertiaFactor == INERTIA_MASSIVE) }; case ALLOW_FORWARD_PLUS_STRAFE: return this.allowForwardPlusStrafe ? var4 + "Allow" : var4 + "Disallow"; + case VR_COMFORT_USE_KEY_BINDING_FOR_YAW: + return this.useKeyBindingForComfortYaw ? var4 + "Key" : var4 + "Crosshair"; case VR_COMFORT_TRANSITION_LINEAR: return this.vrComfortTransitionLinear ? var4 + "Linear" : var4 + "Sinusoidal"; case MOVEMENT_ACCELERATION_SCALE_FACTOR: @@ -1634,6 +1642,9 @@ public void setOptionValue(VRSettings.VrOptions par1EnumOptions, int par2) case ALLOW_FORWARD_PLUS_STRAFE: this.allowForwardPlusStrafe = !this.allowForwardPlusStrafe; break; + case VR_COMFORT_USE_KEY_BINDING_FOR_YAW: + this.useKeyBindingForComfortYaw = !this.useKeyBindingForComfortYaw; + break; case VR_COMFORT_TRANSITION_LINEAR: this.vrComfortTransitionLinear = !this.vrComfortTransitionLinear; break; @@ -2079,6 +2090,7 @@ private void saveOptions(JSONObject theProfiles) var5.println("inertiaFactor:" + this.inertiaFactor); var5.println("useVrComfort:" + this.useVrComfort); var5.println("allowForwardPlusStrafe:" + this.allowForwardPlusStrafe); + var5.println("useKeyBindingForComfortYaw:" + this.useKeyBindingForComfortYaw); var5.println("vrComfortTransitionLinear:" + this.vrComfortTransitionLinear); var5.println("movementAccelerationScaleFactor:" + this.movementAccelerationScaleFactor); var5.println("vrComfortTransitionTimeSecs:" + this.vrComfortTransitionTimeSecs); @@ -2392,6 +2404,7 @@ public static enum VrOptions INERTIA_FACTOR("Player Inertia",false,true), USE_VR_COMFORT("VR Comfort", false, true), ALLOW_FORWARD_PLUS_STRAFE("Forward + Strafe", false, true), + VR_COMFORT_USE_KEY_BINDING_FOR_YAW("Trigger Yaw With", false, true), VR_COMFORT_TRANSITION_LINEAR("Transition Mode", false, true), MOVEMENT_ACCELERATION_SCALE_FACTOR("Player Accel.", true, false), VR_COMFORT_TRANSITION_TIME_SECS("Transition Time", true, false), diff --git a/src/com/mtbs3d/minecrift/settings/profile/ProfileManager.java b/src/com/mtbs3d/minecrift/settings/profile/ProfileManager.java index 85debddd..48c7bf08 100644 --- a/src/com/mtbs3d/minecrift/settings/profile/ProfileManager.java +++ b/src/com/mtbs3d/minecrift/settings/profile/ProfileManager.java @@ -1,6 +1,5 @@ package com.mtbs3d.minecrift.settings.profile; -import com.mtbs3d.minecrift.provider.MCController; import com.mtbs3d.minecrift.settings.VRSettings; import org.json.JSONObject; import org.json.JSONTokener;