From 5586d12e265c1421eeb75cab8aed4536c9ef51c3 Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 5 Feb 2002 23:02:16 +0000 Subject: [PATCH] Fixes for default chase view values. --- src/GUI/sgVec3Slider.cxx | 14 +++++++++++--- src/GUI/sgVec3Slider.hxx | 41 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/GUI/sgVec3Slider.cxx b/src/GUI/sgVec3Slider.cxx index 412237281..3ef12ba16 100644 --- a/src/GUI/sgVec3Slider.cxx +++ b/src/GUI/sgVec3Slider.cxx @@ -286,8 +286,7 @@ sgVec3Slider::sgVec3Slider ( int x, int y, sgVec3 vec, const char *title, dialer_x = dialer_x + 170; /* pitch */ - // HS1 = new FloatDial ( dialer_x, dialer_y, dialer_size, vec[1], Ytitle, 89.99f, -89.99f ); - HS1 = new FloatDial ( dialer_x, dialer_y, dialer_size, vec[1], Ytitle, 179.99f, -179.99f ); + HS1 = new FloatDial ( dialer_x, dialer_y, dialer_size, vec[1], Ytitle, 89.99f, -89.99f ); /* radius */ HS2 = new FloatSlider ( slider_x, slider_y, slider_width, vec[2], Ztitle, 100.0f, 0.0f ); @@ -367,6 +366,7 @@ void PilotOffsetInit() { fgGetFloat("/sim/view[1]/default/pilot-offset/pitch-deg"), fgGetFloat("/sim/view[1]/default/pilot-offset/radius-m") ); + PilotOffsetInit(v); } @@ -374,8 +374,16 @@ void PilotOffsetInit( sgVec3 vec ) { // Only one of these things for now if( PO_vec == 0 ) { - sgVec3Slider *PO = new sgVec3Slider ( 200, 200, vec, "Pilot Offset" ); + /* make change so this gets done once for each vector */ + fgSetFloat("/sim/view[1]/current/pilot-offset/heading-deg",fgGetFloat("/sim/view[1]/default/pilot-offset/heading-deg")); + fgSetFloat("/sim/view[1]/current/pilot-offset/pitch-deg",fgGetFloat("/sim/view[1]/default/pilot-offset/pitch-deg")); + fgSetFloat("/sim/view[1]/current/pilot-offset/radius-m",fgGetFloat("/sim/view[1]/default/pilot-offset/radius-m")); + sgVec3Slider *PO = new sgVec3Slider ( 200, 200, vec, "Pilot Offset" ); PO_vec = PO; + // Bindings for Pilot Offset + fgTie("/sim/view[1]/current/pilot-offset/heading-deg", getPilotOffsetHeadingDeg, setPilotOffsetHeadingDeg); + fgTie("/sim/view[1]/current/pilot-offset/pitch-deg", getPilotOffsetPitchDeg, setPilotOffsetPitchDeg); + fgTie("/sim/view[1]/current/pilot-offset/radius-m", getPilotOffsetRadiusM, setPilotOffsetRadiusM); } } diff --git a/src/GUI/sgVec3Slider.hxx b/src/GUI/sgVec3Slider.hxx index 0d694a2e2..448b830d1 100644 --- a/src/GUI/sgVec3Slider.hxx +++ b/src/GUI/sgVec3Slider.hxx @@ -24,3 +24,44 @@ void PilotOffsetSet( int opt, float setting); float PilotOffsetGetSetting( int opt ); #endif // _VEC3_SLIDER_H + +/* binding functions for chase view offset */ + +static void +setPilotOffsetHeadingDeg (float value) +{ + PilotOffsetSet(0, value); +} + +static float +getPilotOffsetHeadingDeg () +{ + return( PilotOffsetGetSetting(0) ); +} + + +static void +setPilotOffsetPitchDeg (float value) +{ + PilotOffsetSet(1, value); +} + +static float +getPilotOffsetPitchDeg () +{ + return( PilotOffsetGetSetting(1) ); +} + + +static void +setPilotOffsetRadiusM (float value) +{ + PilotOffsetSet(2, value); +} + +static float +getPilotOffsetRadiusM () +{ + return( PilotOffsetGetSetting(2) ); +} +