From 4f13ea26c4f47e54e66926f0700cf631e7bb3352 Mon Sep 17 00:00:00 2001 From: Holger Zickner Date: Thu, 8 Jul 2004 15:58:48 +0000 Subject: import of Jake2 version hannover --- src/jake2/sys/IN.java | 112 +++++++++++++++++++++++++++++++----- src/jake2/sys/RW.java | 151 ------------------------------------------------- src/jake2/sys/Sys.java | 6 +- 3 files changed, 103 insertions(+), 166 deletions(-) delete mode 100644 src/jake2/sys/RW.java (limited to 'src/jake2/sys') diff --git a/src/jake2/sys/IN.java b/src/jake2/sys/IN.java index db88226..5935a0a 100644 --- a/src/jake2/sys/IN.java +++ b/src/jake2/sys/IN.java @@ -2,7 +2,7 @@ * IN.java * Copyright (C) 2003 * - * $Id: IN.java,v 1.1 2004-07-07 19:59:51 hzi Exp $ + * $Id: IN.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,8 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.sys; import jake2.Globals; +import jake2.client.CL_input; +import jake2.client.Key; +import jake2.game.Cmd; import jake2.game.usercmd_t; import jake2.qcommon.Cvar; +import jake2.qcommon.xcommand_t; import java.awt.*; @@ -44,9 +48,17 @@ public final class IN extends Globals { static boolean mouse_avail = true; static boolean mouse_active = false; static boolean ignorefirst = false; + + static int mouse_buttonstate; + static int mouse_oldbuttonstate; + + static int old_mouse_x; + static int old_mouse_y; + + static boolean mlooking; public static void ActivateMouse() { - // if (!mouse_avail || c == null) return; + if (!mouse_avail || c == null) return; if (!mouse_active) { KBD.mx = KBD.my = 0; // don't spazz install_grabs(); @@ -55,7 +67,7 @@ public final class IN extends Globals { } public static void DeactivateMouse() { - // if (!mouse_avail || c == null) return; + // if (!mouse_avail || c == null) return; if (mouse_active) { uninstall_grabs(); mouse_active = false; @@ -78,10 +90,13 @@ public final class IN extends Globals { } public static void toggleMouse() { - if (mouse_active) + if (mouse_active) { + mouse_avail=false; DeactivateMouse(); - else + } else { + mouse_avail=true; ActivateMouse(); + } } public static void Init() { @@ -90,25 +105,57 @@ public final class IN extends Globals { } public static void Shutdown() { - RW.IN_Shutdown(); + mouse_avail = false; } public static void Real_IN_Init() { - RW.IN_Init(); + // mouse variables + Globals.m_filter = Cvar.Get("m_filter", "0", 0); + Globals.in_mouse = Cvar.Get("in_mouse", "1", CVAR_ARCHIVE); + Globals.freelook = Cvar.Get("freelook", "0", 0 ); + Globals.lookstrafe = Cvar.Get("lookstrafe", "0", 0); + Globals.sensitivity = Cvar.Get("sensitivity", "3", 0); + Globals.m_pitch = Cvar.Get("m_pitch", "0.022", 0); + Globals.m_yaw = Cvar.Get("m_yaw", "0.022", 0); + Globals.m_forward = Cvar.Get("m_forward", "1", 0); + Globals.m_side = Cvar.Get("m_side", "0.8", 0); + + Cmd.AddCommand("+mlook", new xcommand_t() { + public void execute() {MLookDown();}}); + Cmd.AddCommand("-mlook", new xcommand_t() { + public void execute() {MLookUp();}}); + + Cmd.AddCommand ("force_centerview", new xcommand_t() { + public void execute() {Force_CenterView_f();}}); + + Cmd.AddCommand ("togglemouse", new xcommand_t() { + public void execute() {toggleMouse();}}); + + IN.mouse_avail = true; } public static void Commands() { - RW.IN_Commands(); + int i; + + if (!IN.mouse_avail) + return; + + for (i=0 ; i<3 ; i++) { + if ( (IN.mouse_buttonstate & (1<