changeset 484:4bd56919f075

avard quest guild bits
author Gloval
date Wed, 27 Feb 2013 02:25:31 +0400
parents 5b6e2021c6fe
children b6bdfaa3ae0f
files Actor.cpp Arcomage.cpp Events.cpp GUIWindow.cpp Game.cpp Items.cpp Party.cpp Party.h Player.cpp Player.h mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_data.cpp mm7_data.h stru159.h
diffstat 18 files changed, 376 insertions(+), 418 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/Actor.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -2169,17 +2169,17 @@
   {
     if ( v1 == 6 || v1 == 7 )
     {
-      _449B57_test_bit(pParty->_award_bits, 99);
-      if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 100) )
+      _449B57_test_bit(pParty->_quest_bits, 99);
+      if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 100) )
         return;
       goto LABEL_12;
     }
     if ( v1 != 8 )
       goto LABEL_12;
   }
-  if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 99) )
+  if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 99) )
     v3 = 0;
-  if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 100) )
+  if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 100) )
     v3 = 1;
   if ( v3 )
   {
@@ -2207,8 +2207,8 @@
     {
       if ( pParty->uFine )
       {
-        if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->field_152, 1) )
-          _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->field_152, 1, 1u);
+        if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_guilds_member_bits, 1) )
+          _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_guilds_member_bits, 1, 1u);
       }
       ++ppPlayers;
     }
--- a/Arcomage.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/Arcomage.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -5667,8 +5667,8 @@
     }
     while ( v10 <= 120 );
     if ( v10 == 121 )
-      _449B7E_toggle_bit(pParty->_award_bits, 238, 1u);
-    v11 = pParty->pPlayers[0].field_152;
+      _449B7E_toggle_bit(pParty->_quest_bits, 238, 1u);
+    v11 = pParty->pPlayers[0]._guilds_member_bits;
     do
     {
       if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v11, 1) )
@@ -5682,7 +5682,7 @@
   }
   else
   {
-    v12 = pParty->pPlayers[0].field_152;
+    v12 = pParty->pPlayers[0]._guilds_member_bits;
     do
     {
       if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v12, 1) )
--- a/Events.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/Events.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -380,7 +380,7 @@
 						if ( v128 == 3 )
 							pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
 						if ( v128 == 13 )
-							pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
+							pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
 						}
 					if (pAsyncMouse)
 						pAsyncMouse->Resume();
@@ -403,7 +403,7 @@
 						if ( v128 == 3 )
 							pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
 						if ( v128 == 13 )
-							pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
+							pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
 						}
 					if (pAsyncMouse)
 						pAsyncMouse->Resume();
@@ -427,7 +427,7 @@
 					if ( v128 == 3 )
 						pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
 					if ( v128 == 13 )
-						pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
+						pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
 					}
 				if (pAsyncMouse)
 					pAsyncMouse->Resume();
@@ -822,70 +822,65 @@
 				//v7 = "";
 				break;
 			case EVENT_Compare://_evt->_e_type == 14 cmp in Global.evt event 6
-				pValue = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-				if ( player_choose == 5 )
+				pValue = EVT_DWORD(_evt->v7);
+				if ( player_choose <= 3 )
 					{
-					v130 = 0;
-					pPlayer = pParty->pPlayers;
-					while ( 1 )
+					if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
 						{
-						v60 = pPlayer->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue);
-						if ( v60 )
-							break;
-						++v130;
-						++pPlayer;
-						if ( (signed int)pPlayer >= (signed int)pParty->pHirelings )
-							{
-							++curr_seq_num;
-							v4 = v124;
-
-							//v6 = v123;
-							//v7 = "";
-							break;
-							}
-						}
-LABEL_129:
-					v11 = _evt->v11;
-					goto LABEL_130;
+						v124 = -1;
+						curr_seq_num = _evt->v11 - 1;
+						};
 					}
-				if ( player_choose < 0 )
-					goto LABEL_139;
-				v61 = player_choose;
-				if ( player_choose <= 3 )
-					goto LABEL_137;
-				if ( player_choose == 4 )
+				else if ( player_choose == 4 ) //active
 					{
 					if ( uActiveCharacter )
 						{
-						v6 = pPlayers[uActiveCharacter];
-						goto LABEL_138;
+						if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
+							{
+							v124 = -1;
+							curr_seq_num = _evt->v11 - 1;
+							};
 						}
 					}
-				else
+				else 	if ( player_choose == 5 )//all
 					{
-					if ( player_choose != 6 )
-						goto LABEL_139;
+					v130=0;
+					for(int i=0; i<4; ++i)
+						{
+						if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
+							{
+							v124 = -1;
+							curr_seq_num = _evt->v11 - 1;
+							break;
+							};
+
+						++v130;
+						}
+
 					}
-				v61 = rand() % 4;
-				
-LABEL_137:
-				v6 = &pParty->pPlayers[v61];
-LABEL_138:
-				//v123 = v6;
-LABEL_139:
-				v62 = ((Player *)v6)->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue);
-LABEL_140:
-				if ( v62 )
-					goto LABEL_129;
+				else if ( player_choose == 6 ) //random
+					{
+					if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
+						{
+						v124 = -1;
+						curr_seq_num = _evt->v11 - 1;
+						}
+					}
+			
 				++curr_seq_num;
 				v4 = v124;
-				
 				//v6 = v123;
 				//v7 = "";
 				break;
 			case EVENT_IsActorAlive:
-				v62 = IsActorAlive(_evt->v5, _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), _evt->v10);
-				goto LABEL_140;
+				 if  (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10)))
+					 {
+					 v124 = -1;
+					 curr_seq_num = _evt->v11 - 1;
+					 }
+				 ++curr_seq_num;
+				 v4 = v124;
+				 break;
 			case EVENT_Substract:
 				v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8));
 				if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands )
@@ -1564,7 +1559,9 @@
 				v105 = curr_seq_num + 1;
 				goto LABEL_295;
 			case EVENT_Exit:
-				goto LABEL_301;
+				if ( v133 == 1 )
+		      		OnMapLeave();
+				return;
 			default:
 				++curr_seq_num;
 				v4 = v124;
--- a/GUIWindow.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/GUIWindow.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -563,7 +563,7 @@
         for ( i = dword_506528; i < 512; ++i )
         {
           v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i];
-          if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, i) && v14 )
+          if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, i) && v14 )
           {
             v15 = dword_506520++;
             pStru179.field_0[v15] = i;
@@ -1070,7 +1070,7 @@
   v18.uFrameZ += 8;
   if ( !pDialogueNPCCount )
   {
-    if ( in_current_bilding_type == BildingType_Jail )
+    if ( in_current_building_type == BildingType_Jail )
     {
       JailDialog();
       goto LABEL_58;
@@ -1151,7 +1151,7 @@
       //p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C]);
       p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle);
     v18.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v19, pTmpBuf, 3u);
-      switch ( in_current_bilding_type )
+      switch ( in_current_building_type )
       {
         case BildingType_WeaponShop:
           WeaponShopDialog();
--- a/Game.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/Game.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -429,7 +429,7 @@
         uActiveCharacter = 1;
       }
     //  while ( (signed int)pHealth < (signed int)&pParty->field_871C[567] );
-      if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 136) )
+      if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 136) )
       {
         pParty->vPosition.x = -17331;            // respawn in harmondale
         pParty->vPosition.y = 12547;
--- a/Items.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/Items.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -1695,13 +1695,13 @@
     v16 = 0;
     v56 = 0;
     do
-      v56 += pParty->field_7BA[v16++];
+      v56 += pParty->pIsArtifactFound[v16++];
     while ( v16 < 29 );
     v17 = rand() % 29;
 
-    if ( v6 == 5 && rand() % 100 < 5 && !pParty->field_7BA[v17] && v56 < 13 )
+    if ( v6 == 5 && rand() % 100 < 5 && !pParty->pIsArtifactFound[v17] && v56 < 13 )
     {
-      pParty->field_7BA[v17] = 1;
+      pParty->pIsArtifactFound[v17] = 1;
       out_item->uAttributes = 0;
       out_item->uItemID = v17 + 500;
       SetSpecialBonus(out_item);
@@ -1732,7 +1732,7 @@
 	out_item->uEncantmentType = out_item->uEncantmentType * treasure_level; 
   }
   if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION
-    && !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) )
+    && !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
     v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST;
   if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St )
     v4->uAttributes = 0;
@@ -1921,7 +1921,7 @@
   uNumArtifactsNotFound = 0;
 
   for (int i=500;i<529;++i)
-     if ( !pParty->field_3C.pIsArtifactFound[i] )
+     if ( !pParty->pIsArtifactFound[i-500] )
         artifacts_list[uNumArtifactsNotFound++] = i;
 
   Reset();
--- a/Party.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/Party.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -761,14 +761,14 @@
 
   pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
   uFlags = 0;
-
-  memset(_award_bits, 0, 64);
-  _449B7E_toggle_bit(_award_bits, 1, 1);
-  _449B7E_toggle_bit(_award_bits, 2, 1);
-  _449B7E_toggle_bit(_award_bits, 3, 1);
-  _449B7E_toggle_bit(_award_bits, 4, 1);
-  _449B7E_toggle_bit(_award_bits, 5, 1);
-  _449B7E_toggle_bit(_award_bits, 6, 1);
+  memset(_autonote_bits, 0, 12);
+  memset(_quest_bits, 0, 64);
+  _449B7E_toggle_bit(_quest_bits, 1, 1);
+  _449B7E_toggle_bit(_quest_bits, 2, 1);
+  _449B7E_toggle_bit(_quest_bits, 3, 1);
+  _449B7E_toggle_bit(_quest_bits, 4, 1);
+  _449B7E_toggle_bit(_quest_bits, 5, 1);
+  _449B7E_toggle_bit(_quest_bits, 6, 1);
 
 
   memcpy(pNPCStats->pNewNPCData, pNPCStats->pNPCData, 0x94BCu);
--- a/Party.h	Tue Feb 26 17:24:53 2013 +0600
+++ b/Party.h	Wed Feb 27 02:25:31 2013 +0400
@@ -115,11 +115,12 @@
   int field_0[20];
  // int field_50[170];
   __int64 field_50[85];
-  int _shop_ban_times[82];
-  int field_440[44];
+  __int64 _shop_ban_times[53];
+  int field_4A0[20];
   int field_4F0[38];
   char field_588[2];
-  char pIsArtifactFound[238];
+  __int64 _s_times[21]; //5d8 440h+8*51
+ // char pIsArtifactFound[8];
 };
 #pragma pack(pop)
 
@@ -250,15 +251,15 @@
   __int16 field_750[5];
   __int16 field_75A[5];
   char field_764; // num hours resting or some sort of.
-  unsigned __int8 _award_bits[64];
+  unsigned __int8 _quest_bits[64];
   unsigned __int8 pArcomageWins[16];
   char field_7B5_in_arena_quest;
   char uNumArenaPageWins;
   char uNumArenaSquireWins;
   char uNumArenaKnightWins;
   char uNumArenaLordWins;
-  char field_7BA[12];
-  char pArtifactsFound[56];
+  char pIsArtifactFound[68];  //7ba
+  //char pArtifactsFound[56];
   unsigned char _autonote_bits[12];
   char field_80A[74];
   char field_854[32];
--- a/Player.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/Player.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -756,7 +756,7 @@
         v7 = 1;
         goto LABEL_4;
       case 1u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 17)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17)
           || _49327B(2u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -773,7 +773,7 @@
         v7 = 5;
         goto LABEL_4;
       case 5u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 11)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11)
           || _49327B(6u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -794,7 +794,7 @@
         v7 = 9;
         goto LABEL_4;
       case 9u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 23)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23)
           || _49327B(0xAu, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -815,7 +815,7 @@
         v7 = 13;
         goto LABEL_4;
       case 0xDu:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 41)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41)
           || _49327B(0xEu, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -836,7 +836,7 @@
         v7 = 17;
         goto LABEL_4;
       case 0x11u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 35)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35)
           || _49327B(0x12u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -855,7 +855,7 @@
         v7 = 21;
         goto LABEL_4;
       case 0x15u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 29)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29)
           || _49327B(0x16u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -877,7 +877,7 @@
         break;
       case 0x19u:
 LABEL_56:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->field_152, 63)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63)
           || _49327B(0x1Au, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -898,7 +898,7 @@
         v7 = 29;
         goto LABEL_4;
       case 0x1Du:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 69)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69)
           || _49327B(0x1Eu, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -919,7 +919,7 @@
         v7 = 33;
         goto LABEL_4;
       case 0x21u:
-        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, 73)
+        if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73)
           || _49327B(0x22u, a3) )
           goto LABEL_84;
         v8 = a3;
@@ -937,7 +937,7 @@
         {
           v5 = 79;
 LABEL_82:
-          v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->field_152, v5) == 0;
+          v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0;
 LABEL_83:
           if ( !v4 )
             goto LABEL_84;
@@ -1062,7 +1062,7 @@
 LABEL_13:
           v4 = 99;
 LABEL_15:
-          v5 = (unsigned __int16)_449B57_test_bit(pParty->_award_bits, v4) == 0;
+          v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0;
 LABEL_23:
           if ( !v5 )
             return 1;
@@ -6486,7 +6486,7 @@
   uExperience = 251 + rand() % 100;
   uBirthYear = 1147 - rand() % 6;
   memset(pActiveSkills, 0, sizeof(pActiveSkills));
-  memset(field_152, 0, 64);
+  memset(_guilds_member_bits, 0, 64);
   memset(&spellbook, 0, sizeof(PlayerSpells));
 
   for (uint i = 0; i < 37; ++i)
@@ -7701,8 +7701,8 @@
 
 
 //----- (00449BB4) --------------------------------------------------------
-char Player::CompareVariable(enum VariableType VarNum, signed int pValue)
-{
+bool Player::CompareVariable( enum VariableType VarNum, signed int pValue )
+	{
   Player *v3; // esi@1
   signed int v4; // edi@1
   unsigned int v5; // eax@8
@@ -7713,8 +7713,8 @@
   unsigned __int8 v10; // of@17
   int v11; // eax@19
   unsigned int v12; // eax@20
-  unsigned int v13; // eax@25
-  unsigned __int8 v14; // cl@25
+  unsigned int test_bit_value; // eax@25
+  unsigned __int8 our_bit_value; // cl@25
   signed int v15; // ecx@28
   ItemGen *v16; // eax@28
   char v17; // zf@31
@@ -7739,10 +7739,9 @@
     switch ( VarNum )
     {
       case VAR_Invisible:
-        if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0
-          && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) )
+        if ( pParty->pPartyBuffs[11].uExpireTime >0 )
           return true;
-        return v4 >= pValue;
+        return false;
       case VAR_NumDeaths:
         v4 = pParty->uNumDeaths;
         return v4 >= pValue;
@@ -7829,8 +7828,7 @@
         return v6;
       case VAR_IsFlying:
         if ( pParty->bFlying
-          && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0
-          && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) > 0) )
+          && (pParty->pPartyBuffs[7].uExpireTime> 0) )
           return true;
         return false;
       case VAR_HiredNPCHasSpeciality:
@@ -7839,9 +7837,9 @@
       case VAR_NPCs2:
         return pNPCStats->pNewNPCData[pValue].Hired();
       case VAR_MonthEquals|VAR_CurrentSP:
-        v13 = 0x80u >> ((signed __int16)a1 - 1) % 8;
-        v14 = this->field_1A50[((signed __int16)a1 - 1) >> 3];
-        if ( !((unsigned __int8)v13 & v14) )
+        test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8;
+        our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8];
+        if ( !((unsigned __int8)test_bit_value & our_bit_value) )
           return v4 >= pValue;
         v4 = pValue;
         return v4 >= pValue;
@@ -7901,12 +7899,11 @@
   }
   if ( VarNum == VAR_AutoNotes )
   {
-    v13 = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8;
-    v14 = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) >> 3];
-    if ( !((unsigned __int8)v13 & v14) )
-      return v4 >= pValue;
-    v4 = pValue;
-    return v4 >= pValue;
+    test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8;
+    our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8];
+    if ( !((unsigned __int8)test_bit_value & our_bit_value) )
+      return false;
+    return true;
   }
   if ( VarNum <= VAR_BaseLuck )
   {
@@ -7972,19 +7969,18 @@
           v12 = GetActualAge();
           goto _j_cmp_against_arg;
         case VAR_Award:
-          v13 = 0x80u >> ((signed __int16)a1 - 1) % 8;
-          v14 = this->field_152[((signed __int16)a1 - 1) >> 3];
-          if ( !((unsigned __int8)v13 & v14) )
-            return v4 >= pValue;
-          v4 = pValue;
-          return v4 >= pValue;
+          test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8;
+          our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8];
+          if ( !((unsigned __int8)test_bit_value & our_bit_value) )
+            return true;
+          return false;
         case VAR_Experience:
           v4 = LODWORD(this->uExperience);
           return v4 >= pValue;
         case VAR_QBits_QuestsDone:
-          v13 = 0x80u >> (pValue - 1) % 8;
-          v14 = pParty->_award_bits[(pValue - 1) >> 3];
-          if ( v13 & v14 )
+          test_bit_value = 0x80u >> (pValue - 1) % 8;
+          our_bit_value = pParty->_quest_bits[(pValue - 1)/8];
+          if ( test_bit_value & our_bit_value )
             return true;
           return false;
         case VAR_PlayerItemInHands:
@@ -8441,7 +8437,7 @@
           this->sAgeModifier = a3;
           return;
         case VAR_Award:
-          if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->field_152[((signed __int16)a3 - 1) >> 3])
+          if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->_guilds_member_bits[((signed __int16)a3 - 1) >> 3])
             //&& dword_723E80_award_related[2 * a3] )
 			&& pAwards[a3-1].pText )
           {
@@ -8450,13 +8446,13 @@
             v31 = 1;
             v12->PlaySound(SPEECH_96, 0);
           }
-          v13 = v4->field_152;
+          v13 = v4->_guilds_member_bits;
           goto LABEL_51;
         case VAR_Experience:
           this->uExperience = a3;
           goto LABEL_124;
         case VAR_QBits_QuestsDone:
-          if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_award_bits[((signed __int16)a3 - 1) >> 3])
+          if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_quest_bits[((signed __int16)a3 - 1) >> 3])
            // && (&dword_722F10)[4 * a3] )
 		   && pQuestTable[a3-1] )
           {
@@ -8466,7 +8462,7 @@
             v31 = 1;
             v14->PlaySound(SPEECH_93, 0);
           }
-          v13 = (char *)pParty->_award_bits;
+          v13 = (char *)pParty->_quest_bits;
 LABEL_51:
           _449B7E_toggle_bit((unsigned char *)v13, a3, 1u);
           goto LABEL_168;
@@ -8477,7 +8473,7 @@
           item.uAttributes = 1;
           pParty->SetHoldingItem(&item);
           if ( a3 >= ITEM_ARTIFACT_PUCK && a3 <= ITEM_RELIC_MEKORIGS_HAMMER )
-            pParty->field_3C.pIsArtifactFound[a3] = 1;
+            pParty->pIsArtifactFound[a3-500] = 1;
           return;
         case VAR_FixedGold:
           Party::SetGold(a3);
@@ -8860,7 +8856,7 @@
             case VAR_Award:
               v13 = pPlayers[uPlayerIdx + 1];
               v33 = 0x80u >> ((signed __int16)val - 1) % 8;
-              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->field_152[((signed __int16)val - 1) >> 3])
+              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->_guilds_member_bits[((signed __int16)val - 1) >> 3])
                 //&& dword_723E80_award_related[2 * val] )
 				&& pAwards[val-1].pText )
               {
@@ -8869,7 +8865,7 @@
                 v3 = 1;
                 v14->PlaySound(SPEECH_96, 0);
               }
-              v15 = v4->field_152;
+              v15 = v4->_guilds_member_bits;
               goto LABEL_44;
             case VAR_Experience:
               v16 = __CFADD__(val, LODWORD(Dst->uExperience));
@@ -8879,7 +8875,7 @@
                 Dst->uExperience = 4000000000i64;
               goto _play_anim_and_exit;
             case VAR_QBits_QuestsDone:
-              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_award_bits[((signed __int16)val - 1) >> 3])
+              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_quest_bits[((signed __int16)val - 1) >> 3])
                 //&& (&dword_722F10)[4 * val] )
 				&& pQuestTable[val-1] )
               {
@@ -8889,7 +8885,7 @@
                 v3 = 1;
                 v17->PlaySound(SPEECH_93, 0);
               }
-              v15 = (char *)pParty->_award_bits;
+              v15 = (char *)pParty->_quest_bits;
 LABEL_44:
               _449B7E_toggle_bit((unsigned char *)v15, val, 1u);
               goto LABEL_173;
@@ -8899,7 +8895,7 @@
               item.uAttributes = 1;
               item.uItemID = val;
               if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER )
-                pParty->field_3C.pIsArtifactFound[val] = 1;
+                pParty->pIsArtifactFound[val-500] = 1;
               if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION )
               {
                 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1;
@@ -9487,7 +9483,7 @@
           this->sAgeModifier -= (signed __int16)a3;
           return;
         case VAR_Award:
-          v11 = this->field_152;
+          v11 = this->_guilds_member_bits;
           goto LABEL_112;
         case VAR_Experience:
           v12 = (char *)&this->uExperience;
@@ -9497,7 +9493,7 @@
           *((int *)v12 + 1) -= v14 + HIDWORD(v13);
           goto LABEL_17;
         case VAR_QBits_QuestsDone:
-          _449B7E_toggle_bit(pParty->_award_bits, (__int16)a3, 0);
+          _449B7E_toggle_bit(pParty->_quest_bits, (__int16)a3, 0);
           pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0);
           return;
         case VAR_PlayerItemInHands:
--- a/Player.h	Tue Feb 26 17:24:53 2013 +0600
+++ b/Player.h	Wed Feb 27 02:25:31 2013 +0400
@@ -444,7 +444,7 @@
   void SetVariable(enum VariableType var, signed int a3);
   void AddVariable(enum VariableType var, signed int val);
   void SubtractVariable(enum VariableType var, void *a3);
-  char CompareVariable(enum VariableType VarNum, signed int pValue);
+  bool CompareVariable(enum VariableType VarNum, signed int pValue);
   void UseItem_DrinkPotion_etc(signed int a2, int a3);
   bool AddItem(struct ItemGen *pItem);
   int GetBaseStrength();
@@ -647,7 +647,7 @@
     };
     unsigned __int16 pActiveSkills[37];
   };
-  char field_152[64];
+  char _guilds_member_bits[64];
   PlayerSpells spellbook;
   char field_1F5[30]; // used to be [31]
   ItemGen pInventoryItems[126];
--- a/mm7_1.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/mm7_1.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -3623,7 +3623,7 @@
     --uRestUI_FoodRequiredToRest;
   if ( uRestUI_FoodRequiredToRest < 1 )
     uRestUI_FoodRequiredToRest = 1;
-  if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 98) )
+  if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 98) )
     uRestUI_FoodRequiredToRest = 0;
   ++pIcons_LOD->uTexturePacksCount;
   if ( !pIcons_LOD->uNumPrevLoadedFiles )
@@ -5250,9 +5250,9 @@
         sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName);
         ShowStatusBarString(pTmpBuf2, 2u);
         if ( v22->uItemID == 506 )
-          _449B7E_toggle_bit(pParty->_award_bits, 184, 1u);
+          _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
         if ( v22->uItemID == 455 )
-          _449B7E_toggle_bit(pParty->_award_bits, 185, 1u);
+          _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u);
         if ( !pParty->AddItem(v22) )
           pParty->SetHoldingItem(v22);
       }
--- a/mm7_2.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/mm7_2.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -91,7 +91,7 @@
     v3 = 8 * *((char *)v2 + v1);
     if ( *(&byte_4F09B1[pParty->uDaysPlayed % 7] + v3 * 4) )
     {
-      if ( !dword_4F09CC[v3] || (unsigned __int16)_449B57_test_bit(pParty->_award_bits, LOWORD(dword_4F09CC[v3])) )
+      if ( !dword_4F09CC[v3] || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v3])) )
         break;
     }
     ++v1;
@@ -3659,7 +3659,7 @@
 LABEL_12:
     if ( v0 == 487 )
     {
-      if ( !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) )
+      if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
         v0 = 486;
     }
     v5 = window_SpeakInHouse;
@@ -3757,7 +3757,7 @@
   //v3 = dword_F8B198;
   if ( dword_F8B19C != 1 )
     goto LABEL_13;
-  if ( in_current_bilding_type == BildingType_Training )
+  if ( in_current_building_type == BildingType_Training )
   {
     if ( uMessageParam == 17 )
     {
@@ -3778,9 +3778,9 @@
     goto LABEL_9;
   }
   v8 = window_SpeakInHouse;
-  if ( (in_current_bilding_type == BildingType_Stables || in_current_bilding_type == BildingType_Boats)
+  if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats)
     && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7))
-    || in_current_bilding_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
+    || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
   {
 LABEL_9:
     pDialogueWindow->Release();
@@ -3801,34 +3801,34 @@
   }
 LABEL_11:
   dword_F8B19C = uMessageParam;
-  if ( in_current_bilding_type < BildingType_19 )
-  {
-    v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_bilding_type], TEXTURE_16BIT_PALETTE);
+  if ( in_current_building_type < BildingType_19 )
+  {
+    v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
     //v3 = dword_F8B198;
     dword_F8B164 = &pIcons_LOD->pTextures[v9];
 LABEL_13:
     v8 = window_SpeakInHouse;
   }
-  if ( in_current_bilding_type > BildingType_Tavern )
-  {
-    if ( in_current_bilding_type == BildingType_Bank )
+  if ( in_current_building_type > BildingType_Tavern )
+  {
+    if ( in_current_building_type == BildingType_Bank )
     {
       if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 )
         pKeyActionMap->EnterText(1, 10, v8);
       return;
     }
-    if ( in_current_bilding_type != BildingType_Temple && in_current_bilding_type != BildingType_Training )
+    if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training )
       return;
   }
   else
   {
-    if ( in_current_bilding_type != BildingType_Tavern )
-    {
-      if ( in_current_bilding_type <= (signed int)v1 )
+    if ( in_current_building_type != BildingType_Tavern )
+    {
+      if ( in_current_building_type <= (signed int)v1 )
         return;
-      if ( in_current_bilding_type > BildingType_AlchemistShop )
-      {
-        if ( in_current_bilding_type <= BildingType_16 )
+      if ( in_current_building_type > BildingType_AlchemistShop )
+      {
+        if ( in_current_building_type <= BildingType_16 )
         {
           if ( (signed __int64)__PAIR__(
                                  *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
@@ -3862,7 +3862,7 @@
           }
           return;
         }
-        if ( in_current_bilding_type != BildingType_TownHall )
+        if ( in_current_building_type != BildingType_TownHall )
           return;
         if ( uMessageParam == 99 )
         {
@@ -4078,12 +4078,12 @@
       case 96:
         pDialogueWindow->eWindowType = WINDOW_MainMenu;
         UI_CreateEndConversationButton();
-        FillAviableSkillsToTeach(in_current_bilding_type);
+        FillAviableSkillsToTeach(in_current_building_type);
         break;
       case 101:
         pDialogueWindow->eWindowType = WINDOW_MainMenu;
         UI_CreateEndConversationButton();
-        sub_4B3A72(in_current_bilding_type);
+        sub_4B3A72(in_current_building_type);
         break;
       case 102:
         dword_F8B19C = 102;
@@ -4148,7 +4148,7 @@
                   if ( pParty->uNumGold < v37 )
                   {
                     ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
-                    if ( in_current_bilding_type == BildingType_Training || in_current_bilding_type == BildingType_Tavern )
+                    if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
                       v39 = 4;
                     else
                       v39 = 2;
@@ -4170,7 +4170,7 @@
               {
                 pDialogueWindow->eWindowType = WINDOW_MainMenu;
                 UI_CreateEndConversationButton();
-                sub_4B3AD4(in_current_bilding_type);
+                sub_4B3AD4(in_current_building_type);
               }
             }
           }
@@ -4220,7 +4220,7 @@
       //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
       while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
     }
-    if ( in_current_bilding_type == BildingType_WeaponShop )
+    if ( in_current_building_type == BildingType_WeaponShop )
     {
       v47 = v8->ptr_1C;
       v48 = 0;
@@ -4265,7 +4265,7 @@
       //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
       while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
     }
-    if ( in_current_bilding_type == BildingType_WeaponShop )
+    if ( in_current_building_type == BildingType_WeaponShop )
     {
       v52 = v8->ptr_1C;
       v53 = 0;
@@ -4334,7 +4334,7 @@
         {
           UI_CreateEndConversationButton();
           dword_F8B19C = 94;
-          sub_4B3AD4(in_current_bilding_type);
+          sub_4B3AD4(in_current_building_type);
         }
         else
         {
@@ -4343,13 +4343,13 @@
             pVideoPlayer->_4BF5B2();
 LABEL_28:
             dword_F8B19C = 1;
-            sub_4B3B42(in_current_bilding_type);
+            sub_4B3B42(in_current_building_type);
             return 1;
           }
           pVideoPlayer->_4BF5B2();
           UI_CreateEndConversationButton();
           dword_F8B19C = 101;
-          sub_4B3A72(in_current_bilding_type);
+          sub_4B3A72(in_current_building_type);
         }
         return 1;
       }
@@ -4512,7 +4512,7 @@
           {
             ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
             v13 = window_SpeakInHouse->ptr_1C;
-            if ( in_current_bilding_type == BildingType_Training )
+            if ( in_current_building_type == BildingType_Training )
               v55 = 4;
             else
               v55 = 2;
@@ -5037,7 +5037,7 @@
   pRenderer->EndScene();
   pRenderer->Present();
   pVideoPlayer->pResetflag = 0;
-  _449B57_test_bit(pParty->_award_bits, 99);
+  _449B57_test_bit(pParty->_quest_bits, 99);
   _this.Load("winbg.pcx", 2);
   pRenderer->BeginScene();
   pRenderer->DrawTextureRGB(0, 0, &_this);
@@ -5052,13 +5052,13 @@
   pWindow.uFrameZ = 543;
   pWindow.uFrameW = 397;
   pFont = LoadFont("endgame.fnt", "FONTPAL", NULL);
-  if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 99) )
+  if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 99) )
   {
     v1 = pGlobalTXT_LocalizationStrings[675];
   }
   else
   {
-    result = _449B57_test_bit(pParty->_award_bits, 100);
+    result = _449B57_test_bit(pParty->_quest_bits, 100);
     if ( !(short)result )
       return result;
     v1 = pGlobalTXT_LocalizationStrings[676];
@@ -14954,9 +14954,9 @@
         sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
         ShowStatusBarString(pTmpBuf2, 2u);
         if ( v19->uItemID == 506 )
-          _449B7E_toggle_bit(pParty->_award_bits, 184, 1u);
+          _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
         if ( v19->uItemID == 455 )
-          _449B7E_toggle_bit(pParty->_award_bits, 185, 1u);
+          _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u);
         if ( !pParty->AddItem(v19) )
           pParty->SetHoldingItem(v19);
         v21 = v26;
--- a/mm7_3.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/mm7_3.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -3173,7 +3173,8 @@
     bWaterWalk = 1;
     *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
     if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
-		pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
+		pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster-1].sMana <= 0 )
+		//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
       bWaterWalk = 0;
   }
   v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk);
@@ -7596,26 +7597,26 @@
 
   v1 = 0;
   v2 = this;
-  if ( pParty->uCurrentHour >= 1 || (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 178) )
+  if ( pParty->uCurrentHour >= 1 || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 178) )
   {
     v1 = 0;
   }
   else
   {
-    if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 164)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 165)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 166)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 167)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 168)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 169)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 170)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 171)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 172)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 173)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 174)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 175)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 176)
-      && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 177) )
+    if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 164)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 165)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 166)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 167)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 168)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 169)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 170)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 171)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 172)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 173)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 174)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 175)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 176)
+      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 177) )
     {
       v1 = 1;
       LOBYTE(v2->field_2) &= 0xDFu;
--- a/mm7_4.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/mm7_4.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -4989,7 +4989,7 @@
           case 8:
             v19 = 0;
             v63 = 0;
-            v20 = (unsigned __int8 *)pPlayer->field_152;
+            v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits;
             do
             {
               if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) )
@@ -5258,8 +5258,8 @@
               goto _continue_strncpy;
             if ( v17 - 51 >= 20 )
               goto _continue_strcat;
-            HIDWORD(v49) = pParty->field_3C.field_440[2 * v17 + 1];
-            LODWORD(v49) = pParty->field_3C.field_440[2 * v17];
+            v49 = pParty->field_3C._s_times[v17-51];
+            
             sub_493F79(&v56, v49);
             v54 = v56.field_18_expire_year;
             v53 = v56.field_C_expire_day + 1;
@@ -8938,8 +8938,8 @@
     result = *v8;
     if ( pParty->uFine )
     {
-      v10 = result->field_152;
-      result = (Player *)_449B57_test_bit((unsigned __int8 *)result->field_152, 1);
+      v10 = result->_guilds_member_bits;
+      result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1);
       if ( !(short)result )
         result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u);
     }
@@ -9080,9 +9080,9 @@
   int v18; // [sp+48h] [bp-4h]@5
 
   //v0 = pPlayers[uActiveCharacter];
-  if ( in_current_bilding_type <= 0 )
+  if ( in_current_building_type <= 0 )
     return;
-  if ( in_current_bilding_type <= BildingType_AlchemistShop )
+  if ( in_current_building_type <= BildingType_AlchemistShop )
   {
     if ( dword_F8B19C != 2 )
     {
@@ -9116,7 +9116,7 @@
 		v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
     goto LABEL_15;
   }
-  if ( in_current_bilding_type <= BildingType_16 && dword_F8B19C == BildingType_18 )
+  if ( in_current_building_type <= BildingType_16 && dword_F8B19C == BildingType_18 )
   {
     v1 = pMouse->GetCursorPos(&a2);
     v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y];
@@ -9180,19 +9180,19 @@
   int v6; // esi@20
   int v7[4]; // [sp+Ch] [bp-10h]@12
 
-  if ( in_current_bilding_type > 0 )
+  if ( in_current_building_type > 0 )
   {
     v0 = 3;
-    if ( in_current_bilding_type > BildingType_MagicShop )
-    {
-      if ( in_current_bilding_type == BildingType_Bank )
+    if ( in_current_building_type > BildingType_MagicShop )
+    {
+      if ( in_current_building_type == BildingType_Bank )
       {
         if ( !dword_F8B1E4 )
           return;
       }
       else
       {
-        if ( in_current_bilding_type != BildingType_Temple )
+        if ( in_current_building_type != BildingType_Temple )
           return;
       }
       v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
@@ -9201,7 +9201,7 @@
       return;
     }
     v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
-    if ( (signed __int64)__PAIR__(pParty->field_3C._shop_ban_times[2 * v1 + 1], pParty->field_3C._shop_ban_times[2 * v1]) <= (signed __int64)pParty->uTimePlayed )
+    if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed )
     {
       if ( pParty->uNumGold <= 0x2710 )
       {
@@ -9262,10 +9262,10 @@
 void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2)
 {
   //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) )
-  if ( BYTE1(pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].field_C) )
+  if ( BYTE1(pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uBuildingType) )
     pAudioPlayer->PlaySound(
       //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)),
-      (SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].field_C) + 300)),
+      (SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uBuildingType) + 300)),
       806,
       0,
       -1,
@@ -9292,14 +9292,14 @@
   int v11; // [sp+14h] [bp-4h]@1
   Player *v12; // [sp+14h] [bp-4h]@11
 
-  dword_F8B1A8 = 0;
+  contract_approved = 0;
   v11 = 0;
   uDialogueType = 84;
   ptr_F8B1E8 = (char *)pNPCTopics[667].pText;
   v0 = _4F0882_evt_VAR_PlayerItemInHands_vals;
   while ( 1 )
   {
-    if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, *v0) )
+    if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) )
     {
       v1 = 0;
       v2 = pParty->pPlayers;
@@ -9324,10 +9324,10 @@
   {
 	  ptr_F8B1E8 = (char *)pNPCTopics[666].pText;
 	  v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
-	  dword_F8B1A8 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
+	  contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
 	  pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
   }
-  if ( dword_F8B1A8 == 601 )
+  if ( contract_approved == 601 )
   {
     v5 = 0;
     v12 = pParty->pPlayers;//[0].uClass;
@@ -9498,7 +9498,7 @@
     {
       if ( uMessageParam == 79 )
       {
-        if ( dword_F8B1A8 )
+        if ( contract_approved )
         {
           Party::TakeGold(gold_transaction_amount);
           if ( uActiveCharacter )
@@ -9534,7 +9534,7 @@
       }
       else
       {
-        if ( uMessageParam == 82 && dword_F8B1A8 )
+        if ( uMessageParam == 82 && contract_approved )
         {
           Party::TakeGold(gold_transaction_amount);
           v4 = pParty->pPlayers;
@@ -9694,7 +9694,7 @@
   char *v35; // [sp+28h] [bp-4h]@1
 
   v1 = pPlayers[uActiveCharacter];
-  dword_F8B1A8 = 0;
+  contract_approved = 0;
   v2 = (_this - 200) % 3;
   v3 = (_this - 200) / 3;
   v4 = v2;
@@ -9815,7 +9815,7 @@
           case 20:
             v19 = 110;
 LABEL_57:
-            if ( !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, v19) )
+            if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) )
               return v35;
             goto LABEL_40;
           case 22:
@@ -9957,7 +9957,7 @@
   if ( gold_transaction_amount > pParty->uNumGold )
     return (char *)pNPCTopics[124].pText;
 LABEL_79:
-  dword_F8B1A8 = 1;
+  contract_approved = 1;
   if ( v34 == 2 )
   {
     v27 = gold_transaction_amount;
@@ -9988,12 +9988,12 @@
 //----- (004B29F2) --------------------------------------------------------
 const char *__fastcall ContractSelectText(int pEventNumber)
 {
-  dword_F8B1A8 = 0;
+  contract_approved = 0;
   dword_F8B1AC_something_todo_with_awards = pEventNumber + 50;
-  gold_transaction_amount = dword_4F08EC[pEventNumber];
+  gold_transaction_amount = price_for_membership[pEventNumber];
   if ( pPlayers[uActiveCharacter]->CanAct() )
   {
-    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->field_152, dword_F8B1AC_something_todo_with_awards) )
+    if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_something_todo_with_awards) )
     {
       return pNPCTopics[123].pText;
     }
@@ -10001,18 +10001,18 @@
     {
       if ( gold_transaction_amount <= pParty->uNumGold )
       {
-        dword_F8B1A8 = 1;
+        contract_approved = 1;
         return pNPCTopics[pEventNumber + 110].pText;
       }
       else
       {
-        return pNPCTopics[124].pText;
+        return pNPCTopics[124].pText; 
       }
     }
   }
   else
   {
-    return pNPCTopics[122].pText;
+    return pNPCTopics[122].pText; 
   }
 }
 
@@ -10232,7 +10232,7 @@
             }
             if ( uDialogueType != 84 )
               goto LABEL_49;
-            sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[dword_F8B1A8].pUnidentifiedName);
+            sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
             sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf);
             ptr_F8B1E8 = pTmpBuf2;
             goto LABEL_45;
@@ -10665,7 +10665,7 @@
                  (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0),
                  0);
   pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
-  if ( dword_F8B1A8 )
+  if ( contract_approved )
     v2 = pGlobalTXT_LocalizationStrings[535];
   pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0);
   pDialogueWindow->_41D08F(1, 1, 0, 2);
@@ -10780,7 +10780,7 @@
     pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0);
     if ( pDialogueNPCCount == 1 && dword_591080 )
     {
-      sub_4B3B42(in_current_bilding_type);
+      sub_4B3B42(in_current_building_type);
     }
     else
     {
@@ -12497,8 +12497,8 @@
     return result;
   }
   if ( !(unsigned __int16)_449B57_test_bit(
-                            (unsigned __int8 *)v1->field_152,
-                            word_4F0704[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
+                            (unsigned __int8 *)v1->_guilds_member_bits,
+                            word_4F0704[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
   {
     v36 = pNPCTopics[121].pText;
     v37 = v57;
@@ -13133,7 +13133,7 @@
     pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
     return result; // void func
   }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->field_152, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
+  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
   {
     v24 = pNPCTopics[171].pText;
     v25 = v31;
@@ -13357,7 +13357,7 @@
                                                                         + pParty->uDaysPlayed % 7)),
               v25
            && ((v26 = 8 * (int)v23, !dword_4F09CC[v26])
-            || (unsigned __int16)_449B57_test_bit(pParty->_award_bits, LOWORD(dword_4F09CC[v26])))) )
+            || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v26])))) )
         {
           v58 = v61;
           v27 = (const char *)v56;
@@ -14162,7 +14162,7 @@
   {
     if ( !v23 )
       //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u);
-      pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_0, 1u);
+      pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u);
   }
   else
   {
@@ -14197,7 +14197,7 @@
 LABEL_20:
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)sHouseName);
   //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) )
-  if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_C) )
+  if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uBuildingType) )
     HousePlaySomeSound(v9, 1);
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
     pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
@@ -14247,7 +14247,7 @@
     if ( uExitMapID > 0 )
     {
       //v17 = (unsigned int *)(uExitMapID - 1);
-      if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_award_bits[(uExitMapID - 1) >> 3]) )
+      if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
       {
         //uExitPic = 0;
         uHouse_ExitPic = 0;
@@ -14331,16 +14331,16 @@
 
 
 //----- (0044622E) --------------------------------------------------------
-bool __fastcall EnterHouse(enum HOUSE_ID uHouseID)
+bool  EnterHouse(enum HOUSE_ID uHouseID)
 {
   //enum HOUSE_ID v1; // edi@1
   //int v2; // edi@5
-  unsigned int uOpenTime; // eax@5
-  int uCloseTime; // esi@5
+  signed int uOpenTime; // eax@5
+  signed int uCloseTime; // esi@5
   unsigned int v5; // esi@5
   int v6; // edx@5
-  signed int v7; // ecx@10
-  signed int v8; // eax@10
+  signed int am_pm_flag_open; // ecx@10
+  signed int am_pm_flag_close; // eax@10
   int v9; // esi@10
   //unsigned int v10; // esi@16
   int v11; // ecx@17
@@ -14364,169 +14364,131 @@
   pStatusBarString[0] = 0;
   ShowStatusBarString("", 2u);
   if ( pMessageQueue_50CBD0->uNumMessages )
-    pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+	  pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
   viewparams->bRedrawGameUI = 1;
   uDialogueType = 0;
   pKeyActionMap->_459ED1(3);
   pKeyActionMap->ResetKeys();
   if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
-  {
-    GameOverMenu(0);
-    return 0;
-  }
-  //v2 = 26 * v1;
-  //uOpenTime = p2DEvents_minus1_::uOpenTime[v2];
+	  {
+	  GameOverMenu(0);
+	  return 0;
+	  }
   uOpenTime = p2DEvents[uHouseID - 1].uOpenTime;
-  //uCloseTime = p2DEvents_minus1_::uCloseTime[v2];
   uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
   ptr_F8B1E8 = 0;
-  v24 = uOpenTime;
-  v5 = uCloseTime - 1;
   dword_F8B1E4 = 0;
   dword_F8B1F4 = 0;
-  memset(byte_F8B1F0, 0, 4u);
-  memset(byte_F8B148, 0, 0x10u);
+  memset(byte_F8B1F0, 0, 4);
+  memset(byte_F8B148, 0, 16);
   pRenderer->ClearZBuffer(0, 479);
-  v6 = v24;
-  if ( (signed int)v5 <= (signed int)v24 )
-  {
-    if ( pParty->uCurrentHour >= v24 )
-      goto LABEL_16;
-  }
+  if ( uCloseTime - 1 <= uOpenTime )
+	  {
+	  if ( pParty->uCurrentHour >= uOpenTime )
+		  {
+		  //v10 = uHouseID;
+		  if ( (signed int)uHouseID < 53 )
+			  {
+			  if ( !(pParty->field_3C._shop_ban_times[uHouseID])
+				  ||  (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) )
+				  {
+				  pParty->field_3C._shop_ban_times[uHouseID] = 0;
+
+				  }
+			  else
+				  {
+				  ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!"
+				  return 0;
+				  }
+			  }
+		  if ( !start_event_seq_number )
+			  pAudioPlayer->StopChannels(-1, -1);
+
+		  uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
+		  in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType;
+		  if ( in_current_building_type == BildingType_20 && pParty->uFine )   // going 2 jail
+			  {
+			  uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
+			  uHouseID = HOUSE_JAIL;
+			  pParty->uTimePlayed = pParty->uTimePlayed+ 0x7620000;
+			  in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].uBuildingType;
+			  ++pParty->uNumPrisonTerms;
+			  pParty->uFine = 0;
+			  for (uint i = 0; i < 4; ++i)
+				  {
+				  pParty->pPlayers[i].uTimeToRecovery = 0;
+				  pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
+				  pParty->pPlayers[i].SetVariable(VAR_Award, 87);
+				  }
+			  }
+		  ++pIcons_LOD->uTexturePacksCount;
+		  if ( !pIcons_LOD->uNumPrevLoadedFiles )
+			  pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
+
+		  switch (pParty->alignment)
+			  {
+		  case PartyAlignment_Good:    sprintf(pContainer, "evt%02d-b", const_2()); break;
+		  case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
+		  case PartyAlignment_Evil:    sprintf(pContainer, "evt%02d-c", const_2()); break;
+		  default: assert(false);
+			  }
+
+		  v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+		  pDialogueNPCCount = 0;
+		  pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
+		  uTextureID_507B04 = uTextureID_right_panel;
+		  PrepareHouse(uHouseID);
+		  v18 = 1;
+		  uTextureID_507B04 = uTextureID_right_panel;
+		  if ( uNumDialogueNPCPortraits == 1 )
+			  pDialogueNPCCount = 1;
+		  pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);  
+		  dword_5C35D4 = 1;
+		  if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
+			  {
+			  if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) )
+				  {
+				  return 1;
+				  }
+			  }
+		  else
+			  { //guilds
+			  v19 = word_4F0704[uHouseID-139] - 1; //some gild flag check
+			  //v20 = uHouseID;
+			  if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
+				  {
+				  HousePlaySomeSound(uHouseID, 3);
+				  return 1;
+				  }
+			  }
+		  HousePlaySomeSound(uHouseID, 1);
+		  dword_5C35D4 = 1;
+		  return 1;
+		  }
+	  }
   else
-  {
-    if ( pParty->uCurrentHour < v24 )
-    {
-LABEL_10:
-      v7 = 0;
-      v8 = 0;
-      v9 = v5 + 1;
-      if ( (signed int)v24 > 12 )
-      {
-        v6 = v24 - 12;
-        v7 = 1;
-      }
-      if ( v9 > 12 )
-      {
-        v9 -= 12;
-        v8 = 1;
-      }
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], v6, aAMPMNames[v7], v9, aAMPMNames[v8]);
-      ShowStatusBarString(pTmpBuf, 2u);
-      if ( uActiveCharacter )
-        pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0);
-      return 0;
-    }
-  }
-  if ( pParty->uCurrentHour > v5 )
-    goto LABEL_10;
-LABEL_16:
-  //v10 = uHouseID;
-  if ( (signed int)uHouseID >= 53 )
-    goto LABEL_21;
-  v11 = pParty->field_3C._shop_ban_times[2 * uHouseID + 1];
-  if ( !(v11 | pParty->field_3C._shop_ban_times[2 * uHouseID])
-    || (signed __int64)__PAIR__(v11, pParty->field_3C._shop_ban_times[2 * uHouseID]) <= (signed __int64)pParty->uTimePlayed )
-  {
-    pParty->field_3C._shop_ban_times[2 * uHouseID] = 0;
-    pParty->field_3C._shop_ban_times[2 * uHouseID + 1] = 0;
-LABEL_21:
-    if ( !start_event_seq_number )
-      pAudioPlayer->StopChannels(-1, -1);
-    //uCurrentHouse_Animation = p2DEvents_minus1___02[v2];
-    uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
-    in_current_bilding_type = LOBYTE(pAnimatedRooms[uCurrentHouse_Animation].field_C);
-    if ( in_current_bilding_type == BildingType_20 && pParty->uFine )   // going 2 jail
-    {
-      uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
-      //v25 = HOUSE_187;
-      uHouseID = HOUSE_JAIL;
-      v12 = LODWORD(pParty->uTimePlayed);
-      LODWORD(pParty->uTimePlayed) += 0x7620000u;
-      v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].field_C);
-      pParty->uTimePlayed = __PAIR__(HIDWORD(pParty->uTimePlayed), v12) + 0x7620000;
-      in_current_bilding_type = v14;
-      //v13 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay;
-      //do
-      ++pParty->uNumPrisonTerms;
-      pParty->uFine = 0;
-      for (uint i = 0; i < 4; ++i)
-      {
-        pParty->pPlayers[i].uTimeToRecovery = 0;
-        pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
-        pParty->pPlayers[i].SetVariable(VAR_Award, 87);
-		//v13->uTimeToRecovery = 0;
-		//memset(&v13->uTimeToRecovery, 0, 4u);
-        //++v13;
-      }
-      //while ( v13 <= &pParty->pPlayers[3] );
-      /*v15 = pParty->pPlayers;
-      do
-      {
-        ++v15;
-      }
-      while ( v15 <= &pParty->pPlayers[3] );*/
-      //v10 = v25;
-    }
-    ++pIcons_LOD->uTexturePacksCount;
-    if ( !pIcons_LOD->uNumPrevLoadedFiles )
-      pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-
-    /*v16 = const_2();
-    sprintf(pContainer, "evt%02d", v16);
-    if ( pParty->uAlignment )
-    {
-      if ( pParty->uAlignment != 2 )
-        goto LABEL_37;
-      v22 = "-c";
-    }
-    else
-    {
-      v22 = "-b";
-    }
-    strcat(pContainer, v22);*/
-//LABEL_37:
-    switch (pParty->alignment)
-    {
-      case PartyAlignment_Good:    sprintf(pContainer, "evt%02d-b", const_2()); break;
-      case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break;
-      case PartyAlignment_Evil:    sprintf(pContainer, "evt%02d-c", const_2()); break;
-      default: assert(false);
-    }
-
-    v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    pDialogueNPCCount = 0;
-    pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
-    uTextureID_507B04 = uTextureID_right_panel;
-    PrepareHouse(uHouseID);
-    v18 = 1;
-    uTextureID_507B04 = uTextureID_right_panel;
-    if ( uNumDialogueNPCPortraits == 1 )
-      pDialogueNPCCount = 1;
-    pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
-    if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
-    {
-      if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) )
-        goto LABEL_49;
-      //v20 = uHouseID;
-    }
-    else
-    {
-      v19 = word_4F0704[2 * uHouseID] - 1;
-      //v20 = uHouseID;
-      if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->field_152[v19 >> 3]) )
-      {
-        HousePlaySomeSound(uHouseID, 3);
-        v18 = 1;
-LABEL_49:
-        dword_5C35D4 = v18;
-        return v18;
-      }
-      v18 = 1;
-    }
-    HousePlaySomeSound(uHouseID, v18);
-    goto LABEL_49;
-  }
-  ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!"
-  return 0;
-}
+	  {
+	  if (( pParty->uCurrentHour < uOpenTime)||( pParty->uCurrentHour > uCloseTime - 1 ))
+		  {
+		  am_pm_flag_open = 0;
+		  am_pm_flag_close = 0;
+		  if (uOpenTime > 12 )
+			  {
+			  uOpenTime -= 12;
+			  am_pm_flag_open = 1;
+			  }
+		  if ( uCloseTime > 12 )
+			  {
+			  uCloseTime -= 12;
+			  am_pm_flag_close = 1;
+			  }
+		  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], 
+			  uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s"
+		  ShowStatusBarString(pTmpBuf, 2u);
+		  if ( uActiveCharacter )
+			  pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0);
+		  return 0;
+		  }
+	  }
+
+}
--- a/mm7_5.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/mm7_5.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -2159,7 +2159,7 @@
           {
             v63 = 206;
           }
-          if ( !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, v63) )
+          if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) )
             return;
           goto LABEL_486;
         case UIMSG_B6:
@@ -2227,7 +2227,7 @@
           {
             v68 = 206;
           }
-          if ( !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, v68) )
+          if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) )
           {
             pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar);
             continue;
@@ -12093,9 +12093,9 @@
     v8 = 1;
   if ( !_strcmpi(pCurrentMapName, "d26.blv") )
     v6 = 1;
-  if (_449B57_test_bit(pParty->_award_bits, 99))
+  if (_449B57_test_bit(pParty->_quest_bits, 99))
     v7 = 1;
-  if (_449B57_test_bit(pParty->_award_bits, 100))
+  if (_449B57_test_bit(pParty->_quest_bits, 100))
     v5 = 1;
 
   Log::Warning(L"%S %S %u", __FILE__, __FUNCTION__, __LINE__); // ai_near_actors_targets_pid[i] for AI_Stand seems always 0;  original code behaviour is identical
@@ -13152,7 +13152,7 @@
     {
       v1 = 206;
 LABEL_14:
-      if ( !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, v1) )
+      if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v1) )
         goto LABEL_16;
       goto LABEL_15;
     }
@@ -13199,7 +13199,7 @@
   {
     v4 = 206;
 LABEL_30:
-    if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, v4) )
+    if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) )
       goto LABEL_31;
     return v6.DrawTitleText(pBook2Font, 0, 22u, 0, pGlobalTXT_LocalizationStrings[10], 3u);
   }
@@ -13421,7 +13421,7 @@
   {
     do
     {
-      if ( *(&v0->field_152[v1 + 63] + v4) )
+      if ( *(&v0->_guilds_member_bits[v1 + 63] + v4) )
       {
         v5 = (Texture *)dword_506408[v4];
         if ( v5 != v3 )
@@ -13679,7 +13679,7 @@
          0,
          0,
          0,
-         (__int64 *)&pParty->field_3C.field_440[2 * v6 + 42]);
+         (__int64 *)&pParty->field_3C._s_times[ v6 + 21]);
   if ( v7 )
   {
     v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]);
@@ -13779,7 +13779,7 @@
     v7 = a1.uFrameY + v6;
     if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight )
       break;
-    pRenderer->DrawTextureTransparent(0x64u, v7 + 12, pTextures_5064A0[10]);
+    pRenderer->DrawTextureTransparent(100, v7 + 12, pTextures_5064A0[10]);
     ++v3;
     a1.uFrameY = v7 + 24;
   }
@@ -15528,16 +15528,14 @@
         v10 = window_SpeakInHouse->ptr_1C;
         if ( (signed int)v10 >= 53 )
           continue;
-        v11 = pParty->field_3C._shop_ban_times[2 * (_DWORD)v10 + 1];
-        if ( !__PAIR__(v11, pParty->field_3C._shop_ban_times[2 * (_DWORD)v10])
-          || v11 < SHIDWORD(pParty->uTimePlayed)
-          || v11 <= SHIDWORD(pParty->uTimePlayed)
-          && (unsigned int)pParty->field_3C._shop_ban_times[2 * (_DWORD)v10] <= LODWORD(pParty->uTimePlayed) )
+        if ( pParty->field_3C._shop_ban_times[(signed int)v10] <=pParty->uTimePlayed )
         {
           if ( (signed int)v10 < 53 )
           {
-            pParty->field_3C._shop_ban_times[2 * (_DWORD)v10] = 0;
-            pParty->field_3C._shop_ban_times[2 * (_DWORD)v10 + 1] = 0;
+
+
+              pParty->field_3C._shop_ban_times[(signed int)v10] = 0;
+ 
           }
           continue;
         }
@@ -17700,7 +17698,7 @@
   dword_506520 = 0;
   dword_50651C = 0;
   dword_506528 = 0;
-  v2 = (unsigned __int8 *)pPlayer->field_152;
+  v2 = (unsigned __int8 *)pPlayer->_guilds_member_bits;
   do
   {
     v13 = (char *)pAwards[v1-1].pText;//dword_723E80_award_related[2 * v1];
--- a/mm7_data.cpp	Tue Feb 26 17:24:53 2013 +0600
+++ b/mm7_data.cpp	Wed Feb 27 02:25:31 2013 +0400
@@ -1663,7 +1663,10 @@
 
 //__int16 word_4F063E[290];
 //__int16 word_4F06D8[22];
-__int16 word_4F0704[40];
+int word_4F0704[32]={
+   54, 54, 54, 54, 52, 52, 52, 52, 55, 55, 55, 55, 53, 53,
+	   53, 53, 58, 58, 58, 58, 57, 57, 57, 57, 56, 56,
+	   56, 56, 59, 59, 60, 60};
 __int16 word_4F0754[49];
 //__int16 word_4F07B6[88];
 __int16 word_4F0866[14];
@@ -1677,7 +1680,7 @@
 	0x0EB, 0x25C, 0x0EC, 0x25D, 0x0ED, 0x259, 0x0F1, 0x21E
 }
 ;
-int dword_4F08EC[777]; // weak
+int price_for_membership[777]; // weak
 char byte_4F09B0[777]; // weak
 char byte_4F09B1[777]; // weak
 char byte_4F09B8[777]; // weak
@@ -2341,11 +2344,11 @@
 __int16 word_F8B158[777]; // weak
 struct Texture *dword_F8B164; // idb
 struct Texture *ItemsInShopTexture[12];
-int in_current_bilding_type; // 0xF8B198
+int in_current_building_type; // 0xF8B198
 int dword_F8B19C; // weak
 __int16 word_F8B1A0; // weak
 const char *dword_F8B1A4; // idb
-int dword_F8B1A8; // weak
+int contract_approved; // weak
 int dword_F8B1AC_something_todo_with_awards; // idb
 int dword_F8B1B0; // weak
 int gold_transaction_amount; // F8B1B4
--- a/mm7_data.h	Tue Feb 26 17:24:53 2013 +0600
+++ b/mm7_data.h	Wed Feb 27 02:25:31 2013 +0400
@@ -1008,12 +1008,12 @@
 extern char uItemsAmountPerShopType[]; // weak
 //extern __int16 word_4F063E[290];
 //extern __int16 word_4F06D8[22];
-extern __int16 word_4F0704[40];
+extern int word_4F0704[32];
 extern __int16 word_4F0754[49];
 //extern __int16 word_4F07B6[88];
 extern __int16 word_4F0866[14];
 extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54];
-extern int dword_4F08EC[]; // weak
+extern int price_for_membership[]; // weak
 extern char byte_4F09B0[]; // weak
 extern char byte_4F09B1[]; // weak
 extern char byte_4F09B8[]; // weak
@@ -1686,11 +1686,11 @@
 extern __int16 word_F8B158[]; // weak
 extern struct Texture *dword_F8B164; // idb
 extern struct Texture *ItemsInShopTexture[12];
-extern int in_current_bilding_type; // weak
+extern int in_current_building_type; // weak
 extern int dword_F8B19C; // weak
 extern __int16 word_F8B1A0; // weak
 extern const char *dword_F8B1A4; // idb
-extern int dword_F8B1A8; // weak
+extern int contract_approved; // weak
 extern int dword_F8B1AC_something_todo_with_awards; // idb
 extern int dword_F8B1B0; // weak
 extern int gold_transaction_amount; // F8B1B4
@@ -2026,7 +2026,7 @@
 int __fastcall sub_445C8B(signed int a1);
 void __cdecl sub_44603D();
 void PrepareHouse(enum HOUSE_ID house); // idb
-bool __fastcall EnterHouse(enum HOUSE_ID uHouseID);
+bool  EnterHouse(enum HOUSE_ID uHouseID);
 int sub_4465DF_check_season(int a1);
 int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb
 // void __cdecl crt_construct_5773C4();
--- a/stru159.h	Tue Feb 26 17:24:53 2013 +0600
+++ b/stru159.h	Wed Feb 27 02:25:31 2013 +0400
@@ -6,10 +6,10 @@
 #pragma pack(push, 1)
 struct stru159
 {
-  char *field_0;
+  char *video_name;
   int field_4;
   int field_8;
-  int field_C;
+  int uBuildingType;
 };
 #pragma pack(pop)
 extern stru159 pAnimatedRooms[196];
\ No newline at end of file