ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/FileClasses/TXMP.pas
(Generate patch)

Comparing oup/current/FileClasses/TXMP.pas (file contents):
Revision 207 by alloc, Tue May 29 19:39:15 2007 UTC vs.
Revision 215 by alloc, Tue Jun 12 20:31:54 2007 UTC

# Line 3 | Line 3 | unit TXMP;
3   interface
4  
5   uses
6 <  TypeDefs, _FileTypes, _DataTypes;
6 >  _FileTypes;
7  
8   type
9    TFile_TXMP = class(TFile)
10 <    protected
11 <      procedure InitDatLinks; override;
10 >    public
11        procedure InitDataFields; override;
13      procedure InitRawList; override;
12    end;
13  
14   implementation
15  
16   uses
17 <  ConnectionManager, Math, Classes;
20 <
21 < { TFile_SNDD }
22 <
23 < procedure TFile_TXMP.InitDatLinks;
24 < begin
25 <  SetLength(FDatLinks, 2);
26 <  FDatLinks[0].SrcOffset := $94;
27 <  FDatLinks[0].DestID := -1;
28 <  FDatLinks[0].PosDestExts := '*';
29 <  FDatLinks[1].SrcOffset := $98;
30 <  FDatLinks[1].DestID := -1;
31 <  FDatLinks[1].PosDestExts := 'TXMP';
32 < end;
17 >  ConnectionManager, Math, Classes, TypeDefs, _DataTypes;
18  
19 + { TFile_TXMP }
20  
21   procedure TFile_TXMP.InitDataFields;
22   var
# Line 38 | Line 24 | var
24    temps: String;
25    templist: TStringList;
26   begin
27 <  FDataFields := TBlock.Create(Self, 0, 'Base', '', nil);
27 >  inherited;
28 >  FDataFields := TBlock.Create(Self, nil, 0, 'Base', '', nil);
29    templist := TStringList.Create;
30    with FDataFields do
31    begin
# Line 118 | Line 105 | begin
105   end;
106  
107  
121 procedure TFile_TXMP.InitRawList;
122 var
123  link_pc:   Integer;
124  link_mac:  Integer;
125  x, y:      Word;
126  storetype: Byte;
127  datasize:  Integer;
128  mipmap:    Byte;
129
130  function GetImgSize(w,h, storetype: Integer): Integer;
131  begin
132    case storetype of
133      0, 1, 2:
134        Result := w*h*2;
135      8:
136        Result := w*h*4;
137      9:
138        Result :=  Max(1, w div 4) * Max(1, h div 4) * 8;
139    else
140      Result := -1;
141    end;
142  end;
143
144 begin
145  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $88, SizeOf(mipmap), @mipmap);
146  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $8C, SizeOf(x), @x);
147  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $8E, SizeOf(y), @y);
148  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $90, SizeOf(storetype), @storetype);
149  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $9C, 4, @link_pc);
150  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $A0, 4, @link_mac);
151
152  datasize := GetImgSize(x, y, storetype);
153  if (mipmap and $01) > 0 then
154  begin
155    repeat
156      x    := Max(x div 2, 1);
157      y    := Max(y div 2, 1);
158      datasize := datasize + GetImgSize(x, y, storetype);
159    until (x = 1) and (y = 1);
160  end;
161
162  SetLength(FRawParts, 1);
163  if ConManager.Connection[FConnectionID].DataOS = DOS_WIN then
164  begin
165    FRawParts[0].SrcOffset := $9C;
166    FRawParts[0].RawAddr   := link_pc;
167  end
168  else
169  begin
170    FRawParts[0].SrcOffset := $A0;
171    FRawParts[0].RawAddr   := link_mac;
172  end;
173  FRawParts[0].RawSize := datasize;
174  FRawParts[0].LocSep  := not (ConManager.Connection[FConnectionID].DataOS = DOS_WIN);
175 end;
176
108   end.
109  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)