Horizon generator code is included in the file Enviro.asm. The horizon generator is run from the file Indwind.asm as soon as the Flight Simulator window is opened. The horizon generator module contains multiple BGL databases that are executed conditionally, depending on cloud levels, display options that are set (for example, textured or gradient earth and sky), whisping, and map view. The following example shows horizon generator code.
Variables:generate_horizondw0;0=generate, 1=scenery will do it (global.asm)
seed8_scaledw0,0;scale factor computed based on level 8 seed we're over
seed8_lat/londw0,0,0;lat/lon of SW corner of level 8 seed we're over
seed8_altdw0,0,0;altitude of level 8 seed we're over
sky_typedw0;0=simple or gouraud, 1=texture
texture_availdw0;0=last texture command didn't work 1= it worked
The following table describes how clouds are generated in BGL.
View | BGL database | Pre-BGL action | BGL action |
Map view | gouraud_ground | texture_ground_scale =seed8_scale | setcolor 69b0h; SURFACE 9,10,8,7 |
gradient_sky | draw_gradient_sky: GSURF 1,2,3,4 |
||
3-D window | if generate_horizon .nz. gouraud_ground |
texture_ground_scale = seed8_scale | setcolor 69b0h |
if no clouds or above both cloud layers, or above layer 1 with no layer 2 present, then gradient_sky | draw_gradient_sky: |
||
if under layer 1, with no layer 2, under_cloud_1 |
VSCALE cloud_lat_1 |
||
if between layers, under_cloud_2 | VSCALE cloud_lat_2 |
||
if under active layers 1 and 2, under_cloud_2 special_cloud_1 |