annotate AudioPlayer.cpp @ 2152:d44b7775fc06

Removed DirectDraw2 compatibility. 3D Sound enabled (change 3DSoundProvider registry entry to activate it). Moved all forward declarations to mm7_unsorted_subs.h (many cpp files do not need them anyweay).
author Nomad
date Thu, 09 Jan 2014 01:37:34 +0200
parents 4c0c475917dd
children d28d3c006077
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1104
diff changeset
4
0
Ritor1
parents:
diff changeset
5 #include <string>
Ritor1
parents:
diff changeset
6
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1205
diff changeset
7 #include "mm7_data.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 848
diff changeset
8 #include "VideoPlayer.h"
0
Ritor1
parents:
diff changeset
9 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
10 #include "FrameTableInc.h"
Ritor1
parents:
diff changeset
11 #include "Indoor.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 412
diff changeset
12 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
13 #include "Party.h"
Ritor1
parents:
diff changeset
14 #include "Actor.h"
Ritor1
parents:
diff changeset
15 #include "Game.h"
Ritor1
parents:
diff changeset
16 #include "DecorationList.h"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 2037
diff changeset
17 #include "Timer.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 2009
diff changeset
18 #include "OurMath.h"
0
Ritor1
parents:
diff changeset
19 #include "MapInfo.h"
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
20 #include "GUIWindow.h"
0
Ritor1
parents:
diff changeset
21 #include "Log.h"
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
22 #include "ErrorHandling.h"
1828
35c1e4ff6ba7 party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents: 1802
diff changeset
23 #include "Level/Decoration.h"
0
Ritor1
parents:
diff changeset
24
Ritor1
parents:
diff changeset
25 #include "Bink_Smacker.h"
Ritor1
parents:
diff changeset
26
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
27 #include "MM7.h"
0
Ritor1
parents:
diff changeset
28
Ritor1
parents:
diff changeset
29
Ritor1
parents:
diff changeset
30 PCMWAVEFORMAT pcmWaveFormat;
Ritor1
parents:
diff changeset
31
Ritor1
parents:
diff changeset
32 int uFindSound_BinSearch_ResultID; // weak
Ritor1
parents:
diff changeset
33 int uLastLoadedSoundID; // weak
Ritor1
parents:
diff changeset
34 int sLastTrackLengthMS;
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
35 std::array<Sound, 3000> pSounds;
0
Ritor1
parents:
diff changeset
36 AudioPlayer *pAudioPlayer;
Ritor1
parents:
diff changeset
37 SoundList *pSoundList;
Ritor1
parents:
diff changeset
38
Ritor1
parents:
diff changeset
39
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
40 std::array<stru339_spell_sound, 4> stru_A750F8;
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
41 std::array<stru339_spell_sound, 4> stru_AA1058;
0
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
45 unsigned __int8 uSoundVolumeMultiplier;// = 4;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
46 unsigned __int8 uVoicesVolumeMultiplier;// = 4;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
47 unsigned __int8 uMusicVolimeMultiplier;// = 4;
0
Ritor1
parents:
diff changeset
48 int bWalkSound; // idb
Ritor1
parents:
diff changeset
49
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1165
diff changeset
50 std::array<float, 10> pSoundVolumeLevels =
0
Ritor1
parents:
diff changeset
51 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
52 0.0000000f, 0.1099999f, 0.2199999f, 0.3300000f, 0.4399999f,
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
53 0.5500000f, 0.6600000f, 0.7699999f, 0.8799999f, 0.9700000f
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
54 // 0.0000000f, 0.4900000f, 0.5500000f, 0.6100000f, 0.6700000f, //for 128.0f
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
55 // 0.7000000f, 0.7600000f, 0.8200000f, 0.8800000f, 0.9700000f //changed 0.9900000f to 0.9700000f. for some reason it only works for values below this
328
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
56 };
0
Ritor1
parents:
diff changeset
57
Ritor1
parents:
diff changeset
58
Ritor1
parents:
diff changeset
59
Ritor1
parents:
diff changeset
60
Ritor1
parents:
diff changeset
61 void ReleaseSoundData(void *_this);
Ritor1
parents:
diff changeset
62
Ritor1
parents:
diff changeset
63
Ritor1
parents:
diff changeset
64
Ritor1
parents:
diff changeset
65
Ritor1
parents:
diff changeset
66 //----- (004A9953) --------------------------------------------------------
Ritor1
parents:
diff changeset
67 void SoundList::Initialize()
Ritor1
parents:
diff changeset
68 {
Ritor1
parents:
diff changeset
69 SoundDesc *pSoundDesc; // eax@5
Ritor1
parents:
diff changeset
70 void *pSoundData; // ebx@7
Ritor1
parents:
diff changeset
71 unsigned int uSoundSize; // eax@7
Ritor1
parents:
diff changeset
72 char *pSoundBytes; // ebx@7
Ritor1
parents:
diff changeset
73 AILFILETYPE pType; // eax@7
Ritor1
parents:
diff changeset
74 int v8; // eax@8
Ritor1
parents:
diff changeset
75 char pSoundName[120]; // [sp+4h] [bp-A4h]@4
Ritor1
parents:
diff changeset
76 AILSOUNDINFO pInfo; // [sp+7Ch] [bp-2Ch]@10
Ritor1
parents:
diff changeset
77 int v12; // [sp+A0h] [bp-8h]@12
Ritor1
parents:
diff changeset
78
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
79 if ( sNumSounds > 1 )
0
Ritor1
parents:
diff changeset
80 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
81 for ( uint i = 1; i < pSoundList->sNumSounds; ++i )
0
Ritor1
parents:
diff changeset
82 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
83 sprintf(pSoundName, "%s", pSL_Sounds[i].pSoundName);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
84 pSoundDesc = &pSoundList->pSL_Sounds[i];
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
85 if ( pSoundList->pSL_Sounds[i].eType != SOUND_DESC_SYSTEM )
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
86 continue;
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
87 sprintf(pSoundName, "%s", pSL_Sounds[i].pSoundName);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
88 pSoundList->pSL_Sounds[i].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)-1, pSL_Sounds[i].uSoundID);
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
89 if ( !pAudioPlayer->b3DSoundInitialized )
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
90 continue;
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
91 pSoundDesc = &pSoundList->pSL_Sounds[i];
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
92 if ( !(pSoundDesc->uFlags & SOUND_DESC_SWAP) || !pSoundDesc->pSoundData[0] )
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
93 continue;
0
Ritor1
parents:
diff changeset
94 pSoundData = pSoundDesc->pSoundData[0];
Ritor1
parents:
diff changeset
95 uSoundSize = *(int *)pSoundData;
Ritor1
parents:
diff changeset
96 pSoundBytes = (char *)pSoundData + 4;
Ritor1
parents:
diff changeset
97 pType = AIL_file_type(pSoundBytes, uSoundSize);
Ritor1
parents:
diff changeset
98 if ( !pType )
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
99 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
100 pSoundList->pSL_Sounds[i].bDecompressed = false;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
101 pSoundList->UnloadSound(i, 1);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
102 continue;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
103 }
0
Ritor1
parents:
diff changeset
104 v8 = pType - 1;
Ritor1
parents:
diff changeset
105 if ( v8 )
Ritor1
parents:
diff changeset
106 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
107 if ( v8 == 1 )
0
Ritor1
parents:
diff changeset
108 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
109 if ( AIL_WAV_info(pSoundBytes, &pInfo) && pInfo.uChannels != 2 )
0
Ritor1
parents:
diff changeset
110 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
111 if ( !AIL_decompress_ADPCM(&pInfo, &pSoundList->pSL_Sounds[i].p3DSound, &v12) )
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
112 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
113 pSoundList->pSL_Sounds[i].p3DSound = 0;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
114 pSoundList->pSL_Sounds[i].bDecompressed = true;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
115 }
0
Ritor1
parents:
diff changeset
116 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
117 pSoundList->UnloadSound(i, 1);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
118 continue;
0
Ritor1
parents:
diff changeset
119 }
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
120 pSoundList->pSL_Sounds[i].bDecompressed = false;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
121 pSoundList->UnloadSound(i, 1);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
122 continue;
0
Ritor1
parents:
diff changeset
123 }
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
124 pSoundList->pSL_Sounds[i].p3DSound = pSoundList->pSL_Sounds[i].pSoundData[0];
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
125 pSoundList->UnloadSound(i, 1);
0
Ritor1
parents:
diff changeset
126 }
Ritor1
parents:
diff changeset
127 }
Ritor1
parents:
diff changeset
128 }
Ritor1
parents:
diff changeset
129
Ritor1
parents:
diff changeset
130 //----- (004A9A67) --------------------------------------------------------
Ritor1
parents:
diff changeset
131 __int16 SoundList::LoadSound(int a1, unsigned int a3)
Ritor1
parents:
diff changeset
132 {
Ritor1
parents:
diff changeset
133 AILSOUNDINFO v24; // [sp+84h] [bp-28h]@23
Ritor1
parents:
diff changeset
134
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
135 if (bNoSound || !sNumSounds)
0
Ritor1
parents:
diff changeset
136 return 0;
Ritor1
parents:
diff changeset
137
Ritor1
parents:
diff changeset
138 uint uSoundIdx = 0;
Ritor1
parents:
diff changeset
139 SoundDesc *pSound = nullptr;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
140 for (uint i = 1; i < sNumSounds; ++i)
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
141 if (pSL_Sounds[i].uSoundID == a1)
0
Ritor1
parents:
diff changeset
142 {
Ritor1
parents:
diff changeset
143 uSoundIdx = i;
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
144 pSound = &pSL_Sounds[i];
0
Ritor1
parents:
diff changeset
145 break;
Ritor1
parents:
diff changeset
146 }
Ritor1
parents:
diff changeset
147 if (!pSound)
Ritor1
parents:
diff changeset
148 return 0;
Ritor1
parents:
diff changeset
149
592
96f48cfdd657 some flags
Nomad
parents: 515
diff changeset
150 if (pSound->uFlags & SOUND_DESC_SWAP && pSound->p3DSound ||
96f48cfdd657 some flags
Nomad
parents: 515
diff changeset
151 ~pSound->uFlags & SOUND_DESC_SWAP && pSound->pSoundData[0])
0
Ritor1
parents:
diff changeset
152 return uSoundIdx;
Ritor1
parents:
diff changeset
153
Ritor1
parents:
diff changeset
154 if (!pSound->pSoundData[0])
2006
30c2b575d25c signed fixes
zipi
parents: 1980
diff changeset
155 pSound->pSoundData[0] = ::LoadSound(pSound->pSoundName, (SoundData *)-1, pSound->uSoundID);
0
Ritor1
parents:
diff changeset
156
Ritor1
parents:
diff changeset
157 if (!pSound->pSoundData[0])
Ritor1
parents:
diff changeset
158 return 0;
Ritor1
parents:
diff changeset
159
Ritor1
parents:
diff changeset
160 if (a3)
592
96f48cfdd657 some flags
Nomad
parents: 515
diff changeset
161 pSound->uFlags |= SOUND_DESC_SYSTEM;
0
Ritor1
parents:
diff changeset
162
Ritor1
parents:
diff changeset
163 if (!pAudioPlayer->b3DSoundInitialized)
Ritor1
parents:
diff changeset
164 return uSoundIdx;
Ritor1
parents:
diff changeset
165
592
96f48cfdd657 some flags
Nomad
parents: 515
diff changeset
166 if (~pSound->uFlags & SOUND_DESC_SWAP || !pSound->pSoundData[0])
0
Ritor1
parents:
diff changeset
167 return uSoundIdx;
Ritor1
parents:
diff changeset
168
Ritor1
parents:
diff changeset
169
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
170 SoundData* pSoundData = pSound->pSoundData[0];
0
Ritor1
parents:
diff changeset
171 switch (AIL_file_type((void *)pSoundData->pData, pSoundData->uDataSize))
Ritor1
parents:
diff changeset
172 {
Ritor1
parents:
diff changeset
173 default:
Ritor1
parents:
diff changeset
174 case AILFILETYPE_UNKNOWN:
Ritor1
parents:
diff changeset
175 pSound->bDecompressed = false;
Ritor1
parents:
diff changeset
176 return 0;
Ritor1
parents:
diff changeset
177
Ritor1
parents:
diff changeset
178 case AILFILETYPE_PCM_WAV:
Ritor1
parents:
diff changeset
179 pSound->p3DSound = pSound->pSoundData[0];
Ritor1
parents:
diff changeset
180 return uSoundIdx;
Ritor1
parents:
diff changeset
181
Ritor1
parents:
diff changeset
182 case AILFILETYPE_ADPCM_WAV:
Ritor1
parents:
diff changeset
183 if (AIL_WAV_info((void *)pSoundData->pData, &v24) && v24.uChannels != 2)
Ritor1
parents:
diff changeset
184 {
Ritor1
parents:
diff changeset
185 if (!AIL_decompress_ADPCM(&v24, &pSound->p3DSound, &a1) )
Ritor1
parents:
diff changeset
186 {
Ritor1
parents:
diff changeset
187 pSound->p3DSound = nullptr;
Ritor1
parents:
diff changeset
188 pSound->bDecompressed = true;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
189 UnloadSound(uSoundIdx, 0);
0
Ritor1
parents:
diff changeset
190 }
Ritor1
parents:
diff changeset
191 }
Ritor1
parents:
diff changeset
192 return uSoundIdx;
Ritor1
parents:
diff changeset
193 };
Ritor1
parents:
diff changeset
194 }
Ritor1
parents:
diff changeset
195
Ritor1
parents:
diff changeset
196 //----- (004A9BBD) --------------------------------------------------------
Ritor1
parents:
diff changeset
197 int SoundList::LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6)
Ritor1
parents:
diff changeset
198 {
Ritor1
parents:
diff changeset
199 //SoundList *v6; // edi@1
Ritor1
parents:
diff changeset
200 signed int v7; // esi@1
Ritor1
parents:
diff changeset
201 //unsigned __int8 v8; // zf@1
Ritor1
parents:
diff changeset
202 //unsigned __int8 v9; // sf@1
Ritor1
parents:
diff changeset
203 SoundDesc *v10; // eax@3
Ritor1
parents:
diff changeset
204 SoundDesc *v11; // ecx@3
Ritor1
parents:
diff changeset
205 int v12; // ebx@7
Ritor1
parents:
diff changeset
206 int result; // eax@13
Ritor1
parents:
diff changeset
207 SoundHeader *v14; // esi@16
Ritor1
parents:
diff changeset
208 DWORD *v15; // edi@16
Ritor1
parents:
diff changeset
209 int v16; // ebx@16
Ritor1
parents:
diff changeset
210 unsigned int v17; // eax@18
Ritor1
parents:
diff changeset
211 void *v18; // ebx@19
Ritor1
parents:
diff changeset
212 std::string v19; // [sp-18h] [bp-38h]@22
Ritor1
parents:
diff changeset
213 const char *v20; // [sp-8h] [bp-28h]@22
Ritor1
parents:
diff changeset
214 int v21; // [sp-4h] [bp-24h]@22
Ritor1
parents:
diff changeset
215 //SoundList *v22; // [sp+Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
216 SoundDesc *Args; // [sp+10h] [bp-10h]@3
Ritor1
parents:
diff changeset
217 unsigned int v24; // [sp+14h] [bp-Ch]@2
Ritor1
parents:
diff changeset
218 int v25; // [sp+18h] [bp-8h]@2
Ritor1
parents:
diff changeset
219 int v26; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
220
Ritor1
parents:
diff changeset
221 //v6 = this;
Ritor1
parents:
diff changeset
222 v7 = 0;
Ritor1
parents:
diff changeset
223 //v22 = this;
Ritor1
parents:
diff changeset
224 //v8 = this->uNumSounds == 0;
Ritor1
parents:
diff changeset
225 //v9 = (this->uNumSounds & 0x80000000u) != 0;
Ritor1
parents:
diff changeset
226 v26 = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
227 if (!sNumSounds)
0
Ritor1
parents:
diff changeset
228 return 0;
Ritor1
parents:
diff changeset
229
Ritor1
parents:
diff changeset
230
Ritor1
parents:
diff changeset
231 v24 = 0;
Ritor1
parents:
diff changeset
232 v25 = 44;
Ritor1
parents:
diff changeset
233 while ( 1 )
Ritor1
parents:
diff changeset
234 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
235 v10 = pSL_Sounds;
0
Ritor1
parents:
diff changeset
236 v11 = &v10[v24 / 0x78];
Ritor1
parents:
diff changeset
237 Args = &v10[v24 / 0x78];
Ritor1
parents:
diff changeset
238 if ( a2 == v10[v24 / 0x78].uSoundID )
Ritor1
parents:
diff changeset
239 {
Ritor1
parents:
diff changeset
240 if ( a6 == v7 && *(int *)&v10->pSoundName[v25] != v7 )
Ritor1
parents:
diff changeset
241 return v26;
Ritor1
parents:
diff changeset
242 if ( (signed int)pAudioPlayer->uNumSoundHeaders > v7 )
Ritor1
parents:
diff changeset
243 break;
Ritor1
parents:
diff changeset
244 }
Ritor1
parents:
diff changeset
245 LABEL_12:
Ritor1
parents:
diff changeset
246 ++v26;
Ritor1
parents:
diff changeset
247 v25 += 120;
Ritor1
parents:
diff changeset
248 v24 += 120;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
249 if ( v26 >= (signed int)sNumSounds )
0
Ritor1
parents:
diff changeset
250 return 0;
Ritor1
parents:
diff changeset
251 }
Ritor1
parents:
diff changeset
252 v12 = 0;
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1016
diff changeset
253 while ( _stricmp(pAudioPlayer->pSoundHeaders[v12].pSoundName, v11->pSoundName) )
0
Ritor1
parents:
diff changeset
254 {
Ritor1
parents:
diff changeset
255 ++v7;
Ritor1
parents:
diff changeset
256 ++v12;
Ritor1
parents:
diff changeset
257 if ( v7 >= (signed int)pAudioPlayer->uNumSoundHeaders )
Ritor1
parents:
diff changeset
258 {
Ritor1
parents:
diff changeset
259 v7 = 0;
Ritor1
parents:
diff changeset
260 goto LABEL_12;
Ritor1
parents:
diff changeset
261 }
Ritor1
parents:
diff changeset
262 v11 = Args;
Ritor1
parents:
diff changeset
263 }
Ritor1
parents:
diff changeset
264 v14 = &pAudioPlayer->pSoundHeaders[v7];
Ritor1
parents:
diff changeset
265 v15 = (DWORD *)&v14->uDecompressedSize;
Ritor1
parents:
diff changeset
266 a2 = v14->uDecompressedSize;
Ritor1
parents:
diff changeset
267 v16 = a2;
Ritor1
parents:
diff changeset
268 if ( (signed int)a2 > uBufferSizeLeft )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
269 Error("Sound %s is size %i bytes, sound buffer size is %i bytes", Args, a2, uBufferSizeLeft);
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
270
0
Ritor1
parents:
diff changeset
271 SetFilePointer(pAudioPlayer->hAudioSnd, v14->uFileOffset, 0, 0);
Ritor1
parents:
diff changeset
272 v17 = v14->uCompressedSize;
Ritor1
parents:
diff changeset
273 if ( (signed int)v17 >= (signed int)*v15 )
Ritor1
parents:
diff changeset
274 {
Ritor1
parents:
diff changeset
275 if ( v17 == *v15 )
Ritor1
parents:
diff changeset
276 {
Ritor1
parents:
diff changeset
277 ReadFile(pAudioPlayer->hAudioSnd, lpBuffer, *v15, (LPDWORD)&Args, 0);
Ritor1
parents:
diff changeset
278 }
Ritor1
parents:
diff changeset
279 else
Ritor1
parents:
diff changeset
280 {
Ritor1
parents:
diff changeset
281 MessageBoxW(nullptr, L"Can't load sound file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Sound.cpp:666", 0);
Ritor1
parents:
diff changeset
282 }
Ritor1
parents:
diff changeset
283 }
Ritor1
parents:
diff changeset
284 else
Ritor1
parents:
diff changeset
285 {
Ritor1
parents:
diff changeset
286 v18 = malloc(v14->uCompressedSize);
Ritor1
parents:
diff changeset
287 ReadFile(pAudioPlayer->hAudioSnd, v18, v14->uCompressedSize, (LPDWORD)&Args, 0);
Ritor1
parents:
diff changeset
288 zlib::MemUnzip(lpBuffer, &v14->uDecompressedSize, v18, v14->uCompressedSize);
Ritor1
parents:
diff changeset
289 free(v18);
Ritor1
parents:
diff changeset
290 v16 = a2;
Ritor1
parents:
diff changeset
291 }
Ritor1
parents:
diff changeset
292 result = v26;
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
293 pSL_Sounds->pSoundData[a6 + 30 * v26] = (SoundData *)lpBuffer;
0
Ritor1
parents:
diff changeset
294 *pOutSoundSize = v16;
Ritor1
parents:
diff changeset
295
Ritor1
parents:
diff changeset
296 return result;
Ritor1
parents:
diff changeset
297 }
Ritor1
parents:
diff changeset
298
Ritor1
parents:
diff changeset
299 //----- (004A9D3E) --------------------------------------------------------
Ritor1
parents:
diff changeset
300 SoundDesc *SoundList::Release()
Ritor1
parents:
diff changeset
301 {
Ritor1
parents:
diff changeset
302 SoundDesc *result; // eax@3
Ritor1
parents:
diff changeset
303 void *v5; // ecx@3
Ritor1
parents:
diff changeset
304
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
305 if ( (signed int)this->sNumSounds > 0 )
0
Ritor1
parents:
diff changeset
306 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
307 for ( uint i = 0; i < (signed int)this->sNumSounds; ++i )
0
Ritor1
parents:
diff changeset
308 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
309 result = this->pSL_Sounds;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
310 v5 = result[i].pSoundData[0];
0
Ritor1
parents:
diff changeset
311 if ( v5 )
Ritor1
parents:
diff changeset
312 {
Ritor1
parents:
diff changeset
313 ReleaseSoundData(v5);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
314 this->pSL_Sounds[i].pSoundData[0] = 0;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
315 result = (SoundDesc *)((char *)&this->pSL_Sounds[i] + 40);
0
Ritor1
parents:
diff changeset
316 *(int *)&result->pSoundName[0] &= 0xFFFFFFFEu;
Ritor1
parents:
diff changeset
317 }
Ritor1
parents:
diff changeset
318 }
Ritor1
parents:
diff changeset
319 }
Ritor1
parents:
diff changeset
320 return result;
Ritor1
parents:
diff changeset
321 }
Ritor1
parents:
diff changeset
322
Ritor1
parents:
diff changeset
323 //----- (004A9D79) --------------------------------------------------------
Ritor1
parents:
diff changeset
324 void SoundList::_4A9D79(int a2)
Ritor1
parents:
diff changeset
325 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
326 for ( int i = 0; i < (signed int)this->sNumSounds; ++i )
0
Ritor1
parents:
diff changeset
327 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
328 if ( this->pSL_Sounds[i].eType != SOUND_DESC_SYSTEM && (a2 || this->pSL_Sounds[i].eType != SOUND_DESC_LOCK) )
0
Ritor1
parents:
diff changeset
329 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
330 if ( this->pSL_Sounds[i].pSoundData[0] )
0
Ritor1
parents:
diff changeset
331 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
332 ReleaseSoundData(this->pSL_Sounds[i].pSoundData[0]);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
333 this->pSL_Sounds[i].pSoundData[0] = 0;
0
Ritor1
parents:
diff changeset
334 }
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
335 this->pSL_Sounds[i].uFlags &= ~SOUND_DESC_SYSTEM;
0
Ritor1
parents:
diff changeset
336 }
Ritor1
parents:
diff changeset
337 }
Ritor1
parents:
diff changeset
338 }
Ritor1
parents:
diff changeset
339
Ritor1
parents:
diff changeset
340 //----- (004A9DCD) --------------------------------------------------------
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
341 void SoundList::UnloadSound(unsigned int uSoundID, char a3)
0
Ritor1
parents:
diff changeset
342 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
343 if ( pSL_Sounds[uSoundID].eType != SOUND_DESC_SYSTEM )
0
Ritor1
parents:
diff changeset
344 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
345 if ( (pSL_Sounds[uSoundID].uFlags & SOUND_DESC_SWAP) && pSL_Sounds[uSoundID].p3DSound && a3 )
0
Ritor1
parents:
diff changeset
346 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
347 if ( pSL_Sounds[uSoundID].bDecompressed)
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
348 AIL_mem_free_lock(pSL_Sounds[uSoundID].p3DSound);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
349 pSL_Sounds[uSoundID].p3DSound = 0;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
350 pSL_Sounds[uSoundID].uFlags &= ~SOUND_DESC_SYSTEM;
0
Ritor1
parents:
diff changeset
351 }
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
352 if ( pSL_Sounds[uSoundID].pSoundData[0] )
0
Ritor1
parents:
diff changeset
353 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
354 ReleaseSoundData(pSL_Sounds[uSoundID].pSoundData[0]);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
355 pSL_Sounds[uSoundID].pSoundData[0] = NULL;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
356 pSL_Sounds[uSoundID].uFlags &= ~SOUND_DESC_SYSTEM;
0
Ritor1
parents:
diff changeset
357 }
Ritor1
parents:
diff changeset
358 }
Ritor1
parents:
diff changeset
359 }
Ritor1
parents:
diff changeset
360
Ritor1
parents:
diff changeset
361
Ritor1
parents:
diff changeset
362 //----- (004A9E3D) --------------------------------------------------------
Ritor1
parents:
diff changeset
363 void SoundList::ToFile()
Ritor1
parents:
diff changeset
364 {
Ritor1
parents:
diff changeset
365 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
366
Ritor1
parents:
diff changeset
367 v2 = fopen("data\\dsounds.bin", "wb");
Ritor1
parents:
diff changeset
368 if ( !v2 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
369 Error("Unable to save dsounds.bin!");
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
370
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
371 fwrite(this, 4, 1, v2);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
372 fwrite(this->pSL_Sounds, 0x78u, this->sNumSounds, v2);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
373 fclose(v2);
0
Ritor1
parents:
diff changeset
374 }
Ritor1
parents:
diff changeset
375
Ritor1
parents:
diff changeset
376 //----- (004A9E89) --------------------------------------------------------
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
377 void SoundList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
0
Ritor1
parents:
diff changeset
378 {
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
379 uint num_mm6_sounds = data_mm6 ? *(int *)data_mm6 : 0,
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
380 num_mm7_sounds = data_mm7 ? *(int *)data_mm7 : 0,
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
381 num_mm8_sounds = data_mm8 ? *(int *)data_mm8 : 0;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
382
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
383 sNumSounds = num_mm6_sounds + num_mm7_sounds + num_mm8_sounds;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
384 assert(sNumSounds);
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
385 assert(!num_mm8_sounds);
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
386
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
387 pSL_Sounds = (SoundDesc *)malloc(sNumSounds * sizeof(SoundDesc));
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
388 memcpy(pSL_Sounds, (char *)data_mm7 + 4, num_mm7_sounds * sizeof(SoundDesc));
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
389 for (uint i = 0; i < num_mm6_sounds; ++i)
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
390 {
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
391 auto src = (SoundDesc_mm6 *)((char *)data_mm6 + 4) + i;
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
392 SoundDesc* dst = &pSL_Sounds[num_mm7_sounds + i];
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
393
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
394 memcpy(dst, src, sizeof(SoundDesc_mm6));
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
395 dst->p3DSound = nullptr;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
396 dst->bDecompressed = false;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
397 }
0
Ritor1
parents:
diff changeset
398 }
Ritor1
parents:
diff changeset
399
Ritor1
parents:
diff changeset
400 //----- (004A9ED0) --------------------------------------------------------
Ritor1
parents:
diff changeset
401 int SoundList::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
402 {
Ritor1
parents:
diff changeset
403 __int32 v3; // edi@1
Ritor1
parents:
diff changeset
404 FILE *v4; // eax@1
Ritor1
parents:
diff changeset
405 unsigned int v5; // esi@3
Ritor1
parents:
diff changeset
406 void *v6; // eax@9
Ritor1
parents:
diff changeset
407 FILE *v7; // ST0C_4@11
Ritor1
parents:
diff changeset
408 char *i; // eax@11
Ritor1
parents:
diff changeset
409 int v9; // eax@14
Ritor1
parents:
diff changeset
410 const char *v10; // ST0C_4@14
Ritor1
parents:
diff changeset
411 int v11; // eax@18
Ritor1
parents:
diff changeset
412 SoundDesc *v12; // ecx@18
Ritor1
parents:
diff changeset
413 char v13; // zf@18
Ritor1
parents:
diff changeset
414 unsigned int v14; // eax@18
Ritor1
parents:
diff changeset
415 int v15; // eax@23
Ritor1
parents:
diff changeset
416 char Buf; // [sp+Ch] [bp-2F0h]@3
Ritor1
parents:
diff changeset
417 FrameTableTxtLine v18; // [sp+200h] [bp-FCh]@4
Ritor1
parents:
diff changeset
418 FrameTableTxtLine v19; // [sp+27Ch] [bp-80h]@4
Ritor1
parents:
diff changeset
419 FILE *File; // [sp+2F8h] [bp-4h]@1
Ritor1
parents:
diff changeset
420 unsigned int Argsa; // [sp+304h] [bp+8h]@3
Ritor1
parents:
diff changeset
421
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
422 free(this->pSL_Sounds);
0
Ritor1
parents:
diff changeset
423 v3 = 0;
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
424 this->pSL_Sounds = 0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
425 this->sNumSounds = 0;
0
Ritor1
parents:
diff changeset
426 v4 = fopen(Args, "r");
Ritor1
parents:
diff changeset
427 File = v4;
Ritor1
parents:
diff changeset
428 if ( !v4 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
429 Error("SoundListClass::load - Unable to open file: %s.");
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
430
0
Ritor1
parents:
diff changeset
431 v5 = 0;
Ritor1
parents:
diff changeset
432 Argsa = 0;
Ritor1
parents:
diff changeset
433 if ( fgets(&Buf, 490, v4) )
Ritor1
parents:
diff changeset
434 {
Ritor1
parents:
diff changeset
435 do
Ritor1
parents:
diff changeset
436 {
Ritor1
parents:
diff changeset
437 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
438 memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19));
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 592
diff changeset
439 if ( v19.uPropCount && *v19.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
440 ++Argsa;
Ritor1
parents:
diff changeset
441 }
Ritor1
parents:
diff changeset
442 while ( fgets(&Buf, 490, File) );
Ritor1
parents:
diff changeset
443 v5 = Argsa;
Ritor1
parents:
diff changeset
444 v3 = 0;
Ritor1
parents:
diff changeset
445 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
446 this->sNumSounds = v5;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
447 v6 = malloc(120 * v5);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
448 this->pSL_Sounds = (SoundDesc *)v6;
0
Ritor1
parents:
diff changeset
449 if ( v6 == (void *)v3 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
450 Error("SoundListClass::load - Out of Memory!");
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1479
diff changeset
451
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
452 memset(v6, v3, 120 * this->sNumSounds);
0
Ritor1
parents:
diff changeset
453 v7 = File;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
454 this->sNumSounds = v3;
0
Ritor1
parents:
diff changeset
455 fseek(v7, v3, v3);
Ritor1
parents:
diff changeset
456 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
Ritor1
parents:
diff changeset
457 {
Ritor1
parents:
diff changeset
458 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
459 memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19));
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 592
diff changeset
460 if ( v19.uPropCount && *v19.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
461 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
462 sprintf(this->pSL_Sounds[this->sNumSounds].pSoundName, "%s", v19.pProperties[0]);
0
Ritor1
parents:
diff changeset
463 v9 = atoi(v19.pProperties[1]);
Ritor1
parents:
diff changeset
464 v10 = v19.pProperties[2];
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
465 this->pSL_Sounds[this->sNumSounds].uSoundID = v9;
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1016
diff changeset
466 if ( _stricmp(v10, "system") )
0
Ritor1
parents:
diff changeset
467 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1016
diff changeset
468 if ( _stricmp(v19.pProperties[2], "swap") )
0
Ritor1
parents:
diff changeset
469 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1016
diff changeset
470 v11 = _stricmp(v19.pProperties[2], "lock");
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
471 v12 = this->pSL_Sounds;
0
Ritor1
parents:
diff changeset
472 v13 = v11 == 0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
473 v14 = this->sNumSounds;
0
Ritor1
parents:
diff changeset
474 if ( v13 )
Ritor1
parents:
diff changeset
475 v12[v14].eType = SOUND_DESC_LOCK;
Ritor1
parents:
diff changeset
476 else
Ritor1
parents:
diff changeset
477 v12[v14].eType = SOUND_DESC_LEVEL;
Ritor1
parents:
diff changeset
478 }
Ritor1
parents:
diff changeset
479 else
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
480 this->pSL_Sounds[this->sNumSounds].eType = SOUND_DESC_SWAP;
0
Ritor1
parents:
diff changeset
481 }
Ritor1
parents:
diff changeset
482 else
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
483 this->pSL_Sounds[this->sNumSounds].eType = SOUND_DESC_SYSTEM;
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1016
diff changeset
484 if ( v19.uPropCount >= 4 && !_stricmp(v19.pProperties[3], "3D") )
0
Ritor1
parents:
diff changeset
485 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
486 v15 = (int)&this->pSL_Sounds[this->sNumSounds].uFlags;
592
96f48cfdd657 some flags
Nomad
parents: 515
diff changeset
487 *(int *)v15 |= SOUND_DESC_SWAP;
0
Ritor1
parents:
diff changeset
488 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
489 ++this->sNumSounds;
0
Ritor1
parents:
diff changeset
490 }
Ritor1
parents:
diff changeset
491 }
Ritor1
parents:
diff changeset
492 fclose(File);
Ritor1
parents:
diff changeset
493 return 1;
Ritor1
parents:
diff changeset
494 }
Ritor1
parents:
diff changeset
495
Ritor1
parents:
diff changeset
496 //----- (004AA13F) --------------------------------------------------------
Ritor1
parents:
diff changeset
497 void AudioPlayer::PlayMusicTrack(MusicID eTrack)
Ritor1
parents:
diff changeset
498 {
Ritor1
parents:
diff changeset
499 if (!bNoSound && bPlayerReady && hAILRedbook && uMusicVolimeMultiplier)
Ritor1
parents:
diff changeset
500 {
Ritor1
parents:
diff changeset
501 AIL_redbook_stop(hAILRedbook);
328
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
502 AIL_redbook_set_volume(hAILRedbook, (signed)pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
0
Ritor1
parents:
diff changeset
503 AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS);
Ritor1
parents:
diff changeset
504 AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS);
Ritor1
parents:
diff changeset
505 uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000;
Ritor1
parents:
diff changeset
506 }
Ritor1
parents:
diff changeset
507 }
Ritor1
parents:
diff changeset
508
Ritor1
parents:
diff changeset
509
Ritor1
parents:
diff changeset
510 //----- (004AA1F3) --------------------------------------------------------
Ritor1
parents:
diff changeset
511 void AudioPlayer::SetMusicVolume(int vol)
Ritor1
parents:
diff changeset
512 {
Ritor1
parents:
diff changeset
513 if (bPlayerReady)
Ritor1
parents:
diff changeset
514 {
Ritor1
parents:
diff changeset
515 if (hAILRedbook)
Ritor1
parents:
diff changeset
516 AIL_redbook_set_volume(hAILRedbook, vol);
Ritor1
parents:
diff changeset
517 }
Ritor1
parents:
diff changeset
518 }
Ritor1
parents:
diff changeset
519
Ritor1
parents:
diff changeset
520 //----- (004AA214) --------------------------------------------------------
328
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
521 void AudioPlayer::SetMasterVolume(float fVolume)
0
Ritor1
parents:
diff changeset
522 {
328
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
523 if ( bPlayerReady )
0
Ritor1
parents:
diff changeset
524 {
328
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
525 uMasterVolume = fVolume;
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
526 if ( hDigDriver )
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
527 AIL_set_digital_master_volume(hDigDriver, fVolume);
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
528 if ( b3DSoundInitialized )
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
529 s3DSoundVolume = fVolume * 0.5f;
0
Ritor1
parents:
diff changeset
530 }
Ritor1
parents:
diff changeset
531 }
Ritor1
parents:
diff changeset
532 // 4D8304: using guessed type int __stdcall AIL_set_digital_master_volume(int, int);
Ritor1
parents:
diff changeset
533
Ritor1
parents:
diff changeset
534 //----- (004AA258) --------------------------------------------------------
Ritor1
parents:
diff changeset
535 void AudioPlayer::_4AA258(int a2)
Ritor1
parents:
diff changeset
536 {
1425
16a24dc103e7 uninitialized Party::walk_sound_timer leads to crash
Nomad
parents: 1423
diff changeset
537 if (!bPlayerReady)
16a24dc103e7 uninitialized Party::walk_sound_timer leads to crash
Nomad
parents: 1423
diff changeset
538 return;
16a24dc103e7 uninitialized Party::walk_sound_timer leads to crash
Nomad
parents: 1423
diff changeset
539
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
540 if ( this->b3DSoundInitialized && a2 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
541 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
542 for ( uint i = 0; i < this->uNum3DSamples; ++i )
0
Ritor1
parents:
diff changeset
543 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
544 if ( this->p3DSamples[i].field_4 == a2 && AIL_3D_sample_status(this->p3DSamples[i].hSample) == AIL::Sample::Playing )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
545 AIL_end_3D_sample(this->p3DSamples[i].hSample);
0
Ritor1
parents:
diff changeset
546 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
547 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
548 if ( this->hDigDriver && a2 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
549 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
550 for ( uint i = 0; i < this->uMixerChannels; ++i )
0
Ritor1
parents:
diff changeset
551 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
552 if ( this->pMixerChannels[i].source_pid == a2 && AIL_sample_status(this->pMixerChannels[i].hSample) == AIL::Sample::Playing)
0
Ritor1
parents:
diff changeset
553 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
554 AIL_end_sample(this->pMixerChannels[i].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
555 FreeChannel(&this->pMixerChannels[i]);
0
Ritor1
parents:
diff changeset
556 }
Ritor1
parents:
diff changeset
557 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
558 }
0
Ritor1
parents:
diff changeset
559 }
Ritor1
parents:
diff changeset
560
Ritor1
parents:
diff changeset
561 //----- (004AA306) --------------------------------------------------------
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
562 void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int source_x, signed int source_y, int a7, float uVolume, int sPlaybackRate)
0
Ritor1
parents:
diff changeset
563 {
Ritor1
parents:
diff changeset
564 int v12; // edi@13
Ritor1
parents:
diff changeset
565 signed int v13; // ecx@17
Ritor1
parents:
diff changeset
566 signed int v14; // eax@20
Ritor1
parents:
diff changeset
567 int v15; // eax@24
Ritor1
parents:
diff changeset
568 signed int v16; // eax@25
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 412
diff changeset
569 SpriteObject *pLayingItem; // eax@28
0
Ritor1
parents:
diff changeset
570 signed int v18; // eax@29
Ritor1
parents:
diff changeset
571 Actor *pActor1; // eax@32
Ritor1
parents:
diff changeset
572 signed int v20; // ecx@32
Ritor1
parents:
diff changeset
573 double v21; // st7@32
Ritor1
parents:
diff changeset
574 signed int v22; // ecx@33
Ritor1
parents:
diff changeset
575 AudioPlayer_3DSample *pAudioPlayer_3DSample; // esi@53
Ritor1
parents:
diff changeset
576 AudioPlayer_3DSample *pAudioPlayer_3DSample1; // esi@61
Ritor1
parents:
diff changeset
577 int v25; // esi@67
Ritor1
parents:
diff changeset
578 double v26; // st7@68
Ritor1
parents:
diff changeset
579 int v27; // ST18_4@68
Ritor1
parents:
diff changeset
580 int v28; // ebx@68
Ritor1
parents:
diff changeset
581 int v29; // eax@68
Ritor1
parents:
diff changeset
582 AudioPlayer_3DSample *pAudioPlayer_3DSample2; // esi@69
Ritor1
parents:
diff changeset
583 int v31; // ST18_4@70
Ritor1
parents:
diff changeset
584 int v32; // ebx@70
Ritor1
parents:
diff changeset
585 int v33; // eax@70
Ritor1
parents:
diff changeset
586 int v34; // eax@70
Ritor1
parents:
diff changeset
587 char v35; // zf@70
Ritor1
parents:
diff changeset
588 signed int v36; // ebx@74
Ritor1
parents:
diff changeset
589 AudioPlayer_3DSample *pAudioPlayer_3DSample3; // esi@79
Ritor1
parents:
diff changeset
590 int v40; // eax@81
Ritor1
parents:
diff changeset
591 char *v41; // edi@82
Ritor1
parents:
diff changeset
592 int v42; // esi@82
Ritor1
parents:
diff changeset
593 double v43; // st7@91
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 412
diff changeset
594 SpriteObject *pLayingItem2; // eax@92
0
Ritor1
parents:
diff changeset
595 Actor *pActor; // eax@93
Ritor1
parents:
diff changeset
596 signed int v46; // ecx@93
Ritor1
parents:
diff changeset
597 double v47; // st7@93
Ritor1
parents:
diff changeset
598 BLVDoor *pBLVDoor; // eax@97
Ritor1
parents:
diff changeset
599 double v49; // st7@104
Ritor1
parents:
diff changeset
600 int v50; // ST18_4@104
Ritor1
parents:
diff changeset
601 int v51; // ebx@104
Ritor1
parents:
diff changeset
602 int v52; // eax@104
Ritor1
parents:
diff changeset
603 float v53; // ST0C_4@106
Ritor1
parents:
diff changeset
604 float v54; // ST04_4@106
Ritor1
parents:
diff changeset
605 SoundDesc *pSoundDesc; // edx@107
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 412
diff changeset
606 SpriteObject *pLayingItem3; // eax@114
0
Ritor1
parents:
diff changeset
607 signed int v62; // esi@133
Ritor1
parents:
diff changeset
608 int v68; // eax@143
Ritor1
parents:
diff changeset
609 unsigned int v86; // [sp+14h] [bp-60h]@84
Ritor1
parents:
diff changeset
610 RenderVertexSoft pRenderVertexSoft; // [sp+24h] [bp-50h]@1
Ritor1
parents:
diff changeset
611 int v90; // [sp+58h] [bp-1Ch]@68
Ritor1
parents:
diff changeset
612 float v91; // [sp+5Ch] [bp-18h]@68
Ritor1
parents:
diff changeset
613 float v93; // [sp+64h] [bp-10h]@1
Ritor1
parents:
diff changeset
614 signed int varC; // [sp+68h] [bp-Ch]@68
Ritor1
parents:
diff changeset
615 int v96; // [sp+70h] [bp-4h]@19
Ritor1
parents:
diff changeset
616 signed int uNumRepeatsb; // [sp+84h] [bp+10h]@93
Ritor1
parents:
diff changeset
617 float uNumRepeatsa; // [sp+84h] [bp+10h]@104
Ritor1
parents:
diff changeset
618 float v99; // [sp+8Ch] [bp+18h]@104
Ritor1
parents:
diff changeset
619 signed int v100; // [sp+90h] [bp+1Ch]@32
Ritor1
parents:
diff changeset
620 int v101; // [sp+90h] [bp+1Ch]@52
Ritor1
parents:
diff changeset
621 int v102; // [sp+90h] [bp+1Ch]@60
Ritor1
parents:
diff changeset
622 int v103; // [sp+90h] [bp+1Ch]@68
Ritor1
parents:
diff changeset
623
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
624 if ( !bPlayerReady || !uSoundVolumeMultiplier || !hDigDriver || eSoundID == SOUND_Invalid )
0
Ritor1
parents:
diff changeset
625 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
626
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
627 int sample_volume = 10000;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
628
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
629 int sound_id = 0;
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
630 for (uint i = 0; i < pSoundList->sNumSounds; ++i)
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
631 if (pSoundList->pSL_Sounds[i].uSoundID == eSoundID)
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
632 {
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
633 sound_id = i;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
634 break;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
635 }
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
636
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
637 if (!sound_id)
0
Ritor1
parents:
diff changeset
638 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
639 Log::Warning(L"SoundID = %u not found", eSoundID);
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
640 return;
0
Ritor1
parents:
diff changeset
641 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
642 assert(sound_id < pSoundList->sNumSounds);
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
643 if ( !a7 )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
644 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
645 if ( !pSoundList->pSL_Sounds[sound_id].pSoundData[0] )
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
646 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
647 if ( pSoundList->pSL_Sounds[sound_id].eType == SOUND_DESC_SWAP )
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
648 pSoundList->LoadSound(eSoundID, 0);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
649 }
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
650 }
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
651 if ( !pSoundList->pSL_Sounds[sound_id].pSoundData[a7] )
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
652 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
653
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
654 int start_channel = 0,
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
655 end_channel = 0;
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
656 v62 = start_channel;
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
657
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
658 if (!b3DSoundInitialized || pSoundList->pSL_Sounds[sound_id].Is3D())
0
Ritor1
parents:
diff changeset
659 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
660 if (a3 == 0) // generic sound like from UI
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
661 {
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
662 start_channel = 10;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
663 end_channel = 12;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
664 for (uint i = start_channel; i <= end_channel; ++i)
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
665 {
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
666 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
667 {
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
668 if ( pMixerChannels[i].uSourceTrackIdx == sound_id )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
669 return; // already playing the same sound from the same source - return
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
670 AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
671 FreeChannel(&pMixerChannels[i]);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
672 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
673 }
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
674 for ( uint j = start_channel; j <= end_channel; j++ )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
675 {
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
676 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
677 {
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
678 AIL_init_sample(pMixerChannels[j].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
679 char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7];
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
680 if (a7 == 0) p = p + 4;//for RIFF
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
681 if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20]
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
682 p = p + 7;
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
683 AIL_set_sample_file(pMixerChannels[j].hSample, p, -1);
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
684 if ( sample_volume == 10000 )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
685 sample_volume = uMasterVolume;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
686 if (uVolume)
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
687 sample_volume = uVolume;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
688 int object_type = PID_TYPE(a3),
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
689 object_id = PID_ID(a3);
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
690 if (source_x != -1)//
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
691 {
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
692 //if (!source_x)
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
693 //source_x = pParty->vPosition.x;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
694 //if (!source_y)
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
695 //source_y = pParty->vPosition.y;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
696 if ( source_x )//Ritor1: for pedestals
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
697 {
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
698 AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(source_x, source_y));
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
699 int vol = GetSoundStrengthByDistanceFromParty(source_x, source_y, pParty->vPosition.z);
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
700 AIL_set_sample_volume(pMixerChannels[j].hSample, vol);
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2113
diff changeset
701 }
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
702 }
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
703 if (uNumRepeats)
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
704 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
705 pMixerChannels[j].uSourceTrackIdx = sound_id;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
706 pMixerChannels[j].source_pid = a3;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
707 pMixerChannels[j].uSourceTrackID = eSoundID;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
708 int rval = AIL_start_sample(pMixerChannels[j].hSample);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
709 if ( sPlaybackRate )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
710 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
711 if (object_type == OBJECT_Player)
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
712 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
713 return;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
714 }
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
715 }
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
716 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
717 }
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
718 else if (a3 == -1) // exclusive sounds - can override
0
Ritor1
parents:
diff changeset
719 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
720 /*if ( AIL_sample_status(pMixerChannels[13].hSample) == AIL::Sample::Done )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
721 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
722 AIL_end_sample(pMixerChannels[13].hSample);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
723 if ( pMixerChannels[13].uSourceTrackIdx )
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
724 FreeChannel(&pMixerChannels[13]);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
725 }*/
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
726 AIL_init_sample(pMixerChannels[13].hSample);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
727 char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7];
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
728 if (a7 == 0)
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
729 p = p + 4;//for RIFF
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
730 if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20]
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
731 p = p + 7;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
732 AIL_set_sample_file(pMixerChannels[13].hSample, p, -1);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
733 if ( sample_volume == 10000 )
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
734 sample_volume = uMasterVolume;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
735 if (uVolume)
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
736 sample_volume = uVolume;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
737 AIL_set_sample_volume(pMixerChannels[13].hSample, sample_volume);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
738 int object_type = PID_TYPE(a3),
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
739 object_id = PID_ID(a3);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
740 if (uNumRepeats)
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
741 AIL_set_sample_loop_count(pMixerChannels[13].hSample, uNumRepeats - 1);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
742 pMixerChannels[13].uSourceTrackIdx = sound_id;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
743 pMixerChannels[13].source_pid = a3;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
744 pMixerChannels[13].uSourceTrackID = eSoundID;
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
745 int rval = AIL_start_sample(pMixerChannels[13].hSample);//no sound chest close
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
746 if ( sPlaybackRate )
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
747 AIL_set_sample_playback_rate(pMixerChannels[13].hSample, sPlaybackRate);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
748 if (object_type == OBJECT_Player)
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
749 AIL_sample_ms_position(pMixerChannels[13].hSample, &sLastTrackLengthMS, 0);
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
750 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
751 }
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
752 else if (a3 < 0) // exclusive sounds - no override (close chest)
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
753 {
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
754 start_channel = 14;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
755 end_channel = 14;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
756 for (uint i = start_channel; i <= end_channel; ++i)
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
757 {
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
758 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
759 {
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
760 if ( pMixerChannels[i].uSourceTrackIdx == sound_id )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
761 return; // already playing the same sound from the same source - return
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
762 AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
763 FreeChannel(&pMixerChannels[i]);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
764 }
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
765 }
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
766 for ( uint j = start_channel; j <= end_channel; j++ )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
767 {
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
768 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
769 {
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
770 AIL_init_sample(pMixerChannels[j].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
771 char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7];
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
772 if (a7 == 0) p = p + 4;//for RIFF
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
773 if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20]
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
774 p = p + 7;
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
775 AIL_set_sample_file(pMixerChannels[j].hSample, p, -1);
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
776 if ( sample_volume == 10000 )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
777 sample_volume = uMasterVolume;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
778 if (uVolume)
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
779 sample_volume = uVolume;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
780 int object_type = PID_TYPE(a3),
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
781 object_id = PID_ID(a3);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
782 if (uNumRepeats)
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
783 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
784 pMixerChannels[j].uSourceTrackIdx = sound_id;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
785 pMixerChannels[j].source_pid = a3;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
786 pMixerChannels[j].uSourceTrackID = eSoundID;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
787 int rval = AIL_start_sample(pMixerChannels[j].hSample);//no sound chest close
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
788 if ( sPlaybackRate )
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
789 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
790 if (object_type == OBJECT_Player)
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
791 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0);
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
792 return;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
793 }
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
794 }
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
795 return;
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
796 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
797 else
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
798 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
799 int object_type = PID_TYPE(a3),
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
800 object_id = PID_ID(a3);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
801 switch (object_type)
0
Ritor1
parents:
diff changeset
802 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
803 case OBJECT_BLVDoor:
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
804 {
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
805 assert(uCurrentlyLoadedLevelType == LEVEL_Indoor);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
806 assert(object_id < pIndoor->uNumDoors);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
807 if ( !pIndoor->pDoors[object_id].uDoorID )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
808 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
809
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
810 start_channel = 10;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
811 end_channel = 12;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
812 for (uint i = start_channel; i <= end_channel; ++i)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
813 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
814 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
815 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
816 if ( pMixerChannels[i].uSourceTrackIdx == sound_id )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
817 return; // already playing the same sound from the same source - return
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
818 AIL_end_sample( pMixerChannels[i].hSample); // requested new sound from the same source - end & switch
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
819 FreeChannel(&pMixerChannels[i]);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
820 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
821 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
822 for ( uint j = start_channel; j <= end_channel; j++ )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
823 {
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
824 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
825 {
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
826 AIL_init_sample(pMixerChannels[j].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
827 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
828 if (uVolume)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
829 sample_volume = uVolume;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
830 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
831 /*if (!GetSoundStrengthByDistanceFromParty(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0], pIndoor->pDoors[object_id].pZOffsets[0]))
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
832 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
833 AIL_end_sample(pMixerChannels[j].hSample);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
834 FreeChannel(&pMixerChannels[j]);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
835 return;
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
836 } */
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
837 AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0]));
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
838 if (uNumRepeats)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
839 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
840 pMixerChannels[j].uSourceTrackIdx = sound_id;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
841 pMixerChannels[j].source_pid = a3;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
842 pMixerChannels[j].uSourceTrackID = eSoundID;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
843 int rval = AIL_start_sample(pMixerChannels[j].hSample);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
844 if ( sPlaybackRate )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
845 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
846 if (object_type == OBJECT_Player)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
847 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
848 return;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
849 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
850 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
851 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
852 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
853
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
854 case OBJECT_Player:
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
855 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
856 start_channel = 10;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
857 end_channel = 12;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
858 for (uint i = start_channel; i <= end_channel; ++i)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
859 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
860 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
861 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
862 if ( pMixerChannels[i].uSourceTrackIdx == sound_id )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
863 return; // already playing the same sound from the same source - return
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
864 AIL_end_sample( pMixerChannels[i].hSample); // requested new sound from the same source - end & switch
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
865 FreeChannel(&pMixerChannels[i]);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
866 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
867 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
868 for ( uint j = start_channel; j <= end_channel; j++ )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
869 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
870 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
871 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
872 AIL_init_sample(pMixerChannels[j].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
873 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
874 if (uVolume)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
875 sample_volume = uVolume;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
876 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
877 if (uNumRepeats)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
878 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
879 pMixerChannels[j].uSourceTrackIdx = sound_id;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
880 pMixerChannels[j].source_pid = a3;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
881 pMixerChannels[j].uSourceTrackID = eSoundID;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
882 int rval = AIL_start_sample(pMixerChannels[j].hSample);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
883 if ( sPlaybackRate )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
884 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
885 if (object_type == OBJECT_Player)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
886 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
887 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
888 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
889 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
890 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
891 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
892
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
893 case OBJECT_Actor:
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
894 {
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
895 start_channel = 0;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
896 end_channel = 3;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
897 assert(object_id < uNumActors);
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
898 sample_volume = GetSoundStrengthByDistanceFromParty(pActors[object_id].vPosition.x, pActors[object_id].vPosition.y, pActors[object_id].vPosition.z);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
899 if (!sample_volume)
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
900 return;
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
901 for (uint i = start_channel; i <= end_channel; ++i)
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
902 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
903 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
904 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
905 if ( pMixerChannels[i].uSourceTrackIdx == sound_id )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
906 return; // already playing the same sound from the same source - return
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
907 AIL_end_sample( pMixerChannels[i].hSample); // requested new sound from the same source - end & switch
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
908 FreeChannel(&pMixerChannels[i]);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
909 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
910 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
911 for ( uint j = start_channel; j <= end_channel; j++ )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
912 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
913 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
914 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
915 AIL_init_sample(pMixerChannels[j].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
916 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
917 if (uVolume)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
918 sample_volume = uVolume;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
919 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
920 if (!GetSoundStrengthByDistanceFromParty(pActors[object_id].vPosition.x, pActors[object_id].vPosition.y, pActors[object_id].vPosition.z))
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
921 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
922 AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(pActors[object_id].vPosition.x, pActors[object_id].vPosition.y));
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
923 if (uNumRepeats)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
924 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
925 pMixerChannels[j].uSourceTrackIdx = sound_id;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
926 pMixerChannels[j].source_pid = a3;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
927 pMixerChannels[j].uSourceTrackID = eSoundID;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
928 int rval = AIL_start_sample(pMixerChannels[j].hSample);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
929 if ( sPlaybackRate )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
930 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
931 if (object_type == OBJECT_Player)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
932 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
933 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
934 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
935 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
936 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
937 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
938
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
939 case OBJECT_Decoration:
0
Ritor1
parents:
diff changeset
940 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
941 start_channel = 4;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
942 end_channel = 4;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
943 assert(object_id < uNumLevelDecorations);
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
944 sample_volume = GetSoundStrengthByDistanceFromParty(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y, pLevelDecorations[object_id].vPosition.z);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
945 if (!sample_volume)
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
946 return;
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
947 for (uint i = start_channel; i <= end_channel; ++i)
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
948 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
949 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )//
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
950 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
951 if ( pMixerChannels[i].uSourceTrackIdx == sound_id )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
952 return; // already playing the same sound from the same source - return
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
953 AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
954 FreeChannel(&pMixerChannels[i]);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
955 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
956 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
957 for ( uint j = start_channel; j <= end_channel; j++ )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
958 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
959 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
960 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
961 AIL_init_sample(pMixerChannels[j].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
962 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
963 if (uVolume)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
964 sample_volume = uVolume;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
965 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
966 if (!GetSoundStrengthByDistanceFromParty(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y, pLevelDecorations[object_id].vPosition.z))
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
967 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
968 AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y));
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
969 if (uNumRepeats)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
970 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
971 pMixerChannels[j].uSourceTrackIdx = sound_id;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
972 pMixerChannels[j].source_pid = a3;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
973 pMixerChannels[j].uSourceTrackID = eSoundID;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
974 int rval = AIL_start_sample(pMixerChannels[j].hSample);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
975 if ( sPlaybackRate )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
976 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
977 if (object_type == OBJECT_Player)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
978 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
979 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
980 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
981 }
0
Ritor1
parents:
diff changeset
982 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
983 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
984
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
985 case OBJECT_Item:
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
986 {
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
987 start_channel = 5;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
988 end_channel = 7;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 412
diff changeset
989 assert(object_id < uNumSpriteObjects);
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
990 sample_volume = GetSoundStrengthByDistanceFromParty(pSpriteObjects[object_id].vPosition.x, pSpriteObjects[object_id].vPosition.y, pSpriteObjects[object_id].vPosition.z);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
991 if (!sample_volume)
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
992 return;
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
993 for (uint i = start_channel; i <= end_channel; ++i)
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
994 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
995 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
996 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
997 if (pMixerChannels[i].uSourceTrackIdx == sound_id)
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
998 return; // already playing the same sound from the same source - return
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
999 AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1000 FreeChannel(&pMixerChannels[i]);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1001 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1002 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1003 for ( uint j = start_channel; j <= end_channel; j++ )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1004 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1005 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1006 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1007 AIL_init_sample(pMixerChannels[j].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
1008 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1009 if (uVolume)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1010 sample_volume = uVolume;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1011 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1012 if (!GetSoundStrengthByDistanceFromParty(pSpriteObjects[object_id].vPosition.x, pSpriteObjects[object_id].vPosition.y, pSpriteObjects[object_id].vPosition.z) )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1013 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1014 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pSpriteObjects[object_id].vPosition.x, pSpriteObjects[object_id].vPosition.y));
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1015 if (uNumRepeats)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1016 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1017 pMixerChannels[j].uSourceTrackIdx = sound_id;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1018 pMixerChannels[j].source_pid = a3;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1019 pMixerChannels[j].uSourceTrackID = eSoundID;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1020 int rval = AIL_start_sample(pMixerChannels[j].hSample);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1021 if ( sPlaybackRate )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1022 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1023 if (object_type == OBJECT_Player)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1024 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1025 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1026 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1027 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1028 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1029 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1030
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1031 case OBJECT_BModel:
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1032 {
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1033 start_channel = 8;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1034 end_channel = 9;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1035 for (uint i = start_channel; i <= end_channel; ++i)
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1036 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1037 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1038 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1039 if ( pMixerChannels[i].uSourceTrackIdx == sound_id )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1040 return; // already playing the same sound from the same source - return
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1041 AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1042 FreeChannel(&pMixerChannels[i]);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1043 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1044 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1045 for ( uint j = start_channel; j <= end_channel; j++ )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1046 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1047 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1048 {
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1049 AIL_init_sample(pMixerChannels[j].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
1050 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1051 if (uVolume)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1052 sample_volume = uVolume;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1053 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1054 if (uNumRepeats)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1055 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1056 pMixerChannels[j].uSourceTrackIdx = sound_id;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1057 pMixerChannels[j].source_pid = a3;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1058 pMixerChannels[j].uSourceTrackID = eSoundID;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1059 int rval = AIL_start_sample(pMixerChannels[j].hSample);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1060 if ( sPlaybackRate )
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1061 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1062 if (object_type == OBJECT_Player)
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1063 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0);
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1064 return;
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1065 }
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1066 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1067 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1068 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1069
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1070 default:
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1071 assert(false);
0
Ritor1
parents:
diff changeset
1072 }
Ritor1
parents:
diff changeset
1073 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1074
2106
b52c09e01e7e PlaySound() blv_door and other sounds
Ritor1
parents: 2105
diff changeset
1075 __debugbreak();//Ritor1
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1076 if (start_channel > end_channel) // no free channel - occupy the quitest one
0
Ritor1
parents:
diff changeset
1077 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1078 start_channel = -1;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1079 int min_volume = sample_volume;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1080 for (uint i = start_channel; i <= end_channel; ++i)
0
Ritor1
parents:
diff changeset
1081 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1082 int volume = AIL_sample_volume(pMixerChannels[i].hSample);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1083 if (volume < min_volume)
0
Ritor1
parents:
diff changeset
1084 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1085 min_volume = volume;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
1086 start_channel = i;
0
Ritor1
parents:
diff changeset
1087 }
Ritor1
parents:
diff changeset
1088 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1089 if (v62 == -1) // no free channels at all - only channel 13 allows override (a3 == -1)
0
Ritor1
parents:
diff changeset
1090 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1091 if (start_channel != 13)
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1092 return;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1093 v62 = 13;
0
Ritor1
parents:
diff changeset
1094 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1095 AIL_end_sample(pMixerChannels[v62].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1096 FreeChannel(&pMixerChannels[v62]);
0
Ritor1
parents:
diff changeset
1097 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1098
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1099 if (v62 > end_channel)//10!=13
0
Ritor1
parents:
diff changeset
1100 return;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1101
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1102 if ( sample_volume == 10000 )
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1103 sample_volume = uMasterVolume;
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1104
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1105 AIL_init_sample(pMixerChannels[v62].hSample);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
1106 AIL_set_sample_file(pMixerChannels[v62].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1107 if (uVolume)
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1108 sample_volume = uVolume;
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1109 AIL_set_sample_volume(pMixerChannels[v62].hSample, sample_volume);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1110
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1111 int object_type = PID_TYPE(a3),
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1112 object_id = PID_ID(a3);
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1113 if (source_x != -1)
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1114 {
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1115 if (!source_x)
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1116 source_x = pParty->vPosition.x;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1117 if (!source_y)
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1118 source_y = pParty->vPosition.y;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1119 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(source_x, source_y));
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1120 AIL_set_sample_volume(pMixerChannels[v62].hSample, GetSoundStrengthByDistanceFromParty(source_x, source_y, pParty->vPosition.z));
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1121 }
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1122
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1123 if (uNumRepeats)
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1124 AIL_set_sample_loop_count(pMixerChannels[v62].hSample, uNumRepeats - 1);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1125 pMixerChannels[v62].uSourceTrackIdx = sound_id;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1126 pMixerChannels[v62].source_pid = a3;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1127 pMixerChannels[v62].uSourceTrackID = eSoundID;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1128 int rval = AIL_start_sample(pMixerChannels[v62].hSample);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1129 if ( sPlaybackRate )
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1130 AIL_set_sample_playback_rate(pMixerChannels[v62].hSample, sPlaybackRate);
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1131 if (object_type == OBJECT_Player)
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1132 AIL_sample_ms_position(pMixerChannels[v62].hSample, &sLastTrackLengthMS, 0);
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1133 return;
0
Ritor1
parents:
diff changeset
1134 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1135 else
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1136 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1137 __debugbreak(); // 3d sound stuff, refactor
0
Ritor1
parents:
diff changeset
1138 v12 = 13;
Ritor1
parents:
diff changeset
1139 if ( a3 < 0 )
Ritor1
parents:
diff changeset
1140 {
Ritor1
parents:
diff changeset
1141 v15 = pAudioPlayer->uNum3DSamples;
Ritor1
parents:
diff changeset
1142 if ( a3 == -1 )
Ritor1
parents:
diff changeset
1143 {
Ritor1
parents:
diff changeset
1144 if ( v15 < 16 )
Ritor1
parents:
diff changeset
1145 v12 = v15 - 1;
Ritor1
parents:
diff changeset
1146 v96 = v12;
Ritor1
parents:
diff changeset
1147 //goto LABEL_46;
Ritor1
parents:
diff changeset
1148 pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x;
Ritor1
parents:
diff changeset
1149 pRenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y;
Ritor1
parents:
diff changeset
1150 v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
Ritor1
parents:
diff changeset
1151 goto LABEL_47;
Ritor1
parents:
diff changeset
1152 }
Ritor1
parents:
diff changeset
1153 if ( v15 >= 16 )
Ritor1
parents:
diff changeset
1154 v15 = 14;
Ritor1
parents:
diff changeset
1155 v12 = v15;
Ritor1
parents:
diff changeset
1156 //goto LABEL_45;
Ritor1
parents:
diff changeset
1157 v96 = v15;
Ritor1
parents:
diff changeset
1158 pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x;
Ritor1
parents:
diff changeset
1159 pRenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y;
Ritor1
parents:
diff changeset
1160 v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
Ritor1
parents:
diff changeset
1161 goto LABEL_47;
Ritor1
parents:
diff changeset
1162 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1163 if ( PID_TYPE(a3) == 2 )
0
Ritor1
parents:
diff changeset
1164 {
Ritor1
parents:
diff changeset
1165 v22 = pAudioPlayer->uNum3DSamples;
Ritor1
parents:
diff changeset
1166 if ( v22 < 16 )
Ritor1
parents:
diff changeset
1167 {
Ritor1
parents:
diff changeset
1168 v12 = 5 * v22 / 16;
Ritor1
parents:
diff changeset
1169 v96 = 7 * v22 / 16;
Ritor1
parents:
diff changeset
1170 }
Ritor1
parents:
diff changeset
1171 else
Ritor1
parents:
diff changeset
1172 {
Ritor1
parents:
diff changeset
1173 v96 = 7;
Ritor1
parents:
diff changeset
1174 v12 = 5;
Ritor1
parents:
diff changeset
1175 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1176 pLayingItem = &pSpriteObjects[PID_ID(a3)];
0
Ritor1
parents:
diff changeset
1177 }
Ritor1
parents:
diff changeset
1178 else
Ritor1
parents:
diff changeset
1179 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1180 if ( PID_TYPE(a3) == 3 )
0
Ritor1
parents:
diff changeset
1181 {
Ritor1
parents:
diff changeset
1182 v18 = pAudioPlayer->uNum3DSamples;
Ritor1
parents:
diff changeset
1183 v12 = 0;
Ritor1
parents:
diff changeset
1184 if ( v18 < 16 )
Ritor1
parents:
diff changeset
1185 v96 = 3 * v18 / 16;
Ritor1
parents:
diff changeset
1186 else
Ritor1
parents:
diff changeset
1187 v96 = 3;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1188 pActor1 = &pActors[PID_ID(a3)];
0
Ritor1
parents:
diff changeset
1189 v20 = pActor1->vPosition.y;
Ritor1
parents:
diff changeset
1190 pRenderVertexSoft.vWorldPosition.x = (double)pActor1->vPosition.x;
Ritor1
parents:
diff changeset
1191 v100 = pActor1->vPosition.z;
Ritor1
parents:
diff changeset
1192 pRenderVertexSoft.vWorldPosition.y = (double)v20;
Ritor1
parents:
diff changeset
1193 v21 = (double)v100;
Ritor1
parents:
diff changeset
1194 goto LABEL_47;
Ritor1
parents:
diff changeset
1195 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1196 if ( PID_TYPE(a3) != 5 )
0
Ritor1
parents:
diff changeset
1197 {
Ritor1
parents:
diff changeset
1198 v13 = pAudioPlayer->uNum3DSamples;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1199 if ( PID_TYPE(a3) == 6 )
0
Ritor1
parents:
diff changeset
1200 {
Ritor1
parents:
diff changeset
1201 if ( v13 >= 16 )
Ritor1
parents:
diff changeset
1202 {
Ritor1
parents:
diff changeset
1203 v96 = 9;
Ritor1
parents:
diff changeset
1204 v12 = 8;
Ritor1
parents:
diff changeset
1205 //goto LABEL_46;
Ritor1
parents:
diff changeset
1206 pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x;
Ritor1
parents:
diff changeset
1207 pRenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y;
Ritor1
parents:
diff changeset
1208 v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
Ritor1
parents:
diff changeset
1209 goto LABEL_47;
Ritor1
parents:
diff changeset
1210 }
Ritor1
parents:
diff changeset
1211 v12 = 8 * v13 / 16;
Ritor1
parents:
diff changeset
1212 v14 = 9 * v13;
Ritor1
parents:
diff changeset
1213 }
Ritor1
parents:
diff changeset
1214 else
Ritor1
parents:
diff changeset
1215 {
Ritor1
parents:
diff changeset
1216 if ( v13 >= 16 )
Ritor1
parents:
diff changeset
1217 {
Ritor1
parents:
diff changeset
1218 v96 = 12;
Ritor1
parents:
diff changeset
1219 v12 = 10;
Ritor1
parents:
diff changeset
1220 //LABEL_46:
Ritor1
parents:
diff changeset
1221 pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x;
Ritor1
parents:
diff changeset
1222 pRenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y;
Ritor1
parents:
diff changeset
1223 v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
Ritor1
parents:
diff changeset
1224 goto LABEL_47;
Ritor1
parents:
diff changeset
1225 }
Ritor1
parents:
diff changeset
1226 v12 = 10 * v13 / 16;
Ritor1
parents:
diff changeset
1227 v14 = 12 * v13;
Ritor1
parents:
diff changeset
1228 }
Ritor1
parents:
diff changeset
1229 v15 = v14 / 16;
Ritor1
parents:
diff changeset
1230 //LABEL_45:
Ritor1
parents:
diff changeset
1231 v96 = v15;
Ritor1
parents:
diff changeset
1232 //goto LABEL_46;
Ritor1
parents:
diff changeset
1233 pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x;
Ritor1
parents:
diff changeset
1234 pRenderVertexSoft.vWorldPosition.y = (double)pParty->vPosition.y;
Ritor1
parents:
diff changeset
1235 v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
Ritor1
parents:
diff changeset
1236 goto LABEL_47;
Ritor1
parents:
diff changeset
1237 }
Ritor1
parents:
diff changeset
1238 v16 = pAudioPlayer->uNum3DSamples;
Ritor1
parents:
diff changeset
1239 if ( v16 < 16 )
Ritor1
parents:
diff changeset
1240 {
Ritor1
parents:
diff changeset
1241 v12 = v16 / 4;
Ritor1
parents:
diff changeset
1242 v96 = v16 / 4;
Ritor1
parents:
diff changeset
1243 }
Ritor1
parents:
diff changeset
1244 else
Ritor1
parents:
diff changeset
1245 {
Ritor1
parents:
diff changeset
1246 v12 = 4;
Ritor1
parents:
diff changeset
1247 v96 = 4;
Ritor1
parents:
diff changeset
1248 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1249 pLayingItem = (SpriteObject *)&pLevelDecorations[PID_ID(a3)];
0
Ritor1
parents:
diff changeset
1250 }
Ritor1
parents:
diff changeset
1251 pRenderVertexSoft.vWorldPosition.x = (double)pLayingItem->vPosition.x;
Ritor1
parents:
diff changeset
1252 pRenderVertexSoft.vWorldPosition.y = (double)pLayingItem->vPosition.y;
Ritor1
parents:
diff changeset
1253 v21 = (double)pLayingItem->vPosition.z;
Ritor1
parents:
diff changeset
1254 LABEL_47:
Ritor1
parents:
diff changeset
1255 pRenderVertexSoft.vWorldPosition.z = v21;
Ritor1
parents:
diff changeset
1256 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
1257 sub_4AAEA6_transform(&pRenderVertexSoft);
Ritor1
parents:
diff changeset
1258 else
Ritor1
parents:
diff changeset
1259 pGame->pIndoorCameraD3D->ViewTransform(&pRenderVertexSoft, 1);
Ritor1
parents:
diff changeset
1260 if ( a3 )
Ritor1
parents:
diff changeset
1261 {
Ritor1
parents:
diff changeset
1262 if ( a3 != -1 )
Ritor1
parents:
diff changeset
1263 {
Ritor1
parents:
diff changeset
1264 v101 = 0;
Ritor1
parents:
diff changeset
1265 if ( pAudioPlayer->uNum3DSamples > 0 )
Ritor1
parents:
diff changeset
1266 {
Ritor1
parents:
diff changeset
1267 pAudioPlayer_3DSample = pAudioPlayer->p3DSamples;
Ritor1
parents:
diff changeset
1268 do
Ritor1
parents:
diff changeset
1269 {
Ritor1
parents:
diff changeset
1270 if ( AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4
Ritor1
parents:
diff changeset
1271 && pAudioPlayer_3DSample->field_4 == a3 && AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4 )
Ritor1
parents:
diff changeset
1272 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1273 if ( pAudioPlayer_3DSample->field_8 == sound_id )
0
Ritor1
parents:
diff changeset
1274 return;
Ritor1
parents:
diff changeset
1275 AIL_end_3D_sample(pAudioPlayer_3DSample->hSample);
Ritor1
parents:
diff changeset
1276 pAudioPlayer->_4ABF23(pAudioPlayer_3DSample);
Ritor1
parents:
diff changeset
1277 }
Ritor1
parents:
diff changeset
1278 ++v101;
Ritor1
parents:
diff changeset
1279 ++pAudioPlayer_3DSample;
Ritor1
parents:
diff changeset
1280 }
Ritor1
parents:
diff changeset
1281 while ( v101 < pAudioPlayer->uNum3DSamples );
Ritor1
parents:
diff changeset
1282 }
Ritor1
parents:
diff changeset
1283 }
Ritor1
parents:
diff changeset
1284 }
Ritor1
parents:
diff changeset
1285 v102 = v12;
Ritor1
parents:
diff changeset
1286 if ( v12 <= v96 )
Ritor1
parents:
diff changeset
1287 {
Ritor1
parents:
diff changeset
1288 pAudioPlayer_3DSample1 = &pAudioPlayer->p3DSamples[v12];
Ritor1
parents:
diff changeset
1289 while ( AIL_3D_sample_status(pAudioPlayer_3DSample1->hSample) != 2 )
Ritor1
parents:
diff changeset
1290 {
Ritor1
parents:
diff changeset
1291 ++v102;
Ritor1
parents:
diff changeset
1292 ++pAudioPlayer_3DSample1;
Ritor1
parents:
diff changeset
1293 if ( v102 > v96 )
Ritor1
parents:
diff changeset
1294 goto LABEL_67;
Ritor1
parents:
diff changeset
1295 }
Ritor1
parents:
diff changeset
1296 AIL_end_3D_sample(pAudioPlayer_3DSample1->hSample);
Ritor1
parents:
diff changeset
1297 if ( pAudioPlayer_3DSample1->field_8 )
Ritor1
parents:
diff changeset
1298 pAudioPlayer->_4ABF23(pAudioPlayer_3DSample1);
Ritor1
parents:
diff changeset
1299 }
Ritor1
parents:
diff changeset
1300 LABEL_67:
Ritor1
parents:
diff changeset
1301 v25 = v96;
Ritor1
parents:
diff changeset
1302 if ( v102 == v96 + 1 )
Ritor1
parents:
diff changeset
1303 {
Ritor1
parents:
diff changeset
1304 LODWORD(v91) = -1;
Ritor1
parents:
diff changeset
1305 v103 = 0;
Ritor1
parents:
diff changeset
1306 *(float *)&varC = pRenderVertexSoft.vWorldViewPosition.y * -0.012207031;
Ritor1
parents:
diff changeset
1307 v93 = 0.0;
Ritor1
parents:
diff changeset
1308 v26 = pRenderVertexSoft.vWorldViewPosition.x * 0.012207031;
Ritor1
parents:
diff changeset
1309 *(float *)&uVolume = v26;
Ritor1
parents:
diff changeset
1310 v27 = abs((signed __int64)v26);
Ritor1
parents:
diff changeset
1311 v28 = abs((signed __int64)v93);
Ritor1
parents:
diff changeset
1312 v29 = abs((signed __int64)*(float *)&varC);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 225
diff changeset
1313 v90 = int_get_vector_length(v29, v28, v27);
0
Ritor1
parents:
diff changeset
1314 sPlaybackRate = v12;
Ritor1
parents:
diff changeset
1315 if ( v12 > v25 )
Ritor1
parents:
diff changeset
1316 goto LABEL_192;
Ritor1
parents:
diff changeset
1317 pAudioPlayer_3DSample2 = &pAudioPlayer->p3DSamples[v12];
Ritor1
parents:
diff changeset
1318 do
Ritor1
parents:
diff changeset
1319 {
Ritor1
parents:
diff changeset
1320 AIL_3D_position(pAudioPlayer_3DSample2->hSample, &varC, &v93, (long *)&uVolume);
Ritor1
parents:
diff changeset
1321 v31 = abs((signed __int64)*(float *)&uVolume);
Ritor1
parents:
diff changeset
1322 v32 = abs((signed __int64)v93);
Ritor1
parents:
diff changeset
1323 v33 = abs((signed __int64)*(float *)&varC);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 225
diff changeset
1324 v34 = int_get_vector_length(v33, v32, v31);
0
Ritor1
parents:
diff changeset
1325 v35 = v103 == v34;
Ritor1
parents:
diff changeset
1326 if ( v103 < v34 )
Ritor1
parents:
diff changeset
1327 {
Ritor1
parents:
diff changeset
1328 v103 = v34;
Ritor1
parents:
diff changeset
1329 v35 = 1;
Ritor1
parents:
diff changeset
1330 }
Ritor1
parents:
diff changeset
1331 if ( v35 && v90 < v103 )
Ritor1
parents:
diff changeset
1332 {
Ritor1
parents:
diff changeset
1333 v36 = sPlaybackRate;
Ritor1
parents:
diff changeset
1334 LODWORD(v91) = sPlaybackRate;
Ritor1
parents:
diff changeset
1335 }
Ritor1
parents:
diff changeset
1336 else
Ritor1
parents:
diff changeset
1337 {
Ritor1
parents:
diff changeset
1338 v36 = LODWORD(v91);
Ritor1
parents:
diff changeset
1339 }
Ritor1
parents:
diff changeset
1340 ++sPlaybackRate;
Ritor1
parents:
diff changeset
1341 ++pAudioPlayer_3DSample2;
Ritor1
parents:
diff changeset
1342 }
Ritor1
parents:
diff changeset
1343 while ( sPlaybackRate <= v96 );
Ritor1
parents:
diff changeset
1344 if ( v36 == -1 )
Ritor1
parents:
diff changeset
1345 {
Ritor1
parents:
diff changeset
1346 LABEL_192:
Ritor1
parents:
diff changeset
1347 v36 = 13;
Ritor1
parents:
diff changeset
1348 if ( v12 != 13 )
Ritor1
parents:
diff changeset
1349 return;
Ritor1
parents:
diff changeset
1350 }
Ritor1
parents:
diff changeset
1351 //pAudioPlayer2 = pAudioPlayer;
Ritor1
parents:
diff changeset
1352 pAudioPlayer_3DSample3 = &pAudioPlayer->p3DSamples[v36];
Ritor1
parents:
diff changeset
1353 AIL_end_3D_sample(pAudioPlayer_3DSample3->hSample);
Ritor1
parents:
diff changeset
1354 pAudioPlayer->_4ABF23(pAudioPlayer_3DSample3);
Ritor1
parents:
diff changeset
1355 v102 = v36;
Ritor1
parents:
diff changeset
1356 }
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1357 //v39 = v89;
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
1358 if ( pSoundList->pSL_Sounds[sound_id].p3DSound || (LOWORD(v40) = pSoundList->LoadSound(eSoundID, 0), v40) )
0
Ritor1
parents:
diff changeset
1359 {
Ritor1
parents:
diff changeset
1360 v41 = (char *)pAudioPlayer + 16 * v102;
Ritor1
parents:
diff changeset
1361 v42 = (int)(v41 + 20);
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
1362 if ( AIL_set_3D_sample_file(*((int *)v41 + 5), *(void **)((char *)&pSoundList->pSL_Sounds->p3DSound + sound_id * sizeof(SoundDesc))) )
0
Ritor1
parents:
diff changeset
1363 {
Ritor1
parents:
diff changeset
1364 if ( uNumRepeats )
Ritor1
parents:
diff changeset
1365 v86 = uNumRepeats - 1;
Ritor1
parents:
diff changeset
1366 else
Ritor1
parents:
diff changeset
1367 v86 = 1;
Ritor1
parents:
diff changeset
1368 AIL_set_3D_sample_loop_count(*(int *)v42, v86);
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1369 if ( source_x == -1 )
0
Ritor1
parents:
diff changeset
1370 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1371 if ( PID_TYPE(a3) == 1 )
0
Ritor1
parents:
diff changeset
1372 {
Ritor1
parents:
diff changeset
1373 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
1374 {
Ritor1
parents:
diff changeset
1375 //goto LABEL_103;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1376 pBLVDoor = &pIndoor->pDoors[PID_ID(a3)];
0
Ritor1
parents:
diff changeset
1377 if ( !pBLVDoor->uDoorID )
Ritor1
parents:
diff changeset
1378 return;
Ritor1
parents:
diff changeset
1379 pRenderVertexSoft.vWorldPosition.x = (double)*pBLVDoor->pXOffsets;
Ritor1
parents:
diff changeset
1380 pRenderVertexSoft.vWorldPosition.y = (double)*pBLVDoor->pYOffsets;
Ritor1
parents:
diff changeset
1381 v47 = (double)*pBLVDoor->pZOffsets;
Ritor1
parents:
diff changeset
1382 LABEL_101:
Ritor1
parents:
diff changeset
1383 pRenderVertexSoft.vWorldPosition.z = v47;
Ritor1
parents:
diff changeset
1384 //if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
1385 //{
Ritor1
parents:
diff changeset
1386 sub_4AAEA6_transform(&pRenderVertexSoft);
Ritor1
parents:
diff changeset
1387 //goto LABEL_104;
Ritor1
parents:
diff changeset
1388 //}
Ritor1
parents:
diff changeset
1389 }
Ritor1
parents:
diff changeset
1390 //LABEL_103:
Ritor1
parents:
diff changeset
1391 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )
Ritor1
parents:
diff changeset
1392 pGame->pIndoorCameraD3D->ViewTransform(&pRenderVertexSoft, 1);
Ritor1
parents:
diff changeset
1393 //LABEL_104:
Ritor1
parents:
diff changeset
1394 AIL_start_3D_sample(*(int *)v42);
Ritor1
parents:
diff changeset
1395 AIL_set_3D_sample_float_distances(*(int **)v42, 100.0, 20.0, 100.0, 20.0);
Ritor1
parents:
diff changeset
1396 AIL_set_3D_sample_volume(*(int **)v42, pAudioPlayer->s3DSoundVolume);
Ritor1
parents:
diff changeset
1397 v99 = pRenderVertexSoft.vWorldViewPosition.y * -0.012207031;
Ritor1
parents:
diff changeset
1398 v49 = pRenderVertexSoft.vWorldViewPosition.x * 0.012207031;
Ritor1
parents:
diff changeset
1399 uNumRepeatsa = v49;
Ritor1
parents:
diff changeset
1400 v50 = abs((signed __int64)v49);
Ritor1
parents:
diff changeset
1401 v51 = abs(0);
Ritor1
parents:
diff changeset
1402 v52 = abs((signed __int64)v99);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 225
diff changeset
1403 if ( int_get_vector_length(v52, v51, v50) <= 100 )
0
Ritor1
parents:
diff changeset
1404 {
Ritor1
parents:
diff changeset
1405 AIL_set_3D_position((void *)*(int *)v42, LODWORD(v99), 0.0, LODWORD(uNumRepeatsa));
Ritor1
parents:
diff changeset
1406 v53 = -uNumRepeatsa;
Ritor1
parents:
diff changeset
1407 v54 = -v99;
Ritor1
parents:
diff changeset
1408 AIL_set_3D_orientation((void *)*(int *)v42, LODWORD(v54), 0.0, LODWORD(v53), 0.0, 1.0, 0.0);
Ritor1
parents:
diff changeset
1409 //pAudioPlayer3 = pAudioPlayer;
Ritor1
parents:
diff changeset
1410 *((int *)v41 + 6) = a3;
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 379
diff changeset
1411 *((int *)v41 + 7) = sound_id;
0
Ritor1
parents:
diff changeset
1412 *(&pAudioPlayer->bEAXSupported + 4 * (v102 + 2)) = eSoundID;
Ritor1
parents:
diff changeset
1413 }
Ritor1
parents:
diff changeset
1414 else
Ritor1
parents:
diff changeset
1415 {
Ritor1
parents:
diff changeset
1416 AIL_end_3D_sample(*(int **)v42);
Ritor1
parents:
diff changeset
1417 pAudioPlayer->_4ABF23((AudioPlayer_3DSample *)(v41 + 20));
Ritor1
parents:
diff changeset
1418 }
Ritor1
parents:
diff changeset
1419 return;
Ritor1
parents:
diff changeset
1420 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1421 if ( PID_TYPE(a3) == 2 )
0
Ritor1
parents:
diff changeset
1422 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1423 pLayingItem2 = &pSpriteObjects[PID_ID(a3)];
0
Ritor1
parents:
diff changeset
1424 }
Ritor1
parents:
diff changeset
1425 else
Ritor1
parents:
diff changeset
1426 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1427 if ( PID_TYPE(a3) == 3 )
0
Ritor1
parents:
diff changeset
1428 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1429 pActor = &pActors[PID_ID(a3)];
0
Ritor1
parents:
diff changeset
1430 v46 = pActor->vPosition.y;
Ritor1
parents:
diff changeset
1431 pRenderVertexSoft.vWorldPosition.x = (double)pActor->vPosition.x;
Ritor1
parents:
diff changeset
1432 uNumRepeatsb = pActor->vPosition.z;
Ritor1
parents:
diff changeset
1433 pRenderVertexSoft.vWorldPosition.y = (double)v46;
Ritor1
parents:
diff changeset
1434 v47 = (double)uNumRepeatsb;
Ritor1
parents:
diff changeset
1435 goto LABEL_101;
Ritor1
parents:
diff changeset
1436 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1437 if ( PID_TYPE(a3) != 5 )
0
Ritor1
parents:
diff changeset
1438 {
Ritor1
parents:
diff changeset
1439 pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x;
Ritor1
parents:
diff changeset
1440 v43 = (double)pParty->vPosition.y;
Ritor1
parents:
diff changeset
1441 pRenderVertexSoft.vWorldPosition.y = v43;
Ritor1
parents:
diff changeset
1442 v47 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
Ritor1
parents:
diff changeset
1443 goto LABEL_101;
Ritor1
parents:
diff changeset
1444 }
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 764
diff changeset
1445 pLayingItem2 = (SpriteObject *)&pLevelDecorations[PID_ID(a3)];
0
Ritor1
parents:
diff changeset
1446 }
Ritor1
parents:
diff changeset
1447 pRenderVertexSoft.vWorldPosition.x = (double)pLayingItem2->vPosition.x;
Ritor1
parents:
diff changeset
1448 pRenderVertexSoft.vWorldPosition.y = (double)pLayingItem2->vPosition.y;
Ritor1
parents:
diff changeset
1449 v47 = (double)pLayingItem2->vPosition.z;
Ritor1
parents:
diff changeset
1450 goto LABEL_101;
Ritor1
parents:
diff changeset
1451 }
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1452 pRenderVertexSoft.vWorldPosition.x = (double)source_x;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1453 v43 = (double)source_y;
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1454 pRenderVertexSoft.vWorldPosition.y = v43;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1455 v47 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1391
diff changeset
1456 goto LABEL_101;
0
Ritor1
parents:
diff changeset
1457 }
Ritor1
parents:
diff changeset
1458 }
2105
7ee21636d67a PlaySound() continue
Ritor1
parents: 2104
diff changeset
1459 }
0
Ritor1
parents:
diff changeset
1460 }
Ritor1
parents:
diff changeset
1461
Ritor1
parents:
diff changeset
1462 //----- (0040DEA5) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1425
diff changeset
1463 void AudioPlayer::MessWithChannels()
0
Ritor1
parents:
diff changeset
1464 {
Ritor1
parents:
diff changeset
1465 pAudioPlayer->StopChannels(-1, -1);
Ritor1
parents:
diff changeset
1466 }
Ritor1
parents:
diff changeset
1467
Ritor1
parents:
diff changeset
1468
Ritor1
parents:
diff changeset
1469 //----- (004AAFCF) --------------------------------------------------------
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1470 void AudioPlayer::UpdateSounds()
0
Ritor1
parents:
diff changeset
1471 {
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1472 //AudioPlayer *pAudioPlayer; // edi@1
0
Ritor1
parents:
diff changeset
1473 int v2; // ebx@1
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1474 //unsigned __int8 v3; // zf@1
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1475 //int *v4; // eax@2
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1476 //unsigned __int8 v5; // sf@4
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1477 //AudioPlayer_3DSample *v6; // esi@5
0
Ritor1
parents:
diff changeset
1478 int v7; // ebx@6
Ritor1
parents:
diff changeset
1479 int v8; // ebx@9
Ritor1
parents:
diff changeset
1480 int v9; // ebx@10
Ritor1
parents:
diff changeset
1481 int v10; // ebx@11
Ritor1
parents:
diff changeset
1482 double v11; // st7@13
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 412
diff changeset
1483 SpriteObject *v12; // eax@14
0
Ritor1
parents:
diff changeset
1484 Actor *v13; // eax@15
Ritor1
parents:
diff changeset
1485 signed int v14; // edx@15
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1486 BLVDoor *pDoor; // eax@19
0
Ritor1
parents:
diff changeset
1487 double v16; // st7@22
Ritor1
parents:
diff changeset
1488 double v17; // st6@22
Ritor1
parents:
diff changeset
1489 double v18; // st5@23
Ritor1
parents:
diff changeset
1490 double v19; // st4@24
Ritor1
parents:
diff changeset
1491 double v20; // st3@24
Ritor1
parents:
diff changeset
1492 double v21; // st6@28
Ritor1
parents:
diff changeset
1493 double v22; // st7@32
Ritor1
parents:
diff changeset
1494 int v23; // ST1C_4@32
Ritor1
parents:
diff changeset
1495 int v24; // ebx@32
Ritor1
parents:
diff changeset
1496 int v25; // eax@32
Ritor1
parents:
diff changeset
1497 float v26; // ST10_4@34
Ritor1
parents:
diff changeset
1498 float v27; // ST08_4@34
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1499 //MixerChannel *v28; // esi@38
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1500 //unsigned __int8 v29; // of@43
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1501 //MixerChannel *v30; // esi@44
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1502 //int v31; // eax@45
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 412
diff changeset
1503 //SpriteObject *v32; // eax@49
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1504 //Actor *v33; // edi@50
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1505 //int v34; // eax@50
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1506 //unsigned int v35; // edx@51
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1507 //unsigned int v36; // ecx@51
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 412
diff changeset
1508 //SpriteObject *v37; // edi@53
0
Ritor1
parents:
diff changeset
1509 int v38; // eax@53
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1510 //BLVDoor *v39; // edi@56
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1511 //int v40; // eax@57
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1512 //int v41; // eax@60
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1513 //MixerChannel *v42; // edi@65
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1514 //int v43; // ebx@68
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1515 //LevelDecoration *v44; // esi@68
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1516 //int v45; // ST1C_4@68
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1517 //int v46; // edi@68
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1518 //int v47; // eax@68
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1519 //DecorationDesc *v48; // edi@69
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1520 //__int16 v49; // ax@69
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1521 //__int16 v50; // ax@70
0
Ritor1
parents:
diff changeset
1522 __int16 v51; // ax@71
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1523 //__int16 v52; // ax@73
0
Ritor1
parents:
diff changeset
1524 signed int v53; // eax@88
Ritor1
parents:
diff changeset
1525 RenderVertexSoft a1; // [sp+24h] [bp-48h]@1
Ritor1
parents:
diff changeset
1526 float v55; // [sp+54h] [bp-18h]@22
Ritor1
parents:
diff changeset
1527 float v56; // [sp+58h] [bp-14h]@22
Ritor1
parents:
diff changeset
1528 int uNumRepeats; // [sp+5Ch] [bp-10h]@15
Ritor1
parents:
diff changeset
1529 float v58; // [sp+60h] [bp-Ch]@23
Ritor1
parents:
diff changeset
1530 int v59; // [sp+64h] [bp-8h]@4
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1531 //AudioPlayer *thisa; // [sp+68h] [bp-4h]@1
0
Ritor1
parents:
diff changeset
1532
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1533 //pAudioPlayer = this;
0
Ritor1
parents:
diff changeset
1534 v2 = 0;
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1535 //thisa = this;
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1536 //v3 = this->bPlayerReady == 0;
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1537 //a1.flt_2C = 0.0;
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1538 if (!bPlayerReady)
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1539 return;
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1540
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1541 //if (field_2D0_time_left <= pEventTimer->uTimeElapsed)
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1542 //field_2D0_time_left = 32;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1543 //else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1544 //{
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1545 //field_2D0_time_left -= pEventTimer->uTimeElapsed;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1546 //return;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1547 //}
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1548 field_2D0_time_left -= pEventTimer->uTimeElapsed;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1549 if ( field_2D0_time_left <= 0 )
0
Ritor1
parents:
diff changeset
1550 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1551 field_2D0_time_left = 32;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1552 if ( b3DSoundInitialized )//for 3D sound
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1553 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1554 __debugbreak(); // refactor refactor
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1555 v2 = 0;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1556 for ( v59 = 0; v59 < pAudioPlayer->uNum3DSamples; ++v59 )
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1557 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1558 v7 = PID_TYPE(this->p3DSamples[v59].field_4);
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1559 if ( AIL_3D_sample_status(this->p3DSamples[v59].hSample) == AIL::Sample::Done )
0
Ritor1
parents:
diff changeset
1560 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1561 AIL_end_3D_sample(this->p3DSamples[v59].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1562 pAudioPlayer->_4ABF23(&this->p3DSamples[v59]);
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1563 }
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1564 if ( AIL_3D_sample_status(this->p3DSamples[v59].hSample) != AIL::Sample::Playing )
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1565 continue;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1566 v8 = v7 - 1;//
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1567 if ( v8 )//> 1
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1568 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1569 v9 = v8 - 1;//
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1570 if ( v9 )//> 2
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1571 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1572 v10 = v9 - 1;//
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1573 if ( !v10 )//3
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1574 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1575 v13 = &pActors[PID_ID(this->p3DSamples[v59].field_4)];
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1576 //uNumRepeats = v13->vPosition.x;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1577 //v14 = v13->vPosition.y;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1578 a1.vWorldPosition.x = (double)v13->vPosition.x;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1579 //uNumRepeats = v13->vPosition.z;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1580 a1.vWorldPosition.y = (double)v13->vPosition.y;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1581 //v11 = (double)uNumRepeats;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1582 a1.vWorldPosition.z = v13->vPosition.z;
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1583 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1584 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1585 v16 = pGame->pIndoorCameraD3D->fRotationXCosine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1586 v17 = pGame->pIndoorCameraD3D->fRotationXSine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1587 v55 = pGame->pIndoorCameraD3D->fRotationYCosine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1588 v56 = pGame->pIndoorCameraD3D->fRotationYSine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1589 if (pGame->pIndoorCameraD3D->sRotationX)
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1590 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1591 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1592 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1593 v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1594 if ( pRenderer->pRenderD3D )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1595 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1596 v19 = *(float *)&uNumRepeats * v56 + v58 * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1597 v20 = v58 * v56 - *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1598 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1599 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1600 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1601 v19 = v58 * v55 - *(float *)&uNumRepeats * v56;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1602 v20 = v58 * v56 + *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1603 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1604 a1.vWorldViewPosition.x = v19 * v16 - v18 * v17;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1605 a1.vWorldViewPosition.y = v20;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1606 a1.vWorldViewPosition.z = v19 * v17 + v18 * v16;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1607 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1608 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1609 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1610 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1611 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1612 if ( pRenderer->pRenderD3D )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1613 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1614 a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1615 v21 = v58 * v56 - *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1616 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1617 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1618 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1619 a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1620 v21 = v58 * v56 + *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1621 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1622 a1.vWorldViewPosition.y = v21;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1623 a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1624 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1625 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1626 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1627 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1628 v58 = a1.vWorldViewPosition.y * -0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1629 v22 = a1.vWorldViewPosition.x * 0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1630 *(float *)&uNumRepeats = v22;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1631 v23 = abs((signed __int64)v22);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1632 v24 = abs(0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1633 v25 = abs((signed __int64)v58);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1634 if ( int_get_vector_length(v25, v24, v23) <= 100 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1635 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1636 AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1637 v26 = -*(float *)&uNumRepeats;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1638 v27 = -v58;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1639 AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1640 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1641 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1642 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1643 AIL_end_3D_sample(this->p3DSamples[v59].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1644 pAudioPlayer->_4ABF23(&this->p3DSamples[v59]);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1645 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1646 continue;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1647 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1648 if ( v10 != 2 )//4
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1649 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1650 a1.vWorldPosition.x = (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1651 a1.vWorldPosition.y = (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1652 v11 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1653 a1.vWorldPosition.z = v11;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1654 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1655 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1656 v16 = pGame->pIndoorCameraD3D->fRotationXCosine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1657 v17 = pGame->pIndoorCameraD3D->fRotationXSine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1658 v55 = pGame->pIndoorCameraD3D->fRotationYCosine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1659 v56 = pGame->pIndoorCameraD3D->fRotationYSine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1660 if (pGame->pIndoorCameraD3D->sRotationX)
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1661 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1662 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1663 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1664 v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1665 if ( pRenderer->pRenderD3D )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1666 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1667 v19 = *(float *)&uNumRepeats * v56 + v58 * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1668 v20 = v58 * v56 - *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1669 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1670 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1671 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1672 v19 = v58 * v55 - *(float *)&uNumRepeats * v56;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1673 v20 = v58 * v56 + *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1674 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1675 a1.vWorldViewPosition.x = v19 * v16 - v18 * v17;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1676 a1.vWorldViewPosition.y = v20;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1677 a1.vWorldViewPosition.z = v19 * v17 + v18 * v16;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1678 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1679 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1680 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1681 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1682 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1683 if ( pRenderer->pRenderD3D )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1684 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1685 a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1686 v21 = v58 * v56 - *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1687 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1688 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1689 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1690 a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1691 v21 = v58 * v56 + *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1692 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1693 a1.vWorldViewPosition.y = v21;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1694 a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1695 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1696 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1697 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1698 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1699 v58 = a1.vWorldViewPosition.y * -0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1700 v22 = a1.vWorldViewPosition.x * 0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1701 *(float *)&uNumRepeats = v22;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1702 v23 = abs((signed __int64)v22);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1703 v24 = abs(0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1704 v25 = abs((signed __int64)v58);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1705 if ( int_get_vector_length(v25, v24, v23) <= 100 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1706 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1707 AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1708 v26 = -*(float *)&uNumRepeats;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1709 v27 = -v58;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1710 AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1711 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1712 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1713 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1714 AIL_end_3D_sample(this->p3DSamples[v59].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1715 pAudioPlayer->_4ABF23(&this->p3DSamples[v59]);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1716 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1717 continue;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1718 }//5
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1719 v12 = (SpriteObject *)&pLevelDecorations[PID_ID(this->p3DSamples[v59].field_4)];
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1720 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1721 else//2
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1722 v12 = &pSpriteObjects[PID_ID(this->p3DSamples[v59].field_4)];
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1723 a1.vWorldPosition.x = (double)v12->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1724 a1.vWorldPosition.y = (double)v12->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1725 v11 = (double)v12->vPosition.z;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1726 //LABEL_21:
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1727 a1.vWorldPosition.z = v11;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1728 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1729 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1730 v16 = pGame->pIndoorCameraD3D->fRotationXCosine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1731 v17 = pGame->pIndoorCameraD3D->fRotationXSine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1732 v55 = pGame->pIndoorCameraD3D->fRotationYCosine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1733 v56 = pGame->pIndoorCameraD3D->fRotationYSine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1734 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
1735 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1736 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1737 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1738 v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1739 if ( pRenderer->pRenderD3D )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1740 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1741 v19 = *(float *)&uNumRepeats * v56 + v58 * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1742 v20 = v58 * v56 - *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1743 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1744 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1745 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1746 v19 = v58 * v55 - *(float *)&uNumRepeats * v56;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1747 v20 = v58 * v56 + *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1748 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1749 a1.vWorldViewPosition.x = v19 * v16 - v18 * v17;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1750 a1.vWorldViewPosition.y = v20;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1751 a1.vWorldViewPosition.z = v19 * v17 + v18 * v16;
0
Ritor1
parents:
diff changeset
1752 }
Ritor1
parents:
diff changeset
1753 else
Ritor1
parents:
diff changeset
1754 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1755 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1756 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1757 if ( pRenderer->pRenderD3D )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1758 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1759 a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1760 v21 = v58 * v56 - *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1761 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1762 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1763 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1764 a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1765 v21 = v58 * v56 + *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1766 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1767 a1.vWorldViewPosition.y = v21;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1768 a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z;
0
Ritor1
parents:
diff changeset
1769 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1770 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1771 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1772 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1773 v58 = a1.vWorldViewPosition.y * -0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1774 v22 = a1.vWorldViewPosition.x * 0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1775 *(float *)&uNumRepeats = v22;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1776 v23 = abs((signed __int64)v22);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1777 v24 = abs(0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1778 v25 = abs((signed __int64)v58);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1779 if ( int_get_vector_length(v25, v24, v23) <= 100 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1780 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1781 AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1782 v26 = -*(float *)&uNumRepeats;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1783 v27 = -v58;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1784 AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0);
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1785 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1786 else
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1787 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1788 AIL_end_3D_sample(this->p3DSamples[v59].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1789 pAudioPlayer->_4ABF23(&this->p3DSamples[v59]);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1790 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1791 continue;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1792 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1793 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )//==1
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1794 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1795 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1796 v58 = a1.vWorldViewPosition.y * -0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1797 v22 = a1.vWorldViewPosition.x * 0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1798 *(float *)&uNumRepeats = v22;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1799 v23 = abs((signed __int64)v22);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1800 v24 = abs(0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1801 v25 = abs((signed __int64)v58);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1802 if ( int_get_vector_length(v25, v24, v23) <= 100 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1803 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1804 AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1805 v26 = -*(float *)&uNumRepeats;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1806 v27 = -v58;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1807 AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1808 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1809 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1810 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1811 AIL_end_3D_sample(this->p3DSamples[v59].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1812 pAudioPlayer->_4ABF23(&this->p3DSamples[v59]);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1813 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1814 continue;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1815 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1816 pDoor = &pIndoor->pDoors[PID_ID(this->p3DSamples[v59].field_4)];
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1817 if ( pDoor->uDoorID )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1818 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1819 uNumRepeats = *pDoor->pXOffsets;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1820 a1.vWorldPosition.x = (double)uNumRepeats;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1821 uNumRepeats = *pDoor->pYOffsets;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1822 a1.vWorldPosition.y = (double)uNumRepeats;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1823 uNumRepeats = *pDoor->pZOffsets;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1824 v11 = (double)uNumRepeats;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1825 a1.vWorldPosition.z = v11;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1826 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1827 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1828 v16 = pGame->pIndoorCameraD3D->fRotationXCosine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1829 v17 = pGame->pIndoorCameraD3D->fRotationXSine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1830 v55 = pGame->pIndoorCameraD3D->fRotationYCosine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1831 v56 = pGame->pIndoorCameraD3D->fRotationYSine;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1832 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
1833 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1834 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1835 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1836 v18 = a1.vWorldPosition.z - (double)pParty->vPosition.z;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1837 if ( pRenderer->pRenderD3D )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1838 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1839 v19 = *(float *)&uNumRepeats * v56 + v58 * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1840 v20 = v58 * v56 - *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1841 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1842 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1843 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1844 v19 = v58 * v55 - *(float *)&uNumRepeats * v56;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1845 v20 = v58 * v56 + *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1846 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1847 a1.vWorldViewPosition.x = v19 * v16 - v18 * v17;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1848 a1.vWorldViewPosition.y = v20;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1849 a1.vWorldViewPosition.z = v19 * v17 + v18 * v16;
0
Ritor1
parents:
diff changeset
1850 }
Ritor1
parents:
diff changeset
1851 else
Ritor1
parents:
diff changeset
1852 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1853 v58 = a1.vWorldPosition.x - (double)pParty->vPosition.x;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1854 *(float *)&uNumRepeats = a1.vWorldPosition.y - (double)pParty->vPosition.y;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1855 if ( pRenderer->pRenderD3D )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1856 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1857 a1.vWorldViewPosition.x = *(float *)&uNumRepeats * v56 + v58 * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1858 v21 = v58 * v56 - *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1859 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1860 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1861 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1862 a1.vWorldViewPosition.x = v58 * v55 - *(float *)&uNumRepeats * v56;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1863 v21 = v58 * v56 + *(float *)&uNumRepeats * v55;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1864 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1865 a1.vWorldViewPosition.y = v21;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1866 a1.vWorldViewPosition.z = a1.vWorldPosition.z - (double)pParty->vPosition.z;
0
Ritor1
parents:
diff changeset
1867 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1868 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1869 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1870 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1871 v58 = a1.vWorldViewPosition.y * -0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1872 v22 = a1.vWorldViewPosition.x * 0.012207031;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1873 *(float *)&uNumRepeats = v22;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1874 v23 = abs((signed __int64)v22);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1875 v24 = abs(0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1876 v25 = abs((signed __int64)v58);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1877 if ( int_get_vector_length(v25, v24, v23) <= 100 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1878 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1879 AIL_set_3D_position(this->p3DSamples[v59].hSample, LODWORD(v58), 0.0, uNumRepeats);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1880 v26 = -*(float *)&uNumRepeats;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1881 v27 = -v58;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1882 AIL_set_3D_orientation(this->p3DSamples[v59].hSample, LODWORD(v27), 0.0, LODWORD(v26), 0.0, 1.0, 0.0);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1883 }
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1884 else
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1885 {
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1886 AIL_end_3D_sample(this->p3DSamples[v59].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1887 pAudioPlayer->_4ABF23(&this->p3DSamples[v59]);
0
Ritor1
parents:
diff changeset
1888 }
Ritor1
parents:
diff changeset
1889 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1890 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1891 //}
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1892 }
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1893
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
1894 //LABEL_37:
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1895 for (uint i = 0; i < uMixerChannels; ++i)
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1896 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1897 if (AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Done)
390
35a62d1948d4 More sound fixes
Nomad
parents: 388
diff changeset
1898 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1899 AIL_end_sample(pMixerChannels[i].hSample);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1900 FreeChannel(&pMixerChannels[i]);
390
35a62d1948d4 More sound fixes
Nomad
parents: 388
diff changeset
1901 }
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1902 }
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1903
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1904 for (uint i = 0; i < uMixerChannels; ++i)
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1905 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1906 if (pMixerChannels[i].source_pid <= 0)
390
35a62d1948d4 More sound fixes
Nomad
parents: 388
diff changeset
1907 continue;
35a62d1948d4 More sound fixes
Nomad
parents: 388
diff changeset
1908
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1909 int source_type = PID_TYPE(pMixerChannels[i].source_pid),
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1910 source_id = PID_ID(pMixerChannels[i].source_pid);
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1911 int source_x,
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1912 source_y,
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1913 source_z;
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1914
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1915 switch (source_type)
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1916 {
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1917 case 0:
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1918 case OBJECT_Player:
411
747933903b1c 00401A91 sub_401A91_AI(): actors drop when dead
Nomad
parents: 390
diff changeset
1919 case OBJECT_BModel:
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1920 continue;
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1921
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1922 case OBJECT_BLVDoor:
0
Ritor1
parents:
diff changeset
1923 {
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1924 assert(uCurrentlyLoadedLevelType == LEVEL_Indoor);
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1925
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1926 assert(source_id < pIndoor->uNumDoors);
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
1927 if (!pIndoor->pDoors[source_id].uDoorID)
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1928 continue;
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1929
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1930 //source_x = pIndoor->pDoors[source_id].pXOffsets[0];
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1931 //source_y = pIndoor->pDoors[source_id].pYOffsets[0];
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1932 //source_z = pIndoor->pDoors[source_id].pZOffsets[0];
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1933 int sound_strength = GetSoundStrengthByDistanceFromParty(pIndoor->pDoors[source_id].pXOffsets[0],
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1934 pIndoor->pDoors[source_id].pYOffsets[0],
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1935 pIndoor->pDoors[source_id].pZOffsets[0]);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1936 if ( sound_strength )
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1937 {
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1938 AIL_set_sample_volume(pMixerChannels[i].hSample, sound_strength);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1939 AIL_set_sample_pan(pMixerChannels[i].hSample, sub_4AB66C(pIndoor->pDoors[source_id].pXOffsets[0],
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1940 pIndoor->pDoors[source_id].pYOffsets[0]));
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1941 }
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1942 else
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1943 {
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1944 AIL_end_sample(pMixerChannels[i].hSample);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1945 FreeChannel(&pMixerChannels[i]);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1946 }
0
Ritor1
parents:
diff changeset
1947 }
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1948 continue;
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1949
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1950 case OBJECT_Item:
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1951 {
2140
4c0c475917dd drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents: 2114
diff changeset
1952 //assert(source_id < uNumSpriteObjects); // Ritor1:
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1953
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1954 //source_x = pSpriteObjects[source_id].vPosition.x;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1955 //source_y = pSpriteObjects[source_id].vPosition.y;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1956 //source_z = pSpriteObjects[source_id].vPosition.z;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1957 int sound_strength = GetSoundStrengthByDistanceFromParty(pSpriteObjects[source_id].vPosition.x,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1958 pSpriteObjects[source_id].vPosition.y,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1959 pSpriteObjects[source_id].vPosition.z);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1960 if ( sound_strength )
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1961 {
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1962 AIL_set_sample_volume(pMixerChannels[i].hSample, sound_strength);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1963 AIL_set_sample_pan(pMixerChannels[i].hSample, sub_4AB66C(pSpriteObjects[source_id].vPosition.x,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1964 pSpriteObjects[source_id].vPosition.y));
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1965 }
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1966 else
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1967 {
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1968 AIL_end_sample(pMixerChannels[i].hSample);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1969 FreeChannel(&pMixerChannels[i]);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1970 }
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1971 }
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1972 continue;
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1973
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1974 case OBJECT_Decoration:
0
Ritor1
parents:
diff changeset
1975 {
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
1976 assert(source_id < uNumLevelDecorations);
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1977
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1978 //source_x = pLevelDecorations[source_id].vPosition.x;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1979 //source_y = pLevelDecorations[source_id].vPosition.y;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1980 //source_z = pLevelDecorations[source_id].vPosition.z;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1981 int sound_strength = GetSoundStrengthByDistanceFromParty(pLevelDecorations[source_id].vPosition.x,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1982 pLevelDecorations[source_id].vPosition.y,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1983 pLevelDecorations[source_id].vPosition.z);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1984 if ( sound_strength )
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1985 {
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1986 AIL_set_sample_volume(pMixerChannels[i].hSample, sound_strength);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1987 AIL_set_sample_pan(pMixerChannels[i].hSample, sub_4AB66C(pLevelDecorations[source_id].vPosition.x,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1988 pLevelDecorations[source_id].vPosition.y));
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1989 }
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1990 else
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1991 {
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1992 AIL_end_sample(pMixerChannels[i].hSample);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1993 FreeChannel(&pMixerChannels[i]);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1994 }
0
Ritor1
parents:
diff changeset
1995 }
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
1996 continue;
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1997
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1998 case OBJECT_Actor:
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
1999 {
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2000 assert(source_id < uNumActors);
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2001
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2002 //source_x = pActors[source_id].vPosition.x;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2003 //source_y = pActors[source_id].vPosition.y;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2004 //source_z = pActors[source_id].vPosition.z;
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2005 int sound_strength = GetSoundStrengthByDistanceFromParty(pActors[source_id].vPosition.x,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2006 pActors[source_id].vPosition.y,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2007 pActors[source_id].vPosition.z);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2008 if ( sound_strength )
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2009 {
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2010 AIL_set_sample_volume(pMixerChannels[i].hSample, sound_strength);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2011 AIL_set_sample_pan(pMixerChannels[i].hSample, sub_4AB66C(pActors[source_id].vPosition.x,
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2012 pActors[source_id].vPosition.y));
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2013 }
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2014 else
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2015 {
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2016 AIL_end_sample(pMixerChannels[i].hSample);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2017 FreeChannel(&pMixerChannels[i]);
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2018 }
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2019 }
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2020 continue;
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2021
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2022 default:
408
Ritor1
parents: 405
diff changeset
2023 assert(false);
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2024 continue;
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2025 }
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2026
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2027 /*if (int sound_strength = GetSoundStrengthByDistanceFromParty(source_x, source_y, source_z))
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2028 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2029 AIL_set_sample_volume(pMixerChannels[i].hSample, sound_strength);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2030 AIL_set_sample_pan(pMixerChannels[i].hSample, sub_4AB66C(source_x, source_y));
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2031 }
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2032 else
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2033 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2034 AIL_end_sample(pMixerChannels[i].hSample);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2035 FreeChannel(&pMixerChannels[i]);
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2036 } */
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2037 }
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2038
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2039 if (pCurrentScreen != SCREEN_GAME) //
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2040 {
2112
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2041 if (AIL_sample_status(pMixerChannels[4].hSample) == AIL::Sample::Playing)
9d79b07dc237 PlaySound() source_x
Ritor1
parents: 2110
diff changeset
2042 AIL_end_sample(pMixerChannels[4].hSample);
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2043 return;
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2044 }
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2045 if (!_6807E0_num_decorations_with_sounds_6807B8)
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2046 return;
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2047
378
50875632e776 AudioPlayer::UpdateSounds (004AAFCF) take 1
Nomad
parents: 328
diff changeset
2048 v55 = 0;
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2049 //v59 = 0;
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2050 for (uint i = 0; i < _6807E0_num_decorations_with_sounds_6807B8; ++i)
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2051 {
0
Ritor1
parents:
diff changeset
2052 LODWORD(v56) = 1;
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2053 //v43 = _6807B8_level_decorations_ids[v59];
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2054 //v44 = &pLevelDecorations[_6807B8_level_decorations_ids[v59]];
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2055 //v45 = abs(v44->vPosition.z - pParty->vPosition.z);
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2056 //v46 = abs(v44->vPosition.y - pParty->vPosition.y);
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2057 //v47 = abs(v44->vPosition.x - pParty->vPosition.x);
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
2058 LevelDecoration* decor = &pLevelDecorations[_6807B8_level_decorations_ids[i]];
2009
3fb1101e5805 fixing sprite sounds not playing
Grumpy7
parents: 2006
diff changeset
2059 if (int_get_vector_length(abs(decor->vPosition.x - pParty->vPosition.x),
3fb1101e5805 fixing sprite sounds not playing
Grumpy7
parents: 2006
diff changeset
2060 abs(decor->vPosition.y - pParty->vPosition.y),
3fb1101e5805 fixing sprite sounds not playing
Grumpy7
parents: 2006
diff changeset
2061 abs(decor->vPosition.z - pParty->vPosition.z)) > 8192)
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2062 continue;
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2063
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1828
diff changeset
2064 DecorationDesc* decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID];
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2065 //v48 = &pDecorationList->pDecorations[decor->uDecorationDescID];
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2066 //v49 = v48->uFlags;
1479
59d1da1863df Rename DECORATION_FLAGS to DECORATION_DESC_FLAGS.
yoctozepto
parents: 1477
diff changeset
2067 uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & DECORATION_DESC_SLOW_LOOP) >> 6;
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2068
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2069 if (decor_desc->SoundOnDawn() || decor_desc->SoundOnDusk())
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2070 {
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2071 //v50 = decor->field_1A;
0
Ritor1
parents:
diff changeset
2072 v55 = 0.0;
Ritor1
parents:
diff changeset
2073 uNumRepeats = 2;
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2074 if (decor->field_1A)
0
Ritor1
parents:
diff changeset
2075 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2076 //v51 = decor->field_1A - 32;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2077 decor->field_1A = decor->field_1A - 32;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2078 if ( decor->field_1A < 0 )
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2079 decor->field_1A = 0;
0
Ritor1
parents:
diff changeset
2080 }
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2081 }
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2082
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2083 //v52 = v48->uFlags;
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2084 if (!decor_desc->SoundOnDawn())
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2085 {
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2086 if (!decor_desc->SoundOnDusk())
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2087 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2088 if ( v55 == 0.0 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2089 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2090 if ( v56 != 0.0 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2091 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2092 v53 = 8 * _6807B8_level_decorations_ids[i];
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2093 LOBYTE(v53) = v53 | OBJECT_Decoration;
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2094 PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0);// ,
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2095 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2096 continue;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2097 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2098 if ( !decor->field_1A )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2099 decor->field_1A = (rand() % 15 + 1) << 7;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2100 if ( v56 != 0.0 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2101 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2102 v53 = 8 * _6807B8_level_decorations_ids[i];
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2103 LOBYTE(v53) = v53 | OBJECT_Decoration;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2104 PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2105 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2106 continue;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2107 }
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2108 if ( v55 != 0.0 )
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2109 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2110 if ( !decor->field_1A )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2111 decor->field_1A = (rand() % 15 + 1) << 7;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2112 if ( v56 != 0.0 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2113 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2114 v53 = 8 * _6807B8_level_decorations_ids[i];
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2115 LOBYTE(v53) = v53 | OBJECT_Decoration;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2116 PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2117 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2118 continue;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2119 }
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2120 }
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2121 v56 = 0.0;
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2122
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2123 if (pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 6 ||
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2124 pParty->uCurrentHour >= 20 && pParty->uCurrentHour < 21)
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2125 {
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2126 if ( !decor->field_1A && rand() % 100 < 100 )
0
Ritor1
parents:
diff changeset
2127 LODWORD(v56) = 1;
Ritor1
parents:
diff changeset
2128 LODWORD(v55) = 1;
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2129 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2130 if ( v55 == 0.0 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2131 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2132 if ( v56 != 0.0 )
0
Ritor1
parents:
diff changeset
2133 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2134 v53 = 8 * _6807B8_level_decorations_ids[i];
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2135 LOBYTE(v53) = v53 | OBJECT_Decoration;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2136 PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
2137 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2138 continue;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2139 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2140 if ( !decor->field_1A )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2141 decor->field_1A = (rand() % 15 + 1) << 7;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2142 if ( v56 != 0.0 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2143 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2144 v53 = 8 * _6807B8_level_decorations_ids[i];
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2145 LOBYTE(v53) = v53 | OBJECT_Decoration;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2146 PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2147 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2148 continue;
379
5bea494a2365 AudioPlayer::UpdateSounds (004AAFCF) take 2
Nomad
parents: 378
diff changeset
2149 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2150 }
0
Ritor1
parents:
diff changeset
2151 }
Ritor1
parents:
diff changeset
2152
Ritor1
parents:
diff changeset
2153 //----- (004AB66C) --------------------------------------------------------
Ritor1
parents:
diff changeset
2154 int __fastcall sub_4AB66C(int a1, int a2)
Ritor1
parents:
diff changeset
2155 {
Ritor1
parents:
diff changeset
2156 signed int v2; // eax@1
Ritor1
parents:
diff changeset
2157
Ritor1
parents:
diff changeset
2158 v2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->Atan2(a1 - pParty->vPosition.x, a2 - pParty->vPosition.y)
147
c70fea5013aa 12.02.13
Ritor1
parents: 82
diff changeset
2159 - stru_5C6E00->uIntegerHalfPi - pParty->sRotationY);
0
Ritor1
parents:
diff changeset
2160 if ( v2 > (signed int)stru_5C6E00->uIntegerPi )
Ritor1
parents:
diff changeset
2161 v2 = 2 * stru_5C6E00->uIntegerPi - v2;
Ritor1
parents:
diff changeset
2162 return (v2 >> 3) - (v2 >> 10);
Ritor1
parents:
diff changeset
2163 }
Ritor1
parents:
diff changeset
2164 // 4AB66C: using guessed type int __fastcall sub_4AB66C(int, int);
Ritor1
parents:
diff changeset
2165
Ritor1
parents:
diff changeset
2166 //----- (004AB6B1) --------------------------------------------------------
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2167 int GetSoundStrengthByDistanceFromParty(int x, int y, int z)
0
Ritor1
parents:
diff changeset
2168 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2169 int dir_x; // ST08_4@1
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2170 int dir_y; // esi@1
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2171 int dir_z; // eax@1
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2172 int length; // [sp+10h] [bp+8h]@1
0
Ritor1
parents:
diff changeset
2173
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2174 dir_z = abs(z - pParty->vPosition.z);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2175 dir_y = abs(y - pParty->vPosition.y);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2176 dir_x = abs(x - pParty->vPosition.x);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2177 length = int_get_vector_length(dir_x, dir_y, dir_z);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2178 if ( length <= 8192 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2179 return 114 - (unsigned __int64)(signed __int64)((double)length * 0.0001220703125 * 100.0);
0
Ritor1
parents:
diff changeset
2180 else
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 225
diff changeset
2181 return 0;
0
Ritor1
parents:
diff changeset
2182 }
Ritor1
parents:
diff changeset
2183
Ritor1
parents:
diff changeset
2184 //----- (004AB71F) --------------------------------------------------------
Ritor1
parents:
diff changeset
2185 void AudioPlayer::StopChannels(int uStartChannel, int uEndChannel)
Ritor1
parents:
diff changeset
2186 {
Ritor1
parents:
diff changeset
2187 if ( bPlayerReady )
Ritor1
parents:
diff changeset
2188 {
Ritor1
parents:
diff changeset
2189 if ( b3DSoundInitialized )
Ritor1
parents:
diff changeset
2190 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2191 for ( uint i = 0; i < uNum3DSamples; ++i )
0
Ritor1
parents:
diff changeset
2192 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2193 if ( (uStartChannel == -1 || i < uStartChannel || i > uEndChannel)
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2194 && p3DSamples[i].field_8 && pSoundList->pSL_Sounds[p3DSamples[i].field_8].eType != SOUND_DESC_SYSTEM)
0
Ritor1
parents:
diff changeset
2195 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2196 AIL_end_3D_sample(p3DSamples[i].hSample);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2197 _4ABF23(&p3DSamples[i]);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2198 p3DSamples[i].field_4 = 0;
0
Ritor1
parents:
diff changeset
2199 }
Ritor1
parents:
diff changeset
2200 }
Ritor1
parents:
diff changeset
2201 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2202 if ( hDigDriver )
0
Ritor1
parents:
diff changeset
2203 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2204 for ( int i = 0; i < uMixerChannels; ++i )
0
Ritor1
parents:
diff changeset
2205 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2206 if ( (uStartChannel == -1 || i < uStartChannel || i > uEndChannel)
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2207 && pSoundList->pSL_Sounds[pMixerChannels[i].uSourceTrackIdx].eType != SOUND_DESC_SYSTEM)//, ,
0
Ritor1
parents:
diff changeset
2208 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2209 AIL_end_sample(pMixerChannels[i].hSample);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2210 FreeChannel(&pMixerChannels[i]);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2211 pMixerChannels[i].source_pid = 0;
0
Ritor1
parents:
diff changeset
2212 }
Ritor1
parents:
diff changeset
2213 }
Ritor1
parents:
diff changeset
2214 }
Ritor1
parents:
diff changeset
2215 if (hSequence)
Ritor1
parents:
diff changeset
2216 AIL_end_sequence(hSequence);
Ritor1
parents:
diff changeset
2217 if (hStream)
Ritor1
parents:
diff changeset
2218 AIL_pause_stream(hStream, 1);
Ritor1
parents:
diff changeset
2219 }
Ritor1
parents:
diff changeset
2220 }
Ritor1
parents:
diff changeset
2221
Ritor1
parents:
diff changeset
2222 //----- (004AB818) --------------------------------------------------------
Ritor1
parents:
diff changeset
2223 void AudioPlayer::LoadAudioSnd()
Ritor1
parents:
diff changeset
2224 {
Ritor1
parents:
diff changeset
2225 DWORD NumberOfBytesRead; // [sp+Ch] [bp-4h]@3
Ritor1
parents:
diff changeset
2226
Ritor1
parents:
diff changeset
2227 hAudioSnd = CreateFileA("Sounds\\Audio.snd", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
Ritor1
parents:
diff changeset
2228 if (hAudioSnd == INVALID_HANDLE_VALUE)
Ritor1
parents:
diff changeset
2229 {
Ritor1
parents:
diff changeset
2230 Log::Warning(L"Can't open file: %s", L"Sounds\\Audio.snd");
Ritor1
parents:
diff changeset
2231 return;
Ritor1
parents:
diff changeset
2232 }
Ritor1
parents:
diff changeset
2233
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
2234 ReadFile(hAudioSnd, &uNumSoundHeaders, 4, &NumberOfBytesRead, 0);
0
Ritor1
parents:
diff changeset
2235 pSoundHeaders = nullptr;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
2236 pSoundHeaders = (SoundHeader *)malloc(52 * uNumSoundHeaders + 2);
0
Ritor1
parents:
diff changeset
2237 ReadFile(hAudioSnd, pSoundHeaders, 52 * uNumSoundHeaders, &NumberOfBytesRead, 0);
Ritor1
parents:
diff changeset
2238 }
Ritor1
parents:
diff changeset
2239
Ritor1
parents:
diff changeset
2240 //----- (004AB8CE) --------------------------------------------------------
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2241 void AudioPlayer::Initialize()
0
Ritor1
parents:
diff changeset
2242 {
Ritor1
parents:
diff changeset
2243 //AudioPlayer *v2; // esi@1
Ritor1
parents:
diff changeset
2244 int v3; // ebx@1
Ritor1
parents:
diff changeset
2245 //_DIG_DRIVER *v4; // eax@1
Ritor1
parents:
diff changeset
2246 _PROVIDER *v6; // eax@9
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2247 //HWND v7; // ST00_4@9
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2248 //MixerChannel *pChannel; // edi@14
0
Ritor1
parents:
diff changeset
2249 _SAMPLE *v9; // eax@15
Ritor1
parents:
diff changeset
2250 //_REDBOOK *v10; // eax@19
Ritor1
parents:
diff changeset
2251 //int v11; // ecx@21
Ritor1
parents:
diff changeset
2252 int v12; // [sp+Ch] [bp-Ch]@9
Ritor1
parents:
diff changeset
2253 char *Str1; // [sp+10h] [bp-8h]@6
Ritor1
parents:
diff changeset
2254 int v14; // [sp+14h] [bp-4h]@5
Ritor1
parents:
diff changeset
2255
Ritor1
parents:
diff changeset
2256 //v2 = this;
Ritor1
parents:
diff changeset
2257 v3 = 0;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2258 //this->hWindow = hWnd;
0
Ritor1
parents:
diff changeset
2259 this->hAILRedbook = 0;
Ritor1
parents:
diff changeset
2260 this->hDigDriver = 0;
Ritor1
parents:
diff changeset
2261 this->dword_0002AC = 0;
Ritor1
parents:
diff changeset
2262 this->hSequence = 0;
Ritor1
parents:
diff changeset
2263 this->uMasterVolume = 127;
Ritor1
parents:
diff changeset
2264 this->dword_0002C8 = 64;
Ritor1
parents:
diff changeset
2265 this->dword_0002CC = 2;
Ritor1
parents:
diff changeset
2266
Ritor1
parents:
diff changeset
2267 MSS32_DLL_Initialize();
Ritor1
parents:
diff changeset
2268 BINKW32_DLL_Initialize();
Ritor1
parents:
diff changeset
2269 SMACKW32_DLL_Initialize();
Ritor1
parents:
diff changeset
2270
Ritor1
parents:
diff changeset
2271 AIL_startup();
Ritor1
parents:
diff changeset
2272 if (bCanLoadFromCD)
Ritor1
parents:
diff changeset
2273 hAILRedbook = AIL_redbook_open_drive(cMM7GameCDDriveLetter/*cGameCDDriveLetter*/);
Ritor1
parents:
diff changeset
2274 //else
Ritor1
parents:
diff changeset
2275 // hAILRedbook = AIL_redbook_open(0);
Ritor1
parents:
diff changeset
2276 //v4 = Audio_GetFirstHardwareDigitalDriver();
Ritor1
parents:
diff changeset
2277
Ritor1
parents:
diff changeset
2278 hDigDriver = Audio_GetFirstHardwareDigitalDriver();
Ritor1
parents:
diff changeset
2279 if ( hDigDriver )
Ritor1
parents:
diff changeset
2280 SmackSoundUseMSS(hDigDriver);
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2281 if ( ReadWindowsRegistryInt("Disable3DSound", 0) != 1 && true)//pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT )
0
Ritor1
parents:
diff changeset
2282 {
Ritor1
parents:
diff changeset
2283 v14 = 0;
Ritor1
parents:
diff changeset
2284 bEAXSupported = 0;
Ritor1
parents:
diff changeset
2285 b3DSoundInitialized = 0;
Ritor1
parents:
diff changeset
2286 ReadWindowsRegistryString("3DSoundProvider", p3DSoundProvider, 128u, "NONE");
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2287 CheckA3DSupport(true);
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2288 HPROVIDER prov;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2289 while ( AIL_enumerate_3D_providers(&v14, &prov, &Str1) )
0
Ritor1
parents:
diff changeset
2290 {
Ritor1
parents:
diff changeset
2291 if ( !strcmp(Str1, p3DSoundProvider) )
Ritor1
parents:
diff changeset
2292 {
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2293 if ( AIL_open_3D_provider(prov) )
0
Ritor1
parents:
diff changeset
2294 {
Ritor1
parents:
diff changeset
2295 bEAXSupported = 0;
Ritor1
parents:
diff changeset
2296 b3DSoundInitialized = 0;
Ritor1
parents:
diff changeset
2297 h3DSoundProvider = 0;
Ritor1
parents:
diff changeset
2298 }
Ritor1
parents:
diff changeset
2299 else
Ritor1
parents:
diff changeset
2300 {
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2301 v6 = prov;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2302 //v7 = prov;
0
Ritor1
parents:
diff changeset
2303 b3DSoundInitialized = 1;
Ritor1
parents:
diff changeset
2304 h3DSoundProvider = v6;
Ritor1
parents:
diff changeset
2305 uNum3DSamples = 4;
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1642
diff changeset
2306 AIL_3D_provider_attribute(prov, "EAX environment selection", &v12);
0
Ritor1
parents:
diff changeset
2307 if ( v12 != -1 )
Ritor1
parents:
diff changeset
2308 bEAXSupported = 1;
Ritor1
parents:
diff changeset
2309 }
Ritor1
parents:
diff changeset
2310 pAudioPlayer->_4AC0A2();
Ritor1
parents:
diff changeset
2311 break;
Ritor1
parents:
diff changeset
2312 }
Ritor1
parents:
diff changeset
2313 }
Ritor1
parents:
diff changeset
2314 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2315 for ( v3; v3 < uMixerChannels; ++v3 )
0
Ritor1
parents:
diff changeset
2316 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2317 pMixerChannels[v3].hSample = AIL_allocate_sample_handle(hDigDriver);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2318 if ( !pMixerChannels[v3].hSample )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2319 break;
0
Ritor1
parents:
diff changeset
2320 }
Ritor1
parents:
diff changeset
2321 uMixerChannels = v3;
Ritor1
parents:
diff changeset
2322 if ( bPlayerReady )
Ritor1
parents:
diff changeset
2323 StopChannels(-1, -1);
Ritor1
parents:
diff changeset
2324 //v10 = hAILRedbook;
Ritor1
parents:
diff changeset
2325 bPlayerReady = true;
Ritor1
parents:
diff changeset
2326 if ( hAILRedbook )
Ritor1
parents:
diff changeset
2327 {
Ritor1
parents:
diff changeset
2328 AIL_redbook_stop(hAILRedbook);
Ritor1
parents:
diff changeset
2329 uNumRedbookTracks = AIL_redbook_tracks(hAILRedbook);
Ritor1
parents:
diff changeset
2330 }
Ritor1
parents:
diff changeset
2331 pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook);
328
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
2332 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
0
Ritor1
parents:
diff changeset
2333 if ( bPlayerReady && hAILRedbook )
328
8e23edf57e27 little fix
Ritor1
parents: 322
diff changeset
2334 AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32);
0
Ritor1
parents:
diff changeset
2335 LoadAudioSnd();
Ritor1
parents:
diff changeset
2336 }
Ritor1
parents:
diff changeset
2337
Ritor1
parents:
diff changeset
2338 //----- (004ABAF7) --------------------------------------------------------
Ritor1
parents:
diff changeset
2339 _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void)
Ritor1
parents:
diff changeset
2340 {
Ritor1
parents:
diff changeset
2341 int v0; // ecx@1
Ritor1
parents:
diff changeset
2342 unsigned int v1; // ebp@2
Ritor1
parents:
diff changeset
2343 size_t v2; // eax@4
Ritor1
parents:
diff changeset
2344 signed int v3; // kr14_4@9
Ritor1
parents:
diff changeset
2345 char *v5; // [sp+10h] [bp-Ch]@2
Ritor1
parents:
diff changeset
2346 unsigned int v6; // [sp+14h] [bp-8h]@1
Ritor1
parents:
diff changeset
2347 _DIG_DRIVER *hDrv; // [sp+18h] [bp-4h]@3
Ritor1
parents:
diff changeset
2348
Ritor1
parents:
diff changeset
2349 static int dword_4F00DC = 22050;
Ritor1
parents:
diff changeset
2350 static int dword_4F00E0 = 16;
Ritor1
parents:
diff changeset
2351 static int dword_4F00E4 = 2;
Ritor1
parents:
diff changeset
2352
Ritor1
parents:
diff changeset
2353 AIL_set_preference(15, 0);
Ritor1
parents:
diff changeset
2354 AIL_set_preference(33, 1);
Ritor1
parents:
diff changeset
2355 v0 = dword_4F00DC;
Ritor1
parents:
diff changeset
2356 pAudioPlayer->pDeviceNames[0][0] = 0;
Ritor1
parents:
diff changeset
2357 pAudioPlayer->uNumDevices = 0;
Ritor1
parents:
diff changeset
2358 v6 = 0;
Ritor1
parents:
diff changeset
2359
Ritor1
parents:
diff changeset
2360 if ( dword_4F00DC < 11025 )
Ritor1
parents:
diff changeset
2361 return 0;
Ritor1
parents:
diff changeset
2362 v1 = 0;
Ritor1
parents:
diff changeset
2363 v5 = (char *)pAudioPlayer->array_000BF0;
Ritor1
parents:
diff changeset
2364 while ( 1 )
Ritor1
parents:
diff changeset
2365 {
Ritor1
parents:
diff changeset
2366 while ( 1 )
Ritor1
parents:
diff changeset
2367 {
Ritor1
parents:
diff changeset
2368 pcmWaveFormat.wf.wFormatTag = 1;
Ritor1
parents:
diff changeset
2369 pcmWaveFormat.wf.nChannels = dword_4F00E4;
Ritor1
parents:
diff changeset
2370 pcmWaveFormat.wf.nSamplesPerSec = v0;
Ritor1
parents:
diff changeset
2371 pcmWaveFormat.wf.nBlockAlign = dword_4F00E4 * dword_4F00E0 / 8;
Ritor1
parents:
diff changeset
2372 pcmWaveFormat.wBitsPerSample = dword_4F00E0;
Ritor1
parents:
diff changeset
2373 pcmWaveFormat.wf.nAvgBytesPerSec = v0 * dword_4F00E4 * dword_4F00E0 / 8;
Ritor1
parents:
diff changeset
2374 if ( !AIL_waveOutOpen(&hDrv, 0, -1, &pcmWaveFormat.wf) )
Ritor1
parents:
diff changeset
2375 break;
Ritor1
parents:
diff changeset
2376 if ( !AIL_get_preference(15) )
Ritor1
parents:
diff changeset
2377 goto LABEL_8;
Ritor1
parents:
diff changeset
2378 v3 = dword_4F00DC;
Ritor1
parents:
diff changeset
2379 v0 = dword_4F00DC / 2;
Ritor1
parents:
diff changeset
2380 dword_4F00DC /= 2;
Ritor1
parents:
diff changeset
2381 if ( v3 / 2 < 11025 )
Ritor1
parents:
diff changeset
2382 {
Ritor1
parents:
diff changeset
2383 if ( dword_4F00E0 == 8 )
Ritor1
parents:
diff changeset
2384 {
Ritor1
parents:
diff changeset
2385 v0 = 22050;
Ritor1
parents:
diff changeset
2386 dword_4F00E0 = 8;
Ritor1
parents:
diff changeset
2387 dword_4F00DC = 22050;
Ritor1
parents:
diff changeset
2388 }
Ritor1
parents:
diff changeset
2389 goto LABEL_12;
Ritor1
parents:
diff changeset
2390 }
Ritor1
parents:
diff changeset
2391 }
Ritor1
parents:
diff changeset
2392 strcpy(pAudioPlayer->pDeviceNames[v1 / 8], "Device: ");
Ritor1
parents:
diff changeset
2393 v2 = strlen(pAudioPlayer->pDeviceNames[v1 / 8]);
Ritor1
parents:
diff changeset
2394 AIL_digital_configuration(hDrv, (int *)v5, (int *)(v5 + 64), (char *)pAudioPlayer->pDeviceNames + v2 + v1 * 16);
Ritor1
parents:
diff changeset
2395 ++v6;
Ritor1
parents:
diff changeset
2396 v1 += 8;
Ritor1
parents:
diff changeset
2397 v5 += 4;
Ritor1
parents:
diff changeset
2398 pAudioPlayer->uNumDevices = v6;
Ritor1
parents:
diff changeset
2399 if ( AIL_get_preference(15) )
Ritor1
parents:
diff changeset
2400 return hDrv;
Ritor1
parents:
diff changeset
2401 if ( !strstr(pAudioPlayer->pDeviceNames[v1 / 8 - 1], "Emulated") )
Ritor1
parents:
diff changeset
2402 return hDrv;
Ritor1
parents:
diff changeset
2403 AIL_waveOutClose(hDrv);
Ritor1
parents:
diff changeset
2404 AIL_set_preference(15, 1);
Ritor1
parents:
diff changeset
2405 LABEL_8:
Ritor1
parents:
diff changeset
2406 AIL_set_preference(15, 1);
Ritor1
parents:
diff changeset
2407 v0 = dword_4F00DC;
Ritor1
parents:
diff changeset
2408 LABEL_12:
Ritor1
parents:
diff changeset
2409 if ( v0 < 11025 )
Ritor1
parents:
diff changeset
2410 return 0;
Ritor1
parents:
diff changeset
2411 }
Ritor1
parents:
diff changeset
2412 }
Ritor1
parents:
diff changeset
2413
Ritor1
parents:
diff changeset
2414 //----- (004ABC9B) --------------------------------------------------------
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2415 void AudioPlayer::CheckA3DSupport(bool query)
0
Ritor1
parents:
diff changeset
2416 {
Ritor1
parents:
diff changeset
2417 DWORD cbData; // [sp+8h] [bp-Ch]@1
Ritor1
parents:
diff changeset
2418 HKEY hKey; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
2419 hKey = 0;
Ritor1
parents:
diff changeset
2420 cbData = 4;
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2421 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Aureal\\A3D", 0, 0x2001Fu, &hKey))
0
Ritor1
parents:
diff changeset
2422 {
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2423 int Aureal3D_SplashAudio = 0;
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2424 if (query)
0
Ritor1
parents:
diff changeset
2425 RegQueryValueExA(hKey, "SplashAudio", 0, 0, (LPBYTE)&Aureal3D_SplashAudio, &cbData);
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2426 RegSetValueExA(hKey, "SplashAudio", 0, 4, (const BYTE *)&Aureal3D_SplashAudio, 4);
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2427
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2428 int Aureal3D_SplashScreen = 0;
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2429 if (query)
0
Ritor1
parents:
diff changeset
2430 RegQueryValueExA(hKey, "SplashScreen", 0, 0, (LPBYTE)&Aureal3D_SplashScreen, &cbData);
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2431 RegSetValueExA(hKey, "SplashScreen", 0, 4, (const BYTE *)&Aureal3D_SplashScreen, 4);
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2432 RegCloseKey(hKey);
0
Ritor1
parents:
diff changeset
2433 }
Ritor1
parents:
diff changeset
2434 }
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2435
0
Ritor1
parents:
diff changeset
2436
Ritor1
parents:
diff changeset
2437 //----- (004ABD5B) --------------------------------------------------------
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2438 void AudioPlayer::Release() //
0
Ritor1
parents:
diff changeset
2439 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2440 MixerChannel *pMixerChannel; // ebx@3
0
Ritor1
parents:
diff changeset
2441 char v4; // dl@5
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2442 AudioPlayer_3DSample *p3DSample; // edi@7
0
Ritor1
parents:
diff changeset
2443 void *v9; // ecx@15
Ritor1
parents:
diff changeset
2444
Ritor1
parents:
diff changeset
2445 if ( this->bPlayerReady )
Ritor1
parents:
diff changeset
2446 {
Ritor1
parents:
diff changeset
2447 CloseHandle(pVideoPlayer->hMagicVid);
Ritor1
parents:
diff changeset
2448 CloseHandle(pVideoPlayer->hMightVid);
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2449 pAudioPlayer->StopChannels(-1, -1);
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2450 if ( pAudioPlayer->uMixerChannels > 0 )
0
Ritor1
parents:
diff changeset
2451 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2452 pMixerChannel = pAudioPlayer->pMixerChannels;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2453 for ( uint i = 0; i < pAudioPlayer->uMixerChannels; ++i )
0
Ritor1
parents:
diff changeset
2454 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2455 AIL_release_sample_handle(pMixerChannel->hSample);
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2456 ++pMixerChannel;
0
Ritor1
parents:
diff changeset
2457 }
Ritor1
parents:
diff changeset
2458 }
Ritor1
parents:
diff changeset
2459 if ( ReadWindowsRegistryInt("Disable3DSound", 0) != 1 )
Ritor1
parents:
diff changeset
2460 {
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2140
diff changeset
2461 CheckA3DSupport(false);
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2462 if ( pAudioPlayer->uNum3DSamples > 0 )
0
Ritor1
parents:
diff changeset
2463 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2464 p3DSample = pAudioPlayer->p3DSamples;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2465 for ( uint i = 0; i < pAudioPlayer->uNum3DSamples; ++i )
0
Ritor1
parents:
diff changeset
2466 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2467 if ( p3DSample->hSample )
0
Ritor1
parents:
diff changeset
2468 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2469 AIL_release_3D_sample_handle(p3DSample->hSample);
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2470 p3DSample->hSample = 0;
0
Ritor1
parents:
diff changeset
2471 }
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2472 ++p3DSample;
0
Ritor1
parents:
diff changeset
2473 }
Ritor1
parents:
diff changeset
2474 }
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2475 if ( pAudioPlayer->h3DSoundProvider )
0
Ritor1
parents:
diff changeset
2476 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2477 AIL_close_3D_provider(pAudioPlayer->h3DSoundProvider);
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2478 pAudioPlayer->h3DSoundProvider = 0;
0
Ritor1
parents:
diff changeset
2479 }
Ritor1
parents:
diff changeset
2480 }
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2481 if ( pAudioPlayer->hAILRedbook )
0
Ritor1
parents:
diff changeset
2482 {
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2483 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2484 AIL_redbook_set_volume((HREDBOOK)&pAudioPlayer->hAILRedbook, pAudioPlayer->sRedbookVolume);
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2485 AIL_redbook_close(pAudioPlayer->hAILRedbook);
0
Ritor1
parents:
diff changeset
2486 }
Ritor1
parents:
diff changeset
2487 AIL_shutdown();
Ritor1
parents:
diff changeset
2488 pSoundList->Release();
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2489 v9 = *(void **)&pAudioPlayer->field_C78[0];
0
Ritor1
parents:
diff changeset
2490 if ( v9 )
Ritor1
parents:
diff changeset
2491 ReleaseSoundData(v9);
4
8e33efd39355 15.01.13(work)
Ritor1
parents: 0
diff changeset
2492 CloseHandle(pAudioPlayer->hAudioSnd);
0
Ritor1
parents:
diff changeset
2493 }
Ritor1
parents:
diff changeset
2494 }
Ritor1
parents:
diff changeset
2495
Ritor1
parents:
diff changeset
2496 //----- (004ABE55) --------------------------------------------------------
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2497 void AudioPlayer::FreeChannel(MixerChannel *pChannel)
0
Ritor1
parents:
diff changeset
2498 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2499 //int v2; // ebx@1
0
Ritor1
parents:
diff changeset
2500 //AudioPlayer *v3; // esi@1
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2501 //SoundDesc *v4; // eax@2
0
Ritor1
parents:
diff changeset
2502 unsigned __int8 v5; // zf@5
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2503 //unsigned __int8 v6; // sf@5
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2504 //char *v7; // edi@6
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2505 int num_same_sound_on_channels; // eax@8
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2506 //int v9; // ST04_4@8
0
Ritor1
parents:
diff changeset
2507 int v10; // ecx@12
Ritor1
parents:
diff changeset
2508 int v11; // edi@13
Ritor1
parents:
diff changeset
2509 int v12; // eax@13
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2510 //unsigned __int8 v13; // of@13
0
Ritor1
parents:
diff changeset
2511 int v14[16]; // [sp+Ch] [bp-48h]@8
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2512 int num_playing_channels; // [sp+4Ch] [bp-8h]@5
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2513 //int v16; // [sp+50h] [bp-4h]@5
0
Ritor1
parents:
diff changeset
2514
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2515 if (!pSoundList->pSL_Sounds)
390
35a62d1948d4 More sound fixes
Nomad
parents: 388
diff changeset
2516 return;
35a62d1948d4 More sound fixes
Nomad
parents: 388
diff changeset
2517
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2518 //v4 = &pSoundList->pSounds[pChannel->uSourceTrackIdx];
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2519 if ( pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].eType == SOUND_DESC_SWAP)
0
Ritor1
parents:
diff changeset
2520 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2521 if ( pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].pSoundData[0] &&
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2522 !(pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].uFlags & SOUND_DESC_SYSTEM) )
0
Ritor1
parents:
diff changeset
2523 {
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2524 num_playing_channels = 0;
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2525 num_same_sound_on_channels = 0;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2526 if ( this->uMixerChannels <= 0 )
0
Ritor1
parents:
diff changeset
2527 goto LABEL_16;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2528 for ( uint i = 0; i < uMixerChannels; i++ )
0
Ritor1
parents:
diff changeset
2529 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2530 if ( pChannel->uSourceTrackID == pMixerChannels[i].uSourceTrackID )
0
Ritor1
parents:
diff changeset
2531 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2532 v14[num_same_sound_on_channels++] = i;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2533 if ( AIL_sample_status((HSAMPLE)pMixerChannels[i].hSample) == AIL::Sample::Playing)
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2534 ++num_playing_channels;
0
Ritor1
parents:
diff changeset
2535 }
Ritor1
parents:
diff changeset
2536 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2537 if ( !num_playing_channels )
0
Ritor1
parents:
diff changeset
2538 {
Ritor1
parents:
diff changeset
2539 LABEL_16:
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2540 pSoundList->UnloadSound(pChannel->uSourceTrackIdx, 1);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2541 for ( v10 = 0; v10 < num_same_sound_on_channels; v10++ )
0
Ritor1
parents:
diff changeset
2542 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2543 v12 = 16 * (v14[v10] + 47);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2544 pMixerChannels[v14[v10]].uSourceTrackID = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2044
diff changeset
2545 *(unsigned int *)((char *)&bEAXSupported + v12) = 0;
0
Ritor1
parents:
diff changeset
2546 }
Ritor1
parents:
diff changeset
2547 }
Ritor1
parents:
diff changeset
2548 }
Ritor1
parents:
diff changeset
2549 }
Ritor1
parents:
diff changeset
2550 }
Ritor1
parents:
diff changeset
2551
Ritor1
parents:
diff changeset
2552 //----- (004ABF23) --------------------------------------------------------
Ritor1
parents:
diff changeset
2553 void AudioPlayer::_4ABF23(AudioPlayer_3DSample *a2)
Ritor1
parents:
diff changeset
2554 {
Ritor1
parents:
diff changeset
2555 int v2; // ebx@1
Ritor1
parents:
diff changeset
2556 //AudioPlayer *v3; // esi@1
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2557 //SoundDesc *v4; // eax@2
0
Ritor1
parents:
diff changeset
2558 unsigned __int8 v5; // zf@5
Ritor1
parents:
diff changeset
2559 unsigned __int8 v6; // sf@5
Ritor1
parents:
diff changeset
2560 char *v7; // edi@6
Ritor1
parents:
diff changeset
2561 int v8; // eax@8
Ritor1
parents:
diff changeset
2562 int v9; // ST04_4@8
Ritor1
parents:
diff changeset
2563 int v10; // ecx@12
Ritor1
parents:
diff changeset
2564 int v11; // eax@13
Ritor1
parents:
diff changeset
2565 unsigned __int8 v12; // of@13
Ritor1
parents:
diff changeset
2566 int v13[16]; // [sp+Ch] [bp-48h]@8
Ritor1
parents:
diff changeset
2567 int v14; // [sp+4Ch] [bp-8h]@5
Ritor1
parents:
diff changeset
2568 int v15; // [sp+50h] [bp-4h]@5
Ritor1
parents:
diff changeset
2569
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2570 if ( pSoundList->pSL_Sounds )
0
Ritor1
parents:
diff changeset
2571 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2572 //v4 = &pSoundList->pSounds[a2->field_8];
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2573 if ( pSoundList->pSL_Sounds[a2->field_8].eType == SOUND_DESC_SWAP)
0
Ritor1
parents:
diff changeset
2574 {
2113
a94c5bee0225 SoundVolume options
Ritor1
parents: 2112
diff changeset
2575 if ( pSoundList->pSL_Sounds[a2->field_8].p3DSound && !(pSoundList->pSL_Sounds[a2->field_8].uFlags & SOUND_DESC_SYSTEM) )
0
Ritor1
parents:
diff changeset
2576 {
Ritor1
parents:
diff changeset
2577 v5 = this->uNum3DSamples == 0;
Ritor1
parents:
diff changeset
2578 v6 = this->uNum3DSamples < 0;
Ritor1
parents:
diff changeset
2579 v14 = 0;
Ritor1
parents:
diff changeset
2580 v15 = 0;
Ritor1
parents:
diff changeset
2581 if ( v6 | v5 )
Ritor1
parents:
diff changeset
2582 goto LABEL_16;
Ritor1
parents:
diff changeset
2583 v7 = (char *)this->p3DSamples;
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2584 __debugbreak();//Ritor1
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2585 for ( v2 = 0; v2 < uNum3DSamples; ++v2 )
0
Ritor1
parents:
diff changeset
2586 {
Ritor1
parents:
diff changeset
2587 if ( a2->field_C == *((int *)v7 + 3) )
Ritor1
parents:
diff changeset
2588 {
Ritor1
parents:
diff changeset
2589 v8 = v15;
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2590 //v9 = this->p3DSamples[v2];
0
Ritor1
parents:
diff changeset
2591 ++v15;
Ritor1
parents:
diff changeset
2592 v13[v8] = v2;
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2593 if ( AIL_3D_sample_status(&this->p3DSamples[v2]) == 4 )
0
Ritor1
parents:
diff changeset
2594 ++v14;
Ritor1
parents:
diff changeset
2595 }
Ritor1
parents:
diff changeset
2596 v7 += 16;
Ritor1
parents:
diff changeset
2597 }
Ritor1
parents:
diff changeset
2598 if ( !v14 )
Ritor1
parents:
diff changeset
2599 {
Ritor1
parents:
diff changeset
2600 LABEL_16:
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 703
diff changeset
2601 pSoundList->UnloadSound(a2->field_8, 1);
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2602 for ( v10 = 0; v10 < v15; v10++ )
0
Ritor1
parents:
diff changeset
2603 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2604 v11 = v13[v10];
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2605 *(&bEAXSupported + 4 * (v11 + 2)) = 0;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2606 p3DSamples[v11].field_8 = 0;
0
Ritor1
parents:
diff changeset
2607 }
Ritor1
parents:
diff changeset
2608 }
Ritor1
parents:
diff changeset
2609 }
Ritor1
parents:
diff changeset
2610 }
Ritor1
parents:
diff changeset
2611 }
Ritor1
parents:
diff changeset
2612 }
Ritor1
parents:
diff changeset
2613
Ritor1
parents:
diff changeset
2614 //----- (004ABFDB) --------------------------------------------------------
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
2615 void PlayLevelMusic()
0
Ritor1
parents:
diff changeset
2616 {
Ritor1
parents:
diff changeset
2617 unsigned int v0; // eax@1
Ritor1
parents:
diff changeset
2618
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
2619 v0 = pMapStats->GetMapInfo(pCurrentMapName);
0
Ritor1
parents:
diff changeset
2620 if ( v0 )
Ritor1
parents:
diff changeset
2621 pAudioPlayer->PlayMusicTrack((MusicID)pMapStats->pInfos[v0].uRedbookTrackID);
Ritor1
parents:
diff changeset
2622 }
Ritor1
parents:
diff changeset
2623
Ritor1
parents:
diff changeset
2624 //----- (004AC004) --------------------------------------------------------
Ritor1
parents:
diff changeset
2625 void AudioPlayer::SetEAXPreferences()
Ritor1
parents:
diff changeset
2626 {
Ritor1
parents:
diff changeset
2627 float v4; // [sp+4h] [bp-4h]@2
Ritor1
parents:
diff changeset
2628
Ritor1
parents:
diff changeset
2629 if ( this->bEAXSupported )
Ritor1
parents:
diff changeset
2630 {
Ritor1
parents:
diff changeset
2631 v4 = 0.0;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2632 AIL_set_3D_provider_preference(this->h3DSoundProvider, "EAX effect volume", (int *)&v4);
0
Ritor1
parents:
diff changeset
2633 v4 = 1.0;
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2634 AIL_set_3D_provider_preference(this->h3DSoundProvider, "EAX damping", (int *)&v4);
0
Ritor1
parents:
diff changeset
2635 }
Ritor1
parents:
diff changeset
2636 }
Ritor1
parents:
diff changeset
2637 // 4D82DC: using guessed type int __stdcall AIL_set_3D_provider_preference(int, int, int);
Ritor1
parents:
diff changeset
2638
Ritor1
parents:
diff changeset
2639 //----- (004AC041) --------------------------------------------------------
Ritor1
parents:
diff changeset
2640 void AudioPlayer::SetMapEAX()
Ritor1
parents:
diff changeset
2641 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2642 unsigned int pMapID; // eax@1
0
Ritor1
parents:
diff changeset
2643 int v3; // [sp+4h] [bp-4h]@3
Ritor1
parents:
diff changeset
2644
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1458
diff changeset
2645 pMapID = pMapStats->GetMapInfo(pCurrentMapName);
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2646 if ( this->b3DSoundInitialized && this->bEAXSupported )
0
Ritor1
parents:
diff changeset
2647 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2648 v3 = pMapStats->pInfos[pMapID].uEAXEnv;
0
Ritor1
parents:
diff changeset
2649 if ( (unsigned int)v3 >= 0x1A )
Ritor1
parents:
diff changeset
2650 {
Ritor1
parents:
diff changeset
2651 SetEAXPreferences();
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2652 this->field_214 = -1;
0
Ritor1
parents:
diff changeset
2653 }
Ritor1
parents:
diff changeset
2654 else
Ritor1
parents:
diff changeset
2655 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2656 AIL_set_3D_provider_preference(this->h3DSoundProvider, "EAX environment selection", &v3);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2657 this->field_214 = v3;
0
Ritor1
parents:
diff changeset
2658 }
Ritor1
parents:
diff changeset
2659 }
Ritor1
parents:
diff changeset
2660 }
Ritor1
parents:
diff changeset
2661 // 4D82DC: using guessed type int __stdcall AIL_set_3D_provider_preference(int, int, int);
Ritor1
parents:
diff changeset
2662
Ritor1
parents:
diff changeset
2663 //----- (004AC0A2) --------------------------------------------------------
Ritor1
parents:
diff changeset
2664 int AudioPlayer::_4AC0A2()
Ritor1
parents:
diff changeset
2665 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2666 unsigned int map_id; // eax@1
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2667 //int v4; // ebx@1
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2668 //int *v5; // edi@2
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2669 //int v6; // eax@4
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2670 //AudioPlayer_3DSample *v8; // ebx@7
0
Ritor1
parents:
diff changeset
2671 void *v9; // eax@8
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2672 //int v10; // ebx@14
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2673 //unsigned int v11; // eax@14
0
Ritor1
parents:
diff changeset
2674 int v12; // [sp+1Ch] [bp-8h]@1
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2675 //int v13; // [sp+20h] [bp-4h]@6
0
Ritor1
parents:
diff changeset
2676
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2677 __debugbreak();//Ritor1
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2678 map_id = pMapStats->GetMapInfo(pCurrentMapName);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2679 if ( this->b3DSoundInitialized )
0
Ritor1
parents:
diff changeset
2680 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2681 //v5 = &this->uNum3DSamples;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2682 AIL_3D_provider_attribute(this->h3DSoundProvider, "Maximum supported samples", &this->uNum3DSamples);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2683 if ( this->uNum3DSamples > 32 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2684 this->uNum3DSamples = 32;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2685 //v6 = this->uNum3DSamples;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2686 if ( !this->uNum3DSamples )
0
Ritor1
parents:
diff changeset
2687 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2688 this->b3DSoundInitialized = 0;
0
Ritor1
parents:
diff changeset
2689 return -1;
Ritor1
parents:
diff changeset
2690 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2691 //v13 = 0;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2692 //if ( this->uNum3DSamples > 0 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2693 //{
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2694 //v8 = this->p3DSamples;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2695 //while ( 1 )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2696 for ( uint i = 0; i < this->uNum3DSamples; ++i )
0
Ritor1
parents:
diff changeset
2697 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2698 v9 = (void *)AIL_allocate_3D_sample_handle(this->h3DSoundProvider);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2699 this->p3DSamples[i].hSample = v9;
0
Ritor1
parents:
diff changeset
2700 if ( !v9 )
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2701 this->uNum3DSamples = i;
0
Ritor1
parents:
diff changeset
2702 AIL_set_3D_sample_float_distances(v9, 4096.0, 256.0, 4096.0, 256.0);
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2703 AIL_set_3D_sample_volume(this->p3DSamples[i].hSample, this->s3DSoundVolume);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2704 //++v8;
0
Ritor1
parents:
diff changeset
2705 }
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2706 //}
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2707 if ( this->bEAXSupported )
0
Ritor1
parents:
diff changeset
2708 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2709 //v10 = v4;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2710 //v11 = pMapStats->pInfos[map_id].uEAXEnv;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2711 v12 = pMapStats->pInfos[map_id].uEAXEnv;
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2712 if ( pMapStats->pInfos[map_id].uEAXEnv >= 0x1A )
0
Ritor1
parents:
diff changeset
2713 {
Ritor1
parents:
diff changeset
2714 pAudioPlayer->SetEAXPreferences();
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2715 this->field_214 = -1;
0
Ritor1
parents:
diff changeset
2716 }
Ritor1
parents:
diff changeset
2717 else
Ritor1
parents:
diff changeset
2718 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2719 AIL_set_3D_provider_preference(this->h3DSoundProvider, "EAX environment selection", &v12);
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2720 this->field_214 = v12;
0
Ritor1
parents:
diff changeset
2721 }
Ritor1
parents:
diff changeset
2722 }
Ritor1
parents:
diff changeset
2723 }
Ritor1
parents:
diff changeset
2724 return 1;
Ritor1
parents:
diff changeset
2725 }
Ritor1
parents:
diff changeset
2726
Ritor1
parents:
diff changeset
2727 //----- (004A96BE) --------------------------------------------------------
Ritor1
parents:
diff changeset
2728 void ReleaseSoundData(void *_this)
Ritor1
parents:
diff changeset
2729 {
2104
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2730 //for ( uint i = 0; (void *)&pSounds[i].pSoundData < (void *)&pSounds[2999].pSoundData; i++ )
9574c5bfb96f UpdateSounds()
Ritor1
parents: 2085
diff changeset
2731 for ( uint i = 0; i < 2999; i++ )
0
Ritor1
parents:
diff changeset
2732 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2733 if ( pSounds[i].pSoundData == _this )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2734 {
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
2735 free(_this);
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2736 memset(&pSounds[i], 0, 0x80u);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2737 }
0
Ritor1
parents:
diff changeset
2738 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2739
0
Ritor1
parents:
diff changeset
2740 }
Ritor1
parents:
diff changeset
2741
Ritor1
parents:
diff changeset
2742 //----- (004A96FF) --------------------------------------------------------
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2743 struct SoundHeader *FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName)
0
Ritor1
parents:
diff changeset
2744 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2745 /* SoundHeader *result; // eax@2
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2746 SoundHeader *pSound;
0
Ritor1
parents:
diff changeset
2747 signed int v6; // ebx@11
Ritor1
parents:
diff changeset
2748
Ritor1
parents:
diff changeset
2749 while ( 1 )
Ritor1
parents:
diff changeset
2750 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2751 v6 = uEnd - uStart;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2752 pSound = &pAudioPlayer->pSoundHeaders[v6 / 2 + uStart];
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2753 if ( !pSound )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2754 return false;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2755 result = (SoundHeader *)_stricmp(pName, pSound->pSoundName);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2756 if ( !_stricmp(pName, pSound->pSoundName) )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2757 uFindSound_BinSearch_ResultID = v6 / 2 + uStart;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2758 if ( uStart == uEnd )
0
Ritor1
parents:
diff changeset
2759 {
Ritor1
parents:
diff changeset
2760 uFindSound_BinSearch_ResultID = -1;
Ritor1
parents:
diff changeset
2761 return result;
Ritor1
parents:
diff changeset
2762 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2763 if ( (signed int)result < 0 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2764 break;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2765
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2766 if ( v6 <= 4 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2767 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2768 if ( (signed int)uStart < (signed int)uEnd )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2769 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2770 for ( uint i = uStart; i < (signed int)uEnd; ++i )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2771 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2772 if ( !_stricmp(pName, pAudioPlayer->pSoundHeaders[i].pSoundName) )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2773 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2774 uFindSound_BinSearch_ResultID = i;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2775 return &pAudioPlayer->pSoundHeaders[i];
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2776 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2777 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2778 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2779 uFindSound_BinSearch_ResultID = -1;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2780 return false;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2781 }
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2782
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2783 uStart += v6 / 2;
0
Ritor1
parents:
diff changeset
2784 LABEL_10:
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2785 ;
0
Ritor1
parents:
diff changeset
2786 }
Ritor1
parents:
diff changeset
2787 if ( v6 > 4 )
Ritor1
parents:
diff changeset
2788 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2789 uEnd = v6 / 2 + uStart;
0
Ritor1
parents:
diff changeset
2790 goto LABEL_10;
Ritor1
parents:
diff changeset
2791 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2792 if ( (signed int)uStart >= (signed int)uEnd )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2793 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2794 uFindSound_BinSearch_ResultID = -1;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2795 return false;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2796 }*/
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2797 for ( uint i = uStart; i < (signed int)uEnd; ++i )
0
Ritor1
parents:
diff changeset
2798 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2799 if ( !_stricmp(pName, pAudioPlayer->pSoundHeaders[i].pSoundName) )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2800 {
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2801 uFindSound_BinSearch_ResultID = i;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2802 return &pAudioPlayer->pSoundHeaders[i];
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2803 }
0
Ritor1
parents:
diff changeset
2804 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2805 uFindSound_BinSearch_ResultID = -1;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2806 return false;
0
Ritor1
parents:
diff changeset
2807 }
Ritor1
parents:
diff changeset
2808 // F1B4C8: using guessed type int uFindSound_BinSearch_ResultID;
Ritor1
parents:
diff changeset
2809
Ritor1
parents:
diff changeset
2810 //----- (004A97C6) --------------------------------------------------------
Ritor1
parents:
diff changeset
2811 SoundData *LoadSound(const char *pSoundName, SoundData *pOutBuff, unsigned int uID)
Ritor1
parents:
diff changeset
2812 {
Ritor1
parents:
diff changeset
2813 DWORD NumberOfBytesRead; // [sp+14h] [bp-8h]@8
Ritor1
parents:
diff changeset
2814
Ritor1
parents:
diff changeset
2815 for (uint i = 0; i < 3000; ++i)
24
352b15291822 18.01.13 (PlaySound work)
Ritor1
parents: 11
diff changeset
2816 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2817 if (pSounds[i].uID == uID)
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2818 return pSounds[i].pSoundData;
24
352b15291822 18.01.13 (PlaySound work)
Ritor1
parents: 11
diff changeset
2819 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2820 FindSound_BinSearch(0, pAudioPlayer->uNumSoundHeaders, pSoundName);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2821 if ( uFindSound_BinSearch_ResultID == -1 )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2822 return 0;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2823 if ( pOutBuff == (SoundData *)-1 )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
2824 pOutBuff = (SoundData *)malloc(pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize + 4);
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2825 SetFilePointer(pAudioPlayer->hAudioSnd, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uFileOffset, 0, 0);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2826 if ( (signed int)pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize >= (signed int)pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize )
0
Ritor1
parents:
diff changeset
2827 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2828 pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize = pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2829 if ( pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize )
0
Ritor1
parents:
diff changeset
2830 {
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
2831 ReadFile(pAudioPlayer->hAudioSnd, pOutBuff->pData, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize + 7, &NumberOfBytesRead, 0);// Ritor1: include +7 for pSounds[20]
0
Ritor1
parents:
diff changeset
2832 }
Ritor1
parents:
diff changeset
2833 else
Ritor1
parents:
diff changeset
2834 {
Ritor1
parents:
diff changeset
2835 MessageBoxW(nullptr, L"Can't load sound file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Sound.cpp:448", 0);
Ritor1
parents:
diff changeset
2836 }
Ritor1
parents:
diff changeset
2837 }
Ritor1
parents:
diff changeset
2838 else
Ritor1
parents:
diff changeset
2839 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2840 uID = (unsigned int)malloc(pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2841 ReadFile(pAudioPlayer->hAudioSnd, (LPVOID)uID, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize, &NumberOfBytesRead, 0);
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
2842 zlib::MemUnzip(pOutBuff->pData, &pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize, (const void *)uID, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize);
0
Ritor1
parents:
diff changeset
2843 free((void *)uID);
Ritor1
parents:
diff changeset
2844 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2845 if ( pOutBuff )
0
Ritor1
parents:
diff changeset
2846 {
2110
18b0ff5e1bf1 pSounds[20] error and GetSkillIdxByOrder(2) != 37 //37 - None(Нет)
Ritor1
parents: 2106
diff changeset
2847 pOutBuff->uDataSize = pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize;
0
Ritor1
parents:
diff changeset
2848 uLastLoadedSoundID = 0;
Ritor1
parents:
diff changeset
2849 if ( pSounds[0].pSoundData )
Ritor1
parents:
diff changeset
2850 {
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2851 for ( uint i = 0; pSounds[i].pSoundData; i++ )
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2852 ++uLastLoadedSoundID;
0
Ritor1
parents:
diff changeset
2853 }
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2854 strcpy((char *)pSounds[uLastLoadedSoundID].SoundName, pSoundName);
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2855 pSoundList->uTotalLoadedSoundSize += pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2856 pSounds[uLastLoadedSoundID].pSoundData = pOutBuff;
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2857 return pOutBuff;
0
Ritor1
parents:
diff changeset
2858 }
Ritor1
parents:
diff changeset
2859 else
1408
204cce84300b FindSound
Ritor1
parents: 1406
diff changeset
2860 return 0;
0
Ritor1
parents:
diff changeset
2861 }