Beginnings of baselayer.cpp/.h refactor. This is 99.9% renames.

git-svn-id: https://svn.eduke32.com/eduke32@6827 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-04-12 21:02:31 +00:00
parent f41dc7b9c4
commit ee63d2c070
25 changed files with 641 additions and 708 deletions

View file

@ -642,14 +642,14 @@ static void CONTROL_PollDevices(ControlInfo *info)
if (CONTROL_JoystickEnabled)
{
int32_t i = joynumaxes-1;
int32_t i = joystick.numAxes-1;
Bmemcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes));
memset(CONTROL_JoyAxes, 0, sizeof(CONTROL_JoyAxes));
for (; i>=0; i--)
{
CONTROL_JoyAxes[i].analog = joyaxis[i];
CONTROL_JoyAxes[i].analog = joystick.pAxis[i];
CONTROL_DigitizeAxis(i, controldevice_joystick);
CONTROL_ScaleAxis(i, controldevice_joystick);
@ -859,8 +859,8 @@ int32_t CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t
// break;
// case controltype_keyboardandjoystick:
CONTROL_NumJoyAxes = min(MAXJOYAXES,joynumaxes);
CONTROL_NumJoyButtons = min(MAXJOYBUTTONS,joynumbuttons + 4*(joynumhats>0));
CONTROL_NumJoyAxes = min(MAXJOYAXES,joystick.numAxes);
CONTROL_NumJoyButtons = min(MAXJOYBUTTONS,joystick.numButtons + 4*(joystick.numHats>0));
CONTROL_JoystickEnabled = CONTROL_JoyPresent = (inputdevices&4)>>2;
// break;
//}

View file

@ -44,31 +44,31 @@ int32_t JOYSTICK_GetButtons(void)
{
int32_t buttons;
readjoybstatus(&buttons);
joyReadButtons(&buttons);
if (joynumhats > 0)
if (joystick.numHats > 0)
{
int32_t hat = JOYSTICK_GetHat(0);
if (hat != 0)
buttons |= hat << min(MAXJOYBUTTONS, joynumbuttons);
buttons |= hat << min(MAXJOYBUTTONS, joystick.numButtons);
}
return buttons;
}
int32_t JOYSTICK_ClearButton(int32_t b)
{
return (joyb &= ~b);
return (joystick.bits &= ~b);
}
void JOYSTICK_ClearAllButtons(void)
{
joyb = 0;
joystick.bits = 0;
}
int32_t JOYSTICK_GetHat(int32_t h)
{
if (h>=0 && h<joynumhats)
if (h>=0 && h<joystick.numHats)
{
if (joyhat[h] == -1)
if (joystick.pHat[h] == -1)
return (HAT_CENTERED);
else
{
@ -76,7 +76,7 @@ int32_t JOYSTICK_GetHat(int32_t h)
int32_t val;
// thanks SDL for this much more sensible method
val = ((joyhat[0] + 4500 / 2) % 36000) / 4500;
val = ((joystick.pHat[0] + 4500 / 2) % 36000) / 4500;
if (val < 8)
return hatstate[val];
}
@ -85,28 +85,28 @@ int32_t JOYSTICK_GetHat(int32_t h)
}
void JOYSTICK_ClearHat(int32_t h)
{
if (h>=0 && h<joynumhats)
joyhat[h] = -1;
if (h>=0 && h<joystick.numHats)
joystick.pHat[h] = -1;
}
void JOYSTICK_ClearAllHats(void)
{
int32_t h;
for (h=0; h<joynumhats; ++h)
joyhat[h] = -1;
for (h=0; h<joystick.numHats; ++h)
joystick.pHat[h] = -1;
}
int32_t JOYSTICK_GetAxis(int32_t a)
{
return ((a>=0 && a<joynumaxes)?joyaxis[a]:0);
return ((a>=0 && a<joystick.numAxes)?joystick.pAxis[a]:0);
}
void JOYSTICK_ClearAxis(int32_t a)
{
if (a>=0 && a<joynumaxes)
joyaxis[a] = 0;
if (a>=0 && a<joystick.numAxes)
joystick.pAxis[a] = 0;
}
void JOYSTICK_ClearAllAxes(void)
{
int32_t a;
for (a=0; a<joynumaxes; ++a)
joyaxis[a] = 0;
for (a=0; a<joystick.numAxes; ++a)
joystick.pAxis[a] = 0;
}