From 5dfaba8ea1e84f0b981ac1ea14dbf2ebcf6c4cff Mon Sep 17 00:00:00 2001 From: Max Khon Date: Wed, 18 Jun 2003 09:21:21 +0000 Subject: New port: games/quake2lnx Quake2-LNX project aims to further develop and bug fix original Quake II code released by id Software in 1998, as well as support multiple architectures. It also includes additional rendering drivers, eyecandy stuff from Quake2Max project, and experimental IPv6 support. Submitted by: Alexey Dokuchaev --- games/quake2lnx/files/patch-src::linux::rw_x11.c | 171 +++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 games/quake2lnx/files/patch-src::linux::rw_x11.c (limited to 'games/quake2lnx/files/patch-src::linux::rw_x11.c') diff --git a/games/quake2lnx/files/patch-src::linux::rw_x11.c b/games/quake2lnx/files/patch-src::linux::rw_x11.c new file mode 100644 index 000000000000..3472cb66844e --- /dev/null +++ b/games/quake2lnx/files/patch-src::linux::rw_x11.c @@ -0,0 +1,171 @@ +--- src/linux/rw_x11.c.orig Wed Oct 9 03:54:25 2002 ++++ src/linux/rw_x11.c Mon Jun 16 23:19:40 2003 +@@ -36,7 +36,6 @@ + #include + #include + #ifdef Joystick +-#include + #include + #endif + #include +@@ -58,7 +57,11 @@ + #include + #endif + #ifdef Joystick +-#include ++# if defined(__linux__) ++# include ++# elif defined(__FreeBSD__) ++# include ++# endif + #include + #endif + +@@ -317,8 +320,9 @@ + #ifdef Joystick + static cvar_t *in_joystick; + static qboolean joystick_avail = false; +-static int joy_fd, jx, jy, jt; ++static int joy_fd, jx, jy, center_jx, center_jy; + static cvar_t *j_invert_y; ++static cvar_t *j_sensitivity; + #endif + + static qboolean mlooking; +@@ -357,10 +361,10 @@ + void InitJoystick() { + int i, err; + glob_t pglob; +- struct js_event e; ++ struct joystick j; + + joystick_avail = false; +- err = glob("/dev/js*", 0, NULL, &pglob); ++ err = glob("/dev/joy*", 0, NULL, &pglob); + + if (err) { + switch (err) { +@@ -373,7 +377,7 @@ + default: + ri.Con_Printf(PRINT_ALL, "Error #%d while looking for joysticks\n",err); + } +- return; ++ goto out; + } + + for (i=0;iKey_Event_fp (key_index + e.number, true); +- } +- else { +- in_state->Key_Event_fp (key_index + e.number, false); +- } +- //joy_oldbuttonstate = e.number; +- } +- else if (JS_EVENT_AXIS & e.type) { +- switch (e.number) { +- case 0: +- jx = e.value; +- break; +- case 1: +- jy = e.value; +- break; +- case 3: +- jt = e.value; +- break; +- } +- } ++ if (read(joy_fd, &j, sizeof(struct joystick)) != -1) { ++ if (j.b1) ++ in_state->Key_Event_fp (K_JOY1, true); ++ else ++ in_state->Key_Event_fp (K_JOY1, false); ++ if (j.b2) ++ in_state->Key_Event_fp (K_JOY2, true); ++ else ++ in_state->Key_Event_fp (K_JOY2, false); ++ jx = j.x; jy = j.y; + } + } + #endif +@@ -542,25 +532,26 @@ + } + #ifdef Joystick + if (joystick_avail) { ++ int djx = (jx - center_jx) * j_sensitivity->value / 10, ++ djy = (jy - center_jy) * j_sensitivity->value / 10; + // add joy X/Y movement to cmd + if ( (*in_state->in_strafe_state & 1) || + (lookstrafe->value && mlooking )) +- cmd->sidemove += m_side->value * (jx/100); ++ cmd->sidemove += m_side->value * djx; + else +- in_state->viewangles[YAW] -= m_yaw->value * (jx/100); ++ in_state->viewangles[YAW] -= m_yaw->value * djx; + + if ( (mlooking || freelook->value) && + !(*in_state->in_strafe_state & 1)) + { + if (j_invert_y) +- in_state->viewangles[PITCH] -= m_pitch->value * (jy/100); ++ in_state->viewangles[PITCH] -= m_pitch->value * djy; + else +- in_state->viewangles[PITCH] += m_pitch->value * (jy/100); +- cmd->forwardmove -= m_forward->value * (jt/100); ++ in_state->viewangles[PITCH] += m_pitch->value * djy; + } + else + { +- cmd->forwardmove -= m_forward->value * (jy/100); ++ cmd->forwardmove -= m_forward->value * djy; + } + } + #endif -- cgit v1.2.3