Mercurial > might-and-magic-trilogy
diff AudioPlayer.cpp @ 3:540178ef9b18
Main menu functionality
author | Nomad |
---|---|
date | Wed, 10 Oct 2012 19:10:15 +0200 |
parents | 2ca04ccb612a |
children | be2066176d89 |
line wrap: on
line diff
--- a/AudioPlayer.cpp Wed Oct 10 14:21:15 2012 +0200 +++ b/AudioPlayer.cpp Wed Oct 10 19:10:15 2012 +0200 @@ -38,9 +38,9 @@ -unsigned __int8 uSoundVolumeMultiplier; -unsigned __int8 uVoicesVolumeMultiplier; -unsigned __int8 uMusicVolimeMultiplier; +unsigned __int8 uSoundVolumeMultiplier = 4; +unsigned __int8 uVoicesVolumeMultiplier = 4; +unsigned __int8 uMusicVolimeMultiplier = 4; int bWalkSound; // idb float pSoundVolumeLevels[777]; // idb @@ -146,7 +146,7 @@ int a2; // [sp+A8h] [bp-4h]@2 v3 = this; - if ( dword_6BE364_game_settings_1 & 0x10 + if (bNoSound || (v4 = this->uNumSounds, v5 = 1, v8 = __OFSUB__(this->uNumSounds, 1), @@ -212,7 +212,6 @@ v3->pSounds[v12].p3DSound = v3->pSounds[v12].pSoundData[0]; return a2; } -// 6BE364: using guessed type int dword_6BE364_game_settings_1; //----- (004A9BBD) -------------------------------------------------------- int SoundList::LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6) @@ -539,31 +538,18 @@ } //----- (004AA13F) -------------------------------------------------------- -void AudioPlayer::PlayMusicTrack(unsigned int uTrackID) +void AudioPlayer::PlayMusicTrack(MusicID eTrack) { - AudioPlayer *v2; // esi@1 - unsigned int v3; // [sp+0h] [bp-4h]@0 - - v2 = this; - if ( !(dword_6BE364_game_settings_1 & 0x10) && hAILRedbook && uMusicVolimeMultiplier ) + if (!bNoSound && bPlayerReady && hAILRedbook && uMusicVolimeMultiplier) { - if ( bPlayerReady ) - { - if ( hAILRedbook ) - AIL_redbook_set_volume( - hAILRedbook, - (signed)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0)); - } AIL_redbook_stop(hAILRedbook); - AIL_redbook_track_info(hAILRedbook, v3, &v2->uCurrentMusicTrackStartMS, &v2->uCurrentMusicTrackEndMS); - AIL_redbook_play(hAILRedbook, v2->uCurrentMusicTrackStartMS + 1, v2->uCurrentMusicTrackEndMS); - v2->uCurrentMusicTrackLength = ((v2->uCurrentMusicTrackEndMS - v2->uCurrentMusicTrackStartMS) << 7) / 0x3E8; + AIL_redbook_set_volume(hAILRedbook, (signed)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); + AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS); + AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS); + uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000; } } -// 4AA13F: could not find valid save-restore pair for ebx -// 4AA13F: could not find valid save-restore pair for edi -// 4D8324: using guessed type int __stdcall AIL_redbook_stop(int); -// 6BE364: using guessed type int dword_6BE364_game_settings_1; + //----- (004AA1F3) -------------------------------------------------------- void AudioPlayer::SetMusicVolume(int vol) @@ -1889,8 +1875,12 @@ SMACKW32_DLL_Initialize(); AIL_startup(); - hAILRedbook = AIL_redbook_open_drive(cMM7GameCDDriveLetter/*cGameCDDriveLetter*/); + if (bCanLoadFromCD) + hAILRedbook = AIL_redbook_open_drive(cMM7GameCDDriveLetter/*cGameCDDriveLetter*/); + //else + // hAILRedbook = AIL_redbook_open(0); //v4 = Audio_GetFirstHardwareDigitalDriver(); + hDigDriver = Audio_GetFirstHardwareDigitalDriver(); if ( hDigDriver ) SmackSoundUseMSS(hDigDriver); @@ -2363,7 +2353,7 @@ v0 = pMapStats->GetMapInfo(pCurrentMapName); if ( v0 ) - pAudioPlayer->PlayMusicTrack(pMapStats->pInfos[v0].uRedbookTrackID); + pAudioPlayer->PlayMusicTrack((MusicID)pMapStats->pInfos[v0].uRedbookTrackID); } //----- (004AC004) --------------------------------------------------------