changeset 874:231523a39203

Buy books(first)
author Ritor1
date Mon, 01 Apr 2013 17:37:32 +0600
parents aa0172fd88c6
children b7246c149957
files GUIWindow.cpp UIHouses.cpp UIHouses.h mm7_2.cpp mm7_4.cpp
diffstat 5 files changed, 37 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Mon Apr 01 16:28:10 2013 +0600
+++ b/GUIWindow.cpp	Mon Apr 01 17:37:32 2013 +0600
@@ -1028,12 +1028,7 @@
   int v8; // edi@46
   int v9; // eax@50
   unsigned int v10; // [sp-10h] [bp-C8h]@53
-  //unsigned __int16 v11; // [sp-Ch] [bp-C4h]@53
-  //unsigned int v12; // [sp-Ch] [bp-C4h]@60
   char *pTitleText; // [sp-8h] [bp-C0h]@50
-  //unsigned int v14; // [sp-8h] [bp-C0h]@60
-  //unsigned int v15; // [sp-4h] [bp-BCh]@50
-  //Texture *v16; // [sp-4h] [bp-BCh]@60
   GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4
   GUIWindow pWindow; // [sp+60h] [bp-58h]@2
   int pColor2; // [sp+B4h] [bp-4h]@2
@@ -1051,10 +1046,7 @@
   {
     pDialogWindow.uFrameWidth = 130;
     pDialogWindow.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight);
-
-    //v2 = (const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C];
     pHouseName = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName;
-
     if ( pHouseName )
     {
       v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(pHouseName, &pDialogWindow, 0, 0);
@@ -1108,24 +1100,16 @@
       }
       return;
     }
-    //v8 = 0;
-    //while ( 1 )
     for ( v8 = 0; v8 < uNumDialogueNPCPortraits; ++v8 )
     {
-      //pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
-      //                              *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4,
       pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4,
-                                    pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); // frame around portrait
-      //pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6),
-      //  *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6), pDialogueNPCPortraits[v8]);
+                                    pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]);
       pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8],
                                     pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8], pDialogueNPCPortraits[v8]);
       if ( uNumDialogueNPCPortraits < 4 )
-        //break;
       {
         if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
         {
-          //v15 = 3;
           pTitleText = pMapStats->pInfos[uHouse_ExitPic].pName;
           v9 = 94 * v8 + 113;
         }
@@ -1133,27 +1117,17 @@
         {
           if ( !v8 && dword_591080 )
           {
-            //v15 = 3;
-            //v13 = (char *)p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C];
             pTitleText = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle;
             pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, pTitleText, 3);
-            //goto LABEL_57;
             continue;
           }
-          //v15 = 3;
           pTitleText = HouseNPCData[v8 - (dword_591080 != 0)]->pName;
           v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
         }
-        //v11 = pColor2;
         v10 = v9;
         pWindow.DrawTitleText(pFontCreate, 0x1E3u, v10, pColor2, pTitleText, 3);
-        //goto LABEL_57;
       }
-	}
-//LABEL_57:
-    //++v8;
-    //if ( v8 >= uNumDialogueNPCPortraits )
-    //{
+    }
       if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
       {
         pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
@@ -1164,8 +1138,6 @@
         pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
       }
       return;
-      //}
-    //}
   }
   v4 = (char *)pDialogueNPCCount - 1;
   pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]);
@@ -1260,7 +1232,6 @@
   }
 }
 
-
 //----- (004B1854) --------------------------------------------------------
 void GUIWindow::DrawCurrentTime( __int64 a2 )
 	{
@@ -1962,33 +1933,29 @@
     v26 = 0;
     if ( uNumDialogueNPCPortraits > 0 )
     {
-      //do
       for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 )
       {
-        //uWidtha = v26 + 1;
         if ( v26 + 1 == v25 && uHouse_ExitPic )
         {
           v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
-          v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];//Войти в ^Pv[%s]
+          v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];
         }
         else
         {
           if ( v26 || !dword_591080 )
-            v27 = HouseNPCData[v26 - (dword_591080 != 0)]->pName;//problem in Harmondale tavern(v26 == 0)
+            v27 = HouseNPCData[v26 - (dword_591080 != 0)]->pName;
           else
             //v27 = (char *)p2DEvents_minus1_::08[13 * a4];
             v27 = (char *)p2DEvents[pButton - 1].pProprieterName;
           v30 = v27;
-          v29 = (char*)pGlobalTXT_LocalizationStrings[435];// "Converse with %s" Побеседовать с ^Pt[%s]
+          v29 = (char*)pGlobalTXT_LocalizationStrings[435];
         }
         sprintfex(byte_591180[v26], v29, v30);
         HouseNPCData[v26 + 7] = (NPCData *)pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
                                                                  pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26],
                                              0x3Fu, 0x49u, 1, 0, UIMSG_19A, v26, 0, byte_591180[v26], 0, 0, 0);
-        //++v26;
         v25 = uNumDialogueNPCPortraits;
       }
-      //while ( uWidtha < uNumDialogueNPCPortraits );
     }
     if ( v25 == 1 )
     {
--- a/UIHouses.cpp	Mon Apr 01 16:28:10 2013 +0600
+++ b/UIHouses.cpp	Mon Apr 01 17:37:32 2013 +0600
@@ -4595,7 +4595,7 @@
     void GuildDialog()
         {
         GUIWindow *v0; // ebx@1
-        Player *currPlayer; // edi@1
+        //Player *currPlayer; // edi@1
         signed int base_teach_price; // ebx@1
         int v3; // edi@6
         int result; // eax@11
@@ -4652,17 +4652,17 @@
         int v55; // [sp+2C8h] [bp-24h]@47
         int main_text_color; // [sp+2CCh] [bp-20h]@1
         int hi_text_color; // [sp+2D0h] [bp-1Ch]@1
-        Player *v58; // [sp+2D4h] [bp-18h]@1
+        //Player *v58; // [sp+2D4h] [bp-18h]@1
         unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
         char *Str; // [sp+2DCh] [bp-10h]@35
         int v61; // [sp+2E0h] [bp-Ch]@35
         unsigned int v62; // [sp+2E4h] [bp-8h]@13
         int v63; // [sp+2E8h] [bp-4h]@1
 
-        v0 = window_SpeakInHouse;
+        v0 = window_SpeakInHouse;//Ritor1: in process
         memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
-        v58 = pPlayers[uActiveCharacter];
-        currPlayer = v58;
+        //v58 = pPlayers[uActiveCharacter];
+        //currPlayer = pPlayers[uActiveCharacter];
         working_window.uFrameX = 483;
         working_window.uFrameWidth = 148;
         working_window.uFrameZ = 334;
@@ -4670,7 +4670,7 @@
         hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
         //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0);
         base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0);
-        v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100;
+        v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
         if ( v63 < base_teach_price / 3 )
             v63 = base_teach_price / 3;
         strcpy(Dest, "");
@@ -4680,12 +4680,12 @@
         strcpy(v49, "");
         if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
             {
-            if ( dialog_menu_id != HOUSE_DIALOGUE_GULD_BUY_BOOKS ) //buy skill
+            if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
                 {
                 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
                     {
                     //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill
-                    if ( v58->pActiveSkills[dialog_menu_id-36] )
+                    if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
                         {
                         sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
                         ShowStatusBarString(pTmpBuf, 2u);
@@ -4701,7 +4701,7 @@
                         else
                             {
                             Party::TakeGold(v63);
-                            v58->pActiveSkills[dialog_menu_id-36] = 1;
+                            pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
                             }
                         }
                     }
@@ -4721,7 +4721,7 @@
                     {
                     pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
                     ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
-                    currPlayer = v58;
+                    //currPlayer = v58;
                     }
                 v63 += 70;
                 v62 += 280;
@@ -4739,7 +4739,7 @@
                         {
                         pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
                         ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
-                        currPlayer = v58;
+                        //currPlayer = v58;
                         }
                     v63 += 70;
                     v62 += 280;
@@ -4785,7 +4785,7 @@
                                 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
                                 v16 = (int)window_SpeakInHouse->ptr_1C;
                                 uPlayerID = uActiveCharacter - 1;
-                                v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16,  2);
+                                v17 = pPlayers[uActiveCharacter]->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16,  2);
                                 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);     
                                 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
                                 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138,  main_text_color, v18, 3);
@@ -4795,7 +4795,7 @@
                     return;
             }
         if ( !(unsigned __int16)_449B57_test_bit(
-            (unsigned __int8 *)currPlayer->_guilds_member_bits,
+            (unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits,
             guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
             { //you must me member
             v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
@@ -4834,7 +4834,7 @@
             else
                 {
 
-                if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36]))
+                if((byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23-36])&&(pPlayers[uActiveCharacter]->pActiveSkills[v23-36]))
                     // or
                     //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
                     {
@@ -4850,7 +4850,7 @@
             if ( !v61 )
                 {
 LABEL_64:
-                sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s"	
+                sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
                 strcat(pTmpBuf, "\n \n");
                 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
                 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
@@ -4882,7 +4882,7 @@
                     //  __debugbreak();
                     //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
                     // or
-                    if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36]))
+                    if ((byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36])&&(pPlayers[uActiveCharacter]->pActiveSkills[v29-36]))
                         // or
                         //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
 
--- a/UIHouses.h	Mon Apr 01 16:28:10 2013 +0600
+++ b/UIHouses.h	Mon Apr 01 17:37:32 2013 +0600
@@ -21,7 +21,7 @@
   HOUSE_DIALOGUE_TAVERN_REST = 15,
   HOUSE_DIALOGUE_TAVERN_BUY_FOOD = 16,
   HOUSE_DIALOGUE_TRAININGHALL_TRAIN = 17,
-  HOUSE_DIALOGUE_GULD_BUY_BOOKS = 18,
+  HOUSE_DIALOGUE_GUILD_BUY_BOOKS = 18,
   //...
   HOUSE_DIALOGUE_GUILD_LEARN_SKILL = 72,
   //...
--- a/mm7_2.cpp	Mon Apr 01 16:28:10 2013 +0600
+++ b/mm7_2.cpp	Mon Apr 01 17:37:32 2013 +0600
@@ -1006,35 +1006,26 @@
   }
   if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
   {
-    v56 = 0;
-    v52 = 0;
-    v50 = 0;
-    v49 = 0;
-    v48 = -1;
-    v47 = 0;
-    v46 = 0;
-    pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
+    pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
     return;
   }
 
   switch(dialog_menu_id)
   {
-	case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
-		{
-			pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-			sub_421EA6_OnInventoryLeftClick();
-			break;
-		}
-	case HOUSE_DIALOGUE_GULD_BUY_BOOKS:
-		{
+    case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
+    {
+      pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
+      sub_421EA6_OnInventoryLeftClick();
+      break;
+    }
+    case HOUSE_DIALOGUE_GUILD_BUY_BOOKS://Ritor1: in process
+    {
 		v17 = pMouse->GetCursorPos(&v63);
 		v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF;
 		if ( !v18 )
 			return;
-		v19 = window_SpeakInHouse->ptr_1C;
-		v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)v19));
-		//v21 = p2DEvents_minus1__20[13 * (signed int)v19];
-		v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier;
+		v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C));
+		v21 = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
 		_this = v20;
 		v22 = v20->GetValue();
 		v23 = v0->GetBuyingPrice(v22, v21);
@@ -1043,7 +1034,6 @@
 		if ( pParty->uNumGold < v23 )
 		{
 			v24 = 2;
-	//LABEL_62:
 			PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24);
 			v9 = pGlobalTXT_LocalizationStrings[155];
 			v54 = 2;
@@ -1062,16 +1052,11 @@
 			_this->Reset();
 			pRenderer->ClearZBuffer(0, 479);
 			v27 = v77;
-			v53 = 0;
-			v51 = SPEECH_75;
-			v27->PlaySound((PlayerSpeech)v51, v53);
+			v27->PlaySound((PlayerSpeech)SPEECH_75, 0);
 			return;
 		}
 		v0->PlaySound(SPEECH_NoRoom, 0);
-		v54 = 5;
-	//LABEL_70:
-		v9 = pGlobalTXT_LocalizationStrings[563];   // "Pack is Full!"
-		ShowStatusBarString(v9, v54);
+		ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5);  // "Pack is Full!"
 		break;
 		}
 
@@ -1341,7 +1326,7 @@
 		break;
 		}
 
-	default:
+	default:// if click video screen in shop
 		{
           __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU  enum
 		if( dialog_menu_id >= 36 && dialog_menu_id <= 72 )
--- a/mm7_4.cpp	Mon Apr 01 16:28:10 2013 +0600
+++ b/mm7_4.cpp	Mon Apr 01 17:37:32 2013 +0600
@@ -6326,7 +6326,7 @@
 		v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
     goto LABEL_15;
   }
-  if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GULD_BUY_BOOKS )
+  if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS )
   {
     v1 = pMouse->GetCursorPos(&a2);
     v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y];