annotate AudioPlayer.cpp @ 170:f089d88b6739

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