changeset 1031:f93d17337113

UI stuff.
author Nomad
date Tue, 21 May 2013 14:34:14 +0200
parents 7735bdb3c30f
children 9408f98f4929 3a5c8df8381d
files GUIWindow.h Keyboard.cpp Time.cpp Time.h UICharacter.cpp UIOptions.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 11 files changed, 152 insertions(+), 277 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Tue May 21 12:52:38 2013 +0200
+++ b/GUIWindow.h	Tue May 21 14:34:14 2013 +0200
@@ -486,8 +486,10 @@
 
 
 
-
-
+// game menu ui
+void GameMenuUI_DrawKeyBindings();
+void GameMenuUI_DrawVideoOptions();
+void GameMenuUI_Options_Draw();
 
 
 
@@ -709,6 +711,11 @@
 extern unsigned int ui_game_minimap_projectile_color;
 extern unsigned int ui_game_minimap_treasure_color;
 extern unsigned int ui_game_character_record_playerbuff_colors[24];
+extern unsigned int ui_gamemenu_video_gamma_title_color;
+extern unsigned int ui_gamemenu_keys_action_name_color;
+extern unsigned int ui_gamemenu_keys_key_selection_blink_color_1;
+extern unsigned int ui_gamemenu_keys_key_selection_blink_color_2;
+extern unsigned int ui_gamemenu_keys_key_default_color;
 extern unsigned int ui_book_quests_title_color;
 extern unsigned int ui_book_quests_text_color;
 extern unsigned int ui_book_autonotes_title_color;
--- a/Keyboard.cpp	Tue May 21 12:52:38 2013 +0200
+++ b/Keyboard.cpp	Tue May 21 14:34:14 2013 +0200
@@ -44,9 +44,9 @@
 
   ResetKeys();
 
-  dword_506E68 = -1;
+  uGameMenuUI_CurentlySelectedKeyIdx = -1;
 }
-// 506E68: using guessed type int dword_506E68;
+// 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx;
 
 //----- (00459CC4) --------------------------------------------------------
 void KeyboardActionMapping::SetDefaultMapping()
@@ -155,7 +155,7 @@
   int v3; // [sp-4h] [bp-4h]@3
 
   pKeyActionMap->uLastKeyPressed = a2;
-  if ( dword_506E68 == -1 )
+  if ( uGameMenuUI_CurentlySelectedKeyIdx == -1 )
   {
     if ( pKeyActionMap->field_204 == 1 )
     {
@@ -215,7 +215,7 @@
   pKeyActionMap->_459ED1(v3);
   return 1;
 }
-// 506E68: using guessed type int dword_506E68;
+// 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx;
 
 //----- (00459FFC) --------------------------------------------------------
 void KeyboardActionMapping::ReadMappings()
--- a/Time.cpp	Tue May 21 12:52:38 2013 +0200
+++ b/Time.cpp	Tue May 21 14:34:14 2013 +0200
@@ -21,7 +21,7 @@
 //----- (00426317) --------------------------------------------------------
 unsigned __int64 Timer::Time()
 {
-  uint v2 = (timeGetTime() * 128) / 1000;
+  uint v2 = TimeQuant * timeGetTime() / 1000;
   if (v2 < uStartTime)
     uStartTime = 0;
   return v2;
--- a/Time.h	Tue May 21 12:52:38 2013 +0200
+++ b/Time.h	Tue May 21 14:34:14 2013 +0200
@@ -40,6 +40,14 @@
   unsigned int uTimeElapsed;
   int dt_in_some_format;
   unsigned int uTotalGameTimeElapsed;
+
+  static const unsigned int TimeQuant = 128;
+  static const unsigned int Minute = 2 * TimeQuant;
+  static const unsigned int Hour = 60 * Minute;
+  static const unsigned int Day = 24 * Hour;
+  static const unsigned int Week = 7 * Day;
+  static const unsigned int Month = 4 * Week;
+  static const unsigned int Year = 12 * Month;
 };
 
 #pragma pack(pop)
@@ -47,11 +55,4 @@
 
 
 extern Timer *pMiscTimer;
-extern Timer *pEventTimer;
-
-const unsigned int Minute = 256;
-const unsigned int Hour = 60 * Minute;
-const unsigned int Day = 24 * Hour;
-const unsigned int Week = 7 * Day;
-const unsigned int Month = 4 * Week;
-const unsigned int Year = 12 * Month;
\ No newline at end of file
+extern Timer *pEventTimer;
\ No newline at end of file
--- a/UICharacter.cpp	Tue May 21 12:52:38 2013 +0200
+++ b/UICharacter.cpp	Tue May 21 14:34:14 2013 +0200
@@ -46,6 +46,12 @@
 unsigned int ui_game_minimap_treasure_color;
 unsigned int ui_game_character_record_playerbuff_colors[24];
 
+unsigned int ui_gamemenu_video_gamma_title_color;
+unsigned int ui_gamemenu_keys_action_name_color;
+unsigned int ui_gamemenu_keys_key_selection_blink_color_1;
+unsigned int ui_gamemenu_keys_key_selection_blink_color_2;
+unsigned int ui_gamemenu_keys_key_default_color;
+
 unsigned int ui_book_quests_title_color;
 unsigned int ui_book_quests_text_color;
 unsigned int ui_book_autonotes_title_color;
@@ -118,6 +124,12 @@
   ui_game_character_record_playerbuff_colors[22] = TargetColor(0, 128, 255);
   ui_game_character_record_playerbuff_colors[23] = TargetColor(0, 128, 255);
 
+  ui_gamemenu_video_gamma_title_color = TargetColor(255, 255, 155);
+  ui_gamemenu_keys_action_name_color = TargetColor(255, 255, 255);
+  ui_gamemenu_keys_key_selection_blink_color_1 = TargetColor(50, 0, 0);
+  ui_gamemenu_keys_key_selection_blink_color_2 = TargetColor(225, 205, 35);
+  ui_gamemenu_keys_key_default_color = TargetColor(255, 255, 255);
+
   ui_book_quests_title_color = TargetColor(255, 255, 255);
   ui_book_quests_text_color = TargetColor(255, 255, 255);
   ui_book_autonotes_title_color = TargetColor(255, 255, 255);
--- a/UIOptions.cpp	Tue May 21 12:52:38 2013 +0200
+++ b/UIOptions.cpp	Tue May 21 14:34:14 2013 +0200
@@ -56,98 +56,43 @@
 OptionsMenuSkin options_menu_skin; // 507C60
 
 
+bool GameMenuUI_InvaligKeyBindingsFlags[28]; // 506E6C
+//----- (00414D24) --------------------------------------------------------
+static unsigned int GameMenuUI_GetKeyBindingColor(int key_index)
+{
+  if (uGameMenuUI_CurentlySelectedKeyIdx == key_index)
+  {
+    if (GetTickCount() % 1000 < 500)
+      return ui_gamemenu_keys_key_selection_blink_color_1;
+    else
+      return ui_gamemenu_keys_key_selection_blink_color_2;
+  }
+  else if (GameMenuUI_InvaligKeyBindingsFlags[key_index])
+  {
+    int intensity;
 
+    int time = GetTickCount() % 800;
+    if (time < 400)
+      intensity = - 70 + 70 * time / 400;
+    else
+      intensity = + 70 - 70 * time / 800;
+
+    return TargetColor(185 + intensity, 40 + intensity / 4, 40 + intensity / 4);
+  }
+
+  return ui_gamemenu_keys_key_default_color;
+}
 
 //----- (004142D3) --------------------------------------------------------
 void GameMenuUI_DrawKeyBindings()
-    {
-    unsigned int v0; // ebp@1
-    int v1; // ecx@2
-    unsigned int v2; // eax@6
-    GUIWindow *v3; // edx@6
+{
     signed int v4; // ecx@7
     signed int v5; // eax@8
-    const char *v6; // ST0C_4@16
-    unsigned int v7; // eax@16
-    const char *v8; // ST0C_4@16
-    unsigned int v9; // eax@16
-    const char *v10; // ST0C_4@16
-    unsigned int v11; // eax@16
-    const char *v12; // ST0C_4@16
-    unsigned int v13; // eax@16
-    const char *v14; // ST0C_4@16
-    unsigned int v15; // eax@16
-    const char *v16; // ST0C_4@16
-    unsigned int v17; // eax@16
-    const char *v18; // ST0C_4@16
-    unsigned int v19; // eax@16
-    const char *v20; // ST0C_4@16
-    unsigned int v21; // eax@16
-    signed int v22; // ebp@16
-    const char *v23; // ST0C_4@16
-    unsigned int v24; // eax@16
-    const char *v25; // ST0C_4@16
-    unsigned int v26; // eax@16
-    const char *v27; // ST0C_4@16
-    unsigned int v28; // eax@16
-    const char *v29; // ST0C_4@16
-    unsigned int v30; // eax@16
-    const char *v31; // ST0C_4@16
-    unsigned int v32; // eax@16
-    const char *v33; // ST0C_4@17
-    unsigned int v34; // eax@17
-    const char *v35; // ST0C_4@17
-    unsigned int v36; // eax@17
-    const char *v37; // ST0C_4@17
-    unsigned int v38; // eax@17
-    const char *v39; // ST0C_4@17
-    unsigned int v40; // eax@17
-    const char *v41; // ST0C_4@17
-    unsigned int v42; // eax@17
-    const char *v43; // ST0C_4@17
-    unsigned int v44; // eax@17
-    const char *v45; // ST0C_4@17
-    unsigned int v46; // eax@17
-    const char *v47; // ST0C_4@17
-    unsigned int v48; // eax@17
-    const char *v49; // ST0C_4@17
-    unsigned int v50; // eax@17
-    const char *v51; // ST0C_4@17
-    unsigned int v52; // eax@17
-    const char *v53; // ST0C_4@17
-    unsigned int v54; // eax@17
-    const char *v55; // ST0C_4@17
-    unsigned int v56; // eax@17
-    const char *v57; // ST0C_4@17
-    unsigned int v58; // eax@17
-    unsigned int v59; // eax@18
-    //int v61; // [sp-14h] [bp-28h]@16
-    const char *v62; // [sp-10h] [bp-24h]@16
-    unsigned int a5; // [sp+10h] [bp-4h]@1
-
-    v0 = TargetColor(0xFFu, 0xFFu, 0xFFu);
-    a5 = v0;
-    if ( byte_4E28FC )
-        {
-        v1 = dword_507C0C + 15;
-        dword_507C0C = v1;
-        if ( v1 == 255 )
-            byte_4E28FC = 0;
-        }
-    else
-        {
-        v1 = dword_507C0C - 15;
-        dword_507C0C = v1;
-        if ( v1 == 15 )
-            byte_4E28FC = 1;
-        }
-    v2 = TargetColor(v1, 0, 0);
-    v3 = pGUIWindow_CurrentMenu;
-    dword_507C08 = v2;
+    
     if ( pGUIWindow_CurrentMenu->field_40 == 2 )
         {
-        pPrevVirtualCidesMapping[dword_506E68] = pKeyActionMap->pPressedKeysBuffer[0];
-        memset(&KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray));
+        pPrevVirtualCidesMapping[uGameMenuUI_CurentlySelectedKeyIdx] = pKeyActionMap->pPressedKeysBuffer[0];
+        memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
         v4 = 0;
         do
             {
@@ -156,8 +101,8 @@
                 {
                 if ( v4 != v5 && pPrevVirtualCidesMapping[v4] == pPrevVirtualCidesMapping[v5] )
                     {
-                    KeyButtonFlagChangesArray[v4] = 1;
-                    KeyButtonFlagChangesArray[v5] = 1;
+                    GameMenuUI_InvaligKeyBindingsFlags[v4] = true;
+                    GameMenuUI_InvaligKeyBindingsFlags[v5] = true;
                     }
                 ++v5;
                 }
@@ -165,168 +110,86 @@
                 ++v4;
             }
             while ( v4 < 28 );
-            dword_506E68 = -1;
-            v3->field_40 = 0;
+            uGameMenuUI_CurentlySelectedKeyIdx = -1;
+            pGUIWindow_CurrentMenu->field_40 = 0;
         }
     pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Optkb[0]));
     if ( KeyboardPageNum == 1 )
     {
         pRenderer->DrawTextureIndexed(0x13, 0x12E, pIcons_LOD->GetTexture(uTextureID_Optkb[3]));
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, "ÂÏÅШÄ", 0, 0, 0);
-        v6 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]);
-        v7 = sub_414D24(0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, v7, v6, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, v0, "ÍÀÇÀÄ", 0, 0, 0);
-        v8 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[1]);
-        v9 = sub_414D24(1);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, v9, v8, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, v0, "ÂËÅÂÎ", 0, 0, 0);
-        v10 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[2]);
-        v11 = sub_414D24(2);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, v11, v10, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, v0, "ÂÏÐÀÂÎ", 0, 0, 0);
-        v12 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[3]);
-        v13 = sub_414D24(3);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, v13, v12, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, v0, "ÊÐÈÊ", 0, 0, 0);
-        v14 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[4]);
-        v15 = sub_414D24(4);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, v15, v14, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, v0, "ÏÐÛÆÎÊ", 0, 0, 0);
-        v16 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[5]);
-        v17 = sub_414D24(5);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, v17, v16, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, v0, "Ï.ÐÅÆÈÌ", 0, 0, 0);
-        v18 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[6]);
-        v19 = sub_414D24(6);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, v19, v18, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, v0, "ÏÐÈÌ. ÇÀÊË.", 0, 0, 0);
-        v20 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[7]);
-        v21 = sub_414D24(7);
-        v22 = 350;
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, v21, v20, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, a5, "ÀÒÀÊÀ", 0, 0, 0);
-        v23 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[8]);
-        v24 = sub_414D24(8);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, v24, v23, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, a5, "ÄÅÉÑÒÂ.", 0, 0, 0);
-        v25 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[9]);
-        v26 = sub_414D24(9);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, v26, v25, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, a5, "ÇÀÊËÈÍ.", 0, 0, 0);
-        v27 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[10]);
-        v28 = sub_414D24(10);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, v28, v27, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, a5, "ÈÃÐÎÊ", 0, 0, 0);
-        v29 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[11]);
-        v30 = sub_414D24(11);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, v30, v29, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, a5, "ÑËÅÄ. ÈÃÐÎÊ", 0, 0, 0);
-        v31 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[12]);
-        v32 = sub_414D24(12);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, v32, v31, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, a5, "ÇÀÄÀÍÈß", 0, 0, 0);
 
-        v62 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[13]);
-        v59 = sub_414D24(13);
-        }
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "ÂÏÅШÄ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(0), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "ÍÀÇÀÄ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(1), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[1]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "ÂËÅÂÎ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(2), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[2]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "ÂÏÐÀÂÎ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(3), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[3]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "ÊÐÈÊ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(4), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[4]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "ÏÐÛÆÎÊ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(5), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[5]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, "Ï.ÐÅÆÈÌ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(6), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[6]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, "ÏÐÈÌ. ÇÀÊË.", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(7), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[7]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "ÀÒÀÊÀ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(8), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[8]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "ÄÅÉÑÒÂ.", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(9), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[9]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "ÇÀÊËÈÍ.", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(10), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[10]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "ÈÃÐÎÊ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(11), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[11]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, "ÑËÅÄ. ÈÃÐÎÊ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(12), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[12]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "ÇÀÄÀÍÈß", 0, 0, 0);
+     pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(13), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[13]), 0, 0, 0);
+    }
     else
-        {
+    {
         pRenderer->DrawTextureIndexed(0x7F, 0x12E, pIcons_LOD->GetTexture(uTextureID_Optkb[4]));
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, "Á. ÑÏÐÀÂÊÀ", 0, 0, 0);
-        v33 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]);
-        v34 = sub_414D24(14);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, v34, v33, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, v0, "ÎÒÄÛÕ", 0, 0, 0);
-        v35 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[15]);
-        v36 = sub_414D24(15);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, v36, v35, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, v0, "ÒÅÊ. ÂÐÅÌß", 0, 0, 0);
-        v37 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[16]);
-        v38 = sub_414D24(16);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, v38, v37, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, v0, "ÀÂÒÎÇÀÌÅÒÊÈ", 0, 0, 0);
-        v39 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[17]);
-        v40 = sub_414D24(17);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, v40, v39, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, v0, "ÊÀÐÒÀ", 0, 0, 0);
-        v41 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[18]);
-        v42 = sub_414D24(18);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, v42, v41, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, v0, "ÁÅÆÀÒÜ", 0, 0, 0);
-        v43 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[19]);
-        v44 = sub_414D24(19);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, v44, v43, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, v0, "ÑÌ. ÂÂÅÐÕ", 0, 0, 0);
-        v45 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[20]);
-        v46 = sub_414D24(20);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, v46, v45, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, v0, "ÑÌ. ÂÍÈÇ", 0, 0, 0);
-        v47 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[21]);
-        v48 = sub_414D24(21);
-        v22 = 350;
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, v48, v47, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, a5, "ÑÌ. ÂÏÅШÄ", 0, 0, 0);
-        v49 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[22]);
-        v50 = sub_414D24(22);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, v50, v49, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, a5, "ÏÐÈÁËÈÇ", 0, 0, 0);
-        v51 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[23]);
-        v52 = sub_414D24(23);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, v52, v51, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, a5, "ÎÒÄÀËÈÒÜ", 0, 0, 0);
-        v53 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[24]);
-        v54 = sub_414D24(24);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, v54, v53, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, a5, "Ï. ÂÂÅÐÕ", 0, 0, 0);
-        v55 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[25]);
-        v56 = sub_414D24(25);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, v56, v55, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, a5, "Ï. ÂÍÈÇ", 0, 0, 0);
-        v57 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[26]);
-        v58 = sub_414D24(26);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, v58, v57, 0, 0, 0);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, a5, "ÏÐÈÇÅÌË", 0, 0, 0);
 
-        v62 = pKeyActionMap->GetVKeyDisplayName(pWindowList_at_506F50_minus1_indexing[0]);
-        v59 = sub_414D24(27);
-        }
-     pGUIWindow_CurrentMenu->DrawText(pFontLucida, v22, 268, v59, v62, 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, ui_gamemenu_keys_action_name_color, "Á. ÑÏÐÀÂÊÀ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 142, GameMenuUI_GetKeyBindingColor(14), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 163, ui_gamemenu_keys_action_name_color, "ÎÒÄÛÕ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 163, GameMenuUI_GetKeyBindingColor(15), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[15]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 184, ui_gamemenu_keys_action_name_color, "ÒÅÊ. ÂÐÅÌß", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 184, GameMenuUI_GetKeyBindingColor(16), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[16]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 205, ui_gamemenu_keys_action_name_color, "ÀÂÒÎÇÀÌÅÒÊÈ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 205, GameMenuUI_GetKeyBindingColor(17), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[17]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 226, ui_gamemenu_keys_action_name_color, "ÊÀÐÒÀ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 226, GameMenuUI_GetKeyBindingColor(18), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[18]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 247, ui_gamemenu_keys_action_name_color, "ÁÅÆÀÒÜ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 247, GameMenuUI_GetKeyBindingColor(19), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[19]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 268, ui_gamemenu_keys_action_name_color, "ÑÌ. ÂÂÅÐÕ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 127, 268, GameMenuUI_GetKeyBindingColor(20), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[20]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 142, ui_gamemenu_keys_action_name_color, "ÑÌ. ÂÍÈÇ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 142, GameMenuUI_GetKeyBindingColor(21), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[21]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 163, ui_gamemenu_keys_action_name_color, "ÑÌ. ÂÏÅШÄ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 163, GameMenuUI_GetKeyBindingColor(22), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[22]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 184, ui_gamemenu_keys_action_name_color, "ÏÐÈÁËÈÇ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 184, GameMenuUI_GetKeyBindingColor(23), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[23]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 205, ui_gamemenu_keys_action_name_color, "ÎÒÄÀËÈÒÜ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 205, GameMenuUI_GetKeyBindingColor(24), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[24]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 226, ui_gamemenu_keys_action_name_color, "Ï. ÂÂÅÐÕ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 226, GameMenuUI_GetKeyBindingColor(25), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[25]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 247, ui_gamemenu_keys_action_name_color, "Ï. ÂÍÈÇ", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 247, GameMenuUI_GetKeyBindingColor(26), pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[26]), 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 247, 268, ui_gamemenu_keys_action_name_color, "ÏÐÈÇÅÌË", 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, 350, 268, GameMenuUI_GetKeyBindingColor(27), pKeyActionMap->GetVKeyDisplayName(pWindowList_at_506F50_minus1_indexing[0]), 0, 0, 0);
     }
+}
 
 
-//----- (00414D24) --------------------------------------------------------
-unsigned int __thiscall sub_414D24(int _this)
-    {
-    int v1; // esi@1
-    unsigned int v2; // edi@1
-    unsigned int v3; // ebx@1
-    unsigned int result; // eax@1
 
-    v1 = _this;
-    v2 = TargetColor(0xE1u, 0xCDu, 0x23u);
-    v3 = TargetColor(0xFu, 0, 0);
-    result = TargetColor(0xFFu, 0xFFu, 0xFFu);
-    if ( dword_506E68 == v1 )
-        {
-        if ( GetTickCount() % 0x3E8 <= 0x1F4 )
-            result = v3;
-        else
-            result = v2;
-        }
-    else
-        {
-        if ( KeyButtonFlagChangesArray[v1] )
-            result = dword_507C08;
-        }
-    return result;
-    }
 
 //----- (00414D9A) --------------------------------------------------------
 void GameMenuUI_DrawVideoOptions()
 {
     const char *v0; // ST0C_4@3
-    unsigned __int16 v1; // ax@3
+    //unsigned __int16 v1; // ax@3
     //int v2; // eax@10
     GUIWindow v3; // [sp+8h] [bp-54h]@3
 
@@ -345,8 +208,8 @@
         v3.uFrameHeight = 79;
         v3.uFrameZ = 232;
         v3.uFrameW = 268;
-        v1 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-        v3.DrawTitleText(pFontSmallnum, 0, 0, v1, v0, 3u);
+        //v1 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
+        v3.DrawTitleText(pFontSmallnum, 0, 0, ui_gamemenu_video_gamma_title_color, v0, 3u);
         }
 
     if (!pRenderer->pRenderD3D)
@@ -369,7 +232,7 @@
 
 
 //----- (00414F82) --------------------------------------------------------
-void DrawGameOptions()
+void GameMenuUI_Options_Draw()
 {
   pRenderer->DrawTextureIndexed(8,   8, pIcons_LOD->GetTexture(uTextureID_Options));
   pRenderer->DrawTextureIndexed(8, 132, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_Background));
--- a/mm7_2.cpp	Tue May 21 12:52:38 2013 +0200
+++ b/mm7_2.cpp	Tue May 21 14:34:14 2013 +0200
@@ -6886,10 +6886,10 @@
           return 0;
 
         //SubMenu "Time"
-        case 40009:  pParty->uTimePlayed += Day;   return 0;
-        case 40010:  pParty->uTimePlayed += Week;   return 0;
-        case 40011:  pParty->uTimePlayed += Month;   return 0;
-        case 40012:  pParty->uTimePlayed += Year;   return 0;
+        case 40009:  pParty->uTimePlayed += Timer::Day;   return 0;
+        case 40010:  pParty->uTimePlayed += Timer::Week;   return 0;
+        case 40011:  pParty->uTimePlayed += Timer::Month;   return 0;
+        case 40012:  pParty->uTimePlayed += Timer::Year;   return 0;
 
         //SubMenu "Items"
         case 40015:
@@ -7235,7 +7235,7 @@
       }
         return DefWindowProcA(hWnd, Msg, wParam, lParam);
     }
-    if ( dword_506E68 != -1 )
+    if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 )
     {
       pKeyActionMap->_459F10(wParam);
       return DefWindowProcA(hWnd, Msg, wParam, lParam);
--- a/mm7_4.cpp	Tue May 21 12:52:38 2013 +0200
+++ b/mm7_4.cpp	Tue May 21 14:34:14 2013 +0200
@@ -2245,7 +2245,7 @@
 }
 
 //----- (00494035) --------------------------------------------------------
-void __cdecl _494035_timed_effects__water_walking_damage__etc()
+void _494035_timed_effects__water_walking_damage__etc()
 {
   signed __int64 v0; // qax@1
   signed __int64 v1; // ST30_8@1
--- a/mm7_5.cpp	Tue May 21 12:52:38 2013 +0200
+++ b/mm7_5.cpp	Tue May 21 14:34:14 2013 +0200
@@ -624,16 +624,16 @@
           pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0);
-          dword_506E68 = -1;
+          uGameMenuUI_CurentlySelectedKeyIdx = -1;
           KeyboardPageNum = 1;
-          memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray));
+          memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
           //*(_WORD *)KeyButtonArray[28] = 0;
           memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
           //v1 = "";
           //v0 = 1;
           continue;
         case UIMSG_ChangeKeyButton:
-          if ( dword_506E68 != -1 )
+          if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 )
           {
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             continue;
@@ -641,7 +641,7 @@
           v14 = uMessageParam;
           if ( KeyboardPageNum != 1 )
             v14 = uMessageParam + 14;
-          dword_506E68 = v14;
+          uGameMenuUI_CurentlySelectedKeyIdx = v14;
           pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu);
           continue;
         case UIMSG_ResetKeyMapping:
@@ -669,7 +669,7 @@
             v18 = uAction++;
             v13 = uAction > 28;
             v12 = uAction - 28 < 0;
-            KeyButtonFlagChangesArray[v18] = 0;
+            GameMenuUI_InvaligKeyBindingsFlags[v18] = 0;
           }
           while ( v12 ^ v13 );
           pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
@@ -1199,22 +1199,25 @@
                       WriteWindowsRegistryInt("GammaPos", uGammaPos);
                       stru_506E40.Release();
                       break;
+
                     case SCREEN_KEYBOARD_OPTIONS://Return to game
                       v197 = 1;
                       v32 = 0;
-                      while ( KeyButtonFlagChangesArray[v32] != 1 )
+                      while ( !GameMenuUI_InvaligKeyBindingsFlags[v32])
                       {
                         ++v32;
                         if ( v32 >= 28 )
                         {
                           thisb = (signed int)&uTextureID_Optkb;
+                          assert(false && "Invalid condition values");
                           do
                           {
                             if ( *(int *)thisb )
                               pIcons_LOD->pTextures[*(int *)thisb].Release();
                             thisb += 4;
                           }
-                          while ( thisb < (signed int)&dword_507C08 );
+                          while ( thisb < (signed int)0x00507C08 );
+
                           memset(&uTextureID_Optkb, 0, 0x14u);
                           pIcons_LOD->SyncLoadedFilesCount();
                           uAction = 0;
@@ -10065,7 +10068,7 @@
 
 
 //----- (004156F0) --------------------------------------------------------
-void __cdecl GUI_UpdateWindows() 
+void GUI_UpdateWindows() 
 {
   GUIWindow *pWindow; // esi@4
   unsigned int pWindowType; // eax@4
@@ -10113,7 +10116,7 @@
       }
       case WINDOW_Options:
       {
-        DrawGameOptions();
+        GameMenuUI_Options_Draw();
         continue;
       }
       case WINDOW_Book:
--- a/mm7_data.cpp	Tue May 21 12:52:38 2013 +0200
+++ b/mm7_data.cpp	Tue May 21 14:34:14 2013 +0200
@@ -495,7 +495,6 @@
 char aS100110DS[777]; // idb
 char aS100110D02dSS[777]; // idb
 int pCurrentScreen = SCREEN_VIDEO; // 004E28F8
-char byte_4E28FC; // weak
 unsigned int uGammaPos;
 int BtnTurnCoord[8] = 
 {
@@ -1492,8 +1491,7 @@
 int dword_506984; // weak
 int dword_506988; // weak
 int dword_50698C; // weak
-int dword_506E68; // weak
-char KeyButtonFlagChangesArray[28]; // weak
+int uGameMenuUI_CurentlySelectedKeyIdx; // 506E68
 unsigned int pPrevVirtualCidesMapping[27];
 int KeyboardPageNum; // weak
 int dword_506F0C[777]; // idb
@@ -1529,8 +1527,6 @@
 int dword_507B98_ctrl_pressed; // weak
 unsigned int uActiveCharacter;
 int dword_507BF0_is_there_popup_onscreen; // weak
-int dword_507C08; // weak
-int dword_507C0C; // weak
 int dword_507CBC; // weak
 int dword_507CC0; // weak
 __int64 GameUI_RightPanel_BookFlashTimer; // weak
--- a/mm7_data.h	Tue May 21 12:52:38 2013 +0200
+++ b/mm7_data.h	Tue May 21 14:34:14 2013 +0200
@@ -430,7 +430,6 @@
 extern char aS100110DS[]; // idb
 extern char aS100110D02dSS[]; // idb
 extern int pCurrentScreen; // 004E28F8
-extern char byte_4E28FC; // weak
 extern unsigned int uGammaPos;
 extern int BtnTurnCoord[8];
 extern __int16 RightClickPortraitXmin[4];
@@ -934,8 +933,8 @@
 extern int dword_506984; // weak
 extern int dword_506988; // weak
 extern int dword_50698C; // weak
-extern int dword_506E68; // weak
-extern char KeyButtonFlagChangesArray[28]; // weak
+extern int uGameMenuUI_CurentlySelectedKeyIdx; // 506E68
+extern bool GameMenuUI_InvaligKeyBindingsFlags[28]; // 506E6C
 extern unsigned int pPrevVirtualCidesMapping[27];
 extern int KeyboardPageNum; // weak
 extern int dword_506F0C[]; // idb
@@ -971,8 +970,6 @@
 extern int dword_507B98_ctrl_pressed; // weak
 extern unsigned int uActiveCharacter;
 extern int dword_507BF0_is_there_popup_onscreen; // weak
-extern int dword_507C08; // weak
-extern int dword_507C0C; // weak
 extern int dword_507CBC; // weak
 extern int dword_507CC0; // weak
 extern __int64 GameUI_RightPanel_BookFlashTimer; // weak
@@ -1549,10 +1546,6 @@
 void uGameUIFontShadow_initialize();
 void sub_41420D_press_esc();
 void sub_41426F();
-void GameMenuUI_DrawKeyBindings();
-unsigned int __thiscall sub_414D24(int _this);
-void GameMenuUI_DrawVideoOptions();
-void DrawGameOptions();
 void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight); // idb
 void DrawCopyrightWindow();
 void LoadFonts_and_DrawCopyrightWindow();