129 end; |
129 end; |
130 |
130 |
131 procedure SoundLoad; |
131 procedure SoundLoad; |
132 var i: TSound; |
132 var i: TSound; |
133 t: Longword; |
133 t: Longword; |
|
134 s:shortstring; |
134 begin |
135 begin |
135 if not isSoundEnabled then exit; |
136 if not isSoundEnabled then exit; |
136 |
137 |
137 defVoicepack:= AskForVoicepack('Default'); |
138 defVoicepack:= AskForVoicepack('Default'); |
138 |
139 |
139 for i:= Low(TSound) to High(TSound) do |
|
140 defVoicepack^.chunks[i]:= nil; |
|
141 |
|
142 for t:= 0 to cMaxTeams do |
140 for t:= 0 to cMaxTeams do |
143 if voicepacks[t].name <> '' then |
141 if voicepacks[t].name <> '' then |
144 for i:= Low(TSound) to High(TSound) do |
142 for i:= Low(TSound) to High(TSound) do |
145 voicepacks[t].chunks[i]:= nil; |
143 voicepacks[t].chunks[i]:= nil; |
|
144 |
|
145 for i:= Low(TSound) to High(TSound) do |
|
146 begin |
|
147 defVoicepack^.chunks[i]:= nil; |
|
148 // preload all the big sound files (>32k) that would otherwise lockup the game |
|
149 if (i in [sndBeeWater, sndBee, sndCake, sndHellishImpact1, sndHellish, sndHomerun, sndMolotov, sndMortar, sndRideOfTheValkyries, sndYoohoo]) |
|
150 and (Soundz[i].Path <> ptVoices) and (Soundz[i].FileName <> '') then |
|
151 begin |
|
152 s:= Pathz[Soundz[i].Path] + '/' + Soundz[i].FileName; |
|
153 WriteToConsole(msgLoading + s + ' '); |
|
154 defVoicepack^.chunks[i]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1); |
|
155 TryDo(defVoicepack^.chunks[i] <> nil, msgFailed, true); |
|
156 WriteLnToConsole(msgOK); |
|
157 end; |
|
158 end; |
146 |
159 |
147 end; |
160 end; |
148 |
161 |
149 procedure PlaySound(snd: TSound); |
162 procedure PlaySound(snd: TSound); |
150 begin |
163 begin |