mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Prettify some code where I felt was necessary.
git-svn-id: https://svn.eduke32.com/eduke32@3127 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
935f3ec50d
commit
0f35221820
5 changed files with 21 additions and 22 deletions
|
@ -150,6 +150,7 @@ void CONFIG_SetDefaultKeys(int32_t type)
|
|||
int32_t i,f;
|
||||
|
||||
Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
|
||||
|
||||
Bmemset(&KeyBindings,0,sizeof(KeyBindings));
|
||||
Bmemset(&MouseBindings,0,sizeof(MouseBindings));
|
||||
|
||||
|
@ -157,10 +158,10 @@ void CONFIG_SetDefaultKeys(int32_t type)
|
|||
{
|
||||
for (i=0; i < (int32_t)(sizeof(oldkeydefaults)/sizeof(oldkeydefaults[0])); i+=3)
|
||||
{
|
||||
f = CONFIG_FunctionNameToNum((char *)oldkeydefaults[i+0]);
|
||||
f = CONFIG_FunctionNameToNum(oldkeydefaults[i+0]);
|
||||
if (f == -1) continue;
|
||||
ud.config.KeyboardKeys[f][0] = KB_StringToScanCode((char *)oldkeydefaults[i+1]);
|
||||
ud.config.KeyboardKeys[f][1] = KB_StringToScanCode((char *)oldkeydefaults[i+2]);
|
||||
ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(oldkeydefaults[i+1]);
|
||||
ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(oldkeydefaults[i+2]);
|
||||
|
||||
if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]);
|
||||
else CONFIG_MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0);
|
||||
|
|
|
@ -745,9 +745,9 @@ void CONTROL_ProcessBinds(void)
|
|||
if (KB_KeyPressed(i) && (KeyBindings[i].repeat || (KeyBindings[i].laststate == 0)))
|
||||
{
|
||||
OSD_Dispatch(KeyBindings[i].cmd);
|
||||
KeyBindings[i].laststate = KB_KeyPressed(i);
|
||||
}
|
||||
else KeyBindings[i].laststate = KB_KeyPressed(i);
|
||||
|
||||
KeyBindings[i].laststate = KB_KeyPressed(i);
|
||||
}
|
||||
}
|
||||
while (i--);
|
||||
|
|
|
@ -243,7 +243,7 @@ const char *KB_ScanCodeToString(kb_scancode scancode)
|
|||
return "";
|
||||
}
|
||||
|
||||
kb_scancode KB_StringToScanCode(char * string)
|
||||
kb_scancode KB_StringToScanCode(const char * string)
|
||||
{
|
||||
uint32_t s;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ 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( char * string ); // convert a string into a scancode
|
||||
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
|
||||
|
|
|
@ -727,17 +727,11 @@ void onvideomodechange(int32_t newmode)
|
|||
{
|
||||
uint8_t palid;
|
||||
|
||||
if (newmode)
|
||||
{
|
||||
if (g_player[screenpeek].ps->palette < BASEPALCOUNT)
|
||||
palid = g_player[screenpeek].ps->palette;
|
||||
else
|
||||
palid = BASEPAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// XXX?
|
||||
if (!newmode || g_player[screenpeek].ps->palette < BASEPALCOUNT)
|
||||
palid = g_player[screenpeek].ps->palette;
|
||||
}
|
||||
else
|
||||
palid = BASEPAL;
|
||||
|
||||
#ifdef POLYMER
|
||||
if (getrendermode() == 4)
|
||||
|
@ -912,7 +906,7 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
|
|||
{
|
||||
int32_t i, j;
|
||||
|
||||
if (parm->numparms==1&&!Bstrcasecmp(parm->parms[0],"showkeys"))
|
||||
if (parm->numparms==1 && !Bstrcasecmp(parm->parms[0],"showkeys"))
|
||||
{
|
||||
for (i=0; ConsoleKeys[i].name; i++)
|
||||
OSD_Printf("%s\n",ConsoleKeys[i].name);
|
||||
|
@ -930,14 +924,16 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
|
|||
if (KeyBindings[i].cmd[0] && KeyBindings[i].key)
|
||||
{
|
||||
j++;
|
||||
OSD_Printf("%-9s %s\"%s\"\n",KeyBindings[i].key, KeyBindings[i].repeat?"":"norepeat ", KeyBindings[i].cmd);
|
||||
OSD_Printf("%-9s %s\"%s\"\n", KeyBindings[i].key, KeyBindings[i].repeat?"":"norepeat ",
|
||||
KeyBindings[i].cmd);
|
||||
}
|
||||
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
||||
if (MouseBindings[i].cmd[0] && MouseBindings[i].key)
|
||||
{
|
||||
j++;
|
||||
OSD_Printf("%-9s %s\"%s\"\n",MouseBindings[i].key, MouseBindings[i].repeat?"":"norepeat ",MouseBindings[i].cmd);
|
||||
OSD_Printf("%-9s %s\"%s\"\n", MouseBindings[i].key, MouseBindings[i].repeat?"":"norepeat ",
|
||||
MouseBindings[i].cmd);
|
||||
}
|
||||
|
||||
if (j == 0)
|
||||
|
@ -960,7 +956,8 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
|
|||
|
||||
if (parm->numparms < 2)
|
||||
{
|
||||
OSD_Printf("%-9s %s\"%s\"\n",ConsoleButtons[i], MouseBindings[i].repeat?"":"norepeat ",MouseBindings[i].cmd);
|
||||
OSD_Printf("%-9s %s\"%s\"\n", ConsoleButtons[i], MouseBindings[i].repeat?"":"norepeat ",
|
||||
MouseBindings[i].cmd);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
|
@ -989,7 +986,8 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
|
|||
|
||||
if (parm->numparms < 2)
|
||||
{
|
||||
OSD_Printf("%-9s %s\"%s\"\n",ConsoleKeys[i].name, KeyBindings[ConsoleKeys[i].id].repeat?"":"norepeat ", KeyBindings[ConsoleKeys[i].id].cmd);
|
||||
OSD_Printf("%-9s %s\"%s\"\n", ConsoleKeys[i].name, KeyBindings[ConsoleKeys[i].id].repeat?"":"norepeat ",
|
||||
KeyBindings[ConsoleKeys[i].id].cmd);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue