# HG changeset patch # User Ritor1 # Date 1411128198 -21600 # Node ID e3a619609dae95a4c6c94d5b3909ff12fffcf83d # Parent 6b8c2f8c7fadf822df5e697aa683a6f9bde90fbb for sounds of decoration diff -r 6b8c2f8c7fad -r e3a619609dae Media/Audio/AudioPlayer.cpp --- a/Media/Audio/AudioPlayer.cpp Fri Sep 19 10:49:17 2014 +0600 +++ b/Media/Audio/AudioPlayer.cpp Fri Sep 19 18:03:18 2014 +0600 @@ -259,7 +259,7 @@ { ReleaseSoundData(this->pSL_Sounds[i].pSoundData[0]); this->pSL_Sounds[i].pSoundData[0] = nullptr; - this->pSL_Sounds[i].uFlags &= 0xFFFFFFFE; + this->pSL_Sounds[i].uFlags &= 0xFFFFFFFE;//~0x00000001 } } } @@ -554,7 +554,7 @@ if ( !bPlayerReady || !uSoundVolumeMultiplier || !hDigDriver || eSoundID == SOUND_Invalid ) return; - int sample_volume = 10000; + float sample_volume = 10000; int sound_id = 0; for (uint i = 0; i < pSoundList->sNumSounds; ++i) @@ -872,8 +872,10 @@ end_channel = 4; assert(object_id < uNumLevelDecorations); sample_volume = GetSoundStrengthByDistanceFromParty(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y, pLevelDecorations[object_id].vPosition.z); - if (!sample_volume) + if (sample_volume == 0.0) return; + if ( pid > 0 ) + { for (uint i = start_channel; i <= end_channel; ++i) { if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )//звук фонтана и шагов не проходят проверку на повтор @@ -884,17 +886,19 @@ FreeChannel(&pMixerChannels[i]); } } + } for ( uint j = start_channel; j <= end_channel; j++ ) { if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] + 4 * (sound_data_id == 0), -1); - if (uVolume) - sample_volume = uVolume; + if (uVolume == 0.0) + sample_volume = uMasterVolume; AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); if (!GetSoundStrengthByDistanceFromParty(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y, pLevelDecorations[object_id].vPosition.z)) return; + AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y)); if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); @@ -1884,7 +1888,7 @@ pLevelDecorations[source_id].vPosition.z); if ( sound_strength ) { - AIL_set_sample_volume(pMixerChannels[i].hSample, sound_strength); + //AIL_set_sample_volume(pMixerChannels[i].hSample, sound_strength); AIL_set_sample_pan(pMixerChannels[i].hSample, sub_4AB66C(pLevelDecorations[source_id].vPosition.x, pLevelDecorations[source_id].vPosition.y)); } @@ -1959,7 +1963,7 @@ LevelDecoration* decor = &pLevelDecorations[_6807B8_level_decorations_ids[i]]; if (int_get_vector_length(abs(decor->vPosition.x - pParty->vPosition.x), abs(decor->vPosition.y - pParty->vPosition.y), - abs(decor->vPosition.z - pParty->vPosition.z)) > 0x2000) + abs(decor->vPosition.z - pParty->vPosition.z)) > 8192) continue; DecorationDesc* decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID]; @@ -2060,7 +2064,8 @@ - stru_5C6E00->uIntegerHalfPi - pParty->sRotationY); if ( v2 > (signed int)stru_5C6E00->uIntegerPi ) v2 = 2 * stru_5C6E00->uIntegerPi - v2; - return (v2 >> 3) - (v2 >> 10); + v2 =(v2 >> 3) - (v2 >> 10) ; + return v2; } // 4AB66C: using guessed type int __fastcall sub_4AB66C(int, int); @@ -2076,7 +2081,7 @@ dir_y = abs(y - pParty->vPosition.y); dir_x = abs(x - pParty->vPosition.x); length = int_get_vector_length(dir_x, dir_y, dir_z); - if ( length <= 0x2000 ) + if ( length <= 8192 ) return 114 - (unsigned __int64)(signed __int64)((double)length * 0.0001220703125 * 100.0); else return 0;