Changeset 237 for oup/current
- Timestamp:
- Jul 14, 2007, 4:18:23 PM (17 years ago)
- Location:
- oup/current
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/FileClasses/AKVA.pas
r233 r237 18 18 19 19 procedure TFile_AKVA.InitDataFields; 20 var21 tempi: Integer;22 20 begin 23 21 inherited; 24 FDataFields := TBlock.Create(Self, nil, 0, 'Base', '', nil);22 FDataFields := TBlock.Create(Self, nil, 'Base', '', []); 25 23 with FDataFields do 26 24 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; 29 74 end; 75 FDataFields.Update(0, -1); 30 76 FFileStream.Free; 31 77 FFileStream := nil; -
oup/current/FileClasses/TXAN.pas
r236 r237 34 34 AddField(TUnused, 'Unused', '', [2]); 35 35 36 with TArray(AddField(TArray, 'AnimTextures array', '', [4 , 0])) do36 with TArray(AddField(TArray, 'AnimTextures array', '', [4])) do 37 37 begin 38 38 AddField(TLinkByID, 'Texture', '', ['*']); -
oup/current/FileClasses/_DataTypes.pas
r236 r237 21 21 FParentBlock: TContainer; 22 22 FChanged: Boolean; 23 FExtraArgs: array of TVarRec; 23 24 function GetValueAsString: String; virtual; 24 25 public … … 39 40 TContainer = class(TDataField) 40 41 public 42 function AddField(fieldtype: TFieldType; Name, Description: String; 43 ExtraArgs: array of const): TDataField; virtual; abstract; 41 44 procedure UpdateSize; virtual; abstract; 42 45 end; … … 56 59 57 60 function AddField(fieldtype: TFieldType; Name, Description: String; 58 ExtraArgs: array of const): TDataField; 61 ExtraArgs: array of const): TDataField; override; 59 62 procedure UpdateSize; override; 60 63 end; … … 67 70 public 68 71 // 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 69 84 constructor Create(ParentFile: TObject; ParentBlock: TContainer; 70 85 Name, Description: String; ExtraArgs: array of const); override; … … 147 162 function GetFieldByOffset(Offset: Integer): TDataField; 148 163 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) 150 167 constructor Create(ParentFile: TObject; ParentBlock: TContainer; 151 168 Name, Description: String; ExtraArgs: array of const); override; … … 153 170 154 171 function AddField(fieldtype: TFieldType; Name, Description: String; 155 ExtraArgs: array of const): TDataField; 172 ExtraArgs: array of const): TDataField; override; 156 173 procedure SetCount; overload; 157 174 procedure SetCount(n: Integer); overload; … … 188 205 189 206 uses 190 SysUtils, Dialogs, _FileTypes, ConnectionManager ;207 SysUtils, Dialogs, _FileTypes, ConnectionManager, StrUtils; 191 208 192 209 … … 197 214 constructor TDataField.Create(ParentFile: TObject; ParentBlock: TContainer; 198 215 Name, Description: String; ExtraArgs: array of const); 216 var 217 i: Integer; 199 218 begin 200 219 if Assigned(ParentBlock) then … … 206 225 FParentFile := ParentFile; 207 226 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]; 208 231 FConnectionID := TFile(ParentFile).ConnectionID; 209 232 end; … … 300 323 constructor TArray.Create(ParentFile: TObject; ParentBlock: TContainer; 301 324 Name, Description: String; ExtraArgs: array of const); 302 var303 i: Integer;304 fstream: TMemoryStream;305 325 begin 306 326 inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs); 307 327 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, '', '', []); 333 end; 334 335 function TArray.GetChildCount: Integer; 336 begin 337 Result := Length(FDataFields); 338 end; 339 340 function TArray.GetChild(ID: Integer): TTreeElement; 341 begin 342 Result := FDataFields[ID]; 343 end; 344 345 function TArray.GetFieldByOffset(Offset: Integer): TDataField; 346 begin 347 Exit; 348 end; 349 350 procedure TArray.SetCount; 351 var 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 374 begin 309 375 if FCounterSize > 0 then 310 376 begin 311 fstream := TFile( ParentFile).FileStream;377 fstream := TFile(FParentFile).FileStream; 312 378 fstream.Seek(Offset, soFromBeginning); 313 379 FBlockCount := 0; 314 380 fstream.Read(FBlockCount, FCounterSize); 315 381 end; 316 FTemplate := TBlock.Create(ParentFile, Self, '', '', []);317 end;318 319 function TArray.GetChildCount: Integer;320 begin321 Result := Length(FDataFields);322 end;323 324 function TArray.GetChild(ID: Integer): TTreeElement;325 begin326 Result := FDataFields[ID];327 end;328 329 function TArray.GetFieldByOffset(Offset: Integer): TDataField;330 begin331 Exit;332 end;333 334 procedure TArray.SetCount;335 var336 fid: Integer;337 arr_index: Integer;338 field: TDataField;339 begin340 382 FDataLength := FCounterSize; 341 383 if FBlockCount > 0 then … … 345 387 SetLength(FDataFields, arr_index + 1); 346 388 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); 356 399 end; 357 400 end; … … 361 404 362 405 procedure TArray.SetCount(n: Integer); 363 begin 364 FParentBlock.UpdateSize; 406 var 407 fstream: TMemoryStream; 408 begin 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; 365 417 end; 366 418 … … 680 732 end; 681 733 734 735 736 { TFloat } 737 738 constructor TFloat.Create(ParentFile: TObject; ParentBlock: TContainer; Name, 739 Description: String; ExtraArgs: array of const); 740 begin 741 inherited Create(ParentFile, ParentBlock, Name, Description, ExtraArgs); 742 FDataLength := 4; 743 FFloat := 0; 744 end; 745 746 function TFloat.GetValueAsString: String; 747 begin 748 Result := FloatToStr(FFloat); 749 end; 750 751 procedure TFloat.Update(Offset, Length: Integer); 752 var 753 fstream: TMemoryStream; 754 begin 755 fstream := TFile(FParentFile).FileStream; 756 fstream.Seek(FOffset, soFromBeginning); 757 fstream.Read(FFloat, FDataLength); 758 end; 759 760 682 761 end. -
oup/current/FileClasses/_Extensions.pas
r233 r237 17 17 constructor Create(ConnectionID: Integer; Ext: String); virtual; 18 18 procedure InitList; 19 property Ext: String read FExt; 19 20 end; 20 21 … … 48 49 function TExtension.GetCaption: String; 49 50 begin 50 Result := FExt ;51 Result := FExt + '[' + IntToStr(GetChildCount) + ']'; 51 52 end; 52 53 … … 100 101 function TExtensions.GetChild(ID: Integer): TTreeElement; 101 102 begin 103 FExtensions[ID].InitList; 102 104 Result := FExtensions[ID]; 103 105 end; … … 141 143 if Length(FExtensions) > 0 then 142 144 for i := 0 to High(FExtensions) do 143 if FExtensions[i]. GetCaption= Ext then145 if FExtensions[i].Ext = Ext then 144 146 begin 145 147 Result := FExtensions[i]; -
oup/current/FileClasses/_FileTypes.pas
r233 r237 12 12 function GetChild(ID: Integer): TTreeElement; override; 13 13 function GetCaption: String; override; 14 private15 FConnectionID: Integer;16 14 protected 17 15 FFileInfo: TFileInfo; -
oup/current/FileClasses/_MetaTypes.pas
r236 r237 5 5 uses 6 6 _FileTypes, _EmptyFile, _Unlinked, _DataTypes, _Extensions, _TreeElement, 7 TXAN, TXMP;7 AKVA, TXAN, TXMP; 8 8 // ABNA, AGDB, AGQC, AGQG, AGQM, AGQR, AISA, AITR, AIWA, AKAA, AKBA, AKBP, AKDA, 9 9 // AKEV, AKOT, AKVA, BINA, CBPI, CBPM, CONS, CRSA, DOOR, DPge, EDIA, ENVP, FILM, … … 32 32 33 33 const 34 FileDescs: array[0..1] of TFileDesc = ( 34 FileDescs: array[0..2] of TFileDesc = ( 35 (ext: 'AKVA'; ftype: TFile_AKVA), 35 36 (ext: 'TXAN'; ftype: TFile_TXAN), 36 37 (ext: 'TXMP'; ftype: TFile_TXMP) -
oup/current/OniUnPacker.bdsproj
r236 r237 176 176 <Language Name="ProjectLang">$00000000</Language> 177 177 <Language Name="RootDir"></Language> 178 </Language> 179 <Excluded_Packages> 178 </Language> <Excluded_Packages> 180 179 <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages> 181 180 </Excluded_Packages> -
oup/current/OniUnPacker.dpr
r236 r237 30 30 TXMP in 'FileClasses\TXMP.pas', 31 31 TXAN in 'FileClasses\TXAN.pas', 32 AKVA in 'FileClasses\AKVA.pas', 32 33 { 33 34 SUBT in 'FileClasses\SUBT.pas', … … 129 130 TStr in 'FileClasses\TStr.pas', 130 131 TURR in 'FileClasses\TURR.pas', 132 TXAN in 'FileClasses\TXAN.pas', 131 133 TXCA in 'FileClasses\TXCA.pas', 132 134 TXMA in 'FileClasses\TXMA.pas', 133 135 TXMB in 'FileClasses\TXMB.pas', 136 TXMP in 'FileClasses\TXMP.pas', 134 137 TXPC in 'FileClasses\TXPC.pas', 135 138 TxtC in 'FileClasses\TxtC.pas', -
oup/current/Tools/MetaEditor.dfm
r233 r237 64 64 item 65 65 Position = 3 66 Width = 150 66 67 WideText = 'Data' 67 68 end> -
oup/current/Tools/MetaEditor.pas
r236 r237 88 88 VST.Clear; 89 89 VST.BeginUpdate; 90 root := ConManager.Connection[FConnectionID].MetaData.Root; 90 // root := ConManager.Connection[FConnectionID].MetaData.Root; 91 root := ConManager.Connection[FConnectionID].MetaData.FileById[454]; 91 92 for i := 0 to root.ChildCount - 1 do 92 93 begin … … 111 112 data := Sender.GetNodeData(node); 112 113 Meta := ConManager.Connection[ConnectionID].MetaData; 113 if data.Field is TExtension then114 if TExtension(data.Field).ChildCount = 0 then115 TExtension(data.Field).InitList;116 114 117 115 if data.Field.ChildCount > 0 then
Note:
See TracChangeset
for help on using the changeset viewer.