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

Comparing:
oup/rewrite/Global/RawList.pas (file contents), Revision 105 by alloc, Wed Feb 21 00:29:27 2007 UTC vs.
oup/current/Global/RawList.pas (file contents), Revision 144 by alloc, Sun Apr 1 14:44:32 2007 UTC

# Line 1 | Line 1
1   unit RawList;
2
2   interface
4
3   uses TypeDefs;
4  
5   type
# Line 31 | Line 29 | var
29   implementation
30  
31   uses
32 <  Template, ConnectionManager, Access_OniArchive, Classes, SysUtils;
32 >  Template, ConnectionManager, Access_OniArchive, Classes, SysUtils, Math;
33  
34  
35   function AGDB(ConnectionID, FileID: Integer): TRawDataList;
# Line 142 | Line 140 | function SUBT(ConnectionID, FileID: Inte
140   var
141    baselink, lastlink: Integer;
142    links: Integer;
145  j, k:  Integer;
146 //  Data:  TByteData;
143    Data:  TStream;
144   begin
145    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $18, 4, @baselink);
# Line 315 | Line 311 | var
311    x, y:      Word;
312    storetype: Byte;
313    datasize:  Integer;
314 +  mipmap:    Byte;
315 +
316 +  function GetImgSize(w,h, storetype: Integer): Integer;
317 +  begin
318 +    case storetype of
319 +      0, 1, 2:
320 +        Result := w*h*2;
321 +      8:
322 +        Result := w*h*4;
323 +      9:
324 +        Result :=  Max(1, w div 4) * Max(1, h div 4) * 8;
325 +    else
326 +      Result := -1;
327 +    end;
328 +  end;
329 +
330   begin
331 +  ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $88, SizeOf(mipmap), @mipmap);
332    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $8C, SizeOf(x), @x);
333    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $8E, SizeOf(y), @y);
334    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $90, SizeOf(storetype), @storetype);
335    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $9C, 4, @link_pc);
336    ConManager.Connection[ConnectionID].LoadDatFilePart(fileid, $A0, 4, @link_mac);
337 <  case storetype of
338 <    0, 1, 2:
339 <      datasize := x * y * 2;
340 <    8:
341 <      datasize := x * y * 4;
342 <    9:
343 <      datasize := x * y div 2;
337 >
338 >
339 >  datasize := GetImgSize(x, y, storetype);
340 >  if (mipmap and $01) > 0 then
341 >  begin
342 >    repeat
343 >      x    := Max(x div 2, 1);
344 >      y    := Max(y div 2, 1);
345 >      datasize := datasize + GetImgSize(x, y, storetype);
346 >    until (x = 1) and (y = 1);
347    end;
348 +
349    SetLength(Result, 1);
350    if ConManager.Connection[ConnectionID].DataOS = DOS_WIN then
351    begin
# Line 407 | Line 424 | end;
424  
425   initialization
426    RawLists := TRawLists.Create;
427 <  RawLists.InsertRawListHandler('AGDB',False,AGDB);
427 >  RawLists.InsertRawListHandler('AGDB', True, AGDB);
428    RawLists.InsertRawListHandler('AKVA', True, AKVA);
429    RawLists.InsertRawListHandler('BINA', True, BINA);
430    RawLists.InsertRawListHandler('OSBD', True, OSBD);

Diff Legend

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