Freed mouse during rendering process

Made replay_recordings and replay_videos folder customizable through config file (not recommended)
This commit is contained in:
Marius Metzger
2015-04-06 19:15:55 +02:00
parent 4ed92c3739
commit 352fcbde4e
13 changed files with 126 additions and 45 deletions

View File

@@ -33,6 +33,7 @@ import eu.crushedpixel.replaymod.holders.TimeKeyframe;
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import eu.crushedpixel.replaymod.replay.ReplayProcess;
import eu.crushedpixel.replaymod.utils.MouseUtils;
import eu.crushedpixel.replaymod.video.VideoWriter;
@@ -82,7 +83,7 @@ public class GuiReplayOverlay extends Gui {
@SubscribeEvent
public void onRenderGui(RenderGameOverlayEvent event) {
if(VideoWriter.isRecording() && !(mc.currentScreen instanceof GuiCancelRender)) {
if(ReplayProcess.isVideoRecording() && ReplayHandler.isInPath() && !(mc.currentScreen instanceof GuiCancelRender)) {
event.setCanceled(true);
}
}
@@ -113,10 +114,6 @@ public class GuiReplayOverlay extends Gui {
GL11.glEnable(GL11.GL_BLEND);
if(!ReplayHandler.isInReplay()) {
return;
}
Point mousePoint = MouseUtils.getMousePos();
final int mouseX = (int) mousePoint.getX();
final int mouseY = (int) mousePoint.getY();
@@ -250,7 +247,8 @@ public class GuiReplayOverlay extends Gui {
mc.renderEngine.bindTexture(extended_gui);
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)
&& !ReplayHandler.isInPath()) {
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof PositionKeyframe)) {
addPlaceKeyframe();
} else {
@@ -292,7 +290,7 @@ public class GuiReplayOverlay extends Gui {
mc.renderEngine.bindTexture(extended_gui);
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof TimeKeyframe)) {
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof TimeKeyframe) && !ReplayHandler.isInPath()) {
addTimeKeyframe();
} else {
ReplayHandler.removeKeyframe(ReplayHandler.getSelected());

View File

@@ -16,6 +16,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
import eu.crushedpixel.replaymod.gui.elements.GuiMouseInput;
import eu.crushedpixel.replaymod.reflection.MCPNames;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import eu.crushedpixel.replaymod.replay.ReplayProcess;
@@ -70,13 +71,32 @@ public class TickAndRenderListener {
}
}
//private boolean f1Down = false;
@SubscribeEvent
public void tick(TickEvent event) {
if(!ReplayHandler.isInReplay()) return;
/*
if(Keyboard.getEventKeyState() && Keyboard.isKeyDown(Keyboard.KEY_F1)
&& ReplayHandler.isInPath() && !ReplayProcess.isVideoRecording()
&& mc.currentScreen instanceof GuiMouseInput && !f1Down) {
mc.gameSettings.hideGUI = !mc.gameSettings.hideGUI;
}
f1Down = Keyboard.isKeyDown(Keyboard.KEY_F1) && Keyboard.getEventKeyState();
*/
if(ReplayHandler.getCameraEntity() != null)
ReplayHandler.getCameraEntity().updateMovement();
if(ReplayHandler.isInPath()) ReplayProcess.unblockAndTick(true);
if(!ReplayHandler.isInPath()) onMouseMove(new MouseEvent());
if(ReplayHandler.isInPath()) {
ReplayProcess.unblockAndTick(true);
if(ReplayProcess.isVideoRecording() &&
!(mc.currentScreen instanceof GuiMouseInput || mc.currentScreen instanceof GuiCancelRender)) {
mc.displayGuiScreen(new GuiMouseInput());
}
}
else onMouseMove(new MouseEvent());
FMLCommonHandler.instance().bus().post(new InputEvent.KeyInputEvent());
}
@@ -95,7 +115,7 @@ public class TickAndRenderListener {
Mouse.setGrabbed(true);
}
if (mc.inGameHasFocus && flag)
if (mc.inGameHasFocus && flag && !(ReplayHandler.isInPath()))
{
mc.mouseHelper.mouseXYChange();
float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;