From: havoc Date: Thu, 19 May 2011 01:33:42 +0000 (+0000) Subject: added JOY_UP/DOWN/LEFT/RIGHT keys which are a more general form of the joy_axiskeyeve... X-Git-Tag: xonotic-v0.6.0~163^2~389 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=db717d093453e95a1fc005d7c884b12562d7ca9f;p=xonotic%2Fdarkplaces.git added JOY_UP/DOWN/LEFT/RIGHT keys which are a more general form of the joy_axiskeyevents cvar (which when set to 1 will turn these into UPARROW/DOWNARROW/etc as before, but this way a menu qc can respond to them correctly) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11157 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/keys.c b/keys.c index c955570c..ea6e2d59 100644 --- a/keys.c +++ b/keys.c @@ -498,6 +498,11 @@ static const keyname_t keynames[] = { {"X360_RIGHT_THUMB_LEFT", K_X360_RIGHT_THUMB_LEFT}, {"X360_RIGHT_THUMB_RIGHT", K_X360_RIGHT_THUMB_RIGHT}, + {"JOY_UP", K_JOY_UP}, + {"JOY_DOWN", K_JOY_DOWN}, + {"JOY_LEFT", K_JOY_LEFT}, + {"JOY_RIGHT", K_JOY_RIGHT}, + {"SEMICOLON", ';'}, // because a raw semicolon separates commands {"TILDE", '~'}, {"BACKQUOTE", '`'}, diff --git a/keys.h b/keys.h index a02acf2f..c2587aed 100644 --- a/keys.h +++ b/keys.h @@ -214,6 +214,12 @@ typedef enum keynum_e K_X360_RIGHT_THUMB_LEFT, K_X360_RIGHT_THUMB_RIGHT, + // generic joystick emulation for menu + K_JOY_UP, + K_JOY_DOWN, + K_JOY_LEFT, + K_JOY_RIGHT, + K_MIDINOTE0 = 896, // to this, the note number is added K_MIDINOTE1, K_MIDINOTE2, diff --git a/vid_shared.c b/vid_shared.c index 24a15094..ada1a260 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1193,7 +1193,7 @@ void VID_Shared_BuildJoyState_Begin(vid_joystate_t *joystate) void VID_Shared_BuildJoyState_Finish(vid_joystate_t *joystate) { float f, r; - if (!joy_axiskeyevents.integer || joystate->is360) + if (joystate->is360) return; // emulate key events for thumbstick f = VID_JoyState_GetAxis(joystate, joy_axisforward.integer, 1, joy_axiskeyevents_deadzone.value) * joy_sensitivityforward.value; @@ -1242,7 +1242,7 @@ static int joybuttonkey[MAXJOYBUTTON][2] = { {K_JOY1, K_ENTER}, {K_JOY2, K_ESCAPE}, {K_JOY3, 0}, {K_JOY4, 0}, {K_JOY5, 0}, {K_JOY6, 0}, {K_JOY7, 0}, {K_JOY8, 0}, {K_JOY9, 0}, {K_JOY10, 0}, {K_JOY11, 0}, {K_JOY12, 0}, {K_JOY13, 0}, {K_JOY14, 0}, {K_JOY15, 0}, {K_JOY16, 0}, {K_AUX1, 0}, {K_AUX2, 0}, {K_AUX3, 0}, {K_AUX4, 0}, {K_AUX5, 0}, {K_AUX6, 0}, {K_AUX7, 0}, {K_AUX8, 0}, {K_AUX9, 0}, {K_AUX10, 0}, {K_AUX11, 0}, {K_AUX12, 0}, {K_AUX13, 0}, {K_AUX14, 0}, {K_AUX15, 0}, {K_AUX16, 0}, - {K_UPARROW, K_UPARROW}, {K_DOWNARROW, K_DOWNARROW}, {K_RIGHTARROW, K_RIGHTARROW}, {K_LEFTARROW, K_LEFTARROW}, + {K_JOY_UP, K_UPARROW}, {K_JOY_DOWN, K_DOWNARROW}, {K_JOY_RIGHT, K_RIGHTARROW}, {K_JOY_LEFT, K_LEFTARROW}, }; static int joybuttonkey360[][2] =