Code:
// read buildings
BlockRead(MapFile,ItemCount,sizeof(integer));
for i := 1 to ItemCount do
begin
new(BuildingItem);
BlockRead(MapFile,BuildingItem^.PosX,sizeof(integer)); // PosX
BlockRead(MapFile,BuildingItem^.PosY,sizeof(integer)); // PosY
BlockRead(MapFile,BuildingItem^.Angle,sizeof(integer)); // Angle
BlockRead(MapFile,BuildingItem^.BuildingType,sizeof(integer)); // type
BlockRead(MapFile,BuildingItem^.Destroyable,sizeof(boolean)); // Is it destroyable?
BlockRead(MapFile,Size,SizeOf(Integer));
SetLength(TmpString,Size);
BlockRead(MapFile,TmpString[1],Size);
BuildingItem^.DestroyOn := TmpString; // triggeraction that destroys the building
BlockRead(MapFile,Size,SizeOf(Integer));
SetLength(TmpString,Size);
BlockRead(MapFile,TmpString[1],Size);
BuildingItem^.OpenOn := TmpString; // For gates only (Triggeraction that opens Gate)
BlockRead(MapFile,BuildingItem^.Active,sizeof(boolean)); // Is it active (atm radar only)?
BlockRead(MapFile,Size,SizeOf(Integer));
SetLength(TmpString,Size);
BlockRead(MapFile,TmpString[1],Size);
BuildingItem^.ActivateOn := TmpString; // Triggeraction that activates building (radar only atm)
// Read Dummy 1
BlockRead(MapFile,Size,SizeOf(Integer));
SetLength(TmpString,Size);
BlockRead(MapFile,TmpString[1],Size);
BuildingItem^.Dummy1 := TmpString; // For future implementations
// Read Dummy 2
BlockRead(MapFile,BuildingItem^.Dummy2,sizeof(integer));// For future implementations
// Read Dummy 3
BlockRead(MapFile,BuildingItem^.Dummy3,sizeof(integer));// For future implementations
// Read Dummy 4
BlockRead(MapFile,BuildingItem^.Dummy4,sizeof(integer));// For future implementations
// Read Dummy 5
BlockRead(MapFile,BuildingItem^.Dummy5,sizeof(boolean));// For future implementations
BuildingList.Add(BuildingItem);
end;
This is the code to read building data from level file. It is nearly exactly the way WILL described, so I think there is no need to change it for IGF now. We can add things to the editor which are unused yet, and I am also able to convert old level data to new level data if there is any need. All other things will cost too much time now.
Bookmarks