diff --git a/src/game/g_sound.pas b/src/game/g_sound.pas
index 48c5167e007b40eea32a13512ee948509a67c847..813d8d145c4edec5cb745d5e83206215d9a17f12 100644 (file)
--- a/src/game/g_sound.pas
+++ b/src/game/g_sound.pas
+(* Copyright (C) DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$MODE DELPHI}
unit g_sound;
interface
function g_Sound_CreateWAD(var ID: DWORD; Resource: string; isMusic: Boolean = False): Boolean;
var
WAD: TWADFile;
- FileName,
- SectionName,
- ResourceName: string;
+ FileName: string;
SoundData: Pointer;
ResLength: Integer;
ok: Boolean;
ok := False;
// e_WriteLog('Loading sound: ' + Resource, MSG_NOTIFY);
- g_ProcessResourceStr(Resource, FileName, SectionName, ResourceName);
+ FileName := g_ExtractWadName(Resource);
WAD := TWADFile.Create();
WAD.ReadFile(FileName);
- if WAD.GetResource(SectionName, ResourceName, SoundData, ResLength) then
+ if WAD.GetResource(g_ExtractFilePathName(Resource), SoundData, ResLength) then
begin
if e_LoadSoundMem(SoundData, ResLength, ID, isMusic) then
ok := True
function g_Sound_CreateWADEx(SoundName: ShortString; Resource: string; isMusic: Boolean = False): Boolean;
var
WAD: TWADFile;
- FileName, SectionName, ResourceName: string;
+ FileName: string;
SoundData: Pointer;
ResLength: Integer;
find_id: DWORD;
ok := False;
// e_WriteLog('Loading sound: ' + Resource, MSG_NOTIFY);
- g_ProcessResourceStr(Resource, FileName, SectionName, ResourceName);
+ FileName := g_ExtractWadName(Resource);
find_id := FindSound();
WAD := TWADFile.Create();
WAD.ReadFile(FileName);
- if WAD.GetResource(SectionName, ResourceName, SoundData, ResLength) then
+ if WAD.GetResource(g_ExtractFilePathName(Resource), SoundData, ResLength) then
begin
if e_LoadSoundMem(SoundData, ResLength, SoundArray[find_id].ID, isMusic) then
begin