[Scummvm-cvs-logs] scummvm master -> 38ff68e4492df227f49f3932f16d7b3a5a5c9231

tsoliman tarek at bashasoliman.com
Tue Dec 13 03:24:09 CET 2011


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

Summary:
feb04d2164 KEYMAPPER: Add Common::KeyActionEntry for making simple keymap tables
38ff68e449 KYRA: Use Common::KeyActionEntry table for LoL game keymap


Commit: feb04d2164766378d40304a843ab0374b87320a1
    https://github.com/scummvm/scummvm/commit/feb04d2164766378d40304a843ab0374b87320a1
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2011-12-12T18:18:40-08:00

Commit Message:
KEYMAPPER: Add Common::KeyActionEntry for making simple keymap tables

Changed paths:
    backends/keymapper/action.h



diff --git a/backends/keymapper/action.h b/backends/keymapper/action.h
index b15b3aa..e5bf6d5 100644
--- a/backends/keymapper/action.h
+++ b/backends/keymapper/action.h
@@ -40,6 +40,12 @@ class Keymap;
 
 #define ACTION_ID_SIZE (4)
 
+struct KeyActionEntry {
+	const KeyState ks;
+	const char *id;
+	const char *description;
+};
+
 struct Action {
 	/** unique id used for saving/loading to config */
 	char id[ACTION_ID_SIZE];


Commit: 38ff68e4492df227f49f3932f16d7b3a5a5c9231
    https://github.com/scummvm/scummvm/commit/38ff68e4492df227f49f3932f16d7b3a5a5c9231
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2011-12-12T18:19:42-08:00

Commit Message:
KYRA: Use Common::KeyActionEntry table for LoL game keymap

This is for the keymapper keymap

Changed paths:
    engines/kyra/lol.cpp



diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 538e88a..7d73526 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -568,41 +568,27 @@ void LoLEngine::initKeymap() {
 	Common::Action *act;
 	Common::Keymap *engineKeyMap = new Common::Keymap(kKeymapName);
 
-	act = new Common::Action(engineKeyMap, "AT1", _("Attack 1"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0));
-
-	act = new Common::Action(engineKeyMap, "AT2", _("Attack 2"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_F2, Common::ASCII_F2 , 0));
-
-	act = new Common::Action(engineKeyMap, "AT3", _("Attack 3"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_F3, Common::ASCII_F3 , 0));
-
-	act = new Common::Action(engineKeyMap, "MVF", _("Move Forward"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_UP));
-
-	act = new Common::Action(engineKeyMap, "MVB", _("Move Back"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_DOWN));
-
-	act = new Common::Action(engineKeyMap, "SLL", _("Slide Left"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_LEFT));
-
-	act = new Common::Action(engineKeyMap, "SLR", _("Slide Right"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_RIGHT));
-
-	act = new Common::Action(engineKeyMap, "TL", _("Turn Left"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_HOME));
-
-	act = new Common::Action(engineKeyMap, "TR", _("Turn Right"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_PAGEUP));
-
-	act = new Common::Action(engineKeyMap, "RST", _("Rest"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_r));
-
-	act = new Common::Action(engineKeyMap, "OPT", _("Options"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_o));
+	const Common::KeyActionEntry keyActionEntries[] = {
+		{Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0), "AT1", _("Attack 1")},
+		{Common::KeyState(Common::KEYCODE_F2, Common::ASCII_F2 , 0), "AT2", _("Attack 2")},
+		{Common::KeyState(Common::KEYCODE_F3, Common::ASCII_F2 , 0), "AT3", _("Attack 3")},
+		{Common::KeyState(Common::KEYCODE_UP), "MVF", _("Move Forward")},
+		{Common::KeyState(Common::KEYCODE_DOWN), "MVB", _("Move Back")},
+		{Common::KeyState(Common::KEYCODE_LEFT), "SLL", _("Slide Left")},
+		{Common::KeyState(Common::KEYCODE_RIGHT), "SLR", _("Slide Right")},
+		{Common::KeyState(Common::KEYCODE_HOME), "TL", _("Turn Left")},
+		{Common::KeyState(Common::KEYCODE_PAGEUP), "TR", _("Turn Right")},
+		{Common::KeyState(Common::KEYCODE_r), "RST", _("Rest")},
+		{Common::KeyState(Common::KEYCODE_o), "OPT", _("Options")},
+		{Common::KeyState(Common::KEYCODE_SLASH), "SPL", _("Choose Spell")},
+		{Common::KeyState(), 0, 0}
+	};
 
-	act = new Common::Action(engineKeyMap, "SPL", _("Choose Spell"), Common::kGenericActionType, Common::kActionKeyType);
-	act->addKeyEvent(Common::KeyState(Common::KEYCODE_SLASH));
+	const Common::KeyActionEntry *entry;
+	for (entry = keyActionEntries; entry->id; ++entry) {
+		act = new Common::Action(engineKeyMap, entry->id, Common::String(entry->description), Common::kGenericActionType, Common::kActionKeyType);
+		act->addKeyEvent(Common::KeyState(entry->ks));
+	}
 
 	mapper->addGameKeymap(engineKeyMap);
 






More information about the Scummvm-git-logs mailing list