Changeset 237 for oup/current


Ignore:
Timestamp:
Jul 14, 2007, 4:18:23 PM (17 years ago)
Author:
alloc
Message:
 
Location:
oup/current
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • oup/current/FileClasses/AKVA.pas

    r233 r237  
    1818
    1919procedure TFile_AKVA.InitDataFields;
    20 var
    21   tempi: Integer;
    2220begin
    2321  inherited;
    24   FDataFields := TBlock.Create(Self, nil, 0, 'Base', '', nil);
     22  FDataFields := TBlock.Create(Self, nil, 'Base', '', []);
    2523  with FDataFields do
    2624  begin
    27     AddField(TFileID, $00, 'FileID', '', nil);
    28     AddField(TLevelID, $04, 'LevelID', '', nil);
     25    AddField(TFileID, 'FileID', '', []);
     26    AddField(TLevelID, 'LevelID', '', []);
     27
     28    AddField(TUnused, 'Unused data', '', [20]);
     29
     30    with TArray(Addfield(TArray, 'BNV nodes', '', [4])) do
     31    begin
     32      AddField(TInt, 'AKBP index', 'BSP tree for this BNV', [4]);
     33      AddField(TInt, 'AKVA index', 'index of this BNV', [4]);
     34      AddField(TInt, 'AKBA index', '"side" range start', [4]);
     35      AddField(TInt, 'AKBA index', '"side" range end', [4]);
     36      AddField(TInt, 'AKVA index', 'first child BNV', [4]);
     37      AddField(TInt, 'AKVA index', 'next sibling BNV', [4]);
     38      AddField(TInt, 'Unknown', 'always -1', [4]);
     39      with TBlock(AddField(TBlock, 'RAW link', '', [])) do
     40      begin
     41        AddField(TInt, 'X-tiles', 'size of pathfinding grid', [4]);
     42        AddField(TInt, 'Z-tiles', 'size of pathfinding grid', [4]);
     43        AddField(TRawLink, 'RAW offset', 'offset of grid data', []);
     44        AddField(TInt, 'RAW size', 'size of grid data', [4]);
     45        AddField(TFloat, 'Tile size', 'usually 4 world units', []);
     46      end;
     47      AddField(TFloat, 'AABB X-', 'BNV AABB', []);
     48      AddField(TFloat, 'AABB Y-', 'BNV AABB', []);
     49      AddField(TFloat, 'AABB Z-', 'BNV AABB', []);
     50      AddField(TFloat, 'AABB X+', 'BNV AABB', []);
     51      AddField(TFloat, 'AABB Y+', 'BNV AABB', []);
     52      AddField(TFloat, 'AABB Z+', 'BNV AABB', []);
     53      AddField(TInt, 'Unknown', 'always -2', [2]);
     54      AddField(TInt, 'Unknown', 'always -2', [2]);
     55      AddField(TInt, 'AKVA index', 'index of this BNV again', [4]);
     56      AddField(TInt, 'Unknown', 'always 0', [4]);
     57      AddField(TInt, 'Unknown', 'always 0', [4]);
     58      AddField(TInt, 'Unknown', 'always 0 (was a RAW offset once?)', [4]);
     59      AddField(TBitSet, 'Bitset', '', ['sloped', 'unknown', 'unknown, always set',
     60          'unknown', 'unknown, "no raw data"', 'unknown', 'unknown', 'unknown']);
     61      AddField(TBitSet, 'Bitset', '', ['unknown', 'unknown', 'unknown', 'unknown',
     62          'unknown', 'unknown', 'unknown', 'unknown']);
     63      AddField(TBitSet, 'Bitset', '', ['unknown', 'unknown', 'unknown', 'unknown',
     64          'unknown', 'unknown', 'unknown', 'unknown']);
     65      AddField(TBitSet, 'Bitset', '', ['unknown', 'unknown', 'unknown', 'unknown',
     66          'unknown', 'unknown', 'unknown', 'unknown']);
     67      AddField(TFloat, 'Plane X', 'floor and ceiling normal', []);
     68      AddField(TFloat, 'Plane Y', 'floor and ceiling normal', []);
     69      AddField(TFloat, 'Plane Z', 'floor and ceiling normal', []);
     70      AddField(TFloat, 'Plane D', 'distance of floor to origin', []);
     71      AddField(TFloat, 'Plane D', 'distance of ceiling to origin', []);
     72      SetCount;
     73    end;
    2974  end;
     75  FDataFields.Update(0, -1);
    3076  FFileStream.Free;
    3177  FFileStream := nil;
  • oup/current/FileClasses/TXAN.pas

    r236 r237  
    3434    AddField(TUnused, 'Unused', '', [2]);
    3535
    36     with TArray(AddField(TArray, 'AnimTextures array', '', [4, 0])) do
     36    with TArray(AddField(TArray, 'AnimTextures array', '', [4])) do
    3737    begin
    3838      AddField(TLinkByID, 'Texture', '', ['*']);
  • oup/current/FileClasses/_DataTypes.pas

    r236 r237  
    2121      FParentBlock: TContainer;
    2222      FChanged: Boolean;
     23      FExtraArgs: array of TVarRec;
    2324      function GetValueAsString: String; virtual;
    2425    public
     
    3940  TContainer = class(TDataField)
    4041    public
     42      function AddField(fieldtype: TFieldType; Name, Description: String;
     43          ExtraArgs: array of const): TDataField; virtual; abstract;
    4144      procedure UpdateSize; virtual; abstract;
    4245  end;
     
    5659
    5760      function AddField(fieldtype: TFieldType; Name, Description: String;
    58           ExtraArgs: array of const): TDataField;
     61          ExtraArgs: array of const): TDataField; override;
    5962      procedure UpdateSize; override;
    6063  end;
     
    6770    public
    6871      // ExtraArgs: Pointer auf Integer: Bytes of TInt
     72      constructor Create(ParentFile: TObject; ParentBlock: TContainer;
     73          Name, Description: String; ExtraArgs: array of const); override;
     74      procedure Update(Offset, Length: Integer); override;
     75  end;
     76
     77
     78  TFloat = class(TDataField)
     79    private
     80      FFloat: Single;
     81      function GetValueAsString: String; override;
     82    public
     83      // ExtraArgs: none
    6984      constructor Create(ParentFile: TObject; ParentBlock: TContainer;
    7085          Name, Description: String; ExtraArgs: array of const); override;
     
    147162      function GetFieldByOffset(Offset: Integer): TDataField;
    148163    public
    149       // ExtraArgs: Pointer auf 2 Integer: CounterSize+Count (packed record...)
     164      // ExtraArgs:
     165      // 1. Integer: CounterSize (if 0 then 2. integer is required)
     166      // 2. Integer: BlockCount (for fixed-size arrays)
    150167      constructor Create(ParentFile: TObject; ParentBlock: TContainer;
    151168          Name, Description: String; ExtraArgs: array of const); override;
     
    153170
    154171      function AddField(fieldtype: TFieldType; Name, Description: String;
    155           ExtraArgs: array of const): TDataField;
     172          ExtraArgs: array of const): TDataField; override;
    156173      procedure SetCount; overload;
    157174      procedure SetCount(n: Integer); overload;
     
    188205
    189206uses
    190   SysUtils, Dialogs, _FileTypes, ConnectionManager;
     207  SysUtils, Dialogs, _FileTypes, ConnectionManager, StrUtils;
    191208
    192209
     
    197214constructor TDataField.Create(ParentFile: TObject; ParentBlock: TContainer;
    198215    Name, Description: String; ExtraArgs: array of const);
     216var
     217  i: Integer;
    199218begin
    200219  if Assigned(ParentBlock) then
     
    206225  FParentFile := ParentFile;
    207226  FParentBlock := ParentBlock;
     227  SetLength(FExtraArgs, Length(ExtraArgs));
     228  if Length(ExtraArgs) > 0 then
     229    for i := 0 to High(ExtraArgs) do
     230      FExtraArgs[i] := ExtraArgs[i];
    208231  FConnectionID := TFile(ParentFile).ConnectionID;
    209232end;
     
    300323constructor TArray.Create(ParentFile: TObject; ParentBlock: TContainer;
    301324    Name, Description: String; ExtraArgs: array of const);
    302 var
    303   i: Integer;
    304   fstream: TMemoryStream;
    305325begin
    306326  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
    307327  FCounterSize := ExtraArgs[0].VInteger;
    308   FBlockCount  := ExtraArgs[1].VInteger;
     328  if Length(ExtraArgs) = 2 then
     329    FBlockCount := ExtraArgs[1].VInteger
     330  else
     331    FBlockCount := 0;
     332  FTemplate := TBlock.Create(ParentFile, Self, '', '', []);
     333end;
     334
     335function TArray.GetChildCount: Integer;
     336begin
     337  Result := Length(FDataFields);
     338end;
     339
     340function TArray.GetChild(ID: Integer): TTreeElement;
     341begin
     342  Result := FDataFields[ID];
     343end;
     344
     345function TArray.GetFieldByOffset(Offset: Integer): TDataField;
     346begin
     347  Exit;
     348end;
     349
     350procedure TArray.SetCount;
     351var
     352  fstream: TMemoryStream;
     353  arr_index: Integer;
     354  i: Integer;
     355
     356  procedure Add(DestBlock, SrcBlock: TBlock);
     357  var
     358    fid: Integer;
     359    field: TDataField;
     360    result: TDataField;
     361  begin
     362    if Length(SrcBlock.FDataFields) > 0 then
     363    begin
     364      for fid := 0 to High(SrcBlock.FDataFields) do
     365      begin
     366        field := SrcBlock.FDataFields[fid];
     367        result := DestBlock.AddField(TFieldType(field.ClassType), field.Name, field.Description, field.FExtraArgs);
     368        if result is TBlock then
     369          Add(TBlock(result), TBlock(field));
     370      end;
     371    end;
     372  end;
     373
     374begin
    309375  if FCounterSize > 0 then
    310376  begin
    311     fstream := TFile(ParentFile).FileStream;
     377    fstream := TFile(FParentFile).FileStream;
    312378    fstream.Seek(Offset, soFromBeginning);
    313379    FBlockCount := 0;
    314380    fstream.Read(FBlockCount, FCounterSize);
    315381  end;
    316   FTemplate := TBlock.Create(ParentFile, Self, '', '', []);
    317 end;
    318 
    319 function TArray.GetChildCount: Integer;
    320 begin
    321   Result := Length(FDataFields);
    322 end;
    323 
    324 function TArray.GetChild(ID: Integer): TTreeElement;
    325 begin
    326   Result := FDataFields[ID];
    327 end;
    328 
    329 function TArray.GetFieldByOffset(Offset: Integer): TDataField;
    330 begin
    331   Exit;
    332 end;
    333 
    334 procedure TArray.SetCount;
    335 var
    336   fid: Integer;
    337   arr_index: Integer;
    338   field: TDataField;
    339 begin
    340382  FDataLength := FCounterSize;
    341383  if FBlockCount > 0 then
     
    345387      SetLength(FDataFields, arr_index + 1);
    346388      FDataFields[arr_index] := TBlock.Create(FParentFile, Self,
    347           FName + '[' + IntToStr(arr_index) + ']', '', []);
    348       if Length(FTemplate.FDataFields) > 0 then
    349       begin
    350         for fid := 0 to High(FTemplate.FDataFields) do
    351         begin
    352           field := FTemplate.FDataFields[fid];
    353           FDataFields[arr_index].AddField(TFieldType(field.ClassType), field.Name, field.Description, []);
    354         end;
    355       end;
     389          '[' + IntToStr(arr_index) + ']', '', []);
     390      Add(FDataFields[arr_index], FTemplate);
     391    end;
     392  end;
     393  if Pos('[', FName) > 0 then
     394  begin
     395    if Pos(']', FName) = Length(FName) then
     396    begin
     397      i := Pos('[', ReverseString(FName));
     398      FName := MidStr(FName, 1, Length(FName) - i);
    356399    end;
    357400  end;
     
    361404
    362405procedure TArray.SetCount(n: Integer);
    363 begin
    364   FParentBlock.UpdateSize;
     406var
     407  fstream: TMemoryStream;
     408begin
     409  FBlockCount := n;
     410  if FCounterSize > 0 then
     411  begin
     412    fstream := TFile(FParentFile).FileStream;
     413    fstream.Seek(Offset, soFromBeginning);
     414    fstream.Write(FBlockCount, FCounterSize);
     415  end;
     416  SetCount;
    365417end;
    366418
     
    680732end;
    681733
     734
     735
     736{ TFloat }
     737
     738constructor TFloat.Create(ParentFile: TObject; ParentBlock: TContainer; Name,
     739  Description: String; ExtraArgs: array of const);
     740begin
     741  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
     742  FDataLength := 4;
     743  FFloat := 0;
     744end;
     745
     746function TFloat.GetValueAsString: String;
     747begin
     748  Result := FloatToStr(FFloat);
     749end;
     750
     751procedure TFloat.Update(Offset, Length: Integer);
     752var
     753  fstream: TMemoryStream;
     754begin
     755  fstream := TFile(FParentFile).FileStream;
     756  fstream.Seek(FOffset, soFromBeginning);
     757  fstream.Read(FFloat, FDataLength);
     758end;
     759
     760
    682761end.
  • oup/current/FileClasses/_Extensions.pas

    r233 r237  
    1717      constructor Create(ConnectionID: Integer; Ext: String); virtual;
    1818      procedure InitList;
     19      property Ext: String read FExt;
    1920  end;
    2021
     
    4849function TExtension.GetCaption: String;
    4950begin
    50   Result := FExt;
     51  Result := FExt + '[' + IntToStr(GetChildCount) + ']';
    5152end;
    5253
     
    100101function TExtensions.GetChild(ID: Integer): TTreeElement;
    101102begin
     103  FExtensions[ID].InitList;
    102104  Result := FExtensions[ID];
    103105end;
     
    141143  if Length(FExtensions) > 0 then
    142144    for i := 0 to High(FExtensions) do
    143       if FExtensions[i].GetCaption = Ext then
     145      if FExtensions[i].Ext = Ext then
    144146      begin
    145147        Result := FExtensions[i];
  • oup/current/FileClasses/_FileTypes.pas

    r233 r237  
    1212      function GetChild(ID: Integer): TTreeElement; override;
    1313      function GetCaption: String; override;
    14   private
    15     FConnectionID: Integer;
    1614    protected
    1715      FFileInfo: TFileInfo;
  • oup/current/FileClasses/_MetaTypes.pas

    r236 r237  
    55uses
    66  _FileTypes, _EmptyFile, _Unlinked, _DataTypes, _Extensions, _TreeElement,
    7   TXAN, TXMP;
     7  AKVA, TXAN, TXMP;
    88//  ABNA, AGDB, AGQC, AGQG, AGQM, AGQR, AISA, AITR, AIWA, AKAA, AKBA, AKBP, AKDA,
    99//  AKEV, AKOT, AKVA, BINA, CBPI, CBPM, CONS, CRSA, DOOR, DPge, EDIA, ENVP, FILM,
     
    3232
    3333const
    34   FileDescs: array[0..1] of TFileDesc = (
     34  FileDescs: array[0..2] of TFileDesc = (
     35    (ext: 'AKVA'; ftype: TFile_AKVA),
    3536    (ext: 'TXAN'; ftype: TFile_TXAN),
    3637    (ext: 'TXMP'; ftype: TFile_TXMP)
  • oup/current/OniUnPacker.bdsproj

    r236 r237  
    176176                        <Language Name="ProjectLang">$00000000</Language>
    177177                        <Language Name="RootDir"></Language>
    178                 </Language> 
    179     <Excluded_Packages>
     178                </Language>  <Excluded_Packages>
    180179      <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages>
    181180    </Excluded_Packages>
  • oup/current/OniUnPacker.dpr

    r236 r237  
    3030  TXMP in 'FileClasses\TXMP.pas',
    3131  TXAN in 'FileClasses\TXAN.pas',
     32  AKVA in 'FileClasses\AKVA.pas',
    3233{
    3334  SUBT in 'FileClasses\SUBT.pas',
     
    129130  TStr in 'FileClasses\TStr.pas',
    130131  TURR in 'FileClasses\TURR.pas',
     132  TXAN in 'FileClasses\TXAN.pas',
    131133  TXCA in 'FileClasses\TXCA.pas',
    132134  TXMA in 'FileClasses\TXMA.pas',
    133135  TXMB in 'FileClasses\TXMB.pas',
     136  TXMP in 'FileClasses\TXMP.pas',
    134137  TXPC in 'FileClasses\TXPC.pas',
    135138  TxtC in 'FileClasses\TxtC.pas',
  • oup/current/Tools/MetaEditor.dfm

    r233 r237  
    6464        item
    6565          Position = 3
     66          Width = 150
    6667          WideText = 'Data'
    6768        end>
  • oup/current/Tools/MetaEditor.pas

    r236 r237  
    8888    VST.Clear;
    8989    VST.BeginUpdate;
    90     root := ConManager.Connection[FConnectionID].MetaData.Root;
     90//    root := ConManager.Connection[FConnectionID].MetaData.Root;
     91    root := ConManager.Connection[FConnectionID].MetaData.FileById[454];
    9192    for i := 0 to root.ChildCount - 1 do
    9293    begin
     
    111112  data := Sender.GetNodeData(node);
    112113  Meta := ConManager.Connection[ConnectionID].MetaData;
    113   if data.Field is TExtension then
    114     if TExtension(data.Field).ChildCount = 0 then
    115       TExtension(data.Field).InitList;
    116114
    117115  if data.Field.ChildCount > 0 then
Note: See TracChangeset for help on using the changeset viewer.