1
0
Fork 0

Updated hud controls a bit:

"h" toggles between day/night/off
"H" cycles through black/dark/medium/light intensities.
This commit is contained in:
curt 2000-05-15 17:47:50 +00:00
parent 9dc5c9ca22
commit ed973e8993
3 changed files with 97 additions and 88 deletions

View file

@ -957,6 +957,20 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
int global_day_night_switch = DAY; 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 ) void HUD_brightkey( bool incr_bright )
{ {
instr_item *pHUDInstr = HUD_deque[0]; instr_item *pHUDInstr = HUD_deque[0];
@ -964,9 +978,10 @@ int brightness = pHUDInstr->get_brightness();
if( current_options.get_hud_status() ) { if( current_options.get_hud_status() ) {
if( incr_bright ) { if( incr_bright ) {
switch (brightness) { switch (brightness)
{
case BRT_LIGHT: case BRT_LIGHT:
current_options.set_hud_status(0); brightness = BRT_BLACK;
break; break;
case BRT_MEDIUM: case BRT_MEDIUM:
@ -984,9 +999,9 @@ int brightness = pHUDInstr->get_brightness();
default: default:
brightness = BRT_BLACK; brightness = BRT_BLACK;
} }
} } else {
else { switch (brightness)
switch (brightness) { {
case BRT_LIGHT: case BRT_LIGHT:
brightness = BRT_MEDIUM; brightness = BRT_MEDIUM;
break; break;
@ -1000,32 +1015,17 @@ int brightness = pHUDInstr->get_brightness();
break; break;
case BRT_BLACK: case BRT_BLACK:
brightness = BRT_LIGHT;
break;
default: default:
current_options.set_hud_status(0); 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,7 +1214,8 @@ void fgUpdateHUD( void ) {
} }
if( day_night_sw == DAY) { if( day_night_sw == DAY) {
switch (brightness) { switch (brightness)
{
case BRT_LIGHT: case BRT_LIGHT:
set_hud_color (0.1f, 0.9f, 0.1f); set_hud_color (0.1f, 0.9f, 0.1f);
break; break;
@ -1234,10 +1235,10 @@ void fgUpdateHUD( void ) {
default: default:
set_hud_color (0.1f, 0.9f, 0.1f); set_hud_color (0.1f, 0.9f, 0.1f);
} }
} } else {
else {
if( day_night_sw == NIGHT) { if( day_night_sw == NIGHT) {
switch (brightness) { switch (brightness)
{
case BRT_LIGHT: case BRT_LIGHT:
set_hud_color (0.9f, 0.1f, 0.1f); set_hud_color (0.9f, 0.1f, 0.1f);
break; break;
@ -1247,11 +1248,17 @@ void fgUpdateHUD( void ) {
break; break;
case BRT_DARK: 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: default:
set_hud_color (0.6f, 0.0f, 0.0f); set_hud_color (0.6f, 0.0f, 0.0f);
} }
} } else { // Just in case default
else { // Just in case default
set_hud_color (0.1f, 0.9f, 0.1f); set_hud_color (0.1f, 0.9f, 0.1f);
} }
} }

View file

@ -808,6 +808,7 @@ class HudLadder : public dual_instr_item {
//using namespace std; //using namespace std;
//deque <instr_item> * Hdeque_ptr; //deque <instr_item> * Hdeque_ptr;
extern void HUD_masterswitch( bool incr );
extern void HUD_brightkey( bool incr_bright ); extern void HUD_brightkey( bool incr_bright );
extern int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ ); extern int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
extern int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ ); extern int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ );

View file

@ -61,6 +61,7 @@
# include <Weather/weather.hxx> # include <Weather/weather.hxx>
#endif #endif
#include "bfi.hxx"
#include "keyboard.hxx" #include "keyboard.hxx"
#include "options.hxx" #include "options.hxx"
#include "save.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); controls.set_brake( FGControls::ALL_WHEELS, b_set);
return; return;
case 104: // h key case 104: // h key
HUD_brightkey( false ); HUD_masterswitch( true );
return; return;
case 105: // i key case 105: // i key
fgHUDInit(&current_aircraft); // normal HUD fgHUDInit(&current_aircraft); // normal HUD