Fix binding

This commit is contained in:
Joelrau 2021-01-09 11:30:24 +02:00
parent 2129d87131
commit 670cb76a93

View File

@ -23,7 +23,7 @@ namespace binding
const auto* const key_button = game::Key_KeynumToString(key_index, 0, 1);
auto value = game::playerKeys->keys[key_index].binding;
if (value && value < 100)
if (value && value < 104)
{
const auto len = sprintf_s(&buffer[bytes_used], (buffer_size_align - bytes_used),
"bind %s \"%s\"\n", key_button, game::command_whitelist[value]);
@ -37,7 +37,7 @@ namespace binding
}
else if (value >= 100)
{
value -= 100;
value -= 104;
if (static_cast<size_t>(value) < custom_binds.size() && !custom_binds[value].empty())
{
const auto len = sprintf_s(&buffer[bytes_used], (buffer_size_align - bytes_used),
@ -78,7 +78,7 @@ namespace binding
int key_get_binding_for_cmd_stub(const char* command)
{
// original binds
for (auto i = 0; i <= 100; i++)
for (auto i = 0; i <= 104; i++)
{
if (game::command_whitelist[i] && !strcmp(command, game::command_whitelist[i]))
{
@ -87,14 +87,14 @@ namespace binding
}
// custom binds
return 100 + get_binding_for_custom_command(command);
return 104 + get_binding_for_custom_command(command);
}
void cl_execute_key_stub(const int local_client_num, unsigned int key, const unsigned int down, const unsigned int time)
{
if (key >= 100)
if (key >= 104)
{
key -= 100;
key -= 104;
if (static_cast<size_t>(key) < custom_binds.size() && !custom_binds[key].empty())
{