Believe it or not, this actually consistently gave me a few fps in my test scenario

git-svn-id: https://svn.eduke32.com/eduke32@1014 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-08-24 04:55:57 +00:00
parent 7082436267
commit cf2f7927ea

View file

@ -669,14 +669,16 @@ void CONTROL_PollDevices(ControlInfo *info)
{ {
CONTROL_GetMouseDelta(); CONTROL_GetMouseDelta();
for (i=0; i<MAXMOUSEAXES; i++) i = MAXMOUSEAXES-1;
do
{ {
CONTROL_DigitizeAxis(i, controldevice_mouse); CONTROL_DigitizeAxis(i, controldevice_mouse);
CONTROL_ScaleAxis(i, controldevice_mouse); CONTROL_ScaleAxis(i, controldevice_mouse);
LIMITCONTROL(&CONTROL_MouseAxes[i].analog); LIMITCONTROL(&CONTROL_MouseAxes[i].analog);
CONTROL_ApplyAxis(i, info, controldevice_mouse); CONTROL_ApplyAxis(i, info, controldevice_mouse);
} while (--i >= 0);
} }
}
if (CONTROL_JoystickEnabled) if (CONTROL_JoystickEnabled)
{ {
CONTROL_GetJoyDelta(); CONTROL_GetJoyDelta();
@ -685,13 +687,14 @@ void CONTROL_PollDevices(ControlInfo *info)
//CONTROL_Axes[0].analog /= 2; //CONTROL_Axes[0].analog /= 2;
//CONTROL_Axes[2].analog /= 2; //CONTROL_Axes[2].analog /= 2;
for (i=0; i<MAXJOYAXES; i++) i = MAXJOYAXES-1;
do
{ {
CONTROL_DigitizeAxis(i, controldevice_joystick); CONTROL_DigitizeAxis(i, controldevice_joystick);
CONTROL_ScaleAxis(i, controldevice_joystick); CONTROL_ScaleAxis(i, controldevice_joystick);
LIMITCONTROL(&CONTROL_JoyAxes[i].analog); LIMITCONTROL(&CONTROL_JoyAxes[i].analog);
CONTROL_ApplyAxis(i, info, controldevice_joystick); CONTROL_ApplyAxis(i, info, controldevice_joystick);
} } while (--i >= 0);
} }
CONTROL_GetDeviceButtons(); CONTROL_GetDeviceButtons();
@ -701,7 +704,8 @@ void CONTROL_AxisFunctionState(int32 *p1)
{ {
int32 i, j; int32 i, j;
for (i=0; i<CONTROL_NumMouseAxes; i++) i = CONTROL_NumMouseAxes-1;
do
{ {
if (!CONTROL_MouseAxes[i].digital) continue; if (!CONTROL_MouseAxes[i].digital) continue;
@ -712,9 +716,11 @@ void CONTROL_AxisFunctionState(int32 *p1)
if (j != AXISUNDEFINED) if (j != AXISUNDEFINED)
p1[j] = 1; p1[j] = 1;
} } while (--i >= 0);
for (i=0; i<CONTROL_NumJoyAxes; i++) i = CONTROL_NumJoyAxes-1;
do
{ {
if (!CONTROL_JoyAxes[i].digital) continue; if (!CONTROL_JoyAxes[i].digital) continue;
@ -725,14 +731,14 @@ void CONTROL_AxisFunctionState(int32 *p1)
if (j != AXISUNDEFINED) if (j != AXISUNDEFINED)
p1[j] = 1; p1[j] = 1;
} } while (--i >= 0);
} }
void CONTROL_ButtonFunctionState(int32 *p1) void CONTROL_ButtonFunctionState(int32 *p1)
{ {
int32 i, j; int32 i = CONTROL_NumMouseButtons-1, j;
for (i=0; i<CONTROL_NumMouseButtons; i++) do
{ {
if (bindsenabled) if (bindsenabled)
{ {
@ -740,8 +746,6 @@ void CONTROL_ButtonFunctionState(int32 *p1)
{ {
if (mousebind[i].repeat || (mousebind[i].laststate == 0)) if (mousebind[i].repeat || (mousebind[i].laststate == 0))
OSD_Dispatch(mousebind[i].cmd); OSD_Dispatch(mousebind[i].cmd);
// if (!boundkeys[i].repeat)
// KB_ClearKeyDown(i);
} }
mousebind[i].laststate = CONTROL_MouseButtonState[i]; mousebind[i].laststate = CONTROL_MouseButtonState[i];
} }
@ -756,9 +760,10 @@ void CONTROL_ButtonFunctionState(int32 *p1)
if (j != KEYUNDEFINED) if (j != KEYUNDEFINED)
p1[j] |= CONTROL_MouseButtonState[i]; p1[j] |= CONTROL_MouseButtonState[i];
} }
} } while (--i >= 0);
for (i=0; i<CONTROL_NumJoyButtons; i++) i=CONTROL_NumJoyButtons-1;
do
{ {
j = CONTROL_JoyButtonMapping[i].doubleclicked; j = CONTROL_JoyButtonMapping[i].doubleclicked;
if (j != KEYUNDEFINED) if (j != KEYUNDEFINED)
@ -767,7 +772,7 @@ void CONTROL_ButtonFunctionState(int32 *p1)
j = CONTROL_JoyButtonMapping[i].singleclicked; j = CONTROL_JoyButtonMapping[i].singleclicked;
if (j != KEYUNDEFINED) if (j != KEYUNDEFINED)
p1[j] |= CONTROL_JoyButtonState[i]; p1[j] |= CONTROL_JoyButtonState[i];
} } while (--i >= 0);
} }
/* /*
void CONTROL_GetUserInput( UserInput *info ) void CONTROL_GetUserInput( UserInput *info )
@ -865,27 +870,31 @@ void CONTROL_ClearButton(int32 whichbutton)
void CONTROL_ProcessBinds(void) void CONTROL_ProcessBinds(void)
{ {
int i; int i=MAXBOUNDKEYS-1;
if (!bindsenabled) return; if (!bindsenabled) return;
do
for (i=0;i<MAXBOUNDKEYS;i++)
{ {
if (boundkeys[i].cmd[0] && KB_KeyPressed(i)) if (boundkeys[i].cmd[0] && KB_KeyPressed(i))
{ {
if (boundkeys[i].repeat || (boundkeys[i].laststate == 0)) if (boundkeys[i].repeat || (boundkeys[i].laststate == 0))
OSD_Dispatch(boundkeys[i].cmd); OSD_Dispatch(boundkeys[i].cmd);
// if (!boundkeys[i].repeat)
// KB_ClearKeyDown(i);
} }
boundkeys[i].laststate = KB_KeyPressed(i); boundkeys[i].laststate = KB_KeyPressed(i);
} while (--i);
if (boundkeys[0].cmd[0] && KB_KeyPressed(0))
{
if (boundkeys[0].repeat || (boundkeys[0].laststate == 0))
OSD_Dispatch(boundkeys[0].cmd);
} }
boundkeys[0].laststate = KB_KeyPressed(0);
} }
void CONTROL_GetInput(ControlInfo *info) void CONTROL_GetInput(ControlInfo *info)
{ {
int32 i, periphs[CONTROL_NUM_FLAGS]; int32 periphs[CONTROL_NUM_FLAGS];
CONTROL_PollDevices(info); CONTROL_PollDevices(info);
@ -899,13 +908,22 @@ void CONTROL_GetInput(ControlInfo *info)
CONTROL_ProcessBinds(); CONTROL_ProcessBinds();
for (i=0; i<CONTROL_NUM_FLAGS; i++) {
int32 i = CONTROL_NUM_FLAGS-1;
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;
} while (--i);
CONTROL_SetFlag(0, CONTROL_KeyboardFunctionPressed(0) | periphs[0] | extinput[0]);
if (CONTROL_Flags[0].cleared == false) BUTTONSET(0, CONTROL_Flags[0].active);
else if (CONTROL_Flags[0].active == false) CONTROL_Flags[0].cleared = 0;
} }
memset(extinput, 0, sizeof(extinput)); memset(extinput, 0, sizeof(extinput));
} }