Make sure there's some binds set up (the rerelease lacks a usable default.cfg).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6037 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-08-23 06:37:10 +00:00
parent b33d20fa75
commit 81d5091fac
3 changed files with 46 additions and 0 deletions

View file

@ -425,6 +425,8 @@ void CL_MakeActive(char *gamename)
else else
TP_ExecTrigger("f_spawn", false); TP_ExecTrigger("f_spawn", false);
Key_EnsureBinds();
#ifdef __GLIBC__ #ifdef __GLIBC__
malloc_trim(0); malloc_trim(0);
#endif #endif

View file

@ -2778,6 +2778,49 @@ void Key_WriteBindings (vfsfile_t *f)
} }
} }
void Key_EnsureBinds(void)
{
int i, m;
if (cls.demoplayback)
return;
for (i=0 ; i<=K_AUX16 ; i++)
{
for (m = 0; m < KEY_MODIFIERSTATES; m++)
{
if (keybindings[i][m])
return;
}
}
Key_SetBinding ('`', ~0, "toggleconsole", RESTRICT_LOCAL);
Key_SetBinding ('w', ~0, "+forward", RESTRICT_LOCAL);
Key_SetBinding ('s', ~0, "+back", RESTRICT_LOCAL);
Key_SetBinding ('a', ~0, "+moveleft", RESTRICT_LOCAL);
Key_SetBinding ('d', ~0, "+moveright", RESTRICT_LOCAL);
Key_SetBinding (K_MOUSE1, ~0, "+attack", RESTRICT_LOCAL);
Key_SetBinding (K_MOUSE2, ~0, "+jump", RESTRICT_LOCAL);
Key_SetBinding (K_SPACE, ~0, "+jump", RESTRICT_LOCAL);
Key_SetBinding ('c', ~0, "+movedown", RESTRICT_LOCAL);
Key_SetBinding ('v', ~0, "+voip", RESTRICT_LOCAL);
Key_SetBinding ('t', ~0, "messagemode2", RESTRICT_LOCAL);
Key_SetBinding ('y', ~0, "messagemode", RESTRICT_LOCAL);
Key_SetBinding (K_TAB, ~0, "+showscores", RESTRICT_LOCAL);
Key_SetBinding (K_MWHEELUP, ~0, "impulse 12", RESTRICT_LOCAL);
Key_SetBinding (K_MWHEELDOWN, ~0, "impulse 10", RESTRICT_LOCAL);
Key_SetBinding ('1', ~0, "impulse 1", RESTRICT_LOCAL);
Key_SetBinding ('2', ~0, "impulse 2", RESTRICT_LOCAL);
Key_SetBinding ('3', ~0, "impulse 3", RESTRICT_LOCAL);
Key_SetBinding ('4', ~0, "impulse 4", RESTRICT_LOCAL);
Key_SetBinding ('5', ~0, "impulse 5", RESTRICT_LOCAL);
Key_SetBinding ('6', ~0, "impulse 6", RESTRICT_LOCAL);
Key_SetBinding ('7', ~0, "impulse 7", RESTRICT_LOCAL);
Key_SetBinding ('8', ~0, "impulse 8", RESTRICT_LOCAL);
Key_SetBinding (K_RSHIFT, ~0, "+speed", RESTRICT_LOCAL);
Menu_Prompt(NULL, NULL, "Configuration missing...\nSetting up some automatic binds..", NULL, NULL, "Okay");
}
/* /*
=================== ===================

View file

@ -321,6 +321,7 @@ void IN_WriteButtons(vfsfile_t *f, qboolean all);
void Key_WriteBindings (struct vfsfile_s *f); void Key_WriteBindings (struct vfsfile_s *f);
void Key_SetBinding (int keynum, int modifier, const char *binding, int cmdlevel); void Key_SetBinding (int keynum, int modifier, const char *binding, int cmdlevel);
void Key_ClearStates (void); void Key_ClearStates (void);
void Key_EnsureBinds(void);
qboolean Key_Centerprint(int key, int unicode, unsigned int devid); qboolean Key_Centerprint(int key, int unicode, unsigned int devid);
void Key_Unbindall_f (void); //aka: Key_Shutdown void Key_Unbindall_f (void); //aka: Key_Shutdown
void Key_ConsoleReplace(const char *instext); void Key_ConsoleReplace(const char *instext);