- more work on console code.

This commit is contained in:
Christoph Oelckers 2020-04-11 17:59:15 +02:00
commit 4a50f78bfe
6 changed files with 218 additions and 142 deletions

View file

@ -51,14 +51,16 @@ public:
bool DoKey(event_t *ev);
void ArchiveBindings(FConfigFile *F, const char *matchcmd = NULL);
int GetKeysForCommand (const char *cmd, int *first, int *second);
TArray<int> GetKeysForCommand (const char *cmd);
void UnbindACommand (const char *str);
void UnbindAll ();
void UnbindKey(const char *key);
void DoBind (const char *key, const char *bind);
void DefaultBind(const char *keyname, const char *cmd);
void SetBind(unsigned int key, const char *bind)
void SetBind(unsigned int key, const char *bind, bool override = true)
{
if (!override && Binds[key].IsNotEmpty()) return;
if (key < NUM_KEYS) Binds[key] = bind;
}
@ -69,8 +71,12 @@ public:
const char *GetBind(unsigned int index) const
{
if (index < NUM_KEYS) return Binds[index].GetChars();
else return NULL;
if (index < NUM_KEYS)
{
auto c = Binds[index].GetChars();
if (*c) return c;
}
return NULL;
}
};
@ -86,6 +92,7 @@ bool C_DoKey (event_t *ev, FKeyBindings *binds, FKeyBindings *doublebinds);
// Stuff used by the customize controls menu
void C_SetDefaultBindings ();
void C_UnbindAll ();
void C_NameKeys(char* str, int first, int second);
extern const char *KeyNames[];
@ -104,3 +111,4 @@ struct FKeySection
extern TArray<FKeySection> KeySections;
#endif //__C_BINDINGS_H__