Skip to content

Commit

Permalink
Use KN_ key defines instead of VK_ key defines in generic code.
Browse files Browse the repository at this point in the history
This also fixes being able to use the right shift, control and alt keys in the SDL version.
  • Loading branch information
isojalka authored and OmniBlade committed Mar 6, 2023
1 parent d28ecb5 commit 83c152c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/wwkeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ unsigned short WWKeyboardClass::Buff_Get(void)
bool WWKeyboardClass::Is_Mouse_Key(unsigned short key)
{
key &= 0xFF;
return (key == VK_LBUTTON || key == VK_MBUTTON || key == VK_RBUTTON);
return (key == KN_LMOUSE || key == KN_MMOUSE || key == KN_RMOUSE);
}

/***********************************************************************************************
Expand Down Expand Up @@ -219,13 +219,13 @@ bool WWKeyboardClass::Put_Key_Message(unsigned short vk_key, bool release)
** would be incompatible with the dos version.
*/
if (!Is_Mouse_Key(vk_key)) {
if (Down(VK_SHIFT) || Down(VK_CAPITAL) || Down(VK_NUMLOCK)) {
if (Down(KN_LSHIFT) || Down(KN_RSHIFT) || Down(KN_CAPSLOCK) || Down(KN_NUMLOCK)) {
vk_key |= WWKEY_SHIFT_BIT;
}
if (Down(VK_CONTROL)) {
if (Down(KN_LCTRL) || Down(KN_RCTRL)) {
vk_key |= WWKEY_CTRL_BIT;
}
if (Down(VK_MENU)) {
if (Down(KN_LALT) || Down(KN_RALT)) {
vk_key |= WWKEY_ALT_BIT;
}
}
Expand Down
1 change: 1 addition & 0 deletions common/wwkeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ typedef enum KeyNumType : unsigned short
KN_LSHIFT = VK_SHIFT,
KN_M = VK_M,
KN_MINUS = VK_NONE_BD,
KN_MMOUSE = VK_MBUTTON,
KN_N = VK_N,
KN_NUMLOCK = VK_NUMLOCK,
KN_O = VK_O,
Expand Down

0 comments on commit 83c152c

Please sign in to comment.