diff UIHouses.cpp @ 735:6daaa2f18d0d

Fixed some house sounds & shop-related stuff
author Nomad
date Fri, 22 Mar 2013 20:01:46 +0200
parents 9f596a163257
children 9cc972ebd3cf
line wrap: on
line diff
--- a/UIHouses.cpp	Fri Mar 22 16:16:40 2013 +0200
+++ b/UIHouses.cpp	Fri Mar 22 20:01:46 2013 +0200
@@ -357,8 +357,8 @@
 
 
 //----- (0044622E) --------------------------------------------------------
-bool  EnterHouse(enum HOUSE_ID uHouseID)
-	{
+bool EnterHouse(enum HOUSE_ID uHouseID)
+{
 	//enum HOUSE_ID v1; // edi@1
 	//int v2; // edi@5
 	signed int uOpenTime; // eax@5
@@ -498,32 +498,32 @@
             }
         }
 		else
-			{ //guilds
-			v19 = guild_mambership_flags[uHouseID-139]; //guilds flags 
+		{ //guilds
+			v19 = guild_mambership_flags[uHouseID - HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE]; //guilds flags 
 			//v20 = uHouseID;
 			//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);
+			if(_449B57_test_bit(pPlayers[uActiveCharacter]->_guilds_member_bits,v19))
+            {
+				PlayHouseSound(uHouseID, HouseSound_Greeting_2);
 				return 1;
-				}
-			}
-		HousePlaySomeSound(uHouseID, 1);
+            }
+		}
+		PlayHouseSound(uHouseID, HouseSound_Greeting);
 		dword_5C35D4 = 1;
 		return 1;
 		}
 	}
 
 //----- (004B1E92) --------------------------------------------------------
-void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2)
-    {
+void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
+{
     //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) )
     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].uRoomSoundId) + 300),
+        (SoundID)(sound + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId + 300)),
         806, 0, -1, 0, 0, 0, 0);
-    }
+}
 
     //----- (004B4F4F) --------------------------------------------------------
 char *__cdecl JailDialog()
@@ -734,7 +734,7 @@
 			}
 			if ( v1 > pParty->uNumGold )
 			{
-				HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+				PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
 				v2 = pParty->uNumGold;
 			}
 			if ( v2 > pParty->uFine )
@@ -830,7 +830,7 @@
 				}
 				if ( v6 > pParty->uNumGold )
 				{
-					HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+					PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
 					v7 = pParty->uNumGold;
 				}
 				if ( v7 )
@@ -877,7 +877,7 @@
 				{
 					if ( v2 > pParty->uNumGoldInBank )
 					{
-						HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+						PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
 						v3 = pParty->uNumGoldInBank;
 					}
 					if ( v3 )
@@ -1187,7 +1187,7 @@
       {
         Party::TakeGold((unsigned int)pOutString);
         v27 = (int)window_SpeakInHouse->ptr_1C;
-        HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
         dialog_menu_id = 0;
         sub_4BD8B5();
         sub_4B1D27();
@@ -1203,7 +1203,7 @@
         return;
       }
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
-      HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
+      PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_4);
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
       break;
     }
@@ -1297,12 +1297,12 @@
         Party::TakeGold(v7);
         //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
         pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
-        HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3);
+        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
         pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
         return;
       }
-      ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
-      HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
+      ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);  // "You don't have enough gold"
+      PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_4);
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
       break;
     }
@@ -3224,7 +3224,7 @@
                         if ( pParty->uNumGold < v63 )
                             {
                             ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
-                            HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+                            PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
                             }
                         else
                             {
@@ -3708,7 +3708,7 @@
             {
 LABEL_55:
             ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
-            HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+            PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
             goto LABEL_46;
             }
         Party::TakeGold(v2);
@@ -4057,7 +4057,7 @@
           if ( pParty->uNumGold >= v11)
           {
             Party::TakeGold(v11);
-            HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
+            PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney);
             ++pPlayers[uActiveCharacter]->uLevel;
             pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5;
             pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth();
@@ -4094,7 +4094,7 @@
           ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
           v63 = 4;
 LABEL_55:
-          HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63);
+          PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v63);
 //LABEL_56:
           /*result = pMessageQueue_50CBD0->uNumMessages;
           if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )