]> git.mxchange.org Git - flightgear.git/blobdiff - Cockpit/hud.c
Add xgl wrappers for debugging.
[flightgear.git] / Cockpit / hud.c
index 453a8dd84dbb62d6d127573466dfcd5766f6989a..ce189c1d36a63aed3cc432ffd14599e11b4b253b 100644 (file)
  
 
 #include <GL/glut.h>
-
 #include <stdlib.h>
+#ifndef WIN32
+#  include <values.h>  /* for MAXINT */
+#endif /* not WIN32 */
 #include "hud.h"
 
-#include "../constants.h"
+#include "../Include/constants.h"
 
 #include "../Aircraft/aircraft.h"
 #include "../Scenery/mesh.h"
@@ -384,7 +386,7 @@ static void drawhorizon( struct HUD_horizon horizon )
 {
        int x_inc1, y_inc1;
        int x_inc2, y_inc2;
-       struct FLIGHT *f;
+       struct fgFLIGHT *f;
        double sin_bank, cos_bank;
        double bank_angle;
               
@@ -392,10 +394,10 @@ static void drawhorizon( struct HUD_horizon horizon )
        
        bank_angle = (*horizon.load_value)();
 
-       // sin_bank = sin( 2*PI-FG_Phi );
-       // cos_bank = cos( 2*PI-FG_Phi );
-       sin_bank = sin(2*PI-bank_angle);
-       cos_bank = cos(2*PI-bank_angle);
+       // sin_bank = sin( FG_2PI-FG_Phi );
+       // cos_bank = cos( FG_2PI-FG_Phi );
+       sin_bank = sin(FG_2PI-bank_angle);
+       cos_bank = cos(FG_2PI-bank_angle);
        x_inc1 = (int)(horizon.scr_width*cos_bank);
        y_inc1 = (int)(horizon.scr_width*sin_bank);
        x_inc2 = (int)(horizon.scr_hole*cos_bank);
@@ -462,15 +464,15 @@ static void drawlabel( struct HUD_label label )
 
 double get_speed()
 {
-       struct FLIGHT *f;
+       struct fgFLIGHT *f;
               
        f = &current_aircraft.flight;
-       return( FG_V_true_kts );
+       return( FG_V_equiv_kts );
 }
 
 double get_aoa()
 {
-       struct FLIGHT *f;
+       struct fgFLIGHT *f;
               
        f = &current_aircraft.flight;
        return( FG_Gamma_vert_rad*RAD_TO_DEG );
@@ -478,7 +480,7 @@ double get_aoa()
 
 double get_roll()
 {
-       struct FLIGHT *f;
+       struct fgFLIGHT *f;
               
        f = &current_aircraft.flight;
        return( FG_Phi );
@@ -486,7 +488,7 @@ double get_roll()
 
 double get_pitch()
 {
-       struct FLIGHT *f;
+       struct fgFLIGHT *f;
               
        f = &current_aircraft.flight;
        return( FG_Theta );
@@ -494,15 +496,15 @@ double get_pitch()
 
 double get_heading()
 {
-       struct FLIGHT *f;
+       struct fgFLIGHT *f;
               
        f = &current_aircraft.flight;
-       return( FG_Gamma_horiz_rad*RAD_TO_DEG ); 
+       return( FG_Psi*RAD_TO_DEG ); 
 }
 
 double get_altitude()
 {
-       struct FLIGHT *f;
+       struct fgFLIGHT *f;
        double rough_elev;
               
        f = &current_aircraft.flight;
@@ -520,7 +522,7 @@ void add_instrument( Hptr hud, HIptr instrument )
        // while( ++instruments
 }
 
-Hptr fgHUDInit( struct AIRCRAFT current_aircraft, int color )
+Hptr fgHUDInit( struct fgAIRCRAFT current_aircraft, int color )
 {
        Hptr hud;
        
@@ -531,13 +533,13 @@ Hptr fgHUDInit( struct AIRCRAFT current_aircraft, int color )
        hud->code = 123;
        hud->status = 0;
        
-       // For now let's just hardcode a hud here .
+       // For now lets just hardcode a hud here .
        // In the future, hud information has to come from the same place 
        // aircraft information came
        
        fgHUDAddHorizon( hud, 590, 50, 40, 20, get_roll );
        fgHUDAddScale( hud, VERTICAL, 220, 100, 280, 5, 10, LEFT, LEFT, 0, 100, get_speed );
-       fgHUDAddScale( hud, VERTICAL, 440, 100, 280, 1, 5, RIGHT, RIGHT, -MAXINT, 25, get_aoa );
+       fgHUDAddScale( hud, VERTICAL, 440, 100, 280, 1, 5, RIGHT, RIGHT, -400, 25, get_aoa );
        fgHUDAddScale( hud, HORIZONTAL, 280, 220, 440, 5, 10, TOP, TOP, 0, 50, get_heading );
        fgHUDAddLabel( hud, 180, 85, SMALL, NOBLINK, RIGHT_JUST, NULL, " Kts", "%5.0f", get_speed );
        fgHUDAddLabel( hud, 180, 73, SMALL, NOBLINK, RIGHT_JUST, NULL, " m", "%5.0f", get_altitude );
@@ -546,10 +548,10 @@ Hptr fgHUDInit( struct AIRCRAFT current_aircraft, int color )
        return( hud );
 }
 
-
 Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, \
                                                int hole_len, double (*load_value)() )
 {
+#ifndef WIN32
        struct HUD_horizon *horizon;
        struct HUD_instr *instrument;
        HIptr tmp_first, tmp_next;
@@ -580,11 +582,13 @@ Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, \
        hud->instruments = instrument;
 
        return( hud );
+#endif
 }
 
 Hptr fgHUDAddScale( Hptr hud, int type, int scr_pos, int scr_min, int scr_max, int div_min, int div_max, \
                                        int orientation, int with_min, int min_value, int width_units, double (*load_value)() )
 {
+#ifndef WIN32
        struct HUD_scale *scale;
        struct HUD_instr *instrument;
        HIptr tmp_first, tmp_next;
@@ -621,11 +625,13 @@ Hptr fgHUDAddScale( Hptr hud, int type, int scr_pos, int scr_min, int scr_max, i
        hud->instruments = instrument;
 
        return( hud );
+#endif
 }
 
 Hptr fgHUDAddLabel( Hptr hud, int x_pos, int y_pos, int size, int blink, int justify, \
                                        char *pre_str, char *post_str, char *format, double (*load_value)() )
 {
+#ifndef WIN32
        struct HUD_label *label;
        struct HUD_instr *instrument;
        HIptr tmp_first, tmp_next;
@@ -660,12 +666,14 @@ Hptr fgHUDAddLabel( Hptr hud, int x_pos, int y_pos, int size, int blink, int jus
        hud->instruments = instrument;
 
        return( hud );
+#endif
 }
 
 Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_height, \
                                        int hole_len, int div_units, int label_pos, int width_units, \
                                        double (*load_roll)(), double (*load_pitch)() )
 {
+#ifndef WIN32
        struct HUD_ladder *ladder;
        struct HUD_instr *instrument;
        HIptr tmp_first, tmp_next;
@@ -683,7 +691,7 @@ Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_heig
        ladder = (struct HUD_ladder *)calloc(sizeof(struct HUD_ladder),1);
        if( ladder == NULL )
                return( NULL );
-       
+
        instrument->type = LADDER;
        instrument->instr = *ladder;
        instrument->instr.ladder.type = 0;      // Not used.
@@ -702,7 +710,7 @@ Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_heig
        hud->instruments = instrument;
 
        return( hud );
-
+#endif
 }
 
 /*
@@ -799,7 +807,24 @@ void fgUpdateHUD( Hptr hud )
 
 
 /* $Log$
-/* Revision 1.1  1997/08/29 18:03:22  curt
-/* Initial revision.
+/* Revision 1.6  1997/12/15 23:54:34  curt
+/* Add xgl wrappers for debugging.
+/* Generate terrain normals on the fly.
 /*
+ * Revision 1.5  1997/12/10 22:37:39  curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
+ * Revision 1.4  1997/09/23 00:29:32  curt
+ * Tweaks to get things to compile with gcc-win32.
+ *
+ * Revision 1.3  1997/09/05 14:17:26  curt
+ * More tweaking with stars.
+ *
+ * Revision 1.2  1997/09/04 02:17:30  curt
+ * Shufflin' stuff.
+ *
+ * Revision 1.1  1997/08/29 18:03:22  curt
+ * Initial revision.
+ *
  */