Mercurial > mm7
comparison AudioPlayer.cpp @ 398:7189d0bddf07
Слияние
author | Ritor1 |
---|---|
date | Sat, 23 Feb 2013 02:12:55 +0600 |
parents | 5fd328336048 5bea494a2365 |
children | 74205b91647b |
comparison
equal
deleted
inserted
replaced
397:5fd328336048 | 398:7189d0bddf07 |
---|---|
1 #include <string> | 1 #include <string> |
2 #include <assert.h> | |
2 | 3 |
3 #include "AudioPlayer.h" | 4 #include "AudioPlayer.h" |
4 #include "Allocator.h" | 5 #include "Allocator.h" |
5 #include "FrameTableInc.h" | 6 #include "FrameTableInc.h" |
6 #include "Indoor.h" | 7 #include "Indoor.h" |
11 #include "DecorationList.h" | 12 #include "DecorationList.h" |
12 #include "Time.h" | 13 #include "Time.h" |
13 #include "OSInfo.h" | 14 #include "OSInfo.h" |
14 #include "Math.h" | 15 #include "Math.h" |
15 #include "MapInfo.h" | 16 #include "MapInfo.h" |
17 #include "Actor.h" | |
18 #include "GUIWindow.h" | |
16 #include "Log.h" | 19 #include "Log.h" |
17 | 20 |
18 #include "Bink_Smacker.h" | 21 #include "Bink_Smacker.h" |
19 | 22 |
20 #include "mm7_data.h" | 23 #include "mm7_data.h" |
600 if ( v2->uMixerChannels > 0 ) | 603 if ( v2->uMixerChannels > 0 ) |
601 { | 604 { |
602 v6 = v2->pMixerChannels; | 605 v6 = v2->pMixerChannels; |
603 do | 606 do |
604 { | 607 { |
605 if ( v6->dword_000004 == a2 ) | 608 if ( v6->source_pid == a2 ) |
606 { | 609 { |
607 if ( AIL_sample_status(v6->hSample) == 4 ) | 610 if ( AIL_sample_status(v6->hSample) == AIL::Sample::Playing) |
608 { | 611 { |
609 AIL_end_sample(v6->hSample); | 612 AIL_end_sample(v6->hSample); |
610 _4ABE55(v6); | 613 _4ABE55(v6); |
611 } | 614 } |
612 } | 615 } |
618 } | 621 } |
619 } | 622 } |
620 } | 623 } |
621 } | 624 } |
622 } | 625 } |
623 // 4D82F4: using guessed type int __stdcall AIL_3D_sample_status(int); | |
624 // 4D82F8: using guessed type int __stdcall AIL_sample_status(int); | |
625 // 4D82FC: using guessed type int __stdcall AIL_end_sample(int); | |
626 // 4D8300: using guessed type int __stdcall AIL_end_3D_sample(int); | |
627 | 626 |
628 //----- (004AA306) -------------------------------------------------------- | 627 //----- (004AA306) -------------------------------------------------------- |
629 void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int PartyX, signed int PartyY, int a7, unsigned int uVolume, int sPlaybackRate) | 628 void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int PartyX, signed int PartyY, int a7, unsigned int uVolume, int sPlaybackRate) |
630 { | 629 { |
631 //AudioPlayer *pAudioPlayer1; // esi@1 | 630 //AudioPlayer *pAudioPlayer1; // esi@1 |
778 if ( pAudioPlayer->uMixerChannels > 0 ) | 777 if ( pAudioPlayer->uMixerChannels > 0 ) |
779 { | 778 { |
780 pMixerChannel = pAudioPlayer->pMixerChannels; | 779 pMixerChannel = pAudioPlayer->pMixerChannels; |
781 do | 780 do |
782 { | 781 { |
783 if ( AIL_sample_status(pMixerChannel->hSample) == 4 && pMixerChannel->dword_000004 == a3 | 782 if ( AIL_sample_status(pMixerChannel->hSample) == AIL::Sample::Playing && pMixerChannel->source_pid == a3 |
784 && AIL_sample_status(pMixerChannel->hSample) == 4 ) | 783 && AIL_sample_status(pMixerChannel->hSample) == AIL::Sample::Playing) |
785 { | 784 { |
786 if ( pMixerChannel->uSourceTrackIdx == pNum ) | 785 if ( pMixerChannel->uSourceTrackIdx == pNum ) |
787 return; | 786 return; |
788 AIL_end_sample(pMixerChannel->hSample); | 787 AIL_end_sample(pMixerChannel->hSample); |
789 _4ABE55(pMixerChannel); | 788 _4ABE55(pMixerChannel); |
799 v62 = varC; | 798 v62 = varC; |
800 //pAudioPlayer4 = pAudioPlayer; | 799 //pAudioPlayer4 = pAudioPlayer; |
801 if ( varC <= v96 ) | 800 if ( varC <= v96 ) |
802 { | 801 { |
803 pMixerChannel2 = &pAudioPlayer->pMixerChannels[varC]; | 802 pMixerChannel2 = &pAudioPlayer->pMixerChannels[varC]; |
804 while ( AIL_sample_status(pMixerChannel2->hSample) != 2 ) | 803 while ( AIL_sample_status(pMixerChannel2->hSample) != AIL::Sample::Done) |
805 { | 804 { |
806 ++v62; | 805 ++v62; |
807 ++pMixerChannel2; | 806 ++pMixerChannel2; |
808 if ( v62 > v96 ) | 807 if ( v62 > v96 ) |
809 goto LABEL_140; | 808 goto LABEL_140; |
901 LABEL_184: | 900 LABEL_184: |
902 if ( uNumRepeats ) | 901 if ( uNumRepeats ) |
903 AIL_set_sample_loop_count(pMixerChannel5->hSample, uNumRepeats - 1); | 902 AIL_set_sample_loop_count(pMixerChannel5->hSample, uNumRepeats - 1); |
904 v85 = pMixerChannel5->hSample; | 903 v85 = pMixerChannel5->hSample; |
905 pMixerChannel5->uSourceTrackIdx = pNum; | 904 pMixerChannel5->uSourceTrackIdx = pNum; |
906 pMixerChannel5->dword_000004 = v76; | 905 pMixerChannel5->source_pid = v76; |
907 pMixerChannel5->uSourceTrackID = eSoundID; | 906 pMixerChannel5->uSourceTrackID = eSoundID; |
908 AIL_start_sample(v85); | 907 AIL_start_sample(v85); |
909 if ( sPlaybackRate ) | 908 if ( sPlaybackRate ) |
910 AIL_set_sample_playback_rate(pMixerChannel5->hSample, sPlaybackRate); | 909 AIL_set_sample_playback_rate(pMixerChannel5->hSample, sPlaybackRate); |
911 if ( (v76 & 7) == 4 ) | 910 if ( (v76 & 7) == 4 ) |
1338 } | 1337 } |
1339 | 1338 |
1340 | 1339 |
1341 | 1340 |
1342 //----- (004AAFCF) -------------------------------------------------------- | 1341 //----- (004AAFCF) -------------------------------------------------------- |
1343 void AudioPlayer::_4AAFCF() | 1342 void AudioPlayer::UpdateSounds() |
1344 { | 1343 { |
1345 AudioPlayer *pAudioPlayer; // edi@1 | 1344 //AudioPlayer *pAudioPlayer; // edi@1 |
1346 int v2; // ebx@1 | 1345 int v2; // ebx@1 |
1347 unsigned __int8 v3; // zf@1 | 1346 //unsigned __int8 v3; // zf@1 |
1348 int *v4; // eax@2 | 1347 //int *v4; // eax@2 |
1349 unsigned __int8 v5; // sf@4 | 1348 //unsigned __int8 v5; // sf@4 |
1350 AudioPlayer_3DSample *v6; // esi@5 | 1349 AudioPlayer_3DSample *v6; // esi@5 |
1351 int v7; // ebx@6 | 1350 int v7; // ebx@6 |
1352 int v8; // ebx@9 | 1351 int v8; // ebx@9 |
1353 int v9; // ebx@10 | 1352 int v9; // ebx@10 |
1354 int v10; // ebx@11 | 1353 int v10; // ebx@11 |
1367 int v23; // ST1C_4@32 | 1366 int v23; // ST1C_4@32 |
1368 int v24; // ebx@32 | 1367 int v24; // ebx@32 |
1369 int v25; // eax@32 | 1368 int v25; // eax@32 |
1370 float v26; // ST10_4@34 | 1369 float v26; // ST10_4@34 |
1371 float v27; // ST08_4@34 | 1370 float v27; // ST08_4@34 |
1372 MixerChannel *v28; // esi@38 | 1371 //MixerChannel *v28; // esi@38 |
1373 unsigned __int8 v29; // of@43 | 1372 //unsigned __int8 v29; // of@43 |
1374 MixerChannel *v30; // esi@44 | 1373 //MixerChannel *v30; // esi@44 |
1375 int v31; // eax@45 | 1374 //int v31; // eax@45 |
1376 LayingItem *v32; // eax@49 | 1375 //LayingItem *v32; // eax@49 |
1377 Actor *v33; // edi@50 | 1376 //Actor *v33; // edi@50 |
1378 int v34; // eax@50 | 1377 //int v34; // eax@50 |
1379 unsigned int v35; // edx@51 | 1378 //unsigned int v35; // edx@51 |
1380 unsigned int v36; // ecx@51 | 1379 //unsigned int v36; // ecx@51 |
1381 LayingItem *v37; // edi@53 | 1380 //LayingItem *v37; // edi@53 |
1382 int v38; // eax@53 | 1381 int v38; // eax@53 |
1383 BLVDoor *v39; // edi@56 | 1382 //BLVDoor *v39; // edi@56 |
1384 int v40; // eax@57 | 1383 //int v40; // eax@57 |
1385 int v41; // eax@60 | 1384 //int v41; // eax@60 |
1386 MixerChannel *v42; // edi@65 | 1385 //MixerChannel *v42; // edi@65 |
1387 int v43; // ebx@68 | 1386 //int v43; // ebx@68 |
1388 LevelDecoration *v44; // esi@68 | 1387 //LevelDecoration *v44; // esi@68 |
1389 int v45; // ST1C_4@68 | 1388 //int v45; // ST1C_4@68 |
1390 int v46; // edi@68 | 1389 //int v46; // edi@68 |
1391 int v47; // eax@68 | 1390 //int v47; // eax@68 |
1392 DecorationDesc *v48; // edi@69 | 1391 //DecorationDesc *v48; // edi@69 |
1393 __int16 v49; // ax@69 | 1392 //__int16 v49; // ax@69 |
1394 __int16 v50; // ax@70 | 1393 //__int16 v50; // ax@70 |
1395 __int16 v51; // ax@71 | 1394 __int16 v51; // ax@71 |
1396 __int16 v52; // ax@73 | 1395 //__int16 v52; // ax@73 |
1397 signed int v53; // eax@88 | 1396 signed int v53; // eax@88 |
1398 RenderVertexSoft a1; // [sp+24h] [bp-48h]@1 | 1397 RenderVertexSoft a1; // [sp+24h] [bp-48h]@1 |
1399 float v55; // [sp+54h] [bp-18h]@22 | 1398 float v55; // [sp+54h] [bp-18h]@22 |
1400 float v56; // [sp+58h] [bp-14h]@22 | 1399 float v56; // [sp+58h] [bp-14h]@22 |
1401 int uNumRepeats; // [sp+5Ch] [bp-10h]@15 | 1400 int uNumRepeats; // [sp+5Ch] [bp-10h]@15 |
1402 float v58; // [sp+60h] [bp-Ch]@23 | 1401 float v58; // [sp+60h] [bp-Ch]@23 |
1403 int v59; // [sp+64h] [bp-8h]@4 | 1402 int v59; // [sp+64h] [bp-8h]@4 |
1404 AudioPlayer *thisa; // [sp+68h] [bp-4h]@1 | 1403 //AudioPlayer *thisa; // [sp+68h] [bp-4h]@1 |
1405 | 1404 |
1406 pAudioPlayer = this; | 1405 //pAudioPlayer = this; |
1407 v2 = 0; | 1406 v2 = 0; |
1408 thisa = this; | 1407 //thisa = this; |
1409 v3 = this->bPlayerReady == 0; | 1408 //v3 = this->bPlayerReady == 0; |
1410 a1.flt_2C = 0.0; | 1409 //a1.flt_2C = 0.0; |
1411 if ( !v3 ) | 1410 if (!bPlayerReady) |
1412 { | 1411 return; |
1413 v4 = &this->field_2D0_time_left; | 1412 |
1414 *v4 -= pEventTimer->uTimeElapsed; | 1413 if (field_2D0_time_left <= pEventTimer->uTimeElapsed) |
1415 if ( this->field_2D0_time_left <= 0 ) | 1414 field_2D0_time_left = 32; |
1416 { | 1415 else |
1417 v3 = this->b3DSoundInitialized == 0; | 1416 { |
1418 *v4 = 32; | 1417 field_2D0_time_left -= pEventTimer->uTimeElapsed; |
1419 if ( !v3 ) | 1418 return; |
1420 { | 1419 } |
1421 v3 = this->uNum3DSamples == 0; | 1420 |
1422 v5 = this->uNum3DSamples < 0; | 1421 //v3 = this->b3DSoundInitialized == 0; |
1422 if (b3DSoundInitialized) | |
1423 { | |
1424 __debugbreak(); // refactor refactor | |
1425 //v3 = this->uNum3DSamples == 0; | |
1426 //v5 = this->uNum3DSamples < 0; | |
1423 v59 = 0; | 1427 v59 = 0; |
1424 if ( !(v5 | v3) ) | 1428 if (uNum3DSamples > 0) |
1425 { | 1429 { |
1426 v6 = this->p3DSamples; | 1430 v6 = this->p3DSamples; |
1427 while ( 1 ) | 1431 while ( 1 ) |
1428 { | 1432 { |
1429 v7 = v6->field_4 & 7; | 1433 v7 = v6->field_4 & 7; |
1457 { | 1461 { |
1458 v2 = 0; | 1462 v2 = 0; |
1459 goto LABEL_37; | 1463 goto LABEL_37; |
1460 } | 1464 } |
1461 } | 1465 } |
1466 | |
1462 v9 = v8 - 1; | 1467 v9 = v8 - 1; |
1463 if ( v9 ) | 1468 if ( v9 ) |
1464 { | 1469 { |
1465 v10 = v9 - 1; | 1470 v10 = v9 - 1; |
1466 if ( !v10 ) | 1471 if ( !v10 ) |
1559 pAudioPlayer->_4ABF23(v6); | 1564 pAudioPlayer->_4ABF23(v6); |
1560 } | 1565 } |
1561 goto LABEL_35; | 1566 goto LABEL_35; |
1562 } | 1567 } |
1563 } | 1568 } |
1569 | |
1570 | |
1571 | |
1572 | |
1573 | |
1574 | |
1575 | |
1564 LABEL_37: | 1576 LABEL_37: |
1565 if ( pAudioPlayer->uMixerChannels > v2 ) | 1577 for (uint i = 0; i < uMixerChannels; ++i) |
1566 { | 1578 { |
1567 v28 = pAudioPlayer->pMixerChannels; | 1579 auto channel = pMixerChannels + i; |
1568 do | 1580 |
1569 { | 1581 AIL_end_sample(channel->hSample); |
1570 if ( AIL_sample_status(v28->hSample) == 2 ) | 1582 _4ABE55(channel); |
1571 { | 1583 } |
1572 AIL_end_sample(v28->hSample); | 1584 |
1573 pAudioPlayer->_4ABE55(v28); | 1585 for (uint i = 0; i < uMixerChannels; ++i) |
1574 } | 1586 { |
1575 ++v2; | 1587 auto channel = pMixerChannels + i; |
1576 ++v28; | 1588 int source_type = channel->source_pid & 7, |
1577 } | 1589 source_id = channel->source_pid >> 3; |
1578 while ( v2 < pAudioPlayer->uMixerChannels ); | 1590 int source_x, |
1579 v2 = 0; | 1591 source_y, |
1580 } | 1592 source_z; |
1581 //v29 = __OFSUB__(v1->uMixerChannels, v2); | 1593 |
1582 v29 = pAudioPlayer->uMixerChannels > v2; | 1594 switch (source_type) |
1583 v3 = pAudioPlayer->uMixerChannels == v2; | 1595 { |
1584 v5 = pAudioPlayer->uMixerChannels - v2 < 0; | 1596 case 0: |
1585 v59 = v2; | 1597 case OBJECT_Player: |
1586 if ( !((unsigned __int8)(v5 ^ v29) | v3) ) | 1598 continue; |
1587 { | 1599 |
1588 v30 = pAudioPlayer->pMixerChannels; | 1600 case OBJECT_BLVDoor: |
1589 while ( 1 ) | 1601 { |
1590 { | 1602 assert(uCurrentlyLoadedLevelType == LEVEL_Indoor); |
1591 v31 = v30->dword_000004; | 1603 |
1592 if ( (v30->dword_000004 & 7) == 1 ) | 1604 assert(source_id < pIndoor->uNumDoors); |
1593 { | 1605 auto door = pIndoor->pDoors + source_id; |
1594 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | 1606 if (!door->uDoorID) |
1595 { | 1607 continue; |
1596 v39 = &pIndoor->pDoors[v31 >> 3]; | 1608 |
1597 if ( !v39->uDoorID ) | 1609 source_x = door->pXOffsets[0]; |
1598 { | 1610 source_y = door->pYOffsets[0]; |
1599 LABEL_61: | 1611 source_z = door->pZOffsets[0]; |
1600 pAudioPlayer = thisa; | 1612 } |
1601 goto LABEL_62; | 1613 break; |
1602 } | 1614 |
1603 v40 = GetSoundStrengthByDistanceFromParty(*v39->pXOffsets, *v39->pYOffsets, *v39->pZOffsets); | 1615 case OBJECT_Item: |
1604 if ( !v40 ) | 1616 { |
1605 { | 1617 assert(source_id < uNumLayingItems); |
1606 LABEL_58: | 1618 auto object = &pLayingItems[source_id]; |
1607 AIL_end_sample(v30->hSample); | 1619 |
1608 thisa->_4ABE55(v30); | 1620 source_x = object->vPosition.x; |
1609 goto LABEL_61; | 1621 source_y = object->vPosition.y; |
1610 } | 1622 source_z = object->vPosition.z; |
1611 AIL_set_sample_volume(v30->hSample, v40); | 1623 } |
1612 v35 = *v39->pYOffsets; | 1624 break; |
1613 v36 = *v39->pXOffsets; | 1625 |
1614 LABEL_60: | 1626 case OBJECT_Decoration: |
1615 v41 = sub_4AB66C(v36, v35); | 1627 { |
1616 AIL_set_sample_pan(v30->hSample, v41); | 1628 assert(source_id < uNumLevelDecorations); |
1617 goto LABEL_61; | 1629 auto object = (LayingItem *)&pLevelDecorations[source_id]; |
1618 } | 1630 |
1619 } | 1631 source_x = object->vPosition.x; |
1620 else | 1632 source_y = object->vPosition.y; |
1621 { | 1633 source_z = object->vPosition.z; |
1622 if ( (v30->dword_000004 & 7) == 2 ) | 1634 } |
1623 { | 1635 break; |
1624 v32 = &pLayingItems[v31 >> 3]; | 1636 |
1625 goto LABEL_53; | 1637 case OBJECT_Actor: |
1626 } | 1638 { |
1627 if ( (v30->dword_000004 & 7) == 3 ) | 1639 assert(source_id < uNumActors); |
1628 { | 1640 auto actor = pActors + source_id; |
1629 v33 = &pActors[v31 >> 3]; | 1641 |
1630 v34 = GetSoundStrengthByDistanceFromParty(v33->vPosition.x, v33->vPosition.y, v33->vPosition.z); | 1642 source_x = actor->vPosition.x; |
1631 if ( !v34 ) | 1643 source_y = actor->vPosition.y; |
1632 goto LABEL_58; | 1644 source_z = actor->vPosition.z; |
1633 AIL_set_sample_volume(v30->hSample, v34); | 1645 } |
1634 v35 = v33->vPosition.y; | 1646 break; |
1635 v36 = v33->vPosition.x; | 1647 |
1636 goto LABEL_60; | 1648 default: |
1637 } | 1649 assert(false); |
1638 if ( (v30->dword_000004 & 7) == 5 ) | 1650 continue; |
1639 { | 1651 } |
1640 v32 = (LayingItem *)&pLevelDecorations[v31 >> 3]; | 1652 |
1641 LABEL_53: | 1653 if (auto sound_strength = GetSoundStrengthByDistanceFromParty(source_x, source_y, source_z)) |
1642 v37 = v32; | 1654 { |
1643 v38 = GetSoundStrengthByDistanceFromParty(v32->vPosition.x, v32->vPosition.y, v32->vPosition.z); | 1655 AIL_set_sample_volume(channel->hSample, sound_strength); |
1644 if ( !v38 ) | 1656 AIL_set_sample_pan(channel->hSample, sub_4AB66C(source_x, source_y)); |
1645 goto LABEL_58; | 1657 } |
1646 AIL_set_sample_volume(v30->hSample, v38); | 1658 else |
1647 v35 = v37->vPosition.y; | 1659 { |
1648 v36 = v37->vPosition.x; | 1660 AIL_end_sample(channel->hSample); |
1649 goto LABEL_60; | 1661 _4ABE55(channel); |
1650 } | 1662 } |
1651 } | 1663 } |
1652 LABEL_62: | 1664 |
1653 ++v59; | 1665 |
1654 ++v30; | 1666 |
1655 if ( v59 >= pAudioPlayer->uMixerChannels ) | 1667 if (pCurrentScreen != SCREEN_GAME) |
1656 { | 1668 { |
1657 v2 = 0; | 1669 auto channel = &pMixerChannels[4]; |
1658 break; | 1670 if (AIL_sample_status(channel->hSample) == AIL::Sample::Playing) |
1659 } | 1671 AIL_end_sample(channel->hSample); |
1660 } | 1672 return; |
1661 } | 1673 } |
1662 if ( pCurrentScreen != v2 ) | 1674 if (!_6807E0_num_decorations_with_sounds_6807B8) |
1663 { | 1675 return; |
1664 v42 = &pAudioPlayer->pMixerChannels[4]; | 1676 |
1665 if ( AIL_sample_status(v42->hSample) == 4 ) | 1677 v55 = 0; |
1666 AIL_end_sample(v42->hSample); | 1678 //v59 = 0; |
1667 return; | 1679 for (uint i = 0; i < _6807E0_num_decorations_with_sounds_6807B8; ++i) |
1668 } | 1680 { |
1669 v59 = v2; | 1681 //while ( 1 ) |
1670 if ( _6807E0_num_decorations_with_sounds_6807B8 <= v2 ) | 1682 //{ |
1671 return; | |
1672 while ( 1 ) | |
1673 { | |
1674 LODWORD(v56) = 1; | 1683 LODWORD(v56) = 1; |
1675 v43 = 4 * v59 + 6817720; | 1684 //v43 = _6807B8_level_decorations_ids[v59]; |
1676 v44 = &pLevelDecorations[_6807B8_level_decorations_ids[v59]]; | 1685 //v44 = &pLevelDecorations[_6807B8_level_decorations_ids[v59]]; |
1677 v45 = abs(v44->vPosition.z - pParty->vPosition.z); | 1686 //v45 = abs(v44->vPosition.z - pParty->vPosition.z); |
1678 v46 = abs(v44->vPosition.y - pParty->vPosition.y); | 1687 //v46 = abs(v44->vPosition.y - pParty->vPosition.y); |
1679 v47 = abs(v44->vPosition.x - pParty->vPosition.x); | 1688 //v47 = abs(v44->vPosition.x - pParty->vPosition.x); |
1680 if ( int_get_vector_length(v47, v46, v45) <= 8192 ) | 1689 auto decor = &pLevelDecorations[_6807B8_level_decorations_ids[i]]; |
1681 break; | 1690 if (int_get_vector_length(decor->vPosition.x - pParty->vPosition.x, |
1682 LABEL_89: | 1691 decor->vPosition.y - pParty->vPosition.y, |
1683 ++v59; | 1692 decor->vPosition.z - pParty->vPosition.z) > 8192) |
1684 if ( v59 >= _6807E0_num_decorations_with_sounds_6807B8 ) | 1693 continue; |
1685 return; | 1694 |
1686 } | 1695 auto decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID]; |
1687 v48 = &pDecorationList->pDecorations[v44->uDecorationDescID]; | 1696 //v48 = &pDecorationList->pDecorations[decor->uDecorationDescID]; |
1688 v49 = v48->uFlags; | 1697 //v49 = v48->uFlags; |
1689 uNumRepeats = (~(unsigned __int8)v48->uFlags & 0x40) >> 6; | 1698 uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & 0x40) >> 6; |
1690 if ( HIBYTE(v49) & 3 ) | 1699 |
1691 { | 1700 if (decor_desc->SoundOnDawn() || decor_desc->SoundOnDusk()) |
1692 v50 = v44->field_1A; | 1701 { |
1702 //v50 = decor->field_1A; | |
1693 v55 = 0.0; | 1703 v55 = 0.0; |
1694 uNumRepeats = 2; | 1704 uNumRepeats = 2; |
1695 if ( v50 ) | 1705 if (decor->field_1A) |
1696 { | 1706 { |
1697 v51 = v50 - 32; | 1707 v51 = decor->field_1A - 32; |
1698 v44->field_1A = v51; | 1708 decor->field_1A = v51; |
1699 if ( v51 < 0 ) | 1709 if ( v51 < 0 ) |
1700 v44->field_1A = 0; | 1710 decor->field_1A = 0; |
1701 } | 1711 } |
1702 } | 1712 } |
1703 v52 = v48->uFlags; | 1713 |
1704 if ( !(HIBYTE(v52) & 1) ) | 1714 //v52 = v48->uFlags; |
1705 { | 1715 if (!decor_desc->SoundOnDawn()) |
1706 if ( !(HIBYTE(v52) & 2) ) | 1716 { |
1707 goto LABEL_84; | 1717 if (!decor_desc->SoundOnDusk()) |
1708 if ( v55 != 0.0 ) | 1718 goto LABEL_84; |
1709 goto LABEL_85; | 1719 if ( v55 != 0.0 ) |
1710 } | 1720 goto LABEL_85; |
1711 v56 = 0.0; | 1721 } |
1712 if ( pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 6 | 1722 v56 = 0.0; |
1713 || pParty->uCurrentHour >= 0x14 && pParty->uCurrentHour < 0x15 ) | 1723 |
1714 { | 1724 if (pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 6 || |
1715 if ( !v44->field_1A && rand() % 100 < 100 ) | 1725 pParty->uCurrentHour >= 20 && pParty->uCurrentHour < 21) |
1726 { | |
1727 if ( !decor->field_1A && rand() % 100 < 100 ) | |
1716 LODWORD(v56) = 1; | 1728 LODWORD(v56) = 1; |
1717 LODWORD(v55) = 1; | 1729 LODWORD(v55) = 1; |
1718 } | 1730 } |
1719 LABEL_84: | 1731 LABEL_84: |
1720 if ( v55 == 0.0 ) | 1732 if ( v55 == 0.0 ) |
1721 { | 1733 { |
1722 LABEL_87: | 1734 LABEL_87: |
1723 if ( v56 != 0.0 ) | 1735 if ( v56 != 0.0 ) |
1724 { | 1736 { |
1725 v53 = 8 * *(int *)v43; | 1737 v53 = 8 * _6807B8_level_decorations_ids[i]; |
1726 LOBYTE(v53) = v53 | 5; | 1738 LOBYTE(v53) = v53 | OBJECT_Decoration; |
1727 thisa->PlaySound((SoundID)v48->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0); | 1739 PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0); |
1728 } | 1740 } |
1729 goto LABEL_89; | 1741 continue; |
1730 } | 1742 } |
1731 LABEL_85: | 1743 LABEL_85: |
1732 if ( !v44->field_1A ) | 1744 if ( !decor->field_1A ) |
1733 v44->field_1A = (rand() % 15 + 1) << 7; | 1745 decor->field_1A = (rand() % 15 + 1) << 7; |
1734 goto LABEL_87; | 1746 goto LABEL_87; |
1735 } | |
1736 } | 1747 } |
1737 } | 1748 } |
1738 | 1749 |
1739 | 1750 |
1740 //----- (004AB66C) -------------------------------------------------------- | 1751 //----- (004AB66C) -------------------------------------------------------- |
1822 if ( (uStartChannel == -1 || v6 < uStartChannel || v6 > uEndChannel) | 1833 if ( (uStartChannel == -1 || v6 < uStartChannel || v6 > uEndChannel) |
1823 && pSoundList->pSounds[pChannel->uSourceTrackIdx].eType != SOUND_DESC_SYSTEM) | 1834 && pSoundList->pSounds[pChannel->uSourceTrackIdx].eType != SOUND_DESC_SYSTEM) |
1824 { | 1835 { |
1825 AIL_end_sample(pChannel->hSample); | 1836 AIL_end_sample(pChannel->hSample); |
1826 _4ABE55(pChannel); | 1837 _4ABE55(pChannel); |
1827 pChannel->dword_000004 = 0; | 1838 pChannel->source_pid = 0; |
1828 } | 1839 } |
1829 ++v6; | 1840 ++v6; |
1830 ++pChannel; | 1841 ++pChannel; |
1831 } | 1842 } |
1832 while (v6 < uMixerChannels); | 1843 while (v6 < uMixerChannels); |
2186 { | 2197 { |
2187 v8 = v16; | 2198 v8 = v16; |
2188 v9 = *(int *)v7; | 2199 v9 = *(int *)v7; |
2189 ++v16; | 2200 ++v16; |
2190 v14[v8] = v2; | 2201 v14[v8] = v2; |
2191 if ( AIL_sample_status((HSAMPLE)v9) == 4 ) | 2202 if ( AIL_sample_status((HSAMPLE)v9) == AIL::Sample::Playing) |
2192 ++v15; | 2203 ++v15; |
2193 } | 2204 } |
2194 ++v2; | 2205 ++v2; |
2195 v7 += 16; | 2206 v7 += 16; |
2196 } | 2207 } |
2216 } | 2227 } |
2217 } | 2228 } |
2218 } | 2229 } |
2219 } | 2230 } |
2220 } | 2231 } |
2221 // 4D82F8: using guessed type int __stdcall AIL_sample_status(int); | |
2222 // 4ABE55: using guessed type int var_48[16]; | |
2223 | 2232 |
2224 | 2233 |
2225 | 2234 |
2226 //----- (004AAEA6) -------------------------------------------------------- | 2235 //----- (004AAEA6) -------------------------------------------------------- |
2227 int __fastcall sub_4AAEA6_transform(RenderVertexSoft *a1) | 2236 int __fastcall sub_4AAEA6_transform(RenderVertexSoft *a1) |