changeset 204:22730e77fa32

7.01.13(SoundVolumeLevel)
author Ritor1
date Mon, 07 Jan 2013 14:16:50 +0600
parents dacc9207809a
children 6d982dfab925
files AudioPlayer.cpp AudioPlayer.h Game.cpp Party.cpp mm7_3.cpp
diffstat 5 files changed, 136 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Thu Jan 03 16:03:54 2013 +0600
+++ b/AudioPlayer.cpp	Mon Jan 07 14:16:50 2013 +0600
@@ -43,7 +43,19 @@
 unsigned __int8 uMusicVolimeMultiplier = 4;
 int bWalkSound; // idb
 
-float pSoundVolumeLevels[777]; // idb
+float pSoundVolumeLevels[10] = 
+{
+  0.0,
+  0.10999999940395,
+  0.21999999880791,
+  0.33000001311302,
+  0.43999999761581,
+  0.55000001192093,
+  0.66000002622604,
+  0.76999998092651,
+  0.87999999523163,
+  0.99000000953674
+}; // idb
 
 
 
@@ -56,66 +68,83 @@
 //----- (004A9953) --------------------------------------------------------
 void SoundList::Initialize()
 {
-  SoundList *v1; // esi@1
+  SoundList *pSoundList; // esi@1
   signed int v2; // edi@2
-  SoundDesc *v3; // eax@5
-  void *v4; // ebx@7
+  SoundDesc *pSoundDesc; // eax@5
+  void *pSoundData; // ebx@7
   unsigned int uSoundSize; // eax@7
   char *pSoundBytes; // ebx@7
-  AILFILETYPE v7; // eax@7
+  AILFILETYPE pType; // eax@7
   int v8; // eax@8
   char pSoundName[120]; // [sp+4h] [bp-A4h]@4
-  AILSOUNDINFO v10; // [sp+7Ch] [bp-2Ch]@10
+  AILSOUNDINFO pInfo; // [sp+7Ch] [bp-2Ch]@10
   int v12; // [sp+A0h] [bp-8h]@12
   int a2; // [sp+A4h] [bp-4h]@1
 
-  v1 = this;
+  pSoundList = this;
   a2 = 1;
   if ( (signed int)this->uNumSounds > 1 )
   {
     v2 = 1;
-    while ( 1 )
+    //while ( 1 )
+	do
     {
-      if ( v1->pSounds[v2].eType != SOUND_DESC_SYSTEM
-        || (sprintf(pSoundName, "%s", pSounds[v2].pSoundName),
-            v1->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)0xFFFFFFFF, pSounds[v2].uSoundID),
+	  sprintf(pSoundName, "%s", pSounds[v2].pSoundName);
+	 // pSoundList->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)0xFFFFFFFF, pSounds[v2].uSoundID); Ritor1: it's error - result: no sound
+	  pSoundDesc = &pSoundList->pSounds[v2];
+      if ( pSoundList->pSounds[v2].eType != SOUND_DESC_SYSTEM || (sprintf(pSoundName, "%s", pSounds[v2].pSoundName),
+            pSoundList->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)0xFFFFFFFF, pSounds[v2].uSoundID),
             !pAudioPlayer->b3DSoundInitialized)
-        || (v3 = &v1->pSounds[v2], !(v3->uFlags & 2))
-        || !v3->pSoundData[0] )
+        || (pSoundDesc = &pSoundList->pSounds[v2], !(pSoundDesc->uFlags & 2))
+        || !pSoundDesc->pSoundData[0] ) // нужно перевернуть
         goto LABEL_17;
-      v4 = v3->pSoundData[0];
-      uSoundSize = *(int *)v4;
-      pSoundBytes = (char *)v4 + 4;
-      v7 = AIL_file_type(pSoundBytes, uSoundSize);
-      if ( !v7 )
-        goto LABEL_15;
-      v8 = v7 - 1;
+      pSoundData = pSoundDesc->pSoundData[0];
+      uSoundSize = *(int *)pSoundData;
+      pSoundBytes = (char *)pSoundData + 4;
+      pType = AIL_file_type(pSoundBytes, uSoundSize);
+      if ( !pType )
+        //goto LABEL_15;
+	  {
+		LOBYTE(pSoundList->pSounds[v2].bDecompressed) = 0;
+		goto LABEL_16;
+	  }
+      v8 = pType - 1;
       if ( v8 )
-        break;
-      v1->pSounds[v2].p3DSound = v1->pSounds[v2].pSoundData[0];
+	  {
+        /*break;
+      pSoundList->pSounds[v2].p3DSound = pSoundList->pSounds[v2].pSoundData[0];
 LABEL_16:
-      v1->_4A9DCD(a2, 1);
+      pSoundList->_4A9DCD(a2, 1);
 LABEL_17:
       ++a2;
       ++v2;
-      if ( a2 >= (signed int)v1->uNumSounds )
+      if ( a2 >= (signed int)pSoundList->uNumSounds )
         return;
-    }
-    if ( v8 == 1 )
-    {
-      if ( AIL_WAV_info(pSoundBytes, &v10) && v10.uChannels != 2 )
+    }*/
+      if ( v8 == 1 )
       {
-        if ( !AIL_decompress_ADPCM(&v10, &v1->pSounds[v2].p3DSound, &v12) )
+        if ( AIL_WAV_info(pSoundBytes, &pInfo) && pInfo.uChannels != 2 )
         {
-          v1->pSounds[v2].p3DSound = 0;
-          LOBYTE(v1->pSounds[v2].bDecompressed) = 1;
+          if ( !AIL_decompress_ADPCM(&pInfo, &pSoundList->pSounds[v2].p3DSound, &v12) )
+          {
+            pSoundList->pSounds[v2].p3DSound = 0;
+            LOBYTE(pSoundList->pSounds[v2].bDecompressed) = 1;
+          }
         }
+        goto LABEL_16;
       }
+//LABEL_15:
+      LOBYTE(pSoundList->pSounds[v2].bDecompressed) = 0;
       goto LABEL_16;
     }
-LABEL_15:
-    LOBYTE(v1->pSounds[v2].bDecompressed) = 0;
-    goto LABEL_16;
+	pSoundList->pSounds[v2].p3DSound = pSoundList->pSounds[v2].pSoundData[0];
+LABEL_16:
+    pSoundList->_4A9DCD(a2, 1);
+LABEL_17:
+      ++a2;
+      ++v2;
+	}
+    while ( a2 < (signed int)pSoundList->uNumSounds );
   }
 }
 
--- a/AudioPlayer.h	Thu Jan 03 16:03:54 2013 +0600
+++ b/AudioPlayer.h	Mon Jan 07 14:16:50 2013 +0600
@@ -293,7 +293,7 @@
 extern unsigned __int8 uMusicVolimeMultiplier;
 extern int bWalkSound; // idb
 
-extern float pSoundVolumeLevels[]; // idb
+extern float pSoundVolumeLevels[10]; // idb
 
 
 
--- a/Game.cpp	Thu Jan 03 16:03:54 2013 +0600
+++ b/Game.cpp	Mon Jan 07 14:16:50 2013 +0600
@@ -150,8 +150,8 @@
   pOtherOverlayList->field_3EC = 0;
   viewparams->bRedrawGameUI = v5;
   GameUI_DrawPartySpells();
-  //if (v4 || pParty->pHirelings[0].evtc || pParty->pHirelings[1].evtc ) Ritor1: it's temporarily
-    //DrawHiredNPCs();
+  if (v4 || pParty->pHirelings[0].evtc || pParty->pHirelings[1].evtc ) //Ritor1: it's temporarily
+    DrawHiredNPCs();
   GameUI_DrawPortraits(v4);
   GameUI_DrawLifeManaBars();
   GameUI_DrawCharacterSelectionFrame();
@@ -193,8 +193,8 @@
   //signed int v3; // esi@7
   signed int v4; // ecx@58
   char *v5; // eax@59
-  Player *v6; // esi@65
-  OtherOverlay *v7; // esi@67
+  Player *pPlayer; // esi@65
+  OtherOverlay *pOtherOverlay; // esi@67
   signed int v8; // edi@67
   int v9; // edi@69
   int *pHealth; // esi@71
@@ -376,23 +376,23 @@
         pVideoPlayer->Unload();
       SaveGame(0, 0);
       ++pParty->uNumDeaths;
-      v6 = pParty->pPlayers;
+      pPlayer = pParty->pPlayers;
       do
       {
-        v6->SetVariable(VAR_Award, 85);
-        ++v6;
+        pPlayer->SetVariable(VAR_Award, 85);
+        ++pPlayer;
       }
-      while ( (signed int)v6 < (signed int)pParty->pHirelings );
+      while ( (signed int)pPlayer < (signed int)pParty->pHirelings );
       pParty->field_764 = 0;
       pParty->uTimePlayed += 0x276000ui64;
       LOWORD(pParty->uFlags) &= 0xFDFBu;
       pParty->SetGold(0);
-      v7 = pOtherOverlayList->pOverlays;
+      pOtherOverlay = pOtherOverlayList->pOverlays;
       v8 = 50;
       do
       {
-        v7->Reset();
-        ++v7;
+        pOtherOverlay->Reset();
+        ++pOtherOverlay;
         --v8;
       }
       while ( v8 );
@@ -478,7 +478,7 @@
     }
     break;
   }
-  pCurrentScreen = 16;
+  pCurrentScreen = 16;//окно видео ролика 
   sub_491E3A();
 }
 
--- a/Party.cpp	Thu Jan 03 16:03:54 2013 +0600
+++ b/Party.cpp	Mon Jan 07 14:16:50 2013 +0600
@@ -574,12 +574,12 @@
  
   switch ( pPlayers[0].uVoiceID )
   {
-    case 0u:
-    case 1u:
-    case 2u:
-    case 3u:
-    case 8u:
-    case 9u:
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 8:
+    case 9:
     case 0xCu:
     case 0xDu:
     case 0x10u:
@@ -589,10 +589,10 @@
     default:
       v6 = SEX_MALE;
       break;
-    case 4u:
-    case 5u:
-    case 6u:
-    case 7u:
+    case 4:
+    case 5:
+    case 6:
+    case 7:
     case 0xAu:
     case 0xBu:
     case 0xEu:
@@ -616,12 +616,12 @@
   v7 = SEX_MALE;
   switch (pPlayers[1].uVoiceID)
   {
-    case 0u:
-    case 1u:
-    case 2u:
-    case 3u:
-    case 8u:
-    case 9u:
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 8:
+    case 9:
     case 0xCu:
     case 0xDu:
     case 0x10u:
@@ -630,10 +630,10 @@
     case 0x17u:
       v7 = SEX_MALE;
       break;
-    case 4u:
-    case 5u:
-    case 6u:
-    case 7u:
+    case 4:
+    case 5:
+    case 6:
+    case 7:
     case 0xAu:
     case 0xBu:
     case 0xEu:
@@ -657,12 +657,12 @@
   v8 = SEX_MALE;
   switch (pPlayers[2].uVoiceID)
   {
-    case 0u:
-    case 1u:
-    case 2u:
-    case 3u:
-    case 8u:
-    case 9u:
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 8:
+    case 9:
     case 0xCu:
     case 0xDu:
     case 0x10u:
@@ -671,10 +671,10 @@
     case 0x17u:
       v8 = SEX_MALE;
       break;
-    case 4u:
-    case 5u:
-    case 6u:
-    case 7u:
+    case 4:
+    case 5:
+    case 6:
+    case 7:
     case 0xAu:
     case 0xBu:
     case 0xEu:
@@ -765,7 +765,7 @@
   _449B7E_toggle_bit(_award_bits, 6, 1);
 
 
-  memcpy(pNPCStats->pNewNPCData, &pNPCStats, 0x94BCu);
+  memcpy(pNPCStats->pNewNPCData, pNPCStats->pNPCData, 0x94BCu);
   memcpy(pNPCStats->pGroups_copy, pNPCStats->pGroups, 0x66u);
   pNPCStats->pNewNPCData[3].uFlags |= 0x80u;
   _494035_timed_effects__water_walking_damage__etc();
--- a/mm7_3.cpp	Thu Jan 03 16:03:54 2013 +0600
+++ b/mm7_3.cpp	Mon Jan 07 14:16:50 2013 +0600
@@ -5405,9 +5405,9 @@
 //----- (00476CB5) --------------------------------------------------------
 void NPCStats::Initialize1()
 {
-  NPCStats *v1; // esi@1
-  char *v2; // eax@1
-  char *v3; // edi@1
+  NPCStats *pNPCStats; // esi@1
+  char *pRaw; // eax@1
+  char *pHouse; // edi@1
   char *v4; // eax@2
   char v5; // dl@3
   int v6; // ecx@3
@@ -5445,13 +5445,13 @@
   signed int v38; // [sp+1Ch] [bp-4h]@43
   signed int v39; // [sp+1Ch] [bp-4h]@57
 
-  v1 = this;
-  v2 = (char *)pEvents_LOD->LoadRaw("npcdata.txt", 0);
-  v1->pNPCDataTXT_Raw = v2;
-  strtok(v2, "\r");
+  pNPCStats = this;
+  pRaw = (char *)pEvents_LOD->LoadRaw("npcdata.txt", 0);
+  pNPCStats->pNPCDataTXT_Raw = pRaw;
+  strtok(pRaw, "\r");
   strtok(0, "\r");
-  v3 = (char *)&v1->pNPCData[1].house;
-  Str = (char *)v1->pNPCNames2;
+  pHouse = (char *)&pNPCStats->pNPCData[1].house;
+  Str = (char *)pNPCStats->pNPCNames2;
   v24 = 500;
   do
   {
@@ -5477,41 +5477,41 @@
         {
           case 0:
             v7 = RemoveQuotes(v4);
-            *((int *)v3 - 5) = (int)v7;
+            *((int *)pHouse - 5) = (int)v7;
             *(int *)Str = (int)v7;
             break;
           case 1:
-            *((int *)v3 - 4) = atoi(v4);
+            *((int *)pHouse - 4) = atoi(v4);
             break;
           case 5:
-            *(int *)v3 = atoi(v4);
+            *(int *)pHouse = atoi(v4);
             break;
           case 6:
-            *((int *)v3 + 1) = atoi(v4);
+            *((int *)pHouse + 1) = atoi(v4);
             break;
           case 7:
-            *((int *)v3 + 2) = atoi(v4);
+            *((int *)pHouse + 2) = atoi(v4);
             break;
           case 8:
-            *((int *)v3 + 3) = *v4 == 121;
+            *((int *)pHouse + 3) = *v4 == 121;
             break;
           case 9:
-            *((int *)v3 + 5) = atoi(v4);
+            *((int *)pHouse + 5) = atoi(v4);
             break;
           case 10:
-            *((int *)v3 + 6) = atoi(v4);
+            *((int *)pHouse + 6) = atoi(v4);
             break;
           case 11:
-            *((int *)v3 + 7) = atoi(v4);
+            *((int *)pHouse + 7) = atoi(v4);
             break;
           case 12:
-            *((int *)v3 + 8) = atoi(v4);
+            *((int *)pHouse + 8) = atoi(v4);
             break;
           case 13:
-            *((int *)v3 + 9) = atoi(v4);
+            *((int *)pHouse + 9) = atoi(v4);
             break;
           case 14:
-            *((int *)v3 + 10) = atoi(v4);
+            *((int *)pHouse + 10) = atoi(v4);
             break;
           default:
             break;
@@ -5522,15 +5522,15 @@
     }
     while ( v36 + 1 <= 15 && !v32 );
     Str += 4;
-    v3 += 76;
+    pHouse += 76;
     --v24;
   }
   while ( v24 );
-  v1->uNumNewNPCs = 501;
+  pNPCStats->uNumNewNPCs = 501;
   v8 = (char *)pEvents_LOD->LoadRaw("npcgreet.txt", 0);
-  v1->pNPCGreetTXT_Raw = v8;
+  pNPCStats->pNPCGreetTXT_Raw = v8;
   strtok(v8, "\r");
-  pGreetings = v1->pNPCGreetings;
+  pGreetings = pNPCStats->pNPCGreetings;
   v25 = 205;
   do
   {
@@ -5571,9 +5571,9 @@
   }
   while ( v25 );
   v13 = (char *)pEvents_LOD->LoadRaw("npcgroup.txt", 0);
-  v1->pNCPGroupTXT_Raw = v13;
+  pNPCStats->pNCPGroupTXT_Raw = v13;
   strtok(v13, "\r");
-  pGroups = v1->pGroups;
+  pGroups = pNPCStats->pGroups;
   v26 = 51;
   do
   {
@@ -5604,9 +5604,9 @@
   }
   while ( v26 );
   v18 = (char *)pEvents_LOD->LoadRaw("npcnews.txt", 0);
-  v1->pNPCNewsTXT_Raw = v18;
+  pNPCStats->pNPCNewsTXT_Raw = v18;
   strtok(v18, "\r");
-  pCatchPhrase = v1->pCatchPhrases;
+  pCatchPhrase = pNPCStats->pCatchPhrases;
   v27 = 51;
   do
   {