From 62e06cc2a432bb9499646f089796157135829195 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 5 Jun 2011 11:23:53 +0000 Subject: 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 --- apps/plugins/doom/d_event.h | 3 ++- apps/plugins/doom/g_game.c | 13 +++++++++++++ apps/plugins/doom/i_video.c | 24 +++++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/apps/plugins/doom/d_event.h b/apps/plugins/doom/d_event.h index c131ed56e1..a29cee8b98 100644 --- a/apps/plugins/doom/d_event.h +++ b/apps/plugins/doom/d_event.h @@ -47,7 +47,8 @@ enum ev_keydown, ev_keyup, ev_mouse, - ev_joystick + ev_joystick, + ev_scroll }; typedef unsigned evtype_t; diff --git a/apps/plugins/doom/g_game.c b/apps/plugins/doom/g_game.c index e41c84c378..99f8e63187 100644 --- a/apps/plugins/doom/g_game.c +++ b/apps/plugins/doom/g_game.c @@ -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; } diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c index dd47cdbe2b..7023e8f87c 100644 --- a/apps/plugins/doom/i_video.c +++ b/apps/plugins/doom/i_video.c @@ -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(); -- cgit v1.2.3