1 /**************************************************************************
2 * hud.c -- hud defines and prototypes
4 * Written by Michele America, started September 1997.
6 * Copyright (C) 1997 Michele F. America - micheleamerica@geocities.com
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * (Log is kept at end of this file)
24 **************************************************************************/
40 # include <values.h> // for MAXINT
43 #include <Aircraft/aircraft.h>
44 #include <Debug/fg_debug.h>
45 #include <Include/fg_constants.h>
46 #include <Math/fg_random.h>
47 #include <Math/mat3.h>
48 #include <Math/polar.h>
49 #include <Scenery/scenery.h>
50 #include <Time/fg_timer.hxx>
51 #include <Weather/weather.h>
57 #define drawOneLine(x1,y1,x2,y2) glBegin(GL_LINES); \
58 glVertex2f ((x1),(y1)); glVertex2f ((x2),(y2)); glEnd();
61 // The following routines obtain information concerntin the aircraft's
62 // current state and return it to calling instrument display routines.
63 // They should eventually be member functions of the aircraft.
66 double get_throttleval( void )
68 fgCONTROLS *pcontrols;
70 pcontrols = current_aircraft.controls;
71 return pcontrols->throttle[0]; // Hack limiting to one engine
74 double get_aileronval( void )
76 fgCONTROLS *pcontrols;
78 pcontrols = current_aircraft.controls;
79 return pcontrols->aileron;
82 double get_elevatorval( void )
84 fgCONTROLS *pcontrols;
86 pcontrols = current_aircraft.controls;
87 return pcontrols->elevator;
90 double get_elev_trimval( void )
92 fgCONTROLS *pcontrols;
94 pcontrols = current_aircraft.controls;
95 return pcontrols->elevator_trim;
98 double get_rudderval( void )
100 fgCONTROLS *pcontrols;
102 pcontrols = current_aircraft.controls;
103 return pcontrols->rudder;
106 double get_speed( void )
110 f = current_aircraft.flight;
111 return( FG_V_equiv_kts ); // Make an explicit function call.
114 double get_aoa( void )
118 f = current_aircraft.flight;
119 return( FG_Gamma_vert_rad * RAD_TO_DEG );
122 double get_roll( void )
126 f = current_aircraft.flight;
130 double get_pitch( void )
134 f = current_aircraft.flight;
138 double get_heading( void )
142 f = current_aircraft.flight;
143 return( FG_Psi * RAD_TO_DEG );
146 double get_altitude( void )
149 // double rough_elev;
151 f = current_aircraft.flight;
152 // rough_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC,
153 // FG_Latitude * RAD_TO_ARCSEC);
155 return( FG_Altitude * FEET_TO_METER /* -rough_elev */ );
158 double get_sideslip( void )
162 f = current_aircraft.flight;
167 /****************************************************************************/
168 /* Convert degrees to dd mm.mmm' (DMM-Format) */
169 /****************************************************************************/
182 d = (double) ( (int) a);
191 sprintf(dm, "%.0f°%06.3f'", d, m);
195 double get_latitude( void )
198 f = current_aircraft.flight;
200 // return( toDM(FG_Latitude * RAD_TO_DEG) );
201 return((double)((int)( FG_Latitude * RAD_TO_DEG)) );
203 double get_lat_min( void )
208 f = current_aircraft.flight;
210 a = FG_Latitude * RAD_TO_DEG;
214 d = (double) ( (int) a);
215 return( (a - d) * 60.0);
219 double get_longitude( void )
222 f = current_aircraft.flight;
224 // return( toDM(FG_Longitude * RAD_TO_DEG) );
225 return((double)((int) (FG_Longitude * RAD_TO_DEG)) );
227 double get_long_min( void )
232 f = current_aircraft.flight;
234 a = FG_Longitude * RAD_TO_DEG;
238 d = (double) ( (int) a);
239 return( (a - d) * 60.0);
243 // The following code deals with painting the "instrument" on the display
245 /* textString - Bitmap font string */
247 static void textString(int x, int y, char *msg, void *font)
251 glutBitmapCharacter(font, *msg);
256 /* strokeString - Stroke font string */
258 static void strokeString(int x, int y, char *msg, void *font)
261 glTranslatef(x, y, 0);
262 glScalef(.04, .04, .04);
264 glutStrokeCharacter(font, *msg);
273 Draws a measuring scale anywhere on the HUD
276 Needs: HUD_scale struct
279 static void drawscale( HUD_scale * pscale )
287 double cur_value = (*(pscale->load_value))();
290 vmin = cur_value - pscale->half_width_units; // width units == needle travel
291 vmax = cur_value + pscale->half_width_units; // or picture unit span.
294 if( pscale->type == VERTICAL ) // Vertical scale
296 drawOneLine( pscale->scrn_pos.right, // Vertical scale bar
297 pscale->scrn_pos.bottom,
298 pscale->scrn_pos.right,
299 pscale->scrn_pos.top );
301 if( pscale->orientation == LEFT ) // Calculate x marker offset
302 marker_x = pscale->scrn_pos.left - 6;
304 if( pscale->orientation == RIGHT )
305 marker_x = pscale->scrn_pos.right;
307 // Draw the basic markings for the scale...
309 if( pscale->orientation == LEFT )
312 drawOneLine( pscale->scrn_pos.right - 3, // Bottom tick bar
313 pscale->scrn_pos.bottom,
314 pscale->scrn_pos.right,
315 pscale->scrn_pos.bottom );
317 drawOneLine( pscale->scrn_pos.right - 3, // Top tick bar
318 pscale->scrn_pos.top,
319 pscale->scrn_pos.right,
320 pscale->scrn_pos.top );
322 drawOneLine( pscale->scrn_pos.right, // Middle tick bar /Index
324 pscale->scrn_pos.right + 6,
329 if( pscale->orientation == RIGHT )
331 drawOneLine( pscale->scrn_pos.right,
332 pscale->scrn_pos.bottom,
333 pscale->scrn_pos.right+3,
334 pscale->scrn_pos.bottom );
336 drawOneLine( pscale->scrn_pos.right,
337 pscale->scrn_pos.top,
338 pscale->scrn_pos.right+3,
339 pscale->scrn_pos.top );
341 drawOneLine( pscale->scrn_pos.right,
343 pscale->scrn_pos.right-6,
347 // Work through from bottom to top of scale. Calculating where to put
348 // minor and major ticks.
350 for( i = (int)(vmin); i <= (int)(vmax); i++ )
352 if( pscale->sub_type == LIMIT ) { // Don't show ticks
353 condition = (i >= pscale->minimum_value); // below Minimum value.
356 if( pscale->sub_type == NOLIMIT ) {
360 if( condition ) // Show a tick if necessary
362 // Calculate the location of this tick
363 marker_y = (int)(pscale->scrn_pos.bottom + (i - vmin) * pscale->factor);
365 // Block calculation artifact from drawing ticks below min coordinate.
366 // Calculation here accounts for text height.
368 if( marker_y < (pscale->scrn_pos.bottom + 4)) { // Magic number!!!
371 if( (i%pscale->div_min) == 0) {
372 if( pscale->orientation == LEFT )
374 drawOneLine( marker_x + 3, marker_y, marker_x + 6, marker_y );
377 if( pscale->orientation == RIGHT )
379 drawOneLine( marker_x, marker_y, marker_x + 3, marker_y );
383 if( (i%pscale->div_max) == 0 ) {
384 drawOneLine( marker_x, marker_y,
385 marker_x + 6, marker_y );
387 disp_val = i % pscale->modulo;
389 disp_val = pscale->modulo;
392 disp_val += pscale->modulo;
394 if( disp_val == pscale->modulo ) {
401 sprintf( TextScale, "%d", disp_val );
402 if( pscale->orientation == LEFT ) {
403 textString( marker_x - 8 * strlen(TextScale) - 2, marker_y - 4,
404 TextScale, GLUT_BITMAP_8_BY_13 );
407 if( pscale->orientation == RIGHT ) {
408 textString( marker_x + 10, marker_y - 4,
409 TextScale, GLUT_BITMAP_8_BY_13 );
413 } // End if condition
414 } // End for range of i from vmin to vmax
415 } // End if VERTICAL SCALE TYPE
416 if( pscale->type == HORIZONTAL ) // Horizontal scale
418 if( pscale->orientation == TOP ) {
419 marker_y = pscale->scrn_pos.bottom;
422 if( pscale->orientation == BOTTOM ) {
423 marker_y = pscale->scrn_pos.bottom - 6;
426 drawOneLine( pscale->scrn_pos.left,
427 pscale->scrn_pos.bottom,
428 pscale->scrn_pos.right,
429 pscale->scrn_pos.bottom );
431 if( pscale->orientation == TOP )
433 drawOneLine( pscale->scrn_pos.left,
434 pscale->scrn_pos.bottom,
435 pscale->scrn_pos.left,
436 pscale->scrn_pos.bottom + 3 );
438 drawOneLine( pscale->scrn_pos.right,
439 pscale->scrn_pos.bottom,
440 pscale->scrn_pos.right,
441 pscale->scrn_pos.bottom + 6 );
443 drawOneLine( pscale->mid_scr,
444 pscale->scrn_pos.bottom,
446 pscale->scrn_pos.bottom - 6 );
450 if( pscale->orientation == BOTTOM )
452 drawOneLine( pscale->scrn_pos.left,
453 pscale->scrn_pos.bottom,
454 pscale->scrn_pos.left,
455 pscale->scrn_pos.bottom - 6 );
457 drawOneLine( pscale->scrn_pos.right,
458 pscale->scrn_pos.bottom,
459 pscale->scrn_pos.right,
460 pscale->scrn_pos.bottom - 6 );
462 drawOneLine( pscale->mid_scr,
463 pscale->scrn_pos.bottom,
465 pscale->scrn_pos.bottom + 6 );
469 for( i = (int)(vmin); i <= (int)(vmax); i++ ) // increment is faster than addition
471 if( pscale->sub_type == LIMIT ) {
472 condition = (i >= pscale->minimum_value);
475 if( pscale->sub_type == NOLIMIT ) {
480 marker_x = (int)(pscale->scrn_pos.left + (i - vmin) * pscale->factor);
481 if( (i%pscale->div_min) == 0 ) {
482 if( pscale->orientation == TOP )
484 drawOneLine( marker_x, marker_y, marker_x, marker_y + 3 );
487 if( pscale->orientation == BOTTOM )
489 drawOneLine( marker_x, marker_y + 3, marker_x, marker_y + 6 );
493 if( (i%pscale->div_max)==0 )
496 disp_val = i % pscale->modulo;
498 disp_val = pscale->modulo;
501 disp_val += pscale->modulo;
503 if( disp_val == pscale->modulo ) {
510 sprintf( TextScale, "%d", disp_val );
511 if( pscale->orientation == TOP )
513 drawOneLine( marker_x, marker_y, marker_x, marker_y+6 );
514 textString ( marker_x - 4 * strlen(TextScale), marker_y + 14,
515 TextScale, GLUT_BITMAP_8_BY_13 );
518 if( pscale->orientation == BOTTOM )
520 drawOneLine( marker_x, marker_y, marker_x, marker_y+6 );
521 textString ( marker_x - 4 * strlen(TextScale), marker_y - 14,
522 TextScale, GLUT_BITMAP_8_BY_13 );
533 // Draws a climb ladder in the center of the HUD
536 static void drawladder( HUD_ladder *ladder )
539 double roll_value, pitch_value;
540 int marker_x, marker_y;
544 int scr_min, scr_max;
547 int new_x_ini, new_x_end;
548 int new_y_ini, new_y_end;
554 double cos_roll_value, sin_roll_value;
555 // double cos_pitch_value, sin_pitch_value;
557 roll_value = (*ladder->load_roll)();
558 sin_roll_value = sin(roll_value);
559 cos_roll_value = cos(roll_value);
561 pitch_value = (*ladder->load_pitch)()*RAD_TO_DEG;
563 vmin = pitch_value - ladder->width_units/2;
564 vmax = pitch_value + ladder->width_units/2;
566 scr_min = ladder->scrn_pos.y - (ladder->scr_height/2);
567 scr_max = scr_min + ladder->scr_height;
570 mid_scr = scr_min + (scr_max-scr_min)/2;
573 marker_x = ladder->scrn_pos.x - ladder->scr_width/2;
575 factor = (scr_max-scr_min)/ladder->width_units;
577 for( i=(int)(vmin); i<=(int)(vmax); i+=1 )
582 marker_y = (int)(scr_min+(i-vmin)*factor);
583 if( i%ladder->div_units==0 )
585 sprintf( TextLadder, "%d", i );
586 if( ladder->scr_hole == 0 )
589 x_ini = ladder->scrn_pos.x - ladder->scr_width/2;
592 x_ini = ladder->scrn_pos.x - ladder->scr_width/2 - 10;
595 x_end = ladder->scrn_pos.x + ladder->scr_width/2;
597 new_x_ini = (int)(ladder->scrn_pos.x + \
598 (x_ini - ladder->scrn_pos.x) * cos_roll_value - \
599 (y_ini - ladder->scrn_pos.y) * sin_roll_value);
600 new_y_ini = (int)(ladder->scrn_pos.y + \
601 (x_ini - ladder->scrn_pos.x) * sin_roll_value + \
602 (y_ini - ladder->scrn_pos.y) * cos_roll_value);
603 new_x_end = (int)(ladder->scrn_pos.x + \
604 (x_end - ladder->scrn_pos.x) * cos_roll_value - \
605 (y_end - ladder->scrn_pos.y) * sin_roll_value);
606 new_y_end = (int)(ladder->scrn_pos.y + \
607 (x_end - ladder->scrn_pos.x) * sin_roll_value + \
608 (y_end - ladder->scrn_pos.y) * cos_roll_value);
612 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
616 glEnable(GL_LINE_STIPPLE);
617 glLineStipple( 1, 0x00FF );
618 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
619 glDisable(GL_LINE_STIPPLE);
621 textString( new_x_ini - 8 * strlen(TextLadder) - 8,
623 TextLadder, GLUT_BITMAP_8_BY_13 );
624 textString( new_x_end + 10,
626 TextLadder, GLUT_BITMAP_8_BY_13 );
631 x_ini = ladder->scrn_pos.x - ladder->scr_width/2;
634 x_ini = ladder->scrn_pos.x - ladder->scr_width/2 - 10;
637 x_end = ladder->scrn_pos.x - ladder->scr_width/2 + ladder->scr_hole/2;
639 new_x_ini = (int)(ladder->scrn_pos.x+ \
640 (x_ini - ladder->scrn_pos.x) * cos_roll_value -\
641 (y_ini - ladder->scrn_pos.y) * sin_roll_value);
642 new_y_ini = (int)(ladder->scrn_pos.y+ \
643 (x_ini - ladder->scrn_pos.x) * sin_roll_value +\
644 (y_ini - ladder->scrn_pos.y) * cos_roll_value);
645 new_x_end = (int)(ladder->scrn_pos.x+ \
646 (x_end - ladder->scrn_pos.x) * cos_roll_value -\
647 (y_end - ladder->scrn_pos.y) * sin_roll_value);
648 new_y_end = (int)(ladder->scrn_pos.y+ \
649 (x_end - ladder->scrn_pos.x) * sin_roll_value +\
650 (y_end - ladder->scrn_pos.y) * cos_roll_value);
654 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
658 glEnable(GL_LINE_STIPPLE);
659 glLineStipple( 1, 0x00FF );
660 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
661 glDisable(GL_LINE_STIPPLE);
663 textString( new_x_ini - 8 * strlen(TextLadder) - 8,
665 TextLadder, GLUT_BITMAP_8_BY_13 );
667 x_ini = ladder->scrn_pos.x + ladder->scr_width/2 - ladder->scr_hole/2;
670 x_end = ladder->scrn_pos.x + ladder->scr_width/2;
673 x_end = ladder->scrn_pos.x + ladder->scr_width/2 + 10;
676 new_x_ini = (int)(ladder->scrn_pos.x + \
677 (x_ini-ladder->scrn_pos.x)*cos_roll_value -\
678 (y_ini-ladder->scrn_pos.y)*sin_roll_value);
679 new_y_ini = (int)(ladder->scrn_pos.y + \
680 (x_ini-ladder->scrn_pos.x)*sin_roll_value +\
681 (y_ini-ladder->scrn_pos.y)*cos_roll_value);
682 new_x_end = (int)(ladder->scrn_pos.x + \
683 (x_end-ladder->scrn_pos.x)*cos_roll_value -\
684 (y_end-ladder->scrn_pos.y)*sin_roll_value);
685 new_y_end = (int)(ladder->scrn_pos.y + \
686 (x_end-ladder->scrn_pos.x)*sin_roll_value +\
687 (y_end-ladder->scrn_pos.y)*cos_roll_value);
691 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
695 glEnable(GL_LINE_STIPPLE);
696 glLineStipple( 1, 0x00FF );
697 drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
698 glDisable(GL_LINE_STIPPLE);
700 textString( new_x_end+10, new_y_end-4,
701 TextLadder, GLUT_BITMAP_8_BY_13 );
704 /* if( i%pscale->div_max==0 )
706 drawOneLine( marker_x, marker_y, marker_x+6, marker_y );
707 sprintf( TextScale, "%d", i );
708 if( pscale->orientation == LEFT )
710 textString( marker_x-8*strlen(TextScale)-2, marker_y-4,
711 TextScale, GLUT_BITMAP_8_BY_13 );
713 else if( pscale->orientation == RIGHT )
715 textString( marker_x+10, marker_y-4,
716 TextScale, GLUT_BITMAP_8_BY_13 );
725 // Draws an artificial horizon line in the center of the HUD
726 // (with or without a center hole)
728 // Needs: x_center, y_center, length, hole
731 static void drawhorizon( HUD_horizon *horizon )
735 int x_t_inc1, y_t_inc1;
737 int d_bottom_x, d_bottom_y;
738 int d_right_x, d_right_y;
739 int d_top_x, d_top_y;
740 int d_left_x, d_left_y;
742 int inc_b_x, inc_b_y;
743 int inc_r_x, inc_r_y;
744 int inc_t_x, inc_t_y;
745 int inc_l_x, inc_l_y;
747 // struct fgFLIGHT *f = ¤t_aircraft.flight;
748 double sin_bank, cos_bank;
749 double bank_angle, sideslip_angle;
750 double ss_const; // sideslip angle pixels per rad
752 bank_angle = (*horizon->load_roll)(); // Roll limit +/- 30 degrees
753 if( bank_angle < -FG_PI_2/3 ) {
754 bank_angle = -FG_PI_2/3;
755 }else if( bank_angle > FG_PI_2/3 ) {
756 bank_angle = FG_PI_2/3;
758 sideslip_angle = (*horizon->load_sideslip)(); // Sideslip limit +/- 5 degrees
759 if( sideslip_angle < -FG_PI/36.0 ) {
760 sideslip_angle = -FG_PI/36.0;
761 } else if( sideslip_angle > FG_PI/36.0 ) {
762 sideslip_angle = FG_PI/36.0;
765 // sin_bank = sin( FG_2PI-FG_Phi );
766 // cos_bank = cos( FG_2PI-FG_Phi );
767 sin_bank = sin(FG_2PI-bank_angle);
768 cos_bank = cos(FG_2PI-bank_angle);
770 x_inc1 = (int)(horizon->scr_width * cos_bank);
771 y_inc1 = (int)(horizon->scr_width * sin_bank);
772 x_inc2 = (int)(horizon->scr_hole * cos_bank);
773 y_inc2 = (int)(horizon->scr_hole * sin_bank);
775 x_t_inc1 = (int)(horizon->tee_height * sin_bank);
776 y_t_inc1 = (int)(horizon->tee_height * cos_bank);
779 d_bottom_y = (int)(-horizon->scr_hole);
780 d_right_x = (int)(horizon->scr_hole);
783 d_top_y = (int)(horizon->scr_hole);
784 d_left_x = (int)(-horizon->scr_hole);
787 ss_const = (horizon->scr_width*2)/(FG_2PI/36.0);// width represents 10 degrees
789 d_bottom_x += (int)(sideslip_angle*ss_const);
790 d_right_x += (int)(sideslip_angle*ss_const);
791 d_left_x += (int)(sideslip_angle*ss_const);
792 d_top_x += (int)(sideslip_angle*ss_const);
794 inc_b_x = (int)(d_bottom_x*cos_bank-d_bottom_y*sin_bank);
795 inc_b_y = (int)(d_bottom_x*sin_bank+d_bottom_y*cos_bank);
796 inc_r_x = (int)(d_right_x*cos_bank-d_right_y*sin_bank);
797 inc_r_y = (int)(d_right_x*sin_bank+d_right_y*cos_bank);
798 inc_t_x = (int)(d_top_x*cos_bank-d_top_y*sin_bank);
799 inc_t_y = (int)(d_top_x*sin_bank+d_top_y*cos_bank);
800 inc_l_x = (int)(d_left_x*cos_bank-d_left_y*sin_bank);
801 inc_l_y = (int)(d_left_x*sin_bank+d_left_y*cos_bank);
803 if( horizon->scr_hole == 0 )
805 drawOneLine( horizon->scrn_pos.x - x_inc1, horizon->scrn_pos.y - y_inc1, \
806 horizon->scrn_pos.x + x_inc1, horizon->scrn_pos.y + y_inc1 );
810 drawOneLine( horizon->scrn_pos.x - x_inc1, horizon->scrn_pos.y - y_inc1, \
811 horizon->scrn_pos.x - x_inc2, horizon->scrn_pos.y - y_inc2 );
812 drawOneLine( horizon->scrn_pos.x + x_inc2, horizon->scrn_pos.y + y_inc2, \
813 horizon->scrn_pos.x + x_inc1, horizon->scrn_pos.y + y_inc1 );
817 drawOneLine( horizon->scrn_pos.x + x_inc2, horizon->scrn_pos.y + y_inc2, \
818 horizon->scrn_pos.x + x_inc2 + x_t_inc1, horizon->scrn_pos.y + y_inc2 - y_t_inc1 );
819 drawOneLine( horizon->scrn_pos.x - x_inc2, horizon->scrn_pos.y - y_inc2, \
820 horizon->scrn_pos.x - x_inc2 + x_t_inc1, horizon->scrn_pos.y - y_inc2 - y_t_inc1 );
822 // draw sideslip diamond (it is not yet positioned correctly )
823 drawOneLine( horizon->scrn_pos.x + inc_b_x, \
824 horizon->scrn_pos.y + inc_b_y, \
825 horizon->scrn_pos.x + inc_r_x, \
826 horizon->scrn_pos.y + inc_r_y )
827 drawOneLine( horizon->scrn_pos.x + inc_r_x, \
828 horizon->scrn_pos.y + inc_r_y, \
829 horizon->scrn_pos.x + inc_t_x, \
830 horizon->scrn_pos.y + inc_t_y );
831 drawOneLine( horizon->scrn_pos.x + inc_t_x, \
832 horizon->scrn_pos.y + inc_t_y, \
833 horizon->scrn_pos.x + inc_l_x, \
834 horizon->scrn_pos.y + inc_l_y );
835 drawOneLine( horizon->scrn_pos.x + inc_l_x, \
836 horizon->scrn_pos.y + inc_l_y, \
837 horizon->scrn_pos.x + inc_b_x, \
838 horizon->scrn_pos.y + inc_b_y );
840 /* drawOneLine( horizon->scrn_pos.x + inc_b_x, \
841 horizon->scrn_pos.y + inc_b_y, \
842 horizon->scrn_pos.x + inc_r_x, \
843 horizon->scrn_pos.y + inc_r_y )
844 drawOneLine( horizon->scrn_pos.x + inc_r_x, \
845 horizon->scrn_pos.y + inc_r_y, \
846 horizon->scrn_pos.x + inc_t_x, \
847 horizon->scrn_pos.y + inc_t_y );
848 drawOneLine( horizon->scrn_pos.x + inc_t_x, \
849 horizon->scrn_pos.y + inc_t_y, \
850 horizon->scrn_pos.x + inc_l_x, \
851 horizon->scrn_pos.y + inc_l_y );
852 drawOneLine( horizon->scrn_pos.x + inc_l_x, \
853 horizon->scrn_pos.y + inc_l_y, \
854 horizon->scrn_pos.x + inc_b_x, \
855 horizon->scrn_pos.y + inc_b_y ); */
858 // drawControlSurfaces()
859 // Draws a representation of the control surfaces in their current state
860 // anywhere in the HUD
863 static void drawControlSurfaces( HUD_control_surfaces *ctrl_surf )
872 x_ini = ctrl_surf->scrn_pos.x;
873 y_ini = ctrl_surf->scrn_pos.y;
877 drawOneLine( x_ini, y_ini, x_end, y_ini );
878 drawOneLine( x_ini, y_ini, x_ini, y_end );
879 drawOneLine( x_ini, y_end, x_end, y_end );
880 drawOneLine( x_end, y_end, x_end, y_ini );
881 drawOneLine( x_ini + 30, y_ini, x_ini + 30, y_end );
882 drawOneLine( x_ini + 30, y_ini + 30, x_ini + 90, y_ini + 30 );
883 drawOneLine( x_ini + 90, y_ini, x_ini + 90, y_end );
884 drawOneLine( x_ini + 120, y_ini, x_ini + 120, y_end );
886 pCtls = current_aircraft.controls;
888 /* Draw elevator diagram */
889 textString( x_ini + 1, y_end-11, "E", GLUT_BITMAP_8_BY_13 );
890 drawOneLine( x_ini + 15, y_ini + 5, x_ini + 15, y_ini + 55 );
891 drawOneLine( x_ini + 14, y_ini + 30, x_ini + 16, y_ini + 30 );
892 tmp = y_ini + 5 + (int)(((pCtls->elevator + 1.0)/2)*50.0);
893 if( pCtls->elevator <= -0.01 || pCtls->elevator >= 0.01 )
895 drawOneLine( x_ini + 10, tmp, x_ini + 20, tmp );
899 drawOneLine( x_ini + 7, tmp, x_ini + 23, tmp);
902 /* Draw aileron diagram */
903 textString( x_ini + 30 + 1, y_end-11, "A", GLUT_BITMAP_8_BY_13 );
904 drawOneLine( x_ini + 35, y_end-15, x_ini + 85, y_end-15 );
905 drawOneLine( x_ini + 60, y_end-14, x_ini + 60, y_end-16 );
906 tmp = x_ini + 35 + (int)(((pCtls->aileron + 1.0)/2)*50.0);
907 if( pCtls->aileron <= -0.01 || pCtls->aileron >= 0.01 )
909 drawOneLine( tmp, y_end-20, tmp, y_end-10 );
913 drawOneLine( tmp, y_end - 25, tmp, y_end - 5 );
916 /* Draw rudder diagram */
917 textString ( x_ini + 30 + 1, y_ini + 21, "R", GLUT_BITMAP_8_BY_13 );
918 drawOneLine( x_ini + 35, y_ini + 15, x_ini + 85, y_ini + 15 );
919 drawOneLine( x_ini + 60, y_ini + 14, x_ini + 60, y_ini + 16 );
921 tmp = x_ini + 35 + (int)(((pCtls->rudder + 1.0) / 2) * 50.0);
922 if( pCtls->rudder <= -0.01 || pCtls->rudder >= 0.01 )
924 drawOneLine( tmp, y_ini + 20, tmp, y_ini + 10 );
928 drawOneLine( tmp, y_ini + 25, tmp, y_ini + 5 );
932 /* Draw throttle diagram */
933 textString( x_ini + 90 + 1, y_end-11, "T", GLUT_BITMAP_8_BY_13 );
934 textString( x_ini + 90 + 1, y_end-21, "r", GLUT_BITMAP_8_BY_13 );
935 drawOneLine( x_ini + 105, y_ini + 5, x_ini + 105, y_ini + 55 );
936 tmp = y_ini + 5 + (int)(pCtls->throttle[0]*50.0);
937 drawOneLine( x_ini + 100, tmp, x_ini + 110, tmp);
940 /* Draw elevator trim diagram */
941 textString( x_ini + 121, y_end-11, "T", GLUT_BITMAP_8_BY_13 );
942 textString( x_ini + 121, y_end-22, "m", GLUT_BITMAP_8_BY_13 );
943 drawOneLine( x_ini + 135, y_ini + 5, x_ini + 135, y_ini + 55 );
944 drawOneLine( x_ini + 134, y_ini + 30, x_ini + 136, y_ini + 30 );
946 tmp = y_ini + 5 + (int)(((pCtls->elevator_trim + 1)/2)*50.0);
947 if( pCtls->elevator_trim <= -0.01 || pCtls->elevator_trim >= 0.01 )
949 drawOneLine( x_ini + 130, tmp, x_ini + 140, tmp);
953 drawOneLine( x_ini + 127, tmp, x_ini + 143, tmp);
959 // Draws a label anywhere in the HUD
963 static void drawlabel( HUD_label *label )
970 if( !label ) { // Eliminate the possible, but absurd case.
974 if( label->pre_str != NULL) {
975 if( label->post_str != NULL ) {
976 sprintf( buffer, "%s%s%s", label->pre_str, \
981 sprintf( buffer, "%s%s", label->pre_str, \
986 if( label->post_str != NULL ) {
987 sprintf( buffer, "%s%s", label->format, \
990 } // else do nothing if both pre and post strings are nulls. Interesting.
993 sprintf( string, buffer, (*label->load_value)() );
995 fgPrintf( FG_COCKPIT, FG_DEBUG, buffer );
996 fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
997 fgPrintf( FG_COCKPIT, FG_DEBUG, string );
998 fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
1000 lenstr = strlen( string );
1001 if( label->justify == LEFT_JUST ) {
1002 posincr = -lenstr*8;
1005 if( label->justify == CENTER_JUST ) {
1006 posincr = -lenstr*4;
1009 if( label->justify == RIGHT_JUST ) {
1015 if( label->size == SMALL ) {
1016 textString( label->scrn_pos.x + posincr, label->scrn_pos.y,
1017 string, GLUT_BITMAP_8_BY_13);
1020 if( label->size == LARGE ) {
1021 textString( label->scrn_pos.x + posincr, label->scrn_pos.y,
1022 string, GLUT_BITMAP_9_BY_15);
1026 // The following routines concern HUD object/component object construction
1031 // Constructs a HUD object and then adds in instruments. At the present
1032 // the instruments are hard coded into the routine. Ultimately these need
1033 // to be defined by the aircraft's instrumentation records so that the
1034 // display for a Piper Cub doesn't show the speed range of a North American
1035 // mustange and the engine readouts of a B36!
1037 Hptr fgHUDInit( fgAIRCRAFT *current_aircraft )
1041 fgPrintf( FG_COCKPIT, FG_INFO, "Initializing HUD\n" );
1043 hud = (Hptr)calloc(sizeof( HUD),1);
1050 // For now lets just hardcode the hud here.
1051 // In the future, hud information has to come from the same place
1052 // aircraft information came from.
1054 fgHUDSetTimeMode( hud, NIGHT );
1055 fgHUDSetBrightness( hud, BRT_LIGHT );
1058 fgHUDAddHorizon( hud, 330, 100, 40, 5, 10, get_roll, get_sideslip );
1060 fgHUDAddLadder ( hud, 330, 285, 120, 180, 70, 10,
1061 NONE, 45, get_roll, get_pitch );
1063 fgHUDAddScale ( hud, VERTICAL, LIMIT, 200, 180, 380, 5, 10,
1064 LEFT, 0, 100, 50, 0, get_speed );
1066 fgHUDAddScale ( hud, HORIZONTAL, NOLIMIT, 180, 250, 410, 1, 5,
1067 BOTTOM, -40, 50, 21, 0, get_aoa );
1069 fgHUDAddScale ( hud, HORIZONTAL, NOLIMIT, 380, 200, 460, 5, 10,
1070 TOP, 0, 50, 50, 360, get_heading );
1072 fgHUDAddScale ( hud, VERTICAL, LIMIT, 460, 180, 380, 25, 100,
1073 RIGHT, 0, 15000, 250, 0, get_altitude);
1075 fgHUDAddLabel ( hud, 160, 150, SMALL, NOBLINK,
1076 RIGHT_JUST, NULL, " Kts", "%5.0f", get_speed );
1077 fgHUDAddLabel ( hud, 160, 135, SMALL, NOBLINK,
1078 RIGHT_JUST, NULL, " m", "%5.0f", get_altitude );
1079 fgHUDAddLabel ( hud, 160, 120, SMALL, NOBLINK,
1080 RIGHT_JUST, NULL, " Roll", "%5.2f", get_roll );
1081 fgHUDAddLabel ( hud, 160, 105, SMALL, NOBLINK,
1082 RIGHT_JUST, "Lat ", "d", "%03.0f", get_latitude );
1083 fgHUDAddLabel ( hud, 160, 90, SMALL, NOBLINK,
1084 RIGHT_JUST, NULL, " m", "%05.2f", get_lat_min );
1086 fgHUDAddLabel ( hud, 440, 150, SMALL, NOBLINK,
1087 RIGHT_JUST, NULL, " AOA", "%5.2f", get_aoa );
1088 fgHUDAddLabel ( hud, 440, 135, SMALL, NOBLINK,
1089 RIGHT_JUST, NULL, " Heading", "%5.0f", get_heading );
1090 fgHUDAddLabel ( hud, 440, 120, SMALL, NOBLINK,
1091 RIGHT_JUST, NULL, " Sideslip", "%5.2f", get_sideslip );
1092 fgHUDAddLabel ( hud, 440, 105, SMALL, NOBLINK,
1093 RIGHT_JUST, "Lon ", "d", "%04.0f", get_longitude );
1094 fgHUDAddLabel ( hud, 440, 90, SMALL, NOBLINK,
1095 RIGHT_JUST, NULL, " m", "%05.2f", get_long_min );
1097 fgHUDAddControlSurfaces( hud, 10, 10, NULL );
1099 // fgHUDAddControl( hud, HORIZONTAL, 50, 25, get_aileronval ); // was 10, 10
1100 // fgHUDAddControl( hud, VERTICAL, 150, 25, get_elevatorval ); // was 10, 10
1101 // fgHUDAddControl( hud, HORIZONTAL, 250, 25, get_rudderval ); // was 10, 10
1109 // This is a stand in for linked list code that will get replaced later
1110 // by some more elegant list handling code.
1112 void add_instrument( Hptr hud, HIptr pinstrument )
1114 if( !hud || !pinstrument ) {
1118 pinstrument->next = hud->instruments;
1119 hud->instruments = pinstrument;
1125 // Constructs a HUD_horizon "object" and installs it into the hud instrument
1128 Hptr fgHUDAddHorizon( Hptr hud, \
1134 double (*load_roll)(),
1135 double (*load_sideslip)() )
1137 HUD_horizon *phorizon;
1138 HUD_instr *pinstrument;
1143 // construct the parent object
1144 pinstrument = (HIptr)calloc(sizeof(HUD_instr),1);
1145 if( pinstrument == NULL ) {
1148 pinstrument->type = HUDhorizon; // ARTIFICIAL_HORIZON;
1150 // Construct the horizon
1151 phorizon = (HUD_horizon *) calloc( sizeof(HUD_horizon),1);
1152 if( phorizon == NULL ) {
1156 phorizon->scrn_pos.x = x_pos;
1157 phorizon->scrn_pos.y = y_pos;
1158 phorizon->scr_width = length | 1;
1159 phorizon->scr_hole = hole_len;
1160 phorizon->tee_height = tee_height;
1161 phorizon->load_roll = load_roll;
1162 phorizon->load_sideslip = load_sideslip;
1163 // Install the horizon in the parent.
1164 pinstrument->instr = phorizon;
1165 // Install the instrument into hud.
1166 add_instrument( hud, pinstrument);
1173 // Constructs a HUD_scale "object" and installs it into the hud instrument
1176 Hptr fgHUDAddScale( Hptr hud, \
1189 double (*load_value)() )
1192 HUD_instr *pinstrument;
1198 pinstrument = (HIptr)calloc(sizeof(HUD_instr),1);
1199 if( pinstrument == NULL ) {
1203 pinstrument->type = HUDscale;
1205 pscale = ( HUD_scale *)calloc(sizeof(HUD_scale),1);
1206 if( pscale == NULL ) {
1210 pscale->type = type;
1211 pscale->sub_type = sub_type;
1212 pscale->div_min = div_min;
1213 pscale->div_max = div_max;
1214 pscale->orientation = orientation;
1215 pscale->minimum_value = min_value;
1216 pscale->maximum_value = max_value;
1217 pscale->modulo = modulus;
1218 pscale->load_value = load_value;
1220 pscale->half_width_units = width_units / 2.0;
1221 pscale->scr_span = scr_max - scr_min; // Run of scan in pix coord
1222 pscale->scr_span |= 1; // Force odd span of units.
1223 // If span is odd number of units, mid will be correct.
1224 // If not it will be high by one coordinate unit. This is
1225 // an artifact of integer division needed for screen loc's.
1227 pscale->mid_scr = (pscale->scr_span >> 1) + scr_min;
1229 // Calculate the number of screen units per indicator unit
1230 // We must force floating point calculation or the factor
1231 // will be low and miss locate tics by several units.
1233 pscale->factor = (double)pscale->scr_span / (double)width_units;
1237 pscale->scrn_pos.left = scr_min;
1238 pscale->scrn_pos.top = scr_pos;
1239 pscale->scrn_pos.right = scr_max;
1240 pscale->scrn_pos.bottom = scr_pos;
1245 pscale->scrn_pos.left = scr_pos;
1246 pscale->scrn_pos.top = scr_max;
1247 pscale->scrn_pos.right = scr_pos;
1248 pscale->scrn_pos.bottom = scr_min;
1251 // Install the scale
1252 pinstrument->instr = pscale;
1253 // Install the instrument into hud.
1254 add_instrument( hud, pinstrument);
1261 // Constructs a HUD_Label object and installs it into the hud instrument
1263 Hptr fgHUDAddLabel( Hptr hud, \
1272 double (*load_value)() )
1275 HUD_instr *pinstrument;
1281 pinstrument = (HIptr)calloc(sizeof(HUD_instr),1);
1282 if( pinstrument == NULL ) {
1285 pinstrument->type = HUDlabel;
1287 plabel = (HUD_label *)calloc(sizeof(HUD_label),1);
1288 if( plabel == NULL ){
1292 plabel->scrn_pos.x = x_pos;
1293 plabel->scrn_pos.y = y_pos;
1294 plabel->size = size;
1295 plabel->blink = blink;
1296 plabel->justify = justify;
1297 plabel->pre_str = pre_str;
1298 plabel->post_str = post_str;
1299 plabel->format = format;
1300 plabel->load_value = load_value;
1301 // Install the label
1302 pinstrument->instr = plabel;
1303 // Install the instrument into hud.
1304 add_instrument( hud, pinstrument);
1311 // Contains code that constructs a ladder "object" and installs it as
1312 // a hud instrument in the hud instrument list.
1314 Hptr fgHUDAddLadder( Hptr hud, \
1323 double (*load_roll)(),
1324 double (*load_pitch)() )
1326 HUD_ladder *pladder;
1327 HUD_instr *pinstrument;
1333 pinstrument = (HIptr)calloc(sizeof(HUD_instr),1);
1334 if( pinstrument == NULL )
1337 pinstrument->type = HUDladder;
1339 pladder = (HUD_ladder *)calloc(sizeof(HUD_ladder),1);
1340 if( pladder == NULL )
1343 pladder->type = 0; // Not used.
1344 pladder->scrn_pos.x = x_pos;
1345 pladder->scrn_pos.y = y_pos;
1346 pladder->scr_width = scr_width;
1347 pladder->scr_height = scr_height;
1348 pladder->scr_hole = hole_len;
1349 pladder->div_units = div_units;
1350 pladder->label_position = label_pos;
1351 pladder->width_units = width_units;
1352 pladder->load_roll = load_roll;
1353 pladder->load_pitch = load_pitch;
1355 pinstrument->instr = pladder;
1356 // Install the instrument into hud.
1357 add_instrument( hud, pinstrument);
1361 // fgHUDAddControlSurfaces()
1363 // Adds the control surface indicators which make up for the lack of seat
1364 // of the pants feel. Should be unnecessary with joystick and pedals
1365 // enabled. But that is another improvement. Also, what of flaps? Spoilers?
1366 // This may need to be expanded or flattened into multiple indicators,
1367 // vertical and horizontal.
1369 Hptr fgHUDAddControlSurfaces( Hptr hud,
1372 double (*load_value)() )
1374 HUD_control_surfaces *pcontrol_surfaces;
1375 HUD_instr *pinstrument;
1382 pinstrument = (HIptr)calloc(sizeof(HUD_instr),1);
1383 if( !pinstrument ) {
1386 pinstrument->type = HUDcontrol_surfaces;
1389 pcontrol_surfaces = (HUD_control_surfaces *)calloc(sizeof(HUD_control),1);
1390 if( !pcontrol_surfaces ) {
1394 pcontrol_surfaces->scrn_pos.x = x_pos;
1395 pcontrol_surfaces->scrn_pos.y = y_pos;
1396 pcontrol_surfaces->load_value = load_value;
1398 pinstrument->instr = pcontrol_surfaces;
1400 add_instrument( hud, pinstrument);
1409 Hptr fgHUDAddControl( Hptr hud, \
1418 double (*load_value)() )
1420 HUD_control *pcontrol;
1421 HUD_instr *pinstrument;
1428 pinstrument = (HIptr)calloc(sizeof(HUD_instr),1);
1429 if( !pinstrument ) {
1432 pinstrument->type = HUDcontrol;
1435 pcontrol = (HUD_control *)calloc(sizeof(HUD_control),1);
1436 if( !(pcontrol == NULL) ) {
1439 pcontrol->scrn_pos.x = ctrl_x;
1440 pcontrol->scrn_pos.y = ctrl_y;
1441 pcontrol->ctrl_length = ctrl_length;
1442 pcontrol->orientation = orientation;
1443 pcontrol->alignment = alignment;
1444 pcontrol->min_value = min_value;
1445 pcontrol->max_value = max_value;
1446 pcontrol->width_units = width_units;
1447 pcontrol->load_value = load_value;
1449 pinstrument->instr = pcontrol;
1451 add_instrument( hud, pinstrument);
1457 Hptr fgHUDAddMovingHorizon( Hptr hud, \
1467 Hptr fgHUDAddCircularLadder( Hptr hud, \
1477 Hptr fgHUDAddNumDisp( Hptr hud, \
1492 // Performs a once around the list of calls to instruments installed in
1493 // the HUD object with requests for redraw. Kinda. It will when this is
1497 void fgUpdateHUD( Hptr hud ) {
1500 glMatrixMode(GL_PROJECTION);
1504 gluOrtho2D(0, 640, 0, 480);
1505 glMatrixMode(GL_MODELVIEW);
1509 glColor3f(1.0, 1.0, 1.0);
1512 glDisable(GL_DEPTH_TEST);
1513 glDisable(GL_LIGHTING);
1516 // This is a good improvement, but needs
1517 // to respond to a dial instead of time
1518 // of day. Of course, we have no dial!
1519 if( hud->time_of_day==DAY) {
1520 switch (hud->brightness) {
1522 glColor3f (0.1, 0.9, 0.1);
1525 glColor3f (0.1, 0.7, 0.0);
1528 glColor3f (0.0, 0.5, 0.0);
1531 else if( hud->time_of_day==NIGHT) {
1532 switch (hud->brightness) {
1534 glColor3f (0.9, 0.1, 0.1);
1537 glColor3f (0.7, 0.0, 0.1);
1540 glColor3f (0.5, 0.0, 0.0);
1544 glColor3f (0.1, 0.9, 0.1);
1547 fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d Status %d\n",
1548 hud->code, hud->status );
1550 phud_instr = hud->instruments;
1551 while( phud_instr ) {
1552 /* printf("Drawing Instrument %d\n", phud_instr->type); */
1554 switch (phud_instr->type) {
1555 case HUDhorizon: // ARTIFICIAL HORIZON
1556 drawhorizon( (pHUDhorizon)phud_instr->instr );
1559 case HUDscale: // Need to simplify this call.
1560 drawscale ( (pHUDscale) phud_instr->instr );
1564 drawlabel ( (pHUDlabel) phud_instr->instr );
1568 drawladder( (pHUDladder) phud_instr->instr );
1572 // drawControl( (pHUDcontrol) phud_instr->instr );
1575 case HUDcontrol_surfaces:
1576 drawControlSurfaces( (pHUDControlSurfaces) phud_instr->instr );
1579 default:; // Ignore anything you don't know about.
1582 phud_instr = phud_instr->next;
1585 glEnable(GL_DEPTH_TEST);
1586 glEnable(GL_LIGHTING);
1587 glMatrixMode(GL_PROJECTION);
1589 glMatrixMode(GL_MODELVIEW);
1593 void fgHUDSetTimeMode( Hptr hud, int time_of_day )
1596 hud->time_of_day = time_of_day;
1600 void fgHUDSetBrightness( Hptr hud, int brightness )
1603 hud->brightness = brightness;
1608 /* Revision 1.2 1998/04/25 22:06:27 curt
1609 /* Edited cvs log messages in source files ... bad bad bad!
1611 * Revision 1.1 1998/04/24 00:45:57 curt
1612 * C++-ifing the code a bit.
1614 * Revision 1.22 1998/04/18 04:14:02 curt
1615 * Moved fg_debug.c to it's own library.
1617 * Revision 1.21 1998/04/03 21:55:28 curt
1618 * Converting to Gnu autoconf system.
1621 * Revision 1.20 1998/03/09 22:48:40 curt
1622 * Minor "formatting" tweaks.
1624 * Revision 1.19 1998/02/23 20:18:28 curt
1625 * Incorporated Michele America's hud changes.
1627 * Revision 1.18 1998/02/21 14:53:10 curt
1628 * Added Charlie's HUD changes.
1630 * Revision 1.17 1998/02/20 00:16:21 curt
1631 * Thursday's tweaks.
1633 * Revision 1.16 1998/02/19 13:05:49 curt
1634 * Incorporated some HUD tweaks from Michelle America.
1635 * Tweaked the sky's sunset/rise colors.
1636 * Other misc. tweaks.
1638 * Revision 1.15 1998/02/16 13:38:39 curt
1639 * Integrated changes from Charlie Hotchkiss.
1641 * Revision 1.14 1998/02/12 21:59:41 curt
1642 * Incorporated code changes contributed by Charlie Hotchkiss
1643 * <chotchkiss@namg.us.anritsu.com>
1645 * Revision 1.12 1998/02/09 15:07:48 curt
1648 * Revision 1.11 1998/02/07 15:29:34 curt
1649 * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
1650 * <chotchkiss@namg.us.anritsu.com>
1652 * Revision 1.10 1998/02/03 23:20:14 curt
1653 * Lots of little tweaks to fix various consistency problems discovered by
1654 * Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
1655 * passed arguments along to the real printf(). Also incorporated HUD changes
1656 * by Michele America.
1658 * Revision 1.9 1998/01/31 00:43:04 curt
1659 * Added MetroWorks patches from Carmen Volpe.
1661 * Revision 1.8 1998/01/27 00:47:51 curt
1662 * Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
1663 * system and commandline/config file processing code.
1665 * Revision 1.7 1998/01/19 18:40:20 curt
1666 * Tons of little changes to clean up the code and to remove fatal errors
1667 * when building with the c++ compiler.
1669 * Revision 1.6 1997/12/15 23:54:34 curt
1670 * Add xgl wrappers for debugging.
1671 * Generate terrain normals on the fly.
1673 * Revision 1.5 1997/12/10 22:37:39 curt
1674 * Prepended "fg" on the name of all global structures that didn't have it yet.
1675 * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
1677 * Revision 1.4 1997/09/23 00:29:32 curt
1678 * Tweaks to get things to compile with gcc-win32.
1680 * Revision 1.3 1997/09/05 14:17:26 curt
1681 * More tweaking with stars.
1683 * Revision 1.2 1997/09/04 02:17:30 curt
1686 * Revision 1.1 1997/08/29 18:03:22 curt