X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fshared%2Fwadreader.pas;h=09bb5033dcda43c19fac864f90e13649f4d23a6c;hb=345e116f73d0e4b11593a94bee7d18b9e64572eb;hp=3f13946bcb1dea1532c6805ad57af2ae4854449a;hpb=31d174a428ef1235e1708b0738804b47e006cf5c;p=d2df-sdl.git diff --git a/src/shared/wadreader.pas b/src/shared/wadreader.pas index 3f13946..09bb503 100644 --- a/src/shared/wadreader.pas +++ b/src/shared/wadreader.pas @@ -22,13 +22,13 @@ unit wadreader; interface uses - mempool, sfs, xstreams, Classes; + Classes, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} + sfs, xstreams, utils; type - SArray = array of ShortString; - - TWADFile = class(TPoolObject) + TWADFile = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private fFileName: AnsiString; // empty: not opened fIter: TSFSFileList; @@ -49,7 +49,7 @@ type function GetResource (name: AnsiString; var pData: Pointer; var Len: Integer; logError: Boolean=true): Boolean; function GetMapResource (name: AnsiString; var pData: Pointer; var Len: Integer; logError: Boolean=true): Boolean; - function GetMapResources (): SArray; + function GetMapResources (): SSArray; // returns `nil` if file wasn't found function openFileStream (name: AnsiString): TStream; @@ -76,7 +76,7 @@ var implementation uses - SysUtils, e_log, utils, MAPDEF, xdynrec; + SysUtils, e_log, MAPDEF, xdynrec; function findDiskWad (fname: AnsiString): AnsiString; @@ -362,7 +362,7 @@ begin if fs = nil then begin if wantMap then continue; - if logError then e_WriteLog(Format('DFWAD: can''t open file [%s] in [%s]', [name, fFileName]), MSG_WARNING); + if logError then e_WriteLog(Format('DFWAD: can''t open file [%s] in [%s]', [name, fFileName]), TMsgType.Warning); break; end; // if we want only maps, check if this is map @@ -441,12 +441,12 @@ begin result := true; {$IFDEF SFS_DFWAD_DEBUG} if wadoptDebug then - e_WriteLog(Format('DFWAD: file [%s] FOUND in [%s]; size is %d bytes', [name, fFileName, Len]), MSG_NOTIFY); + e_WriteLog(Format('DFWAD: file [%s] FOUND in [%s]; size is %d bytes', [name, fFileName, Len]), TMsgType.Notify); {$ENDIF} exit; end; end; - if logError then e_WriteLog(Format('DFWAD: file [%s] not found in [%s]', [name, fFileName]), MSG_WARNING); + if logError then e_WriteLog(Format('DFWAD: file [%s] not found in [%s]', [name, fFileName]), TMsgType.Warning); end; function TWADFile.GetResource (name: AnsiString; var pData: Pointer; var Len: Integer; logError: Boolean=true): Boolean; @@ -459,7 +459,7 @@ begin result := GetResourceEx(name, true, pData, Len, logError); end; -function TWADFile.GetMapResources (): SArray; +function TWADFile.GetMapResources (): SSArray; var f, c: Integer; fi: TSFSFileInfo; @@ -506,11 +506,11 @@ begin rfn := findDiskWad(FileName); if length(rfn) = 0 then begin - e_WriteLog(Format('TWADFile.ReadFile: error looking for [%s]', [FileName]), MSG_NOTIFY); + e_WriteLog(Format('TWADFile.ReadFile: error looking for [%s]', [FileName]), TMsgType.Notify); exit; end; {$IFDEF SFS_DFWAD_DEBUG} - if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: FOUND [%s]', [rfn]), MSG_NOTIFY); + if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: FOUND [%s]', [rfn]), TMsgType.Notify); {$ENDIF} // cache this wad try @@ -529,7 +529,7 @@ begin if fIter = nil then Exit; fFileName := rfn; {$IFDEF SFS_DFWAD_DEBUG} - if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: [%s] opened', [fFileName]), MSG_NOTIFY); + if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: [%s] opened', [fFileName]), TMsgType.Notify); {$ENDIF} Result := True; end; @@ -549,14 +549,14 @@ begin FreeWAD(); if (Data = nil) or (Len = 0) then begin - e_WriteLog('TWADFile.ReadMemory: EMPTY SUBWAD!', MSG_WARNING); + e_WriteLog('TWADFile.ReadMemory: EMPTY SUBWAD!', TMsgType.Warning); Exit; end; fn := Format(' -- memwad %d -- ', [uniqueCounter]); Inc(uniqueCounter); {$IFDEF SFS_DFWAD_DEBUG} - if wadoptDebug then e_WriteLog(Format('TWADFile.ReadMemory: [%s]', [fn]), MSG_NOTIFY); + if wadoptDebug then e_WriteLog(Format('TWADFile.ReadMemory: [%s]', [fn]), TMsgType.Notify); {$ENDIF} try @@ -576,7 +576,7 @@ begin fFileName := fn; {$IFDEF SFS_DFWAD_DEBUG} - if wadoptDebug then e_WriteLog(Format('TWADFile.ReadMemory: [%s] opened', [fFileName]), MSG_NOTIFY); + if wadoptDebug then e_WriteLog(Format('TWADFile.ReadMemory: [%s] opened', [fFileName]), TMsgType.Notify); {$ENDIF} {