icculus quake2 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 406 of file in_win.c.

407 {
408  in_appactive = active;
409  mouseactive = !active; // force a new window check or turn off
410 }

Referenced by AppActivate(), and MainWndProc().

◆ IN_Commands()

void IN_Commands ( void  )

Definition at line 654 of file in_win.c.

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

Referenced by CL_SendCommand().

◆ IN_Frame()

void IN_Frame ( void  )

Definition at line 420 of file in_win.c.

421 {
422  if (!mouseinitialized)
423  return;
424 
425  if (!in_mouse || !in_appactive)
426  {
428  return;
429  }
430 
431  if ( !cl.refresh_prepped
432  || cls.key_dest == key_console
433  || cls.key_dest == key_menu)
434  {
435  // temporarily deactivate if in fullscreen
436  if (Cvar_VariableValue ("vid_fullscreen") == 0)
437  {
439  return;
440  }
441  }
442 
443  IN_ActivateMouse ();
444 }

Referenced by CL_Frame().

◆ IN_Init()

void IN_Init ( void  )

Definition at line 346 of file in_win.c.

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

Referenced by CL_Init().

◆ IN_Move()

void IN_Move ( usercmd_t cmd)

Definition at line 451 of file in_win.c.

452 {
453  IN_MouseMove (cmd);
454 
455  if (ActiveApp)
456  IN_JoyMove (cmd);
457 }

Referenced by CL_CreateCmd().

◆ IN_Shutdown()

void IN_Shutdown ( void  )

Definition at line 391 of file in_win.c.

392 {
394 }

Referenced by CL_Shutdown().

IN_MLookUp
void IN_MLookUp(void)
Definition: in_win.c:112
IN_JoyMove
void IN_JoyMove(usercmd_t *cmd)
Definition: in_win.c:752
ActiveApp
int ActiveApp
Definition: sys_win.c:42
v_centerspeed
cvar_t * v_centerspeed
Definition: in_win.c:338
Key_Event
void Key_Event(int key, qboolean down, unsigned time)
Definition: keys.c:745
joy_forwardsensitivity
cvar_t * joy_forwardsensitivity
Definition: in_win.c:75
IN_StartupJoystick
void IN_StartupJoystick(void)
Definition: in_win.c:486
joy_avail
qboolean joy_avail
Definition: in_win.c:82
joy_name
cvar_t * joy_name
Definition: in_win.c:63
joy_advaxisr
cvar_t * joy_advaxisr
Definition: in_win.c:68
joy_sidesensitivity
cvar_t * joy_sidesensitivity
Definition: in_win.c:76
joy_oldpovstate
DWORD joy_oldpovstate
Definition: in_win.c:83
in_mouse
cvar_t * in_mouse
Definition: in_win.c:54
i
int i
Definition: q_shared.c:305
IN_DeactivateMouse
void IN_DeactivateMouse(void)
Definition: in_win.c:197
joy_upsensitivity
cvar_t * joy_upsensitivity
Definition: in_win.c:80
joy_oldbuttonstate
DWORD joy_oldbuttonstate
Definition: in_win.c:83
Joy_AdvancedUpdate_f
void Joy_AdvancedUpdate_f(void)
Definition: in_win.c:582
joy_pitchthreshold
cvar_t * joy_pitchthreshold
Definition: in_win.c:73
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:74
key_menu
@ key_menu
Definition: client.h:220
joy_sidethreshold
cvar_t * joy_sidethreshold
Definition: in_win.c:72
K_AUX29
@ K_AUX29
Definition: keys.h:125
IN_MLookDown
void IN_MLookDown(void)
Definition: in_win.c:111
in_joystick
cvar_t * in_joystick
Definition: in_win.c:55
joy_yawsensitivity
cvar_t * joy_yawsensitivity
Definition: in_win.c:78
joy_haspov
qboolean joy_haspov
Definition: in_win.c:82
K_JOY1
@ K_JOY1
Definition: keys.h:88
joy_advaxisx
cvar_t * joy_advaxisx
Definition: in_win.c:65
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:118
v_centermove
cvar_t * v_centermove
Definition: in_win.c:337
CVAR_ARCHIVE
#define CVAR_ARCHIVE
Definition: q_shared.h:309
joy_advaxisy
cvar_t * joy_advaxisy
Definition: in_win.c:66
mouseactive
qboolean mouseactive
Definition: in_win.c:125
key_console
@ key_console
Definition: client.h:220
joy_advaxisv
cvar_t * joy_advaxisv
Definition: in_win.c:70
K_AUX1
@ K_AUX1
Definition: keys.h:97
joy_advaxisz
cvar_t * joy_advaxisz
Definition: in_win.c:67
in_appactive
qboolean in_appactive
Definition: in_win.c:91
joy_upthreshold
cvar_t * joy_upthreshold
Definition: in_win.c:79
IN_StartupMouse
void IN_StartupMouse(void)
Definition: in_win.c:222
m_filter
cvar_t * m_filter
Definition: in_win.c:107
IN_ActivateMouse
void IN_ActivateMouse(void)
Definition: in_win.c:143
ji
static JOYINFOEX ji
Definition: in_win.c:89
mouseinitialized
qboolean mouseinitialized
Definition: in_win.c:128
joy_advaxisu
cvar_t * joy_advaxisu
Definition: in_win.c:69
joy_forwardthreshold
cvar_t * joy_forwardthreshold
Definition: in_win.c:71
joy_advanced
cvar_t * joy_advanced
Definition: in_win.c:64
client_static_t::key_dest
keydest_t key_dest
Definition: client.h:225
DWORD
DWORD
Definition: qgl_win.c:49
joy_pitchsensitivity
cvar_t * joy_pitchsensitivity
Definition: in_win.c:77
IN_MouseMove
void IN_MouseMove(usercmd_t *cmd)
Definition: in_win.c:272
cls
client_static_t cls
Definition: cl_main.c:105
cl
client_state_t cl
Definition: cl_main.c:106
joy_numbuttons
DWORD joy_numbuttons
Definition: in_win.c:87
Cvar_VariableValue
float Cvar_VariableValue(char *var_name)
Definition: cvar.c:63