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;
if (!mousegrab)
if (!mousegrab || !appactive)
return;
mousex += rmouse->lLastX;
@ -211,7 +211,7 @@ void RI_PollDevices()
DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
}
if (mousegrab)
if (mousegrab && appactive)
{
// center the cursor in the window
POINT pt = { xdim>>1, ydim>>1 };

View file

@ -11817,15 +11817,16 @@ MAIN_LOOP_RESTART:
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
bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO);
CONTROL_ProcessBinds();
OSD_DispatchQueued();
if (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME)
{
faketimerhandler();
CONTROL_ProcessBinds();
getinput(myconnectindex);
G_HandleLocalKeys();
@ -11839,13 +11840,20 @@ MAIN_LOOP_RESTART:
Bmemcpy(&inputfifo[0][myconnectindex], &avg, 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)
if (i != myconnectindex)
{
//clearbufbyte(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t),0L);
computergetinput(i,&inputfifo[0][i]);
}
if (i != myconnectindex)
{
//clearbufbyte(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t),0L);
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)) &&

View file

@ -800,7 +800,7 @@ void CONTROL_GetInput(ControlInfo *info)
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);
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 mouseyaxismode = -1;
int32_t jump_input = 0;
int32_t jump_timer = 0;
void getinput(int32_t snum)
{
@ -2969,14 +2969,13 @@ void getinput(int32_t snum)
{
if (!(p->gm&MODE_MENU))
CONTROL_GetInput(&info[0]);
memset(&info[1], 0, sizeof(info[1]));
loc.fvel = vel = 0;
loc.svel = svel = 0;
loc.avel = angvel = 0;
loc.horz = horiz = 0;
Bmemset(&info[1], 0, sizeof(input_t));
Bmemset(&loc, 0, sizeof(input_t));
loc.bits = (((int32_t)g_gameQuit)<<SK_GAMEQUIT);
loc.extbits = (g_player[snum].pteam != g_player[snum].ps->team)<<6;
loc.extbits |= (1<<7);
return;
}
@ -2993,16 +2992,13 @@ void getinput(int32_t snum)
}
}
{
int32_t i;
if (g_myAimMode) i = analog_lookingupanddown;
else i = ud.config.MouseAnalogueAxes[1];
if (g_myAimMode) j = analog_lookingupanddown;
else j = ud.config.MouseAnalogueAxes[1];
if (i != mouseyaxismode)
{
CONTROL_MapAnalogAxis(1, i, controldevice_mouse);
mouseyaxismode = i;
}
if (j != mouseyaxismode)
{
CONTROL_MapAnalogAxis(1, j, controldevice_mouse);
mouseyaxismode = j;
}
CONTROL_GetInput(&info[0]);
@ -3055,9 +3051,9 @@ void getinput(int32_t snum)
}
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_Fire)<<SK_FIRE;
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))
CONTROL_ClearButton(gamefunc_Fire);
if (jump_input > 0)
jump_input--;
if (jump_timer > 0)
jump_timer--;
j=0;
@ -3236,10 +3232,6 @@ void getinput(int32_t snum)
return;
}
/*
if (numplayers > 1)
daang = myang;
else*/
daang = p->ang;
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)
{
int32_t i = 0;
extern int32_t jump_timer;
syncvaltail = 0L;
syncvaltottail = 0L;
memset(&syncstat, 0, sizeof(syncstat));
bufferjitter = 1;
mymaxlag = otherminlag = 0;
jump_input = 0;
jump_timer = 0;
movefifoplc = movefifosendplc = predictfifoplc = 0;
avg.fvel = avg.svel = avg.avel = avg.horz = avg.bits = avg.extbits = 0;