diff mm7_4.cpp @ 484:4bd56919f075

avard quest guild bits
author Gloval
date Wed, 27 Feb 2013 02:25:31 +0400
parents 5b6e2021c6fe
children d5da524ec901 a3939d5067c4 00ce82758c72
line wrap: on
line diff
--- 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;
+		  }
+	  }
+
+}