X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_sound.pas;h=48c5167e007b40eea32a13512ee948509a67c847;hb=d1e9c820c486228a7f80ac8c1e2928abea10f0bd;hp=ebce17eb3da8bd509dc7c31ef2e4c850ccbee0e2;hpb=89d242f641ed8a2ccd6b1935f64db62dc9bcf154;p=d2df-sdl.git diff --git a/src/game/g_sound.pas b/src/game/g_sound.pas index ebce17e..48c5167 100644 --- a/src/game/g_sound.pas +++ b/src/game/g_sound.pas @@ -24,7 +24,7 @@ type function SetByName(SN: String): Boolean; function SetCoords(X, Y: Integer; Volume: Single): Boolean; - property Loop: Boolean read FLoop write FLoop; + property Loop: Boolean read FMusic write FMusic; property Name: String read FName; end; @@ -68,7 +68,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 +279,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 +293,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 +304,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 +339,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 +354,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;