[Scummvm-git-logs] scummvm master -> 83ff5921e4fef288481666b26fd1698c1c278561

grisenti noreply at scummvm.org
Sun Apr 9 09:42:36 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
83ff5921e4 HPL1: replace custom keyboard codes


Commit: 83ff5921e4fef288481666b26fd1698c1c278561
    https://github.com/scummvm/scummvm/commit/83ff5921e4fef288481666b26fd1698c1c278561
Author: grisenti (emanuele at grisenti.net)
Date: 2023-04-09T11:42:16+02:00

Commit Message:
HPL1: replace custom keyboard codes

Changed paths:
    engines/hpl1/engine/gui/Gui.cpp
    engines/hpl1/engine/gui/Gui.h
    engines/hpl1/engine/gui/GuiTypes.h
    engines/hpl1/engine/gui/WidgetListBox.cpp
    engines/hpl1/engine/gui/WidgetTextBox.cpp
    engines/hpl1/engine/input/ActionKeyboard.cpp
    engines/hpl1/engine/input/ActionKeyboard.h
    engines/hpl1/engine/input/Input.cpp
    engines/hpl1/engine/input/InputTypes.h
    engines/hpl1/engine/input/Keyboard.cpp
    engines/hpl1/engine/input/Keyboard.h
    engines/hpl1/penumbra-overture/ButtonHandler.cpp
    engines/hpl1/penumbra-overture/ButtonHandler.h
    engines/hpl1/penumbra-overture/MainMenu.cpp
    engines/hpl1/penumbra-overture/MainMenu.h


diff --git a/engines/hpl1/engine/gui/Gui.cpp b/engines/hpl1/engine/gui/Gui.cpp
index ccab5672554..539bdc048ed 100644
--- a/engines/hpl1/engine/gui/Gui.cpp
+++ b/engines/hpl1/engine/gui/Gui.cpp
@@ -452,7 +452,7 @@ bool cGui::SendMouseDoubleClick(eGuiMouseButton aButton) {
 	return mpSetInFocus->SendMessage(eGuiMessage_MouseDoubleClick, data);
 }
 
-bool cGui::SendKeyPress(const cKeyPress &keyPress) {
+bool cGui::SendKeyPress(Common::KeyState keyPress) {
 	if (mpSetInFocus == NULL)
 		return false;
 
diff --git a/engines/hpl1/engine/gui/Gui.h b/engines/hpl1/engine/gui/Gui.h
index 75b4109df9a..8fa2e31fddf 100644
--- a/engines/hpl1/engine/gui/Gui.h
+++ b/engines/hpl1/engine/gui/Gui.h
@@ -128,7 +128,7 @@ public:
 	bool SendMouseClickUp(eGuiMouseButton aButton);
 	bool SendMouseDoubleClick(eGuiMouseButton aButton);
 
-	bool SendKeyPress(const cKeyPress &keyPress);
+	bool SendKeyPress(Common::KeyState keyPress);
 
 	// bool SentArrowKey(eGuiArrowKey aDir);
 
diff --git a/engines/hpl1/engine/gui/GuiTypes.h b/engines/hpl1/engine/gui/GuiTypes.h
index 6b875d813c2..f0af0111c40 100644
--- a/engines/hpl1/engine/gui/GuiTypes.h
+++ b/engines/hpl1/engine/gui/GuiTypes.h
@@ -28,6 +28,7 @@
 #ifndef HPL_GUI_TYPES_H
 #define HPL_GUI_TYPES_H
 
+#include "common/keyboard.h"
 #include "common/list.h"
 #include "hpl1/engine/graphics/GraphicsTypes.h"
 #include "hpl1/engine/input/InputTypes.h"
@@ -276,14 +277,14 @@ struct cGuiMessageData {
 	cGuiMessageData(float afVal) {
 		mfVal = afVal;
 	}
-	cGuiMessageData(const cKeyPress &aKeyPress) {
+	cGuiMessageData(Common::KeyState aKeyPress) {
 		mKeyPress = aKeyPress;
 	}
 
 	cVector2f mvPos;
 	cVector2f mvRel;
 	int mlVal;
-	cKeyPress mKeyPress;
+	Common::KeyState mKeyPress;
 	float mfVal;
 	void *mpData;
 	eGuiMessage mMessage;
diff --git a/engines/hpl1/engine/gui/WidgetListBox.cpp b/engines/hpl1/engine/gui/WidgetListBox.cpp
index cee02f60376..5af4de84d94 100644
--- a/engines/hpl1/engine/gui/WidgetListBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetListBox.cpp
@@ -250,12 +250,11 @@ bool cWidgetListBox::OnMouseLeave(cGuiMessageData &aData) {
 //-----------------------------------------------------------------------
 
 bool cWidgetListBox::OnKeyPress(cGuiMessageData &aData) {
-	eKey key = aData.mKeyPress.mKey;
-
-	if (key == eKey_UP) {
+	auto key = aData.mKeyPress.keycode;
+	if (key == Common::KEYCODE_UP) {
 		if (mlSelectedItem > 0)
 			SetSelectedItem(mlSelectedItem - 1, true);
-	} else if (key == eKey_DOWN) {
+	} else if (key == Common::KEYCODE_DOWN) {
 		if (mlSelectedItem < (int)mvItems.size() - 1)
 			SetSelectedItem(mlSelectedItem + 1, true);
 	}
diff --git a/engines/hpl1/engine/gui/WidgetTextBox.cpp b/engines/hpl1/engine/gui/WidgetTextBox.cpp
index d5728328dac..f5b9837123f 100644
--- a/engines/hpl1/engine/gui/WidgetTextBox.cpp
+++ b/engines/hpl1/engine/gui/WidgetTextBox.cpp
@@ -442,34 +442,34 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 	if (mlMarkerCharPos < 0)
 		return false;
 
-	eKey key = aData.mKeyPress.mKey;
-	int mod = aData.mKeyPress.mlModifier;
+	auto key = aData.mKeyPress.keycode;
+	int mod = aData.mKeyPress.flags;
 
 	if (mpGfxMarker)
 		mpGfxMarker->SetAnimationTime(0);
 
 	//////////////////////////////
 	// Copy / Pase / Cut
-	if ((mod & eKeyModifier_CTRL)) {
+	if ((mod & Common::KBD_CTRL)) {
 		int lStart = mlMarkerCharPos < mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
 		int lEnd = mlMarkerCharPos > mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
 		int lSelectSize = lEnd - lStart;
 
 		/////////////////////////////
 		// Select all
-		if (key == eKey_a) {
+		if (key == Common::KEYCODE_a) {
 			mlSelectedTextEnd = 0;
 			mlMarkerCharPos = (int)msText.size() - 1;
 		}
 		/////////////////////////////
 		// Copy
-		else if (key == eKey_c) {
+		else if (key == Common::KEYCODE_c) {
 			if (mlSelectedTextEnd >= 0)
 				CopyTextToClipboard(cString::SubW(msText, lStart, lSelectSize));
 		}
 		/////////////////////////////
 		// Cut
-		else if (key == eKey_x) {
+		else if (key == Common::KEYCODE_x) {
 			if (mlSelectedTextEnd >= 0) {
 				CopyTextToClipboard(cString::SubW(msText, lStart, lSelectSize));
 				SetText(cString::SubW(msText, 0, lStart) + cString::SubW(msText, lEnd));
@@ -478,7 +478,7 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 		}
 		/////////////////////////////
 		// Paste
-		else if (key == eKey_v) {
+		else if (key == Common::KEYCODE_v) {
 			tWString sExtra = LoadTextFromClipboard();
 
 			if (mlSelectedTextEnd < 0) {
@@ -504,17 +504,17 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 	}
 	//////////////////////////////
 	// Arrow keys
-	else if (key == eKey_LEFT || key == eKey_RIGHT) {
-		if (mod & eKeyModifier_SHIFT) {
+	else if (key == Common::KEYCODE_LEFT || key == Common::KEYCODE_RIGHT) {
+		if (mod & Common::KBD_SHIFT) {
 			if (mlSelectedTextEnd == -1)
 				mlSelectedTextEnd = mlMarkerCharPos;
 
-			if (key == eKey_LEFT)
+			if (key == Common::KEYCODE_LEFT)
 				SetMarkerPos(mlMarkerCharPos - 1);
 			else
 				SetMarkerPos(mlMarkerCharPos + 1);
 		} else {
-			if (key == eKey_LEFT)
+			if (key == Common::KEYCODE_LEFT)
 				SetMarkerPos(mlMarkerCharPos - 1);
 			else
 				SetMarkerPos(mlMarkerCharPos + 1);
@@ -524,7 +524,7 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 	}
 	//////////////////////////////
 	// Delete and backspace
-	else if (key == eKey_DELETE || key == eKey_BACKSPACE) {
+	else if (key == Common::KEYCODE_DELETE || key == Common::KEYCODE_BACKSPACE) {
 		if (mlSelectedTextEnd >= 0) {
 			int lStart = mlMarkerCharPos < mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
 			int lEnd = mlMarkerCharPos > mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
@@ -534,7 +534,7 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 			mlSelectedTextEnd = -1;
 			SetMarkerPos(lStart);
 		} else {
-			if (key == eKey_DELETE) {
+			if (key == Common::KEYCODE_DELETE) {
 				SetText(cString::SubW(msText, 0, mlMarkerCharPos) +
 						cString::SubW(msText, mlMarkerCharPos + 1));
 			} else {
@@ -546,8 +546,8 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 	}
 	//////////////////////////////
 	// Home
-	else if (key == eKey_HOME) {
-		if (mod & eKeyModifier_SHIFT) {
+	else if (key == Common::KEYCODE_HOME) {
+		if (mod & Common::KBD_SHIFT) {
 			if (mlSelectedTextEnd == -1)
 				mlSelectedTextEnd = mlMarkerCharPos;
 		} else {
@@ -557,8 +557,8 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 	}
 	//////////////////////////////
 	// End
-	else if (key == eKey_END) {
-		if (mod & eKeyModifier_SHIFT) {
+	else if (key == Common::KEYCODE_END) {
+		if (mod & Common::KBD_SHIFT) {
 			if (mlSelectedTextEnd == -1)
 				mlSelectedTextEnd = mlMarkerCharPos;
 		} else {
@@ -571,14 +571,14 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 	else {
 		int lFirstFontChar = mpDefaultFontType->getFirstChar();
 		int lLastFontChar = mpDefaultFontType->getLastChar();
-		wchar_t unicode = aData.mKeyPress.mlUnicode;
+		auto textInput = aData.mKeyPress.ascii;
 
 		// Check so press is valid
-		if (unicode >= lFirstFontChar && unicode <= lLastFontChar &&
-			mpDefaultFontType->getGlyph(unicode - lFirstFontChar)) {
+		if (textInput >= lFirstFontChar && textInput <= lLastFontChar &&
+			mpDefaultFontType->getGlyph(textInput - lFirstFontChar)) {
 			if (mlSelectedTextEnd < 0) {
 				if (mlMaxCharacters == -1 || (int)msText.size() < mlMaxCharacters) {
-					SetText(cString::SubW(msText, 0, mlMarkerCharPos) + unicode +
+					SetText(cString::SubW(msText, 0, mlMarkerCharPos) + textInput +
 							cString::SubW(msText, mlMarkerCharPos));
 
 					SetMarkerPos(mlMarkerCharPos + 1);
@@ -587,7 +587,7 @@ bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData) {
 				int lStart = mlMarkerCharPos < mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
 				int lEnd = mlMarkerCharPos > mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
 
-				SetText(cString::SubW(msText, 0, lStart) + unicode +
+				SetText(cString::SubW(msText, 0, lStart) + textInput +
 						cString::SubW(msText, lEnd));
 
 				mlSelectedTextEnd = -1;
diff --git a/engines/hpl1/engine/input/ActionKeyboard.cpp b/engines/hpl1/engine/input/ActionKeyboard.cpp
index ed9d50f014c..b0f749c1ac3 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.cpp
+++ b/engines/hpl1/engine/input/ActionKeyboard.cpp
@@ -31,21 +31,6 @@
 
 #include "hpl1/engine/system/low_level_system.h"
 namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cActionKeyboard::cActionKeyboard(tString asName, cInput *apInput, int aKey) : iAction(asName) {
-	// Split key and modifier
-	mKey = (eKey)(aKey & eKey_MASK);
-	mMod = (eKeyModifier)(aKey & eKeyModifier_MASK);
-	mpInput = apInput;
-}
-
-//-----------------------------------------------------------------------
-
 //////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //////////////////////////////////////////////////////////////////////////
@@ -53,8 +38,8 @@ cActionKeyboard::cActionKeyboard(tString asName, cInput *apInput, int aKey) : iA
 //-----------------------------------------------------------------------
 
 bool cActionKeyboard::IsTriggerd() {
-	return mpInput->GetKeyboard()->KeyIsDown(mKey) &&
-		   ((mpInput->GetKeyboard()->GetModifier() & mMod) > 0 || mMod == eKeyModifier_NONE);
+	return mpInput->GetKeyboard()->KeyIsDown(_key.keycode) &&
+		   ((mpInput->GetKeyboard()->GetModifier() & _key.flags) > 0 || _key.flags == 0);
 }
 //-----------------------------------------------------------------------
 
@@ -69,16 +54,16 @@ float cActionKeyboard::GetValue() {
 
 tString cActionKeyboard::GetInputName() {
 	tString tsKey = "";
-	if (mMod & eKeyModifier_SHIFT) {
+	if (_key.flags & Common::KBD_SHIFT) {
 		tsKey += "Shift ";
 	}
-	if (mMod & eKeyModifier_ALT) {
+	if (_key.flags & Common::KBD_ALT) {
 		tsKey += "Alt ";
 	}
-	if (mMod & eKeyModifier_CTRL) {
+	if (_key.flags & Common::KBD_CTRL) {
 		tsKey += "Control ";
 	}
-	if (mMod & eKeyModifier_META) {
+	if (_key.flags & Common::KBD_META) {
 #ifdef __APPLE__
 		tsKey += "Command ";
 #else
@@ -86,409 +71,406 @@ tString cActionKeyboard::GetInputName() {
 #endif
 	}
 
-	switch (mKey) {
-	case eKey_BACKSPACE:
+	switch (_key.keycode) {
+	case Common::KEYCODE_BACKSPACE:
 		tsKey += "BackSpace";
 		break;
-	case eKey_TAB:
+	case Common::KEYCODE_TAB:
 		tsKey += "Tab";
 		break;
-	case eKey_CLEAR:
+	case Common::KEYCODE_CLEAR:
 		tsKey += "Clear";
 		break;
-	case eKey_RETURN:
+	case Common::KEYCODE_RETURN:
 		tsKey += "Return";
 		break;
-	case eKey_PAUSE:
+	case Common::KEYCODE_PAUSE:
 		tsKey += "Pause";
 		break;
-	case eKey_ESCAPE:
+	case Common::KEYCODE_ESCAPE:
 		tsKey += "Escape";
 		break;
-	case eKey_SPACE:
+	case Common::KEYCODE_SPACE:
 		tsKey += "Space";
 		break;
-	case eKey_EXCLAIM:
+	case Common::KEYCODE_EXCLAIM:
 		tsKey += "Exclaim";
 		break;
-	case eKey_QUOTEDBL:
+	case Common::KEYCODE_QUOTEDBL:
 		tsKey += "DblQoute";
 		break;
-	case eKey_HASH:
+	case Common::KEYCODE_HASH:
 		tsKey += "Hash";
 		break;
-	case eKey_DOLLAR:
+	case Common::KEYCODE_DOLLAR:
 		tsKey += "Dollar";
 		break;
-	case eKey_AMPERSAND:
+	case Common::KEYCODE_AMPERSAND:
 		tsKey += "Ampersand";
 		break;
-	case eKey_QUOTE:
+	case Common::KEYCODE_QUOTE:
 		tsKey += "Quote";
 		break;
-	case eKey_LEFTPAREN:
+	case Common::KEYCODE_LEFTPAREN:
 		tsKey += "LeftParent";
 		break;
-	case eKey_RIGHTPAREN:
+	case Common::KEYCODE_RIGHTPAREN:
 		tsKey += "RightParent";
 		break;
-	case eKey_ASTERISK:
+	case Common::KEYCODE_ASTERISK:
 		tsKey += "Asterisk";
 		break;
-	case eKey_PLUS:
+	case Common::KEYCODE_PLUS:
 		tsKey += "Plus";
 		break;
-	case eKey_COMMA:
+	case Common::KEYCODE_COMMA:
 		tsKey += "Comma";
 		break;
-	case eKey_MINUS:
+	case Common::KEYCODE_MINUS:
 		tsKey += "Minus";
 		break;
-	case eKey_PERIOD:
+	case Common::KEYCODE_PERIOD:
 		tsKey += "Period";
 		break;
-	case eKey_SLASH:
+	case Common::KEYCODE_SLASH:
 		tsKey += "Slash";
 		break;
-	case eKey_0:
+	case Common::KEYCODE_0:
 		tsKey += "0";
 		break;
-	case eKey_1:
+	case Common::KEYCODE_1:
 		tsKey += "1";
 		break;
-	case eKey_2:
+	case Common::KEYCODE_2:
 		tsKey += "2";
 		break;
-	case eKey_3:
+	case Common::KEYCODE_3:
 		tsKey += "3";
 		break;
-	case eKey_4:
+	case Common::KEYCODE_4:
 		tsKey += "4";
 		break;
-	case eKey_5:
+	case Common::KEYCODE_5:
 		tsKey += "5";
 		break;
-	case eKey_6:
+	case Common::KEYCODE_6:
 		tsKey += "6";
 		break;
-	case eKey_7:
+	case Common::KEYCODE_7:
 		tsKey += "7";
 		break;
-	case eKey_8:
+	case Common::KEYCODE_8:
 		tsKey += "8";
 		break;
-	case eKey_9:
+	case Common::KEYCODE_9:
 		tsKey += "9";
 		break;
-	case eKey_COLON:
+	case Common::KEYCODE_COLON:
 		tsKey += "Colon";
 		break;
-	case eKey_SEMICOLON:
+	case Common::KEYCODE_SEMICOLON:
 		tsKey += "SemiColon";
 		break;
-	case eKey_LESS:
+	case Common::KEYCODE_LESS:
 		tsKey += "Less";
 		break;
-	case eKey_EQUALS:
+	case Common::KEYCODE_EQUALS:
 		tsKey += "Equals";
 		break;
-	case eKey_GREATER:
+	case Common::KEYCODE_GREATER:
 		tsKey += "Greater";
 		break;
-	case eKey_QUESTION:
+	case Common::KEYCODE_QUESTION:
 		tsKey += "Question";
 		break;
-	case eKey_AT:
+	case Common::KEYCODE_AT:
 		tsKey += "At";
 		break;
-	case eKey_LEFTBRACKET:
+	case Common::KEYCODE_LEFTBRACKET:
 		tsKey += "LeftBracket";
 		break;
-	case eKey_BACKSLASH:
+	case Common::KEYCODE_BACKSLASH:
 		tsKey += "BackSlash";
 		break;
-	case eKey_RIGHTBRACKET:
+	case Common::KEYCODE_RIGHTBRACKET:
 		tsKey += "RightBracket";
 		break;
-	case eKey_CARET:
+	case Common::KEYCODE_CARET:
 		tsKey += "Caret";
 		break;
-	case eKey_UNDERSCORE:
+	case Common::KEYCODE_UNDERSCORE:
 		tsKey += "Underscore";
 		break;
-	case eKey_BACKQUOTE:
+	case Common::KEYCODE_BACKQUOTE:
 		tsKey += "BackQuote";
 		break;
-	case eKey_a:
+	case Common::KEYCODE_a:
 		tsKey += "A";
 		break;
-	case eKey_b:
+	case Common::KEYCODE_b:
 		tsKey += "B";
 		break;
-	case eKey_c:
+	case Common::KEYCODE_c:
 		tsKey += "C";
 		break;
-	case eKey_d:
+	case Common::KEYCODE_d:
 		tsKey += "D";
 		break;
-	case eKey_e:
+	case Common::KEYCODE_e:
 		tsKey += "E";
 		break;
-	case eKey_f:
+	case Common::KEYCODE_f:
 		tsKey += "F";
 		break;
-	case eKey_g:
+	case Common::KEYCODE_g:
 		tsKey += "G";
 		break;
-	case eKey_h:
+	case Common::KEYCODE_h:
 		tsKey += "H";
 		break;
-	case eKey_i:
+	case Common::KEYCODE_i:
 		tsKey += "I";
 		break;
-	case eKey_j:
+	case Common::KEYCODE_j:
 		tsKey += "J";
 		break;
-	case eKey_k:
+	case Common::KEYCODE_k:
 		tsKey += "K";
 		break;
-	case eKey_l:
+	case Common::KEYCODE_l:
 		tsKey += "L";
 		break;
-	case eKey_m:
+	case Common::KEYCODE_m:
 		tsKey += "M";
 		break;
-	case eKey_n:
+	case Common::KEYCODE_n:
 		tsKey += "N";
 		break;
-	case eKey_o:
+	case Common::KEYCODE_o:
 		tsKey += "O";
 		break;
-	case eKey_p:
+	case Common::KEYCODE_p:
 		tsKey += "P";
 		break;
-	case eKey_q:
+	case Common::KEYCODE_q:
 		tsKey += "Q";
 		break;
-	case eKey_r:
+	case Common::KEYCODE_r:
 		tsKey += "R";
 		break;
-	case eKey_s:
+	case Common::KEYCODE_s:
 		tsKey += "S";
 		break;
-	case eKey_t:
+	case Common::KEYCODE_t:
 		tsKey += "T";
 		break;
-	case eKey_u:
+	case Common::KEYCODE_u:
 		tsKey += "U";
 		break;
-	case eKey_v:
+	case Common::KEYCODE_v:
 		tsKey += "V";
 		break;
-	case eKey_w:
+	case Common::KEYCODE_w:
 		tsKey += "W";
 		break;
-	case eKey_x:
+	case Common::KEYCODE_x:
 		tsKey += "X";
 		break;
-	case eKey_y:
+	case Common::KEYCODE_y:
 		tsKey += "Y";
 		break;
-	case eKey_z:
+	case Common::KEYCODE_z:
 		tsKey += "Z";
 		break;
-	case eKey_DELETE:
+	case Common::KEYCODE_DELETE:
 		tsKey += "Delete";
 		break;
-	case eKey_KP0:
+	case Common::KEYCODE_KP0:
 		tsKey += "Kp0";
 		break;
-	case eKey_KP1:
+	case Common::KEYCODE_KP1:
 		tsKey += "Kp1";
 		break;
-	case eKey_KP2:
+	case Common::KEYCODE_KP2:
 		tsKey += "Kp2";
 		break;
-	case eKey_KP3:
+	case Common::KEYCODE_KP3:
 		tsKey += "Kp3";
 		break;
-	case eKey_KP4:
+	case Common::KEYCODE_KP4:
 		tsKey += "Kp4";
 		break;
-	case eKey_KP5:
+	case Common::KEYCODE_KP5:
 		tsKey += "Kp5";
 		break;
-	case eKey_KP6:
+	case Common::KEYCODE_KP6:
 		tsKey += "Kp6";
 		break;
-	case eKey_KP7:
+	case Common::KEYCODE_KP7:
 		tsKey += "Kp7";
 		break;
-	case eKey_KP8:
+	case Common::KEYCODE_KP8:
 		tsKey += "Kp8";
 		break;
-	case eKey_KP9:
+	case Common::KEYCODE_KP9:
 		tsKey += "Kp9";
 		break;
-	case eKey_KP_PERIOD:
+	case Common::KEYCODE_KP_PERIOD:
 		tsKey += "Period";
 		break;
-	case eKey_KP_DIVIDE:
+	case Common::KEYCODE_KP_DIVIDE:
 		tsKey += "Divide";
 		break;
-	case eKey_KP_MULTIPLY:
+	case Common::KEYCODE_KP_MULTIPLY:
 		tsKey += "Multiply";
 		break;
-	case eKey_KP_MINUS:
+	case Common::KEYCODE_KP_MINUS:
 		tsKey += "Minus";
 		break;
-	case eKey_KP_PLUS:
+	case Common::KEYCODE_KP_PLUS:
 		tsKey += "Plus";
 		break;
-	case eKey_KP_ENTER:
+	case Common::KEYCODE_KP_ENTER:
 		tsKey += "Enter";
 		break;
-	case eKey_KP_EQUALS:
+	case Common::KEYCODE_KP_EQUALS:
 		tsKey += "Equals";
 		break;
-	case eKey_UP:
+	case Common::KEYCODE_UP:
 		tsKey += "Up";
 		break;
-	case eKey_DOWN:
+	case Common::KEYCODE_DOWN:
 		tsKey += "Down";
 		break;
-	case eKey_RIGHT:
+	case Common::KEYCODE_RIGHT:
 		tsKey += "Right";
 		break;
-	case eKey_LEFT:
+	case Common::KEYCODE_LEFT:
 		tsKey += "Left";
 		break;
-	case eKey_INSERT:
+	case Common::KEYCODE_INSERT:
 		tsKey += "Insert";
 		break;
-	case eKey_HOME:
+	case Common::KEYCODE_HOME:
 		tsKey += "Home";
 		break;
-	case eKey_END:
+	case Common::KEYCODE_END:
 		tsKey += "End";
 		break;
-	case eKey_PAGEUP:
+	case Common::KEYCODE_PAGEUP:
 		tsKey += "PageUp";
 		break;
-	case eKey_PAGEDOWN:
+	case Common::KEYCODE_PAGEDOWN:
 		tsKey += "PageDown";
 		break;
-	case eKey_F1:
+	case Common::KEYCODE_F1:
 		tsKey += "F1";
 		break;
-	case eKey_F2:
+	case Common::KEYCODE_F2:
 		tsKey += "F2";
 		break;
-	case eKey_F3:
+	case Common::KEYCODE_F3:
 		tsKey += "F3";
 		break;
-	case eKey_F4:
+	case Common::KEYCODE_F4:
 		tsKey += "F4";
 		break;
-	case eKey_F5:
+	case Common::KEYCODE_F5:
 		tsKey += "F5";
 		break;
-	case eKey_F6:
+	case Common::KEYCODE_F6:
 		tsKey += "F6";
 		break;
-	case eKey_F7:
+	case Common::KEYCODE_F7:
 		tsKey += "F7";
 		break;
-	case eKey_F8:
+	case Common::KEYCODE_F8:
 		tsKey += "F8";
 		break;
-	case eKey_F9:
+	case Common::KEYCODE_F9:
 		tsKey += "F9";
 		break;
-	case eKey_F10:
+	case Common::KEYCODE_F10:
 		tsKey += "F10";
 		break;
-	case eKey_F11:
+	case Common::KEYCODE_F11:
 		tsKey += "F11";
 		break;
-	case eKey_F12:
+	case Common::KEYCODE_F12:
 		tsKey += "F12";
 		break;
-	case eKey_F13:
+	case Common::KEYCODE_F13:
 		tsKey += "F13";
 		break;
-	case eKey_F14:
+	case Common::KEYCODE_F14:
 		tsKey += "F14";
 		break;
-	case eKey_F15:
+	case Common::KEYCODE_F15:
 		tsKey += "F15";
 		break;
-	case eKey_NUMLOCK:
+	case Common::KEYCODE_NUMLOCK:
 		tsKey += "NumLock";
 		break;
-	case eKey_CAPSLOCK:
+	case Common::KEYCODE_CAPSLOCK:
 		tsKey += "CapsLock";
 		break;
-	case eKey_SCROLLOCK:
+	case Common::KEYCODE_SCROLLOCK:
 		tsKey += "ScrollLock";
 		break;
-	case eKey_RSHIFT:
+	case Common::KEYCODE_RSHIFT:
 		tsKey += "RightShift";
 		break;
-	case eKey_LSHIFT:
+	case Common::KEYCODE_LSHIFT:
 		tsKey += "LeftShift";
 		break;
-	case eKey_RCTRL:
+	case Common::KEYCODE_RCTRL:
 		tsKey += "RightControl";
 		break;
-	case eKey_LCTRL:
+	case Common::KEYCODE_LCTRL:
 		tsKey += "LeftControl";
 		break;
-	case eKey_RALT:
+	case Common::KEYCODE_RALT:
 		tsKey += "RightAlt";
 		break;
-	case eKey_LALT:
+	case Common::KEYCODE_LALT:
 		tsKey += "LeftAlt";
 		break;
-	case eKey_RMETA:
+	case Common::KEYCODE_RMETA:
 		tsKey += "RightMeta";
 		break;
-	case eKey_LMETA:
+	case Common::KEYCODE_LMETA:
 		tsKey += "LeftMeta";
 		break;
-	case eKey_LSUPER:
+	case Common::KEYCODE_LSUPER:
 		tsKey += "LeftSuper";
 		break;
-	case eKey_RSUPER:
+	case Common::KEYCODE_RSUPER:
 		tsKey += "RightSuper";
 		break;
-	case eKey_MODE:
+	case Common::KEYCODE_MODE:
 		tsKey += "Mode";
 		break;
-	case eKey_HELP:
+	case Common::KEYCODE_HELP:
 		tsKey += "Help";
 		break;
-	case eKey_PRINT:
+	case Common::KEYCODE_PRINT:
 		tsKey += "Print";
 		break;
-	case eKey_SYSREQ:
+	case Common::KEYCODE_SYSREQ:
 		tsKey += "SysReq";
 		break;
-	case eKey_BREAK:
+	case Common::KEYCODE_BREAK:
 		tsKey += "Break";
 		break;
-	case eKey_MENU:
+	case Common::KEYCODE_MENU:
 		tsKey += "Menu";
 		break;
-	case eKey_POWER:
+	case Common::KEYCODE_POWER:
 		tsKey += "Power";
 		break;
-	case eKey_EURO:
+	case Common::KEYCODE_EURO:
 		tsKey += "Euro";
 		break;
-	case eKey_NONE:
-		tsKey += "None";
-		break;
 	default:
 		break;
 	}
diff --git a/engines/hpl1/engine/input/ActionKeyboard.h b/engines/hpl1/engine/input/ActionKeyboard.h
index b4bfe918abd..5e32210fe65 100644
--- a/engines/hpl1/engine/input/ActionKeyboard.h
+++ b/engines/hpl1/engine/input/ActionKeyboard.h
@@ -28,6 +28,7 @@
 #ifndef HPL_ACTIONKEYBOARD_H
 #define HPL_ACTIONKEYBOARD_H
 
+#include "common/keyboard.h"
 #include "hpl1/engine/input/Action.h"
 #include "hpl1/engine/input/InputTypes.h"
 
@@ -37,7 +38,7 @@ class cInput;
 
 class cActionKeyboard : public iAction {
 public:
-	cActionKeyboard(tString asName, cInput *apInput, int aKey);
+	cActionKeyboard(tString asName, cInput *apInput, Common::KeyState key) : iAction(asName), _key(key), mpInput(apInput) {}
 
 	bool IsTriggerd();
 	float GetValue();
@@ -46,12 +47,11 @@ public:
 
 	tString GetInputType() { return "Keyboard"; }
 
-	eKey GetKey() { return mKey; }
-	eKeyModifier GetModifier() { return mMod; }
+	Common::KeyCode GetKey() { return _key.keycode; }
+	int GetModifier() { return _key.flags; }
 
 private:
-	eKey mKey;
-	eKeyModifier mMod;
+	Common::KeyState _key;
 	cInput *mpInput;
 };
 
diff --git a/engines/hpl1/engine/input/Input.cpp b/engines/hpl1/engine/input/Input.cpp
index 2fa0a3893a7..6cb2f2a4477 100644
--- a/engines/hpl1/engine/input/Input.cpp
+++ b/engines/hpl1/engine/input/Input.cpp
@@ -25,10 +25,10 @@
  * This file is part of HPL1 Engine.
  */
 
-#include "hpl1/engine/input/Input.h"
 #include "hpl1/engine/input/Action.h"
 #include "hpl1/engine/input/ActionKeyboard.h"
 #include "hpl1/engine/input/ActionMouseButton.h"
+#include "hpl1/engine/input/Input.h"
 #include "hpl1/engine/input/Keyboard.h"
 #include "hpl1/engine/input/LowLevelInput.h"
 #include "hpl1/engine/input/Mouse.h"
@@ -174,8 +174,8 @@ void cInput::DestroyAction(tString asName) {
 bool cInput::CheckForInput() {
 	//////////////////////
 	// Keyboard
-	for (int i = 0; i < eKey_LastEnum; ++i) {
-		if (mpKeyboard->KeyIsDown((eKey)i))
+	for (int i = 0; i < Common::KEYCODE_LAST; ++i) {
+		if (mpKeyboard->KeyIsDown(static_cast<Common::KeyCode>(i)))
 			return true;
 	}
 
@@ -196,9 +196,10 @@ iAction *cInput::InputToAction(const tString &asName) {
 
 	//////////////////////
 	// Keyboard
-	for (int i = 0; i < eKey_LastEnum; ++i) {
-		if (mpKeyboard->KeyIsDown((eKey)i)) {
-			pAction = hplNew(cActionKeyboard, (asName, this, (eKey)i));
+	for (int i = 0; i < Common::KEYCODE_LAST; ++i) {
+		Common::KeyCode key = static_cast<Common::KeyCode>(i);
+		if (mpKeyboard->KeyIsDown(key)) {
+			pAction = hplNew(cActionKeyboard, (asName, this, key));
 			break;
 		}
 	}
diff --git a/engines/hpl1/engine/input/InputTypes.h b/engines/hpl1/engine/input/InputTypes.h
index 5e1d46aee84..813124e3d09 100644
--- a/engines/hpl1/engine/input/InputTypes.h
+++ b/engines/hpl1/engine/input/InputTypes.h
@@ -54,172 +54,6 @@ enum eMButton {
 	eMButton_LastEnum
 };
 
-//-------------------------------------------------
-
-enum eKey {
-	eKey_BACKSPACE,
-	eKey_TAB,
-	eKey_CLEAR,
-	eKey_RETURN,
-	eKey_PAUSE,
-	eKey_ESCAPE,
-	eKey_SPACE,
-	eKey_EXCLAIM,
-	eKey_QUOTEDBL,
-	eKey_HASH,
-	eKey_DOLLAR,
-	eKey_AMPERSAND,
-	eKey_QUOTE,
-	eKey_LEFTPAREN,
-	eKey_RIGHTPAREN,
-	eKey_ASTERISK,
-	eKey_PLUS,
-	eKey_COMMA,
-	eKey_MINUS,
-	eKey_PERIOD,
-	eKey_SLASH,
-	eKey_0,
-	eKey_1,
-	eKey_2,
-	eKey_3,
-	eKey_4,
-	eKey_5,
-	eKey_6,
-	eKey_7,
-	eKey_8,
-	eKey_9,
-	eKey_COLON,
-	eKey_SEMICOLON,
-	eKey_LESS,
-	eKey_EQUALS,
-	eKey_GREATER,
-	eKey_QUESTION,
-	eKey_AT,
-	eKey_LEFTBRACKET,
-	eKey_BACKSLASH,
-	eKey_RIGHTBRACKET,
-	eKey_CARET,
-	eKey_UNDERSCORE,
-	eKey_BACKQUOTE,
-	eKey_a,
-	eKey_b,
-	eKey_c,
-	eKey_d,
-	eKey_e,
-	eKey_f,
-	eKey_g,
-	eKey_h,
-	eKey_i,
-	eKey_j,
-	eKey_k,
-	eKey_l,
-	eKey_m,
-	eKey_n,
-	eKey_o,
-	eKey_p,
-	eKey_q,
-	eKey_r,
-	eKey_s,
-	eKey_t,
-	eKey_u,
-	eKey_v,
-	eKey_w,
-	eKey_x,
-	eKey_y,
-	eKey_z,
-	eKey_DELETE,
-	eKey_KP0,
-	eKey_KP1,
-	eKey_KP2,
-	eKey_KP3,
-	eKey_KP4,
-	eKey_KP5,
-	eKey_KP6,
-	eKey_KP7,
-	eKey_KP8,
-	eKey_KP9,
-	eKey_KP_PERIOD,
-	eKey_KP_DIVIDE,
-	eKey_KP_MULTIPLY,
-	eKey_KP_MINUS,
-	eKey_KP_PLUS,
-	eKey_KP_ENTER,
-	eKey_KP_EQUALS,
-	eKey_UP,
-	eKey_DOWN,
-	eKey_RIGHT,
-	eKey_LEFT,
-	eKey_INSERT,
-	eKey_HOME,
-	eKey_END,
-	eKey_PAGEUP,
-	eKey_PAGEDOWN,
-	eKey_F1,
-	eKey_F2,
-	eKey_F3,
-	eKey_F4,
-	eKey_F5,
-	eKey_F6,
-	eKey_F7,
-	eKey_F8,
-	eKey_F9,
-	eKey_F10,
-	eKey_F11,
-	eKey_F12,
-	eKey_F13,
-	eKey_F14,
-	eKey_F15,
-	eKey_NUMLOCK,
-	eKey_CAPSLOCK,
-	eKey_SCROLLOCK,
-	eKey_RSHIFT,
-	eKey_LSHIFT,
-	eKey_RCTRL,
-	eKey_LCTRL,
-	eKey_RALT,
-	eKey_LALT,
-	eKey_RMETA,
-	eKey_LMETA,
-	eKey_LSUPER,
-	eKey_RSUPER,
-	eKey_MODE,
-	eKey_HELP,
-	eKey_PRINT,
-	eKey_SYSREQ,
-	eKey_BREAK,
-	eKey_MENU,
-	eKey_POWER,
-	eKey_EURO,
-	eKey_NONE,
-	eKey_LastEnum
-};
-#define eKey_MASK 0x000ff
-//-------------------------------------------------
-
-typedef unsigned int eKeyModifier;
-
-enum eKeyModifier_Enums {
-	eKeyModifier_NONE = 0x00000,
-	eKeyModifier_CTRL = 0x00100,
-	eKeyModifier_SHIFT = 0x00200,
-	eKeyModifier_ALT = 0x00400,
-	eKeyModifier_META = 0x00800,
-	eKeyModifier_LastEnum = 5
-};
-#define eKeyModifier_MASK 0x00f00
-
-//-------------------------------------------------
-
-struct cKeyPress {
-	cKeyPress() {}
-	cKeyPress(eKey aKey, int alUnicode, int alModifier)
-		: mKey(aKey), mlUnicode(alUnicode), mlModifier(alModifier) {}
-
-	eKey mKey;
-	int mlUnicode;
-	int mlModifier;
-};
-
 } // namespace hpl
 
 #endif // HPL_INPUT_TYPES_H
diff --git a/engines/hpl1/engine/input/Keyboard.cpp b/engines/hpl1/engine/input/Keyboard.cpp
index 3c06cb81f3e..75156bf7839 100644
--- a/engines/hpl1/engine/input/Keyboard.cpp
+++ b/engines/hpl1/engine/input/Keyboard.cpp
@@ -26,6 +26,7 @@
  */
 
 #include "common/events.h"
+#include "hpl1/debug.h"
 #include "hpl1/engine/input/Keyboard.h"
 #include "hpl1/engine/input/LowLevelInput.h"
 
@@ -36,308 +37,23 @@ namespace hpl {
 Keyboard::Keyboard(LowLevelInput *lowLevelInput) : iInputDevice("Keyboard", eInputDeviceType_Keyboard) {
 	_lowLevelSystem = lowLevelInput;
 
-	_downKeys.set_size(eKey_LastEnum);
+	_downKeys.set_size(Common::KEYCODE_LAST);
 	_downKeys.clear();
 }
 
 //-----------------------------------------------------------------------
 
-static eKey convertKey(int alKey) {
-	switch (alKey) {
-	case Common::KEYCODE_BACKSPACE:
-		return eKey_BACKSPACE;
-	case Common::KEYCODE_TAB:
-		return eKey_TAB;
-	case Common::KEYCODE_CLEAR:
-		return eKey_CLEAR;
-	case Common::KEYCODE_RETURN:
-		return eKey_RETURN;
-	case Common::KEYCODE_PAUSE:
-		return eKey_PAUSE;
-	case Common::KEYCODE_ESCAPE:
-		return eKey_ESCAPE;
-	case Common::KEYCODE_SPACE:
-		return eKey_SPACE;
-	case Common::KEYCODE_EXCLAIM:
-		return eKey_EXCLAIM;
-	case Common::KEYCODE_QUOTEDBL:
-		return eKey_QUOTEDBL;
-	case Common::KEYCODE_HASH:
-		return eKey_HASH;
-	case Common::KEYCODE_DOLLAR:
-		return eKey_DOLLAR;
-	case Common::KEYCODE_AMPERSAND:
-		return eKey_AMPERSAND;
-	case Common::KEYCODE_QUOTE:
-		return eKey_QUOTE;
-	case Common::KEYCODE_LEFTPAREN:
-		return eKey_LEFTPAREN;
-	case Common::KEYCODE_RIGHTPAREN:
-		return eKey_RIGHTPAREN;
-	case Common::KEYCODE_ASTERISK:
-		return eKey_ASTERISK;
-	case Common::KEYCODE_PLUS:
-		return eKey_PLUS;
-	case Common::KEYCODE_COMMA:
-		return eKey_COMMA;
-	case Common::KEYCODE_MINUS:
-		return eKey_MINUS;
-	case Common::KEYCODE_PERIOD:
-		return eKey_PERIOD;
-	case Common::KEYCODE_SLASH:
-		return eKey_SLASH;
-	case Common::KEYCODE_0:
-		return eKey_0;
-	case Common::KEYCODE_1:
-		return eKey_1;
-	case Common::KEYCODE_2:
-		return eKey_2;
-	case Common::KEYCODE_3:
-		return eKey_3;
-	case Common::KEYCODE_4:
-		return eKey_4;
-	case Common::KEYCODE_5:
-		return eKey_5;
-	case Common::KEYCODE_6:
-		return eKey_6;
-	case Common::KEYCODE_7:
-		return eKey_7;
-	case Common::KEYCODE_8:
-		return eKey_8;
-	case Common::KEYCODE_9:
-		return eKey_9;
-	case Common::KEYCODE_COLON:
-		return eKey_COLON;
-	case Common::KEYCODE_SEMICOLON:
-		return eKey_SEMICOLON;
-	case Common::KEYCODE_LESS:
-		return eKey_LESS;
-	case Common::KEYCODE_EQUALS:
-		return eKey_EQUALS;
-	case Common::KEYCODE_GREATER:
-		return eKey_GREATER;
-	case Common::KEYCODE_QUESTION:
-		return eKey_QUESTION;
-	case Common::KEYCODE_AT:
-		return eKey_AT;
-	case Common::KEYCODE_LEFTBRACKET:
-		return eKey_LEFTBRACKET;
-	case Common::KEYCODE_BACKSLASH:
-		return eKey_BACKSLASH;
-	case Common::KEYCODE_RIGHTBRACKET:
-		return eKey_RIGHTBRACKET;
-	case Common::KEYCODE_CARET:
-		return eKey_CARET;
-	case Common::KEYCODE_UNDERSCORE:
-		return eKey_UNDERSCORE;
-	case Common::KEYCODE_BACKQUOTE:
-		return eKey_BACKQUOTE;
-	case Common::KEYCODE_a:
-		return eKey_a;
-	case Common::KEYCODE_b:
-		return eKey_b;
-	case Common::KEYCODE_c:
-		return eKey_c;
-	case Common::KEYCODE_d:
-		return eKey_d;
-	case Common::KEYCODE_e:
-		return eKey_e;
-	case Common::KEYCODE_f:
-		return eKey_f;
-	case Common::KEYCODE_g:
-		return eKey_g;
-	case Common::KEYCODE_h:
-		return eKey_h;
-	case Common::KEYCODE_i:
-		return eKey_i;
-	case Common::KEYCODE_j:
-		return eKey_j;
-	case Common::KEYCODE_k:
-		return eKey_k;
-	case Common::KEYCODE_l:
-		return eKey_l;
-	case Common::KEYCODE_m:
-		return eKey_m;
-	case Common::KEYCODE_n:
-		return eKey_n;
-	case Common::KEYCODE_o:
-		return eKey_o;
-	case Common::KEYCODE_p:
-		return eKey_p;
-	case Common::KEYCODE_q:
-		return eKey_q;
-	case Common::KEYCODE_r:
-		return eKey_r;
-	case Common::KEYCODE_s:
-		return eKey_s;
-	case Common::KEYCODE_t:
-		return eKey_t;
-	case Common::KEYCODE_u:
-		return eKey_u;
-	case Common::KEYCODE_v:
-		return eKey_v;
-	case Common::KEYCODE_w:
-		return eKey_w;
-	case Common::KEYCODE_x:
-		return eKey_x;
-	case Common::KEYCODE_y:
-		return eKey_y;
-	case Common::KEYCODE_z:
-		return eKey_z;
-	case Common::KEYCODE_DELETE:
-		return eKey_DELETE;
-	case Common::KEYCODE_KP0:
-		return eKey_KP0;
-	case Common::KEYCODE_KP1:
-		return eKey_KP1;
-	case Common::KEYCODE_KP2:
-		return eKey_KP2;
-	case Common::KEYCODE_KP3:
-		return eKey_KP3;
-	case Common::KEYCODE_KP4:
-		return eKey_KP4;
-	case Common::KEYCODE_KP5:
-		return eKey_KP5;
-	case Common::KEYCODE_KP6:
-		return eKey_KP6;
-	case Common::KEYCODE_KP7:
-		return eKey_KP7;
-	case Common::KEYCODE_KP8:
-		return eKey_KP8;
-	case Common::KEYCODE_KP9:
-		return eKey_KP9;
-	case Common::KEYCODE_KP_PERIOD:
-		return eKey_KP_PERIOD;
-	case Common::KEYCODE_KP_DIVIDE:
-		return eKey_KP_DIVIDE;
-	case Common::KEYCODE_KP_MULTIPLY:
-		return eKey_KP_MULTIPLY;
-	case Common::KEYCODE_KP_MINUS:
-		return eKey_KP_MINUS;
-	case Common::KEYCODE_KP_PLUS:
-		return eKey_KP_PLUS;
-	case Common::KEYCODE_KP_ENTER:
-		return eKey_KP_ENTER;
-	case Common::KEYCODE_KP_EQUALS:
-		return eKey_KP_EQUALS;
-	case Common::KEYCODE_UP:
-		return eKey_UP;
-	case Common::KEYCODE_DOWN:
-		return eKey_DOWN;
-	case Common::KEYCODE_RIGHT:
-		return eKey_RIGHT;
-	case Common::KEYCODE_LEFT:
-		return eKey_LEFT;
-	case Common::KEYCODE_INSERT:
-		return eKey_INSERT;
-	case Common::KEYCODE_HOME:
-		return eKey_HOME;
-	case Common::KEYCODE_END:
-		return eKey_END;
-	case Common::KEYCODE_PAGEUP:
-		return eKey_PAGEUP;
-	case Common::KEYCODE_PAGEDOWN:
-		return eKey_PAGEDOWN;
-	case Common::KEYCODE_F1:
-		return eKey_F1;
-	case Common::KEYCODE_F2:
-		return eKey_F2;
-	case Common::KEYCODE_F3:
-		return eKey_F3;
-	case Common::KEYCODE_F4:
-		return eKey_F4;
-	case Common::KEYCODE_F5:
-		return eKey_F5;
-	case Common::KEYCODE_F6:
-		return eKey_F6;
-	case Common::KEYCODE_F7:
-		return eKey_F7;
-	case Common::KEYCODE_F8:
-		return eKey_F8;
-	case Common::KEYCODE_F9:
-		return eKey_F9;
-	case Common::KEYCODE_F10:
-		return eKey_F10;
-	case Common::KEYCODE_F11:
-		return eKey_F11;
-	case Common::KEYCODE_F12:
-		return eKey_F12;
-	case Common::KEYCODE_F13:
-		return eKey_F13;
-	case Common::KEYCODE_F14:
-		return eKey_F14;
-	case Common::KEYCODE_F15:
-		return eKey_F15;
-	case Common::KEYCODE_NUMLOCK:
-		return eKey_NUMLOCK;
-	case Common::KEYCODE_CAPSLOCK:
-		return eKey_CAPSLOCK;
-	case Common::KEYCODE_SCROLLOCK:
-		return eKey_SCROLLOCK;
-	case Common::KEYCODE_RSHIFT:
-		return eKey_RSHIFT;
-	case Common::KEYCODE_LSHIFT:
-		return eKey_LSHIFT;
-	case Common::KEYCODE_RCTRL:
-		return eKey_RCTRL;
-	case Common::KEYCODE_LCTRL:
-		return eKey_LCTRL;
-	case Common::KEYCODE_RALT:
-		return eKey_RALT;
-	case Common::KEYCODE_LALT:
-		return eKey_LALT;
-	case Common::KEYCODE_RMETA:
-		return eKey_RMETA;
-	case Common::KEYCODE_LMETA:
-		return eKey_LMETA;
-	case Common::KEYCODE_LSUPER:
-		return eKey_LSUPER;
-	case Common::KEYCODE_RSUPER:
-		return eKey_RSUPER;
-	case Common::KEYCODE_MODE:
-		return eKey_MODE;
-	case Common::KEYCODE_HELP:
-		return eKey_HELP;
-	case Common::KEYCODE_PRINT:
-		return eKey_PRINT;
-	case Common::KEYCODE_SYSREQ:
-		return eKey_SYSREQ;
-	case Common::KEYCODE_BREAK:
-		return eKey_BREAK;
-	case Common::KEYCODE_MENU:
-		return eKey_MENU;
-	case Common::KEYCODE_POWER:
-		return eKey_POWER;
-	case Common::KEYCODE_EURO:
-		return eKey_EURO;
-	}
-	return eKey_NONE;
-}
-
-static eKeyModifier convertModifiers(const int mods) {
-	eKeyModifier out = eKeyModifier_NONE;
-	if (mods & Common::KBD_CTRL)
-		out |= eKeyModifier_CTRL;
-	if (mods & Common::KBD_SHIFT)
-		out |= eKeyModifier_SHIFT;
-	if (mods & Common::KBD_ALT)
-		out |= eKeyModifier_ALT;
-	if (mods & Common::KBD_META)
-		out |= eKeyModifier_META;
-	return out;
-}
-
 void Keyboard::processEvent(const Common::Event &ev) {
 	if (ev.type != Common::EVENT_KEYDOWN && ev.type != Common::EVENT_KEYUP)
 		return;
 
-	eKey key = convertKey(ev.kbd.keycode);
 	if (ev.type == Common::EVENT_KEYDOWN) {
-		_downKeys.set(key);
-		_modifiers = convertModifiers(ev.kbd.flags);
-		_pressedKeys.push(cKeyPress(key, ev.kbd.ascii, _modifiers));
-	} else
-		_downKeys.unset(key);
+		_downKeys.set(ev.kbd.keycode);
+		_modifiers = ev.kbd.flags;
+		_pressedKeys.push(ev.kbd);
+	} else {
+		_downKeys.unset(ev.kbd.keycode);
+	}
 }
 
 void Keyboard::Update() {
@@ -348,13 +64,13 @@ void Keyboard::Update() {
 
 //-----------------------------------------------------------------------
 
-bool Keyboard::KeyIsDown(eKey key) {
+bool Keyboard::KeyIsDown(Common::KeyCode key) {
 	return _downKeys.get(key);
 }
 
 //-----------------------------------------------------------------------
 
-cKeyPress Keyboard::GetKey() {
+Common::KeyState Keyboard::GetKey() {
 	return _pressedKeys.pop();
 }
 
@@ -366,20 +82,20 @@ bool Keyboard::KeyIsPressed() {
 
 //-----------------------------------------------------------------------
 
-eKeyModifier Keyboard::GetModifier() {
+int Keyboard::GetModifier() {
 	return _modifiers;
 }
 
 //-----------------------------------------------------------------------
 
-tString Keyboard::KeyToString(eKey) {
-	return "None";
+tString Keyboard::KeyToString(Common::KeyCode eKey) {
+	HPL1_UNIMPLEMENTED(Keyboard::KeyToString);
 }
 
 //-----------------------------------------------------------------------
 
-eKey Keyboard::StringToKey(tString) {
-	return eKey_NONE;
+Common::KeyCode Keyboard::StringToKey(tString) {
+	HPL1_UNIMPLEMENTED(Keyboard::StringToKey);
 }
 
 //-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/input/Keyboard.h b/engines/hpl1/engine/input/Keyboard.h
index 40611e2e095..f598852019b 100644
--- a/engines/hpl1/engine/input/Keyboard.h
+++ b/engines/hpl1/engine/input/Keyboard.h
@@ -51,12 +51,12 @@ public:
 	 * \param aKey The key to check
 	 * \return true if pressed else false
 	 */
-	bool KeyIsDown(eKey aKey);
+	bool KeyIsDown(Common::KeyCode aKey);
 	/**
 	 * Can be checked many times to see all key presses
 	 * \return key that is currently pressed. eKey_NONE is no key.
 	 */
-	cKeyPress GetKey();
+	Common::KeyState GetKey();
 	/**
 	 *
 	 * \return If ANY key is pressed
@@ -65,29 +65,28 @@ public:
 	/**
 	 * \return The current modifiers.
 	 */
-	eKeyModifier GetModifier();
+	int GetModifier();
 	/**
 	 * \todo Implement!
 	 * \param eKey The key to change to string.
 	 * \return The name of the key as a string.
 	 */
-	tString KeyToString(eKey);
+	tString KeyToString(Common::KeyCode eKey);
 	/**
 	 * \todo Implement!
 	 * \param tString NAme of the key
 	 * \return enum of the key.
 	 */
-	eKey StringToKey(tString);
+	Common::KeyCode StringToKey(tString);
 
 	void Update();
 
 private:
 	void processEvent(const Common::Event &ev);
-	eKey AsciiToKey(int alChar);
 
-	eKeyModifier _modifiers;
+	int _modifiers;
 	Common::BitArray _downKeys;
-	Common::Queue<cKeyPress> _pressedKeys;
+	Common::Queue<Common::KeyState> _pressedKeys;
 	LowLevelInput *_lowLevelSystem;
 };
 
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.cpp b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
index e365f5eae71..d07a8b749ae 100644
--- a/engines/hpl1/penumbra-overture/ButtonHandler.cpp
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
@@ -52,68 +52,65 @@ struct cButtonHandlerAction {
 
 static const char *const gsLastPlayerAction = "GlowStick";
 static constexpr cButtonHandlerAction gvDefaultActions[] = {
-	{"Forward", "Keyboard", eKey_w, true},
-	{"Backward", "Keyboard", eKey_s, true},
-	{"Left", "Keyboard", eKey_a, true},
-	{"Right", "Keyboard", eKey_d, true},
+	{"Forward", "Keyboard", Common::KEYCODE_w, true},
+	{"Backward", "Keyboard", Common::KEYCODE_s, true},
+	{"Left", "Keyboard", Common::KEYCODE_a, true},
+	{"Right", "Keyboard", Common::KEYCODE_d, true},
 
-	{"LeanLeft", "Keyboard", eKey_q, true},
-	{"LeanRight", "Keyboard", eKey_e, true},
+	{"LeanLeft", "Keyboard", Common::KEYCODE_q, true},
+	{"LeanRight", "Keyboard", Common::KEYCODE_e, true},
 
-	{"Run", "Keyboard", eKey_LSHIFT, true},
-	{"Jump", "Keyboard", eKey_SPACE, true},
-	{"Crouch", "Keyboard", eKey_LCTRL, true},
+	{"Run", "Keyboard", Common::KEYCODE_LSHIFT, true},
+	{"Jump", "Keyboard", Common::KEYCODE_SPACE, true},
+	{"Crouch", "Keyboard", Common::KEYCODE_LCTRL, true},
 
-	{"InteractMode", "Keyboard", eKey_r, true},
+	{"InteractMode", "Keyboard", Common::KEYCODE_r, true},
 	{"LookMode", "MouseButton", eMButton_Middle, true},
 
-	{"Holster", "Keyboard", eKey_x, true},
+	{"Holster", "Keyboard", Common::KEYCODE_x, true},
 
 	{"Examine", "MouseButton", eMButton_Right, true},
 	{"Interact", "MouseButton", eMButton_Left, true},
 
-	{"Inventory", "Keyboard", eKey_TAB, true},
-	{"NoteBook", "Keyboard", eKey_n, true},
-	{"PersonalNotes", "Keyboard", eKey_p, true},
+	{"Inventory", "Keyboard", Common::KEYCODE_TAB, true},
+	{"NoteBook", "Keyboard", Common::KEYCODE_n, true},
+	{"PersonalNotes", "Keyboard", Common::KEYCODE_p, true},
 
 	{"WheelUp", "MouseButton", eMButton_WheelUp, true},
 	{"WheelDown", "MouseButton", eMButton_WheelDown, true},
 
-	{"Flashlight", "Keyboard", eKey_f, true},
-	{"GlowStick", "Keyboard", eKey_g, true},
+	{"Flashlight", "Keyboard", Common::KEYCODE_f, true},
+	{"GlowStick", "Keyboard", Common::KEYCODE_g, true},
 
-	{"Escape", "Keyboard", eKey_ESCAPE, false},
-	{"Enter", "Keyboard", eKey_RETURN, false},
+	{"Escape", "Keyboard", Common::KEYCODE_ESCAPE, false},
+	{"Enter", "Keyboard", Common::KEYCODE_RETURN, false},
 	{"MouseClick", "MouseButton", eMButton_Left, false},
 	{"MouseClickRight", "MouseButton", eMButton_Right, false},
 
 	{"RightClick", "MouseButton", eMButton_Right, false},
 	{"LeftClick", "MouseButton", eMButton_Left, false},
 
-	{"One", "Keyboard", eKey_1, false},
-	{"Two", "Keyboard", eKey_2, false},
-	{"Three", "Keyboard", eKey_3, false},
-	{"Four", "Keyboard", eKey_4, false},
-	{"Five", "Keyboard", eKey_5, false},
-	{"Six", "Keyboard", eKey_6, false},
-	{"Seven", "Keyboard", eKey_7, false},
-	{"Eight", "Keyboard", eKey_8, false},
-	{"Nine", "Keyboard", eKey_9, false},
+	{"One", "Keyboard", Common::KEYCODE_1, false},
+	{"Two", "Keyboard", Common::KEYCODE_2, false},
+	{"Three", "Keyboard", Common::KEYCODE_3, false},
+	{"Four", "Keyboard", Common::KEYCODE_4, false},
+	{"Five", "Keyboard", Common::KEYCODE_5, false},
+	{"Six", "Keyboard", Common::KEYCODE_6, false},
+	{"Seven", "Keyboard", Common::KEYCODE_7, false},
+	{"Eight", "Keyboard", Common::KEYCODE_8, false},
+	{"Nine", "Keyboard", Common::KEYCODE_9, false},
 
 	// Debug:
-	{"ResetGame", "Keyboard", eKey_F1, false},
-	{"SaveGame", "Keyboard", eKey_F4, false},
-	{"LoadGame", "Keyboard", eKey_F5, false},
-#ifdef __APPLE__
-	{"QuitGame", "Keyboard", eKeyModifier_META | eKey_q, false},
-#endif
-	{"LockInput", "Keyboard", eKey_k, false},
-	{"Screenshot", "Keyboard", eKey_F12, false},
-
-	//{"Hit","Keyboard",eKey_h,false},
-	//{"Log","Keyboard",eKey_l,false},
-	//{"Taunt","Keyboard",eKey_t,false},
-	{"PrintLog", "Keyboard", eKey_l, false},
+	{"ResetGame", "Keyboard", Common::KEYCODE_F1, false},
+	{"SaveGame", "Keyboard", Common::KEYCODE_F4, false},
+	{"LoadGame", "Keyboard", Common::KEYCODE_F5, false},
+	{"LockInput", "Keyboard", Common::KEYCODE_k, false},
+	{"Screenshot", "Keyboard", Common::KEYCODE_F12, false},
+
+	//{"Hit","Keyboard",Common::KEYCODE_h,false},
+	//{"Log","Keyboard",Common::KEYCODE_l,false},
+	//{"Taunt","Keyboard",Common::KEYCODE_t,false},
+	{"PrintLog", "Keyboard", Common::KEYCODE_l, false},
 
 	{"", "", 0, false}};
 
@@ -138,9 +135,8 @@ cButtonHandler::cButtonHandler(cInit *apInit) : iUpdateable("ButtonHandler") {
 	while (pBHAction->msName[0] != '\0') {
 		tString sName = pBHAction->msName;
 		tString sType = mpInit->mpConfig->GetString("Keys", sName + "_Type", pBHAction->msType);
-		tString sVal = mpInit->mpConfig->GetString("Keys", sName + "_Val", cString::ToString(pBHAction->mlVal));
 
-		iAction *pAction = ActionFromTypeAndVal(sName, sType, sVal);
+		iAction *pAction = ActionFromTypeAndVal(sName, sType, pBHAction->mlVal);
 		if (pAction) {
 			mpInput->AddAction(pAction);
 		} else {
@@ -653,9 +649,8 @@ void cButtonHandler::SetDefaultKeys() {
 	while (pBHAction->msName[0] != '\0') {
 		tString sName = pBHAction->msName;
 		tString sType = pBHAction->msType;
-		tString sVal = cString::ToString(pBHAction->mlVal);
 
-		iAction *pAction = ActionFromTypeAndVal(sName, sType, sVal);
+		iAction *pAction = ActionFromTypeAndVal(sName, sType, pBHAction->mlVal);
 
 		if (pAction) {
 			mpInput->DestroyAction(sName);
@@ -701,13 +696,13 @@ tString cButtonHandler::GetActionName(const tString &asInputName, const tString
 
 //-----------------------------------------------------------------------
 
-iAction *cButtonHandler::ActionFromTypeAndVal(const tString &asName, const tString &asType, const tString &asVal) {
+iAction *cButtonHandler::ActionFromTypeAndVal(const tString &asName, const tString &asType, int input) {
 	// Log("Action %s from %s\n",asName.c_str(),asType.c_str());
 
 	if (asType == "Keyboard") {
-		return hplNew(cActionKeyboard, (asName, mpInit->mpGame->GetInput(), (eKey)cString::ToInt(asVal.c_str(), 0)));
+		return hplNew(cActionKeyboard, (asName, mpInit->mpGame->GetInput(), static_cast<Common::KeyCode>(input)));
 	} else if (asType == "MouseButton" || asType == "HapticDeviceButton") {
-		return hplNew(cActionMouseButton, (asName, mpInit->mpGame->GetInput(), (eMButton)cString::ToInt(asVal.c_str(), 0)));
+		return hplNew(cActionMouseButton, (asName, mpInit->mpGame->GetInput(), (eMButton)input));
 	}
 
 	return NULL;
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.h b/engines/hpl1/penumbra-overture/ButtonHandler.h
index 0f1e1eb2598..d15a02ebdf0 100644
--- a/engines/hpl1/penumbra-overture/ButtonHandler.h
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.h
@@ -64,7 +64,7 @@ public:
 	bool mbToggleCrouch;
 
 private:
-	iAction *ActionFromTypeAndVal(const tString &asName, const tString &asType, const tString &asVal);
+	iAction *ActionFromTypeAndVal(const tString &asName, const tString &asType, int input);
 	void TypeAndValFromAction(iAction *apAction, tString *apType, tString *apVal);
 
 	int mlNumOfActions;
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index 244b1910bf3..917498f722a 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -2118,8 +2118,8 @@ void cMainMenu::SetInputToAction(const tString &asActionName, cMainMenuWidget_Te
 void cMainMenu::InitCheckInput() {
 	cInput *pInput = mpInit->mpGame->GetInput();
 
-	for (int i = 0; i < eKey_LastEnum; ++i) {
-		mvKeyPressed[i] = pInput->GetKeyboard()->KeyIsDown((eKey)i);
+	for (int i = 0; i < Common::KEYCODE_LAST; ++i) {
+		mvKeyPressed[i] = pInput->GetKeyboard()->KeyIsDown(static_cast<Common::KeyCode>(i));
 	}
 
 	for (int i = 0; i < eMButton_LastEnum; ++i) {
@@ -2134,8 +2134,8 @@ bool cMainMenu::CheckForInput() {
 
 	////////////////////
 	// Keyboard
-	for (int i = 0; i < eKey_LastEnum; ++i) {
-		if (pInput->GetKeyboard()->KeyIsDown((eKey)i)) {
+	for (int i = 0; i < Common::KEYCODE_LAST; ++i) {
+		if (pInput->GetKeyboard()->KeyIsDown(static_cast<Common::KeyCode>(i))) {
 			if (mvKeyPressed[i] == false)
 				return true;
 		} else {
diff --git a/engines/hpl1/penumbra-overture/MainMenu.h b/engines/hpl1/penumbra-overture/MainMenu.h
index 30e6e8a98b7..325839162e6 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.h
+++ b/engines/hpl1/penumbra-overture/MainMenu.h
@@ -448,7 +448,7 @@ private:
 
 	bool mbGameActive;
 
-	bool mvKeyPressed[eKey_LastEnum];
+	bool mvKeyPressed[Common::KEYCODE_LAST];
 	bool mvMousePressed[eMButton_LastEnum];
 };
 




More information about the Scummvm-git-logs mailing list