Mercurial > mm7
changeset 2104:9574c5bfb96f
UpdateSounds()
author | Ritor1 |
---|---|
date | Wed, 18 Dec 2013 17:33:04 +0600 |
parents | 2318216e5206 |
children | 7ee21636d67a |
files | AudioPlayer.cpp OSWindow.cpp |
diffstat | 2 files changed, 504 insertions(+), 367 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.cpp Tue Dec 17 23:11:49 2013 +0600 +++ b/AudioPlayer.cpp Wed Dec 18 17:33:04 2013 +0600 @@ -535,36 +535,25 @@ if (!bPlayerReady) return; - if ( this->b3DSoundInitialized && a2 && this->uNum3DSamples > 0 ) + if ( this->b3DSoundInitialized && a2 ) + { + for ( uint i = 0; i < this->uNum3DSamples; ++i ) { - for ( uint i = 0; i < this->uNum3DSamples; ++i ) - { - if ( this->p3DSamples[i].field_4 == a2 && AIL_3D_sample_status(this->p3DSamples[i].hSample) == 4 ) - AIL_end_3D_sample(this->p3DSamples[i].hSample); - } - goto LABEL_9; + if ( this->p3DSamples[i].field_4 == a2 && AIL_3D_sample_status(this->p3DSamples[i].hSample) == AIL::Sample::Playing ) + AIL_end_3D_sample(this->p3DSamples[i].hSample); } - else + } + if ( this->hDigDriver && a2 ) + { + for ( uint i = 0; i < this->uMixerChannels; ++i ) { -LABEL_9: - if ( this->hDigDriver ) + if ( this->pMixerChannels[i].source_pid == a2 && AIL_sample_status(this->pMixerChannels[i].hSample) == AIL::Sample::Playing) { - if ( a2 && this->uMixerChannels > 0 ) - { - for ( uint i = 0; i < this->uMixerChannels; ++i ) - { - if ( this->pMixerChannels[i].source_pid == a2 ) - { - if ( AIL_sample_status(this->pMixerChannels[i].hSample) == AIL::Sample::Playing) - { - AIL_end_sample(this->pMixerChannels[i].hSample); - FreeChannel(&this->pMixerChannels[i]); - } - } - } - } + AIL_end_sample(this->pMixerChannels[i].hSample); + FreeChannel(&this->pMixerChannels[i]); } } + } } //----- (004AA306) -------------------------------------------------------- @@ -703,54 +692,38 @@ SoundDesc* sound_desc = &pSoundList->pSounds[sound_id]; if (!b3DSoundInitialized || sound_desc->Is3D()) { - if (!a3) // generic sound like from UI + if (a3 == 0) // generic sound like from UI { - start_channel = 10; - end_channel = 12; - for (v62 = start_channel; v62 <= end_channel; ++v62) + for (int i = 10; i <= 12; ++i) { - MixerChannel* channel = pMixerChannels + v62; - if (AIL_sample_status(channel->hSample) == AIL::Sample::Done) + if (AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Done) { - AIL_end_sample(channel->hSample); - if (channel->uSourceTrackIdx) - FreeChannel(channel); + AIL_end_sample(pMixerChannels[i].hSample); + if ( pMixerChannels[i].uSourceTrackIdx ) + FreeChannel(&pMixerChannels[i]); break; } } } else if (a3 == -1) // exclusive sounds - can override { - start_channel = 13; - end_channel = 13; - for (v62 = start_channel; v62 <= end_channel; ++v62) + if ( AIL_sample_status(pMixerChannels[13].hSample) == AIL::Sample::Done ) { - MixerChannel* channel = pMixerChannels + v62; - if (AIL_sample_status(channel->hSample) == AIL::Sample::Done) - { - AIL_end_sample(channel->hSample); - if (channel->uSourceTrackIdx) - FreeChannel(channel); - break; - } + AIL_end_sample(pMixerChannels[13].hSample); + if ( pMixerChannels[13].uSourceTrackIdx ) + FreeChannel(&pMixerChannels[13]); } } else { if (a3 < 0) // exclusive sounds - no override { - start_channel = 14; - end_channel = 14; - for (uint i = 0; i < uMixerChannels; ++i) + if ( pMixerChannels[14].source_pid == a3 && AIL_sample_status(pMixerChannels[14].hSample) == AIL::Sample::Playing ) { - MixerChannel* channel = &pMixerChannels[i]; - if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) - { - if (channel->uSourceTrackIdx == sound_id) - return; // already playing the same sound from the same source - return - AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch - FreeChannel(channel); - } + if ( pMixerChannels[14].uSourceTrackIdx == sound_id ) + return; // already playing the same sound from the same source - return + AIL_end_sample(pMixerChannels[14].hSample); // requested new sound from the same source - end & switch + FreeChannel(&pMixerChannels[14]); } } else @@ -762,16 +735,13 @@ case OBJECT_BLVDoor: case OBJECT_Player: { - start_channel = 10; - end_channel = 12; - for (v62 = start_channel; v62 <= end_channel; ++v62) + for ( int i = 10; i <= 12; ++i) { - MixerChannel* channel = pMixerChannels + v62; - if (AIL_sample_status(channel->hSample) == AIL::Sample::Done) + if (AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Done) { - AIL_end_sample(channel->hSample); - if (channel->uSourceTrackIdx) - FreeChannel(channel); + AIL_end_sample(pMixerChannels[i].hSample); + if ( pMixerChannels[i].uSourceTrackIdx ) + FreeChannel(&pMixerChannels[i]); break; } } @@ -782,22 +752,18 @@ { start_channel = 0; end_channel = 3; - assert(object_id < uNumActors); - Actor* actor = &pActors[object_id]; - - sample_volume = GetSoundStrengthByDistanceFromParty(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z); + sample_volume = GetSoundStrengthByDistanceFromParty(pActors[object_id].vPosition.x, pActors[object_id].vPosition.y, pActors[object_id].vPosition.z); if (!sample_volume) return; for (uint i = 0; i < uMixerChannels; ++i) { - MixerChannel* channel = &pMixerChannels[i]; - if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) + if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { - if (channel->uSourceTrackIdx == sound_id) + if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return - AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch - FreeChannel(channel); + AIL_end_sample( pMixerChannels[i].hSample); // requested new sound from the same source - end & switch + FreeChannel(&pMixerChannels[i]); } } } @@ -807,22 +773,20 @@ { start_channel = 4; end_channel = 4; + v62 = 4; assert(object_id < uNumLevelDecorations); - LevelDecoration* decor = &pLevelDecorations[object_id]; - - sample_volume = GetSoundStrengthByDistanceFromParty(decor->vPosition.x, decor->vPosition.y, decor->vPosition.z); + sample_volume = GetSoundStrengthByDistanceFromParty(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y, pLevelDecorations[object_id].vPosition.z); if (!sample_volume) return; for (uint i = 0; i < uMixerChannels; ++i) { - MixerChannel* channel = &pMixerChannels[i]; - if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) + if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )//звук фонтана и шагов не проходят проверку на повтор { - if (channel->uSourceTrackIdx == sound_id) + if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return - AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch - FreeChannel(channel); + AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch + FreeChannel(&pMixerChannels[i]); } } } @@ -830,24 +794,21 @@ case OBJECT_Item: { - start_channel = 5; - end_channel = 7; - + //start_channel = 5; + //end_channel = 7; assert(object_id < uNumSpriteObjects); - SpriteObject* object = &pSpriteObjects[object_id]; - - sample_volume = GetSoundStrengthByDistanceFromParty(object->vPosition.x, object->vPosition.y, object->vPosition.z); + sample_volume = GetSoundStrengthByDistanceFromParty(pSpriteObjects[object_id].vPosition.x, pSpriteObjects[object_id].vPosition.y, pSpriteObjects[object_id].vPosition.z); if (!sample_volume) return; - for (uint i = 0; i < uMixerChannels; ++i) + for (uint i = 5; i <= 7; ++i) { - MixerChannel* channel = &pMixerChannels[i]; - if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) + //MixerChannel* channel = &pMixerChannels[i]; + if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { - if (channel->uSourceTrackIdx == sound_id) + if (pMixerChannels[i].uSourceTrackIdx == sound_id) return; // already playing the same sound from the same source - return - AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch - FreeChannel(channel); + AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch + FreeChannel(&pMixerChannels[i]); } } } @@ -855,17 +816,16 @@ case OBJECT_BModel: { - start_channel = 8; - end_channel = 9; - for (uint i = 0; i < uMixerChannels; ++i) + //start_channel = 8; + //end_channel = 9; + for (uint i = 8; i <= 9; ++i) { - MixerChannel* channel = &pMixerChannels[i]; - if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) + if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { - if (channel->uSourceTrackIdx == sound_id) + if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return - AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch - FreeChannel(channel); + AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch + FreeChannel(&pMixerChannels[i]); } } } @@ -899,9 +859,7 @@ int min_volume = sample_volume; for (uint i = start_channel; i <= end_channel; ++i) { - MixerChannel* channel = &pMixerChannels[i]; - - int volume = AIL_sample_volume(channel->hSample); + int volume = AIL_sample_volume(pMixerChannels[i].hSample); if (volume < min_volume) { min_volume = volume; @@ -934,16 +892,15 @@ v62 = 13; } - MixerChannel* channel = &pMixerChannels[v62]; - AIL_end_sample(channel->hSample); - FreeChannel(channel); + AIL_end_sample(pMixerChannels[v62].hSample); + FreeChannel(&pMixerChannels[v62]); } if (v62 > end_channel)//10!=13 return; //LABEL_150: - if (sample_volume == 10000) + if ( sample_volume == 10000 ) sample_volume = uMasterVolume; //v70 = 0; @@ -951,86 +908,92 @@ { //pSoundDesc = pSoundList->pSounds; //pSoundDesc2 = &pSoundList->pSounds[sound_id]; - if (!sound_desc->pSoundData[0]) + if ( !sound_desc->pSoundData[0] ) { - if (sound_desc->eType == SOUND_DESC_SWAP) + if ( sound_desc->eType == SOUND_DESC_SWAP ) pSoundList->LoadSound(eSoundID, 0); } } //v72 = 4 * (a7 + 30 * sound_id) + 44; - if (!pSoundList->pSounds[sound_id].pSoundData[a7]) + if ( !pSoundList->pSounds[sound_id].pSoundData[a7] ) return; - //pMixerChannel5 = &pAudioPlayer->pMixerChannels[v62]; - MixerChannel* channel = &pMixerChannels[v62]; - AIL_init_sample(channel->hSample); - AIL_set_sample_file(channel->hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); + AIL_init_sample(pMixerChannels[v62].hSample); + AIL_set_sample_file(pMixerChannels[v62].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); if (uVolume) sample_volume = uVolume; - AIL_set_sample_volume(channel->hSample, sample_volume); + AIL_set_sample_volume(pMixerChannels[v62].hSample, sample_volume); int object_type = PID_TYPE(a3), object_id = PID_ID(a3); if (PartyX != -1) { - if (!PartyX) PartyX = pParty->vPosition.x; - if (!PartyY) PartyY = pParty->vPosition.y; - AIL_set_sample_pan(channel->hSample, sub_4AB66C(PartyX, PartyY)); - AIL_set_sample_volume(channel->hSample, GetSoundStrengthByDistanceFromParty(PartyX, PartyY, pParty->vPosition.z)); + if (!PartyX) + PartyX = pParty->vPosition.x; + if (!PartyY) + PartyY = pParty->vPosition.y; + AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(PartyX, PartyY)); + AIL_set_sample_volume(pMixerChannels[v62].hSample, GetSoundStrengthByDistanceFromParty(PartyX, PartyY, pParty->vPosition.z)); } else if (object_type == OBJECT_BLVDoor) { assert(uCurrentlyLoadedLevelType == LEVEL_Indoor); - assert(object_id < pIndoor->uNumDoors); - BLVDoor* door = &pIndoor->pDoors[object_id]; - if (!door->uDoorID) + if ( !pIndoor->pDoors[object_id].uDoorID ) return; - if (!GetSoundStrengthByDistanceFromParty(door->pXOffsets[0], door->pYOffsets[0], door->pZOffsets[0])) + if (!GetSoundStrengthByDistanceFromParty(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0], pIndoor->pDoors[object_id].pZOffsets[0])) { - AIL_end_sample(channel->hSample); - FreeChannel(channel); + AIL_end_sample(pMixerChannels[v62].hSample); + FreeChannel(&pMixerChannels[v62]); return; } - AIL_set_sample_pan(channel->hSample, sub_4AB66C(door->pXOffsets[0], door->pYOffsets[0])); + AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0])); } else if (object_type == OBJECT_Item) { assert(object_id < uNumSpriteObjects); - SpriteObject* object = &pSpriteObjects[object_id]; - if (!GetSoundStrengthByDistanceFromParty(object->vPosition.x, object->vPosition.y, object->vPosition.z) ) + if (!GetSoundStrengthByDistanceFromParty(pSpriteObjects[object_id].vPosition.x, pSpriteObjects[object_id].vPosition.y, pSpriteObjects[object_id].vPosition.z) ) return; - AIL_set_sample_pan(channel->hSample, sub_4AB66C(object->vPosition.x, object->vPosition.y)); + AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pSpriteObjects[object_id].vPosition.x, pSpriteObjects[object_id].vPosition.y)); } else if (object_type == OBJECT_Actor) { assert(object_id < uNumActors); - Actor* actor = &pActors[object_id]; - if (!GetSoundStrengthByDistanceFromParty(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z)) + if (!GetSoundStrengthByDistanceFromParty(pActors[object_id].vPosition.x, pActors[object_id].vPosition.y, pActors[object_id].vPosition.z)) return; - AIL_set_sample_pan(channel->hSample, sub_4AB66C(actor->vPosition.x, actor->vPosition.y)); + AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pActors[object_id].vPosition.x, pActors[object_id].vPosition.y)); } else if (object_type == OBJECT_Decoration) { assert(object_id < uNumLevelDecorations); - LevelDecoration* decor = &pLevelDecorations[object_id]; - if (!GetSoundStrengthByDistanceFromParty(decor->vPosition.x, decor->vPosition.y, decor->vPosition.z)) + if (!GetSoundStrengthByDistanceFromParty(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y, pLevelDecorations[object_id].vPosition.z)) return; - AIL_set_sample_pan(channel->hSample, sub_4AB66C(decor->vPosition.x, decor->vPosition.y)); + AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y)); + if (uNumRepeats) + AIL_set_sample_loop_count(pMixerChannels[v62].hSample, uNumRepeats - 1); + pMixerChannels[v62].uSourceTrackIdx = sound_id; + pMixerChannels[v62].source_pid = a3; + pMixerChannels[v62].uSourceTrackID = eSoundID; + int rval = AIL_start_sample(pMixerChannels[v62].hSample); + if ( sPlaybackRate ) + AIL_set_sample_playback_rate(pMixerChannels[v62].hSample, sPlaybackRate); + if (object_type == OBJECT_Player) + AIL_sample_ms_position(pMixerChannels[v62].hSample, &sLastTrackLengthMS, 0); + return; } //LABEL_184: if (uNumRepeats) - AIL_set_sample_loop_count(channel->hSample, uNumRepeats - 1); - channel->uSourceTrackIdx = sound_id; - channel->source_pid = a3; - channel->uSourceTrackID = eSoundID; - int rval = AIL_start_sample(channel->hSample); + AIL_set_sample_loop_count(pMixerChannels[v62].hSample, uNumRepeats - 1); + pMixerChannels[v62].uSourceTrackIdx = sound_id; + pMixerChannels[v62].source_pid = a3; + pMixerChannels[v62].uSourceTrackID = eSoundID; + int rval = AIL_start_sample(pMixerChannels[v62].hSample); if ( sPlaybackRate ) - AIL_set_sample_playback_rate(channel->hSample, sPlaybackRate); + AIL_set_sample_playback_rate(pMixerChannels[v62].hSample, sPlaybackRate); if (object_type == OBJECT_Player) - AIL_sample_ms_position(channel->hSample, &sLastTrackLengthMS, 0); + AIL_sample_ms_position(pMixerChannels[v62].hSample, &sLastTrackLengthMS, 0); return; } @@ -1373,7 +1336,7 @@ //unsigned __int8 v3; // zf@1 //int *v4; // eax@2 //unsigned __int8 v5; // sf@4 - AudioPlayer_3DSample *v6; // esi@5 + //AudioPlayer_3DSample *v6; // esi@5 int v7; // ebx@6 int v8; // ebx@9 int v9; // ebx@10 @@ -1437,164 +1400,368 @@ if (!bPlayerReady) return; - if (field_2D0_time_left <= pEventTimer->uTimeElapsed) - field_2D0_time_left = 32; - else + //if (field_2D0_time_left <= pEventTimer->uTimeElapsed) + //field_2D0_time_left = 32; + //else + //{ + //field_2D0_time_left -= pEventTimer->uTimeElapsed; + //return; + //} + field_2D0_time_left -= pEventTimer->uTimeElapsed; + if ( field_2D0_time_left <= 0 ) { - field_2D0_time_left -= pEventTimer->uTimeElapsed; - return; - } - //v3 = this->b3DSoundInitialized == 0; - if ( b3DSoundInitialized ) + field_2D0_time_left = 32; + if ( b3DSoundInitialized )//for 3D sound { __debugbreak(); // refactor refactor //v3 = this->uNum3DSamples == 0; //v5 = this->uNum3DSamples < 0; - v59 = 0; - if (uNum3DSamples > 0) + + //if (uNum3DSamples > 0) + //{ + //v6 = this->p3DSamples; + v2 = 0; + //while ( 1 ) + for ( v59 = 0; v59 < pAudioPlayer->uNum3DSamples; ++v59 ) { - v6 = this->p3DSamples; - while ( 1 ) + v7 = PID_TYPE(this->p3DSamples[v59].field_4); + if ( AIL_3D_sample_status(this->p3DSamples[v59].hSample) == 2 ) { - v7 = PID_TYPE(v6->field_4); - if ( AIL_3D_sample_status(v6->hSample) == 2 ) - { - AIL_end_3D_sample(v6->hSample); - pAudioPlayer->_4ABF23(v6); - } - if ( AIL_3D_sample_status(v6->hSample) != 4 ) - goto LABEL_35; - v8 = v7 - 1;// - if ( v8 )//> 1 - break; - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )//==1 - goto LABEL_31; - pDoor = &pIndoor->pDoors[PID_ID(v6->field_4)]; - if ( pDoor->uDoorID ) - { - uNumRepeats = *pDoor->pXOffsets; - a1.vWorldPosition.x = (double)uNumRepeats; - uNumRepeats = *pDoor->pYOffsets; - a1.vWorldPosition.y = (double)uNumRepeats; - uNumRepeats = *pDoor->pZOffsets; - v11 = (double)uNumRepeats; - goto LABEL_21; - } -LABEL_35: - ++v59; - ++v6; - if ( v59 >= pAudioPlayer->uNum3DSamples ) - { - v2 = 0; - goto LABEL_37; - } + AIL_end_3D_sample(this->p3DSamples[v59].hSample); + pAudioPlayer->_4ABF23(&this->p3DSamples[v59]); } - - v9 = v8 - 1;// - if ( v9 )//> 2 + if ( AIL_3D_sample_status(this->p3DSamples[v59].hSample) != 4 ) + continue; + v8 = v7 - 1;// + if ( v8 )//> 1 { - v10 = v9 - 1;// - if ( !v10 )//3 - { - v13 = &pActors[PID_ID(v6->field_4)]; - uNumRepeats = v13->vPosition.x; - v14 = v13->vPosition.y; - a1.vWorldPosition.x = (double)uNumRepeats; - uNumRepeats = v13->vPosition.z; - a1.vWorldPosition.y = (double)v14; - v11 = (double)uNumRepeats; - goto LABEL_21; - } - if ( v10 != 2 )//4 + v9 = v8 - 1;// + if ( v9 )//> 2 { - a1.vWorldPosition.x = (double)pParty->vPosition.x; - a1.vWorldPosition.y = (double)pParty->vPosition.y; - v11 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; - goto LABEL_21; - }//5 - v12 = (SpriteObject *)&pLevelDecorations[PID_ID(v6->field_4)]; - } - else//2 - { - v12 = &pSpriteObjects[PID_ID(v6->field_4)]; - } - a1.vWorldPosition.x = (double)v12->vPosition.x; - a1.vWorldPosition.y = (double)v12->vPosition.y; - v11 = (double)v12->vPosition.z; -LABEL_21: - a1.vWorldPosition.z = v11; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - v16 = pGame->pIndoorCameraD3D->fRotationXCosine; - v17 = pGame->pIndoorCameraD3D->fRotationXSine; - v55 = pGame->pIndoorCameraD3D->fRotationYCosine; - v56 = pGame->pIndoorCameraD3D->fRotationYSine; - if (pGame->pIndoorCameraD3D->sRotationX) + v10 = v9 - 1;// + if ( !v10 )//3 + { + v13 = &pActors[PID_ID(this->p3DSamples[v59].field_4)]; + uNumRepeats = v13->vPosition.x; + v14 = v13->vPosition.y; + a1.vWorldPosition.x = (double)uNumRepeats; + uNumRepeats = v13->vPosition.z; + a1.vWorldPosition.y = (double)v14; + v11 = (double)uNumRepeats; + a1.vWorldPosition.z = v11; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + v16 = pGame->pIndoorCameraD3D->fRotationXCosine; + v17 = pGame->pIndoorCameraD3D->fRotationXSine; + v55 = pGame->pIndoorCameraD3D->fRotationYCosine; + v56 = pGame->pIndoorCameraD3D->fRotationYSine; + if (pGame->pIndoorCameraD3D->sRotationX) + { + v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z; + if ( pRenderer->pRenderD3D ) + { + v19 = *(float *)&uNumRepeats * v56 + v58 * v55; + v20 = v58 * v56 - *(float *)&uNumRepeats * v55; + } + else + { + v19 = v58 * v55 - *(float *)&uNumRepeats * v56; + v20 = v58 * v56 + *(float *)&uNumRepeats * v55; + } + a1.vWorldViewPosition.x = v19 * v16 - v18 * v17; + a1.vWorldViewPosition.y = v20; + a1.vWorldViewPosition.z = v19 * v17 + v18 * v16; + } + else + { + v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + if ( pRenderer->pRenderD3D ) + { + a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55; + v21 = v58 * v56 - *(float *)&uNumRepeats * v55; + } + else + { + a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56; + v21 = v58 * v56 + *(float *)&uNumRepeats * v55; + } + a1.vWorldViewPosition.y = v21; + a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z; + } + } + else + pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); + v58 = a1.vWorldViewPosition.y * -0.012207031; + v22 = a1.vWorldViewPosition.x * 0.012207031; + *(float *)&uNumRepeats = v22; + v23 = abs((signed __int64)v22); + v24 = abs(0); + v25 = abs((signed __int64)v58); + if ( int_get_vector_length(v25, v24, v23) <= 100 ) + { + AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats); + v26 = -*(float *)&uNumRepeats; + v27 = -v58; + AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0); + } + else + { + AIL_end_3D_sample(this->p3DSamples[v59].hSample); + pAudioPlayer->_4ABF23(&this->p3DSamples[v59]); + } + continue; + } + if ( v10 != 2 )//4 + { + a1.vWorldPosition.x = (double)pParty->vPosition.x; + a1.vWorldPosition.y = (double)pParty->vPosition.y; + v11 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; + a1.vWorldPosition.z = v11; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + v16 = pGame->pIndoorCameraD3D->fRotationXCosine; + v17 = pGame->pIndoorCameraD3D->fRotationXSine; + v55 = pGame->pIndoorCameraD3D->fRotationYCosine; + v56 = pGame->pIndoorCameraD3D->fRotationYSine; + if (pGame->pIndoorCameraD3D->sRotationX) + { + v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z; + if ( pRenderer->pRenderD3D ) + { + v19 = *(float *)&uNumRepeats * v56 + v58 * v55; + v20 = v58 * v56 - *(float *)&uNumRepeats * v55; + } + else + { + v19 = v58 * v55 - *(float *)&uNumRepeats * v56; + v20 = v58 * v56 + *(float *)&uNumRepeats * v55; + } + a1.vWorldViewPosition.x = v19 * v16 - v18 * v17; + a1.vWorldViewPosition.y = v20; + a1.vWorldViewPosition.z = v19 * v17 + v18 * v16; + } + else + { + v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + if ( pRenderer->pRenderD3D ) + { + a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55; + v21 = v58 * v56 - *(float *)&uNumRepeats * v55; + } + else + { + a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56; + v21 = v58 * v56 + *(float *)&uNumRepeats * v55; + } + a1.vWorldViewPosition.y = v21; + a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z; + } + } + else + pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); + v58 = a1.vWorldViewPosition.y * -0.012207031; + v22 = a1.vWorldViewPosition.x * 0.012207031; + *(float *)&uNumRepeats = v22; + v23 = abs((signed __int64)v22); + v24 = abs(0); + v25 = abs((signed __int64)v58); + if ( int_get_vector_length(v25, v24, v23) <= 100 ) + { + AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats); + v26 = -*(float *)&uNumRepeats; + v27 = -v58; + AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0); + } + else + { + AIL_end_3D_sample(this->p3DSamples[v59].hSample); + pAudioPlayer->_4ABF23(&this->p3DSamples[v59]); + } + continue; + }//5 + v12 = (SpriteObject *)&pLevelDecorations[PID_ID(this->p3DSamples[v59].field_4)]; + } + else//2 + v12 = &pSpriteObjects[PID_ID(this->p3DSamples[v59].field_4)]; + a1.vWorldPosition.x = (double)v12->vPosition.x; + a1.vWorldPosition.y = (double)v12->vPosition.y; + v11 = (double)v12->vPosition.z; +//LABEL_21: + a1.vWorldPosition.z = v11; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { - v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; - *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; - v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z; - if ( pRenderer->pRenderD3D ) + v16 = pGame->pIndoorCameraD3D->fRotationXCosine; + v17 = pGame->pIndoorCameraD3D->fRotationXSine; + v55 = pGame->pIndoorCameraD3D->fRotationYCosine; + v56 = pGame->pIndoorCameraD3D->fRotationYSine; + if (pGame->pIndoorCameraD3D->sRotationX) { - v19 = *(float *)&uNumRepeats * v56 + v58 * v55; - v20 = v58 * v56 - *(float *)&uNumRepeats * v55; + v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z; + if ( pRenderer->pRenderD3D ) + { + v19 = *(float *)&uNumRepeats * v56 + v58 * v55; + v20 = v58 * v56 - *(float *)&uNumRepeats * v55; + } + else + { + v19 = v58 * v55 - *(float *)&uNumRepeats * v56; + v20 = v58 * v56 + *(float *)&uNumRepeats * v55; + } + a1.vWorldViewPosition.x = v19 * v16 - v18 * v17; + a1.vWorldViewPosition.y = v20; + a1.vWorldViewPosition.z = v19 * v17 + v18 * v16; } else { - v19 = v58 * v55 - *(float *)&uNumRepeats * v56; - v20 = v58 * v56 + *(float *)&uNumRepeats * v55; + v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + if ( pRenderer->pRenderD3D ) + { + a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55; + v21 = v58 * v56 - *(float *)&uNumRepeats * v55; + } + else + { + a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56; + v21 = v58 * v56 + *(float *)&uNumRepeats * v55; + } + a1.vWorldViewPosition.y = v21; + a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z; } - a1.vWorldViewPosition.x = v19 * v16 - v18 * v17; - a1.vWorldViewPosition.y = v20; - a1.vWorldViewPosition.z = v19 * v17 + v18 * v16; + } + else + pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); + v58 = a1.vWorldViewPosition.y * -0.012207031; + v22 = a1.vWorldViewPosition.x * 0.012207031; + *(float *)&uNumRepeats = v22; + v23 = abs((signed __int64)v22); + v24 = abs(0); + v25 = abs((signed __int64)v58); + if ( int_get_vector_length(v25, v24, v23) <= 100 ) + { + AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats); + v26 = -*(float *)&uNumRepeats; + v27 = -v58; + AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0); } else { - v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; - *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; - if ( pRenderer->pRenderD3D ) + AIL_end_3D_sample(this->p3DSamples[v59].hSample); + pAudioPlayer->_4ABF23(&this->p3DSamples[v59]); + } + continue; + } + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )//==1 + { + pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); + v58 = a1.vWorldViewPosition.y * -0.012207031; + v22 = a1.vWorldViewPosition.x * 0.012207031; + *(float *)&uNumRepeats = v22; + v23 = abs((signed __int64)v22); + v24 = abs(0); + v25 = abs((signed __int64)v58); + if ( int_get_vector_length(v25, v24, v23) <= 100 ) + { + AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats); + v26 = -*(float *)&uNumRepeats; + v27 = -v58; + AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0); + } + else + { + AIL_end_3D_sample(this->p3DSamples[v59].hSample); + pAudioPlayer->_4ABF23(&this->p3DSamples[v59]); + } + continue; + } + pDoor = &pIndoor->pDoors[PID_ID(this->p3DSamples[v59].field_4)]; + if ( pDoor->uDoorID ) + { + uNumRepeats = *pDoor->pXOffsets; + a1.vWorldPosition.x = (double)uNumRepeats; + uNumRepeats = *pDoor->pYOffsets; + a1.vWorldPosition.y = (double)uNumRepeats; + uNumRepeats = *pDoor->pZOffsets; + v11 = (double)uNumRepeats; + a1.vWorldPosition.z = v11; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + v16 = pGame->pIndoorCameraD3D->fRotationXCosine; + v17 = pGame->pIndoorCameraD3D->fRotationXSine; + v55 = pGame->pIndoorCameraD3D->fRotationYCosine; + v56 = pGame->pIndoorCameraD3D->fRotationYSine; + if (pGame->pIndoorCameraD3D->sRotationX) { - a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55; - v21 = v58 * v56 - *(float *)&uNumRepeats * v55; + v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z; + if ( pRenderer->pRenderD3D ) + { + v19 = *(float *)&uNumRepeats * v56 + v58 * v55; + v20 = v58 * v56 - *(float *)&uNumRepeats * v55; + } + else + { + v19 = v58 * v55 - *(float *)&uNumRepeats * v56; + v20 = v58 * v56 + *(float *)&uNumRepeats * v55; + } + a1.vWorldViewPosition.x = v19 * v16 - v18 * v17; + a1.vWorldViewPosition.y = v20; + a1.vWorldViewPosition.z = v19 * v17 + v18 * v16; } else { - a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56; - v21 = v58 * v56 + *(float *)&uNumRepeats * v55; + v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x; + *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y; + if ( pRenderer->pRenderD3D ) + { + a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55; + v21 = v58 * v56 - *(float *)&uNumRepeats * v55; + } + else + { + a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56; + v21 = v58 * v56 + *(float *)&uNumRepeats * v55; + } + a1.vWorldViewPosition.y = v21; + a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z; } - a1.vWorldViewPosition.y = v21; - a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z; + } + else + pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); + v58 = a1.vWorldViewPosition.y * -0.012207031; + v22 = a1.vWorldViewPosition.x * 0.012207031; + *(float *)&uNumRepeats = v22; + v23 = abs((signed __int64)v22); + v24 = abs(0); + v25 = abs((signed __int64)v58); + if ( int_get_vector_length(v25, v24, v23) <= 100 ) + { + AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats); + v26 = -*(float *)&uNumRepeats; + v27 = -v58; + AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0); + } + else + { + AIL_end_3D_sample(this->p3DSamples[v59].hSample); + pAudioPlayer->_4ABF23(&this->p3DSamples[v59]); } } - else - { -LABEL_31: - pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u); - } - v58 = a1.vWorldViewPosition.y * -0.012207031; - v22 = a1.vWorldViewPosition.x * 0.012207031; - *(float *)&uNumRepeats = v22; - v23 = abs((signed __int64)v22); - v24 = abs(0); - v25 = abs((signed __int64)v58); - if ( int_get_vector_length(v25, v24, v23) <= 100 ) - { - AIL_set_3D_position(v6->hSample, LODWORD(v58), 0.0, uNumRepeats); - v26 = -*(float *)&uNumRepeats; - v27 = -v58; - AIL_set_3D_orientation(v6->hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0); - } - else - { - AIL_end_3D_sample(v6->hSample); - pAudioPlayer->_4ABF23(v6); - } - goto LABEL_35; } + //} } -LABEL_37: +//LABEL_37: for (uint i = 0; i < uMixerChannels; ++i) { if (AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Done) @@ -1683,8 +1850,6 @@ } } - - if (pCurrentScreen != SCREEN_GAME) { MixerChannel* channel = &pMixerChannels[4]; @@ -1725,9 +1890,9 @@ uNumRepeats = 2; if (decor->field_1A) { - v51 = decor->field_1A - 32; - decor->field_1A = v51; - if ( v51 < 0 ) + //v51 = decor->field_1A - 32; + decor->field_1A = decor->field_1A - 32; + if ( decor->field_1A < 0 ) decor->field_1A = 0; } } @@ -1743,7 +1908,7 @@ { v53 = 8 * _6807B8_level_decorations_ids[i]; LOBYTE(v53) = v53 | OBJECT_Decoration; - PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0); + PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0);//звуки корабля, плескания воды } continue; } @@ -1799,6 +1964,7 @@ } continue; } + } } //----- (004AB66C) -------------------------------------------------------- @@ -1835,37 +2001,27 @@ //----- (004AB71F) -------------------------------------------------------- void AudioPlayer::StopChannels(int uStartChannel, int uEndChannel) { - int v4; // ecx@1 - int v9; // [sp+4h] [bp-4h]@3 - if ( bPlayerReady ) { if ( b3DSoundInitialized ) { - v9 = 0; - if ( uNum3DSamples > 0 ) + for ( uint i = 0; i < uNum3DSamples; ++i ) { - for ( v4 = 0; v4 < uNum3DSamples; ++v4 ) + if ( (uStartChannel == -1 || i < uStartChannel || i > uEndChannel) + && p3DSamples[i].field_8 && pSoundList->pSounds[p3DSamples[i].field_8].eType != SOUND_DESC_SYSTEM) { - if ( (uStartChannel == -1 || v4 < uStartChannel || v4 > uEndChannel) - && p3DSamples[v4].field_8 - && pSoundList->pSounds[p3DSamples[v4].field_8].eType != SOUND_DESC_SYSTEM) - { - AIL_end_3D_sample(p3DSamples[v4].hSample); - _4ABF23(&p3DSamples[v4]); - p3DSamples[v4].field_4 = 0; - v4 = v9; - } - v9 = v4; + AIL_end_3D_sample(p3DSamples[i].hSample); + _4ABF23(&p3DSamples[i]); + p3DSamples[i].field_4 = 0; } } } - if ( hDigDriver && uMixerChannels > 0 ) + if ( hDigDriver ) { for ( int i = 0; i < uMixerChannels; ++i ) { if ( (uStartChannel == -1 || i < uStartChannel || i > uEndChannel) - && pSoundList->pSounds[pMixerChannels[i].uSourceTrackIdx].eType != SOUND_DESC_SYSTEM) + && pSoundList->pSounds[pMixerChannels[i].uSourceTrackIdx].eType != SOUND_DESC_SYSTEM)//все, кроме системных звуков, отключаются { AIL_end_sample(pMixerChannels[i].hSample); FreeChannel(&pMixerChannels[i]); @@ -2226,7 +2382,7 @@ { int v2; // ebx@1 //AudioPlayer *v3; // esi@1 - SoundDesc *v4; // eax@2 + //SoundDesc *v4; // eax@2 unsigned __int8 v5; // zf@5 unsigned __int8 v6; // sf@5 char *v7; // edi@6 @@ -2239,14 +2395,12 @@ int v14; // [sp+4Ch] [bp-8h]@5 int v15; // [sp+50h] [bp-4h]@5 - v2 = 0; - //v3 = this; if ( pSoundList->pSounds ) { - v4 = &pSoundList->pSounds[a2->field_8]; - if ( v4->eType == SOUND_DESC_SWAP) + //v4 = &pSoundList->pSounds[a2->field_8]; + if ( pSoundList->pSounds[a2->field_8].eType == SOUND_DESC_SWAP) { - if ( v4->p3DSound && !(v4->uFlags & SOUND_DESC_SYSTEM) ) + if ( pSoundList->pSounds[a2->field_8].p3DSound && !(pSoundList->pSounds[a2->field_8].uFlags & SOUND_DESC_SYSTEM) ) { v5 = this->uNum3DSamples == 0; v6 = this->uNum3DSamples < 0; @@ -2255,37 +2409,29 @@ if ( v6 | v5 ) goto LABEL_16; v7 = (char *)this->p3DSamples; - do + __debugbreak();//Ritor1 + for ( v2 = 0; v2 < uNum3DSamples; ++v2 ) { if ( a2->field_C == *((int *)v7 + 3) ) { v8 = v15; - v9 = *(int *)v7; + //v9 = this->p3DSamples[v2]; ++v15; v13[v8] = v2; - if ( AIL_3D_sample_status((void *)v9) == 4 ) + if ( AIL_3D_sample_status(&this->p3DSamples[v2]) == 4 ) ++v14; } - ++v2; v7 += 16; } - while ( v2 < uNum3DSamples ); if ( !v14 ) { LABEL_16: pSoundList->UnloadSound(a2->field_8, 1); - v10 = 0; - if ( v15 > 0 ) + for ( v10 = 0; v10 < v15; v10++ ) { - do - { - v11 = v13[v10++]; - *(&bEAXSupported + 4 * (v11 + 2)) = 0; - v12 = __OFSUB__(v10, v15); - v6 = v10 - v15 < 0; - p3DSamples[v11].field_8 = 0; - } - while ( v6 ^ v12 ); + v11 = v13[v10]; + *(&bEAXSupported + 4 * (v11 + 2)) = 0; + p3DSamples[v11].field_8 = 0; } } } @@ -2345,71 +2491,61 @@ //----- (004AC0A2) -------------------------------------------------------- int AudioPlayer::_4AC0A2() { - AudioPlayer *v1; // esi@1 - unsigned int v2; // eax@1 - char v3; // zf@1 - int v4; // ebx@1 - int *v5; // edi@2 - int v6; // eax@4 - AudioPlayer_3DSample *v8; // ebx@7 + unsigned int map_id; // eax@1 + //int v4; // ebx@1 + //int *v5; // edi@2 + //int v6; // eax@4 + //AudioPlayer_3DSample *v8; // ebx@7 void *v9; // eax@8 - int v10; // ebx@14 - unsigned int v11; // eax@14 + //int v10; // ebx@14 + //unsigned int v11; // eax@14 int v12; // [sp+1Ch] [bp-8h]@1 - int v13; // [sp+20h] [bp-4h]@6 + //int v13; // [sp+20h] [bp-4h]@6 - v1 = this; - v2 = pMapStats->GetMapInfo(pCurrentMapName); - v3 = v1->b3DSoundInitialized == 0; - v4 = v2; - v12 = v2; - if ( !v3 ) + __debugbreak();//Ritor1 + map_id = pMapStats->GetMapInfo(pCurrentMapName); + if ( this->b3DSoundInitialized ) { - v5 = &v1->uNum3DSamples; - AIL_3D_provider_attribute(v1->h3DSoundProvider, "Maximum supported samples", &v1->uNum3DSamples); - if ( v1->uNum3DSamples > 32 ) - *v5 = 32; - v6 = *v5; - if ( !*v5 ) + //v5 = &this->uNum3DSamples; + AIL_3D_provider_attribute(this->h3DSoundProvider, "Maximum supported samples", &this->uNum3DSamples); + if ( this->uNum3DSamples > 32 ) + this->uNum3DSamples = 32; + //v6 = this->uNum3DSamples; + if ( !this->uNum3DSamples ) { - v1->b3DSoundInitialized = 0; + this->b3DSoundInitialized = 0; return -1; } - v13 = 0; - if ( v6 > 0 ) - { - v8 = v1->p3DSamples; - while ( 1 ) + //v13 = 0; + //if ( this->uNum3DSamples > 0 ) + //{ + //v8 = this->p3DSamples; + //while ( 1 ) + for ( uint i = 0; i < this->uNum3DSamples; ++i ) { - v9 = (void *)AIL_allocate_3D_sample_handle(v1->h3DSoundProvider); - v8->hSample = v9; + v9 = (void *)AIL_allocate_3D_sample_handle(this->h3DSoundProvider); + this->p3DSamples[i].hSample = v9; if ( !v9 ) - break; + this->uNum3DSamples = i; AIL_set_3D_sample_float_distances(v9, 4096.0, 256.0, 4096.0, 256.0); - AIL_set_3D_sample_volume(v8->hSample, v1->s3DSoundVolume); - ++v13; - ++v8; - if ( v13 >= *v5 ) - goto LABEL_12; + AIL_set_3D_sample_volume(this->p3DSamples[i].hSample, this->s3DSoundVolume); + //++v8; } - *v5 = v13; -LABEL_12: - v4 = v12; - } - if ( v1->bEAXSupported ) + //} + if ( this->bEAXSupported ) { - v10 = v4; - v11 = pMapStats->pInfos[v10].uEAXEnv; - v12 = pMapStats->pInfos[v10].uEAXEnv; - if ( v11 >= 0x1A ) + //v10 = v4; + //v11 = pMapStats->pInfos[map_id].uEAXEnv; + v12 = pMapStats->pInfos[map_id].uEAXEnv; + if ( pMapStats->pInfos[map_id].uEAXEnv >= 0x1A ) { pAudioPlayer->SetEAXPreferences(); - v1->field_214 = -1; + this->field_214 = -1; } else { - AIL_set_3D_provider_preference(v1->h3DSoundProvider, "EAX environment selection", &v12); - v1->field_214 = v12; + AIL_set_3D_provider_preference(this->h3DSoundProvider, "EAX environment selection", &v12); + this->field_214 = v12; } } } @@ -2419,7 +2555,8 @@ //----- (004A96BE) -------------------------------------------------------- void ReleaseSoundData(void *_this) { - for ( uint i = 0; (void *)&pSounds[i].pSoundData < (void *)&pSounds[2999].pSoundData; i++ ) + //for ( uint i = 0; (void *)&pSounds[i].pSoundData < (void *)&pSounds[2999].pSoundData; i++ ) + for ( uint i = 0; i < 2999; i++ ) { if ( pSounds[i].pSoundData == _this ) {
--- a/OSWindow.cpp Tue Dec 17 23:11:49 2013 +0600 +++ b/OSWindow.cpp Wed Dec 18 17:33:04 2013 +0600 @@ -331,7 +331,7 @@ else pMiscTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); + pAudioPlayer->StopChannels(-1, -1);//приостановка воспроизведения звуков при неактивном окне игры if ( pAudioPlayer->hAILRedbook ) AIL_redbook_pause(pAudioPlayer->hAILRedbook); }