]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud_ladr.cxx
300c091e407742776e8761849cc0a7990d6381c7
[flightgear.git] / src / Cockpit / hud_ladr.cxx
1
2 #include "hud.hxx"
3 #include "panel.hxx"
4
5 #define DO_PANEL_HACK
6
7 //====================== Top of HudLadder Class =======================
8 HudLadder ::   HudLadder(  int       x,
9                int       y,
10                UINT      width,
11                UINT      height,
12                UINT      mini,
13                FLTFNPTR  ptch_source,
14                FLTFNPTR  roll_source,
15                float    span_units,
16                float    major_div,
17                float    minor_div,
18                UINT      screen_hole,
19                UINT      lbl_pos,
20                bool      working) :
21    dual_instr_item( x, y, width, height,
22                     ptch_source,
23                     roll_source,
24                     working,
25                     HUDS_RIGHT),
26                     width_units    ( (int)(span_units)   ),
27                     div_units      ( (int)(major_div < 0? -major_div: major_div) ),
28                     minor_div      ( (int)(minor_div)    ),
29                     label_pos      ( lbl_pos      ),
30                     scr_hole       ( screen_hole  ),
31                     vmax           ( span_units/2 ),
32                     vmin           ( -vmax        )
33    {
34        if( !width_units ) {
35            width_units = 45;
36        }
37 // $$$ begin -added VS Renganthan 16 Oct 2k
38 #ifdef FIGHTER_HUD
39        factor = 480.0 / 33.75;
40 #else
41 // $$$ begin -added VS Renganthan 16 Oct 2k
42        factor = (float)get_span() / (float) width_units;
43 #endif
44        minimal = mini;
45    }
46    
47 HudLadder ::  ~HudLadder()
48     {
49     }
50            
51     HudLadder ::
52             HudLadder( const HudLadder & image ) :
53             dual_instr_item( (dual_instr_item &) image),
54             width_units    ( image.width_units   ),
55             div_units      ( image.div_units     ),
56             label_pos      ( image.label_pos     ),
57             scr_hole       ( image.scr_hole      ),
58             vmax           ( image.vmax ),
59             vmin           ( image.vmin ),
60             factor         ( image.factor        )
61     {
62     }
63 HudLadder & HudLadder ::  operator = ( const HudLadder & rhs )
64     {
65         if( !(this == &rhs)) {
66             (dual_instr_item &)(*this) = (dual_instr_item &)rhs;
67             width_units  = rhs.width_units;
68             div_units    = rhs.div_units;
69             label_pos    = rhs.label_pos;
70             scr_hole     = rhs.scr_hole;
71             vmax         = rhs.vmax;
72             vmin         = rhs.vmin;
73             factor       = rhs.factor;
74         }
75         return *this;
76     }
77                            
78 //
79 //  Draws a climb ladder in the center of the HUD
80 //
81 // $$$ begin - added VS Renganathan, 13 Oct 2K
82 #ifdef FIGHTER_HUD
83 void HudLadder :: draw( void )
84 {
85     float  x_ini;
86     float  x_end;
87     float  y;
88     int count;
89     float cosine, sine,xvvr,yvvr,Vxx,Vyy,Vzz,up_vel,ground_vel,actslope;
90     float Axx,Ayy,Azz,total_vel,pot_slope,t1,t2,psi,alpha,pla;
91     float vel_x,vel_y,drift;
92     char     Textaux[8] ;
93
94     GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
95     GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
96     GLdouble eqn_right[4] = {1.0,0.0,0.0,100.0};
97
98     POINT  centroid    = get_centroid();
99     RECT   box         = get_location();
100
101     float   half_span  = box.right / 2.0;
102     float   roll_value = current_ch2();
103     alpha = get_aoa();
104     pla = get_throttleval();
105
106     int lgear,wown,wowm,iclaw,ihook;
107     iclaw = get_iaux1();
108     lgear = get_iaux2();
109     wown = get_iaux3();
110     wowm = get_iaux4();
111     ihook = get_iaux5();
112     
113     float pitch_value = current_ch1() * RAD_TO_DEG;
114     vmin              = pitch_value - (float)width_units;
115     vmax              = pitch_value + (float)width_units; //$$$
116
117     glPushMatrix();
118     glTranslatef( centroid.x, centroid.y, 0);
119
120 //*********************************************************
121 //waypoint marker computation
122     float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
123
124     fromwp_lon = get_longitude()*DEG_TO_RAD;
125     fromwp_lat = get_latitude()*DEG_TO_RAD;
126     towp_lon = get_aux5()*DEG_TO_RAD;
127     towp_lat = get_aux6()*DEG_TO_RAD;
128
129     dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
130     delx= towp_lat - fromwp_lat;
131     dely = towp_lon - fromwp_lon;
132     hyp = sqrt(pow(delx,2)+pow(dely,2));
133     if (hyp != 0) {
134        theta = asin(dely/hyp);
135     } else {
136     theta = 0.0;
137     }
138     brg = theta*RAD_TO_DEG;
139     if (brg > 360.0) brg = 0.0;
140     if (delx < 0) brg = 180 - brg;
141
142 //        {Brg  = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
143 //        Brg = Brg * RAD_TO_DEG; }
144     dist = dist*RAD_TO_DEG * 60.0*1852.0; //rad->deg->nm->m
145 //*********************************************************
146     // Draw the FRL spot and line
147 #define FRL_DIAMOND_SIZE 2.0
148     glBegin(GL_LINE_LOOP);
149         glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
150         glVertex2f(0.0, FRL_DIAMOND_SIZE);
151         glVertex2f( FRL_DIAMOND_SIZE, 0.0);
152         glVertex2f(0.0, -FRL_DIAMOND_SIZE);
153     glEnd();
154     glBegin(GL_LINE_STRIP);
155           glVertex2f(0, FRL_DIAMOND_SIZE);
156           glVertex2f(0, 8.0 );
157     glEnd();
158 #undef FRL_DIAMOND_SIZE
159
160         //velocity vector reticle - computations
161         Vxx = get_Vx();
162         Vyy = get_Vy();
163         Vzz = get_Vz();
164       Axx = get_Ax();
165         Ayy = get_Ay();
166         Azz = get_Az();
167         psi = get_heading();
168
169     if (psi > 180.0) psi = psi - 360;
170
171     total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
172         ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
173         up_vel = Vzz;
174
175         if (ground_vel < 2.0) {
176                 if (fabs(up_vel) < 2.0) {
177                         actslope = 0.0;
178                 } else {
179                         actslope = (up_vel/fabs(up_vel))*90.0;
180                 }
181         } else {
182                 actslope = atan(up_vel/ground_vel)*RAD_TO_DEG;
183         }
184
185     xvvr = (((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi)*(640.0/45.0));
186     drift = ((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi);
187     yvvr = ((actslope - pitch_value)*factor);
188     vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
189     vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*(640/45.0);
190 //      printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
191
192         // drift marker
193     glBegin(GL_LINE_STRIP);
194           glVertex2f((xvvr*25/120)-6, -4);
195           glVertex2f(xvvr*25/120, 8);
196           glVertex2f((xvvr*25/120)+6, -4);
197     glEnd();
198     
199 // clip hud ladder
200     glClipPlane(GL_CLIP_PLANE0,eqn_top);
201     glEnable(GL_CLIP_PLANE0);
202     glClipPlane(GL_CLIP_PLANE1,eqn_left);
203     glEnable(GL_CLIP_PLANE1);
204     glClipPlane(GL_CLIP_PLANE2,eqn_right);
205     glEnable(GL_CLIP_PLANE2);
206
207     // alpha bracket - reqd only for landing (tied to hook)
208     if (ihook == 1) {
209     glBegin(GL_LINE_STRIP);
210         glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
211         glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
212         glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
213         glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
214     glEnd();
215     glBegin(GL_LINE_STRIP);
216         glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
217         glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
218         glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
219         glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
220     glEnd();
221         }
222
223         //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
224         //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
225         
226     //energy markers - compute potential slope
227         if (total_vel < 5.0) {
228                 t1 = 0;
229                 t2 = 0;
230         } else {
231                 t1 = up_vel/total_vel;
232                 t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
233         }
234         pot_slope = ((t2/3)*RAD_TO_DEG)*factor + vel_y;
235
236     //energy markers
237     glBegin(GL_LINE_STRIP);
238           glVertex2f(vel_x-20, pot_slope-5);
239           glVertex2f(vel_x-15, pot_slope);
240           glVertex2f(vel_x-20, pot_slope+5);
241     glEnd();
242     glBegin(GL_LINE_STRIP);
243           glVertex2f(vel_x+20, pot_slope-5);
244           glVertex2f(vel_x+15, pot_slope);
245           glVertex2f(vel_x+20, pot_slope+5);
246     glEnd();
247     if (pla > (105.0/131.0)) {
248     glBegin(GL_LINE_STRIP);
249           glVertex2f(vel_x-24, pot_slope-5);
250           glVertex2f(vel_x-19, pot_slope);
251           glVertex2f(vel_x-24, pot_slope+5);
252     glEnd();
253     glBegin(GL_LINE_STRIP);
254           glVertex2f(vel_x+24, pot_slope-5);
255           glVertex2f(vel_x+19, pot_slope);
256           glVertex2f(vel_x+24, pot_slope+5);
257     glEnd();
258     }
259  
260 // ramp reticle - for ski jump takeoff only
261     if (iclaw == 1) {
262     glBegin(GL_LINE_STRIP);
263           glVertex2f(-15, -134);
264           glVertex2f(15, -134);
265     glEnd();
266     glBegin(GL_LINE_STRIP);
267           glVertex2f(-6, -134);
268           glVertex2f(-6, t2*RAD_TO_DEG*4.0 - 134);
269           glVertex2f(+6, t2*RAD_TO_DEG*4.0 - 134);
270           glVertex2f(6, -134);
271     glEnd();
272     glBegin(GL_LINE_LOOP);
273           glVertex2f(-6, actslope*4.0 - 134);
274           glVertex2f(0, actslope*4.0 -134 +3);
275           glVertex2f(6, actslope*4.0 - 134);
276           glVertex2f(0, actslope*4.0 -134 -3);
277     glEnd();
278     }
279
280     // Draw the locked velocity vector.
281     glBegin(GL_LINE_LOOP);
282         glVertex2f( -3.0, 0.0+vel_y);
283         glVertex2f(0.0, 6.0+vel_y);
284         glVertex2f( 3.0, 0.0+vel_y);
285         glVertex2f(0.0, -6.0+vel_y);
286     glEnd();
287     
288 //  draw velocity vector
289     glBegin(GL_LINE_LOOP);  // Use polygon to approximate a circle 
290         for(count=0; count<50; count++) {             
291                         cosine = 6 * cos(count * 2 * M_PI/50.0); 
292             sine =   6 * sin(count * 2 * M_PI/50.0); 
293             glVertex2f(cosine+vel_x, sine+vel_y);
294                 }     
295         glEnd(); 
296
297     //velocity vector reticle orientation lines
298     glBegin(GL_LINE_STRIP);
299           glVertex2f(vel_x-12, vel_y);
300           glVertex2f(vel_x-6, vel_y);
301     glEnd();
302     glBegin(GL_LINE_STRIP);
303           glVertex2f(vel_x+12, vel_y);
304           glVertex2f(vel_x+6, vel_y);
305     glEnd();
306     glBegin(GL_LINE_STRIP);
307           glVertex2f(vel_x, vel_y+12);
308           glVertex2f(vel_x, vel_y+6);
309     glEnd();
310
311     if (lgear == 1) {
312 // undercarriage status
313     glBegin(GL_LINE_STRIP);
314           glVertex2f(vel_x+8, vel_y);
315           glVertex2f(vel_x+8, vel_y-4);
316     glEnd();
317     glBegin(GL_LINE_STRIP);
318           glVertex2f(vel_x-8, vel_y);
319           glVertex2f(vel_x-8, vel_y-4);
320     glEnd();
321     glBegin(GL_LINE_STRIP);
322           glVertex2f(vel_x, vel_y-6);
323           glVertex2f(vel_x, vel_y-10);
324     glEnd();
325     }
326
327     if (ihook == 1) {
328 // arrestor hook status
329     glBegin(GL_LINE_STRIP);
330           glVertex2f(vel_x-4, vel_y-8);
331           glVertex2f(vel_x, vel_y-10);
332           glVertex2f(vel_x+4, vel_y-8);
333     glEnd();
334     }
335
336         // FRL marker not rotated - this line shifted below
337     glTranslatef( vel_x, vel_y, 0);
338     glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
339
340     if( div_units ) {
341   
342         char     TextLadder[8] ;
343         float    label_length ;
344         float    label_height ;
345         float    left ;
346         float    right ;
347         float    bot ;
348         float    top ;
349         float    text_offset = 4.0f ;
350         float    zero_offset = 50.0f ;
351           
352        fntFont *font      = HUDtext->getFont();
353        float    pointsize = HUDtext->getPointSize();
354        float    italic    = HUDtext->getSlant();
355
356         TextList.setFont( HUDtext );
357         TextList.erase();
358         LineList.erase();
359         StippleLineList.erase();
360
361         int last = FloatToInt(vmax)+1;
362         int i    = FloatToInt(vmin);
363
364         if( !scr_hole ) {
365             for( ; i<last ; i++ ) {
366                 
367                 y =  (((float)(i - pitch_value) * factor) + .5f);
368                 if( !(i % div_units ))    {        //  At integral multiple of div
369                 
370                     sprintf( TextLadder, "%d", i );
371                     font->getBBox ( TextLadder, pointsize, italic,
372                                     &left, &right, &bot, &top ) ;
373                     label_length  = right - left;
374                     label_length += text_offset;
375                     label_height  = (top - bot)/2.0f;
376                 
377                     x_ini = -half_span;
378                     x_end =  half_span;
379                     
380                     if( i >= 0 ) {
381                         // Make zero point wider on left
382                         if( i == 0 )
383                             x_ini -= zero_offset;
384                         // Zero or above draw solid lines
385                         Line(x_ini, y, x_end, y);
386                     } else {
387                         // Below zero draw dashed lines.
388                         StippleLine(x_ini, y, x_end, y);
389                     }
390                     
391                     // Calculate the position of the left text and write it.
392                     Text( x_ini-label_length, y-label_height, TextLadder );
393                     Text( x_end+text_offset,  y-label_height, TextLadder );
394                 }
395             }
396         }
397         else // if(scr_hole )
398         {    // Draw ladder with space in the middle of the lines
399             float hole = (float)((scr_hole)/2.0f);
400             for( ; i<last ; i++ )      {
401
402 //                y = (((float)(i - pitch_value) * factor) + .5);
403                 y = (((float)(i - actslope) * factor) + .5);
404
405                 if( !(i % div_units ))    {        //  At integral multiple of div
406
407                     sprintf( TextLadder, "%d", i );
408                     font->getBBox ( TextLadder, pointsize, italic,
409                                     &left, &right, &bot, &top ) ;
410                     label_length  = right - left;
411                     label_length += text_offset;
412                     label_height  = (top - bot)/2.0f;
413 //                  printf("l %f r %f b %f t %f\n",left, right, bot, top );
414                 
415                     // Start by calculating the points and drawing the
416                     // left side lines.
417                     x_ini = -half_span;
418                     x_end = -half_span + hole;
419                     
420                     if( i >= 0 ) { 
421                         // Make zero point wider on left
422                         if( i == 0 ) {
423                             x_ini -= zero_offset;
424                                                 } else {
425                         // Zero or above draw solid lines
426                         Line(x_end, y-5.0, x_end, y);
427                                                 }
428
429                         Line(x_ini, y, x_end, y);
430
431                     } else {
432                         // Below zero draw dashed lines.
433                         Line(x_end, y+5.0, x_end, y);
434                         StippleLine(x_ini, y, x_end, y);
435                     }
436                     
437                     // Now calculate the location of the left side label using
438                     Text( x_ini-label_length, y-label_height, TextLadder );
439                     
440                     // Now calculate and draw the right side line location
441                     x_ini = half_span - hole;
442                     x_end = half_span;
443                     
444                     if( i >= 0 ) {
445                         if( i == 0 ) {
446                             x_end += zero_offset;
447                                                 } else {
448                            Line(x_ini, y-5.0, x_ini, y);
449                                                 }
450                         // Zero or above draw solid lines
451                         Line(x_ini, y, x_end, y);
452                     } else {
453                         // Below zero draw dashed lines.
454                         Line(x_ini, y+5.0, x_ini, y);
455                         StippleLine(x_ini, y, x_end, y);
456                     }
457                     
458                     // Calculate the location and draw the right side label
459                     Text( x_end+text_offset,  y-label_height, TextLadder );
460                 }
461             }
462         
463        // draw appraoch glide slope marker - for landing only (tied to hook)
464           if (ihook) {
465              Line(-half_span+15, (-4-actslope)*factor, -half_span + hole, (-4-actslope)*factor);
466              Line(half_span-15, (-4-actslope)*factor, half_span - hole, (-4-actslope)*factor);
467           }
468
469         }
470
471         TextList.draw();
472
473         glLineWidth(0.2);
474         
475         LineList.draw();
476         
477         glEnable(GL_LINE_STIPPLE);
478         glLineStipple( 1, 0x00FF );
479         StippleLineList.draw( );
480         glDisable(GL_LINE_STIPPLE);
481     }
482     glDisable(GL_CLIP_PLANE0);
483     glDisable(GL_CLIP_PLANE1);
484     glDisable(GL_CLIP_PLANE2);
485 //      glDisable(GL_SCISSOR_TEST);
486     glPopMatrix();
487 //*************************************************************
488 // waypoint marker
489 if (fabs(brg-psi) > 10.0) {
490     glPushMatrix();
491     glTranslatef( centroid.x, centroid.y, 0);
492     glTranslatef( vel_x, vel_y, 0);
493     glRotatef(brg - psi,0.0,0.0,-1.0);
494     glBegin(GL_LINE_LOOP);
495         glVertex2f(-2.5,20.0);
496         glVertex2f(-2.5,30.0);
497         glVertex2f(-5.0,30.0);
498         glVertex2f(0.0,35.0);
499         glVertex2f(5.0,30.0);
500         glVertex2f(2.5,30.0);
501         glVertex2f(2.5,20.0);
502     glEnd();
503     glPopMatrix();
504 }
505 // waypoint marker on heading scale
506 if (fabs(brg-psi) < 12.0) {
507     glBegin(GL_LINE_LOOP);
508         glVertex2f(((brg-psi)*60/25)+320,240.0);
509         glVertex2f(((brg-psi)*60/25)+326,240.0-4);
510         glVertex2f(((brg-psi)*60/25)+323,240.0-4);
511         glVertex2f(((brg-psi)*60/25)+323,240.0-8);
512         glVertex2f(((brg-psi)*60/25)+317,240.0-8);
513         glVertex2f(((brg-psi)*60/25)+317,240.0-4);
514         glVertex2f(((brg-psi)*60/25)+314,240.0-4);
515     glEnd();
516 }
517 //*************************************************************
518
519 }
520 #else
521 // $$$ end - added VS Renganathan, 13 Oct 2K
522
523 // draw DEFAULT_HUD
524 void HudLadder :: draw( void )
525 {
526     POINT  centroid    = get_centroid();
527         
528     float   roll_value = current_ch2();
529     
530     glPushMatrix();
531     glTranslatef( centroid.x, centroid.y, 0);
532         // Alex's panel patch
533 //      glScalef( current_options.get_fov()/55.0, 1.0, 1.0 );
534     glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
535
536     // Draw the target spot.
537 #define CENTER_DIAMOND_SIZE 6.0f
538         
539     glBegin(GL_LINE_LOOP);
540         glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
541         glVertex2f( 0.0, CENTER_DIAMOND_SIZE);
542         glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
543         glVertex2f( 0.0, -CENTER_DIAMOND_SIZE);
544     glEnd();
545
546     if( minimal || ! div_units ) {
547         glPopMatrix();      
548         return;
549     }
550
551         float  x_ini;
552         float  x_end;
553         float  y;
554
555         float pitch_value = current_ch1() * RAD_TO_DEG;
556         vmin              = pitch_value - (float)width_units * 0.5f;
557         vmax              = pitch_value + (float)width_units * 0.5f;
558
559         RECT   box         = get_location();
560
561         float   half_span  = box.right * 0.5f ;
562
563         char     TextLadder[8] ;
564         float    label_length ;
565         float    label_height ;
566         float    left ;
567         float    right ;
568         float    bot ;
569         float    top ;
570         float    text_offset = 4.0f ;
571         float    zero_offset = 10.0f ;
572         
573         fntFont *font      = HUDtext->getFont();
574         float    pointsize = HUDtext->getPointSize();
575         float    italic    = HUDtext->getSlant();
576         
577         TextList.setFont( HUDtext );
578         TextList.erase();
579         LineList.erase();
580         StippleLineList.erase();
581         
582         int last = FloatToInt(vmax)+1;
583         int i    = FloatToInt(vmin);
584         
585         if( !scr_hole ) {
586                 x_end =  half_span;
587                 for( ; i<last ; i++ ) {
588                 
589                         y =  (((float)(i - pitch_value) * factor) + .5f);
590                         if( !(i % div_units ))    {        //  At integral multiple of div
591                 
592                                 sprintf( TextLadder, "%d", i );
593                                 font->getBBox ( TextLadder, pointsize, italic,
594                                                                 &left, &right, &bot, &top ) ;
595                                 
596                                 label_length  = right - left;
597                                 label_length += text_offset;
598                                 label_height  = (top - bot) * 0.5f;
599                 
600                                 x_ini = -half_span;
601
602                                 if( i >= 0 ) {
603                                         // Make zero point wider on left
604                                         if( i == 0 )
605                                                 x_ini -= zero_offset;
606                                         // Zero or above draw solid lines
607                                         Line(x_ini, y, x_end, y);
608                                 } else {
609                                         // Below zero draw dashed lines.
610                                         StippleLine(x_ini, y, x_end, y);
611                                 }
612                     
613                                 // Calculate the position of the left text and write it.
614                                 Text( x_ini-label_length, y-label_height, TextLadder );
615                                 Text( x_end+text_offset,  y-label_height, TextLadder );
616                         }
617                 }
618         } else  { // scr_hole != 0
619                 // Draw ladder with space in the middle of the lines
620                 float  x_ini2;
621                 float  x_end2;
622                 float hole = (float)((scr_hole)*0.5f);
623                 
624                 x_end  = -half_span + hole;
625                 x_ini2 =  half_span - hole;
626                 
627                 for( ; i<last ; i++ )      {
628                 
629                         y = (((float)(i - pitch_value) * factor) + .5);
630                         if( !(i % div_units ))    {        //  At integral multiple of div
631                 
632                                 sprintf( TextLadder, "%d", i );
633                                 font->getBBox ( TextLadder, pointsize, italic,
634                                                                 &left, &right, &bot, &top ) ;
635                                 label_length  = right - left;
636                                 label_length += text_offset;
637                                 label_height  = (top - bot) * 0.5f;
638                 
639                                 // Start by calculating the points and drawing the
640                                 // left side lines.
641                                 x_ini  = -half_span;
642                                 x_end2 =  half_span;
643                     
644                                 if( i >= 0 ) { 
645                                         // Make zero point wider on left
646                                         if( i == 0 ) {
647                                                 x_ini -= zero_offset;
648                                                 x_end2 += zero_offset;
649                                         }
650                                         // Zero or above draw solid lines
651                                         Line(x_ini, y, x_end, y);
652                                         Line(x_ini2, y, x_end2, y);
653                                 } else {
654                                         // Below zero draw dashed lines.
655                                         StippleLine(x_ini,  y, x_end,  y);
656                                         StippleLine(x_ini2, y, x_end2, y);
657                                 }
658                                 // Calculate the location of the left side label using
659                                 Text( x_ini-label_length, y-label_height, TextLadder );
660                                 // Calculate the location and draw the right side label
661                                 Text( x_end2+text_offset, y-label_height, TextLadder );
662                         }
663                 }
664         }
665         TextList.draw();
666         
667         LineList.draw();
668
669         glEnable(GL_LINE_STIPPLE);
670 #ifdef DO_PANEL_HACK
671         glLineStipple( 1, fgPanelVisible() ? 0x0F0F : 0x00FF );
672 #else
673         glLineStipple( 1, 0x00FF );
674 #endif
675         
676         StippleLineList.draw( );
677         glDisable(GL_LINE_STIPPLE);
678
679 //   } // if(div_units)
680     glPopMatrix();
681 }
682
683 #endif  // DEFAULT_HUD