diff UI/UIShops.cpp @ 1407:d4f57df4c299

PlayerSpeechID and uSpeakingCharacter
author Ritor1
date Tue, 23 Jul 2013 16:34:00 +0600
parents d071e0e9ba75
children c9e3b93ec570
line wrap: on
line diff
--- a/UI/UIShops.cpp	Tue Jul 23 15:41:45 2013 +0600
+++ b/UI/UIShops.cpp	Tue Jul 23 16:34:00 2013 +0600
@@ -2642,20 +2642,14 @@
   }
 }
 //----- (004B1D27) --------------------------------------------------------
-void __cdecl sub_4B1D27()
+void __cdecl GetHouseGoodbyeSpeech()
 {
-  int v0; // edx@2
-  unsigned int v1; // ecx@7
   signed int v2; // edi@10
-  int v3; // esi@10
-  __int16 v4; // ax@15
   signed int v5; // edi@20
-  int v6; // esi@20
   int v7[4]; // [sp+Ch] [bp-10h]@12
 
   if ( in_current_building_type > 0 )
   {
-    v0 = 3;
     if ( in_current_building_type > BildingType_MagicShop )
     {
       if ( in_current_building_type == BildingType_Bank )
@@ -2668,39 +2662,32 @@
         if ( in_current_building_type != BildingType_Temple )
           return;
       }
-      v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
-      PlayHouseSound(v1, (HouseSoundID)v0);
+      PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
       return;
     }
-    v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
-    if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed )
+    if ( (signed __int64)pParty->field_3C._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C]<= (signed __int64)pParty->uTimePlayed )
     {
-      if ( pParty->uNumGold <= 0x2710 )
+      if ( pParty->uNumGold <= 10000 )
       {
         if ( !dword_F8B1E4 )
           return;
-        v0 = 4;
-        PlayHouseSound(v1, (HouseSoundID)v0);
+        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
         return;
       }
-      PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3));
+      PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)(dword_F8B1E4 + 3));
       if ( !dword_F8B1E4 && !qword_A750D8 )
       {
         v5 = 0;
-        v6 = 1;
-        do
+        for ( uint i = 1; i <= 4; ++i )
         {
-          if ( pPlayers[v6]->CanAct() )
-            v7[v5++] = v6;
-          ++v6;
+          if ( pPlayers[i]->CanAct() )
+            v7[v5++] = i;
         }
-        while ( v6 <= 4 );
         if ( v5 )
         {
           qword_A750D8 = 256i64;
           PlayerSpeechID = SPEECH_80;
-          v4 = LOWORD(v7[rand() % v5]);
-          word_A750E2 = v4;
+          uSpeakingCharacter = v7[rand() % v5];
           return;
         }
       }
@@ -2710,20 +2697,16 @@
       if ( !qword_A750D8 )
       {
         v2 = 0;
-        v3 = 1;
-        do
+        for ( uint i = 1; i <= 4; ++i )
         {
-          if ( pPlayers[v3]->CanAct() )
-            v7[v2++] = v3;
-          ++v3;
+          if ( pPlayers[i]->CanAct() )
+            v7[v2++] = i;
         }
-        while ( v3 <= 4 );
         if ( v2 )
         {
           qword_A750D8 = 256i64;
           PlayerSpeechID = SPEECH_80;
-          v4 = LOWORD(v7[rand() % v2]);
-          word_A750E2 = v4;
+          uSpeakingCharacter = v7[rand() % v2];
           return;
         }
       }