What's new

Mouse as analog

swimg43

New member
I'm trying to play Mario 64 on my computer. It starts and functions perfectly. But when I move with my mouse I have to keep moving it up. Is there a way to make it keep moving forward instead of moving the mouse up then pulling it back so I can push it up again? Sorry if this is a regular question, I searched the forum and didn't come up with anything. Thanks.
 

firestarter

Mahoukenshi Master!
Not likely, unless there's a control plugin that allows for cursory control (where movement is based on a cursor's position on screen, and not the movement of the cursor itself). I don't think the plugins do that...I mean, most games that require such constant movement (such as flying a jet in BF2) don't do that.
 

Illissius

New member
I had the same idea as you, and hacked blight-input-0.0.8 a bit to work this way. Unfortunately it's not as convenient as I hoped, the mouse not jumping back to the center automatically matters much more than you'd think. Here's the patch, if you want to try it for yourself.
(Myself, I solved this by getting a wired Xbox360 controller for Christmas :)

--- src/plugin.c 2003-10-15 02:44:17.000000000 +0200
+++ src/plugin.c 2005-09-17 11:11:52.000000000 +0200
@@ -757,9 +757,10 @@
// read joystick state
SDL_JoystickUpdate();

+ static int mouse_x = 0, mouse_y = 0;
+ controller[Control].buttons.stick_y = mouse_x;
+ controller[Control].buttons.stick_x = -mouse_y;
controller[Control].buttons.button = 0;
- controller[Control].buttons.stick_x = 0;
- controller[Control].buttons.stick_y = 0;

if( controller[Control].device >= 0 )
{
@@ -822,6 +823,19 @@
// else if( controller[Control].device == DEVICE_KEYBOARD )
{
Uint8 *keystate = SDL_GetKeyState( NULL );
+ if( keystate[SDLK_LCTRL] || keystate[SDLK_RCTRL] )
+ {
+ if( SDL_WM_GrabInput( SDL_GRAB_QUERY ) == SDL_GRAB_ON )
+ {
+ SDL_WM_GrabInput( SDL_GRAB_OFF );
+ SDL_ShowCursor( SDL_ENABLE );
+ }
+ else
+ {
+ SDL_WM_GrabInput( SDL_GRAB_ON );
+ SDL_ShowCursor( SDL_DISABLE );
+ }
+ }
for( b = 0; b < 14; b++ )
{
if( controller[Control].button.key == SDLK_UNKNOWN )
@@ -856,7 +870,9 @@
{
Uint8 mstate = SDL_GetMouseState( NULL, NULL );

- for( b = 0; b < 14; b++ )
+ if( mstate & SDL_BUTTON( 2 ) )
+ controller[Control].buttons.stick_y = controller[Control].buttons.stick_x = mouse_x = mouse_y = 0;
+ else for( b = 0; b < 14; b++ )
{
if( controller[Control].button.mouse < 1 )
continue;
@@ -873,21 +889,21 @@
{
if (event.motion.xrel)
{
- axis_val = (event.motion.xrel * 10);
- if (axis_val < -80)
- axis_val = -80;
- else if (axis_val > 80)
- axis_val = 80;
- controller[Control].buttons.stick_y = axis_val;
+ mouse_x += event.motion.xrel;
+ if (mouse_x < -80)
+ mouse_x = -80;
+ else if (mouse_x > 80)
+ mouse_x = 80;
+ controller[Control].buttons.stick_y = mouse_x;
}
if (event.motion.yrel)
{
- axis_val = (event.motion.yrel * 10);
- if (axis_val < -80)
- axis_val = -80;
- else if (axis_val > 80)
- axis_val = 80;
- controller[Control].buttons.stick_x = -axis_val;
+ mouse_y += event.motion.yrel;
+ if (mouse_y < -80)
+ mouse_y = -80;
+ else if (mouse_y > 80)
+ mouse_y = 80;
+ controller[Control].buttons.stick_x = -mouse_y;
}
}
}
 

NrgSpoon

New member
Why not have it so if you hold the mouse button it remembers the position, and when you let go it resets to center? Or some other option where using the mouse buttons alters the function.
 

djlarz

13 000 roms and growing...
NrgSpoon said:
Why not have it so if you hold the mouse button it remembers the position, and when you let go it resets to center? Or some other option where using the mouse buttons alters the function.
Or map the left mouse button as pushing the controlstick forward.
 

Top