annotate AudioPlayer.cpp @ 0:8b8875f5b359

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