summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-06-05 11:23:53 +0000
committerThomas Martitz <kugel@rockbox.org>2011-06-05 11:23:53 +0000
commit62e06cc2a432bb9499646f089796157135829195 (patch)
tree968497d8811b3a4f76466186891123c7984dd176 /apps/plugins
parent1fd7ad8861d7c14b234695e0ca5ef97aa029598a (diff)
downloadrockbox-62e06cc2a432bb9499646f089796157135829195.zip
rockbox-62e06cc2a432bb9499646f089796157135829195.tar.gz
rockbox-62e06cc2a432bb9499646f089796157135829195.tar.bz2
rockbox-62e06cc2a432bb9499646f089796157135829195.tar.xz
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')
-rw-r--r--apps/plugins/doom/d_event.h3
-rw-r--r--apps/plugins/doom/g_game.c13
-rw-r--r--apps/plugins/doom/i_video.c24
3 files changed, 38 insertions, 2 deletions
diff --git a/apps/plugins/doom/d_event.h b/apps/plugins/doom/d_event.h
index c131ed5..a29cee8 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 e41c84c..99f8e63 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 dd47cdb..7023e8f 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();