--- oup/current/FileClasses/TXMP.pas 2007/05/29 19:39:15 207 +++ oup/current/FileClasses/TXMP.pas 2007/06/12 20:31:54 215 @@ -3,34 +3,20 @@ unit TXMP; interface uses - TypeDefs, _FileTypes, _DataTypes; + _FileTypes; type TFile_TXMP = class(TFile) - protected - procedure InitDatLinks; override; + public procedure InitDataFields; override; - procedure InitRawList; override; end; implementation uses - ConnectionManager, Math, Classes; - -{ TFile_SNDD } - -procedure TFile_TXMP.InitDatLinks; -begin - SetLength(FDatLinks, 2); - FDatLinks[0].SrcOffset := $94; - FDatLinks[0].DestID := -1; - FDatLinks[0].PosDestExts := '*'; - FDatLinks[1].SrcOffset := $98; - FDatLinks[1].DestID := -1; - FDatLinks[1].PosDestExts := 'TXMP'; -end; + ConnectionManager, Math, Classes, TypeDefs, _DataTypes; +{ TFile_TXMP } procedure TFile_TXMP.InitDataFields; var @@ -38,7 +24,8 @@ var temps: String; templist: TStringList; begin - FDataFields := TBlock.Create(Self, 0, 'Base', '', nil); + inherited; + FDataFields := TBlock.Create(Self, nil, 0, 'Base', '', nil); templist := TStringList.Create; with FDataFields do begin @@ -118,61 +105,5 @@ begin end; -procedure TFile_TXMP.InitRawList; -var - link_pc: Integer; - link_mac: Integer; - x, y: Word; - storetype: Byte; - datasize: Integer; - mipmap: Byte; - - function GetImgSize(w,h, storetype: Integer): Integer; - begin - case storetype of - 0, 1, 2: - Result := w*h*2; - 8: - Result := w*h*4; - 9: - Result := Max(1, w div 4) * Max(1, h div 4) * 8; - else - Result := -1; - end; - end; - -begin - ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $88, SizeOf(mipmap), @mipmap); - ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $8C, SizeOf(x), @x); - ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $8E, SizeOf(y), @y); - ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $90, SizeOf(storetype), @storetype); - ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $9C, 4, @link_pc); - ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $A0, 4, @link_mac); - - datasize := GetImgSize(x, y, storetype); - if (mipmap and $01) > 0 then - begin - repeat - x := Max(x div 2, 1); - y := Max(y div 2, 1); - datasize := datasize + GetImgSize(x, y, storetype); - until (x = 1) and (y = 1); - end; - - SetLength(FRawParts, 1); - if ConManager.Connection[FConnectionID].DataOS = DOS_WIN then - begin - FRawParts[0].SrcOffset := $9C; - FRawParts[0].RawAddr := link_pc; - end - else - begin - FRawParts[0].SrcOffset := $A0; - FRawParts[0].RawAddr := link_mac; - end; - FRawParts[0].RawSize := datasize; - FRawParts[0].LocSep := not (ConManager.Connection[FConnectionID].DataOS = DOS_WIN); -end; - end.