BGL scenery consists of a large number of BGL files that cover large geographic areas. Flight Simulator has a facilities directory system that includes all the scenery locations, airports, and enables you to locate those airports. (Flight Simulator enables the user to index this information through a text database.) The best place to put this information is within the scenery files that contain scenery for a given area (rather than maintaining a big list in some other location). If you do this, the facilities directory system can scan through all BGL files and compile a list of scenery that’s currently available.
The FACILITIES_DATA data section contains facilities information used by the facilities directory system. This data is broken down into a two-level system. The actual definition of these levels is determined by the facilities directory system; the top level represents a state, and the lower level represents a city within the state. All the facilities opcodes are specified around the city-and-state metaphor. The following example shows the layout of facilities information.
;DATABASE HEADER ********************************************************
dw0001;00 world set number (not saved to file list)
;0=off 1=fs5 default world
dd000490000h;02 N bound meter units
dd0003f0000h;06 S bound
dd0cf000000h;10 E bound 32-bit pseudodegrees
dd0bf000000h;14 W bound
ddVOR_DATA;18 VOR_DATA
dw50;22 lowest vor freq (channel 0–199)
dw50;24 highest vor freq (108.00–117.95)
ddSYNTH_SEEDS_08;26 seeds level 8
dd0;SYNTH_SEEDS_09;30 seeds level 9
dd0;SYNTH_SEEDS_10;34 seeds level 10
dd0;SYNTH_SEEDS_11;38 seeds level 11
dd0;SYNTH_SEEDS_12;42 seeds level 12
dd0;SYNTH_SEEDS_13;46 seeds level 13
dd0;SYNTH_SEEDS_14;50 seeds level 14
dd0;54 seeds level 15
ddOBJECT_DATA;58 OBJECT_DATA
dd0;62 LIBRARY_DATA
dd0;FACILITIES_DATA;66 FACILITIES_DATA
dd0;70 ANCHOR POINT DATA
FACILITIES_DATA:
rel_base=FACILITIES_DATA
COUNTRY'USA-Illinois',ill_STATEs
COUNTRY 'USA-California',cal_STATEs
EOL
;The two entries for Meigs that are commented out have runway altitude MSL.
;(1/256 meters)!. The two commented in have altitude AGL (1/256 meters)!
ill_STATEs:
;"Airport - Runway Name",Latitude ,Longitude ,Alt. ,Head,COM1 ,NAV1 ,OBS,NAV2 ,OBS
STATE"Chicago, Meigs Runway 36",237c2500h,0c1b40ae3h,46080,00000,2130h,1420h,355,1390h,121
STATE"Synthberg, Rural Rt. 11",20aff580h,0c1873b92h,46080,00000,2130h,1420h,355,1390h,121
EOL
cal_STATEs:
STATE"Santa Monica, Santa Monica 27L",52232,123754,23432,0,2485h,1000h,0,1100,0
EOL
In the preceding example, the scenery in the BGL file includes some data for areas in Illinois and California. The FACILITIES_DATA pointer at address 66 in the database header refers to the facilities data. The FACILITIES_DATA section begins by setting the rel_base. A country list is the first item in the facilities data section. Country entities for each area (in this case the two states) are put in the list, followed by an EOL command that specifies the end of the list.
The COUNTRY entity is a variable-sized command as shown in the following example. The first word in the entity is a size word that specifies how big the country is, so that the system that scans it knows where the instruction ends. The second item is a pointer to a list of STATE entities associated with this country. The final item in the COUNTRY entity is the name string, an ASCII string followed by a 0 (and asciiz string). This string can be any size (limited only by the 65K limit). The following example includes two text entities that result in the text shown in the facilities directory.
USA - Illinois
USA - California
;FACILITIES LOCATOR DATA*************************************************
;OBJECT ENTITY OPCODE DEFINITIONS -
;OpFormatDefinition
;-----------------------------------------------------------------
;1db 1COUNTRY
;(see macro below)
;3db 3STATE
;(see macro below)
COUNTRYmacroname_ascii,pointer
localopcode,endop
opcode:db01;;opcode
dwendop-opcode;;entity size
ddpointer-rel_base;;pointer to state info
dbname_ascii,0
endop:
endm
STATEmacroname_ascii,lat,lon,alt,heading,com1,nav1,obi1,nav2,obi2
localopcode,endop
opcode:db03;;opcode
dwendop-opcode;;entity size
ddlat;;latitude1/128 meter
ddlon;;longitude32-bit pseudodegrees
ddalt;;alt msl1/256 meter
dwheading;;heading16-bit pseudodegrees
dwcom1;;com1 freq4-digit packed bcd
dwnav1;;nav1 freq4-digit packed bcd
dwobi1;;angle degrees
dwnav2;;nav2 freq4-digit packed bcd
dwobi2;;angle degrees
dbname_ascii,0;;state nameasciiz
endop:
endm
The list of state entities specifies text that details each state feature. The STATE entity is primarily concerned with airports and contains arguments not only for latitude/longitude/altitude locations, but also a heading that places the airplane at the right direction if moved to the specified location (pointing down a runway, for example), NAV and COM frequencies for this airport, and an ASCIIZ string that defines the name of this feature. For example, if USA - Illinois is chosen in the Facilities directory (shown in an earlier example in this topic), the result is the following list.
Chicago, Meigs Runway 36
Synthberg, Rural Rt. 11
For another example, if Chicago, Meigs Runway 36 is chosen as the destination, the facilities locator system places the plane at the airport specified, on the runway, heading in the appropriate direction, with all radios tuned to the appropriate NAV and COM frequencies specified in the STATE command.