diff Player.cpp @ 1406:d071e0e9ba75

Explosion Traps fix
author Ritor1
date Tue, 23 Jul 2013 15:41:45 +0600
parents c0b273d33338
children d4f57df4c299
line wrap: on
line diff
--- a/Player.cpp	Mon Jul 22 15:23:43 2013 +0600
+++ b/Player.cpp	Tue Jul 23 15:41:45 2013 +0600
@@ -529,35 +529,22 @@
 {
   signed int speechCount = 0; // esi@4
   signed int expressionCount = 0; // esi@4
-  unsigned __int8 v8; // al@6
   int pickedVariant; // esi@10
-  int v14; // eax@12
   CHARACTER_EXPRESSION_ID expression; // ebx@17
-  signed int v17; // ecx@19
-  unsigned int pSoundID; // edi@20
+  signed int pSoundID; // ecx@19
   int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7
   int expressionVariantArray[5]; 
-  int pPlayerNum; // [sp+24h] [bp-4h]@1
   unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4
   unsigned int expressionDuration = 0;
 
-  pPlayerNum = 1;
-  for (int i = 0; i < 4; ++i)
-    if (&pParty->pPlayers[i] == this)
-    {
-      pPlayerNum = i + 1;
-      break;
-    }
-
   pickedSoundID = 0;
   if (uVoicesVolumeMultiplier)
   {
     for (int i = 0; i < 2; i++)
     {
-      v8 = SoundSetAction[speech][i];
-      if ( v8 )
-      {
-        speechVariantArray[speechCount] = v8;
+      if ( SoundSetAction[speech][i] )
+      {
+        speechVariantArray[speechCount] = SoundSetAction[speech][i];
         speechCount++;
       }
     }
@@ -568,17 +555,16 @@
       if (numberOfSubvariants > 0)
       {
         pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998;
-        pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0);
+        pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0);
       }
     }
   }
 
   for (int i = 0; i < 5; i++)
   {
-    v14 = SoundSetAction[speech][i + 3];
-    if ( v14 )
-    {
-      expressionVariantArray[expressionCount] = v14;
+    if ( SoundSetAction[speech][i + 3] )
+    {
+      expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3];
       expressionCount++;
     }
   }
@@ -587,25 +573,16 @@
     expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount];
     if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID )
     {
-      if ( (signed int)pSoundList->sNumSounds <= 0 )
-      {
-        v17 = 0;
-      }
-      else
-      {
-        pSoundID = pSoundList->pSounds[0].uSoundID;
-        v17 = 0;
+      pSoundID = 0;
+      if ( pSoundList->sNumSounds )
+      {
         for (int i = 0; i < pSoundList->sNumSounds; i++)
         {
-          v17 = i;
-          if (pSoundID == pickedSoundID)
-          {
-            break;
-          }
-          pSoundID += 120;
+          if (pSoundList->pSounds[i].uSoundID == pickedSoundID)
+            pSoundID = i;
         }
       }
-      if ( pSoundList->pSounds[v17].pSoundData[0] )
+      if ( pSoundList->pSounds[pSoundID].pSoundData[0] )
         expressionDuration = (sLastTrackLengthMS << 7) / 1000;
     }
     PlayEmotion(expression, expressionDuration);
@@ -9382,7 +9359,7 @@
     if ( v38 == OBJECT_Player && !qword_A750D8 )
     {
       qword_A750D8 = 256i64;
-      word_A750E0 = 44;
+      PlayerSpeechID = SPEECH_44;
       word_A750E2 = uActorID + 1;
     }
     return;