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 213 by alloc, Tue Jun 12 17:00:48 2007 UTC vs.
Revision 215 by alloc, Tue Jun 12 20:31:54 2007 UTC

# Line 7 | Line 7 | uses
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
# Line 107 | Line 105 | begin
105   end;
106  
107  
110 procedure TFile_TXMP.InitDatLinks;
111 begin
112  SetLength(FDatLinks, 2);
113  FDatLinks[0].SrcOffset := $94;
114  FDatLinks[0].DestID := GetDatLinkValue(FFileStream, $94);
115  FDatLinks[0].PosDestExts := '*';
116  FDatLinks[1].SrcOffset := $98;
117  FDatLinks[1].DestID := GetDatLinkValue(FFileStream, $98);
118  FDatLinks[1].PosDestExts := 'TXMP';
119 end;
120
121
122 procedure TFile_TXMP.InitRawList;
123 var
124  link_pc:   Integer;
125  link_mac:  Integer;
126  x, y:      Word;
127  storetype: Byte;
128  datasize:  Integer;
129  mipmap:    Byte;
130
131  function GetImgSize(w,h, storetype: Integer): Integer;
132  begin
133    case storetype of
134      0, 1, 2:
135        Result := w*h*2;
136      8:
137        Result := w*h*4;
138      9:
139        Result :=  Max(1, w div 4) * Max(1, h div 4) * 8;
140    else
141      Result := -1;
142    end;
143  end;
144
145 begin
146  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $88, SizeOf(mipmap), @mipmap);
147  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $8C, SizeOf(x), @x);
148  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $8E, SizeOf(y), @y);
149  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $90, SizeOf(storetype), @storetype);
150  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $9C, 4, @link_pc);
151  ConManager.Connection[FConnectionID].LoadDatFilePart(FFileID, $A0, 4, @link_mac);
152
153  datasize := GetImgSize(x, y, storetype);
154  if (mipmap and $01) > 0 then
155  begin
156    repeat
157      x    := Max(x div 2, 1);
158      y    := Max(y div 2, 1);
159      datasize := datasize + GetImgSize(x, y, storetype);
160    until (x = 1) and (y = 1);
161  end;
162
163  SetLength(FRawParts, 1);
164  if ConManager.Connection[FConnectionID].DataOS = DOS_WIN then
165  begin
166    FRawParts[0].SrcOffset := $9C;
167    FRawParts[0].RawAddr   := link_pc;
168  end
169  else
170  begin
171    FRawParts[0].SrcOffset := $A0;
172    FRawParts[0].RawAddr   := link_mac;
173  end;
174  FRawParts[0].RawSize := datasize;
175  FRawParts[0].LocSep  := not (ConManager.Connection[FConnectionID].DataOS = DOS_WIN);
176 end;
177
108   end.
109  

Diff Legend

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