Better mouse movement

git-svn-id: https://svn.eduke32.com/eduke32@127 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-04-30 00:40:41 +00:00
parent a61f880dc0
commit aa042016b7
7 changed files with 26 additions and 34 deletions

View file

@ -284,7 +284,7 @@ void CONFIG_SetDefaults( void )
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum( mouseanalogdefaults[i] );
CONTROL_MapAnalogAxis( i, MouseAnalogueAxes[i], controldevice_mouse);
}
CONTROL_SetMouseSensitivity(32768);
CONTROL_SetMouseSensitivity(DEFAULTMOUSESENSITIVITY);
memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
for (i=0; i<MAXJOYBUTTONS; i++) {
@ -420,8 +420,8 @@ void CONFIG_SetupMouse( void )
MouseAnalogueScale[i] = scale;
}
function = 32768;
SCRIPT_GetNumber( scripthandle, "Controls","MouseSensitivity",&function);
function = DEFAULTMOUSESENSITIVITY;
SCRIPT_GetNumber( scripthandle, "Controls","Mouse_Sensitivity",&function);
CONTROL_SetMouseSensitivity(function);
for (i=0; i<MAXMOUSEBUTTONS; i++)
@ -776,7 +776,7 @@ void CONFIG_WriteSetup( void )
SCRIPT_PutNumber(scripthandle, "Controls", buf, MouseAnalogueScale[dummy], false, false);
}
dummy = CONTROL_GetMouseSensitivity();
SCRIPT_PutNumber( scripthandle, "Controls","MouseSensitivity",dummy,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","Mouse_Sensitivity",dummy,false,false);
for (dummy=0;dummy<MAXJOYBUTTONS;dummy++) {
Bsprintf(buf,"JoystickButton%ld",dummy);

View file

@ -130,7 +130,7 @@ extern "C" {
// DEFAULT mouse sensitivity scale
#define DEFAULTMOUSESENSITIVITY (1<<15)
#define DEFAULTMOUSESENSITIVITY 10
enum
{

View file

@ -68,8 +68,8 @@ extern "C" {
#define MouseInt 0x33
#define JoyMax 0xa00
#define MaxJoyValue 5000
#define MINIMUMMOUSESENSITIVITY 0x1000
#define DEFAULTMOUSESENSITIVITY 0x7000+MINIMUMMOUSESENSITIVITY
#define DEFAULTMOUSESENSITIVITY 10 // 0x7000+MINIMUMMOUSESENSITIVITY
#define CONTROL_NUM_FLAGS 64
#define INSTANT_ONOFF 0

View file

@ -72,18 +72,18 @@ void CONTROL_GetMouseDelta(void)
*x = (*x * 32 * CONTROL_MouseSensitivity) >> 15;
*/
CONTROL_MouseAxes[0].analog = (x * CONTROL_MouseSensitivity>>8);
CONTROL_MouseAxes[1].analog = (y * CONTROL_MouseSensitivity>>6);
CONTROL_MouseAxes[0].analog = (x * (CONTROL_MouseSensitivity<<1));
CONTROL_MouseAxes[1].analog = (y * (CONTROL_MouseSensitivity<<1))<<2;
}
int32 CONTROL_GetMouseSensitivity(void)
{
return (CONTROL_MouseSensitivity - MINIMUMMOUSESENSITIVITY);
return (CONTROL_MouseSensitivity);
}
void CONTROL_SetMouseSensitivity(int32 newsensitivity)
{
CONTROL_MouseSensitivity = newsensitivity + MINIMUMMOUSESENSITIVITY;
CONTROL_MouseSensitivity = newsensitivity;
}
boolean CONTROL_StartMouse(void)
@ -604,12 +604,12 @@ void CONTROL_ApplyAxis(int32 axis, ControlInfo *info, controldevice device)
}
switch (map[axis].analogmap) {
case analog_turning: info->dyaw += set[axis].analog; break;
case analog_strafing: info->dx += set[axis].analog; break;
case analog_lookingupanddown: info->dpitch += set[axis].analog; break;
case analog_elevation: info->dy += set[axis].analog; break;
case analog_rolling: info->droll += set[axis].analog; break;
case analog_moving: info->dz += set[axis].analog; break;
case analog_turning: info->dyaw = set[axis].analog; break;
case analog_strafing: info->dx = set[axis].analog; break;
case analog_lookingupanddown: info->dpitch = set[axis].analog; break;
case analog_elevation: info->dy = set[axis].analog; break;
case analog_rolling: info->droll = set[axis].analog; break;
case analog_moving: info->dz = set[axis].analog; break;
default: break;
}
}
@ -706,7 +706,7 @@ void CONTROL_ButtonFunctionState( int32 *p1 )
p1[j] |= CONTROL_JoyButtonState[i];
}
}
/*
void CONTROL_GetUserInput( UserInput *info )
{
ControlInfo ci;
@ -792,7 +792,7 @@ void CONTROL_ClearUserInput( UserInput *info )
if (info->button0) CONTROL_UserInputCleared[1] = true;
if (info->button1) CONTROL_UserInputCleared[2] = true;
}
*/
void CONTROL_ClearButton( int32 whichbutton )
{
if (CONTROL_CheckRange( whichbutton )) return;

View file

@ -2870,9 +2870,9 @@ cheat_for_port_credits:
{
short sense;
sense = CONTROL_GetMouseSensitivity()>>10;
barsm(248,128,&sense,2,x==(MAXMOUSEBUTTONS-2)*2+2,MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),PHX(-7));
CONTROL_SetMouseSensitivity( sense<<10 );
sense = CONTROL_GetMouseSensitivity();
barsm(248,128,&sense,1,x==(MAXMOUSEBUTTONS-2)*2+2,MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),PHX(-7));
CONTROL_SetMouseSensitivity( sense );
}
if (!ud.mouseaiming) modval(0,1,(int *)&myaimmode,1,probey == (MAXMOUSEBUTTONS-2)*2+2+1);

View file

@ -490,11 +490,11 @@ int osdcmd_cvar_set(const osdfuncparm_t *parm)
int osdcmd_sensitivity(const osdfuncparm_t *parm)
{
if (parm->numparms != 1) {
OSD_Printf("sensitivity %d\n",CONTROL_GetMouseSensitivity()>>10);
OSD_Printf("sensitivity %d\n",CONTROL_GetMouseSensitivity());
return OSDCMD_OK;
}
CONTROL_SetMouseSensitivity(atoi(parm->parms[0])<<10);
OSD_Printf("\n");
CONTROL_SetMouseSensitivity(atoi(parm->parms[0]));
OSD_Printf("sensitivity %d\n",CONTROL_GetMouseSensitivity());
return OSDCMD_OK;
}

View file

@ -2160,7 +2160,7 @@ void displayweapon(short snum)
}
if( j < 7 || j > 12 )
if( j < 6 || j > 12 )
myospal(weapon_xoffset+80-(p->look_ang>>1),
looking_arc+250-gun_pos,KNEE,gs,o|4,pal);
else myospal(weapon_xoffset+160-16-(p->look_ang>>1),
@ -2704,14 +2704,6 @@ void getinput(short snum)
CONTROL_GetInput( &info );
info.dx += lastinfo.dx;
info.dy += lastinfo.dy;
/* info.dz += lastinfo.dz;
info.dyaw += lastinfo.dyaw; */
info.dpitch += lastinfo.dpitch;
info.droll += lastinfo.droll;
memset(&lastinfo.dx, 0, sizeof(lastinfo));
if( (p->gm&MODE_MENU) || (p->gm&MODE_TYPE) || (ud.pause_on && !KB_KeyPressed(sc_Pause)) )
{
loc.fvel = vel = 0;