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

Comparing oup/current/Global/RawList.pas (file contents):
Revision 113 by alloc, Sun Feb 25 17:20:22 2007 UTC vs.
Revision 146 by alloc, Sun Apr 1 15:40:16 2007 UTC

# Line 29 | 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 311 | 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 403 | Line 424 | end;
424  
425   initialization
426    RawLists := TRawLists.Create;
427 <  RawLists.InsertRawListHandler('AGDB',False,AGDB);
427 >  RawLists.InsertRawListHandler('AGDB', False, 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)