When reading ingame controls only flush mouse delta timer-based since reading is event-based already, allowing high precision no matter the game speed; Removed Mouse smoothing/filtering as it's now unnecessary due to event-based motion handling

This commit is contained in:
zicodxx 2011-04-22 13:02:03 +02:00
parent 7890015efd
commit 53d48e005e
6 changed files with 9 additions and 28 deletions

View file

@ -3,6 +3,7 @@ D1X-Rebirth Changelog
20110422
--------
2d/rle.c, SConstruct, main/segment.h, main/texmerge.c: Expanded possibilities for level authors: RLE- and Texture-cache accepts textures bigger than 64x64, only limit being Texture width must be equal height; Increased maximum amount of Segments from 900 to 9000 - not dynamically allocating them, yet
arch/sdl/mouse.c, main/kconfig.c, main/menu.c, main/playsave.c, main/playsave.h: When reading ingame controls only flush mouse delta timer-based since reading is event-based already, allowing high precision no matter the game speed; Removed Mouse smoothing/filtering as it's now unnecessary due to event-based motion handling
20110421
--------

View file

@ -124,13 +124,6 @@ void mouse_motion_handler(SDL_MouseMotionEvent *mme)
event.dy = mme->yrel;
event.dz = 0; // handled in mouse_button_handler
// filter delta?
if (PlayerCfg.MouseFilter)
{
event.dx = (event.dx + Mouse.old_delta_x) * 0.5;
event.dy = (event.dy + Mouse.old_delta_y) * 0.5;
}
Mouse.old_delta_x = event.dx;
Mouse.old_delta_y = event.dy;
@ -174,13 +167,6 @@ void mouse_get_delta( int *dx, int *dy, int *dz )
*dy = Mouse.delta_y;
*dz = Mouse.delta_z;
// filter delta?
if (PlayerCfg.MouseFilter)
{
Mouse.delta_x = (*dx + Mouse.old_delta_x) * 0.5;
Mouse.delta_y = (*dy + Mouse.old_delta_y) * 0.5;
}
Mouse.old_delta_x = *dx;
Mouse.old_delta_y = *dy;

View file

@ -1277,11 +1277,11 @@ void kconfig_read_controls(d_event *event, int automap_flag)
Controls.mouse_axis[i] = 0;
}
}
else if (mouse_delta_time < timer_query())
else
{
event_mouse_get_delta( event, &Controls.raw_mouse_axis[0], &Controls.raw_mouse_axis[1], &Controls.raw_mouse_axis[2] );
Controls.mouse_axis[0] = (Controls.raw_mouse_axis[0]*FrameTime)/15;
Controls.mouse_axis[1] = (Controls.raw_mouse_axis[1]*FrameTime)/15;
Controls.mouse_axis[0] = (Controls.raw_mouse_axis[0]*FrameTime)/8;
Controls.mouse_axis[1] = (Controls.raw_mouse_axis[1]*FrameTime)/8;
Controls.mouse_axis[2] = (Controls.raw_mouse_axis[2]*FrameTime);
mouse_delta_time = timer_query() + (F1_0/30);
}
@ -1290,7 +1290,10 @@ void kconfig_read_controls(d_event *event, int automap_flag)
case EVENT_IDLE:
default:
if (!PlayerCfg.MouseFlightSim && mouse_delta_time < timer_query())
{
Controls.mouse_axis[0] = Controls.mouse_axis[1] = Controls.mouse_axis[2] = 0;
mouse_delta_time = timer_query() + (F1_0/30);
}
break;
}

View file

@ -1057,7 +1057,7 @@ void input_config_sensitivity()
PlayerCfg.MouseFSDead = m[mousefsdead].value;
}
static int opt_ic_usejoy = 0, opt_ic_usemouse = 0, opt_ic_confkey = 0, opt_ic_confjoy = 0, opt_ic_confmouse = 0, opt_ic_confweap = 0, opt_ic_mouseflightsim = 0, opt_ic_joymousesens = 0, opt_ic_grabinput = 0, opt_ic_mousefsgauge = 0, opt_ic_mousefilt = 0, opt_ic_help0 = 0, opt_ic_help1 = 0, opt_ic_help2 = 0;
static int opt_ic_usejoy = 0, opt_ic_usemouse = 0, opt_ic_confkey = 0, opt_ic_confjoy = 0, opt_ic_confmouse = 0, opt_ic_confweap = 0, opt_ic_mouseflightsim = 0, opt_ic_joymousesens = 0, opt_ic_grabinput = 0, opt_ic_mousefsgauge = 0, opt_ic_help0 = 0, opt_ic_help1 = 0, opt_ic_help2 = 0;
int input_config_menuset(newmenu *menu, d_event *event, void *userdata)
{
newmenu_item *items = newmenu_get_items(menu);
@ -1080,8 +1080,6 @@ int input_config_menuset(newmenu *menu, d_event *event, void *userdata)
GameCfg.Grabinput = items[citem].value;
if (citem == opt_ic_mousefsgauge)
PlayerCfg.MouseFSIndicator = items[citem].value;
if (citem == opt_ic_mousefilt)
PlayerCfg.MouseFilter = items[citem].value;
break;
case EVENT_NEWMENU_SELECTED:
@ -1113,7 +1111,7 @@ int input_config_menuset(newmenu *menu, d_event *event, void *userdata)
void input_config()
{
newmenu_item m[21];
newmenu_item m[20];
int nitems = 0;
opt_ic_usejoy = nitems;
@ -1142,8 +1140,6 @@ void input_config()
m[nitems].type = NM_TYPE_CHECK; m[nitems].text= "Keep Keyboard/Mouse focus"; m[nitems].value = GameCfg.Grabinput; nitems++;
opt_ic_mousefsgauge = nitems;
m[nitems].type = NM_TYPE_CHECK; m[nitems].text= "Mouse FlightSim Indicator"; m[nitems].value = PlayerCfg.MouseFSIndicator; nitems++;
opt_ic_mousefilt = nitems;
m[nitems].type = NM_TYPE_CHECK; m[nitems].text= "Mouse Smoothing/Filtering"; m[nitems].value = PlayerCfg.MouseFilter; nitems++;
m[nitems].type = NM_TYPE_TEXT; m[nitems].text = ""; nitems++;
opt_ic_help0 = nitems;
m[nitems].type = NM_TYPE_MENU; m[nitems].text = "GAME SYSTEM KEYS"; nitems++;

View file

@ -82,7 +82,6 @@ int new_player_config()
PlayerCfg.MouseSens[0] = PlayerCfg.MouseSens[1] = PlayerCfg.MouseSens[2] = PlayerCfg.MouseSens[3] = PlayerCfg.MouseSens[4] = 8;
PlayerCfg.MouseFSDead = 0;
PlayerCfg.MouseFSIndicator = 1;
PlayerCfg.MouseFilter = 0;
PlayerCfg.CockpitMode[0] = PlayerCfg.CockpitMode[1] = CM_FULL_COCKPIT;
PlayerCfg.ReticleType = RET_TYPE_CLASSIC;
PlayerCfg.ReticleRGBA[0] = RET_COLOR_DEFAULT_R; PlayerCfg.ReticleRGBA[1] = RET_COLOR_DEFAULT_G; PlayerCfg.ReticleRGBA[2] = RET_COLOR_DEFAULT_B; PlayerCfg.ReticleRGBA[3] = RET_COLOR_DEFAULT_A;
@ -212,8 +211,6 @@ int read_player_d1x(char *filename)
PlayerCfg.MouseFSDead = atoi(line);
if(!strcmp(word,"FSINDI"))
PlayerCfg.MouseFSIndicator = atoi(line);
if(!strcmp(word,"FILTER"))
PlayerCfg.MouseFilter = atoi(line);
d_free(word);
cfgets(line,50,f);
word=splitword(line,'=');
@ -576,7 +573,6 @@ int write_player_d1x(char *filename)
PHYSFSX_printf(fout,"sensitivity4=%d\n",PlayerCfg.MouseSens[4]);
PHYSFSX_printf(fout,"fsdead=%d\n",PlayerCfg.MouseFSDead);
PHYSFSX_printf(fout,"fsindi=%d\n",PlayerCfg.MouseFSIndicator);
PHYSFSX_printf(fout,"filter=%d\n",PlayerCfg.MouseFilter);
PHYSFSX_printf(fout,"[end]\n");
PHYSFSX_printf(fout,"[weapon keys v2]\n");
PHYSFSX_printf(fout,"1=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[0],PlayerCfg.KeySettingsD1X[1],PlayerCfg.KeySettingsD1X[2]);

View file

@ -65,7 +65,6 @@ typedef struct player_config
int MouseSens[5];
int MouseFSDead;
int MouseFSIndicator;
int MouseFilter;
int CockpitMode[2]; // 0 saves the "real" cockpit, 1 also saves letterbox and rear. Used to properly switch between modes and restore the real one.
char NetworkMessageMacro[4][MAX_MESSAGE_LEN];
int NetlifeKills;