]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel.cxx
Updates from David Megginson.
[flightgear.git] / src / Cockpit / panel.cxx
index 8cfc864a892987f6e092786feb9b1c1a00df9a39..6825dca4ea4aba53f27daac554c54399837725ed 100644 (file)
@@ -32,7 +32,7 @@
 #include <plib/fnt.h>
 
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/fgpath.hxx>
+#include <simgear/misc/sg_path.hxx>
 
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
@@ -46,7 +46,8 @@
 bool
 fgPanelVisible ()
 {
-  return ((globals->get_options()->get_panel_status()) &&
+  return ((current_panel != 0) &&
+         (current_panel->getVisibility()) &&
          (globals->get_viewmgr()->get_current() == 0) &&
          (globals->get_current_view()->get_view_offset() == 0.0));
 }
@@ -65,7 +66,7 @@ FGTextureManager::createTexture (const string &relativePath)
   ssgTexture * texture = _textureMap[relativePath];
   if (texture == 0) {
     cerr << "Texture " << relativePath << " does not yet exist" << endl;
-    FGPath tpath(globals->get_options()->get_fg_root());
+    SGPath tpath(globals->get_fg_root());
     tpath.append(relativePath);
     texture = new ssgTexture((char *)tpath.c_str(), false, false);
     _textureMap[relativePath] = texture;
@@ -237,7 +238,7 @@ FGPanel::update ()
   glEnable(GL_ALPHA_TEST);
   glEnable(GL_COLOR_MATERIAL);
   // glColor4f(1.0, 1.0, 1.0, 1.0);
-  if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) {
+  if ( cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES < 95.0 ) {
       glColor4fv( cur_light_params.scene_diffuse );
   } else {
       glColor4f(0.7, 0.2, 0.2, 1.0);
@@ -342,8 +343,8 @@ FGPanel::doMouseAction (int button, int updown, int x, int y)
   }
 
                                // Scale for the real window size.
-  x = int(((float)x / globals->get_options()->get_xsize()) * _winw);
-  y = int(_winh - (((float)y / globals->get_options()->get_ysize())
+  x = int(((float)x / fgGetInt("/sim/startup/xsize")) * _winw);
+  y = int(_winh - (((float)y / fgGetInt("/sim/startup/ysize"))
                   * _winh));
 
                                // Adjust for offsets.
@@ -475,6 +476,7 @@ FGToggleAction::doAction ()
 ////////////////////////////////////////////////////////////////////////
 
 FGPanelTransformation::FGPanelTransformation ()
+  : table(0)
 {
 }
 
@@ -663,7 +665,11 @@ FGInstrumentLayer::transform () const
     } else if (val > t->max) {
       val = t->max;
     }
-    val = val * t->factor + t->offset;
+    if(t->table==0) {
+       val = val * t->factor + t->offset;
+    } else {
+       val = t->table->interpolate(val) * t->factor + t->offset;
+    }
 
     switch (t->type) {
     case FGPanelTransformation::XSHIFT:
@@ -717,7 +723,7 @@ FGTexturedLayer::draw ()
 
                                // From Curt: turn on the panel
                                // lights after sundown.
-  if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) {
+  if ( cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES < 95.0 ) {
       glColor4fv( cur_light_params.scene_diffuse );
   } else {
       glColor4f(0.7, 0.2, 0.2, 1.0);