Some mouse changes... previous effect of the "mouse smoothing" menu option is now mandatory (since turning it off just means you'll lose input from tiny movements), new "mouse smoothing" effect is a more traditional average of the last 2 times the mouse input was read

git-svn-id: https://svn.eduke32.com/eduke32@1099 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-10-13 01:16:40 +00:00
parent 09831cd150
commit 60a4224533
11 changed files with 111 additions and 111 deletions

View file

@ -895,10 +895,6 @@
<Filter
Name="Misc"
>
<File
RelativePath=".\m32help.hlp"
>
</File>
</Filter>
</Files>
<Globals>

View file

@ -3383,7 +3383,7 @@ ENDFOR1:
dax = sp->x; day = sp->y;
daang = sp->ang;
}
j = sp->xrepeat*(hgap+tilesizx[sp->picnum]+2);
setsprite(cursor,
dax + ((j*sintable[daang])>>17),
@ -3472,7 +3472,7 @@ ENDFOR1:
numletters--;
deletesprite(last);
updatenumsprites();
updatenumsprites();
asksave = 1;
}
else

View file

@ -198,7 +198,7 @@ void CONFIG_SetDefaults(void)
ud.config.MixRate = 48000;
#endif
ud.config.MouseBias = 0;
ud.config.MouseFilter = 0;
ud.config.MouseDeadZone = 0;
ud.config.MusicDevice = 0;
ud.config.MusicToggle = 1;
ud.config.MusicVolume = 200;
@ -819,8 +819,9 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle
g_player[0].ps->aim_mode = ud.mouseaiming;
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseBias",&ud.config.MouseBias);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseFilter",&ud.config.MouseFilter);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseDeadZone",&ud.config.MouseDeadZone);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","SmoothInput",&ud.config.SmoothInput);
control_smoothmouse = ud.config.SmoothInput;
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseJoystick",&ud.config.UseJoystick);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseMouse",&ud.config.UseMouse);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32 *)&myaimmode); // (if toggle mode) gives state
@ -933,7 +934,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",ud.mouseflip,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAiming",ud.mouseaiming,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseBias",ud.config.MouseBias,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseFilter",ud.config.MouseFilter,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseDeadZone",ud.config.MouseDeadZone,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","SmoothInput",ud.config.SmoothInput,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",ud.runkey_mode,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseJoystick",ud.config.UseJoystick,false,false);

View file

@ -340,7 +340,7 @@ typedef struct {
int RunMode;
int AutoAim;
int ShowOpponentWeapons;
int MouseFilter,MouseBias;
int MouseDeadZone,MouseBias;
int SmoothInput;
// JBF 20031211: Store the input settings because

View file

@ -245,8 +245,10 @@ static inline int sbarsc(int sc)
static inline int textsc(int sc)
{
// prevent ridiculousness to a degree
if (xdim <= 640) return sc;
if (xdim <= 800) return scale(sc,min(300,ud.textscale),100);
if (xdim <= 320) return sc;
else if (xdim <= 640) return scale(sc,min(200,ud.textscale),100);
else if (xdim <= 800) return scale(sc,min(300,ud.textscale),100);
else if (xdim <= 1024) return scale(sc,min(350,ud.textscale),100);
return scale(sc,ud.textscale,100);
}
@ -448,7 +450,7 @@ int gametextlen(int x,const char *t)
static inline int mpgametext(int y,const char *t,int s,int dabits)
{
// if (xdim < 640 || ydim < 480)
// return(gametext_z(0,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536));
// return(gametext_z(0,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536));
return(gametext_z(4,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536));
}
@ -2724,13 +2726,13 @@ static void operatefta(void)
else k += 1; */
}
/* if (xdim >= 640 && ydim >= 480)
k = scale(k,ydim,200); */
/* if (xdim >= 640 && ydim >= 480)
k = scale(k,ydim,200); */
j = k;
// quotebot = min(quotebot,j);
// quotebotgoal = min(quotebotgoal,j);
// quotebotgoal = min(quotebotgoal,j);
// if (g_player[myconnectindex].ps->gm&MODE_TYPE) j -= 8;
//quotebotgoal = j;
//j = quotebot;
@ -2739,9 +2741,18 @@ static void operatefta(void)
{
if (user_quote_time[i] <= 0) continue;
k = user_quote_time[i];
if (k > 4) { mpgametext(j,user_quote[i],0,2+8+16); j += textsc(8); }
else if (k > 2) { mpgametext(j,user_quote[i],0,2+8+16+1); j += textsc(k<<1); }
else { mpgametext(j,user_quote[i],0,2+8+16+1+32); j += textsc(k<<1); }
if (hud_glowingquotes)
{
if (k > 4) { mpgametext(j,user_quote[i],(sintable[(totalclock<<5)&2047]>>11),2+8+16); j += textsc(8); }
else if (k > 2) { mpgametext(j,user_quote[i],(sintable[(totalclock<<5)&2047]>>11),2+8+16+1); j += textsc(k<<1); }
else { mpgametext(j,user_quote[i],(sintable[(totalclock<<5)&2047]>>11),2+8+16+1+32); j += textsc(k<<1); }
}
else
{
if (k > 4) { mpgametext(j,user_quote[i],0,2+8+16); j += textsc(8); }
else if (k > 2) { mpgametext(j,user_quote[i],0,2+8+16+1); j += textsc(k<<1); }
else { mpgametext(j,user_quote[i],0,2+8+16+1+32); j += textsc(k<<1); }
}
l = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(tempbuf,user_quote[i]));
while (l > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET))
{
@ -2791,9 +2802,9 @@ static void operatefta(void)
else gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps->ftq],0,2+8+16+1+32);
return;
}
if (j > 4) gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps->ftq],(sintable[(totalclock<<5)&2047]>>10),2+8+16);
else if (j > 2) gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps->ftq],(sintable[(totalclock<<5)&2047]>>10),2+8+16+1);
else gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps->ftq],(sintable[(totalclock<<5)&2047]>>10),2+8+16+1+32);
if (j > 4) gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps->ftq],(sintable[(totalclock<<5)&2047]>>11),2+8+16);
else if (j > 2) gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps->ftq],(sintable[(totalclock<<5)&2047]>>11),2+8+16+1);
else gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps->ftq],(sintable[(totalclock<<5)&2047]>>11),2+8+16+1+32);
}
void FTA(int q, player_struct *p)
@ -3542,7 +3553,8 @@ void GetCrosshairColor(void)
}
ptr++;
ii--;
} while (ii > 0);
}
while (ii > 0);
default_crosshair_colors.r = crosshair_colors.r = curpalette[bri].r;
default_crosshair_colors.g = crosshair_colors.g = curpalette[bri].g;
@ -11427,10 +11439,11 @@ MAIN_LOOP_RESTART:
{
static unsigned int lastrender = 0;
unsigned int j = getticks();
if (r_maxfps == 0 || getticks() >= lastrender+g_FrameDelay)
if (r_maxfps == 0 || j >= lastrender+g_FrameDelay)
{
lastrender = getticks();
lastrender = j;
displayrooms(screenpeek,i);
displayrest(i);

View file

@ -59,6 +59,7 @@ static int32 CONTROL_DoubleClickSpeed;
int extinput[CONTROL_NUM_FLAGS];
keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS];
int bindsenabled = 0;
int control_smoothmouse = 0;
void CONTROL_GetMouseDelta(void)
{
@ -66,15 +67,16 @@ void CONTROL_GetMouseDelta(void)
MOUSE_GetDelta(&x, &y);
/* What in the name of all things sacred is this?
if (labs(*x) > labs(*y)) {
*x /= 3;
} else {
*y /= 3;
if (control_smoothmouse)
{
static int32 lastx = 0, lasty = 0;
CONTROL_MouseAxes[0].analog = (((x + lastx) / 2) * (CONTROL_MouseSensitivity<<1));
CONTROL_MouseAxes[1].analog = (((y + lasty) / 2) * (CONTROL_MouseSensitivity<<1))<<1;
lastx = x;
lasty = y;
return;
}
*y = *y * 96;
*x = (*x * 32 * CONTROL_MouseSensitivity) >> 15;
*/
CONTROL_MouseAxes[0].analog = (x * (CONTROL_MouseSensitivity<<1));
CONTROL_MouseAxes[1].analog = (y * (CONTROL_MouseSensitivity<<1))<<1;

View file

@ -231,6 +231,7 @@ void CONTROL_ProcessBinds(void);
#define CONTROL_NUM_FLAGS 64
extern int extinput[CONTROL_NUM_FLAGS];
extern int control_smoothmouse;
#ifdef __cplusplus
};

View file

@ -2433,7 +2433,7 @@ cheat_for_port_credits:
case 230:
#if defined(POLYMOST) && defined(USE_OPENGL)
rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(320>>1,24,0,0,"VIDEO SETUP");
menutext(320>>1,24,0,0,"RENDERER SETUP");
c = (320>>1)-120;
@ -3020,7 +3020,7 @@ cheat_for_port_credits:
int osdmode = OSD_GetTextMode();
if (x==io) osdmode = !osdmode;
modval(0,1,(int *)&osdmode,1,probey==io);
mgametextpal(d,yy, osdmode? "Fast" : "Nice", MENUHIGHLIGHT(io), 0);
mgametextpal(d,yy, osdmode? "Plain" : "Sprites", MENUHIGHLIGHT(io), 0);
if (OSD_GetTextMode() != osdmode)
OSD_SetTextMode(osdmode);
break;
@ -3482,7 +3482,7 @@ cheat_for_port_credits:
if (gltexfiltermode != filter)
gltexapplyprops();
mgametextpal(c+168,50+62+16+16-8,tempbuf,MENUHIGHLIGHT(5),!getrendermode());
menutext(c,50+62+16+16+16,MENUHIGHLIGHT(6),bpp==8,"MORE SETTINGS");
menutext(c,50+62+16+16+16,MENUHIGHLIGHT(6),bpp==8,"RENDERER SETUP");
}
#endif
break;
@ -3664,6 +3664,7 @@ cheat_for_port_credits:
{
//input smoothing
ud.config.SmoothInput = !ud.config.SmoothInput;
control_smoothmouse = ud.config.SmoothInput;
}
else if (x == (MAXMOUSEBUTTONS-2)*2+2+2+2)
{
@ -3720,7 +3721,7 @@ cheat_for_port_credits:
mgametextpal(40,118,"Base mouse sensitivity",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),10);
mgametextpal(40,118+9,"Use mouse aiming",!ud.mouseaiming?MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+1):DISABLEDMENUSHADE,10);
mgametextpal(40,118+9+9,"Invert mouse",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2),10);
mgametextpal(40,118+9+9+9,"Use mouse input smoothing",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2+1),10);
mgametextpal(40,118+9+9+9,"Smooth mouse movement",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2+1),10);
mgametextpal(40,118+9+9+9+9,"Advanced mouse setup",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2+2),10);
{
@ -3739,6 +3740,11 @@ cheat_for_port_credits:
modval(0,1,(int *)&ud.mouseflip,1,probey == (MAXMOUSEBUTTONS-2)*2+2+2);
modval(0,1,(int *)&ud.config.SmoothInput,1,probey == (MAXMOUSEBUTTONS-2)*2+2+2+1);
if (probey == (MAXMOUSEBUTTONS-2)*2+2+2+1)
{
mgametext(160,160+9,"THIS OPTION INCURS A MOVEMENT DELAY",0,2+8+16);
control_smoothmouse = ud.config.SmoothInput;
}
mgametextpal(240,118+9, myaimmode && !ud.mouseaiming ? "Yes" : "No", !ud.mouseaiming?MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+1):DISABLEDMENUSHADE, 0);
mgametextpal(240,118+9+9, !ud.mouseflip ? "Yes" : "No", MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2), 0);
@ -4004,19 +4010,19 @@ cheat_for_port_credits:
mgametext(c+160-16,46+16-8,tempbuf,MENUHIGHLIGHT(1),2+8+16);
menutext(c,46+16+16,MENUHIGHLIGHT(2),0,"DEAD ZONE");
l = ud.config.MouseFilter>>1;
l = ud.config.MouseDeadZone>>1;
bar(c+160+40,46+16+16,&l,2,x==2,MENUHIGHLIGHT(2),0);
ud.config.MouseFilter = l<<1;
ud.config.MouseDeadZone = l<<1;
rotatesprite(320<<15,94<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(320>>1,43+16+16+16+8,0,0,"DIGITAL AXES SETUP");
if (ud.config.MouseFilter == 0)
if (ud.config.MouseDeadZone == 0)
Bsprintf(tempbuf," OFF");
else if (ud.config.MouseFilter < 48)
else if (ud.config.MouseDeadZone < 48)
Bsprintf(tempbuf," LOW");
else if (ud.config.MouseFilter < 96)
else if (ud.config.MouseDeadZone < 96)
Bsprintf(tempbuf," MED");
else if (ud.config.MouseFilter < 128)
else if (ud.config.MouseDeadZone < 128)
Bsprintf(tempbuf,"HIGH");
mgametext(c+160-16,46+16+16-8,tempbuf,MENUHIGHLIGHT(2),2+8+16);
@ -4444,7 +4450,7 @@ cheat_for_port_credits:
"Restart sound system",
"-",
"Duke talk",
"Other player sounds in DM",
"Dukematch player sounds",
"Ambient sounds",
"Reverse stereo channels",
NULL

View file

@ -747,8 +747,8 @@ cvarmappings cvar[] =
{ "cl_angleinterpolation", "cl_angleinterpolation: enable/disable angle interpolation", (void*)&ud.angleinterpolation, CVAR_INT, 0, 0, 256 },
{ "in_mousebias", "in_mousebias: emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time\n", (void*)&ud.config.MouseBias, CVAR_INT, 0, 0, 32 },
{ "in_mousefilter", "in_mousefilter: amount of mouse movement to filter out\n", (void*)&ud.config.MouseFilter, CVAR_INT, 0, 0, 512 },
{ "in_smoothinput", "in_smoothinput: enable/disable input smoothing\n", (void*)&ud.config.SmoothInput, CVAR_BOOL, 0, 0, 1 },
{ "in_mousedeadzone", "in_mousedeadzone: amount of mouse movement to filter out\n", (void*)&ud.config.MouseDeadZone, CVAR_INT, 0, 0, 512 },
{ "in_mousesmoothing", "in_mousesmoothing: enable/disable mouse input smoothing\n", (void*)&ud.config.SmoothInput, CVAR_BOOL, 0, 0, 1 },
#if defined(POLYMOST) && defined(USE_OPENGL)
{ "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 0, 1 },

View file

@ -2789,8 +2789,7 @@ int jump_input = 0;
void getinput(int snum)
{
int j, daang;
static ControlInfo info;
static ControlInfo lastinfo = { 0,0,0,0,0,0 };
static ControlInfo info[2];
int32 tics;
boolean running;
int32 turnamount;
@ -2801,8 +2800,8 @@ void getinput(int snum)
if ((p->gm&MODE_MENU) || (p->gm&MODE_TYPE) || (ud.pause_on && !KB_KeyPressed(sc_Pause)) || (numplayers > 1 && totalclock < 10)) // HACK: kill getinput() for the first 10 tics of a new map in multi
{
if (!(p->gm&MODE_MENU))
CONTROL_GetInput(&info);
memset(&lastinfo, 0, sizeof(lastinfo));
CONTROL_GetInput(&info[0]);
memset(&info[1], 0, sizeof(info[1]));
loc.fvel = vel = 0;
loc.svel = svel = 0;
loc.avel = angvel = 0;
@ -2838,41 +2837,41 @@ void getinput(int snum)
}
}
CONTROL_GetInput(&info);
CONTROL_GetInput(&info[0]);
if (ud.config.MouseFilter)
if (ud.config.MouseDeadZone)
{
if (info.dpitch > 0)
if (info[0].dpitch > 0)
{
if (info.dpitch > ud.config.MouseFilter)
info.dpitch -= ud.config.MouseFilter;
else info.dpitch = 0;
if (info[0].dpitch > ud.config.MouseDeadZone)
info[0].dpitch -= ud.config.MouseDeadZone;
else info[0].dpitch = 0;
}
else if (info.dpitch < 0)
else if (info[0].dpitch < 0)
{
if (info.dpitch < -ud.config.MouseFilter)
info.dpitch += ud.config.MouseFilter;
else info.dpitch = 0;
if (info[0].dpitch < -ud.config.MouseDeadZone)
info[0].dpitch += ud.config.MouseDeadZone;
else info[0].dpitch = 0;
}
if (info.dyaw > 0)
if (info[0].dyaw > 0)
{
if (info.dyaw > ud.config.MouseFilter)
info.dyaw -= ud.config.MouseFilter;
else info.dyaw = 0;
if (info[0].dyaw > ud.config.MouseDeadZone)
info[0].dyaw -= ud.config.MouseDeadZone;
else info[0].dyaw = 0;
}
else if (info.dyaw < 0)
else if (info[0].dyaw < 0)
{
if (info.dyaw < -ud.config.MouseFilter)
info.dyaw += ud.config.MouseFilter;
else info.dyaw = 0;
if (info[0].dyaw < -ud.config.MouseDeadZone)
info[0].dyaw += ud.config.MouseDeadZone;
else info[0].dyaw = 0;
}
}
if (ud.config.MouseBias)
{
if (klabs(info.dyaw) > klabs(info.dpitch))
info.dpitch /= ud.config.MouseBias;
else info.dyaw /= ud.config.MouseBias;
if (klabs(info[0].dyaw) > klabs(info[0].dpitch))
info[0].dpitch /= ud.config.MouseBias;
else info[0].dyaw /= ud.config.MouseBias;
}
tics = totalclock-lastcontroltime;
@ -2963,44 +2962,26 @@ void getinput(int snum)
svel = vel = angvel = horiz = 0;
if (ud.config.SmoothInput)
if (BUTTON(gamefunc_Strafe))
{
if (BUTTON(gamefunc_Strafe))
{
svel = -(info.dyaw+lastinfo.dyaw)/8;
lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 8;
}
else
{
angvel = (info.dyaw+lastinfo.dyaw)/64;
lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 64;
}
if (ud.mouseflip)
horiz = -(info.dpitch+lastinfo.dpitch)/(314-128);
else horiz = (info.dpitch+lastinfo.dpitch)/(314-128);
lastinfo.dpitch = (lastinfo.dpitch+info.dpitch) % (314-128);
svel = -(info[0].dyaw+info[1].dyaw)/8;
info[1].dyaw = (info[1].dyaw+info[0].dyaw) % 8;
}
else
{
if (BUTTON(gamefunc_Strafe))
{
svel = -info.dyaw/8;
}
else
{
angvel = info.dyaw/64;
}
if (ud.mouseflip)
horiz -= info.dpitch/(314-128);
else horiz += info.dpitch/(314-128);
angvel = (info[0].dyaw+info[1].dyaw)/64;
info[1].dyaw = (info[1].dyaw+info[0].dyaw) % 64;
}
svel -= info.dx;
lastinfo.dz = info.dz % (1<<6);
vel = -info.dz>>6;
if (ud.mouseflip)
horiz = -(info[0].dpitch+info[1].dpitch)/(314-128);
else horiz = (info[0].dpitch+info[1].dpitch)/(314-128);
info[1].dpitch = (info[1].dpitch+info[0].dpitch) % (314-128);
svel -= info[0].dx;
info[1].dz = info[0].dz % (1<<6);
vel = -info[0].dz>>6;
if (running)
{

View file

@ -1649,14 +1649,14 @@ void checkhitwall(int spr,int dawallnum,int x,int y,int z,int atwith)
case SEENINE__STATIC:
case OOZFILTER__STATIC:
case EXPLODINGBARREL__STATIC:
if (wal->nextwall == -1 || wall[wal->nextwall].pal != 4)
{
lotsofglass(spr,dawallnum,70);
wal->cstat &= ~16;
wal->overpicnum = MIRRORBROKE;
spritesound(GLASS_HEAVYBREAK,spr);
return;
}
if (wal->nextwall == -1 || wall[wal->nextwall].pal != 4)
{
lotsofglass(spr,dawallnum,70);
wal->cstat &= ~16;
wal->overpicnum = MIRRORBROKE;
spritesound(GLASS_HEAVYBREAK,spr);
return;
}
}
}