Index: trunk/src/lib/event/key_mapper.cc
===================================================================
--- trunk/src/lib/event/key_mapper.cc	(revision 7256)
+++ trunk/src/lib/event/key_mapper.cc	(revision 7661)
@@ -27,4 +27,5 @@
 #include "util/preferences.h"
 #include "key_names.h"
+#include "event_def.h"
 #include "debug.h"
 
@@ -71,38 +72,37 @@
  * and you do not have to care about The namings, as they might change
  */
-orxKeyMapping map[] = {
-  {&KeyMapper::PEV_FORWARD,              CONFIG_NAME_PLAYER_FORWARD},
-  {&KeyMapper::PEV_BACKWARD,             CONFIG_NAME_PLAYER_BACKWARD},
-  {&KeyMapper::PEV_UP,                   CONFIG_NAME_PLAYER_UP},
-  {&KeyMapper::PEV_DOWN,                 CONFIG_NAME_PLAYER_DOWN},
-  {&KeyMapper::PEV_LEFT,                 CONFIG_NAME_PLAYER_LEFT},
-  {&KeyMapper::PEV_RIGHT,                CONFIG_NAME_PLAYER_RIGHT},
-  {&KeyMapper::PEV_ROLL_LEFT,            CONFIG_NAME_PLAYER_ROLL_RIGHT},
-  {&KeyMapper::PEV_ROLL_RIGHT,           CONFIG_NAME_PLAYER_ROLL_LEFT},
-  {&KeyMapper::PEV_STRAFE_LEFT,          "StrafeLeft"},
-  {&KeyMapper::PEV_STRAFE_RIGHT,         "StrafeRight"},
-
-  {&KeyMapper::PEV_FIRE1,                CONFIG_NAME_PLAYER_FIRE},
-  {&KeyMapper::PEV_FIRE1,                "Fire1"},
-  {&KeyMapper::PEV_FIRE2,                "Fire2"},
-  {&KeyMapper::PEV_NEXT_WEAPON,          CONFIG_NAME_PLAYER_NEXT_WEAPON},
-  {&KeyMapper::PEV_PREVIOUS_WEAPON,      CONFIG_NAME_PLAYER_PREV_WEAPON},
-
-  {&KeyMapper::PEV_CHANGE_SHIP,          CONFIG_NAME_PLAYER_CHANGE_SHIP},
-
-
-  {&KeyMapper::PEV_VIEW0,                CONFIG_NAME_VIEW0},
-  {&KeyMapper::PEV_VIEW1,                CONFIG_NAME_VIEW1},
-  {&KeyMapper::PEV_VIEW2,                CONFIG_NAME_VIEW2},
-  {&KeyMapper::PEV_VIEW3,                CONFIG_NAME_VIEW3},
-  {&KeyMapper::PEV_VIEW4,                CONFIG_NAME_VIEW4},
-  {&KeyMapper::PEV_VIEW5,                CONFIG_NAME_VIEW5},
-
-  {&KeyMapper::PEV_NEXT_WORLD,           CONFIG_NAME_NEXT_WORLD},
-  {&KeyMapper::PEV_PREVIOUS_WORLD,       CONFIG_NAME_PREV_WORLD},
-
-  {&KeyMapper::PEV_PAUSE,                CONFIG_NAME_PAUSE},
-  {&KeyMapper::PEV_QUIT,                 CONFIG_NAME_QUIT},
-  {NULL, NULL}
+KeyMapper::KeyMapping KeyMapper::map[] = {
+  {&KeyMapper::PEV_FORWARD,              CONFIG_NAME_PLAYER_FORWARD,         SDLK_w},
+  {&KeyMapper::PEV_BACKWARD,             CONFIG_NAME_PLAYER_BACKWARD,        SDLK_s},
+  {&KeyMapper::PEV_UP,                   CONFIG_NAME_PLAYER_UP,              SDLK_r},
+  {&KeyMapper::PEV_DOWN,                 CONFIG_NAME_PLAYER_DOWN,            SDLK_f},
+  {&KeyMapper::PEV_LEFT,                 CONFIG_NAME_PLAYER_LEFT,            SDLK_a},
+  {&KeyMapper::PEV_RIGHT,                CONFIG_NAME_PLAYER_RIGHT,           SDLK_d},
+  {&KeyMapper::PEV_ROLL_RIGHT,           CONFIG_NAME_PLAYER_ROLL_LEFT,       SDLK_z},
+  {&KeyMapper::PEV_ROLL_LEFT,            CONFIG_NAME_PLAYER_ROLL_RIGHT,      SDLK_c},
+  {&KeyMapper::PEV_STRAFE_LEFT,          "StrafeLeft",                       SDLK_q},
+  {&KeyMapper::PEV_STRAFE_RIGHT,         "StrafeRight",                      SDLK_e},
+
+  {&KeyMapper::PEV_FIRE1,                CONFIG_NAME_PLAYER_FIRE,            EV_MOUSE_BUTTON_LEFT},
+  {&KeyMapper::PEV_FIRE2,                "Fire2",                            EV_MOUSE_BUTTON_RIGHT},
+  {&KeyMapper::PEV_NEXT_WEAPON,          CONFIG_NAME_PLAYER_NEXT_WEAPON,     EV_MOUSE_BUTTON_WHEELUP},
+  {&KeyMapper::PEV_PREVIOUS_WEAPON,      CONFIG_NAME_PLAYER_PREV_WEAPON,     EV_MOUSE_BUTTON_WHEELDOWN},
+
+  {&KeyMapper::PEV_CHANGE_SHIP,          CONFIG_NAME_PLAYER_CHANGE_SHIP,     SDLK_g},
+
+
+  {&KeyMapper::PEV_VIEW0,                CONFIG_NAME_VIEW0,                  SDLK_1},
+  {&KeyMapper::PEV_VIEW1,                CONFIG_NAME_VIEW1,                  SDLK_2},
+  {&KeyMapper::PEV_VIEW2,                CONFIG_NAME_VIEW2,                  SDLK_3},
+  {&KeyMapper::PEV_VIEW3,                CONFIG_NAME_VIEW3,                  SDLK_4},
+  {&KeyMapper::PEV_VIEW4,                CONFIG_NAME_VIEW4,                  SDLK_5},
+  {&KeyMapper::PEV_VIEW5,                CONFIG_NAME_VIEW5,                  SDLK_6},
+
+  {&KeyMapper::PEV_NEXT_WORLD,           CONFIG_NAME_NEXT_WORLD,             SDLK_x},
+  {&KeyMapper::PEV_PREVIOUS_WORLD,       CONFIG_NAME_PREV_WORLD,             SDLK_z},
+
+  {&KeyMapper::PEV_PAUSE,                CONFIG_NAME_PAUSE,                  SDLK_p},
+  {&KeyMapper::PEV_QUIT,                 CONFIG_NAME_QUIT,                   SDLK_ESCAPE},
+  {NULL, "", 0}
 };
 
@@ -138,7 +138,7 @@
 void KeyMapper::loadKeyBindings(IniParser* iniParser)
 {
-  if( !iniParser->getSection (CONFIG_SECTION_PLAYER "1"))
-  {
-    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n");
+  if( !iniParser->getSection (CONFIG_SECTION_CONTROL))
+  {
+    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n");
     return;
   }
@@ -158,52 +158,36 @@
 
   // PARSE MISC SECTION
-  if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS))
-  {
-    PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n");
+//   if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS))
+//   {
+//     PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n");
+//     return;
+//   }
+//
+//   iniParser->firstVar();
+//   while( iniParser->getCurrentName() != "" )
+//   {
+//     PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());
+//     index = nameToIndex (iniParser->getCurrentValue());
+//     this->mapKeys(iniParser->getCurrentName(), index);
+//     iniParser->nextVar();
+//   }
+}
+
+void KeyMapper::loadKeyBindings()
+{
+  if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_CONTROL))
+  {
+    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n");
     return;
   }
-
-  iniParser->firstVar();
-  while( iniParser->getCurrentName() != "" )
-  {
-    PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());
-    index = nameToIndex (iniParser->getCurrentValue());
-    this->mapKeys(iniParser->getCurrentName(), index);
-    iniParser->nextVar();
-  }
-}
-
-void KeyMapper::loadKeyBindings()
-{
-  if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_PLAYER "1"))
-  {
-    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n");
-    return;
-  }
   int* index;
 
-  std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_PLAYER "1");
+  std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_CONTROL);
   for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
   {
-    PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, "").c_str());
+    PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_CONTROL, *it, "").c_str());
     // map the name to an sdl index
-    index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, ""));
+    index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_CONTROL, *it, ""));
     // map the index to a internal name
-    this->mapKeys(*it, index);
-  }
-
-
-  // PARSE MISC SECTION
-  if( !Preferences::getInstance()->sectionExists (CONFIG_SECTION_MISC_KEYS))
-  {
-    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_MISC_KEYS "\n");
-    return;
-  }
-
-  keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_MISC_KEYS);
-  for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
-  {
-    PRINTF(3)("MISC: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, "").c_str());
-    index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, ""));
     this->mapKeys(*it, index);
   }
@@ -266,5 +250,5 @@
   for(int i = 0; map[i].pValue != NULL; ++i)
     {
-      PRINT(0)("%s = %i\n",map[i].pName, *map[i].pValue);
+      PRINT(0)("%s = %i\n",map[i].pName.c_str(), *map[i].pValue);
     }
   PRINT(0)("=======================================================\n");
