fix mouse positioning issue when using alt+tab on win32 and fix game speed at low framerates

git-svn-id: https://svn.eduke32.com/eduke32@1633 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2010-05-08 20:15:24 +00:00
parent bb21e1c05f
commit a6b614f6bf
5 changed files with 36 additions and 37 deletions

View file

@ -25,7 +25,7 @@ static inline void RI_ProcessMouse(const RAWMOUSE* rmouse)
{ {
int32_t i, mask; int32_t i, mask;
if (!mousegrab) if (!mousegrab || !appactive)
return; return;
mousex += rmouse->lLastX; mousex += rmouse->lLastX;
@ -211,7 +211,7 @@ void RI_PollDevices()
DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam); DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
} }
if (mousegrab) if (mousegrab && appactive)
{ {
// center the cursor in the window // center the cursor in the window
POINT pt = { xdim>>1, ydim>>1 }; POINT pt = { xdim>>1, ydim>>1 };

View file

@ -11817,15 +11817,16 @@ MAIN_LOOP_RESTART:
quitevent = 0; quitevent = 0;
} }
sampletimer();
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO); bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO);
CONTROL_ProcessBinds();
OSD_DispatchQueued(); OSD_DispatchQueued();
if (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME) if (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME)
{ {
faketimerhandler(); CONTROL_ProcessBinds();
getinput(myconnectindex); getinput(myconnectindex);
G_HandleLocalKeys(); G_HandleLocalKeys();
@ -11839,13 +11840,20 @@ MAIN_LOOP_RESTART:
Bmemcpy(&inputfifo[0][myconnectindex], &avg, sizeof(input_t)); Bmemcpy(&inputfifo[0][myconnectindex], &avg, sizeof(input_t));
Bmemset(&avg, 0, sizeof(input_t)); Bmemset(&avg, 0, sizeof(input_t));
if ((g_netServer || ud.multimode > 1) && ud.playerai) /*
if (ud.playerai && (g_netServer || ud.multimode > 1))
{
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
if (i != myconnectindex) if (i != myconnectindex)
{ {
//clearbufbyte(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t),0L); //clearbufbyte(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t),0L);
computergetinput(i,&inputfifo[0][i]); computergetinput(i,&inputfifo[0][i]);
} }
}
*/
do faketimerhandler();
while (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME);
} }
if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) && if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&

View file

@ -800,7 +800,7 @@ void CONTROL_GetInput(ControlInfo *info)
do do
{ {
CONTROL_SetFlag(i, CONTROL_KeyboardFunctionPressed(i) | periphs[i] | extinput[i]); CONTROL_SetFlag(i, /*CONTROL_KeyboardFunctionPressed(i) | */periphs[i] | extinput[i]);
if (CONTROL_Flags[i].cleared == FALSE) BUTTONSET(i, CONTROL_Flags[i].active); if (CONTROL_Flags[i].cleared == FALSE) BUTTONSET(i, CONTROL_Flags[i].active);
else if (CONTROL_Flags[i].active == FALSE) CONTROL_Flags[i].cleared = 0; else if (CONTROL_Flags[i].active == FALSE) CONTROL_Flags[i].cleared = 0;

View file

@ -2952,7 +2952,7 @@ void P_DisplayWeapon(int32_t snum)
int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0; int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0;
int32_t mouseyaxismode = -1; int32_t mouseyaxismode = -1;
int32_t jump_input = 0; int32_t jump_timer = 0;
void getinput(int32_t snum) void getinput(int32_t snum)
{ {
@ -2969,14 +2969,13 @@ void getinput(int32_t snum)
{ {
if (!(p->gm&MODE_MENU)) if (!(p->gm&MODE_MENU))
CONTROL_GetInput(&info[0]); CONTROL_GetInput(&info[0]);
memset(&info[1], 0, sizeof(info[1]));
loc.fvel = vel = 0; Bmemset(&info[1], 0, sizeof(input_t));
loc.svel = svel = 0; Bmemset(&loc, 0, sizeof(input_t));
loc.avel = angvel = 0;
loc.horz = horiz = 0;
loc.bits = (((int32_t)g_gameQuit)<<SK_GAMEQUIT); loc.bits = (((int32_t)g_gameQuit)<<SK_GAMEQUIT);
loc.extbits = (g_player[snum].pteam != g_player[snum].ps->team)<<6; loc.extbits = (g_player[snum].pteam != g_player[snum].ps->team)<<6;
loc.extbits |= (1<<7); loc.extbits |= (1<<7);
return; return;
} }
@ -2993,16 +2992,13 @@ void getinput(int32_t snum)
} }
} }
{ if (g_myAimMode) j = analog_lookingupanddown;
int32_t i; else j = ud.config.MouseAnalogueAxes[1];
if (g_myAimMode) i = analog_lookingupanddown;
else i = ud.config.MouseAnalogueAxes[1];
if (i != mouseyaxismode) if (j != mouseyaxismode)
{ {
CONTROL_MapAnalogAxis(1, i, controldevice_mouse); CONTROL_MapAnalogAxis(1, j, controldevice_mouse);
mouseyaxismode = i; mouseyaxismode = j;
}
} }
CONTROL_GetInput(&info[0]); CONTROL_GetInput(&info[0]);
@ -3055,9 +3051,9 @@ void getinput(int32_t snum)
} }
if (BUTTON(gamefunc_Jump) && p->on_ground) if (BUTTON(gamefunc_Jump) && p->on_ground)
jump_input = 4; jump_timer = 4;
loc.bits = (jump_input > 0 || BUTTON(gamefunc_Jump))<<SK_JUMP; //BUTTON(gamefunc_Jump); loc.bits = (jump_timer > 0 || BUTTON(gamefunc_Jump))<<SK_JUMP;
loc.bits |= BUTTON(gamefunc_Crouch)<<SK_CROUCH; loc.bits |= BUTTON(gamefunc_Crouch)<<SK_CROUCH;
loc.bits |= BUTTON(gamefunc_Fire)<<SK_FIRE; loc.bits |= BUTTON(gamefunc_Fire)<<SK_FIRE;
loc.bits |= BUTTON(gamefunc_Aim_Up)<<SK_AIM_UP; loc.bits |= BUTTON(gamefunc_Aim_Up)<<SK_AIM_UP;
@ -3070,8 +3066,8 @@ void getinput(int32_t snum)
if (aplWeaponFlags[g_player[snum].ps->curr_weapon][snum] & WEAPON_SEMIAUTO && BUTTON(gamefunc_Fire)) if (aplWeaponFlags[g_player[snum].ps->curr_weapon][snum] & WEAPON_SEMIAUTO && BUTTON(gamefunc_Fire))
CONTROL_ClearButton(gamefunc_Fire); CONTROL_ClearButton(gamefunc_Fire);
if (jump_input > 0) if (jump_timer > 0)
jump_input--; jump_timer--;
j=0; j=0;
@ -3236,10 +3232,6 @@ void getinput(int32_t snum)
return; return;
} }
/*
if (numplayers > 1)
daang = myang;
else*/
daang = p->ang; daang = p->ang;
momx = mulscale9(vel,sintable[(daang+2560)&2047]); momx = mulscale9(vel,sintable[(daang+2560)&2047]);

View file

@ -1588,18 +1588,17 @@ void Net_WaitForServer(void)
} }
} }
extern int32_t jump_input;
void clearfifo(void) void clearfifo(void)
{ {
int32_t i = 0; int32_t i = 0;
extern int32_t jump_timer;
syncvaltail = 0L; syncvaltail = 0L;
syncvaltottail = 0L; syncvaltottail = 0L;
memset(&syncstat, 0, sizeof(syncstat)); memset(&syncstat, 0, sizeof(syncstat));
bufferjitter = 1; bufferjitter = 1;
mymaxlag = otherminlag = 0; mymaxlag = otherminlag = 0;
jump_input = 0; jump_timer = 0;
movefifoplc = movefifosendplc = predictfifoplc = 0; movefifoplc = movefifosendplc = predictfifoplc = 0;
avg.fvel = avg.svel = avg.avel = avg.horz = avg.bits = avg.extbits = 0; avg.fvel = avg.svel = avg.avel = avg.horz = avg.bits = avg.extbits = 0;