Index: /oup/current/FileClasses/AKVA.pas
===================================================================
--- /oup/current/FileClasses/AKVA.pas	(revision 236)
+++ /oup/current/FileClasses/AKVA.pas	(revision 237)
@@ -18,14 +18,60 @@
 
 procedure TFile_AKVA.InitDataFields;
-var
-  tempi: Integer;
 begin
   inherited;
-  FDataFields := TBlock.Create(Self, nil, 0, 'Base', '', nil);
+  FDataFields := TBlock.Create(Self, nil, 'Base', '', []);
   with FDataFields do
   begin
-    AddField(TFileID, $00, 'FileID', '', nil);
-    AddField(TLevelID, $04, 'LevelID', '', nil);
+    AddField(TFileID, 'FileID', '', []);
+    AddField(TLevelID, 'LevelID', '', []);
+
+    AddField(TUnused, 'Unused data', '', [20]);
+
+    with TArray(Addfield(TArray, 'BNV nodes', '', [4])) do
+    begin
+      AddField(TInt, 'AKBP index', 'BSP tree for this BNV', [4]);
+      AddField(TInt, 'AKVA index', 'index of this BNV', [4]);
+      AddField(TInt, 'AKBA index', '"side" range start', [4]);
+      AddField(TInt, 'AKBA index', '"side" range end', [4]);
+      AddField(TInt, 'AKVA index', 'first child BNV', [4]);
+      AddField(TInt, 'AKVA index', 'next sibling BNV', [4]);
+      AddField(TInt, 'Unknown', 'always -1', [4]);
+      with TBlock(AddField(TBlock, 'RAW link', '', [])) do
+      begin
+        AddField(TInt, 'X-tiles', 'size of pathfinding grid', [4]);
+        AddField(TInt, 'Z-tiles', 'size of pathfinding grid', [4]);
+        AddField(TRawLink, 'RAW offset', 'offset of grid data', []);
+        AddField(TInt, 'RAW size', 'size of grid data', [4]);
+        AddField(TFloat, 'Tile size', 'usually 4 world units', []);
+      end;
+      AddField(TFloat, 'AABB X-', 'BNV AABB', []);
+      AddField(TFloat, 'AABB Y-', 'BNV AABB', []);
+      AddField(TFloat, 'AABB Z-', 'BNV AABB', []);
+      AddField(TFloat, 'AABB X+', 'BNV AABB', []);
+      AddField(TFloat, 'AABB Y+', 'BNV AABB', []);
+      AddField(TFloat, 'AABB Z+', 'BNV AABB', []);
+      AddField(TInt, 'Unknown', 'always -2', [2]);
+      AddField(TInt, 'Unknown', 'always -2', [2]);
+      AddField(TInt, 'AKVA index', 'index of this BNV again', [4]);
+      AddField(TInt, 'Unknown', 'always 0', [4]);
+      AddField(TInt, 'Unknown', 'always 0', [4]);
+      AddField(TInt, 'Unknown', 'always 0 (was a RAW offset once?)', [4]);
+      AddField(TBitSet, 'Bitset', '', ['sloped', 'unknown', 'unknown, always set',
+          'unknown', 'unknown, "no raw data"', 'unknown', 'unknown', 'unknown']);
+      AddField(TBitSet, 'Bitset', '', ['unknown', 'unknown', 'unknown', 'unknown',
+          'unknown', 'unknown', 'unknown', 'unknown']);
+      AddField(TBitSet, 'Bitset', '', ['unknown', 'unknown', 'unknown', 'unknown',
+          'unknown', 'unknown', 'unknown', 'unknown']);
+      AddField(TBitSet, 'Bitset', '', ['unknown', 'unknown', 'unknown', 'unknown',
+          'unknown', 'unknown', 'unknown', 'unknown']);
+      AddField(TFloat, 'Plane X', 'floor and ceiling normal', []);
+      AddField(TFloat, 'Plane Y', 'floor and ceiling normal', []);
+      AddField(TFloat, 'Plane Z', 'floor and ceiling normal', []);
+      AddField(TFloat, 'Plane D', 'distance of floor to origin', []);
+      AddField(TFloat, 'Plane D', 'distance of ceiling to origin', []);
+      SetCount;
+    end;
   end;
+  FDataFields.Update(0, -1);
   FFileStream.Free;
   FFileStream := nil;
Index: /oup/current/FileClasses/TXAN.pas
===================================================================
--- /oup/current/FileClasses/TXAN.pas	(revision 236)
+++ /oup/current/FileClasses/TXAN.pas	(revision 237)
@@ -34,5 +34,5 @@
     AddField(TUnused, 'Unused', '', [2]);
 
-    with TArray(AddField(TArray, 'AnimTextures array', '', [4, 0])) do
+    with TArray(AddField(TArray, 'AnimTextures array', '', [4])) do
     begin
       AddField(TLinkByID, 'Texture', '', ['*']);
Index: /oup/current/FileClasses/_DataTypes.pas
===================================================================
--- /oup/current/FileClasses/_DataTypes.pas	(revision 236)
+++ /oup/current/FileClasses/_DataTypes.pas	(revision 237)
@@ -21,4 +21,5 @@
       FParentBlock: TContainer;
       FChanged: Boolean;
+      FExtraArgs: array of TVarRec;
       function GetValueAsString: String; virtual;
     public
@@ -39,4 +40,6 @@
   TContainer = class(TDataField)
     public
+      function AddField(fieldtype: TFieldType; Name, Description: String;
+          ExtraArgs: array of const): TDataField; virtual; abstract;
       procedure UpdateSize; virtual; abstract;
   end;
@@ -56,5 +59,5 @@
 
       function AddField(fieldtype: TFieldType; Name, Description: String;
-          ExtraArgs: array of const): TDataField;
+          ExtraArgs: array of const): TDataField; override;
       procedure UpdateSize; override;
   end;
@@ -67,4 +70,16 @@
     public
       // ExtraArgs: Pointer auf Integer: Bytes of TInt
+      constructor Create(ParentFile: TObject; ParentBlock: TContainer;
+          Name, Description: String; ExtraArgs: array of const); override;
+      procedure Update(Offset, Length: Integer); override;
+  end;
+
+
+  TFloat = class(TDataField)
+    private
+      FFloat: Single;
+      function GetValueAsString: String; override;
+    public
+      // ExtraArgs: none
       constructor Create(ParentFile: TObject; ParentBlock: TContainer;
           Name, Description: String; ExtraArgs: array of const); override;
@@ -147,5 +162,7 @@
       function GetFieldByOffset(Offset: Integer): TDataField;
     public
-      // ExtraArgs: Pointer auf 2 Integer: CounterSize+Count (packed record...)
+      // ExtraArgs:
+      // 1. Integer: CounterSize (if 0 then 2. integer is required)
+      // 2. Integer: BlockCount (for fixed-size arrays)
       constructor Create(ParentFile: TObject; ParentBlock: TContainer;
           Name, Description: String; ExtraArgs: array of const); override;
@@ -153,5 +170,5 @@
 
       function AddField(fieldtype: TFieldType; Name, Description: String;
-          ExtraArgs: array of const): TDataField;
+          ExtraArgs: array of const): TDataField; override;
       procedure SetCount; overload;
       procedure SetCount(n: Integer); overload;
@@ -188,5 +205,5 @@
 
 uses
-  SysUtils, Dialogs, _FileTypes, ConnectionManager;
+  SysUtils, Dialogs, _FileTypes, ConnectionManager, StrUtils;
 
 
@@ -197,4 +214,6 @@
 constructor TDataField.Create(ParentFile: TObject; ParentBlock: TContainer;
     Name, Description: String; ExtraArgs: array of const);
+var
+  i: Integer;
 begin
   if Assigned(ParentBlock) then
@@ -206,4 +225,8 @@
   FParentFile := ParentFile;
   FParentBlock := ParentBlock;
+  SetLength(FExtraArgs, Length(ExtraArgs));
+  if Length(ExtraArgs) > 0 then
+    for i := 0 to High(ExtraArgs) do
+      FExtraArgs[i] := ExtraArgs[i];
   FConnectionID := TFile(ParentFile).ConnectionID;
 end;
@@ -300,42 +323,61 @@
 constructor TArray.Create(ParentFile: TObject; ParentBlock: TContainer;
     Name, Description: String; ExtraArgs: array of const);
-var
-  i: Integer;
-  fstream: TMemoryStream;
 begin
   inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
   FCounterSize := ExtraArgs[0].VInteger;
-  FBlockCount  := ExtraArgs[1].VInteger;
+  if Length(ExtraArgs) = 2 then
+    FBlockCount := ExtraArgs[1].VInteger
+  else
+    FBlockCount := 0;
+  FTemplate := TBlock.Create(ParentFile, Self, '', '', []);
+end;
+
+function TArray.GetChildCount: Integer;
+begin
+  Result := Length(FDataFields);
+end;
+
+function TArray.GetChild(ID: Integer): TTreeElement;
+begin
+  Result := FDataFields[ID];
+end;
+
+function TArray.GetFieldByOffset(Offset: Integer): TDataField;
+begin
+  Exit;
+end;
+
+procedure TArray.SetCount;
+var
+  fstream: TMemoryStream;
+  arr_index: Integer;
+  i: Integer;
+
+  procedure Add(DestBlock, SrcBlock: TBlock);
+  var
+    fid: Integer;
+    field: TDataField;
+    result: TDataField;
+  begin
+    if Length(SrcBlock.FDataFields) > 0 then
+    begin
+      for fid := 0 to High(SrcBlock.FDataFields) do
+      begin
+        field := SrcBlock.FDataFields[fid];
+        result := DestBlock.AddField(TFieldType(field.ClassType), field.Name, field.Description, field.FExtraArgs);
+        if result is TBlock then
+          Add(TBlock(result), TBlock(field));
+      end;
+    end;
+  end;
+
+begin
   if FCounterSize > 0 then
   begin
-    fstream := TFile(ParentFile).FileStream;
+    fstream := TFile(FParentFile).FileStream;
     fstream.Seek(Offset, soFromBeginning);
     FBlockCount := 0;
     fstream.Read(FBlockCount, FCounterSize);
   end;
-  FTemplate := TBlock.Create(ParentFile, Self, '', '', []);
-end;
-
-function TArray.GetChildCount: Integer;
-begin
-  Result := Length(FDataFields);
-end;
-
-function TArray.GetChild(ID: Integer): TTreeElement;
-begin
-  Result := FDataFields[ID];
-end;
-
-function TArray.GetFieldByOffset(Offset: Integer): TDataField;
-begin
-  Exit;
-end;
-
-procedure TArray.SetCount;
-var
-  fid: Integer;
-  arr_index: Integer;
-  field: TDataField;
-begin
   FDataLength := FCounterSize;
   if FBlockCount > 0 then
@@ -345,13 +387,14 @@
       SetLength(FDataFields, arr_index + 1);
       FDataFields[arr_index] := TBlock.Create(FParentFile, Self,
-          FName + '[' + IntToStr(arr_index) + ']', '', []);
-      if Length(FTemplate.FDataFields) > 0 then
-      begin
-        for fid := 0 to High(FTemplate.FDataFields) do
-        begin
-          field := FTemplate.FDataFields[fid];
-          FDataFields[arr_index].AddField(TFieldType(field.ClassType), field.Name, field.Description, []);
-        end;
-      end;
+          '[' + IntToStr(arr_index) + ']', '', []);
+      Add(FDataFields[arr_index], FTemplate);
+    end;
+  end;
+  if Pos('[', FName) > 0 then
+  begin
+    if Pos(']', FName) = Length(FName) then
+    begin
+      i := Pos('[', ReverseString(FName));
+      FName := MidStr(FName, 1, Length(FName) - i);
     end;
   end;
@@ -361,6 +404,15 @@
 
 procedure TArray.SetCount(n: Integer);
-begin
-  FParentBlock.UpdateSize;
+var
+  fstream: TMemoryStream;
+begin
+  FBlockCount := n;
+  if FCounterSize > 0 then
+  begin
+    fstream := TFile(FParentFile).FileStream;
+    fstream.Seek(Offset, soFromBeginning);
+    fstream.Write(FBlockCount, FCounterSize);
+  end;
+  SetCount;
 end;
 
@@ -680,3 +732,30 @@
 end;
 
+
+
+{ TFloat }
+
+constructor TFloat.Create(ParentFile: TObject; ParentBlock: TContainer; Name,
+  Description: String; ExtraArgs: array of const);
+begin
+  inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs);
+  FDataLength := 4;
+  FFloat := 0;
+end;
+
+function TFloat.GetValueAsString: String;
+begin
+  Result := FloatToStr(FFloat);
+end;
+
+procedure TFloat.Update(Offset, Length: Integer);
+var
+  fstream: TMemoryStream;
+begin
+  fstream := TFile(FParentFile).FileStream;
+  fstream.Seek(FOffset, soFromBeginning);
+  fstream.Read(FFloat, FDataLength);
+end;
+
+
 end.
Index: /oup/current/FileClasses/_Extensions.pas
===================================================================
--- /oup/current/FileClasses/_Extensions.pas	(revision 236)
+++ /oup/current/FileClasses/_Extensions.pas	(revision 237)
@@ -17,4 +17,5 @@
       constructor Create(ConnectionID: Integer; Ext: String); virtual;
       procedure InitList;
+      property Ext: String read FExt;
   end;
 
@@ -48,5 +49,5 @@
 function TExtension.GetCaption: String;
 begin
-  Result := FExt;
+  Result := FExt + '[' + IntToStr(GetChildCount) + ']';
 end;
 
@@ -100,4 +101,5 @@
 function TExtensions.GetChild(ID: Integer): TTreeElement;
 begin
+  FExtensions[ID].InitList;
   Result := FExtensions[ID];
 end;
@@ -141,5 +143,5 @@
   if Length(FExtensions) > 0 then
     for i := 0 to High(FExtensions) do
-      if FExtensions[i].GetCaption = Ext then
+      if FExtensions[i].Ext = Ext then
       begin
         Result := FExtensions[i];
Index: /oup/current/FileClasses/_FileTypes.pas
===================================================================
--- /oup/current/FileClasses/_FileTypes.pas	(revision 236)
+++ /oup/current/FileClasses/_FileTypes.pas	(revision 237)
@@ -12,6 +12,4 @@
       function GetChild(ID: Integer): TTreeElement; override;
       function GetCaption: String; override;
-  private
-    FConnectionID: Integer;
     protected
       FFileInfo: TFileInfo;
Index: /oup/current/FileClasses/_MetaTypes.pas
===================================================================
--- /oup/current/FileClasses/_MetaTypes.pas	(revision 236)
+++ /oup/current/FileClasses/_MetaTypes.pas	(revision 237)
@@ -5,5 +5,5 @@
 uses
   _FileTypes, _EmptyFile, _Unlinked, _DataTypes, _Extensions, _TreeElement,
-  TXAN, TXMP;
+  AKVA, TXAN, TXMP;
 //  ABNA, AGDB, AGQC, AGQG, AGQM, AGQR, AISA, AITR, AIWA, AKAA, AKBA, AKBP, AKDA,
 //  AKEV, AKOT, AKVA, BINA, CBPI, CBPM, CONS, CRSA, DOOR, DPge, EDIA, ENVP, FILM,
@@ -32,5 +32,6 @@
 
 const
-  FileDescs: array[0..1] of TFileDesc = (
+  FileDescs: array[0..2] of TFileDesc = (
+    (ext: 'AKVA'; ftype: TFile_AKVA),
     (ext: 'TXAN'; ftype: TFile_TXAN),
     (ext: 'TXMP'; ftype: TFile_TXMP)
Index: /oup/current/OniUnPacker.bdsproj
===================================================================
--- /oup/current/OniUnPacker.bdsproj	(revision 236)
+++ /oup/current/OniUnPacker.bdsproj	(revision 237)
@@ -176,6 +176,5 @@
 			<Language Name="ProjectLang">$00000000</Language>
 			<Language Name="RootDir"></Language>
-		</Language>  
-    <Excluded_Packages>
+		</Language>  <Excluded_Packages>
       <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages>
     </Excluded_Packages>
Index: /oup/current/OniUnPacker.dpr
===================================================================
--- /oup/current/OniUnPacker.dpr	(revision 236)
+++ /oup/current/OniUnPacker.dpr	(revision 237)
@@ -30,4 +30,5 @@
   TXMP in 'FileClasses\TXMP.pas',
   TXAN in 'FileClasses\TXAN.pas',
+  AKVA in 'FileClasses\AKVA.pas',
 {
   SUBT in 'FileClasses\SUBT.pas',
@@ -129,7 +130,9 @@
   TStr in 'FileClasses\TStr.pas',
   TURR in 'FileClasses\TURR.pas',
+  TXAN in 'FileClasses\TXAN.pas',
   TXCA in 'FileClasses\TXCA.pas',
   TXMA in 'FileClasses\TXMA.pas',
   TXMB in 'FileClasses\TXMB.pas',
+  TXMP in 'FileClasses\TXMP.pas',
   TXPC in 'FileClasses\TXPC.pas',
   TxtC in 'FileClasses\TxtC.pas',
Index: /oup/current/Tools/MetaEditor.dfm
===================================================================
--- /oup/current/Tools/MetaEditor.dfm	(revision 236)
+++ /oup/current/Tools/MetaEditor.dfm	(revision 237)
@@ -64,4 +64,5 @@
         item
           Position = 3
+          Width = 150
           WideText = 'Data'
         end>
Index: /oup/current/Tools/MetaEditor.pas
===================================================================
--- /oup/current/Tools/MetaEditor.pas	(revision 236)
+++ /oup/current/Tools/MetaEditor.pas	(revision 237)
@@ -88,5 +88,6 @@
     VST.Clear;
     VST.BeginUpdate;
-    root := ConManager.Connection[FConnectionID].MetaData.Root;
+//    root := ConManager.Connection[FConnectionID].MetaData.Root;
+    root := ConManager.Connection[FConnectionID].MetaData.FileById[454];
     for i := 0 to root.ChildCount - 1 do
     begin
@@ -111,7 +112,4 @@
   data := Sender.GetNodeData(node);
   Meta := ConManager.Connection[ConnectionID].MetaData;
-  if data.Field is TExtension then
-    if TExtension(data.Field).ChildCount = 0 then
-      TExtension(data.Field).InitList;
 
   if data.Field.ChildCount > 0 then
