diff mm7_4.cpp @ 495:90fdb47bfcba

guilds ...
author Gloval
date Thu, 28 Feb 2013 21:45:39 +0400
parents af286cec8967
children 0e20e886365d
line wrap: on
line diff
--- a/mm7_4.cpp	Thu Feb 28 18:18:52 2013 +0400
+++ b/mm7_4.cpp	Thu Feb 28 21:45:39 2013 +0400
@@ -9262,17 +9262,11 @@
 void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2)
 {
   //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) )
-  if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].field_d )
+  if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId )
     pAudioPlayer->PlaySound(
       //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)),
-      (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].field_d) + 300),
-      806,
-      0,
-      -1,
-      0,
-      0,
-      0,
-      0);
+      (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId) + 300),
+      806, 0, -1, 0, 0, 0, 0);
 }
 
 //----- (004B1ECE) --------------------------------------------------------
@@ -12276,7 +12270,7 @@
 void GuildDialog()
 {
   GUIWindow *v0; // ebx@1
-  Player *v1; // edi@1
+  Player *currPlayer; // edi@1
   signed int base_teach_price; // ebx@1
   int v3; // edi@6
   int result; // eax@11
@@ -12343,7 +12337,7 @@
   v0 = window_SpeakInHouse;
   memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
   v58 = pPlayers[uActiveCharacter];
-  v1 = v58;
+  currPlayer = v58;
   working_window.uFrameX = 483;
   v53 = 148;
   v54 = 334;
@@ -12351,7 +12345,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 - v1->GetMerchant()) / 100;
+  v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100;
   if ( v63 < base_teach_price / 3 )
     v63 = base_teach_price / 3;
   strcpy(Dest, "");
@@ -12365,7 +12359,7 @@
     {
       if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
       {
-        v3 = (int)(&v1->uIntelligence + dword_F8B19C); //test skill
+        v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill
         if ( *(short *)v3 )
         {
           sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dword_F8B19C + 20]); //"You already know the %s skill"
@@ -12400,7 +12394,7 @@
       {
         pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
         ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
-        v1 = v58;
+        currPlayer = v58;
       }
       v63 += 70;
       v62 += 280;
@@ -12417,7 +12411,7 @@
       {
         pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
         ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
-        v1 = v58;
+        currPlayer = v58;
       }
       v63 += 70;
       v62 += 280;
@@ -12462,23 +12456,21 @@
         v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
         v16 = (int)window_SpeakInHouse->ptr_1C;
         uPlayerID = uActiveCharacter - 1;
-        v17 = v1->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16,  2);
+        v17 = currPlayer->_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, v5, (174 - v19) / 2 + 138,  main_text_color, v18, 3);
+        working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138,  main_text_color, v18, 3);
         return;
       }
     }
     return;
   }
   if ( !(unsigned __int16)_449B57_test_bit(
-                            (unsigned __int8 *)v1->_guilds_member_bits,
-                            word_4F0704[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
+                            (unsigned __int8 *)currPlayer->_guilds_member_bits,
+                            guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
   { //you must me member
-    v36 = pNPCTopics[121].pText;
-    v37 = hi_text_color;
     v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
-    working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, v37, v36, 3u);
+    working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u);
     pDialogueWindow->pNumPresenceButton = 0;
     return;
   }
@@ -12608,8 +12600,8 @@
 
 
 //----- (004B705E) --------------------------------------------------------
-int __cdecl TampleDialog()
-{
+void TempleDialog()
+	{
   GUIWindow *v0; // ebx@1
   Player *v1; // esi@1
   int v2; // edi@1
@@ -12693,11 +12685,10 @@
     {
       if ( dword_F8B19C != 11 )
       {
-        result = dword_F8B19C - 96;
+
         if ( dword_F8B19C == 96 )
         {
-          result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
-          if ( result )
+          if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
           {
             v4 = pDialogueWindow;
             v61 = pDialogueWindow;
@@ -12791,7 +12782,7 @@
             }
           }
         }
-        return result;
+        return;
       }
 
       // DONATION
@@ -12856,9 +12847,8 @@
       }
       goto LABEL_55;
     }
-    result = v1->_4B6FF9();
-    if ( !result )
-      return result;
+    if ( !v1->_4B6FF9() )
+      return;
     v25 = 0;
     if ( pParty->uNumGold < v2 )
     {
@@ -12914,17 +12904,8 @@
     v1->PlaySound(SPEECH_82, 0);
     pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536);
 LABEL_46:
-    /*result = pMessageQueue_50CBD0->uNumMessages;
-    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-    {
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
-      *(&pMessageQueue_50CBD0->uNumMessages + result) = v25;
-      ++pMessageQueue_50CBD0->uNumMessages;
-    }*/
     pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
-    return result; // void func
+    return ; // void func
   }
   v63 = 1;
   v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem);
@@ -12959,10 +12940,9 @@
   v64 = (174 - (signed int)v66) / v46;
   if ( v64 > 32 )
     v64 = 32;
-  result = v43->pStartingPosActiveItem;
   v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138;
-  v65 = v42 + result;
-  if ( v42 + result < result + v43->pNumPresenceButton )
+  v65 = v42 + v43->pStartingPosActiveItem;
+  if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton )
   {
     v61 = (GUIWindow *)(v42 + 2);
     v66 = (DDM_DLV_Header *)&a1[100 * v42];
@@ -12985,11 +12965,10 @@
       v66 = (DDM_DLV_Header *)((char *)v66 + 100);
       v61 = (GUIWindow *)((char *)v61 + 1);
       ++v65;
-      result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
-    }
-    while ( (signed int)v65 < result );
-  }
-  return result;
+    }
+    while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
+  }
+  return;
 }
 
 
@@ -14169,7 +14148,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 ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_d )
+  if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId )
     HousePlaySomeSound(v9, 1);
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
     pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
@@ -14219,7 +14198,8 @@
     if ( uExitMapID > 0 )
     {
       //v17 = (unsigned int *)(uExitMapID - 1);
-      if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
+	  if(_449B57_test_bit(pParty->_quest_bits,uExitMapID))
+     // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
       {
         //uExitPic = 0;
         uHouse_ExitPic = 0;
@@ -14399,7 +14379,7 @@
 
 		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
+		if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine )   // going 2 jail
 			{
 			uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
 			uHouseID = HOUSE_JAIL;
@@ -14445,9 +14425,10 @@
 			}
 		else
 			{ //guilds
-			v19 = word_4F0704[uHouseID-139] - 1; //some gild flag check
+			v19 = guild_mambership_flags[uHouseID-139]; //guilds flags 
 			//v20 = uHouseID;
-			if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
+			//if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) )
+			if(_449B57_test_bit((unsigned char*)pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
 				{
 				HousePlaySomeSound(uHouseID, 3);
 				return 1;