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

@ -59,9 +59,9 @@ extern kb_scancode KB_LastScan;
keystatus[(scan)] = FALSE; \
}
#define KB_UnBoundKeyPressed(scan) (keystatus[(scan)] != 0 && !CONTROL_KeyBinds[scan].cmdstr)
#define KB_GetCh bgetchar
#define KB_KeyWaiting bkbhit
#define KB_FlushKeyboardQueue bflushchars
#define KB_GetCh keyGetChar
#define KB_KeyWaiting keyBufferWaiting
#define KB_FlushKeyboardQueue keyFlushChars
static inline void KB_ClearKeysDown(void)
{
@ -75,8 +75,8 @@ static inline void KB_KeyEvent(int32_t scancode, int32_t keypressed)
KB_LastScan = scancode;
}
static inline void KB_Startup(void) { setkeypresscallback(KB_KeyEvent); }
static inline void KB_Shutdown(void) { setkeypresscallback((void (*)(int32_t, int32_t))NULL); }
static inline void KB_Startup(void) { keySetCallback(KB_KeyEvent); }
static inline void KB_Shutdown(void) { keySetCallback((void (*)(int32_t, int32_t))NULL); }
const char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string
kb_scancode KB_StringToScanCode( const char * string ); // convert a string into a scancode

View file

@ -48,12 +48,12 @@ extern "C" {
static inline int32_t Mouse_Init(void)
{
initmouse();
mouseInit();
return ((inputdevices & 2) == 2);
}
static inline void MOUSE_Shutdown(void) { uninitmouse(); }
static inline void MOUSE_Shutdown(void) { mouseUninit(); }
#if 0
static inline void MOUSE_ShowCursor(void) {}
@ -63,13 +63,13 @@ static inline void MOUSE_HideCursor(void) {}
static inline int32_t MOUSE_GetButtons(void)
{
int32_t buttons;
readmousebstatus(&buttons);
mouseReadButtons(&buttons);
return buttons;
}
#define MOUSE_ClearButton(b) (mouseb &= ~b)
#define MOUSE_ClearAllButtons() mouseb = 0
#define MOUSE_GetDelta(x, y) readmousexy(x, y)
#define MOUSE_ClearButton(b) (g_mouseBits &= ~b)
#define MOUSE_ClearAllButtons() g_mouseBits = 0
#define MOUSE_GetDelta(x, y) mouseReadPos(x, y)
#ifdef __cplusplus
}

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;
}