- Timestamp:
- Jun 29, 2007, 7:23:56 PM (18 years ago)
- Location:
- oup/current
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/FileClasses/TXAN.pas
r233 r234 47 47 arrargs.CounterSize := 2; 48 48 arrargs.BlockLength := 4; 49 with AddField(TArray, $1C, 'AnimTextures array', '', @arrargs) do49 with TArray(AddField(TArray, $1C, 'AnimTextures array', '', @arrargs)) do 50 50 begin 51 51 AddField(TLinkByID, $00, 'Texture', '', nil); -
oup/current/FileClasses/_DataTypes.pas
r233 r234 281 281 function TArray.AddField(fieldtype: TFieldType; Offset: Integer; 282 282 Name, Description: String; ExtraArgs: Pointer): TDataField; 283 begin284 Exit;285 end;286 287 constructor TArray.Create(ParentFile: TObject; ParentField: TDataField;288 Offset: Integer; Name, Description: String; ExtraArgs: Pointer);289 283 var 290 284 i: Integer; 291 args: TArrayArgs; 292 fstream: TMemoryStream; 293 begin 294 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 295 args := TArrayArgs(ExtraArgs^); 296 if args.CounterSize > 0 then 297 begin 298 fstream := TFile(ParentFile).FileStream; 299 fstream.Seek(Offset, soFromBeginning); 300 args.BlockCount := 0; 301 fstream.Read(args.BlockCount, args.CounterSize); 302 end; 303 SetLength(FDataFields, args.BlockCount); 304 if Length(FDataFields) > 0 then 305 begin 306 for i := 0 to High(FDataFields) do 307 begin 308 FDataFields[i] := TBlock.Create(ParentFile, Self, 309 Offset + args.CounterSize + i * args.BlockLength, Name+'['+IntToStr(i)+']', '', @args.BlockLength); 310 end; 311 end; 312 end; 313 314 function TArray.GetChildCount: Integer; 315 begin 316 Result := Length(FDataFields); 317 end; 318 319 function TArray.GetChild(ID: Integer): TTreeElement; 320 begin 321 Result := FDataFields[ID]; 322 end; 323 324 function TArray.GetFieldByOffset(Offset: Integer): TDataField; 325 begin 326 Exit; 327 end; 328 329 procedure TArray.Update(Offset, Length: Integer); 330 begin 331 Exit; 332 end; 333 334 335 336 { TBlock } 337 338 function TBlock.AddField(fieldtype: TFieldType; Offset: Integer; Name, 339 Description: String; ExtraArgs: Pointer): TDataField; 340 var 341 i: Integer; 342 begin 285 begin 286 (* 343 287 if Length(FDataFields) > 0 then 344 288 begin … … 356 300 FParentFile, Self, Offset, Name, Description, ExtraArgs); 357 301 Result := FDataFields[High(FDataFields)]; 302 *) 303 end; 304 305 constructor TArray.Create(ParentFile: TObject; ParentField: TDataField; 306 Offset: Integer; Name, Description: String; ExtraArgs: Pointer); 307 var 308 i: Integer; 309 args: TArrayArgs; 310 fstream: TMemoryStream; 311 begin 312 inherited Create(ParentFile, ParentField, Offset, Name, Description, ExtraArgs); 313 args := TArrayArgs(ExtraArgs^); 314 if args.CounterSize > 0 then 315 begin 316 fstream := TFile(ParentFile).FileStream; 317 fstream.Seek(Offset, soFromBeginning); 318 args.BlockCount := 0; 319 fstream.Read(args.BlockCount, args.CounterSize); 320 end; 321 SetLength(FDataFields, args.BlockCount); 322 if Length(FDataFields) > 0 then 323 begin 324 for i := 0 to High(FDataFields) do 325 begin 326 FDataFields[i] := TBlock.Create(ParentFile, Self, 327 Offset + args.CounterSize + i * args.BlockLength, Name+'['+IntToStr(i)+']', '', @args.BlockLength); 328 end; 329 end; 330 end; 331 332 function TArray.GetChildCount: Integer; 333 begin 334 Result := Length(FDataFields); 335 end; 336 337 function TArray.GetChild(ID: Integer): TTreeElement; 338 begin 339 Result := FDataFields[ID]; 340 end; 341 342 function TArray.GetFieldByOffset(Offset: Integer): TDataField; 343 begin 344 Exit; 345 end; 346 347 procedure TArray.Update(Offset, Length: Integer); 348 begin 349 Exit; 350 end; 351 352 353 354 { TBlock } 355 356 function TBlock.AddField(fieldtype: TFieldType; Offset: Integer; Name, 357 Description: String; ExtraArgs: Pointer): TDataField; 358 var 359 i: Integer; 360 begin 361 if Length(FDataFields) > 0 then 362 begin 363 for i := 0 to High(FDataFields) do 364 if FDataFields[i].FOffset = Offset then 365 Break; 366 if i < Length(FDataFields) then 367 begin 368 ShowMessage('Field already exists'); 369 Exit; 370 end; 371 end; 372 SetLength(FDataFields, Length(FDataFields) + 1); 373 FDataFields[High(FDataFields)] := TFieldType(fieldtype).Create( 374 FParentFile, Self, Offset, Name, Description, ExtraArgs); 375 Result := FDataFields[High(FDataFields)]; 358 376 end; 359 377
Note:
See TracChangeset
for help on using the changeset viewer.