Accept FS#5153 - Doom Scrollwheel Patch

It hardcodes the scrollwheel for straving left/right.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29968 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2011-06-05 11:23:53 +00:00
parent 1fd7ad8861
commit 62e06cc2a4
3 changed files with 38 additions and 2 deletions

View file

@ -47,7 +47,8 @@ enum
ev_keydown,
ev_keyup,
ev_mouse,
ev_joystick
ev_joystick,
ev_scroll
};
typedef unsigned evtype_t;

View file

@ -229,6 +229,9 @@ static unsigned int dclicktime2;
static unsigned int dclickstate2;
static unsigned int dclicks2;
// scrollwheel values
static int scrollmag;
// joystick values are repeated
static int joyxmove;
static int joyymove;
@ -317,6 +320,13 @@ void G_BuildTiccmd(ticcmd_t* cmd)
// let movement keys cancel each other out
/* strafe with scrollwheel */
if (scrollmag > 0)
side += 5*sidemove[speed];
if (scrollmag < 0)
side -= 5*sidemove[speed];
scrollmag = 0;
if (strafe)
{
if (gamekeydown[key_right])
@ -757,6 +767,9 @@ boolean G_Responder (event_t* ev)
joyymove = ev->data3;
return true; // eat events
case ev_scroll:
scrollmag = ev->data1;
default:
break;
}

View file

@ -158,7 +158,9 @@ void I_ShutdownGraphics(void)
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
//#define DOOMBUTTON_SCROLLWHEEL
#define DOOMBUTTON_SCROLLWHEEL
#define DOOMBUTTON_SCROLLWHEEL_CC BUTTON_SCROLL_BACK
#define DOOMBUTTON_SCROLLWHEEL_CW BUTTON_SCROLL_FWD
#define DOOMBUTTON_UP BUTTON_MENU
#define DOOMBUTTON_WEAPON BUTTON_SELECT
#define DOOMBUTTON_LEFT BUTTON_LEFT
@ -493,6 +495,26 @@ static inline void getkey()
holdbutton=rb->button_hold();
#endif
#ifdef DOOMBUTTON_SCROLLWHEEL
/* use button_get(false) for clickwheel checks */
int button; /* move me */
button = rb->button_get(false);
switch(button){
case DOOMBUTTON_SCROLLWHEEL_CC | BUTTON_REPEAT:
case DOOMBUTTON_SCROLLWHEEL_CC:
event.type = ev_scroll;
event.data1=-1;
D_PostEvent(&event);
break;
case DOOMBUTTON_SCROLLWHEEL_CW | BUTTON_REPEAT:
case DOOMBUTTON_SCROLLWHEEL_CW:
event.type = ev_scroll;
//event.data1=KEY_LEFTARROW;
event.data1=1;
D_PostEvent(&event);
break;
}
#endif
newbuttonstate = rb->button_status();
#ifdef DOOMBUTTON_SCROLLWHEEL
newbuttonstate |= read_scroll_wheel();