diff UIHouses.cpp @ 907:f3ccfc765502

RentRoom
author Ritor1
date Sun, 21 Apr 2013 19:22:42 +0600
parents 23655ae9cd18
children 8cd0b155bebe 645b5fbfce6b
line wrap: on
line diff
--- a/UIHouses.cpp	Fri Apr 19 18:11:28 2013 +0600
+++ b/UIHouses.cpp	Sun Apr 21 19:22:42 2013 +0600
@@ -2597,7 +2597,7 @@
       if ( pParty->uNumGold >= (unsigned int)pOutString )
       {
         Party::TakeGold((unsigned int)pOutString);
-        v27 = (int)window_SpeakInHouse->ptr_1C;
+        v27 = (int)window_SpeakInHouse->ptr_1C;//107
         PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
         dialog_menu_id = HOUSE_DIALOGUE_NULL;
         sub_4BD8B5();
@@ -2607,7 +2607,7 @@
         window_SpeakInHouse = 0;
         if ( pMessageQueue_50CBD0->uNumMessages )
           pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-        pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_OpenRestUI;
+        pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom;
         pMessageQueue_50CBD0->pMessages[0].param = v27;
         pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
         ++pMessageQueue_50CBD0->uNumMessages;
@@ -3896,7 +3896,6 @@
   int v33; // eax@34
   int v35; // eax@35
   char *v36; // edx@36
-  GUIWindow *v37; // edi@42
   signed int v38; // esi@42
   unsigned int v39; // esi@44
   int v40; // eax@44
@@ -4137,7 +4136,6 @@
       pItemCount = 0;
       do
       {
-        // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
         if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
         ++pItemCount;
         ++v68;
@@ -4158,7 +4156,7 @@
         if ( dialog_menu_id == 2 )
           selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
         else
-          selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
+          selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1];
         if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
           v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
         else
@@ -4221,7 +4219,7 @@
          pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 
          || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) )
            return;
-      v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10-1];
+      v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10 - 1];
       v13 = pPlayers[uActiveCharacter]->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3);
       v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)];
       v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0);
@@ -4352,20 +4350,18 @@
       if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
         return;
       v152 = 0;
-      v37 = pDialogueWindow;
-      //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
       v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
       pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
       if ( (signed int)pActiveButton < v38 / 3 )
         pActiveButton = v38 / 3;
-      v39 = v37->pStartingPosActiveItem;
-      v40 = v37->pNumPresenceButton;
+      v39 = pDialogueWindow->pStartingPosActiveItem;
+      v40 = pDialogueWindow->pNumPresenceButton;
       v153 = 0;
       if ( (signed int)v39 < (signed int)(v39 + v40) )
       {
         do
         {
-          v41 = v37->GetControl(v39)->msg_param - 36;
+          v41 = pDialogueWindow->GetControl(v39)->msg_param - 36;
           if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] )
           {
             v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
@@ -4374,7 +4370,7 @@
           }
           ++v39;
         }
-        while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
+        while ( (signed int)v39 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
         if ( v153 )
         {
           sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pActiveButton);
@@ -4383,14 +4379,14 @@
           if ( (149 - v152) / v153 > 32 )
             pActiveButton = 32;
           v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162;
-          v152 = v37->pStartingPosActiveItem;
+          v152 = pDialogueWindow->pStartingPosActiveItem;
           v146 = v43;
-          if ( v152 < v152 + v37->pNumPresenceButton )
+          if ( v152 < v152 + pDialogueWindow->pNumPresenceButton )
           {
             v153 = 2;
             do
             {
-              pButton = v37->GetControl(v152);
+              pButton = pDialogueWindow->GetControl(v152);
               v46 = pButton->msg_param - 36;
               if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] )
               {
@@ -4412,9 +4408,9 @@
                   pTextColor = pWhiteColor;
                 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3);
               }
-              v53 = v37->pStartingPosActiveItem;
+              v53 = pDialogueWindow->pStartingPosActiveItem;
               ++v152;
-              textureH = v37->pNumPresenceButton + v53;
+              textureH = pDialogueWindow->pNumPresenceButton + v53;
               ++v153;
             }
             while ( v152 < textureH );
@@ -4518,7 +4514,6 @@
     {
       if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
       {
-        //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill
         if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
         {
           sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
@@ -4549,11 +4544,9 @@
     do
     {
       if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID)
-                   // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
       {
         pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
         ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
-                   //currPlayer = v58;
       }
       v63 += 70;
       v62 += 280;
@@ -5927,7 +5920,7 @@
       return;
     }
   }
-  pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
+  pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
   v3 = 0;
   v49 = 0;
   v122 = 0;
@@ -5935,8 +5928,7 @@
   {
     do
     {
-     // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
-	 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
+      if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
       {
         v50 = ItemsInShopTexture[v49];
         v51 = 152 - v50->uTextureHeight;
@@ -5968,8 +5960,7 @@
     v122 = 0;
     do
     {
-      //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
-	if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID)
+      if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 1].uItemID)
       {
         v54 = ItemsInShopTexture[v122 + 6];
         v55 = 306 - v54->uTextureHeight;
@@ -6113,32 +6104,17 @@
       v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
       v117 = v71;
       v72 = (int)window_SpeakInHouse->ptr_1C;
-     // v73 = 9 * (v71 + 12 * v72);
       v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71];
       if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
-       // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
-	      v74 =&pParty->SpecialItemsInShops[v72][v71];
+        v74 =&pParty->SpecialItemsInShops[v72][v71];
       if ( v67 && Str )
-      {
         v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
-        v96 = 0;
-        v94 = 2;
-        v93 = window_SpeakInHouse->ptr_1C;
-        v90 = v74;
-        v9 = uActiveCharacter - 1;
-      }
       else
       {
-        v96 = 0;
-        v94 = 2;
-        v93 = window_SpeakInHouse->ptr_1C;
-        v90 = v74;
-        uPlayerID = uActiveCharacter - 1;
         v75 = _this->_490EEE(v74, 3, v72, 2);
-        v9 = uPlayerID;
         v10 = (char *)pMerchantsBuyPhrases[v75];
       }
-      v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
+      v30 = BuilDialogueString(v10, uActiveCharacter - 1, v74, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
       v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
       dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3);
       return;