From ed973e8993678a7f3874ea46c89cb40991895dc4 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 15 May 2000 17:47:50 +0000 Subject: [PATCH] Updated hud controls a bit: "h" toggles between day/night/off "H" cycles through black/dark/medium/light intensities. --- src/Cockpit/hud.cxx | 181 ++++++++++++++++++++++-------------------- src/Cockpit/hud.hxx | 1 + src/Main/keyboard.cxx | 3 +- 3 files changed, 97 insertions(+), 88 deletions(-) diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index bf731e42c..75af7a767 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -957,76 +957,76 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ ) int global_day_night_switch = DAY; +void HUD_masterswitch( bool incr ) +{ + if ( current_options.get_hud_status() ) { + if ( global_day_night_switch == DAY ) { + global_day_night_switch = NIGHT; + } else { + current_options.set_hud_status( false ); + } + } else { + current_options.set_hud_status( true ); + global_day_night_switch = DAY; + } +} + void HUD_brightkey( bool incr_bright ) { -instr_item *pHUDInstr = HUD_deque[0]; -int brightness = pHUDInstr->get_brightness(); + instr_item *pHUDInstr = HUD_deque[0]; + int brightness = pHUDInstr->get_brightness(); - if( current_options.get_hud_status() ) { - if( incr_bright ) { - switch (brightness) { - case BRT_LIGHT: - current_options.set_hud_status(0); - break; + if( current_options.get_hud_status() ) { + if( incr_bright ) { + switch (brightness) + { + case BRT_LIGHT: + brightness = BRT_BLACK; + break; - case BRT_MEDIUM: - brightness = BRT_LIGHT; - break; + case BRT_MEDIUM: + brightness = BRT_LIGHT; + break; - case BRT_DARK: - brightness = BRT_MEDIUM; - break; + case BRT_DARK: + brightness = BRT_MEDIUM; + break; - case BRT_BLACK: - brightness = BRT_DARK; - break; + case BRT_BLACK: + brightness = BRT_DARK; + break; - default: - brightness = BRT_BLACK; - } - } - else { - switch (brightness) { - case BRT_LIGHT: - brightness = BRT_MEDIUM; - break; + default: + brightness = BRT_BLACK; + } + } else { + switch (brightness) + { + case BRT_LIGHT: + brightness = BRT_MEDIUM; + break; - case BRT_MEDIUM: - brightness = BRT_DARK; - break; + case BRT_MEDIUM: + brightness = BRT_DARK; + break; - case BRT_DARK: - brightness = BRT_BLACK; - break; + case BRT_DARK: + brightness = BRT_BLACK; + break; - case BRT_BLACK: - default: - current_options.set_hud_status(0); - } - } + case BRT_BLACK: + brightness = BRT_LIGHT; + break; + + default: + current_options.set_hud_status(0); + } + } + } else { + current_options.set_hud_status(true); } - else { - current_options.set_hud_status(1); - if( incr_bright ) { - if( DAY == global_day_night_switch ) { - brightness = BRT_BLACK; - } - else { - brightness = BRT_DARK; - global_day_night_switch = DAY; - } - } - else { - if( NIGHT == global_day_night_switch ) { - brightness = BRT_DARK; - } - else { - brightness = BRT_MEDIUM; - global_day_night_switch = NIGHT; - } - } - } - pHUDInstr->SetBrightness( brightness ); + + pHUDInstr->SetBrightness( brightness ); } @@ -1214,46 +1214,53 @@ void fgUpdateHUD( void ) { } if( day_night_sw == DAY) { - switch (brightness) { - case BRT_LIGHT: - set_hud_color (0.1f, 0.9f, 0.1f); - break; + switch (brightness) + { + case BRT_LIGHT: + set_hud_color (0.1f, 0.9f, 0.1f); + break; case BRT_MEDIUM: - set_hud_color (0.1f, 0.7f, 0.0f); - break; + set_hud_color (0.1f, 0.7f, 0.0f); + break; case BRT_DARK: - set_hud_color (0.0f, 0.6f, 0.0f); - break; + set_hud_color (0.0f, 0.6f, 0.0f); + break; case BRT_BLACK: - set_hud_color( 0.0f, 0.0f, 0.0f); - break; + set_hud_color( 0.0f, 0.0f, 0.0f); + break; default: - set_hud_color (0.1f, 0.9f, 0.1f); + set_hud_color (0.1f, 0.9f, 0.1f); } - } - else { - if( day_night_sw == NIGHT) { - switch (brightness) { - case BRT_LIGHT: - set_hud_color (0.9f, 0.1f, 0.1f); - break; + } else { + if( day_night_sw == NIGHT) { + switch (brightness) + { + case BRT_LIGHT: + set_hud_color (0.9f, 0.1f, 0.1f); + break; case BRT_MEDIUM: - set_hud_color (0.7f, 0.0f, 0.1f); - break; + set_hud_color (0.7f, 0.0f, 0.1f); + break; - case BRT_DARK: - default: - set_hud_color (0.6f, 0.0f, 0.0f); - } - } - else { // Just in case default - set_hud_color (0.1f, 0.9f, 0.1f); - } + case BRT_DARK: + set_hud_color (0.6f, 0.0f, 0.0f); + break; + + case BRT_BLACK: + set_hud_color( 0.0f, 0.0f, 0.0f); + break; + + default: + set_hud_color (0.6f, 0.0f, 0.0f); + } + } else { // Just in case default + set_hud_color (0.1f, 0.9f, 0.1f); + } } deque < instr_item * > :: iterator current = HUD_deque.begin(); diff --git a/src/Cockpit/hud.hxx b/src/Cockpit/hud.hxx index eca76161b..51274c042 100644 --- a/src/Cockpit/hud.hxx +++ b/src/Cockpit/hud.hxx @@ -808,6 +808,7 @@ class HudLadder : public dual_instr_item { //using namespace std; //deque * Hdeque_ptr; +extern void HUD_masterswitch( bool incr ); extern void HUD_brightkey( bool incr_bright ); extern int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ ); extern int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ ); diff --git a/src/Main/keyboard.cxx b/src/Main/keyboard.cxx index a7c84a3db..0de603d46 100644 --- a/src/Main/keyboard.cxx +++ b/src/Main/keyboard.cxx @@ -61,6 +61,7 @@ # include #endif +#include "bfi.hxx" #include "keyboard.hxx" #include "options.hxx" #include "save.hxx" @@ -320,7 +321,7 @@ void GLUTkey(unsigned char k, int x, int y) { controls.set_brake( FGControls::ALL_WHEELS, b_set); return; case 104: // h key - HUD_brightkey( false ); + HUD_masterswitch( true ); return; case 105: // i key fgHUDInit(¤t_aircraft); // normal HUD