Further minor MACT cleanups

git-svn-id: https://svn.eduke32.com/eduke32@3200 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-11-17 16:48:11 +00:00
parent bbbeefc6a1
commit 83ae3a407a
8 changed files with 40 additions and 153 deletions

View file

@ -7069,7 +7069,7 @@ static void G_CheatGetInv(void)
static void end_cheat(void)
{
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
}
static int8_t cheatbuf[MAXCHEATLEN], cheatbuflen;
@ -7105,7 +7105,7 @@ GAME_STATIC void G_DoCheats(void)
{
while (KB_KeyWaiting())
{
ch = Btolower(KB_Getch());
ch = Btolower(KB_GetCh());
if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')))
{
@ -7169,7 +7169,7 @@ FOUNDCHEAT:
case CHEAT_KEYS:
g_player[myconnectindex].ps->got_access = 7;
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
end_cheat();
return;
@ -7451,7 +7451,7 @@ FOUNDCHEAT:
ud.eog = 1;
g_player[myconnectindex].ps->player_par = 0;
g_player[myconnectindex].ps->gm |= MODE_EOL;
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
return;
}
}

View file

@ -1741,11 +1741,20 @@ skip_check:
int32_t j = Gv_GetVarX(*insptr++);
if ((unsigned)i >= MAXQUOTES)
{
CON_ERRPRINTF("invalid quote ID %d\n", i);
continue;
}
else if ((ScriptQuotes[i] == NULL))
{
CON_ERRPRINTF("null quote %d\n", i);
continue;
}
else if ((unsigned)f >= NUMGAMEFUNCTIONS)
{
CON_ERRPRINTF("invalid function %d\n", f);
continue;
}
else
{
if (j < 2)

View file

@ -39,7 +39,7 @@ int32_t I_CheckAllInput(void)
}
void I_ClearAllInput(void)
{
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
KB_ClearKeysDown();
MOUSE_ClearAllButtons();
JOYSTICK_ClearAllButtons();
@ -55,7 +55,7 @@ int32_t I_CheckInputWaiting(void)
}
int32_t I_ClearInputWaiting(void)
{
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
KB_ClearKeysDown(); // JBF
I_JoystickAdvanceTriggerClear();
return (
@ -137,7 +137,7 @@ int32_t I_AdvanceTrigger(void)
}
int32_t I_AdvanceTriggerClear(void)
{
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_kpad_Enter);
KB_ClearKeyDown(sc_Enter);
I_JoystickAdvanceTriggerClear();
@ -155,7 +155,7 @@ int32_t I_ReturnTrigger(void)
}
int32_t I_ReturnTriggerClear(void)
{
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_Escape);
return (
MOUSE_ClearButton(RIGHT_MOUSE) ||
@ -171,7 +171,7 @@ int32_t I_EscapeTrigger(void)
}
int32_t I_EscapeTriggerClear(void)
{
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_Escape);
return (
I_JoystickEscapeTriggerClear()
@ -197,7 +197,7 @@ int32_t I_PanelUp(void)
}
int32_t I_PanelUpClear(void)
{
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_LeftArrow);
KB_ClearKeyDown(sc_kpad_4);
KB_ClearKeyDown(sc_UpArrow);
@ -230,7 +230,7 @@ int32_t I_PanelDown(void)
}
int32_t I_PanelDownClear(void)
{
KB_FlushKeyBoardQueue();
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_RightArrow);
KB_ClearKeyDown(sc_kpad_6);
KB_ClearKeyDown(sc_DownArrow);
@ -257,7 +257,7 @@ int32_t _EnterText(int32_t small,int32_t x,int32_t y,char *t,int32_t dalen,int32
char ch;
int32_t i;
while ((ch = KB_Getch()) != 0)
while ((ch = KB_GetCh()) != 0)
{
if (ch == asc_BackSpace)
{

View file

@ -574,17 +574,15 @@ static void CONTROL_ApplyAxis(int32_t axis, ControlInfo *info, controldevice dev
static void CONTROL_PollDevices(ControlInfo *info)
{
Bmemcpy(CONTROL_LastMouseAxes, CONTROL_MouseAxes, sizeof(CONTROL_MouseAxes));
Bmemcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes));
memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes));
memset(CONTROL_JoyAxes, 0, sizeof(CONTROL_JoyAxes));
memset(info, 0, sizeof(ControlInfo));
if (CONTROL_MouseEnabled)
{
int32_t i = MAXMOUSEAXES-1;
Bmemcpy(CONTROL_LastMouseAxes, CONTROL_MouseAxes, sizeof(CONTROL_MouseAxes));
memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes));
CONTROL_GetMouseDelta();
for (; i>=0; i--)
{
@ -599,6 +597,9 @@ static void CONTROL_PollDevices(ControlInfo *info)
{
int32_t i = joynumaxes-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];

View file

@ -148,13 +148,7 @@ extern uint64_t CONTROL_ButtonHeldState;
//***************************************************************************
//void CONTROL_MapKey( int32_t which, kb_scancode key1, kb_scancode key2 );
void CONTROL_MapButton
(
int32_t whichfunction,
int32_t whichbutton,
int32_t doubleclicked,
controldevice device
);
void CONTROL_MapButton(int32_t whichfunction, int32_t whichbutton, int32_t doubleclicked, controldevice device);
void CONTROL_DefineFlag( int32_t which, int32_t toggle );
int32_t CONTROL_FlagActive( int32_t which );
void CONTROL_ClearAssignments( void );
@ -162,43 +156,21 @@ void CONTROL_ClearAssignments( void );
void CONTROL_GetInput( ControlInfo *info );
void CONTROL_ClearButton( int32_t whichbutton );
extern float CONTROL_MouseSensitivity;
int32_t CONTROL_Startup
(
controltype which,
int32_t ( *TimeFunction )( void ),
int32_t ticspersecond
);
int32_t CONTROL_Startup(controltype which, int32_t ( *TimeFunction )( void ), int32_t ticspersecond);
void CONTROL_Shutdown( void );
void CONTROL_SetDoubleClickDelay(int32_t delay);
int32_t CONTROL_GetDoubleClickDelay(void);
void CONTROL_MapAnalogAxis
(
int32_t whichaxis,
int32_t whichanalog,
controldevice device
);
void CONTROL_MapDigitalAxis
(
int32_t whichaxis,
int32_t whichfunction,
int32_t direction,
controldevice device
);
void CONTROL_SetAnalogAxisScale
(
int32_t whichaxis,
int32_t axisscale,
controldevice device
);
void CONTROL_MapAnalogAxis(int32_t whichaxis, int32_t whichanalog, controldevice device);
void CONTROL_MapDigitalAxis(int32_t whichaxis, int32_t whichfunction, int32_t direction, controldevice device);
void CONTROL_SetAnalogAxisScale(int32_t whichaxis, int32_t axisscale, controldevice device);
void CONTROL_PrintKeyMap(void);
void CONTROL_PrintControlFlag(int32_t which);
void CONTROL_PrintAxes( void );
#define MAXBOUNDKEYS 256
#define MAXBOUNDKEYS MAXKEYBOARDSCAN
typedef struct binding {
const char *key;

View file

@ -37,11 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "keyboard.h"
#include "control.h"
kb_scancode KB_LastScan;
static int32_t numpad = 0;
// translation table for taking key names to scancodes and back again
static struct
{
@ -152,79 +149,6 @@ static struct
{ "Delete", 0xd3 },
};
// translation table for turning scancode into ascii characters
/*
static char sctoasc[2][256] = {
{
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 8, 9, // 0x00
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 13, 0, 'a', 's', // 0x10
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'','`', 0, '\\','z', 'x', 'c', 'v', // 0x20
'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, // 0x30
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', 0, 0, 0, '+', 0, // 0x40
0, 0, 0, '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x50
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x60
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x70
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x80
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, // 0x90
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xa0
0, 0, 0, 0, 0, '/', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xb0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xc0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xd0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xe0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 0xf0
},
{
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 8, 9, // 0x00
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 13, 0, 'A', 'S', // 0x10
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 0, '|', 'Z', 'X', 'C', 'V', // 0x20
'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, // 0x30
0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', // 0x40
'2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x50
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x60
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x70
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x80
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, // 0x90
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xa0
0, 0, 0, 0, 0, '/', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xb0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xc0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xd0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xe0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 0xf0
}
};
*/
int32_t KB_KeyWaiting(void)
{
return bkbhit();
// return (keyfifoplc != keyfifoend);
}
char KB_Getch(void)
{
/*
uint8_t ch;
char shifted;
if (keyfifoplc == keyfifoend) return 0;
ch = keyfifo[keyfifoplc];
keyfifoplc = ((keyfifoplc+2)&(KEYFIFOSIZ-1));
shifted = ((keystatus[0x2a]!=0)||(keystatus[0x36]!=0));
if (ch >= 0x47 && ch <= 0x52) shifted = numpad;
return sctoasc[shifted][ch];
*/
return (char)bgetchar();
}
void KB_FlushKeyboardQueue(void)
{
//keyfifoplc = keyfifoend = 0;
bflushchars();
}
void KB_ClearKeysDown(void)
{
KB_LastScan = 0;
@ -253,21 +177,6 @@ kb_scancode KB_StringToScanCode(const char * string)
return 0;
}
void KB_TurnKeypadOn(void)
{
numpad = 1;
}
void KB_TurnKeypadOff(void)
{
numpad = 0;
}
int32_t KB_KeypadActive(void)
{
return numpad;
}
static void KB_KeyEvent(int32_t scancode, int32_t keypressed)
{
if (keypressed) KB_LastScan = scancode;
@ -275,7 +184,6 @@ static void KB_KeyEvent(int32_t scancode, int32_t keypressed)
void KB_Startup(void)
{
numpad = 0;
setkeypresscallback(KB_KeyEvent);
}

View file

@ -80,6 +80,12 @@ extern kb_scancode KB_LastScan;
#define KB_UnBoundKeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 && !CONTROL_KeyBinds[scan].cmdstr)
#define KB_GetCh bgetchar
#define KB_KeyWaiting bkbhit
#define KB_FlushKeyboardQueue bflushchars
/*
=============================================================================
@ -88,21 +94,12 @@ extern kb_scancode KB_LastScan;
=============================================================================
*/
int32_t KB_KeyWaiting( void ); // Checks if a character is waiting in the keyboard queue
char KB_Getch( void ); // Gets the next keypress
void KB_FlushKeyboardQueue( void ); // Empties the keyboard queue of all waiting characters.
void KB_ClearKeysDown( void ); // Clears all keys down flags.
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
void KB_TurnKeypadOn( void ); // turn the keypad on
void KB_TurnKeypadOff( void ); // turn the keypad off
int32_t KB_KeypadActive( void ); // check whether keypad is active
void KB_Startup( void );
void KB_Shutdown( void );
#define KB_FlushKeyBoardQueue KB_FlushKeyboardQueue
#define KB_GetCh KB_Getch
#ifdef EXTERNC
};
#endif

View file

@ -2346,7 +2346,7 @@ cheat_for_port_credits2:
else
{
char ch2, ch;
ch = KB_Getch();
ch = KB_GetCh();
if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')))
{
if (ch >= 'a') ch -= ('a'-'A');