X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_sound.pas;h=0632efdfe9904859d6accc8222abd3e3e1e28363;hb=e21c5a3813c8eac0b705cc6fe36fca3e0086d869;hp=55098850892c9b9e40c9079296181f58d87fea12;hpb=3bac09ca2b9ebecd6f81f4fa052b081ffd40041c;p=d2df-sdl.git diff --git a/src/game/g_sound.pas b/src/game/g_sound.pas index 5509885..0632efd 100644 --- a/src/game/g_sound.pas +++ b/src/game/g_sound.pas @@ -1,3 +1,4 @@ +{$MODE DELPHI} unit g_sound; interface @@ -68,7 +69,7 @@ procedure g_Sound_SetupAllVolumes(SoundVol, MusicVol: Byte); implementation uses - e_log, SysUtils, g_console, g_options, WADEDITOR, + e_log, SysUtils, g_console, g_options, wadreader, g_game, g_basic, g_items, g_map, Math, g_language; @@ -279,7 +280,7 @@ end; function g_Sound_CreateWAD(var ID: DWORD; Resource: string; isMusic: Boolean = False): Boolean; var - WAD: TWADEditor_1; + WAD: TWADFile; FileName, SectionName, ResourceName: string; @@ -293,7 +294,7 @@ begin // e_WriteLog('Loading sound: ' + Resource, MSG_NOTIFY); g_ProcessResourceStr(Resource, FileName, SectionName, ResourceName); - WAD := TWADEditor_1.Create(); + WAD := TWADFile.Create(); WAD.ReadFile(FileName); if WAD.GetResource(SectionName, ResourceName, SoundData, ResLength) then @@ -304,25 +305,27 @@ begin FreeMem(SoundData); end else - e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING); + begin + //e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING); + end; WAD.Free(); - - if not ok then + if (not ok) then begin +{$IFNDEF HEADLESS} if isMusic then e_WriteLog(Format('Error loading music %s', [Resource]), MSG_WARNING) else e_WriteLog(Format('Error loading sound %s', [Resource]), MSG_WARNING); Exit; +{$ENDIF} end; - Result := True; end; function g_Sound_CreateWADEx(SoundName: ShortString; Resource: string; isMusic: Boolean = False): Boolean; var - WAD: TWADEditor_1; + WAD: TWADFile; FileName, SectionName, ResourceName: string; SoundData: Pointer; ResLength: Integer; @@ -337,7 +340,7 @@ begin find_id := FindSound(); - WAD := TWADEditor_1.Create(); + WAD := TWADFile.Create(); WAD.ReadFile(FileName); if WAD.GetResource(SectionName, ResourceName, SoundData, ResLength) then @@ -352,19 +355,21 @@ begin FreeMem(SoundData); end else - e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING); + begin + //e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING); + end; WAD.Free(); - - if not ok then + if (not ok) then begin +{$IFNDEF HEADLESS} if isMusic then e_WriteLog(Format('Error loading music %s', [Resource]), MSG_WARNING) else e_WriteLog(Format('Error loading sound %s', [Resource]), MSG_WARNING); Exit; +{$ENDIF} end; - Result := True; end;