vkQuake2 doxygen  1.0 dev
input.h File Reference

Go to the source code of this file.

Functions

void IN_Init (void)
 
void IN_Shutdown (void)
 
void IN_Commands (void)
 
void IN_Frame (void)
 
void IN_Move (usercmd_t *cmd)
 
void IN_Activate (qboolean active)
 

Function Documentation

◆ IN_Activate()

void IN_Activate ( qboolean  active)

Definition at line 399 of file in_win.c.

400 {
401  in_appactive = active;
402  mouseactive = !active; // force a new window check or turn off
403 }

Referenced by AppActivate(), and MainWndProc().

◆ IN_Commands()

void IN_Commands ( void  )

Definition at line 649 of file in_win.c.

650 {
651  int i, key_index;
652  DWORD buttonstate, povstate;
653 
654  if (!joy_avail)
655  {
656  return;
657  }
658 
659 
660  // loop through the joystick buttons
661  // key a joystick event or auxillary event for higher number buttons for each state change
662  buttonstate = ji.dwButtons;
663  for (i=0 ; i < joy_numbuttons ; i++)
664  {
665  if ( (buttonstate & (1<<i)) && !(joy_oldbuttonstate & (1<<i)) )
666  {
667  key_index = (i < 4) ? K_JOY1 : K_AUX1;
668  Key_Event (key_index + i, true, 0);
669  }
670 
671  if ( !(buttonstate & (1<<i)) && (joy_oldbuttonstate & (1<<i)) )
672  {
673  key_index = (i < 4) ? K_JOY1 : K_AUX1;
674  Key_Event (key_index + i, false, 0);
675  }
676  }
677  joy_oldbuttonstate = buttonstate;
678 
679  if (joy_haspov)
680  {
681  // convert POV information into 4 bits of state information
682  // this avoids any potential problems related to moving from one
683  // direction to another without going through the center position
684  povstate = 0;
685  if(ji.dwPOV != JOY_POVCENTERED)
686  {
687  if (ji.dwPOV == JOY_POVFORWARD)
688  povstate |= 0x01;
689  if (ji.dwPOV == JOY_POVRIGHT)
690  povstate |= 0x02;
691  if (ji.dwPOV == JOY_POVBACKWARD)
692  povstate |= 0x04;
693  if (ji.dwPOV == JOY_POVLEFT)
694  povstate |= 0x08;
695  }
696  // determine which bits have changed and key an auxillary event for each change
697  for (i=0 ; i < 4 ; i++)
698  {
699  if ( (povstate & (1<<i)) && !(joy_oldpovstate & (1<<i)) )
700  {
701  Key_Event (K_AUX29 + i, true, 0);
702  }
703 
704  if ( !(povstate & (1<<i)) && (joy_oldpovstate & (1<<i)) )
705  {
706  Key_Event (K_AUX29 + i, false, 0);
707  }
708  }
709  joy_oldpovstate = povstate;
710  }
711 }

Referenced by CL_SendCommand().

◆ IN_Frame()

void IN_Frame ( void  )

Definition at line 413 of file in_win.c.

414 {
415  if (!mouseinitialized)
416  return;
417 
418  if (!in_mouse || !in_appactive)
419  {
421  return;
422  }
423 
424  if ( !cl.refresh_prepped
425  || cls.key_dest == key_console
426  || cls.key_dest == key_menu)
427  {
428  // temporarily deactivate if in fullscreen
429  if (Cvar_VariableValue ("vid_fullscreen") == 0)
430  {
432  return;
433  }
434  }
435 
436  IN_ActivateMouse ();
437 }

Referenced by CL_Frame().

◆ IN_Init()

void IN_Init ( void  )

Definition at line 339 of file in_win.c.

340 {
341  // mouse variables
342  m_filter = Cvar_Get ("m_filter", "0", 0);
343  in_mouse = Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
344 
345  // joystick variables
346  in_joystick = Cvar_Get ("in_joystick", "0", CVAR_ARCHIVE);
347  joy_name = Cvar_Get ("joy_name", "joystick", 0);
348  joy_advanced = Cvar_Get ("joy_advanced", "0", 0);
349  joy_advaxisx = Cvar_Get ("joy_advaxisx", "0", 0);
350  joy_advaxisy = Cvar_Get ("joy_advaxisy", "0", 0);
351  joy_advaxisz = Cvar_Get ("joy_advaxisz", "0", 0);
352  joy_advaxisr = Cvar_Get ("joy_advaxisr", "0", 0);
353  joy_advaxisu = Cvar_Get ("joy_advaxisu", "0", 0);
354  joy_advaxisv = Cvar_Get ("joy_advaxisv", "0", 0);
355  joy_forwardthreshold = Cvar_Get ("joy_forwardthreshold", "0.15", 0);
356  joy_sidethreshold = Cvar_Get ("joy_sidethreshold", "0.15", 0);
357  joy_upthreshold = Cvar_Get ("joy_upthreshold", "0.15", 0);
358  joy_pitchthreshold = Cvar_Get ("joy_pitchthreshold", "0.15", 0);
359  joy_yawthreshold = Cvar_Get ("joy_yawthreshold", "0.15", 0);
360  joy_forwardsensitivity = Cvar_Get ("joy_forwardsensitivity", "-1", 0);
361  joy_sidesensitivity = Cvar_Get ("joy_sidesensitivity", "-1", 0);
362  joy_upsensitivity = Cvar_Get ("joy_upsensitivity", "-1", 0);
363  joy_pitchsensitivity = Cvar_Get ("joy_pitchsensitivity", "1", 0);
364  joy_yawsensitivity = Cvar_Get ("joy_yawsensitivity", "-1", 0);
365 
366  // centering
367  v_centermove = Cvar_Get ("v_centermove", "0.15", 0);
368  v_centerspeed = Cvar_Get ("v_centerspeed", "500", 0);
369 
370  Cmd_AddCommand ("+mlook", IN_MLookDown);
371  Cmd_AddCommand ("-mlook", IN_MLookUp);
372 
373  Cmd_AddCommand ("joy_advancedupdate", Joy_AdvancedUpdate_f);
374 
375  IN_StartupMouse ();
377 }

Referenced by CL_Init().

◆ IN_Move()

void IN_Move ( usercmd_t cmd)

Definition at line 444 of file in_win.c.

445 {
446  IN_MouseMove (cmd);
447 
448  if (ActiveApp)
449  IN_JoyMove (cmd);
450 }

Referenced by CL_CreateCmd().

◆ IN_Shutdown()

void IN_Shutdown ( void  )

Definition at line 384 of file in_win.c.

385 {
387 }

Referenced by CL_Shutdown().

IN_MLookUp
void IN_MLookUp(void)
Definition: in_win.c:113
IN_JoyMove
void IN_JoyMove(usercmd_t *cmd)
Definition: in_win.c:747
v_centerspeed
cvar_t * v_centerspeed
Definition: in_win.c:331
Key_Event
void Key_Event(int key, qboolean down, unsigned time)
Definition: keys.c:744
joy_forwardsensitivity
cvar_t * joy_forwardsensitivity
Definition: in_win.c:76
IN_StartupJoystick
void IN_StartupJoystick(void)
Definition: in_win.c:479
joy_avail
qboolean joy_avail
Definition: in_win.c:83
K_JOY1
#define K_JOY1
Definition: keys.h:89
joy_name
cvar_t * joy_name
Definition: in_win.c:64
joy_advaxisr
cvar_t * joy_advaxisr
Definition: in_win.c:69
joy_sidesensitivity
cvar_t * joy_sidesensitivity
Definition: in_win.c:77
joy_oldpovstate
DWORD joy_oldpovstate
Definition: in_win.c:84
in_mouse
cvar_t * in_mouse
Definition: in_win.c:55
i
int i
Definition: q_shared.c:305
IN_DeactivateMouse
void IN_DeactivateMouse(void)
Definition: in_win.c:190
joy_upsensitivity
cvar_t * joy_upsensitivity
Definition: in_win.c:81
joy_oldbuttonstate
DWORD joy_oldbuttonstate
Definition: in_win.c:84
Joy_AdvancedUpdate_f
void Joy_AdvancedUpdate_f(void)
Definition: in_win.c:577
joy_pitchthreshold
cvar_t * joy_pitchthreshold
Definition: in_win.c:74
Cvar_Get
cvar_t * Cvar_Get(char *var_name, char *var_value, int flags)
Definition: cvar.c:127
joy_yawthreshold
cvar_t * joy_yawthreshold
Definition: in_win.c:75
key_menu
@ key_menu
Definition: client.h:200
joy_sidethreshold
cvar_t * joy_sidethreshold
Definition: in_win.c:73
IN_MLookDown
void IN_MLookDown(void)
Definition: in_win.c:112
in_joystick
cvar_t * in_joystick
Definition: in_win.c:56
joy_yawsensitivity
cvar_t * joy_yawsensitivity
Definition: in_win.c:79
K_AUX29
#define K_AUX29
Definition: keys.h:126
joy_haspov
qboolean joy_haspov
Definition: in_win.c:83
joy_advaxisx
cvar_t * joy_advaxisx
Definition: in_win.c:66
Cmd_AddCommand
void Cmd_AddCommand(char *cmd_name, xcommand_t function)
Definition: cmd.c:691
client_state_t::refresh_prepped
qboolean refresh_prepped
Definition: client.h:98
v_centermove
cvar_t * v_centermove
Definition: in_win.c:330
CVAR_ARCHIVE
#define CVAR_ARCHIVE
Definition: q_shared.h:316
joy_advaxisy
cvar_t * joy_advaxisy
Definition: in_win.c:67
mouseactive
qboolean mouseactive
Definition: in_win.c:126
key_console
@ key_console
Definition: client.h:200
joy_advaxisv
cvar_t * joy_advaxisv
Definition: in_win.c:71
joy_advaxisz
cvar_t * joy_advaxisz
Definition: in_win.c:68
in_appactive
qboolean in_appactive
Definition: in_win.c:92
joy_upthreshold
cvar_t * joy_upthreshold
Definition: in_win.c:80
IN_StartupMouse
void IN_StartupMouse(void)
Definition: in_win.c:215
m_filter
cvar_t * m_filter
Definition: in_win.c:108
ActiveApp
qboolean ActiveApp
Definition: sys_win.c:43
K_AUX1
#define K_AUX1
Definition: keys.h:98
IN_ActivateMouse
void IN_ActivateMouse(void)
Definition: in_win.c:144
ji
static JOYINFOEX ji
Definition: in_win.c:90
mouseinitialized
qboolean mouseinitialized
Definition: in_win.c:129
joy_advaxisu
cvar_t * joy_advaxisu
Definition: in_win.c:70
joy_forwardthreshold
cvar_t * joy_forwardthreshold
Definition: in_win.c:72
joy_advanced
cvar_t * joy_advanced
Definition: in_win.c:65
client_static_t::key_dest
keydest_t key_dest
Definition: client.h:205
DWORD
DWORD
Definition: qgl_win.c:49
joy_pitchsensitivity
cvar_t * joy_pitchsensitivity
Definition: in_win.c:78
IN_MouseMove
void IN_MouseMove(usercmd_t *cmd)
Definition: in_win.c:265
cls
client_static_t cls
Definition: cl_main.c:90
cl
client_state_t cl
Definition: cl_main.c:91
joy_numbuttons
DWORD joy_numbuttons
Definition: in_win.c:88
Cvar_VariableValue
float Cvar_VariableValue(char *var_name)
Definition: cvar.c:63