This topic includes the palette-related variables and palette files included in Flight Simulator, where the files are found, and how the files are loaded.
Note: You can't access all the variables and routines shown in this section; they are included here to give you an understanding of how colors are controlled in BGL scenery design.
Variables, Paths and File Names
pnlpaldb'panels\ xxxxxxxxx ';control panel file path with submittable name
fulpaldb'icons\splpal.pcx',0initgau.asm;path and name of splash screen palette
palette_namedg'12345678.123',0;name of currently loaded palette
Palette Buffers
haze_tabledb4096 dup(0)vgbpoly3;only if haze driver, else no buffer
pnl_paletteequgra_variablesw+70initgau.asm;control panel palette
db32*3 dup (0)global.asm
palettedb768 dup(0)initgau.asm;temporary palette buffer, used to load splash screen
vgb_palette db116*3 dup (0)vgbcol.asm;116 low colors
custom_colorsdb12*3 dup(presets);12 fixed preset colors
panel_colorsdb32*3 dup(0);32 panel colors
sky_colorsdb16*3 dup(presets);16 sky colors
ground_colorsdb16*3 dup(presets);16 ground colors
special_colorsdb64*3 dup(0);64 texture colors
vgb_colorsdb768 dup(0)vgbcol.asm;master pal buffer—sent to VGA board
white_cloud_colorsdb16*3 dup (presets)vgbcol.asm;16 sky hazing colors
overcast_cloud_colors dg16*3 dup (presets)vgbcol.asm;16 sky hazing colors
Control Variables
update_color_flagdw0vgbcol;flag to update color next screen toggle
file_numberdw0;front-end processsor's file list number
;where this palette file came from
color_rangedw0global;how many of top 64 colors (texture colors)
;should be time-adjusted
color_range_setdw0global;top 64-color status flag
;0=no action
;1=palette command set color_range to 64
;2=night_color_range command
set color_range to some value
Palette Initialization at 2-D Driver Load Time
STARTUP.ASM
INIT_PALETTE
vgb_palette (db 116*3 dup (0) vgbcol.asm) <----- texture\fs5pal;load low 116 colors
palette (db768 dup (0) initgau.asm) <----- icons\splpal;load splash screen palette into temp
[initgau.asm U2D_FULL_PALETTE]
vgb_colors (db 768 dup(0)) <----- palette;load splash scr pal into master pal buf
VGA color regs <----- vgb_colors;set VGA to master pal buffer
if haze driver, haze_table (db 4096 dup(0)) <---- fs5.haz;load haze table
[vgbpoly3.asm vgb_load_haze_table_far]
Control Panel Palette Load
PANEL PALETTE COMMAND IN .PNL FILE ACTION (initgau.asm) fill in pnlpal with panel file name
pnl_pal:
pnlpal <---- name of panel file to load;fill in panel palette name
U2D_PNL_PALETTE_FAR (initgau.asm)load pcx panel palette into 32 colors in pnl_palette
PCX2PAL (pnlpal);read pcx file name pnlpal into control panel byte
palette <---- 256-color pcx file palette
pnl_palette (32*3 bytes) <--- palette colors 128–159 (32 panel colors)
Texture Palette Load
The PALETTE command is used to load the 64 texture colors into the color buffers.
BGL_PALETTE (bgllight.asm) "Palette" instruction execution
color_range=64
if this "PALETTE" instruction's palette name is different from the one found in palette_name
palette_name=name from PALETTE instruction
G2D_LOAD_PALETTE_FAR (vgbcol.asm)
FE_GET_TEXTURE_ID (frontend.asm) with valid file_number, palette_name, "loading-a-palette"
flag set
vgb_palette.special_colors <------64*3 byte color values from file
TIME_CHANGE adjust colors for time-of-day effects vgb_colors <------time-of-day effects-------vgb_palette (from color 192, color_range=# or colors)
update_color_flag=1;load the vgb_colors to VGA color regs next screen toggle
color_range_set=1;"palette" commend set color_range to 64
G2D_LOAD_HAZE_TABLE_ID;load the haze table for this palette
Fixed Color Palette System for Night Effects
A command that enables you to set aside the last N colors in the texture color palette (upper 64-colors) is available. This means you can set up a fixed palette, which is useful for night effects. The set-aside colors will remain as loaded from the texture palette and won't change at dawn, dusk, and night. The commands that control the fixed color palette system are shown in the following example.
NIGHT_COLOR_RANGE;BGL command to set color_range to user's value
PALETTE;BGL command that sets loads palette and
;sets color_range to defult value of 64
NIGHT_COLOR_RANGE performs the following action:
BGL_FIXED_COLORS (bgllight.asm)Set the color_range to user's value
color_range=argument from command=color number in texture palette, beyond which not to adjust for night.
=64=adjust all colors
=60=don't adjust colors 60,61,62,63
if color_range_set=1;palette command has loaded and time-adjusted all 64 texture colors
color_range_set=2;night color range command requests colors from color_range to 64
;untouched
Variables:
color_rangeequg3d_variablesw+120;dw0
Actions:
NIGHT_COLOR_RANGE Command
BGL_FIXED_COLORS (bgllight.asm)Set the color_range to user's value
color_range=argument from command=color number in texture palette past which not to adjust for night.
if update_color_flag=1;palette command must have just loaded new palette
vgb_colors<-----colors from color_range to 64, direct copy, no mapping—vgb_palette
TIME_CHANGE (vgbcol.asm);executed by "PALETTE" command and at regular intervals when
;night/dawn/day/dusk/night transitions occur
ADJUST (vgbcol.asm)
for texture (colors 0 to color_range-1)
adjust intensity based on time of day
BGL_PALETTE (bgllight.asm)Set the color range to 64
color_range=64
VGA Palette Register Load at Frame Toggle Time
if update_color_flag !=0
UPDATE_COLORS (vgbcol.asm)
update_color_flag=0
if color_range_set=2
vgb_colors<----------color number (color_range+192) to 255--------vgb_palette
color_range_set=0
vga board color regs<-------vgb_colors
This preceding action is triggered by the following events, in order: