diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-06-05 11:23:53 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-06-05 11:23:53 +0000 |
commit | 62e06cc2a432bb9499646f089796157135829195 (patch) | |
tree | 968497d8811b3a4f76466186891123c7984dd176 /apps/plugins/doom | |
parent | 1fd7ad8861d7c14b234695e0ca5ef97aa029598a (diff) | |
download | rockbox-62e06cc2a432bb9499646f089796157135829195.tar.gz rockbox-62e06cc2a432bb9499646f089796157135829195.zip |
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
Diffstat (limited to 'apps/plugins/doom')
-rw-r--r-- | apps/plugins/doom/d_event.h | 3 | ||||
-rw-r--r-- | apps/plugins/doom/g_game.c | 13 | ||||
-rw-r--r-- | 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 | |||
47 | ev_keydown, | 47 | ev_keydown, |
48 | ev_keyup, | 48 | ev_keyup, |
49 | ev_mouse, | 49 | ev_mouse, |
50 | ev_joystick | 50 | ev_joystick, |
51 | ev_scroll | ||
51 | }; | 52 | }; |
52 | typedef unsigned evtype_t; | 53 | typedef unsigned evtype_t; |
53 | 54 | ||
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; | |||
229 | static unsigned int dclickstate2; | 229 | static unsigned int dclickstate2; |
230 | static unsigned int dclicks2; | 230 | static unsigned int dclicks2; |
231 | 231 | ||
232 | // scrollwheel values | ||
233 | static int scrollmag; | ||
234 | |||
232 | // joystick values are repeated | 235 | // joystick values are repeated |
233 | static int joyxmove; | 236 | static int joyxmove; |
234 | static int joyymove; | 237 | static int joyymove; |
@@ -317,6 +320,13 @@ void G_BuildTiccmd(ticcmd_t* cmd) | |||
317 | 320 | ||
318 | // let movement keys cancel each other out | 321 | // let movement keys cancel each other out |
319 | 322 | ||
323 | /* strafe with scrollwheel */ | ||
324 | if (scrollmag > 0) | ||
325 | side += 5*sidemove[speed]; | ||
326 | if (scrollmag < 0) | ||
327 | side -= 5*sidemove[speed]; | ||
328 | scrollmag = 0; | ||
329 | |||
320 | if (strafe) | 330 | if (strafe) |
321 | { | 331 | { |
322 | if (gamekeydown[key_right]) | 332 | if (gamekeydown[key_right]) |
@@ -757,6 +767,9 @@ boolean G_Responder (event_t* ev) | |||
757 | joyymove = ev->data3; | 767 | joyymove = ev->data3; |
758 | return true; // eat events | 768 | return true; // eat events |
759 | 769 | ||
770 | case ev_scroll: | ||
771 | scrollmag = ev->data1; | ||
772 | |||
760 | default: | 773 | default: |
761 | break; | 774 | break; |
762 | } | 775 | } |
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) | |||
158 | 158 | ||
159 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ | 159 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ |
160 | (CONFIG_KEYPAD == IPOD_1G2G_PAD) | 160 | (CONFIG_KEYPAD == IPOD_1G2G_PAD) |
161 | //#define DOOMBUTTON_SCROLLWHEEL | 161 | #define DOOMBUTTON_SCROLLWHEEL |
162 | #define DOOMBUTTON_SCROLLWHEEL_CC BUTTON_SCROLL_BACK | ||
163 | #define DOOMBUTTON_SCROLLWHEEL_CW BUTTON_SCROLL_FWD | ||
162 | #define DOOMBUTTON_UP BUTTON_MENU | 164 | #define DOOMBUTTON_UP BUTTON_MENU |
163 | #define DOOMBUTTON_WEAPON BUTTON_SELECT | 165 | #define DOOMBUTTON_WEAPON BUTTON_SELECT |
164 | #define DOOMBUTTON_LEFT BUTTON_LEFT | 166 | #define DOOMBUTTON_LEFT BUTTON_LEFT |
@@ -493,6 +495,26 @@ static inline void getkey() | |||
493 | holdbutton=rb->button_hold(); | 495 | holdbutton=rb->button_hold(); |
494 | #endif | 496 | #endif |
495 | 497 | ||
498 | #ifdef DOOMBUTTON_SCROLLWHEEL | ||
499 | /* use button_get(false) for clickwheel checks */ | ||
500 | int button; /* move me */ | ||
501 | button = rb->button_get(false); | ||
502 | switch(button){ | ||
503 | case DOOMBUTTON_SCROLLWHEEL_CC | BUTTON_REPEAT: | ||
504 | case DOOMBUTTON_SCROLLWHEEL_CC: | ||
505 | event.type = ev_scroll; | ||
506 | event.data1=-1; | ||
507 | D_PostEvent(&event); | ||
508 | break; | ||
509 | case DOOMBUTTON_SCROLLWHEEL_CW | BUTTON_REPEAT: | ||
510 | case DOOMBUTTON_SCROLLWHEEL_CW: | ||
511 | event.type = ev_scroll; | ||
512 | //event.data1=KEY_LEFTARROW; | ||
513 | event.data1=1; | ||
514 | D_PostEvent(&event); | ||
515 | break; | ||
516 | } | ||
517 | #endif | ||
496 | newbuttonstate = rb->button_status(); | 518 | newbuttonstate = rb->button_status(); |
497 | #ifdef DOOMBUTTON_SCROLLWHEEL | 519 | #ifdef DOOMBUTTON_SCROLLWHEEL |
498 | newbuttonstate |= read_scroll_wheel(); | 520 | newbuttonstate |= read_scroll_wheel(); |