[Scummvm-cvs-logs] scummvm master -> a8d1454e165fa2178a0463e96a2ee40bd9487627

dreammaster dreammaster at scummvm.org
Sun Jun 8 22:58:33 CEST 2014


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:
a8d1454e16 TSAGE: Fix for R2R game/help dialog not accepting Fn keys


Commit: a8d1454e165fa2178a0463e96a2ee40bd9487627
    https://github.com/scummvm/scummvm/commit/a8d1454e165fa2178a0463e96a2ee40bd9487627
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-06-08T16:57:51-04:00

Commit Message:
TSAGE: Fix for R2R game/help dialog not accepting Fn keys

Changed paths:
    engines/tsage/graphics.cpp
    engines/tsage/graphics.h
    engines/tsage/ringworld2/ringworld2_dialogs.cpp
    engines/tsage/ringworld2/ringworld2_dialogs.h



diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index fa5d1a3..ce24c76 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -1229,6 +1229,8 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
 					selectedButton = defaultButton;
 					breakFlag = true;
 					break;
+				} else if (event.eventType == EVENT_KEYPRESS && handleKeypress(event, selectedButton)) {
+					breakFlag = true;
 				}
 			}
 		}
diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h
index cdb4826..d65d0bc 100644
--- a/engines/tsage/graphics.h
+++ b/engines/tsage/graphics.h
@@ -343,6 +343,8 @@ public:
 	virtual void draw();
 
 	static void setPalette();
+
+	virtual bool handleKeypress(Event &evt, GfxButton *&btn) { return false; }
 };
 
 GfxSurface *surfaceGetArea(GfxSurface &src, const Rect &bounds);
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
index dfbb281..99f88a1 100644
--- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
@@ -365,7 +365,7 @@ void HelpDialog::show() {
 	HelpDialog *dlg = new HelpDialog();
 	dlg->draw();
 
-	// Show the character selection dialog
+	// Show the help dialog
 	GfxButton *btn = dlg->execute(&dlg->_btnResume);
 
 	// If a function button was selected, take care of it
@@ -458,6 +458,36 @@ HelpDialog::HelpDialog() {
 	setCenter(160, 100);
 }
 
+bool HelpDialog::handleKeypress(Event &event, GfxButton *&btn) {
+	switch (event.kbd.keycode) {
+	case Common::KEYCODE_F2:
+		btn = &_btnList[0];
+		break;
+	case Common::KEYCODE_F3:
+		btn = &_btnList[1];
+		break;
+	case Common::KEYCODE_F4:
+		btn = &_btnList[2];
+		break;
+	case Common::KEYCODE_F5:
+		btn = &_btnList[3];
+		break;
+	case Common::KEYCODE_F7:
+		btn = &_btnList[4];
+		break;
+	case Common::KEYCODE_F8:
+		btn = &_btnList[5];
+		break;
+	case Common::KEYCODE_F10:
+		btn = &_btnList[6];
+		break;
+	default:
+		return false;
+	}
+
+	return true;
+}
+
 } // End of namespace Ringworld2
 
 } // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.h b/engines/tsage/ringworld2/ringworld2_dialogs.h
index 8ef35c9..3d1e1ad 100644
--- a/engines/tsage/ringworld2/ringworld2_dialogs.h
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.h
@@ -83,6 +83,8 @@ public:
 	virtual ~HelpDialog() {}
 
 	static void show();
+
+	virtual bool handleKeypress(Event &event, GfxButton *&btn);
 };
 
 } // End of namespace Ringworld2






More information about the Scummvm-git-logs mailing list