As seen in examples of BGL code in this SDK, constants, such as S_16
, and variables, such as crash
are used in BGL code. This topic covers where BGL variables and constants come from and how you can start using them in your own BGL scenery files.
Note: Constants and variable definitions are contained primarily in the files briefly described in this topic. For details of all of the variables you can use in BGL, see the topic Flight Simulator Variables Available to BGL.
BGL constants are found in the file fs5_map.inc. This file is an include file that contains assembly language equates that substitute hard-coded constant variable addresses for variable names. You can include fs5_map.inc at the beginning of your scenery design file or in your Flight Simulator application module that contains embedded BGL code that references these variables. The following example shows a small portion of fs5_map.inc.
altmslequ00280h
beacntequ00282h
crashequ00284h
radflgequ00286h
rpfuelequ00288h
version_identequ0028ah
todequ0028ch
wngcolequ0028eh
.
about 1600 addresses in all
Notice that the variable crash
comes from this file and is equated to 0284h. In earlier versions of Flight Simulator, this address used to be an absolute offset into a global area called ROOTVAR (root variables area). In the current version of Flight Simulator, the variables aren't located at these address offsets; instead, the variables are located in a table in Bglvar.asm called fs5var_to_fs6. This table used to translate the variables to the correct 32-bit address that is now used. These addresses are legacy addresses and are maintained for compatibility with existing scenery; there are approximately 1600 of these constants.