]> git.mxchange.org Git - flightgear.git/commitdiff
remove readLadder(const SGPropertyNode *) and make the HudLadder
authormfranz <mfranz>
Wed, 14 Jun 2006 12:49:27 +0000 (12:49 +0000)
committermfranz <mfranz>
Wed, 14 Jun 2006 12:49:27 +0000 (12:49 +0000)
constructor read its properties on its own

src/Cockpit/hud.cxx
src/Cockpit/hud.hxx
src/Cockpit/hud_ladr.cxx

index fa795c535a5134d18fe2b75de7914fb30564b311..45a25f0cda03bfa9c3e8b568cf865c94108eeb5e 100644 (file)
@@ -91,12 +91,7 @@ static int     x;
 static int     y;
 static UINT    width;
 static UINT    height;
-static float   factor;
 static float   span_units;
-static float   division_units;
-static float   minor_division = 0;
-static UINT    screen_hole;
-static UINT    lbl_pos;
 static bool    working;
 static string  loadfn;
 static UINT    options;
@@ -129,17 +124,6 @@ static float   marker_off;
 static string  type;
 static bool    enable_pointer;
 static string  type_pointer;
-static bool    frl_spot;
-static bool    target;
-static bool    vel_vector;
-static bool    drift;
-static bool    alpha;
-static bool    energy;
-static bool    climb_dive;
-static bool    glide;
-static float   glide_slope_val;
-static bool    worm_energy;
-static bool    waypoint;
 static string  type_tick;
 static string  length_tick;
 static bool    label_box;
@@ -147,9 +131,6 @@ static int     digits;
 static float   radius;
 static int     divisions;
 static int     zoom;
-static int     zenith;
-static int     nadir ;
-static int     hat;
 static bool    tsi;
 static float   rad;
 
@@ -161,7 +142,6 @@ static const char *post_label_string = 0;
 
 int readHud( istream &input );
 int readInstrument ( const SGPropertyNode * node);
-static instr_item * readLadder ( const SGPropertyNode * node);
 static instr_item * readCard ( const SGPropertyNode * node);
 static instr_item * readLabel( const SGPropertyNode * node);
 static instr_item * readTBI( const SGPropertyNode * node);
@@ -175,7 +155,7 @@ public:
     RECT rect;
 
     locRECT( UINT left, UINT top, UINT right, UINT bottom);
-    RECT get_rect(void) { return rect;}
+    RECT get_rect(void) { return rect; }
 };
 
 locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
@@ -198,65 +178,6 @@ locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
 // mustange and the engine readouts of a B36!
 //
 
-#define INSTRDEFS 21
-
-//$$$ begin - added, Neetha, 28 Nov 2k
-static instr_item *
-readLadder(const SGPropertyNode * node)
-{
-
-    instr_item *p;
-
-    name               = node->getStringValue("name");
-    x                  = node->getIntValue("x");
-    y                  = node->getIntValue("y");
-    width              = node->getIntValue("width");
-    height             = node->getIntValue("height");
-    factor             = node->getFloatValue("compression_factor");
-    span_units         = node->getFloatValue("span_units");
-    division_units     = node->getFloatValue("division_units");
-    screen_hole        = node->getIntValue("screen_hole");
-    lbl_pos            = node->getIntValue("lbl_pos");
-    frl_spot           = node->getBoolValue("enable_frl",false);
-    target             = node->getBoolValue("enable_target_spot",false);
-    vel_vector         = node->getBoolValue("enable_velocity_vector",false);
-    drift              = node->getBoolValue("enable_drift_marker",false);
-    alpha              = node->getBoolValue("enable_alpha_bracket",false);
-    energy             = node->getBoolValue("enable_energy_marker",false);
-    climb_dive         = node->getBoolValue("enable_climb_dive_marker",false);
-    glide              = node->getBoolValue("enable_glide_slope_marker",false);
-    glide_slope_val    = node->getFloatValue("glide_slope",-4.0);
-    worm_energy        = node->getBoolValue("enable_energy_marker",false);
-    waypoint           = node->getBoolValue("enable_waypoint_marker",false);
-    working            = node->getBoolValue("working");
-    zenith             = node->getIntValue("zenith");
-    nadir              = node->getIntValue("nadir");
-    hat                = node->getIntValue("hat");
-    // The factor assumes a base of 55 degrees per 640 pixels.
-    // Invert to convert the "compression" factor to a
-    // pixels-per-degree number.
-    if (fgGetBool("/sim/hud/enable3d", true)) {
-        if (HUD_style == 1) {
-            factor = 1;
-            factor = (640./55.) / factor;
-        }
-    }
-
-    SG_LOG(SG_INPUT, SG_INFO, "Done reading instrument " << name);
-
-    p = (instr_item *) new HudLadder( name, x, y,
-                                      width, height, factor,
-                                      get_roll, get_pitch,
-                                      span_units, division_units, minor_division,
-                                      screen_hole, lbl_pos, frl_spot, target, vel_vector,
-                                      drift, alpha, energy, climb_dive,
-                                      glide, glide_slope_val, worm_energy,
-                                      waypoint, working, zenith, nadir, hat);
-
-    return p;
-
-} //end readLadder
-
 static instr_item *
 readCard(const SGPropertyNode * node)
 {
@@ -621,7 +542,7 @@ int readInstrument(const SGPropertyNode * node)
         int nLadders = ladder_group->nChildren();
         for (int j = 0; j < nLadders; j++) {
 
-            HIptr = readLadder(ladder_group->getChild(j));
+            HIptr = static_cast<instr_item *>(new HudLadder(ladder_group->getChild(j)));
             HUD_deque.insert( HUD_deque.begin(), HIptr);
 
         }// for - ladders
index 7765c4648734d2ec04ee530524f413555dfa8a33..1d7a333be7d025db2a1ab023ab615829af83adf4 100644 (file)
@@ -51,6 +51,7 @@
 #include STL_FSTREAM
 
 #include <simgear/constants.h>
+//#include <simgear/props/props.hxx>
 
 #include <Include/fg_typedefs.h>
 #include <Aircraft/aircraft.hxx>
@@ -900,6 +901,7 @@ public:
 
 typedef fgTBI_instr * pTBI;
 
+
 class HudLadder : public dual_instr_item {
 private:
     UINT   width_units;
@@ -926,64 +928,32 @@ private:
     int    nadir;
     int    hat;
 
-
     // The Ladder has it's own temporary display lists
     fgTextList         TextList;
     fgLineList         LineList;
     fgLineList         StippleLineList;
 
 public:
-    HudLadder( const string&    name,
-               int       x,
-               int       y,
-               UINT      width,
-               UINT      height,
-               float     factor,
-               FLTFNPTR  ptch_source,
-               FLTFNPTR  roll_source,
-               float     span_units,
-               float     division_units,
-               float     minor_division,
-               UINT      screen_hole,
-               UINT      lbl_pos,
-               bool      frl,
-               bool      target_spot,
-               bool      velocity_vector,
-               bool      drift_marker,
-               bool      alpha_bracket,
-               bool      energy_marker,
-               bool      climb_dive_marker,
-               bool      glide_slope_marker,
-               float     glide_slope,
-               bool      energy_worm,
-               bool      waypoint_marker,
-               bool      working,
-               int       zenith,
-               int       nadir,
-               int       hat
-             );
-
-
+    HudLadder(const SGPropertyNode *);
     ~HudLadder();
 
-    HudLadder( const HudLadder & image );
-    virtual void draw( void );
-    void drawZenith(float,float,float);
+    virtual void draw(void);
+    void drawZenith(float, float, float);
     void drawNadir(float, float, float);
 
-    void Text( float x, float y, char *s)
+    void Text(float x, float y, char *s)
     {
-        TextList.add( fgText( x, y, s) );
+        TextList.add(fgText(x, y, s));
     }
 
-    void Line( float x1, float y1, float x2, float y2)
+    void Line(float x1, float y1, float x2, float y2)
     {
-        LineList.add(fgLineSeg2D(x1,y1,x2,y2));
+        LineList.add(fgLineSeg2D(x1, y1, x2, y2));
     }
 
-    void StippleLine( float x1, float y1, float x2, float y2)
+    void StippleLine(float x1, float y1, float x2, float y2)
     {
-        StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
+        StippleLineList.add(fgLineSeg2D(x1, y1, x2, y2));
     }
 };
 
index 09a4070a343653a72a8592c540331a966dc71c86..4b3a881727b5eff0a4c9f6da0f94acfe0f8a9915 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #endif
@@ -9,95 +8,60 @@
 #include "panel.hxx"
 
 
-//====================== Top of HudLadder Class =======================
-HudLadder::HudLadder(const string& name,
-                     int      x,
-                     int      y,
-                     UINT     width,
-                     UINT     height,
-                     float    factr,
-                     FLTFNPTR ptch_source,
-                     FLTFNPTR roll_source,
-                     float    span_units,
-                     float    major_div,
-                     float    minor_div,
-                     UINT     screen_hole,
-                     UINT     lbl_pos,
-                     bool     frl_spot,
-                     bool     target,
-                     bool     vel_vec,
-                     bool     drift,
-                     bool     alpha,
-                     bool     energy,
-                     bool     climb,
-                     bool     glide,
-                     float    glide_slope_val,
-                     bool     worm_energy,
-                     bool     waypoint,
-                     bool     working,
-                     int      zenithsymbol,
-                     int      nadirsymbol,
-                     int      hat_marker) :
-    dual_instr_item( x, y, width, height,
-                     ptch_source, roll_source, working, HUDS_RIGHT),
-    width_units         ( (int)(span_units) ),
-    div_units           ( (int)(major_div < 0? -major_div: major_div) ),
-    minor_div           ( (int)(minor_div) ),
-    label_pos           ( lbl_pos      ),
-    scr_hole            ( screen_hole  ),
-    vmax                ( span_units/2 ),
-    vmin                ( -vmax        ),
-    factor              ( factr        ),
-    hudladder_type      ( name         ),
-    frl                 ( frl_spot     ),
-    target_spot         ( target       ),
-    velocity_vector     ( vel_vec      ),
-    drift_marker        ( drift        ),
-    alpha_bracket       ( alpha        ),
-    energy_marker       ( energy       ),
-    climb_dive_marker   ( climb        ),
-    glide_slope_marker  ( glide        ),
-    glide_slope         ( glide_slope_val),
-    energy_worm         ( worm_energy),
-    waypoint_marker     ( waypoint)
-
-
+// FIXME
+extern float get_roll(void);
+extern float get_pitch(void);
+
+
+HudLadder::HudLadder(const SGPropertyNode *node) :
+    dual_instr_item(
+            node->getIntValue("x"),
+            node->getIntValue("y"),
+            node->getIntValue("width"),
+            node->getIntValue("height"),
+            get_roll,
+            get_pitch,                         // FIXME getter functions from cockpit.cxx
+            node->getBoolValue("working"),
+            HUDS_RIGHT),
+    width_units(int(node->getFloatValue("span_units"))),
+    div_units(int(fabs(node->getFloatValue("division_units")))),
+    minor_div(0 /* hud.cxx: static float minor_division = 0 */),
+    label_pos(node->getIntValue("lbl_pos")),
+    scr_hole(node->getIntValue("screen_hole")),
+    factor(node->getFloatValue("compression_factor")),
+    hudladder_type(node->getStringValue("name")),
+    frl(node->getBoolValue("enable_frl", false)),
+    target_spot(node->getBoolValue("enable_target_spot", false)),
+    velocity_vector(node->getBoolValue("enable_velocity_vector", false)),
+    drift_marker(node->getBoolValue("enable_drift_marker", false)),
+    alpha_bracket(node->getBoolValue("enable_alpha_bracket", false)),
+    energy_marker(node->getBoolValue("enable_energy_marker", false)),
+    climb_dive_marker(node->getBoolValue("enable_climb_dive_marker", false)),
+    glide_slope_marker(node->getBoolValue("enable_glide_slope_marker",false)),
+    glide_slope(node->getFloatValue("glide_slope", -4.0)),
+    energy_worm(node->getBoolValue("enable_energy_marker", false)),
+    waypoint_marker(node->getBoolValue("enable_waypoint_marker", false)),
+    zenith(node->getIntValue("zenith")),
+    nadir(node->getIntValue("nadir")),
+    hat(node->getIntValue("hat"))
 {
-    zenith= zenithsymbol;
-    nadir=nadirsymbol;
-    hat= hat_marker;
+    // The factor assumes a base of 55 degrees per 640 pixels.
+    // Invert to convert the "compression" factor to a
+    // pixels-per-degree number.
+    if (fgGetBool("/sim/hud/enable3d", true) && HUD_style == 1)
+        factor = (640./55.);
+
+    SG_LOG(SG_INPUT, SG_INFO, "Done reading HudLadder instrument");    // TODO add name
 
     if (!width_units)
         width_units = 45;
-}
-
 
-HudLadder::~HudLadder()
-{
+    vmax = width_units / 2;
+    vmin = -vmax;
 }
 
 
-HudLadder::HudLadder( const HudLadder & image ) :
-    dual_instr_item     ( (dual_instr_item &) image),
-    width_units         ( image.width_units   ),
-    div_units           ( image.div_units     ),
-    label_pos           ( image.label_pos     ),
-    scr_hole            ( image.scr_hole      ),
-    vmax                ( image.vmax ),
-    vmin                ( image.vmin ),
-    factor              ( image.factor        ),
-    hudladder_type      ( image.hudladder_type),
-    frl                 ( image.frl),
-    target_spot         ( image.target_spot),
-    velocity_vector     ( image.velocity_vector),
-    drift_marker        ( image.drift_marker),
-    alpha_bracket       ( image.alpha_bracket),
-    energy_marker       ( image.energy_marker),
-    climb_dive_marker   ( image.climb_dive_marker),
-    glide_slope_marker  ( image.glide_slope_marker),
-    glide_slope         ( image.glide_slope),
-    energy_worm         ( image.energy_worm),
-    waypoint_marker     ( image.waypoint_marker)
+HudLadder::~HudLadder()
 {
 }
 
@@ -106,37 +70,36 @@ HudLadder::HudLadder( const HudLadder & image ) :
 //  Draws a climb ladder in the center of the HUD
 //
 
-void HudLadder::draw( void )
+void HudLadder::draw(void)
 {
 
-    float  x_ini,x_ini2;
-    float  x_end,x_end2;
-    float  y = 0;
+    float x_ini, x_ini2;
+    float x_end, x_end2;
+    float y = 0;
     int count;
-    float cosine, sine, xvvr, yvvr, Vxx = 0.0, Vyy = 0.0, Vzz = 0.0,
-          up_vel, ground_vel, actslope = 0.0;
-    float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1,
-          t2 = 0.0, psi = 0.0, alpha,pla;
+    float cosine, sine, xvvr, yvvr, Vxx = 0.0, Vyy = 0.0, Vzz = 0.0;
+    float up_vel, ground_vel, actslope = 0.0;
+    float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1;
+    float t2 = 0.0, psi = 0.0, alpha, pla;
     float vel_x = 0.0, vel_y = 0.0, drift;
-    // char     Textaux[8] ;
-    bool  pitch_ladder = false;
-    bool  climb_dive_ladder = false;
-    bool  clip_plane = false;
+    bool pitch_ladder = false;
+    bool climb_dive_ladder = false;
+    bool clip_plane = false;
 
-    GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
-    GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
-    GLdouble eqn_right[4] = {1.0,0.0,0.0,100.0};
+    GLdouble eqn_top[4] = {0.0, -1.0, 0.0, 0.0};
+    GLdouble eqn_left[4] = {-1.0, 0.0, 0.0, 100.0};
+    GLdouble eqn_right[4] = {1.0, 0.0, 0.0, 100.0};
 
-    POINT  centroid    = get_centroid();
-    RECT   box         = get_location();
+    POINT centroid = get_centroid();
+    RECT box = get_location();
 
-    float   half_span  = box.right / 2.0;
-    float   roll_value = current_ch2();
+    float half_span  = box.right / 2.0;
+    float roll_value = current_ch2();
     alpha = get_aoa();
     pla = get_throttleval();
 
 #ifdef ENABLE_SP_FMDS
-    int lgear,wown,wowm,ilcanclaw,ihook;
+    int lgear, wown, wowm, ilcanclaw, ihook;
     ilcanclaw = get_iaux2();
     lgear = get_iaux3();
     wown = get_iaux4();
@@ -145,12 +108,12 @@ void HudLadder::draw( void )
 #endif
     float pitch_value = current_ch1() * SGD_RADIANS_TO_DEGREES;
 
-    if (hudladder_type=="Climb/Dive Ladder") {
+    if (hudladder_type == "Climb/Dive Ladder") {
         pitch_ladder = false;
         climb_dive_ladder = true;
         clip_plane = true;
-    } else {
-        // hudladder_type=="Pitch Ladder"
+
+    } else { // hudladder_type == "Pitch Ladder"
         pitch_ladder = true;
         climb_dive_ladder = false;
         clip_plane = false;
@@ -158,8 +121,8 @@ void HudLadder::draw( void )
 
     //**************************************************************
     glPushMatrix();
-    // define (0,0) as center of screen
-    glTranslatef( centroid.x, centroid.y, 0);
+    // define (0, 0) as center of screen
+    glTranslatef(centroid.x, centroid.y, 0);
 
     // OBJECT STATIC RETICLE
     // TYPE FRL
@@ -168,15 +131,15 @@ void HudLadder::draw( void )
     if (frl) {
 #define FRL_DIAMOND_SIZE 2.0
         glBegin(GL_LINE_LOOP);
-        glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
+        glVertex2f(-FRL_DIAMOND_SIZE, 0.0);
         glVertex2f(0.0, FRL_DIAMOND_SIZE);
-        glVertex2f( FRL_DIAMOND_SIZE, 0.0);
+        glVertex2f(FRL_DIAMOND_SIZE, 0.0);
         glVertex2f(0.0, -FRL_DIAMOND_SIZE);
         glEnd();
 
         glBegin(GL_LINE_STRIP);
         glVertex2f(0, FRL_DIAMOND_SIZE);
-        glVertex2f(0, 8.0 );
+        glVertex2f(0, 8.0);
         glEnd();
 #undef FRL_DIAMOND_SIZE
     }
@@ -189,9 +152,9 @@ void HudLadder::draw( void )
     if (target_spot) {
 #define CENTER_DIAMOND_SIZE 6.0
         glBegin(GL_LINE_LOOP);
-        glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
+        glVertex2f(-CENTER_DIAMOND_SIZE, 0.0);
         glVertex2f(0.0, CENTER_DIAMOND_SIZE);
-        glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
+        glVertex2f(CENTER_DIAMOND_SIZE, 0.0);
         glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
         glEnd();
 #undef CENTER_DIAMOND_SIZE
@@ -211,28 +174,28 @@ void HudLadder::draw( void )
         if (psi > 180.0)
             psi = psi - 360;
 
-        total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
-        ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
+        total_vel = sqrt(Vxx * Vxx + Vyy * Vyy + Vzz * Vzz);
+        ground_vel = sqrt(Vxx * Vxx + Vyy * Vyy);
         up_vel = Vzz;
 
         if (ground_vel < 2.0) {
             if (fabs(up_vel) < 2.0)
                 actslope = 0.0;
             else
-                actslope = (up_vel/fabs(up_vel))*90.0;
+                actslope = (up_vel / fabs(up_vel)) * 90.0;
 
         } else {
-            actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
+            actslope = atan(up_vel / ground_vel) * SGD_RADIANS_TO_DEGREES;
         }
 
-        xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)
-                * (factor/globals->get_current_view()->get_aspect_ratio()));
-        drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
-        yvvr = ((actslope - pitch_value)*factor);
-        vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
-        vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))
+        xvvr = (((atan2(Vyy, Vxx) * SGD_RADIANS_TO_DEGREES) - psi)
+                * (factor / globals->get_current_view()->get_aspect_ratio()));
+        drift = ((atan2(Vyy, Vxx) * SGD_RADIANS_TO_DEGREES) - psi);
+        yvvr = ((actslope - pitch_value) * factor);
+        vel_y = ((actslope - pitch_value) * cos(roll_value) + drift * sin(roll_value)) * factor;
+        vel_x = (-(actslope - pitch_value) * sin(roll_value) + drift * cos(roll_value))
                 * (factor/globals->get_current_view()->get_aspect_ratio());
-        //  printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
+        //  printf("%f %f %f %f\n",vel_x, vel_y, drift, psi);
 
         //****************************************************************
         // OBJECT MOVING RETICLE
@@ -241,9 +204,9 @@ void HudLadder::draw( void )
         // drift marker
         if (drift_marker) {
             glBegin(GL_LINE_STRIP);
-            glVertex2f((xvvr*25/120)-6, -4);
-            glVertex2f(xvvr*25/120, 8);
-            glVertex2f((xvvr*25/120)+6, -4);
+            glVertex2f((xvvr * 25 / 120) - 6, -4);
+            glVertex2f(xvvr * 25 / 120, 8);
+            glVertex2f((xvvr * 25 / 120) + 6, -4);
             glEnd();
         }
 
@@ -251,13 +214,13 @@ void HudLadder::draw( void )
         // Clipping coordinates for ladder to be input from xml file
         // Clip hud ladder
         if (clip_plane) {
-            glClipPlane(GL_CLIP_PLANE0,eqn_top);
+            glClipPlane(GL_CLIP_PLANE0, eqn_top);
             glEnable(GL_CLIP_PLANE0);
-            glClipPlane(GL_CLIP_PLANE1,eqn_left);
+            glClipPlane(GL_CLIP_PLANE1, eqn_left);
             glEnable(GL_CLIP_PLANE1);
-            glClipPlane(GL_CLIP_PLANE2,eqn_right);
+            glClipPlane(GL_CLIP_PLANE2, eqn_right);
             glEnable(GL_CLIP_PLANE2);
-            // glScissor(-100,-240,200,240);
+            // glScissor(-100,-240, 200, 240);
             // glEnable(GL_SCISSOR_TEST);
         }
 
@@ -267,25 +230,25 @@ void HudLadder::draw( void )
         // ATTRIB - ALWAYS
         // velocity vector
         glBegin(GL_LINE_LOOP);  // Use polygon to approximate a circle
-        for (count=0; count<50; count++) {
-            cosine = 6 * cos(count * SGD_2PI/50.0);
-            sine =   6 * sin(count * SGD_2PI/50.0);
-            glVertex2f(cosine+vel_x, sine+vel_y);
+        for (count = 0; count < 50; count++) {
+            cosine = 6 * cos(count * SGD_2PI / 50.0);
+            sine =   6 * sin(count * SGD_2PI / 50.0);
+            glVertex2f(cosine + vel_x, sine + vel_y);
         }
         glEnd();
 
         //velocity vector reticle orientation lines
         glBegin(GL_LINE_STRIP);
-        glVertex2f(vel_x-12, vel_y);
-        glVertex2f(vel_x-6, vel_y);
+        glVertex2f(vel_x - 12, vel_y);
+        glVertex2f(vel_x - 6, vel_y);
         glEnd();
         glBegin(GL_LINE_STRIP);
-        glVertex2f(vel_x+12, vel_y);
-        glVertex2f(vel_x+6, vel_y);
+        glVertex2f(vel_x + 12, vel_y);
+        glVertex2f(vel_x + 6, vel_y);
         glEnd();
         glBegin(GL_LINE_STRIP);
-        glVertex2f(vel_x, vel_y+12);
-        glVertex2f(vel_x, vel_y+6);
+        glVertex2f(vel_x, vel_y + 12);
+        glVertex2f(vel_x, vel_y + 6);
         glEnd();
 
 #ifdef ENABLE_SP_FMDS
@@ -295,24 +258,24 @@ void HudLadder::draw( void )
         if (lgear == 1) {
             // undercarriage status
             glBegin(GL_LINE_STRIP);
-            glVertex2f(vel_x+8, vel_y);
-            glVertex2f(vel_x+8, vel_y-4);
+            glVertex2f(vel_x + 8, vel_y);
+            glVertex2f(vel_x + 8, vel_y - 4);
             glEnd();
 
             // OBJECT MOVING RETICLE
             // TYPE LINE
             // ATTRIB - ON CONDITION
             glBegin(GL_LINE_STRIP);
-            glVertex2f(vel_x-8, vel_y);
-            glVertex2f(vel_x-8, vel_y-4);
+            glVertex2f(vel_x - 8, vel_y);
+            glVertex2f(vel_x - 8, vel_y - 4);
             glEnd();
 
             // OBJECT MOVING RETICLE
             // TYPE LINE
             // ATTRIB - ON CONDITION
             glBegin(GL_LINE_STRIP);
-            glVertex2f(vel_x, vel_y-6);
-            glVertex2f(vel_x, vel_y-10);
+            glVertex2f(vel_x, vel_y - 6);
+            glVertex2f(vel_x, vel_y - 10);
             glEnd();
         }
 
@@ -322,9 +285,9 @@ void HudLadder::draw( void )
         if (ihook == 1) {
             // arrestor hook status
             glBegin(GL_LINE_STRIP);
-            glVertex2f(vel_x-4, vel_y-8);
-            glVertex2f(vel_x, vel_y-10);
-            glVertex2f(vel_x+4, vel_y-8);
+            glVertex2f(vel_x - 4, vel_y - 8);
+            glVertex2f(vel_x, vel_y - 10);
+            glVertex2f(vel_x + 4, vel_y - 8);
             glEnd();
         }
 #endif
@@ -339,22 +302,22 @@ void HudLadder::draw( void )
 #ifdef ENABLE_SP_FMDS
     if (alpha_bracket && ihook == 1) {
         glBegin(GL_LINE_STRIP);
-        glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
-        glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
-        glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
-        glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
+        glVertex2f(vel_x - 20 , vel_y - (16 - alpha) * factor);
+        glVertex2f(vel_x - 17, vel_y - (16 - alpha) * factor);
+        glVertex2f(vel_x - 17, vel_y - (14 - alpha) * factor);
+        glVertex2f(vel_x - 20, vel_y - (14 - alpha) * factor);
         glEnd();
 
         glBegin(GL_LINE_STRIP);
-        glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
-        glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
-        glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
-        glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
+        glVertex2f(vel_x + 20 , vel_y - (16 - alpha) * factor);
+        glVertex2f(vel_x + 17, vel_y - (16 - alpha) * factor);
+        glVertex2f(vel_x + 17, vel_y - (14 - alpha) * factor);
+        glVertex2f(vel_x + 20, vel_y - (14 - alpha) * factor);
         glEnd();
     }
 #endif
-    //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
-    //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
+    //printf("xvr=%f, yvr=%f, Vx=%f, Vy=%f, Vz=%f\n",xvvr, yvvr, Vx, Vy, Vz);
+    //printf("Ax=%f, Ay=%f, Az=%f\n",Ax, Ay, Az);
 
     //****************************************************************
     // OBJECT MOVING RETICLE
@@ -366,37 +329,37 @@ void HudLadder::draw( void )
             t1 = 0;
             t2 = 0;
         } else {
-            t1 = up_vel/total_vel;
-            t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
+            t1 = up_vel / total_vel;
+            t2 = asin((Vxx * Axx + Vyy * Ayy + Vzz * Azz) / (9.81 * total_vel));
         }
-        pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y;
-        // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
-        // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
+        pot_slope = ((t2 / 3) * SGD_RADIANS_TO_DEGREES) * factor + vel_y;
+        // if (pot_slope < (vel_y - 45)) pot_slope = vel_y - 45;
+        // if (pot_slope > (vel_y + 45)) pot_slope = vel_y + 45;
 
         //energy markers
         glBegin(GL_LINE_STRIP);
-        glVertex2f(vel_x-20, pot_slope-5);
-        glVertex2f(vel_x-15, pot_slope);
-        glVertex2f(vel_x-20, pot_slope+5);
+        glVertex2f(vel_x - 20, pot_slope - 5);
+        glVertex2f(vel_x - 15, pot_slope);
+        glVertex2f(vel_x - 20, pot_slope + 5);
         glEnd();
 
         glBegin(GL_LINE_STRIP);
-        glVertex2f(vel_x+20, pot_slope-5);
-        glVertex2f(vel_x+15, pot_slope);
-        glVertex2f(vel_x+20, pot_slope+5);
+        glVertex2f(vel_x + 20, pot_slope - 5);
+        glVertex2f(vel_x + 15, pot_slope);
+        glVertex2f(vel_x + 20, pot_slope + 5);
         glEnd();
 
-        if (pla > (105.0/131.0)) {
+        if (pla > (105.0 / 131.0)) {
             glBegin(GL_LINE_STRIP);
-            glVertex2f(vel_x-24, pot_slope-5);
-            glVertex2f(vel_x-19, pot_slope);
-            glVertex2f(vel_x-24, pot_slope+5);
+            glVertex2f(vel_x - 24, pot_slope - 5);
+            glVertex2f(vel_x - 19, pot_slope);
+            glVertex2f(vel_x - 24, pot_slope + 5);
             glEnd();
 
             glBegin(GL_LINE_STRIP);
-            glVertex2f(vel_x+24, pot_slope-5);
-            glVertex2f(vel_x+19, pot_slope);
-            glVertex2f(vel_x+24, pot_slope+5);
+            glVertex2f(vel_x + 24, pot_slope - 5);
+            glVertex2f(vel_x + 19, pot_slope);
+            glVertex2f(vel_x + 24, pot_slope + 5);
             glEnd();
         }
     }
@@ -418,8 +381,8 @@ void HudLadder::draw( void )
         // ATTRIB - ON CONDITION
         glBegin(GL_LINE_STRIP);
         glVertex2f(-6, -134);
-        glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
-        glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
+        glVertex2f(-6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
+        glVertex2f(+6, t2 * SGD_RADIANS_TO_DEGREES * 4.0 - 134);
         glVertex2f(6, -134);
         glEnd();
 
@@ -427,10 +390,10 @@ void HudLadder::draw( void )
         // TYPE DIAMOND
         // ATTRIB - ON CONDITION
         glBegin(GL_LINE_LOOP);
-        glVertex2f(-6, actslope*4.0 - 134);
-        glVertex2f(0, actslope*4.0 -134 +3);
-        glVertex2f(6, actslope*4.0 - 134);
-        glVertex2f(0, actslope*4.0 -134 -3);
+        glVertex2f(-6, actslope * 4.0 - 134);
+        glVertex2f(0, actslope * 4.0 -134 + 3);
+        glVertex2f(6, actslope * 4.0 - 134);
+        glVertex2f(0, actslope * 4.0 -134 -3);
         glEnd();
     }
 #endif
@@ -442,10 +405,10 @@ void HudLadder::draw( void )
     // Draw the locked velocity vector.
     if (climb_dive_marker) {
         glBegin(GL_LINE_LOOP);
-        glVertex2f( -3.0, 0.0+vel_y);
-        glVertex2f(0.0, 6.0+vel_y);
-        glVertex2f( 3.0, 0.0+vel_y);
-        glVertex2f(0.0, -6.0+vel_y);
+        glVertex2f(-3.0, 0.0 + vel_y);
+        glVertex2f(0.0, 6.0 + vel_y);
+        glVertex2f(3.0, 0.0 + vel_y);
+        glVertex2f(0.0, -6.0 + vel_y);
         glEnd();
     }
 
@@ -454,7 +417,7 @@ void HudLadder::draw( void )
     if (climb_dive_ladder) { // CONFORMAL_HUD
         vmin = pitch_value - (float)width_units;
         vmax = pitch_value + (float)width_units;
-        glTranslatef( vel_x, vel_y, 0);
+        glTranslatef(vel_x, vel_y, 0);
 
     } else { // pitch_ladder - Default Hud
         vmin = pitch_value - (float)width_units * 0.5f;
@@ -480,109 +443,109 @@ void HudLadder::draw( void )
         else
             zero_offset = 10.0f;
 
-        fntFont *font      = HUDtext->getFont();
-        float    pointsize = HUDtext->getPointSize();
-        float    italic    = HUDtext->getSlant();
+        fntFont *font = HUDtext->getFont();                    // FIXME
+        float pointsize = HUDtext->getPointSize();
+        float italic = HUDtext->getSlant();
 
-        TextList.setFont( HUDtext );
+        TextList.setFont(HUDtext);
         TextList.erase();
         LineList.erase();
         StippleLineList.erase();
 
-        int last = FloatToInt(vmax)+1;
-        int i    = FloatToInt(vmin);
+        int last = FloatToInt(vmax) + 1;
+        int i = FloatToInt(vmin);
 
-        if ( !scr_hole ) {
-            x_end =  half_span;
+        if (!scr_hole) {
+            x_end = half_span;
 
             for (; i<last; i++) {
                 y = (((float)(i - pitch_value) * factor) + .5f);
 
-                if ( !(i % div_units )) {           //  At integral multiple of div
-                    sprintf( TextLadder, "%d", i );
-                    font->getBBox ( TextLadder, pointsize, italic,
-                                    &left, &right, &bot, &top ) ;
-                    label_length  = right - left;
+                if (!(i % div_units)) {           //  At integral multiple of div
+                    sprintf(TextLadder, "%d", i);
+                    font->getBBox(TextLadder, pointsize, italic,
+                            &left, &right, &bot, &top);
+                    label_length = right - left;
                     label_length += text_offset;
-                    label_height  = (top - bot)/2.0f;
+                    label_height = (top - bot) / 2.0f;
 
                     x_ini = -half_span;
 
-                    if ( i >= 0 ) {
+                    if (i >= 0) {
                         // Make zero point wider on left
-                        if ( i == 0 )
+                        if (i == 0)
                             x_ini -= zero_offset;
 
                         // Zero or above draw solid lines
                         Line(x_ini, y, x_end, y);
 
                         if (i == 90 && zenith == 1)
-                            drawZenith(x_ini, x_end,y);
+                            drawZenith(x_ini, x_end, y);
                     } else {
                         // Below zero draw dashed lines.
                         StippleLine(x_ini, y, x_end, y);
 
                         if (i == -90 && nadir ==1)
-                            drawNadir(x_ini, x_end,y);
+                            drawNadir(x_ini, x_end, y);
                     }
 
                     // Calculate the position of the left text and write it.
-                    Text( x_ini-label_length, y-label_height, TextLadder );
-                    Text( x_end+text_offset,  y-label_height, TextLadder );
+                    Text(x_ini-label_length, y-label_height, TextLadder);
+                    Text(x_end+text_offset, y-label_height, TextLadder);
                 }
             }
 
-        } else { // if (scr_hole )
+        } else { // if (scr_hole)
             // Draw ladder with space in the middle of the lines
-            float hole = (float)((scr_hole)/2.0f);
+            float hole = (float)((scr_hole) / 2.0f);
 
             x_end = -half_span + hole;
-            x_ini2= half_span  - hole;
+            x_ini2 = half_span - hole;
 
-            for (; i<last; i++) {
-                if (hudladder_type=="Pitch Ladder")
+            for (; i < last; i++) {
+                if (hudladder_type == "Pitch Ladder")
                     y = (((float)(i - pitch_value) * factor) + .5);
-                else if (hudladder_type=="Climb/Dive Ladder")
+                else if (hudladder_type == "Climb/Dive Ladder")
                     y = (((float)(i - actslope) * factor) + .5);
 
                 if (!(i % div_units)) {  //  At integral multiple of div
-                    sprintf( TextLadder, "%d", i );
-                    font->getBBox ( TextLadder, pointsize, italic,
-                            &left, &right, &bot, &top ) ;
-                    label_length  = right - left;
+                    sprintf(TextLadder, "%d", i);
+                    font->getBBox(TextLadder, pointsize, italic,
+                            &left, &right, &bot, &top);
+                    label_length = right - left;
                     label_length += text_offset;
-                    label_height  = (top - bot)/2.0f;
-                    // printf("l %f r %f b %f t %f\n",left, right, bot, top );
+                    label_height = (top - bot) / 2.0f;
+                    // printf("l %f r %f b %f t %f\n",left, right, bot, top);
 
                     // Start by calculating the points and drawing the
                     // left side lines.
                     x_ini = -half_span;
-                    x_end2= half_span;
+                    x_end2 = half_span;
 
-                    if ( i >= 0 ) {
+                    if (i >= 0) {
                         // Make zero point wider on left
-                        if ( i == 0 ) {
+                        if (i == 0) {
                             x_ini -= zero_offset;
-                            x_end2 +=zero_offset;
+                            x_end2 += zero_offset;
                         }
                         //draw climb bar vertical lines
                         if (climb_dive_ladder) {
                             // Zero or above draw solid lines
-                            Line(x_end, y-5.0, x_end, y);
-                            Line(x_ini2, y-5.0, x_ini2, y);
+                            Line(x_end, y - 5.0, x_end, y);
+                            Line(x_ini2, y - 5.0, x_ini2, y);
                         }
                         // draw pitch / climb bar
                         Line(x_ini, y, x_end, y);
                         Line(x_ini2, y, x_end2, y);
 
                         if (i == 90 && zenith == 1)
-                            drawZenith(x_ini2, x_end,y);
+                            drawZenith(x_ini2, x_end, y);
 
                     } else { // i < 0
                         // draw dive bar vertical lines
                         if (climb_dive_ladder) {
-                            Line(x_end, y+5.0, x_end, y);
-                            Line(x_ini2, y+5.0, x_ini2, y);
+                            Line(x_end, y + 5.0, x_end, y);
+                            Line(x_ini2, y + 5.0, x_ini2, y);
                         }
 
                         // draw pitch / dive bars
@@ -590,12 +553,12 @@ void HudLadder::draw( void )
                         StippleLine(x_ini2, y, x_end2, y);
 
                         if (i == -90 && nadir == 1)
-                            drawNadir(x_ini2, x_end,y);
+                            drawNadir(x_ini2, x_end, y);
                     }
 
                     // Now calculate the location of the left side label using
-                    Text( x_ini-label_length, y-label_height, TextLadder );
-                    Text(x_end2+text_offset, y-label_height, TextLadder );
+                    Text(x_ini-label_length, y - label_height, TextLadder);
+                    Text(x_end2+text_offset, y - label_height, TextLadder);
                 }
             }
 
@@ -605,9 +568,11 @@ void HudLadder::draw( void )
             // draw appraoch glide slope marker
 #ifdef ENABLE_SP_FMDS
             if (glide_slope_marker && ihook) {
-                Line(-half_span+15, (glide_slope-actslope)*factor, -half_span + hole, (glide_slope-actslope)*factor);
-                Line(half_span-15, (glide_slope-actslope)*factor, half_span - hole, (glide_slope-actslope)*factor);
-            } // if glide_slope_marker
+                Line(-half_span + 15, (glide_slope-actslope) * factor,
+                        -half_span + hole, (glide_slope - actslope) * factor);
+                Line(half_span - 15, (glide_slope-actslope) * factor,
+                        half_span - hole, (glide_slope - actslope) * factor);
+            }
 #endif
         }
         TextList.draw();
@@ -617,8 +582,8 @@ void HudLadder::draw( void )
         LineList.draw();
 
         glEnable(GL_LINE_STIPPLE);
-        glLineStipple( 1, 0x00FF );
-        StippleLineList.draw( );
+        glLineStipple(1, 0x00FF);
+        StippleLineList.draw();
         glDisable(GL_LINE_STIPPLE);
     }
     glDisable(GL_CLIP_PLANE0);
@@ -632,24 +597,25 @@ void HudLadder::draw( void )
 #ifdef ENABLE_SP_FMDS
     if (waypoint_marker) {
         //waypoint marker computation
-        float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
+        float fromwp_lat, towp_lat, fromwp_lon, towp_lon, dist, delx, dely, hyp, theta, brg;
 
-        fromwp_lon = get_longitude()*SGD_DEGREES_TO_RADIANS;
-        fromwp_lat = get_latitude()*SGD_DEGREES_TO_RADIANS;
-        towp_lon = get_aux2()*SGD_DEGREES_TO_RADIANS;
-        towp_lat = get_aux1()*SGD_DEGREES_TO_RADIANS;
+        fromwp_lon = get_longitude() * SGD_DEGREES_TO_RADIANS;
+        fromwp_lat = get_latitude() * SGD_DEGREES_TO_RADIANS;
+        towp_lon = get_aux2() * SGD_DEGREES_TO_RADIANS;
+        towp_lat = get_aux1() * SGD_DEGREES_TO_RADIANS;
 
-        dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
+        dist = acos(sin(fromwp_lat) * sin(towp_lat) + cos(fromwp_lat)
+                * cos(towp_lat) * cos(fabs(fromwp_lon - towp_lon)));
         delx= towp_lat - fromwp_lat;
         dely = towp_lon - fromwp_lon;
-        hyp = sqrt(pow(delx,2)+pow(dely,2));
+        hyp = sqrt(pow(delx, 2) + pow(dely, 2));
 
         if (hyp != 0)
-            theta = asin(dely/hyp);
+            theta = asin(dely / hyp);
         else
             theta = 0.0;
 
-        brg = theta*SGD_RADIANS_TO_DEGREES;
+        brg = theta * SGD_RADIANS_TO_DEGREES;
         if (brg > 360.0)
             brg = 0.0;
         if (delx < 0)
@@ -658,7 +624,7 @@ void HudLadder::draw( void )
         // {Brg  = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
         // Brg = Brg * SGD_RADIANS_TO_DEGREES; }
 
-        dist = dist*SGD_RADIANS_TO_DEGREES * 60.0*1852.0; //rad->deg->nm->m
+        dist *= SGD_RADIANS_TO_DEGREES * 60.0 * 1852.0; //rad->deg->nm->m
         // end waypoint marker computation
 
         //*********************************************************
@@ -667,17 +633,17 @@ void HudLadder::draw( void )
         // waypoint marker
         if (fabs(brg-psi) > 10.0) {
             glPushMatrix();
-            glTranslatef( centroid.x, centroid.y, 0);
-            glTranslatef( vel_x, vel_y, 0);
-            glRotatef(brg - psi,0.0,0.0,-1.0);
+            glTranslatef(centroid.x, centroid.y, 0);
+            glTranslatef(vel_x, vel_y, 0);
+            glRotatef(brg - psi, 0.0, 0.0, -1.0);
             glBegin(GL_LINE_LOOP);
-            glVertex2f(-2.5,20.0);
-            glVertex2f(-2.5,30.0);
-            glVertex2f(-5.0,30.0);
-            glVertex2f(0.0,35.0);
-            glVertex2f(5.0,30.0);
-            glVertex2f(2.5,30.0);
-            glVertex2f(2.5,20.0);
+            glVertex2f(-2.5, 20.0);
+            glVertex2f(-2.5, 30.0);
+            glVertex2f(-5.0, 30.0);
+            glVertex2f(0.0, 35.0);
+            glVertex2f(5.0, 30.0);
+            glVertex2f(2.5, 30.0);
+            glVertex2f(2.5, 20.0);
             glEnd();
             glPopMatrix();
         }
@@ -686,25 +652,25 @@ void HudLadder::draw( void )
         if (fabs(brg-psi) < 12.0) {
             if (hat == 0) {
                 glBegin(GL_LINE_LOOP);
-                glVertex2f(((brg-psi)*60/25)+320,240.0);
-                glVertex2f(((brg-psi)*60/25)+326,240.0-4);
-                glVertex2f(((brg-psi)*60/25)+323,240.0-4);
-                glVertex2f(((brg-psi)*60/25)+323,240.0-8);
-                glVertex2f(((brg-psi)*60/25)+317,240.0-8);
-                glVertex2f(((brg-psi)*60/25)+317,240.0-4);
-                glVertex2f(((brg-psi)*60/25)+314,240.0-4);
+                glVertex2f(((brg - psi) * 60 / 25) + 320, 240.0);
+                glVertex2f(((brg - psi) * 60 / 25) + 326, 240.0 - 4);
+                glVertex2f(((brg - psi) * 60 / 25) + 323, 240.0 - 4);
+                glVertex2f(((brg - psi) * 60 / 25) + 323, 240.0 - 8);
+                glVertex2f(((brg - psi) * 60 / 25) + 317, 240.0 - 8);
+                glVertex2f(((brg - psi) * 60 / 25) + 317, 240.0 - 4);
+                glVertex2f(((brg - psi) * 60 / 25) + 314, 240.0 - 4);
                 glEnd();
 
             } else { //if hat=0
-                float x = (brg-psi)*60/25 + 320, y = 240.0, r = 5.0;
-                float x1,y1;
+                float x = (brg - psi) * 60 / 25 + 320, y = 240.0, r = 5.0;
+                float x1, y1;
 
                 glEnable(GL_POINT_SMOOTH);
                 glBegin(GL_POINTS);
 
                 for (int count = 0; count <= 200; count++) {
-                    float temp = count * 3.142 * 3 / (200.0*2.0);
-                    float temp1 = temp-(45.0*SGD_DEGREES_TO_RADIANS);
+                    float temp = count * 3.142 * 3 / (200.0 * 2.0);
+                    float temp1 = temp - (45.0 * SGD_DEGREES_TO_RADIANS);
                     x1 = x + r * cos(temp1);
                     y1 = y + r * sin(temp1);
                     glVertex2f(x1, y1);
@@ -721,55 +687,55 @@ void HudLadder::draw( void )
 
 
 /******************************************************************/
-//  draws the zenith symbol  for highest possible climb angle (i,e 90 degree climb angle)
+//  draws the zenith symbol  for highest possible climb angle (i.e. 90 degree climb angle)
 //
-void HudLadder::drawZenith(float xfirst,float xlast,float yvalue)
+void HudLadder::drawZenith(float xfirst, float xlast, float yvalue)
 {
-    float xcentre = (xfirst + xlast)/2.0;
+    float xcentre = (xfirst + xlast) / 2.0;
     float ycentre = yvalue;
 
-    Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre+1.3);
-    Line(xcentre-9.0, ycentre, xcentre-3.0, ycentre-1.3);
+    Line(xcentre - 9.0, ycentre, xcentre - 3.0, ycentre + 1.3);
+    Line(xcentre - 9.0, ycentre, xcentre - 3.0, ycentre - 1.3);
 
-    Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre+1.3);
-    Line(xcentre+9.0, ycentre, xcentre+3.0, ycentre-1.3);
+    Line(xcentre + 9.0, ycentre, xcentre + 3.0, ycentre + 1.3);
+    Line(xcentre + 9.0, ycentre, xcentre + 3.0, ycentre - 1.3);
 
-    Line(xcentre, ycentre+9.0, xcentre-1.3, ycentre+3.0);
-    Line(xcentre, ycentre+9.0, xcentre+1.3, ycentre+3.0);
+    Line(xcentre, ycentre + 9.0, xcentre - 1.3, ycentre + 3.0);
+    Line(xcentre, ycentre + 9.0, xcentre + 1.3, ycentre + 3.0);
 
-    Line(xcentre-3.9, ycentre+3.9, xcentre-3.0, ycentre+1.3);
-    Line(xcentre-3.9, ycentre+3.9, xcentre-1.3, ycentre+3.0);
+    Line(xcentre - 3.9, ycentre + 3.9, xcentre - 3.0, ycentre + 1.3);
+    Line(xcentre - 3.9, ycentre + 3.9, xcentre - 1.3, ycentre + 3.0);
 
-    Line(xcentre+3.9, ycentre+3.9, xcentre+1.3, ycentre+3.0);
-    Line(xcentre+3.9, ycentre+3.9, xcentre+3.0, ycentre+1.3);
+    Line(xcentre + 3.9, ycentre + 3.9, xcentre + 1.3, ycentre+3.0);
+    Line(xcentre + 3.9, ycentre + 3.9, xcentre + 3.0, ycentre+1.3);
 
-    Line(xcentre-3.9, ycentre-3.9, xcentre-3.0, ycentre-1.3);
-    Line(xcentre-3.9, ycentre-3.9, xcentre-1.3, ycentre-2.6);
+    Line(xcentre - 3.9, ycentre - 3.9, xcentre - 3.0, ycentre-1.3);
+    Line(xcentre - 3.9, ycentre - 3.9, xcentre - 1.3, ycentre-2.6);
 
-    Line(xcentre+3.9, ycentre-3.9, xcentre+3.0, ycentre-1.3);
-    Line(xcentre+3.9, ycentre-3.9, xcentre+1.3, ycentre-2.6);
+    Line(xcentre + 3.9, ycentre - 3.9, xcentre + 3.0, ycentre-1.3);
+    Line(xcentre + 3.9, ycentre - 3.9, xcentre + 1.3, ycentre-2.6);
 
-    Line(xcentre-1.3, ycentre-2.6, xcentre, ycentre-27.0);
-    Line(xcentre+1.3, ycentre-2.6, xcentre, ycentre-27.0);
+    Line(xcentre - 1.3, ycentre - 2.6, xcentre, ycentre - 27.0);
+    Line(xcentre + 1.3, ycentre - 2.6, xcentre, ycentre - 27.0);
 }
 
 
-//  draws the nadir symbol  for lowest possible dive angle (i,e 90 degree dive angle)
+//  draws the nadir symbol  for lowest possible dive angle (i.e. 90 degree dive angle)
 //
 void HudLadder::drawNadir(float xfirst, float xlast, float yvalue)
 {
-    float xcentre = (xfirst + xlast)/2.0;
+    float xcentre = (xfirst + xlast) / 2.0;
     float ycentre = yvalue;
 
     float r = 7.5;
-    float x1,y1,x2,y2;
+    float x1, y1, x2, y2;
 
     // to draw a circle
     float xcent1, xcent2, ycent1, ycent2;
-    xcent1 = xcentre + r * cos(0.0);
-    ycent1 = ycentre + r * sin(0.0);
+    xcent1 = xcentre + r;
+    ycent1 = ycentre;
 
-    for (int count=1; count<=400; count++) {
+    for (int count = 1; count <= 400; count++) {
         float temp = count * 2 * 3.142 / 400.0;
         xcent2 = xcentre + r * cos(temp);
         ycent2 = ycentre + r * sin(temp);
@@ -780,42 +746,44 @@ void HudLadder::drawNadir(float xfirst, float xlast, float yvalue)
         ycent1 = ycent2;
     }
 
-    xcent2 = xcentre + r * cos(0.0);
-    ycent2 = ycentre + r * sin(0.0);
+    xcent2 = xcentre + r;
+    ycent2 = ycentre;
 
     drawOneLine(xcent1, ycent1, xcent2, ycent2); //to connect last point to first point
     //end circle
 
-    Line(xcentre, ycentre+7.5, xcentre, ycentre+22.5); //to draw a line above the circle
+    //to draw a line above the circle
+    Line(xcentre, ycentre + 7.5, xcentre, ycentre + 22.5);
 
-    Line(xcentre-7.5, ycentre, xcentre+7.5,ycentre); //line in the middle of circle
+    //line in the middle of circle
+    Line(xcentre - 7.5, ycentre, xcentre + 7.5, ycentre);
 
-    float theta = asin (2.5/7.5);
-    float theta1 = asin(5.0/7.5);
+    float theta = asin (2.5 / 7.5);
+    float theta1 = asin(5.0 / 7.5);
 
     x1 = xcentre + r * cos(theta);
     y1 = ycentre + 2.5;
     x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta);
     y2 = ycentre + 2.5;
-    Line(x1,y1,x2,y2);
+    Line(x1, y1, x2, y2);
 
     x1 = xcentre + r * cos(theta1);
     y1 = ycentre + 5.0;
-    x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS)-theta1);
+    x2 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) - theta1);
     y2 = ycentre + 5.0;
-    Line(x1,y1,x2,y2);
+    Line(x1, y1, x2, y2);
 
-    x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) +theta);
+    x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta);
     y1 = ycentre - 2.5;
-    x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta);
+    x2 = xcentre + r * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta);
     y2 = ycentre - 2.5;
-    Line(x1,y1,x2,y2);
+    Line(x1, y1, x2, y2);
 
-    x1 = xcentre + r * cos((180.0* SGD_DEGREES_TO_RADIANS) +theta1);
+    x1 = xcentre + r * cos((180.0 * SGD_DEGREES_TO_RADIANS) + theta1);
     y1 = ycentre - 5.0;
-    x2 = xcentre + r * cos((360.0* SGD_DEGREES_TO_RADIANS)-theta1);
+    x2 = xcentre + r * cos((360.0 * SGD_DEGREES_TO_RADIANS) - theta1);
     y2 = ycentre - 5.0;
-    Line(x1,y1,x2,y2);
+    Line(x1, y1, x2, y2);
 }