changeset 328:8e23edf57e27

little fix
author Ritor1
date Wed, 20 Feb 2013 17:37:33 +0600
parents a7f15da53e82
children f76027321087 405d0c4dd1b3 bc7f77c694c3
files AudioPlayer.cpp AudioPlayer.h Game.cpp Player.cpp SaveLoad.cpp mm7_1.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp mm7_data.cpp
diffstat 10 files changed, 105 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/AudioPlayer.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -45,17 +45,9 @@
 
 float pSoundVolumeLevels[10] = 
 {
-  0.0,
-  0.10999999940395,
-  0.21999999880791,
-  0.33000001311302,
-  0.43999999761581,
-  0.55000001192093,
-  0.66000002622604,
-  0.76999998092651,
-  0.87999999523163,
-  0.99000000953674
-}; // idb
+  0.0000000f, 0.1099999f, 0.2199999f, 0.3300000f, 0.4399999f,
+ 0.5500000f, 0.6600000f, 0.7699999f, 0.8799999f, 0.9900000f
+};
 
 
 
@@ -541,7 +533,7 @@
   if (!bNoSound && bPlayerReady && hAILRedbook && uMusicVolimeMultiplier)
   {
     AIL_redbook_stop(hAILRedbook);
-    AIL_redbook_set_volume(hAILRedbook, (signed)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0));
+    AIL_redbook_set_volume(hAILRedbook, (signed)pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
     AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS);
     AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS);
     uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000;
@@ -560,20 +552,15 @@
 }
 
 //----- (004AA214) --------------------------------------------------------
-void AudioPlayer::SetMasterVolume(unsigned int uVolume)
+void AudioPlayer::SetMasterVolume(float fVolume)
 {
-  AudioPlayer *v2; // esi@1
-  _DIG_DRIVER *hDrv; // eax@2
-
-  v2 = this;
-  if ( this->bPlayerReady )
+  if ( bPlayerReady )
   {
-    hDrv = this->hDigDriver;
-    this->uMasterVolume = uVolume;
-    if ( hDrv )
-      AIL_set_digital_master_volume(hDrv, uVolume);
-    if ( v2->b3DSoundInitialized )
-      v2->s3DSoundVolume = (signed __int64)((double)(signed int)uVolume * 0.5);
+    uMasterVolume = fVolume;
+    if ( hDigDriver )
+      AIL_set_digital_master_volume(hDigDriver, fVolume);
+    if ( b3DSoundInitialized )
+      s3DSoundVolume = fVolume * 0.5f;
   }
 }
 // 4D8304: using guessed type int __stdcall AIL_set_digital_master_volume(int, int);
@@ -1972,9 +1959,9 @@
     uNumRedbookTracks = AIL_redbook_tracks(hAILRedbook);
   }
   pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook);
-  pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0);
+  pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
   if ( bPlayerReady && hAILRedbook )
-    AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0) >> 32);
+    AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32);
   LoadAudioSnd();
 }
 
--- a/AudioPlayer.h	Wed Feb 20 11:27:06 2013 +0600
+++ b/AudioPlayer.h	Wed Feb 20 17:37:33 2013 +0600
@@ -141,7 +141,7 @@
   }
 
   void SetMusicVolume(int vol);
-  void SetMasterVolume(unsigned int uVolume);
+  void SetMasterVolume(float fVolume);
   void _4AA258(int a2);
   void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, unsigned int uVolume, int sPlaybackRate);
   void _4AAFCF();
--- a/Game.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/Game.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -231,7 +231,7 @@
 
   LoadPlayerPortraintsAndVoices();
   pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
-  pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0);
+  pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
 
   while ( 2 )
   {
--- a/Player.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/Player.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -620,7 +620,7 @@
       {
         pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998;
         v12 = (8 * pPlayerNum + 312) | OBJECT_Player;
-        pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0);
+        pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
       }
     }
   }
--- a/SaveLoad.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/SaveLoad.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -217,8 +217,8 @@
     pSavegameThumbnails[i].Release();
 
   pIcons_LOD->_4114F2();
-  pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0);
-  pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0);
+  pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
+  pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
   if (uTurnSpeed)
     pParty->sRotationY = uTurnSpeed * pParty->sRotationY / (signed int)uTurnSpeed;
   MM7Initialization();
--- a/mm7_1.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/mm7_1.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -6252,7 +6252,7 @@
         dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE);
         uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE);
         uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE);
-        unsigned int uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE);
+        uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE);
         uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE);
         dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE);
         uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE);
@@ -6342,7 +6342,7 @@
         uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE);
         uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE);
         uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE);
-        unsigned int uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE);
+        uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE);
         uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE);
         uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE);
         dword_50796C = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE);
--- a/mm7_2.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/mm7_2.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -13569,7 +13569,7 @@
       }
       if (!bNoSound && pAudioPlayer->hAILRedbook)
       {
-        pAudioPlayer->SetMusicVolume((pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0));
+        pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
         AIL_redbook_stop(pAudioPlayer->hAILRedbook);
         unsigned int end_ms;
         AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms);
--- a/mm7_4.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/mm7_4.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -5720,7 +5720,7 @@
 
   if ( pMessageQueue_50CBD0->uNumMessages )
     pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-  pAudioPlayer->SetMusicVolume((pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0));
+  pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
   ++pIcons_LOD->uTexturePacksCount;
   if ( !pIcons_LOD->uNumPrevLoadedFiles )
     pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
--- a/mm7_5.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/mm7_5.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -931,9 +931,8 @@
             GUIWindow::Create(v23, 0xD8u, 0, 0, (enum WindowType)90, v153, v167);
             //goto LABEL_143;
             if ( uMusicVolimeMultiplier )
-              pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0,
-                (signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0), 0);
-            pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));
+              pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
+            pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
             continue;
           }
           if ( uMessageParam == 5 )
@@ -948,9 +947,8 @@
             GUIWindow::Create(v23, 0xD8u, 0, 0, (enum WindowType)90, v153, v167);
             //goto LABEL_143;
             if ( uMusicVolimeMultiplier )
-              pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0,
-                (signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0), 0);
-            pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));
+              pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
+            pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
             continue;
           }
           uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;
@@ -958,34 +956,21 @@
             uMusicVolimeMultiplier = 9;
 //LABEL_143:
           if ( uMusicVolimeMultiplier )
-            pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0,
-              (signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0), 0);
-          pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));
+            pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
+          pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
           continue;
         case UIMSG_ChangeSoundVolume:
-          if ( uMessageParam == 4 )
+          if ( uMessageParam == 4 )//reduce sound level
           {
             --uSoundVolumeMultiplier;
             if ( (char)uSoundVolumeMultiplier < 1 )
               uSoundVolumeMultiplier = 0;
-            v168 = v0;
-            v24 = 243;
-            v154 = (int)pBtn_SliderLeft;
-//LABEL_150:
-            GUIWindow::Create(v24, 0xA2u, 0, 0, (enum WindowType)90, v154, v168);
-            //goto LABEL_157;
-            pAudioPlayer->SetMasterVolume((signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 128.0));
-            v165 = 0;
-            v151 = 0;
-            v144 = 0;
-            v139 = 0;
-            v135 = -1;
-            v132 = 0;
-            v130 = -1;
-            v127 = 218;
-            goto _play_sound_and_continue;
-          }
-          if ( uMessageParam == 5 )
+            GUIWindow::Create(243, 162, 0, 0, (enum WindowType)90, (int)pBtn_SliderLeft, v0);
+            pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
+            pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0);
+            continue;
+          }
+          if ( uMessageParam == 5 )//Increase sound level 
           {
             ++uSoundVolumeMultiplier;
             if ( (char)uSoundVolumeMultiplier > 8 )
@@ -996,7 +981,7 @@
             //goto LABEL_150;
             GUIWindow::Create(v24, 0xA2u, 0, 0, (enum WindowType)90, v154, v168);
             //goto LABEL_157;
-            pAudioPlayer->SetMasterVolume((signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 128.0));
+            pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
             v165 = 0;
             v151 = 0;
             v144 = 0;
@@ -1011,7 +996,7 @@
           if ( (char)uSoundVolumeMultiplier > 8 )
             uSoundVolumeMultiplier = 9;
 //LABEL_157:
-          pAudioPlayer->SetMasterVolume((signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 128.0));
+          pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
           v165 = 0;
           v151 = 0;
           v144 = 0;
@@ -1048,7 +1033,7 @@
             if ( !uVoicesVolumeMultiplier )
               continue;
             v165 = 0;
-            v151 = (signed __int64)(pSoundVolumeLevels[(char)uVoicesVolumeMultiplier] * 128.0);
+            v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f;
             v144 = 0;
             v139 = 0;
             v135 = -1;
@@ -1071,7 +1056,7 @@
             if ( !uVoicesVolumeMultiplier )
               continue;
             v165 = 0;
-            v151 = (signed __int64)(pSoundVolumeLevels[(char)uVoicesVolumeMultiplier] * 128.0);
+            v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f;
             v144 = 0;
             v139 = 0;
             v135 = -1;
@@ -1087,7 +1072,7 @@
           if ( !uVoicesVolumeMultiplier )
             continue;
           v165 = 0;
-          v151 = (signed __int64)(pSoundVolumeLevels[(char)uVoicesVolumeMultiplier] * 128.0);
+          v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f;
           v144 = 0;
           v139 = 0;
           v135 = -1;
--- a/mm7_data.cpp	Wed Feb 20 11:27:06 2013 +0600
+++ b/mm7_data.cpp	Wed Feb 20 17:37:33 2013 +0600
@@ -67,7 +67,71 @@
 Award pAwards[104];
 
 #include "stru159.h"
-stru159 pAnimatedRooms[196];
+stru159 pAnimatedRooms[196] = 
+{
+ "",                            0x00000004, 0x000001F4, 0x00000000,
+ "Human Armor01",               0x00000020, 0x000002C0, 0x00003A02,
+ "Necromancer Armor01",         0x00000020, 0x000002D7, 0x00004602,
+ "Dwarven Armor01",             0x00000020, 0x000002EE, 0x00000502,
+ "Wizard Armor",                0x00000020, 0x000003BD, 0x00001302,
+ "Warlock Armor",               0x00000020, 0x000002D6, 0x00002302,
+ "Elf Armor",                   0x00000020, 0x000002BC, 0x00004F02,
+ "Human Alchemisht01",          0x0000000E, 0x000002BE, 0x00005F04,
+ "Necromancer Alchemist01",     0x0000000E, 0x000002D6, 0x00004504,
+ "Dwarven Achemist01",          0x0000000E, 0x00000387, 0x00000404,
+ "Wizard Alchemist",            0x0000000E, 0x00000232, 0x00001904,
+ "Warlock Alchemist",           0x0000000E, 0x000002BE, 0x00002A04,
+ "Elf Alchemist",               0x0000000E, 0x0000038A, 0x00005404,
+ "Human Bank01",                0x00000006, 0x00000384, 0x00003416,
+ "Necromancer Bank01",          0x00000006, 0x000002D8, 0x00004716,
+ "Dwarven Bank",                0x00000006, 0x000002F3, 0x00000616,
+ "Wizard Bank",                 0x00000006, 0x000003BA, 0x00001416,
+ "Warlock Bank",                0x00000006, 0x0000039F, 0x00002416,
+ "Elf Bank",                    0x00000006, 0x000002BC, 0x00004716,
+ "Boat01",                      0x0000000F, 0x0000004C, 0x0003351C,
+ "Boat01d",                     0x0000000F, 0x0000004C, 0x0003351C,
+ "Human Magic Shop01",          0x0000000A, 0x000002C8, 0x00003603,
+ "Necromancer Magic Shop01",    0x0000000E, 0x000002DC, 0x00004203,
+ "Dwarven Magic Shop01",        0x0000002A, 0x000002EF, 0x00005B03,
+ "Wizard Magic Shop",           0x0000001E, 0x000002DF, 0x00000F03,
+ "Warlock Magic Shop",          0x00000007, 0x000003B9, 0x00001F03,
+ "Elf Magic Shop",              0x00000024, 0x000002CC, 0x00005203,
+ "Human Stables01",             0x00000021, 0x00000031, 0x0003301B,
+ "Necromancer Stables",         0x00000021, 0x000002DD, 0x0003431B,
+ "",                            0x00000021, 0x000002F0, 0x00035B1B,
+ "Wizard Stables",              0x00000021, 0x000003BA, 0x0003101B,
+ "Warlock Stables",             0x00000021, 0x00000181, 0x0003201B,
+ "Elf Stables",                 0x00000021, 0x00000195, 0x00034D1B,
+ "Human Tavern01",              0x0000000D, 0x000002C2, 0x00003115,
+ "Necromancer Tavern 01",       0x0000000D, 0x000003B0, 0x00003915,
+ "Dwarven Tavern01",            0x0000000D, 0x000002FE, 0x00005E15,
+ "Wizard Tavern",               0x0000000D, 0x000003BB, 0x00001115,
+ "Warlock Tavern",              0x0000000D, 0x000003A8, 0x00002115,
+ "Elf Tavern",                  0x0000000D, 0x000002CD, 0x00004E15,
+ "Human Temple01",              0x00000024, 0x000002DB, 0x00033217,
+ "Necromancer Temple",          0x00000024, 0x000002DF, 0x00033C17,
+ "Dwarven Temple01",            0x00000024, 0x000002F1, 0x00035617,
+ "Wizard Temple",               0x00000024, 0x000002E0, 0x00030A17,
+ "Warlock Temple",              0x00000024, 0x000003A4, 0x00031B17,
+ "Elf Temple",                  0x00000024, 0x000002CE, 0x00034817,
+ "Human Town Hall",             0x00000010, 0x0000039C, 0x00000E11,
+ "Necromancer Town Hall01",     0x00000010, 0x000003A4, 0x00003D11,
+ "Dwarven Town Hall",           0x00000010, 0x000002DB, 0x00005811,
+ "Wizard Town Hall",            0x00000010, 0x000003BD, 0x00000B11,
+ "Warlock Town Hall",           0x00000010, 0x000002DB, 0x00001C11,
+ "Elf Town Hall",               0x00000010, 0x0000027A, 0x00004911,
+ "Human Training Ground01",     0x00000018, 0x000002C7, 0x00002C1E,
+ "Necromancer Training Ground", 0x00000018, 0x000003AD, 0x00003E1E,
+ "Dwarven Training Ground",     0x00000018, 0x000002F2, 0x0000591E,
+ "Wizard Training Ground",      0x00000018, 0x000003A3, 0x00000C1E,
+ "Warlock Training Ground",     0x00000018, 0x000003A6, 0x00001D1E,
+ "Elf Training Ground",         0x00000018, 0x0000019F, 0x00004A1E,
+ "Human Weapon Smith01",        0x00000016, 0x000002C1, 0x00042D01,
+ "Necromancer Weapon Smith01",  0x00000016, 0x000002D9, 0x00043F01,
+ "Dwarven Weapon Smith01",      0x00000016, 0x000002EE, 0x00045201,
+ "Wizard Weapon Smith",         0x00000016, 0x000002D5, 0x00040D01,
+ "Warlock Weapon Smith",        0x00000016, 0x000002D7, 0x00041701
+};
 
 #include "stru160.h"
 stru160 array_4EB8B8[66] =