changeset 368:df09db095ef1

Слияние
author Ritor1
date Fri, 22 Feb 2013 09:12:01 +0600
parents 7f5538ed7875 (current diff) 85edec9da96b (diff)
children 6e984a4a896f
files
diffstat 17 files changed, 578 insertions(+), 592 deletions(-) [+]
line wrap: on
line diff
--- a/Allocator.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/Allocator.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -24,7 +24,7 @@
   //Allocator *v4; // esi@1
   unsigned int v5; // eax@7
   void *result; // eax@8
-  unsigned int *pNumBuffersUsed; // ebx@12
+ // unsigned int *pNumBuffersUsed; // ebx@12
   unsigned int v8; // edi@15
   char v9; // zf@15
   int v10; // eax@16
@@ -32,6 +32,59 @@
   void *v12; // eax@22
   unsigned int Size; // [sp+14h] [bp+Ch]@16
 
+  int aligned_size; 
+
+
+  if ( pPrevPtrValue && !aborting_app )
+	  AbortWithError();
+  if ( !bBigBufferAllocated && !aborting_app )
+	  AbortWithError();
+
+  if (!uSize)
+	  return 0;
+
+  if (((uSize & 0x80000000u) != 0) && !aborting_app)
+	  AbortWithError();
+
+  if (uNumBuffersUsed == 6000 && !aborting_app)
+	  AbortWithError();
+
+  ++uNumBuffersUsed;
+
+  if (!bUseBigBuffer)
+	  {
+	  pMemoryBuffers[uNumBuffersUsed] = malloc(uSize);
+	  if (pMemoryBuffers[uNumBuffersUsed])
+		  uMemoryBuffersSizes[uNumBuffersUsed] = uSize;
+	  else
+		  {
+		  if ( !aborting_app )
+			  AbortWithError();
+		  }
+	  }
+  else
+	  {
+
+	  aligned_size =(uSize&0xFFFFFFFC) + 4;
+
+	  if ((uNextFreeOffsetInBigBuffer +aligned_size) > uBigBufferSizeAligned)
+		  {
+		  printf("Id: %s  Size: %i", pName, aligned_size);
+		  CreateFileDump( "Memory");
+		  if ( !aborting_app )
+			  AbortWithError();
+		  }
+
+	  pMemoryBuffers[uNumBuffersUsed] = (char *)(pBigBufferAligned) + uNextFreeOffsetInBigBuffer;
+	  uMemoryBuffersSizes[uNumBuffersUsed] =aligned_size;
+
+	  if (pName)
+		  strncpy(pMemoryBuffersNames[uNumBuffersUsed], pName, 11);
+	  uNextFreeOffsetInBigBuffer += aligned_size;
+	  }
+  return pMemoryBuffers[uNumBuffersUsed];
+
+  /*
   //v4 = this;
   if ( pPrevPtrValue && !aborting_app )
     AbortWithError();
@@ -94,7 +147,7 @@
   {
     result = 0;
   }
-  return result;
+  return result;*/
 }
 // 720018: using guessed type int aborting_app;
 
@@ -113,7 +166,8 @@
   if (!pBigMemoryBuffer)
     return false;
 
-  pBigBufferAligned = (char *)pBigMemoryBuffer + -((unsigned __int16)pBigMemoryBuffer & 0xFFF) + 4096;
+  pBigBufferAligned = (void *)((unsigned int)(pBigMemoryBuffer) & 0xFFFF0000 + 4096);
+  //(char *)pBigMemoryBuffer + -((unsigned __int16)pBigMemoryBuffer & 0xFFF) + 4096;
   uBigBufferSizeAligned = (uNumKBytes * 1024) - 4096;
 
   uNumBuffersUsed = 0;
@@ -135,6 +189,49 @@
   signed int j; // edx@16
   char v8; // zf@20
 
+ 
+  
+  unsigned int  uBuffindx; 
+  unsigned int indx;
+
+  if (ptr)
+	  {
+	  if ((!bBigBufferAllocated)&& (!aborting_app ))
+		  AbortWithError();
+	  for (indx = 0; indx <=uNumBuffersUsed; ++indx)
+		  if (pMemoryBuffers[indx] == ptr)	
+			  break;
+	//  if ((indx>uNumBuffersUsed)&& !aborting_app )
+//		  AbortWithError(); to detect memory problems - uncomment
+	  if (!bUseBigBuffer)
+		  free(pMemoryBuffers[indx]);
+	  pMemoryBuffers[indx] = NULL;
+	  uMemoryBuffersSizes[indx] = 0;
+	  pMemoryBuffersNames[indx][0] = 0;
+	  if (indx == (uNumBuffersUsed-1))
+		  {
+		  if (indx>0)
+			  {
+			  uBuffindx = 0;
+			  for (j = 0; j < uNumBuffersUsed-1; ++j)
+				  {
+				  if (pMemoryBuffers[j])
+					  uBuffindx = j;
+				  }
+			  uNumBuffersUsed =  uBuffindx + 1;
+			  if (bUseBigBuffer)
+				  uNextFreeOffsetInBigBuffer = 
+				  ((long)((char*)pMemoryBuffers[uBuffindx] -(char*)pBigBufferAligned)+ uMemoryBuffersSizes[uBuffindx]);
+			  }
+		  else
+			  {
+			  uNumBuffersUsed = 0;
+			  uNextFreeOffsetInBigBuffer = 0;
+			  }
+		  }
+	  }
+
+/*
   v2 = this;
   if ( ptr )
   {
@@ -177,7 +274,7 @@
         v2->uNumBuffersUsed = 0;
       }
     }
-  }
+  }*/
 }
 // 720018: using guessed type int aborting_app;
 
--- a/GUIWindow.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/GUIWindow.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -985,10 +985,10 @@
   {
     if (!chapter->bIsSpellAvailable[i])
       continue;
-
-      v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]);
-      CreateButton(pViewport->uViewportX +  pIconPos[v4].Xpos,
-                   pViewport->uViewportY + pIconPos[v4].Ypos,  //dword_4E20D0
+		v4= pPlayer->lastOpenedSpellbookPage;
+      //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]);
+      CreateButton(pViewport->uViewportX +  pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos,
+                   pViewport->uViewportY +  pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos,  //dword_4E20D0
                    dword_506408[i + 1]->uTextureWidth,
                    dword_506408[i + 1]->uTextureHeight,
                    1, 79, 0x56u, i, 0, "", 0);
@@ -1171,7 +1171,7 @@
           sub_4B6478();
           break;
         case 1:
-          sub_4B910F();
+          _4B910F_shop_interaction();
           break;
         case 2:
           sub_4BA928();
@@ -1233,14 +1233,14 @@
 LABEL_58:
   if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic )
   {
-    pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0));
+    pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0));
     v16 = (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0);
     v14 = 451;
     v12 = 476;
   }
   else
   {
-    v16 = (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0);
+    v16 = (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0);
     v14 = 445;
     v12 = 471;
   }
--- a/GUIWindow.h	Fri Feb 22 09:11:48 2013 +0600
+++ b/GUIWindow.h	Fri Feb 22 09:12:01 2013 +0600
@@ -312,10 +312,10 @@
   UIMSG_19B = 0x19B,
   UIMSG_19C = 0x19C,
   UIMSG_OpenKeyMappingOptions = 0x19F,
-  UIMSG_1A0 = 0x1A0,
-  UIMSG_1A1 = 0x1A1,
+  UIMSG_SelectKeyPage1 = 0x1A0,
+  UIMSG_SelectKeyPage2 = 0x1A1,
   UIMSG_ResetKeyMapping = 0x1A2,
-  UIMSG_1A3 = 0x1A3,
+  UIMSG_ChangeKeyButton = 0x1A3,
   UIMSG_OpenVideoOptions = 0x1A5,
   UIMSG_ToggleBloodsplats = 0x1A6,
   UIMSG_ToggleColoredLights = 0x1A7,
--- a/Items.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/Items.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -493,82 +493,82 @@
 					{
 					if ( !_strcmpi(test_string, "weapon") )
 						{
-						pItems[item_counter].uEquipType = 0;
+						pItems[item_counter].uEquipType = EQUIP_ONE_OR_TWO_HANDS;
 						break;
 						}
 					if ( !_strcmpi(test_string, "weapon2") )
 						{
-						pItems[item_counter].uEquipType = 1;
+						pItems[item_counter].uEquipType = EQUIP_TWO_HANDED;
 						break;
 						}
 					if ( !_strcmpi(test_string, "weapon1or2") )
 						{
-						pItems[item_counter].uEquipType = 0;
+						pItems[item_counter].uEquipType = EQUIP_ONE_OR_TWO_HANDS;
 						break;
 						}
 					if ( !(_strcmpi(test_string, "missile")&&_strcmpi(test_string, "bow")))
 						{
-						pItems[item_counter].uEquipType = 2;
+						pItems[item_counter].uEquipType = EQUIP_BOW;
 						break;
 						}
 					if ( !_strcmpi(test_string, "armor") )
 						{
-						pItems[item_counter].uEquipType = 3;
+						pItems[item_counter].uEquipType = EQUIP_ARMOUR;
 						break;
 						}
 					if ( !_strcmpi(test_string, "shield") )
 						{
-						pItems[item_counter].uEquipType = 4;
+						pItems[item_counter].uEquipType = EQUIP_SHIELD;
 						break;
 						}
 					if ( !_strcmpi(test_string, "helm") )
 						{
-						pItems[item_counter].uEquipType = 5;
+						pItems[item_counter].uEquipType = EQUIP_HELMET;
 						break;
 						}
 					if ( !_strcmpi(test_string, "belt") )
 						{
-						pItems[item_counter].uEquipType = 6;
+						pItems[item_counter].uEquipType = EQUIP_BELT;
 						break;
 						}
 					if ( !_strcmpi(test_string, "cloak") )
 						{
-						pItems[item_counter].uEquipType = 7;
+						pItems[item_counter].uEquipType = EQUIP_CLOAK;
 						break;
 						}
 					if ( !_strcmpi(test_string, "gauntlets") )
 						{
-						pItems[item_counter].uEquipType = 8;
+						pItems[item_counter].uEquipType = EQUIP_GAUNTLETS;
 						break;
 						}
 					if ( !_strcmpi(test_string, "boots") )
 						{
-						pItems[item_counter].uEquipType = 9;
+						pItems[item_counter].uEquipType = EQUIP_BOOTS;
 						break;
 						}
 					if ( !_strcmpi(test_string, "ring") )
 						{
-						pItems[item_counter].uEquipType = 10;
+						pItems[item_counter].uEquipType = EQUIP_RING;
 						break;
 						}
 					if ( !_strcmpi(test_string, "amulet") )
 						{
-						pItems[item_counter].uEquipType = 11;
+						pItems[item_counter].uEquipType = EQUIP_AMULET;
 						break;
 						}
 					if ( !_strcmpi(test_string, "weaponw") )
 						{
-						pItems[item_counter].uEquipType = 12;
+						pItems[item_counter].uEquipType = EQUIP_WAND;
 						break;
 						}
 					if ( !(_strcmpi(test_string, "herb")&&_strcmpi(test_string, "reagent")))
 						{
-						pItems[item_counter].uEquipType = 13;
+						pItems[item_counter].uEquipType = EQUIP_REAGENT;
 						break;
 						}
 					if ( !_strcmpi(test_string, "bottle") )
 						{
-						pItems[item_counter].uEquipType = 14;
+						pItems[item_counter].uEquipType = EQUIP_POTION;
 						break;
 						}
 					if ( !_strcmpi(test_string, "sscroll") )
@@ -578,7 +578,7 @@
 						}
 					if ( !_strcmpi(test_string, "book") )
 						{
-						pItems[item_counter].uEquipType = 16;
+						pItems[item_counter].uEquipType = EQUIP_BOOK;
 						break;
 						}
 					if ( !_strcmpi(test_string, "mscroll") )
@@ -588,15 +588,15 @@
 						}
 					if ( !_strcmpi(test_string, "gold") )
 						{
-						pItems[item_counter].uEquipType = 18;
+						pItems[item_counter].uEquipType = EQUIP_GOLD;
 						break;
 						}
 					if ( !_strcmpi(test_string, "gem") )
 						{
-						pItems[item_counter].uEquipType = 19;
+						pItems[item_counter].uEquipType = EQUIP_GEM;
 						break;
 						}
-					pItems[item_counter].uEquipType = 20;
+					pItems[item_counter].uEquipType = EQUIP_NONE;
 					break;
 					}
 				case 5: //Skill Group
@@ -1417,13 +1417,10 @@
 //----- (00456499) --------------------------------------------------------
 const char *ItemGen::GetDisplayName()
 {
-  const char *result; // eax@2
-
-  if ( this->uAttributes & ITEM_IDENTIFIED )
-    result = GetIdentifiedName();
+  if (Identified())
+    return GetIdentifiedName();
   else
-    result = pItemsTable->pItems[uItemID].pUnidentifiedName;
-  return result;
+    return pItemsTable->pItems[uItemID].pUnidentifiedName;
 }
 
 //----- (004564B3) --------------------------------------------------------
--- a/Items.h	Fri Feb 22 09:11:48 2013 +0600
+++ b/Items.h	Fri Feb 22 09:12:01 2013 +0600
@@ -63,26 +63,27 @@
 /*  331 */
 enum ITEM_EQUIP_TYPE
 {
-  EQUIP_ONE_OR_TWO_HANDS = 0x0,
-  EQUIP_TWO_HANDED = 0x1,
-  EQUIP_BOW = 0x2,
-  EQUIP_ARMOUR = 0x3,
-  EQUIP_SHIELD = 0x4,
-  EQUIP_HELMET = 0x5,
-  EQUIP_BELT = 0x6,
-  EQUIP_CLOAK = 0x7,
+  EQUIP_ONE_OR_TWO_HANDS = 0,
+  EQUIP_TWO_HANDED       = 1,
+  EQUIP_BOW              = 2,
+  EQUIP_ARMOUR           = 3,
+  EQUIP_SHIELD           = 4,
+  EQUIP_HELMET           = 5,
+  EQUIP_BELT             = 6,
+  EQUIP_CLOAK            = 7,
   EQUIP_GAUNTLETS = 0x8,
   EQUIP_BOOTS = 0x9,
-  EQUIP_RING = 0xA,
-  EQUIP_AMULET = 0xB,
+  EQUIP_RING = 10,
+  EQUIP_AMULET = 11,
   EQUIP_WAND = 12,
-  EQUIP_REAGENT = 0xD,
-  EQUIP_POTION = 0xE,
+  EQUIP_REAGENT = 13,
+  EQUIP_POTION = 14,
   EQUIP_F = 0xF,
-  EQUIP_BOOK = 0x10,
-  EQUIP_11 = 0x11,
+  EQUIP_BOOK = 16,
+  EQUIP_11 = 17,
   EQUIP_GOLD = 18,
-  EQUIP_GEM = 0x13,
+  EQUIP_GEM = 19,
+  EQUIP_NONE = 20
 };
 
 
@@ -140,8 +141,8 @@
 	unsigned int uValue;  //10 14
 	unsigned __int16 uSpriteID; //14 18
 	__int16 field_1A; //16 
-	unsigned __int16 uEquipX; //18  1c
-	unsigned __int16 uEquipY; //1a  1e
+	signed __int16 uEquipX; //18  1c
+	signed __int16 uEquipY; //1a  1e
 	unsigned __int8 uEquipType; //1c 20
 	unsigned __int8 uSkillType; //1d 21
 	unsigned __int8 uDamageDice; //1e 22
--- a/Spells.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/Spells.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -17,10 +17,11 @@
 
 
 stru324_spell stru_4E3ACC[102];
-
+ //9 spellbook pages  11 spells per page 9*11 =99 +1 zero struct at 0. It counted from 1!
 SpellData pSpellDatas[100]={
-					 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},	
-					 {1, 1, 1, 1, 60, 60, 60, 40, 0, 0},
+					 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+
+					 {1, 1, 1, 1, 60, 60, 60, 40, 0, 0},//0
 	                 {2, 2, 2, 2, 110, 110, 100, 90, 768, 0},
 	                 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
 	                 {4, 4, 4, 4, 120, 120, 120, 120, 0, 0},
@@ -31,7 +32,8 @@
 	                 {20, 20, 20, 20, 100, 100, 100, 90, 264, 0},
 	                 {25, 25, 25, 25, 100, 100, 100, 90, 268, 0},
 	                 {30, 30, 30, 30, 90, 90, 90, 90, 3855, 0},
-	                 {1, 1, 1, 0, 60, 60, 60, 60, 0, 0},
+
+	                 {1, 1, 1, 0, 60, 60, 60, 60, 0, 0},  //1
 	                 {2, 2, 2, 2, 120, 120, 120, 100, 0, 0},
 	                 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
 	                 {4, 4, 4, 4, 110, 100, 90, 80, 258, 0},
@@ -42,7 +44,8 @@
 	                 {20, 20, 20, 20, 100, 100, 100, 90, 2570, 0},
 	                 {25, 25, 25, 25, 250, 250, 250, 250, 0, 0},
 	                 {30, 30, 30, 30, 90, 90, 90, 90, 276, 0},
-	                 {1, 1, 1, 1, 60, 60, 60, 20, 0, 0},
+
+	                 {1, 1, 1, 1, 60, 60, 60, 20, 0, 0},  //2
 	                 {2, 2, 2, 2, 110, 100, 90, 70, 514, 0},
 	                 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
 	                 {4, 4, 4, 4, 110, 100, 90, 80, 1024, 0},
@@ -53,7 +56,8 @@
 	                 {20, 20, 20, 20, 200, 200, 200, 200, 0, 0},
 	                 {25, 25, 25, 25, 80, 80, 80, 80, 780, 0},
 	                 {30, 30, 30, 30, 250, 250, 250, 250, 0, 0},
-	                 {1, 1, 1, 1, 80, 80, 80, 80, 0, 0},
+
+	                 {1, 1, 1, 1, 80, 80, 80, 80, 0, 0},  //3
 	                 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0},
 	                 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
 	                 {4, 4, 4, 4, 110, 100, 90, 80, 773, 0},
@@ -64,7 +68,8 @@
 	                 {20, 20, 20, 20, 150, 150, 150, 150, 0, 0},
 	                 {25, 25, 25, 25, 100, 100, 100, 90, 276, 0},
 	                 {30, 30, 30, 30, 90, 90, 90, 90, 25, 0},
-	                 {1, 1, 1, 1, 100, 100, 100, 100, 0, 0},
+
+	                 {1, 1, 1, 1, 100, 100, 100, 100, 0, 0},  //4
 	                 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0},
 	                 {3, 3, 3, 3, 90, 90, 90, 90, 0, 0},
 	                 {4, 4, 4, 4, 120, 120, 120, 120, 0, 0},
@@ -75,7 +80,8 @@
 	                 {20, 20, 20, 20, 240, 240, 240, 240, 0, 0},
 	                 {25, 25, 25, 25, 150, 150, 150, 150, 0, 0},
 	                 {30, 30, 30, 30, 1000, 1000, 1000, 1000, 0, 0},
-	                 {1, 1, 1, 1, 120, 120, 120, 120, 0, 0},
+
+	                 {1, 1, 1, 1, 120, 120, 120, 120, 0, 0},  //5
 	                 {2, 2, 2, 2, 110, 110, 110, 110, 771, 0},
 	                 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
 	                 {4, 4, 4, 4, 110, 100, 90, 80, 0, 0},
@@ -86,7 +92,8 @@
 	                 {20, 20, 20, 20, 120, 120, 120, 120, 0, 0},
 	                 {25, 25, 25, 25, 110, 110, 110, 100, 268, 0},
 	                 {30, 30, 30, 30, 120, 120, 120, 120, 0, 0},
-	                 {1, 1, 1, 1, 120, 120, 120, 120, 0, 0},
+
+	                 {1, 1, 1, 1, 120, 120, 120, 120, 0, 0},  //6
 	                 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0},
 	                 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
 	                 {4, 4, 4, 4, 110, 100, 90, 80, 520, 0},
@@ -97,7 +104,8 @@
 	                 {20, 20, 20, 20, 120, 120, 120, 120, 0, 0},
 	                 {25, 25, 25, 25, 110, 110, 110, 100, 1310, 0},
 	                 {30, 30, 30, 30, 100, 100, 100, 100, 0, 0},
-	                 {5, 5, 5, 5, 110, 100, 90, 80, 1024, 0},
+
+	                 {5, 5, 5, 5, 110, 100, 90, 80, 1024, 0},   //7
 	                 {10, 10, 10, 10, 120, 110, 100, 90, 4112, 0},
 	                 {15, 15, 15, 15, 120, 110, 100, 90, 0, 0},
 	                 {20, 20, 20, 20, 160, 140, 120, 100, 0, 0},
@@ -108,7 +116,8 @@
 	                 {45, 45, 45, 45, 250, 250, 250, 250, 0, 0},
 	                 {50, 50, 50, 50, 150, 150, 150, 135, 5140, 0},
 	                 {55, 55, 55, 55, 300, 300, 300, 300, 0, 0},
-	                 {10, 10, 10, 10, 140, 140, 140, 140, 0, 0},
+
+	                 {10, 10, 10, 10, 140, 140, 140, 140, 0, 0},  //8
 	                 {15, 15, 15, 15, 120, 110, 100, 90, 2585, 0},
 	                 {20, 20, 20, 20, 120, 100, 90, 120, 0, 0},
 	                 {25, 25, 25, 25, 120, 120, 120, 120, 0, 0},
@@ -122,7 +131,7 @@
 	};
 
 	unsigned char pSpellbookSpellIndices[9][12] = // 4E2430
-	{
+	{  //0   1   2   3  4    5   6  7    8  9   10  11
 		{0,  3,  1,  8, 11,  7,  4, 10,  6,  2,  5,  9},
 		{0, 11,  2,  9,  6,  8,  5, 10,  3,  7,  1,  4},
 		{0,  4,  8,  9,  1, 10,  3, 11,  7,  6,  2,  5}, 
@@ -134,123 +143,43 @@
 		{0,  9,  3,  7,  1,  5,  2, 10, 11,  8,  6,  4}
 	};
 
-	struct SpellBookIconPos pIconPos[108]={
-		{0, 0},          
-		{17, 13},
-		{115, 2},
-		{217, 15},
-		{299, 6},
-		{28, 125},
-		{130, 133},
-		{294, 114},
-		{11, 232},
-		{134, 233},
-		{237, 171},
-		{296, 231},
+	struct SpellBookIconPos pIconPos[9][12]={
+
+		{{  0,   0}, { 17,  13}, {115,   2}, {217,  15},
+		 {299,   6}, { 28, 125}, {130, 133}, {294, 114},
+		 { 11, 232}, {134, 233}, {237, 171}, {296, 231}},
 
-		{0, 0},
-		{19, 9},
-		{117, 3},
-		{206, 13},
-		{285, 7},
-		{16, 123},
-		{113, 101},
-		{201, 118},
-		{317, 110},
-		{11, 230},
-		{149, 236},
-		{296, 234},
+		{{  0,   0},  {19,   9}, {117,   3}, {206,  13},	
+		 {285,   7},  {16, 123}, {113, 101}, {201, 118},
+		 {317, 110},  {11, 230}, {149, 236}, {296, 234}},
 
-		{0, 0},
-		{17, 9},
-		{140, 0},
-		{210, 34},
-		{293, 5},
-		{15, 98},
-		{78, 121},
-		{175, 136},
-		{301, 115},
-		{15, 226},
-		{154, 225},
-		{272, 220},
+		{{  0,   0},  {17,   9}, {140,   0}, {210,  34},
+		 {293,   5},  {15,  98}, { 78, 121}, {175, 136},
+		 {301, 115},  {15, 226}, {154, 225}, {272, 220}},
 
-		{0, 0},
-		{7, 9},
-		{156, 2},
-		{277, 9},
-		{11, 117},
-		{111, 82},
-		{180, 102},
-		{303, 108},
-		{10, 229},
-		{120, 221},
-		{201, 217},
-		{296, 225},
+		{{ 0,    0}, {  7,   9}, {156,   2}, {277,   9},
+		 { 11, 117}, {111,  82}, {180, 102}, {303, 108},
+		 { 10, 229}, {120, 221}, {201, 217}, {296, 225}},
 
-		{0, 0},
-		{18, 8},
-		{89, 15},
-		{192, 14},
-		{292, 7},
-		{22, 129},
-		{125, 146},
-		{217, 136},
-		{305, 115},
-		{22, 226},
-		{174, 237},
-		{290, 231},
+		{{  0,   0},  {18,   8}, { 89,  15}, {192,  14},
+		 {292,   7},  {22, 129}, {125, 146}, {217, 136},
+		 {305, 115},  {22, 226}, {174, 237}, {290, 231}},
 
-		{0, 0},
-		{18, 12},
-		{148, 9},
-		{292, 7},
-		{17, 122},
-		{121, 99},
-		{220, 87},
-		{293, 112},
-		{13, 236},
-		{128, 213},
-		{220, 223},
-		{315, 223},
+		{{ 0,    0}, { 18,  12}, {148,   9}, {292,   7},
+		 { 17, 122}, {121,  99}, {220,  87}, {293, 112},
+		 { 13, 236}, {128, 213}, {220, 223}, {315, 223}},
 
-		{0, 0},
-		{23, 14},
-		{127, 8},
-		{204, 0},
-		{306, 8},
-		{14, 115},
-		{122, 132},
-		{200, 116},
-		{293, 122},
-		{20, 228},
-		{154, 228},
-		{294, 239},
+		{{  0,   0},  {23,  14}, {127,   8}, {204, 0},
+		 {306,   8},  {14, 115}, {122, 132}, {200, 116},
+		 {293, 122},  {20, 228}, {154, 228}, {294, 239}},
 
-		{0, 0},
-		{19, 14},
-		{124, 10},
-		{283, 12},
-		{8, 105},
-		{113, 89},
-		{190, 82},
-		{298, 108},
-		{18, 181},
-		{101, 204},
-		{204, 203},
-		{285, 218},
+		{{  0,   0}, { 19,  14}, {124,  10}, {283,  12},
+		 {  8, 105}, {113,  89}, {190,  82}, {298, 108},
+		 { 18, 181}, {101, 204}, {204, 203}, {285, 218}},
 
-		{0, 0},
-		{18, 17},
-		{110, 16},
-		{201, 15},
-		{307, 15},
-		{18, 148},
-		{125, 166},
-		{201, 123},
-		{275, 120},
-		{28, 235},
-		{217, 222},
-		{324, 216} };
+		{{  0,   0}, {18,  17}, {110,  16}, {201,  15},
+		 {307,  15}, {18, 148}, {125, 166}, {201, 123},
+		 {275, 120}, {28, 235}, {217, 222}, {324, 216}}};
 
 
 //----- (0042EB31) --------------------------------------------------------
--- a/Spells.h	Fri Feb 22 09:11:48 2013 +0600
+++ b/Spells.h	Fri Feb 22 09:12:01 2013 +0600
@@ -126,10 +126,17 @@
 #pragma pack(push, 1)
 struct SpellData
 {
+union
+	{
+  unsigned __int16 mana_per_skill[4];
+  struct
+	  {
   unsigned __int16 uNormalLevelMana;
   unsigned __int16 uExpertLevelMana;
   unsigned __int16 uMasterLevelMana;
   unsigned __int16 uMagisterLevelMana;
+	  };
+	};
   unsigned __int16 field_8;
   __int16 field_A;
   __int16 field_C;
@@ -154,7 +161,7 @@
 
 extern struct SpellStats *pSpellStats;
 
-extern struct SpellBookIconPos pIconPos[108];
+extern struct SpellBookIconPos pIconPos[9][12];
 
 extern stru324_spell stru_4E3ACC[];
 extern SpellData pSpellDatas[100];
\ No newline at end of file
--- a/Texture.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/Texture.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -116,13 +116,13 @@
 Texture *pTexture_pressrigh;
 Texture *pTexture_buttminu;
 Texture *pTexture_buttplus;
-unsigned int uTextureID_50792C; // weak
-unsigned int uTextureID_507930; // weak
-unsigned int uTextureID_507934; // weak
-unsigned int uTextureID_507938; // weak
-unsigned int uTextureID_50793C; // weak
-unsigned int uTextureID_507940; // weak
-unsigned int uTextureID_507944; // weak
+unsigned int uTextureID_Quit1; // weak
+unsigned int uTextureID_Resume1; // weak
+unsigned int uTextureID_Controls1; // weak
+unsigned int uTextureID_Save1; // weak
+unsigned int uTextureID_Load1; // weak
+unsigned int uTextureID_New1; // weak
+unsigned int uTextureID_Options; // weak
 
 
 unsigned int uTextureID_ib_td5_A;
@@ -169,11 +169,11 @@
 Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
 
 
-unsigned int uTextureID_507BF4; // weak
-unsigned int uTextureID_507BF8; // weak
-unsigned int uTextureID_507BFC; // weak
-unsigned int uTextureID_507C00; // weak
-unsigned int uTextureID_507C04; // weak
+unsigned int uTextureID_Optkb; // weak
+unsigned int uTextureID_Optkb_h; // weak
+unsigned int uTextureID_KeyResume1; // weak
+unsigned int uTextureID_Optkb_1; // weak
+unsigned int uTextureID_Optkb_2; // weak
 
 
 unsigned int uTextureID_507C10; // weak
@@ -186,17 +186,15 @@
 unsigned int uTextureID_507C50; // weak
 unsigned int uTextureID_507C54; // weak
 unsigned int uTextureID_507C58; // weak
-unsigned int uTextureID_507C60; // weak
-unsigned int uTextureID_507C64[777]; // weak
-unsigned int uTextureID_507C68; // weak
-unsigned int uTextureID_507C6C; // weak
-unsigned int uTextureID_507C70; // weak
-unsigned int uTextureID_507C74; // weak
-unsigned int uTextureID_507C84; // weak
+unsigned int uTextureID_ControlBG; // weak
+unsigned int uTextureID_Con_Smoo[3]; // weak
+unsigned int uTextureID_Con_ArrL; // weak
+unsigned int uTextureID_Con_ArrR; // weak
+unsigned int uTextureID_Option04; // weak
 unsigned int pTextureIDs_SoundLevels[10];
-unsigned int uTextureID_507CB0; // weak
-unsigned int uTextureID_507CB4; // weak
-unsigned int uTextureID_507CB8; // weak
+unsigned int uTextureID_Option03; // weak
+unsigned int uTextureID_Option01;
+unsigned int uTextureID_Option02; // weak
 
 
 unsigned int uTextureID_5118C8; // weak
--- a/Texture.h	Fri Feb 22 09:11:48 2013 +0600
+++ b/Texture.h	Fri Feb 22 09:12:01 2013 +0600
@@ -218,13 +218,13 @@
 extern Texture *pTexture_pressrigh;
 extern Texture *pTexture_buttminu;
 extern Texture *pTexture_buttplus;
-extern unsigned int uTextureID_50792C; // weak
-extern unsigned int uTextureID_507930; // weak
-extern unsigned int uTextureID_507934; // weak
-extern unsigned int uTextureID_507938; // weak
-extern unsigned int uTextureID_50793C; // weak
-extern unsigned int uTextureID_507940; // weak
-extern unsigned int uTextureID_507944; // weak
+extern unsigned int uTextureID_Quit1;
+extern unsigned int uTextureID_Resume1;
+extern unsigned int uTextureID_Controls1;
+extern unsigned int uTextureID_Save1;
+extern unsigned int uTextureID_Load1;
+extern unsigned int uTextureID_New1;
+extern unsigned int uTextureID_Options;
 
 
 extern unsigned int uTextureID_ib_td5_A;
@@ -271,11 +271,11 @@
 extern Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
 
 
-extern unsigned int uTextureID_507BF4; // weak
-extern unsigned int uTextureID_507BF8; // weak
-extern unsigned int uTextureID_507BFC; // weak
-extern unsigned int uTextureID_507C00; // weak
-extern unsigned int uTextureID_507C04; // weak
+extern unsigned int uTextureID_Optkb; // weak
+extern unsigned int uTextureID_Optkb_h; // weak
+extern unsigned int uTextureID_KeyResume1; // weak
+extern unsigned int uTextureID_Optkb_1; // weak
+extern unsigned int uTextureID_Optkb_2; // weak
 
 
 extern unsigned int uTextureID_507C10; // weak
@@ -288,17 +288,15 @@
 extern unsigned int uTextureID_507C50; // weak
 extern unsigned int uTextureID_507C54; // weak
 extern unsigned int uTextureID_507C58; // weak
-extern unsigned int uTextureID_507C60; // weak
-extern unsigned int uTextureID_507C64[]; // weak
-extern unsigned int uTextureID_507C68; // weak
-extern unsigned int uTextureID_507C6C; // weak
-extern unsigned int uTextureID_507C70; // weak
-extern unsigned int uTextureID_507C74; // weak
-extern unsigned int uTextureID_507C84; // weak
+extern unsigned int uTextureID_ControlBG; // weak
+extern unsigned int uTextureID_Con_Smoo[3]; // weak
+extern unsigned int uTextureID_Con_ArrL; // weak
+extern unsigned int uTextureID_Con_ArrR; // weak
+extern unsigned int uTextureID_Option04; // weak
 extern unsigned int pTextureIDs_SoundLevels[10];
-extern unsigned int uTextureID_507CB0; // weak
-extern unsigned int uTextureID_507CB4; // weak
-extern unsigned int uTextureID_507CB8; // weak
+extern unsigned int uTextureID_Option03; // weak
+extern unsigned int uTextureID_Option01;
+extern unsigned int uTextureID_Option02; // weak
 
 
 extern unsigned int uTextureID_5118C8; // weak
--- a/mm7_1.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7_1.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -2878,12 +2878,7 @@
   v106.uFlags = 0;
   pRenderer->Clip_v2(0, 0, 0x27Fu, 0x1DFu);
   pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5);
-  pRenderer->Line2D(
-    v106.uViewportX + 129,
-    v106.uViewportY - 1,
-    v106.uViewportX + 129,
-    v106.uViewportW + 1,
-    a5);
+  pRenderer->Line2D( v106.uViewportX + 129,  v106.uViewportY - 1,  v106.uViewportX + 129,    v106.uViewportW + 1,    a5);
   pRenderer->Line2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5);
   pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5);
   if ( pRenderer->pRenderD3D )
--- a/mm7_2.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7_2.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -1005,7 +1005,7 @@
 
 
 //----- (004B910F) --------------------------------------------------------
-char *__cdecl sub_4B910F()
+char *__cdecl _4B910F_shop_interaction()
 {
   Player *v0; // ebx@1
   char *result; // eax@6
@@ -11705,6 +11705,7 @@
   {
     case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
   };
+  
 
   v4 = lParam;
   if ( Msg > WM_SYSCOMMAND )
@@ -12200,6 +12201,7 @@
     {
       if ( !(dword_6BE364_game_settings_1 & 0x100) )
       {
+	  while(initing); //ADDED spinlock to allow int players ets! Gloval
         dword_4E98BC_bApplicationActive = 0;
         if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie )
           pVideoPlayer->bStopBeforeSchedule = 1;
@@ -12852,6 +12854,7 @@
 //----- (004651F4) --------------------------------------------------------
 bool MM7_Initialize()
 {
+initing=true; //ADDED Gloval
   wchar_t pCurrentDir[1024];
   _wgetcwd(pCurrentDir, 1024);
 
@@ -13235,6 +13238,7 @@
   {
     uTurnSpeed = (unsigned int)uCPUSpeed < 0xC7 ? 128 : 64; // adjust turn speed to estimated fps
   }
+  initing=false; //ADDED Gloval
   return true;
 }
 
--- a/mm7_3.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7_3.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -14211,168 +14211,168 @@
 
 //----- (00443FDC) --------------------------------------------------------
 void OnMapLoad()
-{
-  stru176 *v3; // esi@7
-  __int16 v4; // cx@9
-  __int16 v5; // di@9
-  int v6; // eax@9
-  signed __int64 v8; // qax@26
-  unsigned int v9; // ecx@26
-  signed __int64 v10; // qax@26
-  signed __int64 v11; // qax@26
-  int v12; // ST50_4@26
-  signed __int64 v13; // qax@26
-  signed __int64 v14; // qax@26
-  int v15; // ST58_4@26
-  signed __int64 v16; // qax@26
-  int hours; // ebx@26
-  unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
-  signed __int64 seconds; // [sp+14h] [bp-3Ch]@26
-  unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
-  int minutes; // [sp+2Ch] [bp-24h]@26
-  int month; // [sp+34h] [bp-1Ch]@26
-  int weeks; // [sp+38h] [bp-18h]@26
-  int v26; // [sp+3Ch] [bp-14h]@15
-  int days; // [sp+3Ch] [bp-14h]@26
-  int v28; // [sp+40h] [bp-10h]@26
-  __int16 v29; // [sp+46h] [bp-Ah]@9
-  __int16 v30; // [sp+48h] [bp-8h]@9
-  __int16 v31; // [sp+4Ah] [bp-6h]@9
-  __int16 v32; // [sp+4Ch] [bp-4h]@9
-  __int16 v33; // [sp+4Eh] [bp-2h]@9
-
-  for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
-  {
-    auto pEvent = pLevelEVT_Index[i];
-
-    auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT);
-
-    if (_evt->_e_type == EVENT_PlaySound)
-    {
-      pSoundList->LoadSound(
-          _evt->v5 +
-          ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8),
-          0);
-    }
-    else if (_evt->_e_type == EVENT_OnMapReload)
-    {
-      start_event_seq_number = pEvent.event_sequence_num;
-      EventProcessor(pEvent.uEventID, 0, 0);
-      start_event_seq_number = 0;
-    }
-    else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer)
-    {
-      v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
-      v20 = pOutdoor->uLastVisitDay;
-      if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
-        v20 = pIndoor->stru1.uLastVisitDay;
-
-      v3->timer_evt_type = _evt->_e_type;
-      v3->timer_evt_ID = pEvent.uEventID;
-      v3->timer_evt_seq_num = pEvent.event_sequence_num;
-
-	  v3->field_10 = _evt->v5;
-      v3->field_12 = _evt->v6;
-      v3->field_14 = _evt->v7;
-      v3->field_16 = _evt->v8;
-	  v3->field_18 = _evt->v9;
-	  v3->field_1A = _evt->v10;
-      
-
-      v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
-     
-      v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11;
-      v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11;
-      if (v3->timer_evt_type  == EVENT_OnLongTimer && !(short)v6 )
-      {
-        if ( v20 )
-          v18 = pParty->uTimePlayed - v20;
-        else
-          v18 = 0i64;
-        v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
-
-        if ( v26 / 7 / 4 / 12 )
-        {
-          if ( v5 )
-          {
-            ++dword_5B65C8_timers_count;
-            v3->field_0_time = 0;
-            continue;
-          }
-        }
-        if (v26 / 7 / 4 != 0 && v33 != 0 ||
-            v26 / 7 != 0 && v32 != 0 ||
-            v26 != 0 || !v20)
-        {
-          ++dword_5B65C8_timers_count;
-          v3->field_0_time = 0;
-          continue;
-        }
-      }
-	  else
-		  {
-      v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
-      v9 = v8;
-      v10 = (signed int)v8 / 60;
-      minutes = v10 % 60;
-      v11 = (signed int)(v10 / 60);
-      v12 = v11 % 24;
-      v13 = (signed int)(v11 / 24);
-      days = v13 % 7;
-      v14 = (signed int)(v13 / 7);
-      v15 = v14 % 4;
-      v16 = (signed int)(v14 / 4);
-      month = v16 / 12;
-
-      auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32;
-      auto _2 = ((__int64)v9 << 32) | _1;
-
-      seconds = _2 % 60;
-      //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32,
-      //                        v9)
-      //    % 60;
-
-      hours = v12;
-      weeks = v15;
-      v28 = v16 % 12;
-      if ( v5 )
-      {
-        ++month;
-      }
-      else
-      {
-        if ( v33 )
-        {
-          ++v28;
-        }
-        else
-        {
-          if ( v32 )
-          {
-            ++weeks;
-          }
-          else
-          {
-            ++days;
-            minutes = v30;
-            hours = v31;
-            seconds = v29;
-          }
-        }
-      }
-      v3->field_0_time = (signed __int64)((double)((seconds
-                                + 60 * minutes
-                                + 3600 * hours
-                                + 0x93A80 * weeks
-                                + 0x15180 * days
-                                + 0x24EA00 * (v28 + 12i64 * month)) << 7)
-                      * 0.033333335);
-
-      ++dword_5B65C8_timers_count;
-		  }
-    }
-  }
-}
+	{
+	stru176 *v3; // esi@7
+	__int16 v4; // cx@9
+	__int16 v5; // di@9
+	int v6; // eax@9
+	signed __int64 v8; // qax@26
+	unsigned int v9; // ecx@26
+	signed __int64 v10; // qax@26
+	signed __int64 v11; // qax@26
+	int v12; // ST50_4@26
+	signed __int64 v13; // qax@26
+	signed __int64 v14; // qax@26
+	int v15; // ST58_4@26
+	signed __int64 v16; // qax@26
+	int hours; // ebx@26
+	unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
+	signed __int64 seconds; // [sp+14h] [bp-3Ch]@26
+	unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
+	int minutes; // [sp+2Ch] [bp-24h]@26
+	int years; // [sp+34h] [bp-1Ch]@26
+	int weeks; // [sp+38h] [bp-18h]@26
+	int v26; // [sp+3Ch] [bp-14h]@15
+	int days; // [sp+3Ch] [bp-14h]@26
+	int months; // [sp+40h] [bp-10h]@26
+	__int16 v29; // [sp+46h] [bp-Ah]@9
+	__int16 v30; // [sp+48h] [bp-8h]@9
+	__int16 v31; // [sp+4Ah] [bp-6h]@9
+	__int16 v32; // [sp+4Ch] [bp-4h]@9
+	__int16 v33; // [sp+4Eh] [bp-2h]@9
+
+	for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
+		{
+		auto pEvent = pLevelEVT_Index[i];
+
+		auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT);
+
+		if (_evt->_e_type == EVENT_PlaySound)
+			{
+			pSoundList->LoadSound(
+				_evt->v5 +
+				((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8),
+				0);
+			}
+		else if (_evt->_e_type == EVENT_OnMapReload)
+			{
+			start_event_seq_number = pEvent.event_sequence_num;
+			EventProcessor(pEvent.uEventID, 0, 0);
+			start_event_seq_number = 0;
+			}
+		else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer)
+			{
+			v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
+			v20 = pOutdoor->uLastVisitDay;
+			if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+				v20 = pIndoor->stru1.uLastVisitDay;
+
+			v3->timer_evt_type = _evt->_e_type;
+			v3->timer_evt_ID = pEvent.uEventID;
+			v3->timer_evt_seq_num = pEvent.event_sequence_num;
+
+			v3->field_10 = _evt->v5;
+			v3->field_12 = _evt->v6;
+			v3->field_14 = _evt->v7;
+			v3->field_16 = _evt->v8;
+			v3->field_18 = _evt->v9;
+			v3->field_1A = _evt->v10;
+
+
+			v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+
+			v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+			v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+			if (v3->timer_evt_type  == EVENT_OnLongTimer && !(short)v6 )
+				{
+				if ( v20 )
+					v18 = pParty->uTimePlayed - v20;
+				else
+					v18 = 0i64;
+				v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
+
+				if ( v26 / 7 / 4 / 12 )
+					{
+					if ( v3->field_10 )
+						{
+						++dword_5B65C8_timers_count;
+						v3->field_0_time = 0;
+						continue;
+						}
+					}
+				if (v26 / 7 / 4 != 0 && v3->field_12 != 0 ||
+					v26 / 7 != 0 && v3->field_14 != 0 ||
+					v26 != 0 || !v20)
+					{
+					++dword_5B65C8_timers_count;
+					v3->field_0_time = 0;
+					continue;
+					}
+				}
+			else
+				{
+				v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
+				v9 = v8;
+				v10 = (signed int)v8 / 60;
+				minutes = v10 % 60;
+				v11 = (signed int)(v10 / 60);
+				v12 = v11 % 24;
+				v13 = (signed int)(v11 / 24);
+				days = v13 % 7;
+				v14 = (signed int)(v13 / 7);
+				v15 = v14 % 4;
+				v16 = (signed int)(v14 / 4);
+				years = v16 / 12;
+
+				auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32;
+				auto _2 = ((__int64)v9 << 32) | _1;
+
+				seconds = _2 % 60;
+				//v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32,
+				//                        v9)
+				//    % 60;
+
+				hours = v12;
+				weeks = v15;
+				months = v16 % 12;
+				if ( v3->field_10 )
+					{
+					++years;
+					}
+				else
+					{
+					if ( v3->field_12 )
+						{
+						++months;
+						}
+					else
+						{
+						if ( v3->field_14 )
+							{
+							++weeks;
+							}
+						else
+							{
+							++days;
+							minutes = v3->field_18;
+							hours = v3->field_16;
+							seconds = v3->field_1A;
+							}
+						}
+					}
+				v3->field_0_time = (signed __int64)((double)((seconds
+					+ 60 * minutes
+					+ 3600 * hours
+					+ 0x93A80 * weeks
+					+ 0x15180 * days
+					+ 0x24EA00 * (months + 12i64 * years)) << 7)
+					* 0.033333335);
+
+				++dword_5B65C8_timers_count;
+				}
+			}
+		}
+	}
 
 //----- (00444360) --------------------------------------------------------
 void __thiscall Level_LoadEvtAndStr(const char *pLevelName)
@@ -15116,7 +15116,7 @@
       strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession));
 	else if (v16 == 19)
 	{
-      __debugbreak(); // learn conditions of this event
+     // __debugbreak(); // learn conditions of this event Scavenger Hunt
       auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23];
       if (!topic)
       {
--- a/mm7_4.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7_4.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -14865,7 +14865,6 @@
   return result;
 }
 
-
 //----- (0044606A) --------------------------------------------------------
 void PrepareHouse(HOUSE_TYPE house)
 {
--- a/mm7_5.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7_5.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -592,12 +592,12 @@
           pGUIWindow_CurrentMenu->Release();
           viewparams->field_48 = v0;
           pCurrentScreen = SCREEN_OPTIONS;
-          uTextureID_507C60 = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C6C = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C68 = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C70 = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C74 = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C64[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
+          uTextureID_Con_Smoo[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
+          uTextureID_Con_Smoo[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
+          uTextureID_Con_ArrL = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
+          uTextureID_Con_ArrR = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
+          uTextureID_Con_Smoo[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
           pTextureIDs_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
           pTextureIDs_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
           pTextureIDs_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
@@ -608,71 +608,59 @@
           pTextureIDs_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
           pTextureIDs_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
           pTextureIDs_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C84 = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
-          uTextureID_507CB0 = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
-          uTextureID_507CB8 = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
-          uTextureID_507CB4 = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
+          uTextureID_Option04 = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
+          uTextureID_Option03 = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
+          uTextureID_Option02 = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
+          uTextureID_Option01 = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x16u, 0x10Eu,
-            (uTextureID_507C6C != -1 ? pIcons_LOD->pTextures[uTextureID_507C6C].uTextureWidth : 24),
-            (uTextureID_507C6C != -1 ? pIcons_LOD->pTextures[uTextureID_507C6C].uTextureHeight : 26),
+            (uTextureID_Con_Smoo[2] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[2]].uTextureWidth : 24),
+            (uTextureID_Con_Smoo[2] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[2]].uTextureHeight : 26),
             v0, 0, 0xB8u, 0x80u, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x5Du, 0x10Eu,
-            (uTextureID_507C68 != -1 ? pIcons_LOD->pTextures[uTextureID_507C68].uTextureWidth : 24),
-            (uTextureID_507C68 != -1 ? pIcons_LOD->pTextures[uTextureID_507C68].uTextureHeight : 26),
+            (uTextureID_Con_Smoo[1] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[1]].uTextureWidth : 24),
+            (uTextureID_Con_Smoo[1] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[1]].uTextureHeight : 26),
             v0, 0, 0xB8u, 0x40u, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0xA4u, 0x10Eu,
-            (uTextureID_507C64[0] != -1 ? pIcons_LOD->pTextures[uTextureID_507C64[0]].uTextureWidth : 24),
-            (uTextureID_507C64[0] != -1 ? pIcons_LOD->pTextures[uTextureID_507C64[0]].uTextureHeight : 26),
+            (uTextureID_Con_Smoo[0] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[0]].uTextureWidth : 24),
+            (uTextureID_Con_Smoo[0] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[0]].uTextureHeight : 26),
             v0, 0, 0xB8u, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x12Fu,
-            (uTextureID_507CB4 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB4].uTextureWidth : 24),
-            (uTextureID_507CB4 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB4].uTextureHeight : 26),
+            (uTextureID_Option01 != -1 ? pIcons_LOD->pTextures[uTextureID_Option01].uTextureWidth : 24),
+            (uTextureID_Option01 != -1 ? pIcons_LOD->pTextures[uTextureID_Option01].uTextureHeight : 26),
             v0, 0, 0xB9u, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x12Fu,
-            (uTextureID_507CB8 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB8].uTextureWidth : 24),
-            (uTextureID_507CB8 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB8].uTextureHeight : 26),
+            (uTextureID_Option02 != -1 ? pIcons_LOD->pTextures[uTextureID_Option02].uTextureWidth : 24),
+            (uTextureID_Option02 != -1 ? pIcons_LOD->pTextures[uTextureID_Option02].uTextureHeight : 26),
             v0, 0, 0xBBu, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x145u,
-            (uTextureID_507CB0 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB0].uTextureWidth : 24),
-            (uTextureID_507CB0 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB0].uTextureHeight : 26),
+            (uTextureID_Option03 != -1 ? pIcons_LOD->pTextures[uTextureID_Option03].uTextureWidth : 24),
+            (uTextureID_Option03 != -1 ? pIcons_LOD->pTextures[uTextureID_Option03].uTextureHeight : 26),
             v0, 0, 0xE1u, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x145u,
-            (uTextureID_507C84 != -1 ? pIcons_LOD->pTextures[uTextureID_507C84].uTextureWidth : 24),
-            (uTextureID_507C84 != -1 ? pIcons_LOD->pTextures[uTextureID_507C84].uTextureHeight : 26),
+            (uTextureID_Option04 != -1 ? pIcons_LOD->pTextures[uTextureID_Option04].uTextureWidth : 24),
+            (uTextureID_Option04 != -1 ? pIcons_LOD->pTextures[uTextureID_Option04].uTextureHeight : 26),
             v0, 0, 0xE2u, 0, 0, v1, 0);
           pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, 111, 4, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C70], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, 0x6Fu, 5, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C74], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0);
           pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xA2u, 0xACu, 0x11u, v0, 0, 0x6Fu, 0, 0, v1, 0);
           pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 4, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C70], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 5, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C74], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0);
           pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xD8u, 0xACu, 0x11u, v0, 0, 0x70u, 0, 0, v1, 0);
           pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 4, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C70], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 5u, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C74], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0);
           pGUIWindow_CurrentMenu->CreateButton(0x107u, 0x10Eu, 0xACu, 0x11u, v0, 0, 0xBAu, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, 0x71u, 0, 0,
             pGlobalTXT_LocalizationStrings[619],// "Return to Game"
             0);
           pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x8Cu, 0xD6u, 0x28u, v0, 0, 0x19Fu, 0, 0x4Bu, v1, 0);
-          pTexture = 0;
-          v150 = v1;
-          v143 = 86;
-          v138 = 0;
-          v134 = 421;
-          v131 = 0;
-          v129 = v0;
-          v126 = 40;
-          v124 = 214;
-          v122 = 194;
-          v120 = 19;
-          //goto LABEL_117;
-          pGUIWindow_CurrentMenu->CreateButton(v120, v122, v124, v126, v129, v131, v134, v138, v143, v150, pTexture);
+          pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, 421, 0, 86, v1, 0);
           continue;
         case UIMSG_OpenKeyMappingOptions:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -680,11 +668,11 @@
           pGUIWindow_CurrentMenu->Release();
           viewparams->field_48 = 1;
           pCurrentScreen = SCREEN_KEYBOARD_OPTIONS;
-          uTextureID_507BF4 = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE);
-          uTextureID_507BF8 = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
-          uTextureID_507BFC = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C00 = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C04 = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
+          uTextureID_Optkb = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE);
+          uTextureID_Optkb_h = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
+          uTextureID_KeyResume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
+          uTextureID_Optkb_1 = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
+          uTextureID_Optkb_2 = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0);
           pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, 0x71u, 0, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A0u, 0, 0, "", 0);
@@ -706,7 +694,7 @@
           pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 0xCu, 0, "", 0);
           pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 0xDu, 0, "", 0);
           dword_506E68 = -1;
-          dword_506F08 = 1;
+          KeyboardPageNum = 1;
           memset(word_506E6C, 0, 0x1Cu);
           word_506E6C[14] = 0;
           memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
@@ -716,11 +704,14 @@
           continue;
         //default:
           //continue;
-        case UIMSG_1A3:
+        case UIMSG_ChangeKeyButton:
           if ( dword_506E68 != -1 )
-            goto LABEL_623;
+          {
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
+          }
           v14 = uMessageParam;
-          if ( dword_506F08 != v0 )
+          if ( KeyboardPageNum != v0 )
             v14 = uMessageParam + 14;
           dword_506E68 = v14;
           pKeyActionMap->EnterText(0, v0, pGUIWindow_CurrentMenu);
@@ -762,11 +753,11 @@
           v130 = 0;
           v127 = 219;
           goto _play_sound_and_continue;
-        case UIMSG_1A0:
-          dword_506F08 = v0;
-          continue;
-        case UIMSG_1A1:
-          dword_506F08 = 2;
+        case UIMSG_SelectKeyPage1:
+          KeyboardPageNum = v0;
+          continue;
+        case UIMSG_SelectKeyPage2:
+          KeyboardPageNum = 2;
           continue;
         case UIMSG_OpenVideoOptions:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -1348,7 +1339,7 @@
                       pEventTimer->Resume();
                       continue;
                     case SCREEN_OPTIONS:
-                      thisa = (signed int)&uTextureID_507C60;
+                      thisa = (signed int)&uTextureID_ControlBG;
                       do
                       {
                         if ( *(int *)thisa )
@@ -1356,7 +1347,7 @@
                         thisa += 4;
                       }
                       while ( thisa < (signed int)&dword_507CBC );
-                      memset(&uTextureID_507C60, 0, 0x5Cu);
+                      memset(&uTextureID_ControlBG, 0, 0x5Cu);
                       pIcons_LOD->_40F9C5();
                       WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
                       WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
@@ -1437,7 +1428,7 @@
                         ++v32;
                         if ( v32 >= 28 )
                         {
-                          thisb = (signed int)&uTextureID_507BF4;
+                          thisb = (signed int)&uTextureID_Optkb;
                           do
                           {
                             if ( *(int *)thisb )
@@ -1445,7 +1436,7 @@
                             thisb += 4;
                           }
                           while ( thisb < (signed int)&dword_507C08 );
-                          memset(&uTextureID_507BF4, 0, 0x14u);
+                          memset(&uTextureID_Optkb, 0, 0x14u);
                           pIcons_LOD->_40F9C5();
                           uAction = 0;
                           do
@@ -1479,7 +1470,8 @@
                           break;
                         }
                       }
-                      goto LABEL_623;
+                      pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+                      continue;
                     case SCREEN_REST:
                       if ( dword_506F14 )
                       {
@@ -1726,31 +1718,31 @@
               if ( !pIcons_LOD->uNumPrevLoadedFiles )
                 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
               pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)3, 0, 0);
-              uTextureID_507944 = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
-              uTextureID_507940 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
-              uTextureID_50793C = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
-              uTextureID_507938 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
-              uTextureID_507934 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
-              uTextureID_507930 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
-              uTextureID_50792C = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
+              uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
               pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, v0, 0, 0x7Cu, 0, 0x4Eu,
                              pGlobalTXT_LocalizationStrings[614],// "New Game"
-                             (Texture *)(uTextureID_507940 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507940] : 0), 0);
+                             (Texture *)(uTextureID_New1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_New1] : 0), 0);
               pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, v0, 0, 0x7Eu, 0, 0x53u,
                              pGlobalTXT_LocalizationStrings[615],// "Save Game"
-                             (Texture *)(uTextureID_507938 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507938] : 0), 0);
+                             (Texture *)(uTextureID_Save1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Save1] : 0), 0);
               pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, v0, 0, 0x7Du, 0, 0x4Cu,
                              pGlobalTXT_LocalizationStrings[616],// "Load Game"
-                             (Texture *)(uTextureID_50793C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50793C] : 0), 0);
+                             (Texture *)(uTextureID_Load1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Load1] : 0), 0);
               pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, v0, 0, 0x7Fu, 0, 0x43u,
                              pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:""
-                             (Texture *)(uTextureID_507934 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507934] : 0), 0);
+                             (Texture *)(uTextureID_Controls1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Controls1] : 0), 0);
               pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, v0, 0, 0x84u, 0, 0x51u,
                              pGlobalTXT_LocalizationStrings[618],// "Quit"
-                             (Texture *)(uTextureID_50792C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50792C] : 0), 0);
+                             (Texture *)(uTextureID_Quit1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Quit1] : 0), 0);
               pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, v0, 0, 0x7Bu, 0, 0x52u,
                              pGlobalTXT_LocalizationStrings[619],// "Return to Game"
-                             (Texture *)(uTextureID_507930 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507930] : 0), 0);
+                             (Texture *)(uTextureID_Resume1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Resume1] : 0), 0);
               pGUIWindow_CurrentMenu->_41D08F(6, v0, 0, 0);
               viewparams->field_48 = v0;
               stru_506E40.Release();
@@ -2609,7 +2601,11 @@
           continue;
         case UIMSG_19:
           if ( bUnderwater == 1 )
-            goto LABEL_682;
+          {
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
+          }
           if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) )
             //goto LABEL_90;
           {
@@ -2617,13 +2613,7 @@
             v0 = 1;
             continue;
           }
-          v79 = pPlayer2->uQuickSpell;
-          v175 = uActiveCharacter;
-          v159 = 0;
-          v147 = 0;
-          v80 = uActiveCharacter - 1;
-          //goto LABEL_679;
-          _42777D_CastSpell_UseWand_ShootArrow(v79, v80, v147, v159, v175);
+          _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
           continue;
         case UIMSG_46:
         case UIMSG_8C:
@@ -2760,7 +2750,9 @@
             //goto LABEL_621;
           {
             v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            goto LABEL_622;
+            ShowStatusBarString(v96, 2);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, (enum WindowType)90,
             (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes"
@@ -2772,7 +2764,9 @@
             //goto LABEL_621;
           {
             v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            goto LABEL_622;
+            ShowStatusBarString(v96, 2);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, (enum WindowType)90,
             (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour"
@@ -2865,7 +2859,9 @@
             //goto LABEL_621;
           {
             v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            goto LABEL_622;
+            ShowStatusBarString(v96, 2);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest )
           {
@@ -2945,7 +2941,9 @@
           {
 //LABEL_621:
             v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            goto LABEL_622;
+            ShowStatusBarString(v96, 2);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, (enum WindowType)90,
             (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
@@ -3155,11 +3153,7 @@
             continue;
           if ( bUnderwater == 1 )
           {
-LABEL_682:
-            v96 = pGlobalTXT_LocalizationStrings[652];// "You can not do that while you are underwater!"
-LABEL_622:
-            ShowStatusBarString(v96, 2u);
-LABEL_623:
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
             v165 = 0;
             v151 = 0;
             v144 = 0;
@@ -8787,13 +8781,13 @@
   {
     v229 = pPlayer->pEquipment.uMainHand;
     v9 = (int)&pPlayer->pInventoryItems[v8-1];
-    v10 = pBodyComplection << 7;
+   // v10 = pBodyComplection << 7;
     v218 = v9;
     v11 = *(int *)v9;
     v12 = *(int *)v9;
     v13 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[v12].uEquipX;
     a2a = v13;
-    a3a = pPaperdoll_BodyY + *(int *)((char *)&paperdoll_Weapon[0][1][1] + v10) - pItemsTable->pItems[v12].uEquipY;
+    a3a = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[v12].uEquipY;
     if ( v11 == 64 )
       v166 = "item64v1";
     else
@@ -13056,7 +13050,7 @@
 }
 
 //----- (00410B28) --------------------------------------------------------
-void __thiscall DrawSpellDescriptionPopup(void *_this)
+void __thiscall DrawSpellDescriptionPopup(int spell_index)
 {
   Player *v1; // edi@1
   SpellInfo *v2; // esi@1
@@ -13067,14 +13061,14 @@
   char *v7; // ST44_4@12
   unsigned __int16 v8; // ax@12
   GUIWindow a1; // [sp+Ch] [bp-68h]@4
-  void *v10; // [sp+60h] [bp-14h]@1
+  int v10; // [sp+60h] [bp-14h]@1
   POINT a2; // [sp+64h] [bp-10h]@1
   int v12; // [sp+6Ch] [bp-8h]@4
   int v13; // [sp+70h] [bp-4h]@4
 
   v1 = pPlayers[uActiveCharacter];
-  v10 = _this;
-  v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->lastOpenedSpellbookPage) + 1];
+  v10 = spell_index;
+  v2 = &pSpellStats->pInfos[spell_index + 11 * v1->lastOpenedSpellbookPage + 1];
   if ( pMouse->GetCursorPos(&a2)->y <= 250 )
     v3 = pMouse->GetCursorPos(&a2)->y + 30;
   else
@@ -13086,10 +13080,10 @@
   a1.uFrameZ = 417;
   a1.uFrameW = v3 + 67;
   a1.Hint = 0;
-  a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);
-  v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);
-  v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);
-  v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);
+  a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]);
+  v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]);
+  v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]);
+  v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]);
   v5 = a2.y;
   if ( v13 > a2.y )
     v5 = v13;
@@ -13097,25 +13091,20 @@
     v5 = v12;
   if ( v4 > v5 )
     v5 = v4;
-  sprintf(
-    pTmpBuf2,
+  sprintf(  pTmpBuf2,
     "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
     v2->pDescription,
-    pGlobalTXT_LocalizationStrings[431],
-    v5 + 3,
-    v5 + 10,
+    pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL],
+    v5 + 3, v5 + 10,
     v2->pBasicSkillDesc,
-    pGlobalTXT_LocalizationStrings[433],
-    v5 + 3,
-    v5 + 10,
+    pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT],
+    v5 + 3,  v5 + 10,
     v2->pExpertSkillDesc,
-    pGlobalTXT_LocalizationStrings[432],
-    v5 + 3,
-    v5 + 10,
+    pGlobalTXT_LocalizationStrings[LOCSTR_MASTER],
+    v5 + 3, v5 + 10,
     v2->pMasterSkillDesc,
-    pGlobalTXT_LocalizationStrings[96],
-    v5 + 3,
-    v5 + 10,
+    pGlobalTXT_LocalizationStrings[LOCSTR_GRAND],
+    v5 + 3,  v5 + 10,
     v2->pGrandmasterSkillDesc);
   v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0);
   a1.uFrameHeight += v6;
@@ -13134,13 +13123,11 @@
   a1.uFrameWidth = 108;
   a1.uFrameZ = a1.uFrameX + 107;
   a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u);
-  sprintf(
-    pTmpBuf,
-    "%s\n%d",
-    pGlobalTXT_LocalizationStrings[522],
-    *(&pSpellDatas[0].field_12 //temp_fix field_14
-    + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6)
-    + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage)));
+  sprintf( pTmpBuf,  "%s\n%d",    pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST],
+	  pSpellDatas[spell_index + 11 * v1->lastOpenedSpellbookPage + 1].mana_per_skill[v1->pActiveSkills[v1->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]);
+  //  *(&[0].field_12 //temp_fix field_14
+   // + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6)
+   // + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage)));
   a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3u);
   dword_507B00_spell_info_to_draw_in_popup = 0;
 }
@@ -13669,15 +13656,16 @@
           }
           if ( v6->pLevelOfDetail0 )
           {
-            v7 =  (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
-            v19 = pViewport->uViewportY + pIconPos[v7].Ypos;
-            v17 = pViewport->uViewportX + pIconPos[v7].Xpos;
+			v7 = v0->lastOpenedSpellbookPage;
+           // v7 =  (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
+            v19 = pViewport->uViewportY +  pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos;
+            v17 = pViewport->uViewportX +  pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos;
             if ( BYTE1(v6->pBits) & 2 )
               pRenderer->DrawTextureTransparent(v17, v19, v6);
             else
               pRenderer->DrawTextureIndexed(v17, v19, v6);
-            v8 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
-            pRenderer->_4A612A(pIconPos[v8].Xpos,pIconPos[v8].Ypos, v23, v4);
+            pRenderer->_4A612A(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos,
+				               pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4);
           }
         }
       }
@@ -13693,9 +13681,10 @@
     if ( v11->pLevelOfDetail0 )
     {
       v21 = dword_5063D8[v10];
-      v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
-      v20 = pViewport->uViewportY + pIconPos[v12].Ypos;
-      v18 = pViewport->uViewportX + pIconPos[v12].Xpos;
+	  v12 = v0->lastOpenedSpellbookPage;
+    //  v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
+      v20 = pViewport->uViewportY +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
+      v18 = pViewport->uViewportX +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
       if ( BYTE1(v11->pBits) & 2 )
         pRenderer->DrawTextureTransparent(v18, v20, v21);
       else
@@ -14832,16 +14821,10 @@
     dword_506E68 = -1;
     v3->field_40 = 0;
   }
-  pRenderer->DrawTextureIndexed(
-    8u,
-    8u,
-    (Texture *)(uTextureID_507BF4 != -1 ? &pIcons_LOD->pTextures[uTextureID_507BF4] : 0));
-  if ( dword_506F08 == 1 )
-  {
-    pRenderer->DrawTextureIndexed(
-      0x13u,
-      0x12Eu,
-      (Texture *)(uTextureID_507C00 != -1 ? &pIcons_LOD->pTextures[uTextureID_507C00] : 0));
+  pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Optkb != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb] : 0));
+  if ( KeyboardPageNum == 1 )
+  {
+    pRenderer->DrawTextureIndexed(0x13, 0x12E, (Texture *)(uTextureID_Optkb_1 != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb_1] : 0));
     pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ascii_4E2D5C, 0, 0, 0);
     v6 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]);
     v7 = sub_414D24(0);
@@ -14904,10 +14887,7 @@
   }
   else
   {
-    pRenderer->DrawTextureIndexed(
-      0x7Fu,
-      0x12Eu,
-      (Texture *)(uTextureID_507C04 != -1 ? &pIcons_LOD->pTextures[uTextureID_507C04] : 0));
+    pRenderer->DrawTextureIndexed(0x7F, 0x12E, (Texture *)(uTextureID_Optkb_2 != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb_2] : 0));
     pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ascii_4E2CDC, 0, 0, 0);
     v33 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]);
     v34 = sub_414D24(14);
@@ -15066,18 +15046,12 @@
 
 
 //----- (00414F82) --------------------------------------------------------
-void __cdecl sub_414F82_DrawGameOptions()
+void __cdecl DrawGameOptions()
 {
   signed int v0; // eax@1
 
-  pRenderer->DrawTextureIndexed(
-    8u,
-    8u,
-    (Texture *)(uTextureID_507944 != -1 ? &pIcons_LOD->pTextures[uTextureID_507944] : 0));
-  pRenderer->DrawTextureIndexed(
-    8u,
-    0x84u,
-    (Texture *)(uTextureID_507C60 != -1 ? &pIcons_LOD->pTextures[uTextureID_507C60] : 0));
+  pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0));
+  pRenderer->DrawTextureIndexed(8, 132, (Texture *)(uTextureID_ControlBG != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG] : 0));
   v0 = 0;
   if ( uTurnSpeed == 128 )
   {
@@ -15088,41 +15062,20 @@
     if ( uTurnSpeed == 64 )
       v0 = 1;
   }
-  pRenderer->DrawTextureIndexed(
-    dword_4E2910[v0],
-    0x10Eu,
-    (Texture *)(uTextureID_507C64[v0] != -1 ? &pIcons_LOD->pTextures[uTextureID_507C64[v0]] : 0));
+  pRenderer->DrawTextureIndexed(BtnTurnCoord[v0], 270, (Texture *)(uTextureID_Con_Smoo[v0] != -1 ? &pIcons_LOD->pTextures[uTextureID_Con_Smoo[v0]] : 0));
   if ( bWalkSound )
-    pRenderer->DrawTextureIndexed(
-      0x14u,
-      0x12Fu,
-      (Texture *)(uTextureID_507CB4 != -1 ? &pIcons_LOD->pTextures[uTextureID_507CB4] : 0));
+    pRenderer->DrawTextureIndexed(20, 303, (Texture *)(uTextureID_Option01 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option01] : 0));
   if ( bShowDamage )
-    pRenderer->DrawTextureIndexed(
-      0x80u,
-      0x12Fu,
-      (Texture *)(uTextureID_507CB8 != -1 ? &pIcons_LOD->pTextures[uTextureID_507CB8] : 0));
+    pRenderer->DrawTextureIndexed(128, 303, (Texture *)(uTextureID_Option02 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option02] : 0));
   if ( bFlipOnExit )
-    pRenderer->DrawTextureIndexed(
-      0x80u,
-      0x145u,
-      (Texture *)(uTextureID_507C84 != -1 ? &pIcons_LOD->pTextures[uTextureID_507C84] : 0));
+    pRenderer->DrawTextureIndexed(128, 325, (Texture *)(uTextureID_Option04 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option04] : 0));
   if ( bAlwaysRun )
-    pRenderer->DrawTextureIndexed(
-      0x14u,
-      0x145u,
-      (Texture *)(uTextureID_507CB0 != -1 ? &pIcons_LOD->pTextures[uTextureID_507CB0] : 0));
-  pRenderer->DrawTextureIndexed(
-    17 * (char)uSoundVolumeMultiplier + 265,
-    0xA2u,
+    pRenderer->DrawTextureIndexed(20, 325, (Texture *)(uTextureID_Option03 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option03] : 0));
+  pRenderer->DrawTextureIndexed(17 * (char)uSoundVolumeMultiplier + 265, 162,
     (Texture *)(pTextureIDs_SoundLevels[(char)uSoundVolumeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uSoundVolumeMultiplier]] : 0));
-  pRenderer->DrawTextureIndexed(
-    17 * (char)uMusicVolimeMultiplier + 265,
-    0xD8u,
+  pRenderer->DrawTextureIndexed(17 * (char)uMusicVolimeMultiplier + 265, 216,
     (Texture *)(pTextureIDs_SoundLevels[(char)uMusicVolimeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uMusicVolimeMultiplier]] : 0));
-  pRenderer->DrawTextureIndexed(
-    17 * (char)uVoicesVolumeMultiplier + 265,
-    0x10Eu,
+  pRenderer->DrawTextureIndexed(17 * (char)uVoicesVolumeMultiplier + 265, 270,
     (Texture *)(pTextureIDs_SoundLevels[(char)uVoicesVolumeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uVoicesVolumeMultiplier]] : 0));
 }
 
@@ -15859,7 +15812,7 @@
               }
               else if (pWindowType == WINDOW_Options)
               {
-                sub_414F82_DrawGameOptions();
+                DrawGameOptions();
               }
             }
             else if (pWindowType == WINDOW_CharacterRecord)
@@ -15868,7 +15821,7 @@
             }
             continue;
           }
-          pTexture = (Texture *)(uTextureID_507944 != -1 ? &pIcons_LOD->pTextures[uTextureID_507944] : 0);//pWindowType == 3 (0x3)
+          pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);//pWindowType == 3 (0x3)
           pY = pViewport->uViewportY;
           pX = pViewport->uViewportX;
           //goto LABEL_18;
@@ -16562,7 +16515,7 @@
             if ( pCurrentScreen == SCREEN_SPELL_BOOK )
             {
               if ( dword_507B00_spell_info_to_draw_in_popup )
-                DrawSpellDescriptionPopup((void *)(dword_507B00_spell_info_to_draw_in_popup - 1));
+                DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1);
             }
             goto LABEL_132;
           }
--- a/mm7_data.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7_data.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -658,7 +658,10 @@
 int pCurrentScreen = SCREEN_VIDEO; // 004E28F8
 char byte_4E28FC; // weak
 unsigned int uGammaPos;
-int dword_4E2910[777]; // weak
+int BtnTurnCoord[8] = 
+{
+  0xA4, 0x5D, 0x16, 0xB, 0x5, 0xD, 0x7, 0x3B,
+}; // weak
 __int16 RightClickPortraitXmin[4]={0x14, 0x83, 0xF2, 0x165};
 __int16 RightClickPortraitXmax[4]={0x53, 0xC6, 0x138, 0x1A7};
 void *off_4E2A12; // weak
@@ -702,10 +705,10 @@
 char ascii_4E2D28[8];
 char ascii_4E2D30[7];
 char ascii_4E2D38[5];
-char ascii_4E2D40[8];
-char ascii_4E2D48[6];
-char ascii_4E2D50[12];
-char ascii_4E2D5C[7];
+char ascii_4E2D40[8];// = {0xC2, 0xCF, 0xD0, 0xC0, 0xC2, 0xCE, 0};//russian text in keyboard options
+char ascii_4E2D48[6];// = {0xC2, 0xCB, 0xC5, 0xC2, 0xCE, 0};
+char ascii_4E2D50[6];// = {0xCD, 0xC0, 0xC7, 0xC0, 0xC4, 0};
+char ascii_4E2D5C[7];// = {0xC2, 0xCF, 0xC5, 0xD0, 0xC5, 0xC4, 0};
 char aMakingItemNumb[777]; // idb
 char aNpc03d[777]; // idb
 const char *format_4E2D80 = "\f%05d%s\f00000\n";
@@ -1778,7 +1781,7 @@
 int dword_506E68; // weak
 __int16 word_506E6C[18]; // weak
 unsigned int pPrevVirtualCidesMapping[27];
-int dword_506F08; // weak
+int KeyboardPageNum; // weak
 int dword_506F0C[777]; // idb
 int uRestUI_FoodRequiredToRest;
 int dword_506F14; // weak
@@ -2301,6 +2304,8 @@
 int dword_F93F20; // weak
 int dword_F93F70; // weak
 
+volatile bool initing;
+
 //int crt_F94004; // weak
 //int crtdword_F9400C; // weak
 FARPROC lpfn; // idb
\ No newline at end of file
--- a/mm7_data.h	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7_data.h	Fri Feb 22 09:12:01 2013 +0600
@@ -459,7 +459,7 @@
 extern int pCurrentScreen; // 004E28F8
 extern char byte_4E28FC; // weak
 extern unsigned int uGammaPos;
-extern int dword_4E2910[]; // weak
+extern int BtnTurnCoord[8];
 extern __int16 RightClickPortraitXmin[4];
 extern __int16 RightClickPortraitXmax[4];
 extern void *off_4E2A12; // weak
@@ -505,7 +505,7 @@
 extern char ascii_4E2D38[5];
 extern char ascii_4E2D40[8];
 extern char ascii_4E2D48[6];
-extern char ascii_4E2D50[12];
+extern char ascii_4E2D50[6];
 extern char ascii_4E2D5C[7];
 extern char aMakingItemNumb[]; // idb
 extern char aNpc03d[]; // idb
@@ -1184,7 +1184,7 @@
 extern int dword_506E68; // weak
 extern __int16 word_506E6C[18]; // weak
 extern unsigned int pPrevVirtualCidesMapping[27];
-extern int dword_506F08; // weak
+extern int KeyboardPageNum; // weak
 extern int dword_506F0C[]; // idb
 extern int uRestUI_FoodRequiredToRest;
 extern int dword_506F14; // weak
@@ -1720,6 +1720,8 @@
 extern int dword_F93F20; // weak
 extern int dword_F93F70; // weak
 
+extern volatile bool initing; //ADDED
+
 //extern int crt_F94004; // weak
 //extern int crtdword_F9400C; // weak
 extern FARPROC lpfn; // idb
@@ -1821,7 +1823,7 @@
 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue);
 void __fastcall sub_40F92A(int *pZBuffer, struct Texture *a2, int a3); // idb
 void __cdecl SetMoonPhaseNames();
-void __thiscall DrawSpellDescriptionPopup(void *_this);
+void DrawSpellDescriptionPopup(int spell_index);
 signed int __fastcall sub_410D99_get_map_index(int a1);
 unsigned int __cdecl DrawLloydBeaconsScreen();
 char *__cdecl DrawTownPortalScreen();
@@ -1849,7 +1851,7 @@
 char __cdecl GameMenuUI_DrawKeyBindings();
 unsigned int __thiscall sub_414D24(int _this);
 void __cdecl GameMenuUI_DrawVideoOptions();
-void __cdecl sub_414F82_DrawGameOptions();
+void __cdecl DrawGameOptions();
 void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight); // idb
 char *__cdecl DrawCopyrightWindow();
 void __cdecl GUI_UpdateWindows();
@@ -2331,7 +2333,7 @@
 void __cdecl sub_4B8285_prolly_draw_arcomage_result();
 void *__cdecl GenerateShopItems();
 void *__cdecl sub_4B8F94();
-char *__cdecl sub_4B910F();
+char *__cdecl _4B910F_shop_interaction();
 POINT *__cdecl sub_4B9CC6();
 void __cdecl sub_4BA928();
 signed int __fastcall sub_4BB756(signed int a1);
--- a/mm7text_ru.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7text_ru.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -872,6 +872,7 @@
   {"", 0},
   {"", 0},
   {"", 0},
+  {"", 0},
   {"", 0},
   {"", 1},
   {"", 0},