Skip to content

Commit

Permalink
Merge pull request #271 from Zegeri/keys
Browse files Browse the repository at this point in the history
More user-friendly report of missing keys
  • Loading branch information
Xottab-DUTY committed Nov 9, 2018
2 parents b4f778f + 154c836 commit 9396cc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/xrEngine/xr_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,7 @@ bool CInput::get_dik_name(int dik, LPSTR dest_str, int dest_sz)
if (dik == SDL_SCANCODE_UNKNOWN)
keyname = "Unknown";
else
{
Msg("! Can't convert dik_name for dik[%d]", dik);
return false;
}
}

xr_strcpy(dest_str, dest_sz, keyname.c_str());
Expand Down
15 changes: 8 additions & 7 deletions src/xrGame/xr_level_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,22 @@ void initialize_bindings()

void remap_keys()
{
int idx = 0;
string128 buff;
// Log("Keys remap:");
while (keyboards[idx].key_name)
for (int idx = 0; keyboards[idx].key_name; ++idx)
{
buff[0] = 0;
_keyboard& kb = keyboards[idx];
const bool res = pInput->get_dik_name(kb.dik, buff, sizeof(buff));
if (res)
if (pInput->get_dik_name(kb.dik, buff, sizeof(buff)))
kb.key_local_name = buff;
else if (kb.key_local_name.empty())
kb.key_local_name = kb.key_name;
else
{
Msg("! Can't find a key name for %s", kb.key_name);
if (kb.key_local_name.empty())
kb.key_local_name = kb.key_name;
}

// Msg("[%s]-[%s]", kb.key_name, kb.key_local_name.c_str());
++idx;
}
}

Expand Down

0 comments on commit 9396cc2

Please sign in to comment.