1
0
Fork 0

Fixed some warnings, updated whitespace.

This commit is contained in:
curt 2001-06-12 23:37:29 +00:00
parent 3d0ed99651
commit d0126ec533
5 changed files with 515 additions and 524 deletions

View file

@ -714,7 +714,7 @@ void fgCockpitUpdate( void ) {
int iwidth = xsize_node->getIntValue(); int iwidth = xsize_node->getIntValue();
int iheight = ysize_node->getIntValue(); int iheight = ysize_node->getIntValue();
float width = iwidth; float width = iwidth;
float height = iheight; // float height = iheight;
// FIXME: inefficient // FIXME: inefficient
if ( hud_visibility_node->getBoolValue() ) { if ( hud_visibility_node->getBoolValue() ) {

View file

@ -890,10 +890,10 @@ void fgHUDalphaInit( void ) {
puGetStringDescender (HUDalphaLabelFont) + puGetStringDescender (HUDalphaLabelFont) +
PUSTR_TGAP + PUSTR_BGAP + 5; PUSTR_TGAP + PUSTR_BGAP + 5;
puFrame * /* puFrame *
HUDalphaFrame = new puFrame ( 0, 0, HUDalphaFrame = new puFrame ( 0, 0, DialogWidth,
DialogWidth, 85 + nSliders
85 + nSliders * horiz_slider_height ); * horiz_slider_height ); */
puText * puText *
HUDalphaDialogMessage = new puText ( labelX, HUDalphaDialogMessage = new puText ( labelX,
@ -920,7 +920,6 @@ void fgHUDalphaInit( void ) {
sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha ); sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
HUDalphaText-> setLabel ( SliderText[ 0 ] ) ; HUDalphaText-> setLabel ( SliderText[ 0 ] ) ;
puOneShot * puOneShot *
HUDalphaOkButton = new puOneShot ( 10, 10, 60, 45 ); HUDalphaOkButton = new puOneShot ( 10, 10, 60, 45 );
HUDalphaOkButton-> setLegend ( gui_msg_OK ); HUDalphaOkButton-> setLegend ( gui_msg_OK );
@ -937,6 +936,7 @@ void fgHUDalphaInit( void ) {
#undef HORIZONTAL #undef HORIZONTAL
} }
void fgHUDReshape(void) { void fgHUDReshape(void) {
if ( HUDtext ) if ( HUDtext )
delete HUDtext; delete HUDtext;
@ -956,6 +956,7 @@ static void set_hud_color(float r, float g, float b) {
glColor3f(r,g,b); glColor3f(r,g,b);
} }
// fgUpdateHUD // fgUpdateHUD
// //
// Performs a once around the list of calls to instruments installed in // Performs a once around the list of calls to instruments installed in

View file

@ -76,6 +76,7 @@ hud_card ::
hud_card( const hud_card & image): hud_card( const hud_card & image):
instr_scale( (const instr_scale & ) image), instr_scale( (const instr_scale & ) image),
val_span( image.val_span), val_span( image.val_span),
type(image.type),
half_width_units (image.half_width_units), half_width_units (image.half_width_units),
draw_tick_bottom (image.draw_tick_bottom), draw_tick_bottom (image.draw_tick_bottom),
draw_tick_top (image.draw_tick_top), draw_tick_top (image.draw_tick_top),
@ -86,7 +87,6 @@ hud_card( const hud_card & image):
draw_cap_right (image.draw_cap_right), draw_cap_right (image.draw_cap_right),
draw_cap_left (image.draw_cap_left), draw_cap_left (image.draw_cap_left),
marker_offset (image.marker_offset), marker_offset (image.marker_offset),
type(image.type),
pointer (image.pointer), pointer (image.pointer),
pointer_type (image.pointer_type) pointer_type (image.pointer_type)
@ -120,8 +120,8 @@ operator = (const hud_card & rhs )
type = rhs.type; type = rhs.type;
pointer = rhs.pointer; pointer = rhs.pointer;
pointer_type = rhs.pointer_type; pointer_type = rhs.pointer_type;
} }
return *this; return *this;
} }
@ -129,12 +129,12 @@ void hud_card ::
draw( void ) // (HUD_scale * pscale ) draw( void ) // (HUD_scale * pscale )
{ {
float vmin, vmax; float vmin = 0.0, vmax = 0.0;
int marker_xs; int marker_xs;
int marker_xe; int marker_xe;
int marker_ys; int marker_ys;
int marker_ye; int marker_ye;
int text_x, text_y; int text_x = 0, text_y = 0;
int lenstr; int lenstr;
int height, width; int height, width;
int i, last; int i, last;
@ -142,7 +142,6 @@ draw( void ) // (HUD_scale * pscale )
bool condition; bool condition;
int disp_val = 0; int disp_val = 0;
POINT mid_scr = get_centroid(); POINT mid_scr = get_centroid();
float cur_value = get_value(); float cur_value = get_value();
RECT scrn_rect = get_location(); RECT scrn_rect = get_location();
@ -151,16 +150,13 @@ draw( void ) // (HUD_scale * pscale )
height = scrn_rect.top + scrn_rect.bottom; height = scrn_rect.top + scrn_rect.bottom;
width = scrn_rect.left + scrn_rect.right; width = scrn_rect.left + scrn_rect.right;
if(type=="guage") { if(type=="guage") {
vmin = min_val(); vmin = min_val();
vmax = max_val(); vmax = max_val();
text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/); text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/);
text_x = marker_xs; text_x = marker_xs;
} } else {
else
if(type=="tape") { if(type=="tape") {
vmin = cur_value - half_width_units; // width units == needle travel vmin = cur_value - half_width_units; // width units == needle travel
@ -168,7 +164,7 @@ draw( void ) // (HUD_scale * pscale )
text_x = mid_scr.x; text_x = mid_scr.x;
text_y = mid_scr.y; text_y = mid_scr.y;
} }
}
// Draw the basic markings for the scale... // Draw the basic markings for the scale...
@ -202,9 +198,9 @@ draw( void ) // (HUD_scale * pscale )
// glEnd(); // glEnd();
// We do not use else in the following so that combining the two // We do not use else in the following so that combining the
// options produces a "caged" display with double carrots. The // two options produces a "caged" display with double
// same is done for horizontal card indicators. // carrots. The same is done for horizontal card indicators.
if( huds_left(options) ) { // Calculate x marker offset if( huds_left(options) ) { // Calculate x marker offset
@ -221,7 +217,7 @@ draw( void ) // (HUD_scale * pscale )
// drawOneLine( marker_xs, mid_scr.y, // drawOneLine( marker_xs, mid_scr.y,
// marker_xe, mid_scr.y - scrn_rect.right / 6); // marker_xe, mid_scr.y - scrn_rect.right / 6);
// draw pointer // draw pointer
if(pointer) { if(pointer) {
if(pointer_type=="fixed") { if(pointer_type=="fixed") {
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
@ -229,13 +225,12 @@ draw( void ) // (HUD_scale * pscale )
glVertex2f( marker_offset+marker_xs, text_y); glVertex2f( marker_offset+marker_xs, text_y);
glVertex2f( marker_offset+marker_xe, text_y - scrn_rect.right / 6); glVertex2f( marker_offset+marker_xe, text_y - scrn_rect.right / 6);
glEnd(); glEnd();
} } else {
else
if(pointer_type=="moving") { if(pointer_type=="moving") {
//Code for Moving Type Pointer to be included. //Code for Moving Type Pointer to be included.
} }
} }
}
} }
if( huds_right(options) ) { // We'll default this for now. if( huds_right(options) ) { // We'll default this for now.
@ -251,7 +246,7 @@ draw( void ) // (HUD_scale * pscale )
// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6, // drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
// marker_xe, mid_scr.y); // marker_xe, mid_scr.y);
// draw pointer // draw pointer
if(pointer) { if(pointer) {
if(pointer_type=="fixed") { if(pointer_type=="fixed") {
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
@ -260,12 +255,13 @@ draw( void ) // (HUD_scale * pscale )
glVertex2f( -marker_offset+scrn_rect.left, text_y - scrn_rect.right / 6); glVertex2f( -marker_offset+scrn_rect.left, text_y - scrn_rect.right / 6);
glEnd(); glEnd();
} }
else else {
if(pointer_type=="moving") { if(pointer_type=="moving") {
// Code for Moving Type Pointer to be included. // Code for Moving Type Pointer to be included.
} }
} }
} }
}
// At this point marker x_start and x_end values are transposed. // At this point marker x_start and x_end values are transposed.
// To keep this from confusing things they are now interchanged. // To keep this from confusing things they are now interchanged.
@ -278,13 +274,12 @@ draw( void ) // (HUD_scale * pscale )
// Work through from bottom to top of scale. Calculating where to put // Work through from bottom to top of scale. Calculating where to put
// minor and major ticks. // minor and major ticks.
// draw scale or tape // draw scale or tape
// last = FloatToInt(vmax)+1; // last = FloatToInt(vmax)+1;
// i = FloatToInt(vmin); // i = FloatToInt(vmin);
last = (int)vmax + 1; last = (int)vmax + 1;
i = (int)vmin; i = (int)vmin;
for( ; i <last ; i++ ) for( ; i <last ; i++ ) {
{
condition = true; condition = true;
if( !modulo()) { if( !modulo()) {
if( i < min_val()) { if( i < min_val()) {
@ -300,7 +295,8 @@ draw( void ) // (HUD_scale * pscale )
// Calculation here accounts for text height. // Calculation here accounts for text height.
if(( marker_ys < (scrn_rect.top + 4)) | if(( marker_ys < (scrn_rect.top + 4)) |
( marker_ys > (height - 4))) { ( marker_ys > (height - 4)))
{
// Magic numbers!!! // Magic numbers!!!
continue; continue;
} }
@ -320,13 +316,11 @@ draw( void ) // (HUD_scale * pscale )
// glVertex2f( marker_xe, marker_ys); // glVertex2f( marker_xe, marker_ys);
// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys ); // glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
// glEnd(); // glEnd();
} } else {
else {
if( huds_left(options) ) { if( huds_left(options) ) {
drawOneLine( marker_xs + 4, marker_ys, drawOneLine( marker_xs + 4, marker_ys,
marker_xe, marker_ys ); marker_xe, marker_ys );
} } else {
else {
drawOneLine( marker_xs, marker_ys, drawOneLine( marker_xs, marker_ys,
marker_xe - 4, marker_ys ); marker_xe - 4, marker_ys );
} }
@ -334,9 +328,9 @@ draw( void ) // (HUD_scale * pscale )
} }
} }
} }
if( div_max() ) { if( div_max() ) {
if( !(i%(int)div_max()) ) if( !(i%(int)div_max()) ) {
{
if(modulo()) { if(modulo()) {
if( disp_val < 0) { if( disp_val < 0) {
while(disp_val < 0) while(disp_val < 0)
@ -369,16 +363,14 @@ draw( void ) // (HUD_scale * pscale )
textString ( marker_xs + 2, marker_ys, textString ( marker_xs + 2, marker_ys,
TextScale, GLUT_BITMAP_8_BY_13 ); TextScale, GLUT_BITMAP_8_BY_13 );
} }
} } else {
else {
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys ); drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
if( !huds_notext(options) ) { if( !huds_notext(options) ) {
if( huds_left(options) ) { if( huds_left(options) ) {
textString( marker_xs - 8 * lenstr - 2, textString( marker_xs - 8 * lenstr - 2,
marker_ys - 4, marker_ys - 4,
TextScale, GLUT_BITMAP_8_BY_13 ); TextScale, GLUT_BITMAP_8_BY_13 );
} } else {
else {
textString( marker_xe + 3 * lenstr, textString( marker_xe + 3 * lenstr,
marker_ys - 4, marker_ys - 4,
TextScale, GLUT_BITMAP_8_BY_13 ); TextScale, GLUT_BITMAP_8_BY_13 );
@ -436,7 +428,7 @@ draw( void ) // (HUD_scale * pscale )
// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top); // mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
// drawOneLine( mid_scr.x, marker_ye, // drawOneLine( mid_scr.x, marker_ye,
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top); // mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
// draw pointer // draw pointer
if(pointer) { if(pointer) {
if(pointer_type=="fixed") { if(pointer_type=="fixed") {
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
@ -444,14 +436,14 @@ draw( void ) // (HUD_scale * pscale )
glVertex2f( marker_xs, marker_ye); glVertex2f( marker_xs, marker_ye);
glVertex2f( marker_xs + scrn_rect.bottom / 4, scrn_rect.top); glVertex2f( marker_xs + scrn_rect.bottom / 4, scrn_rect.top);
glEnd(); glEnd();
} } else {
else
if(pointer_type=="moving") { if(pointer_type=="moving") {
// Code for Moving type Pointer to be included. // Code for Moving type Pointer to be included.
} }
} }
} }
}
if( huds_bottom(options) ) { if( huds_bottom(options) ) {
// Top box line // Top box line
if (draw_cap_top) { if (draw_cap_top) {
@ -469,7 +461,7 @@ draw( void ) // (HUD_scale * pscale )
// scrn_rect.top + scrn_rect.bottom, // scrn_rect.top + scrn_rect.bottom,
// mid_scr.x , marker_ys ); // mid_scr.x , marker_ys );
// draw pointer // draw pointer
if(pointer) { if(pointer) {
if(pointer_type=="fixed") { if(pointer_type=="fixed") {
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
@ -477,14 +469,13 @@ draw( void ) // (HUD_scale * pscale )
glVertex2f( marker_xs, marker_ys ); glVertex2f( marker_xs, marker_ys );
glVertex2f( marker_xs - scrn_rect.bottom / 4, height); glVertex2f( marker_xs - scrn_rect.bottom / 4, height);
glEnd(); glEnd();
} } else {
else
if(pointer_type=="moving") { if(pointer_type=="moving") {
// Code for Moving Type Pointer to be included. // Code for Moving Type Pointer to be included.
} }
}
}//if pointer }//if pointer
} }
// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) { // if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
@ -530,14 +521,12 @@ draw( void ) // (HUD_scale * pscale )
// glVertex2f( marker_xs, marker_ye + 4); // glVertex2f( marker_xs, marker_ye + 4);
// glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom); // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
// glEnd(); // glEnd();
} } else {
else {
if( huds_top(options)) { if( huds_top(options)) {
// draw minor ticks // draw minor ticks
drawOneLine( marker_xs, marker_ys, drawOneLine( marker_xs, marker_ys,
marker_xs, marker_ye - 4); marker_xs, marker_ye - 4);
} } else {
else {
drawOneLine( marker_xs, marker_ys + 4, drawOneLine( marker_xs, marker_ys + 4,
marker_xs, marker_ye); marker_xs, marker_ye);
} }
@ -582,8 +571,7 @@ draw( void ) // (HUD_scale * pscale )
marker_ys + 4, marker_ys + 4,
TextScale, GLUT_BITMAP_8_BY_13 ); TextScale, GLUT_BITMAP_8_BY_13 );
} }
} } else {
else {
drawOneLine( marker_xs, marker_ys, drawOneLine( marker_xs, marker_ys,
marker_xs, marker_ye ); marker_xs, marker_ye );
if( !huds_notext(options)) { if( !huds_notext(options)) {
@ -591,8 +579,7 @@ draw( void ) // (HUD_scale * pscale )
textString ( marker_xs - 4 * lenstr, textString ( marker_xs - 4 * lenstr,
height - 10, height - 10,
TextScale, GLUT_BITMAP_8_BY_13 ); TextScale, GLUT_BITMAP_8_BY_13 );
} } else {
else {
textString( marker_xs - 4 * lenstr, textString( marker_xs - 4 * lenstr,
scrn_rect.top, scrn_rect.top,
TextScale, GLUT_BITMAP_8_BY_13 ); TextScale, GLUT_BITMAP_8_BY_13 );

View file

@ -45,12 +45,12 @@ HudLadder :: HudLadder( string name,
factor ( factr ), factor ( factr ),
hudladder_type ( name ), hudladder_type ( name ),
frl ( frl_spot ), frl ( frl_spot ),
target_spot ( target ),
velocity_vector ( vel_vec ), velocity_vector ( vel_vec ),
drift_marker ( drift ), drift_marker ( drift ),
alpha_bracket ( alpha ), alpha_bracket ( alpha ),
energy_marker ( energy ), energy_marker ( energy ),
climb_dive_marker ( climb ), climb_dive_marker ( climb ),
target_spot ( target ),
glide_slope_marker ( glide ), glide_slope_marker ( glide ),
glide_slope ( glide_slope_val), glide_slope ( glide_slope_val),
energy_worm ( worm_energy), energy_worm ( worm_energy),
@ -79,12 +79,12 @@ HudLadder( const HudLadder & image ) :
factor ( image.factor ), factor ( image.factor ),
hudladder_type ( image.hudladder_type), hudladder_type ( image.hudladder_type),
frl ( image.frl), frl ( image.frl),
target_spot ( image.target_spot),
velocity_vector ( image.velocity_vector), velocity_vector ( image.velocity_vector),
drift_marker ( image.drift_marker), drift_marker ( image.drift_marker),
alpha_bracket ( image.alpha_bracket), alpha_bracket ( image.alpha_bracket),
energy_marker ( image.energy_marker), energy_marker ( image.energy_marker),
climb_dive_marker ( image.climb_dive_marker), climb_dive_marker ( image.climb_dive_marker),
target_spot ( image.target_spot),
glide_slope_marker ( image.glide_slope_marker), glide_slope_marker ( image.glide_slope_marker),
glide_slope ( image.glide_slope), glide_slope ( image.glide_slope),
energy_worm ( image.energy_worm), energy_worm ( image.energy_worm),
@ -127,15 +127,17 @@ void HudLadder :: draw( void )
float x_ini,x_ini2; float x_ini,x_ini2;
float x_end,x_end2; float x_end,x_end2;
float y; float y = 0;
int count; int count;
float cosine, sine,xvvr,yvvr,Vxx,Vyy,Vzz,up_vel,ground_vel,actslope; float cosine, sine, xvvr, yvvr, Vxx = 0.0, Vyy = 0.0, Vzz = 0.0,
float Axx,Ayy,Azz,total_vel,pot_slope,t1,t2,psi,alpha,pla; up_vel, ground_vel, actslope = 0.0;
float vel_x,vel_y,drift; float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1,
char Textaux[8] ; t2 = 0.0, psi = 0.0, alpha,pla;
bool pitch_ladder; float vel_x = 0.0, vel_y = 0.0, drift;
bool climb_dive_ladder; // char Textaux[8] ;
bool clip_plane; 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_top[4] = {0.0,-1.0,0.0,0.0};
GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0}; GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
@ -473,13 +475,15 @@ void HudLadder :: draw( void )
float bot ; float bot ;
float top ; float top ;
float text_offset = 4.0f ; float text_offset = 4.0f ;
float zero_offset; float zero_offset = 0.0;
if(climb_dive_ladder) if ( climb_dive_ladder ) {
zero_offset = 50.0f ; zero_offset = 50.0f ;
else } else {
if(pitch_ladder) if ( pitch_ladder ) {
zero_offset = 10.0f ; zero_offset = 10.0f ;
}
}
fntFont *font = HUDtext->getFont(); fntFont *font = HUDtext->getFont();
float pointsize = HUDtext->getPointSize(); float pointsize = HUDtext->getPointSize();

View file

@ -482,7 +482,6 @@ double FGSteam::get_HackOBS2_deg () {
double FGSteam::get_HackADF_deg () { double FGSteam::get_HackADF_deg () {
static double last_r = 0; static double last_r = 0;
double r;
if ( current_radiostack->get_adf_inrange() ) { if ( current_radiostack->get_adf_inrange() ) {
double r = current_radiostack->get_adf_heading() double r = current_radiostack->get_adf_heading()