1998-07-03 13:16:27 +00:00
|
|
|
|
|
|
|
#include "hud.hxx"
|
1999-05-12 02:04:38 +00:00
|
|
|
|
|
|
|
#ifdef USE_HUD_TextList
|
1999-06-01 21:17:10 +00:00
|
|
|
#define textString( x , y, text, font ) TextString( text, x , y )
|
|
|
|
#else
|
|
|
|
#define textString( x , y, text, font ) puDrawString ( guiFnt, text, x, y );
|
1999-05-12 02:04:38 +00:00
|
|
|
#endif
|
|
|
|
|
1998-07-24 21:36:55 +00:00
|
|
|
//========== Top of hud_card class member definitions =============
|
1998-07-03 13:16:27 +00:00
|
|
|
|
|
|
|
hud_card ::
|
|
|
|
hud_card( int x,
|
|
|
|
int y,
|
|
|
|
UINT width,
|
|
|
|
UINT height,
|
1999-05-12 02:04:38 +00:00
|
|
|
FLTFNPTR data_source,
|
1998-07-03 13:16:27 +00:00
|
|
|
UINT options,
|
1999-05-12 02:04:38 +00:00
|
|
|
float max_value, // 360
|
|
|
|
float min_value, // 0
|
|
|
|
float disp_scaling,
|
1998-07-03 13:16:27 +00:00
|
|
|
UINT major_divs,
|
|
|
|
UINT minor_divs,
|
1999-05-12 02:04:38 +00:00
|
|
|
UINT modulus, // 360
|
1998-07-03 13:16:27 +00:00
|
|
|
int dp_showing,
|
1999-05-12 02:04:38 +00:00
|
|
|
float value_span,
|
1998-07-03 13:16:27 +00:00
|
|
|
bool working) :
|
|
|
|
instr_scale( x,y,width,height,
|
|
|
|
data_source, options,
|
|
|
|
value_span,
|
|
|
|
max_value, min_value, disp_scaling,
|
|
|
|
major_divs, minor_divs, modulus,
|
|
|
|
working),
|
|
|
|
val_span ( value_span)
|
|
|
|
{
|
|
|
|
half_width_units = range_to_show() / 2.0;
|
1999-05-12 02:04:38 +00:00
|
|
|
// UINT options = get_options();
|
|
|
|
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
|
|
|
// huds_right = options & HUDS_RIGHT;
|
|
|
|
// huds_left = options & HUDS_LEFT;
|
|
|
|
// huds_vert = options & HUDS_VERT;
|
|
|
|
// huds_notext = options & HUDS_NOTEXT;
|
|
|
|
// huds_top = options & HUDS_TOP;
|
|
|
|
// huds_bottom = options & HUDS_BOTTOM;
|
1998-07-03 13:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
hud_card ::
|
|
|
|
~hud_card() { }
|
|
|
|
|
|
|
|
hud_card ::
|
|
|
|
hud_card( const hud_card & image):
|
|
|
|
instr_scale( (const instr_scale & ) image),
|
|
|
|
val_span( image.val_span),
|
|
|
|
half_width_units (image.half_width_units)
|
|
|
|
{
|
1999-05-12 02:04:38 +00:00
|
|
|
// UINT options = get_options();
|
|
|
|
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
|
|
|
// huds_right = options & HUDS_RIGHT;
|
|
|
|
// huds_left = options & HUDS_LEFT;
|
|
|
|
// huds_vert = options & HUDS_VERT;
|
|
|
|
// huds_notext = options & HUDS_NOTEXT;
|
|
|
|
// huds_top = options & HUDS_TOP;
|
|
|
|
// huds_bottom = options & HUDS_BOTTOM;
|
1998-07-03 13:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
hud_card & hud_card ::
|
|
|
|
operator = (const hud_card & rhs )
|
|
|
|
{
|
|
|
|
if( !( this == &rhs)){
|
|
|
|
instr_scale::operator = (rhs);
|
|
|
|
val_span = rhs.val_span;
|
|
|
|
half_width_units = rhs.half_width_units;
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
The following changes were made to flightgear-0.7.5 code to implement the follow
ing features:
a) ADA Flight model - ADA.cxx, ADA.hxx, flight.hxx
b) Fighter a/c HUD - flight.hxx, hud.hxx, hud.cxx, cockpit.cxx, hud_ladr.c
xx, hud_card.cxx
c) 3-window display - options.hxx, options.cxx, viewer.cxx
d) Moving objects (ship) - main.cxx
e) Patches - main.cxx
ADA.cxx, ADA.hxx
--------------------------
Interface to the external ADA flight dynamics package.
flight.hxx
----------
Included prototypes for accepting additional data fron the External flight
model for fighter aircraft HUD
Hud.hxx
-------
Included prototypes for accepting additional data for fighter HUD from Exernal F
light model.
Defined FIGHTER_HUD pre-processor directive to enable compilation of fighter hud
code.
hud.cxx, cockpit.cxx, hud_ladr.cxx, hud_card.cxx
---------------------------------------
Included code to initialise additional reticles/text for fighter HUD which is co
nditionally
compiled if FIGHTER_HUD is defined.
options.hxx
-----------
Added window_offset, and function to retrieve its value for 3 windows
options.cxx
-----------
Changed few options to suit ADA/CEF projection system/screens and checks for win
dow offset.
views.cxx
---------
Added code to retrieve view offset for window.
Main.cxx
--------
Added code to load and move an aircraft carrier.
Patch to enable clouds from command line until Curtis fixes it. By default cloud
s are disabled.
2000-10-19 19:46:13 +00:00
|
|
|
// $$$ begin - added, VS Renganathan, 13 Oct 2K
|
|
|
|
#ifdef FIGHTER_HUD
|
|
|
|
void hud_card ::
|
|
|
|
draw( void ) // (HUD_scale * pscale )
|
|
|
|
{
|
|
|
|
float vmin, vmax;
|
|
|
|
int marker_xs;
|
|
|
|
int marker_xe;
|
|
|
|
int marker_ys;
|
|
|
|
int marker_ye;
|
|
|
|
int lenstr;
|
|
|
|
int height, width;
|
|
|
|
int i, last;
|
|
|
|
char TextScale[80];
|
|
|
|
bool condition;
|
|
|
|
int disp_val = 0;
|
|
|
|
POINT mid_scr = get_centroid();
|
|
|
|
float cur_value = get_value();
|
|
|
|
RECT scrn_rect = get_location();
|
|
|
|
UINT options = get_options();
|
|
|
|
|
|
|
|
height = scrn_rect.top + scrn_rect.bottom;
|
|
|
|
width = scrn_rect.left + scrn_rect.right;
|
|
|
|
|
|
|
|
vmin = cur_value - half_width_units; // width units == needle travel
|
|
|
|
vmax = cur_value + half_width_units; // or picture unit span.
|
|
|
|
|
|
|
|
// Draw the basic markings for the scale...
|
|
|
|
|
|
|
|
if( huds_vert(options) ) { // Vertical scale
|
|
|
|
// drawOneLine( scrn_rect.left, // Bottom tick bar
|
|
|
|
// scrn_rect.top,
|
|
|
|
// width,
|
|
|
|
// scrn_rect.top);
|
|
|
|
|
|
|
|
// drawOneLine( scrn_rect.left, // Top tick bar
|
|
|
|
// height,
|
|
|
|
// width,
|
|
|
|
// height );
|
|
|
|
|
|
|
|
marker_xs = scrn_rect.left; // x start
|
|
|
|
marker_xe = width; // x extent
|
|
|
|
marker_ye = height;
|
|
|
|
|
|
|
|
// glBegin(GL_LINES);
|
|
|
|
|
|
|
|
// Bottom tick bar
|
|
|
|
// glVertex2f( marker_xs, scrn_rect.top);
|
|
|
|
// glVertex2f( marker_xe, scrn_rect.top);
|
|
|
|
|
|
|
|
// Top tick bar
|
|
|
|
// glVertex2f( marker_xs, marker_ye);
|
|
|
|
// glVertex2f( marker_xe, marker_ye );
|
|
|
|
// glEnd();
|
|
|
|
|
|
|
|
// We do not use else in the following so that combining the two
|
|
|
|
// options produces a "caged" display with double carrots. The
|
|
|
|
// same is done for horizontal card indicators.
|
|
|
|
|
|
|
|
if( huds_left(options) ) { // Calculate x marker offset
|
|
|
|
// drawOneLine( marker_xe, scrn_rect.top,
|
|
|
|
// marker_xe, marker_ye); // Cap right side
|
|
|
|
|
|
|
|
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
|
|
|
// Indicator carrot
|
|
|
|
// drawOneLine( marker_xs, mid_scr.y,
|
|
|
|
// marker_xe, mid_scr.y + scrn_rect.right / 6);
|
|
|
|
// drawOneLine( marker_xs, mid_scr.y,
|
|
|
|
// marker_xe, mid_scr.y - scrn_rect.right / 6);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( 10+marker_xe, mid_scr.y + scrn_rect.right / 6);
|
|
|
|
glVertex2f( 10+marker_xs, mid_scr.y);
|
|
|
|
glVertex2f( 10+marker_xe, mid_scr.y - scrn_rect.right / 6);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
if( huds_right(options) ) { // We'll default this for now.
|
|
|
|
// drawOneLine( scrn_rect.left, scrn_rect.top,
|
|
|
|
// scrn_rect.left, marker_ye ); // Cap left side
|
|
|
|
|
|
|
|
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
|
|
|
// Indicator carrot
|
|
|
|
// drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
|
|
|
|
// marker_xe, mid_scr.y );
|
|
|
|
// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
|
|
|
|
// marker_xe, mid_scr.y);
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( -10+scrn_rect.left, mid_scr.y + scrn_rect.right / 6);
|
|
|
|
glVertex2f( -10+marker_xe, mid_scr.y );
|
|
|
|
glVertex2f( -10+scrn_rect.left, mid_scr.y - scrn_rect.right / 6);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
// At this point marker x_start and x_end values are transposed.
|
|
|
|
// To keep this from confusing things they are now interchanged.
|
|
|
|
if(huds_both(options)) {
|
|
|
|
marker_ye = marker_xs;
|
|
|
|
marker_xs = marker_xe;
|
|
|
|
marker_xe = marker_ye;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Work through from bottom to top of scale. Calculating where to put
|
|
|
|
// minor and major ticks.
|
|
|
|
|
|
|
|
// last = FloatToInt(vmax)+1;
|
|
|
|
// i = FloatToInt(vmin);
|
|
|
|
last = (int)vmax + 1;
|
|
|
|
i = (int)vmin;
|
|
|
|
for( ; i <last ; i++ )
|
|
|
|
{
|
|
|
|
|
|
|
|
condition = true;
|
|
|
|
if( !modulo()) {
|
|
|
|
if( i < min_val()) {
|
|
|
|
condition = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( condition ) { // Show a tick if necessary
|
|
|
|
// Calculate the location of this tick
|
|
|
|
marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
|
|
|
|
// marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
|
|
|
|
// Block calculation artifact from drawing ticks below min coordinate.
|
|
|
|
// Calculation here accounts for text height.
|
|
|
|
|
|
|
|
if(( marker_ys < (scrn_rect.top + 4)) |
|
|
|
|
( marker_ys > (height - 4))) {
|
|
|
|
// Magic numbers!!!
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if( div_min()) {
|
|
|
|
// if( (i%div_min()) == 0) {
|
|
|
|
if( !(i%(int)div_min())) {
|
|
|
|
if((( marker_ys - 5) > scrn_rect.top ) &&
|
|
|
|
(( marker_ys + 5) < (height))){
|
|
|
|
if( huds_both(options) ) {
|
|
|
|
drawOneLine( scrn_rect.left, marker_ys,
|
|
|
|
marker_xs, marker_ys );
|
|
|
|
drawOneLine( marker_xe, marker_ys,
|
|
|
|
width, marker_ys );
|
|
|
|
// glBegin(GL_LINES);
|
|
|
|
// glVertex2f( scrn_rect.left, marker_ys );
|
|
|
|
// glVertex2f( marker_xs, marker_ys );
|
|
|
|
// glVertex2f( marker_xe, marker_ys);
|
|
|
|
// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
|
|
|
|
// glEnd();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if( huds_left(options) ) {
|
|
|
|
drawOneLine( marker_xs + 4, marker_ys,
|
|
|
|
marker_xe, marker_ys );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
drawOneLine( marker_xs, marker_ys,
|
|
|
|
marker_xe - 4, marker_ys );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( div_max() ) {
|
|
|
|
if( !(i%(int)div_max()) )
|
|
|
|
{
|
|
|
|
if(modulo()) {
|
|
|
|
if( disp_val < 0) {
|
|
|
|
while(disp_val < 0)
|
|
|
|
disp_val += modulo();
|
|
|
|
// } else {
|
|
|
|
// disp_val = i % (int)modulo();
|
|
|
|
}
|
|
|
|
disp_val = i % (int) modulo(); // ?????????
|
|
|
|
} else {
|
|
|
|
disp_val = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
lenstr = sprintf( TextScale, "%d",
|
|
|
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
|
|
|
// (int)(disp_val * data_scaling() +.5));
|
|
|
|
if(( (marker_ys - 8 ) > scrn_rect.top ) &&
|
|
|
|
( (marker_ys + 8) < (height))){
|
|
|
|
if( huds_both(options) ) {
|
|
|
|
// drawOneLine( scrn_rect.left, marker_ys,
|
|
|
|
// marker_xs, marker_ys);
|
|
|
|
// drawOneLine( marker_xs, marker_ys,
|
|
|
|
// scrn_rect.left + scrn_rect.right,
|
|
|
|
// marker_ys);
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( scrn_rect.left, marker_ys );
|
|
|
|
glVertex2f( marker_xs, marker_ys);
|
|
|
|
glVertex2f( width, marker_ys);
|
|
|
|
glEnd();
|
|
|
|
if( !huds_notext(options)) {
|
|
|
|
textString ( marker_xs + 2, marker_ys,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
|
|
|
if( !huds_notext(options) ) {
|
|
|
|
if( huds_left(options) ) {
|
|
|
|
textString( marker_xs - 8 * lenstr - 2,
|
|
|
|
marker_ys - 4,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
textString( marker_xe + 3 * lenstr,
|
|
|
|
marker_ys - 4,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // Else read oriented right
|
|
|
|
} // End if modulo division by major interval is zero
|
|
|
|
} // End if major interval divisor non-zero
|
|
|
|
} // End if condition
|
|
|
|
} // End for range of i from vmin to vmax
|
|
|
|
} // End if VERTICAL SCALE TYPE
|
|
|
|
else { // Horizontal scale by default
|
|
|
|
// commented
|
|
|
|
// left tick bar
|
|
|
|
// drawOneLine( scrn_rect.left, scrn_rect.top,
|
|
|
|
// scrn_rect.left, height);
|
|
|
|
|
|
|
|
// right tick bar
|
|
|
|
// drawOneLine( width, scrn_rect.top,
|
|
|
|
// width,
|
|
|
|
// height );
|
|
|
|
|
|
|
|
marker_ys = scrn_rect.top; // Starting point for
|
|
|
|
marker_ye = height; // tick y location calcs
|
|
|
|
marker_xe = width;
|
|
|
|
|
|
|
|
// glBegin(GL_LINES);
|
|
|
|
// left tick bar
|
|
|
|
// glVertex2f( scrn_rect.left, scrn_rect.top);
|
|
|
|
// glVertex2f( scrn_rect.left, marker_ye);
|
|
|
|
|
|
|
|
// right tick bar
|
|
|
|
// glVertex2f( marker_xe, scrn_rect.top);
|
|
|
|
// glVertex2f( marker_xe, marker_ye );
|
|
|
|
// glEnd();
|
|
|
|
|
|
|
|
if( huds_top(options) ) {
|
|
|
|
// Bottom box line
|
|
|
|
// commented
|
|
|
|
// drawOneLine( scrn_rect.left,
|
|
|
|
// scrn_rect.top,
|
|
|
|
// width,
|
|
|
|
// scrn_rect.top);
|
|
|
|
|
|
|
|
// Tick point adjust
|
|
|
|
marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
|
|
|
|
|
|
|
|
// Bottom arrow
|
|
|
|
// drawOneLine( mid_scr.x, marker_ye,
|
|
|
|
// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
|
|
|
// drawOneLine( mid_scr.x, marker_ye,
|
|
|
|
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
|
|
|
|
|
|
|
// commented
|
|
|
|
// glBegin(GL_LINE_STRIP);
|
|
|
|
// glVertex2f( mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
|
|
|
// glVertex2f( mid_scr.x, marker_ye);
|
|
|
|
// glVertex2f( mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
|
|
|
// glEnd();
|
|
|
|
|
|
|
|
}
|
|
|
|
if( huds_bottom(options) ) {
|
|
|
|
// Top box line
|
|
|
|
drawOneLine( scrn_rect.left, height,
|
|
|
|
width, height);
|
|
|
|
// Tick point adjust
|
|
|
|
marker_ys = height - scrn_rect.bottom / 2;
|
|
|
|
|
|
|
|
// Top arrow
|
|
|
|
// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
|
|
|
|
// scrn_rect.top + scrn_rect.bottom,
|
|
|
|
// mid_scr.x, marker_ys );
|
|
|
|
// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
|
|
|
|
// scrn_rect.top + scrn_rect.bottom,
|
|
|
|
// mid_scr.x , marker_ys );
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( mid_scr.x + scrn_rect.bottom / 4,
|
|
|
|
height);
|
|
|
|
glVertex2f( mid_scr.x , marker_ys );
|
|
|
|
glVertex2f( mid_scr.x - scrn_rect.bottom / 4,
|
|
|
|
height);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
|
|
|
|
// marker_xe = marker_ys;
|
|
|
|
// marker_ys = marker_ye;
|
|
|
|
// marker_ye = marker_xe;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
|
|
|
|
|
|
|
|
// last = FloatToInt(vmax)+1;
|
|
|
|
// i = FloatToInt(vmin);
|
|
|
|
last = (int)vmax + 1;
|
|
|
|
i = (int)vmin;
|
|
|
|
for(; i <last ; i++ ) {
|
|
|
|
// for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
|
|
|
// printf("<*> i = %d\n", i);
|
|
|
|
condition = true;
|
|
|
|
if( !modulo()) {
|
|
|
|
if( i < min_val()) {
|
|
|
|
condition = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// printf("<**> i = %d\n", i);
|
|
|
|
if( condition ) {
|
|
|
|
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
|
|
|
|
marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
|
|
|
|
if( div_min()){
|
|
|
|
// if( (i%(int)div_min()) == 0 ) {
|
|
|
|
if( !(i%(int)div_min() )) {
|
|
|
|
// draw in ticks only if they aren't too close to the edge.
|
|
|
|
if((( marker_xs - 5) > scrn_rect.left ) &&
|
|
|
|
(( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
|
|
|
|
|
|
|
|
if( huds_both(options) ) {
|
|
|
|
drawOneLine( marker_xs, scrn_rect.top,
|
|
|
|
marker_xs, marker_ys - 4);
|
|
|
|
drawOneLine( marker_xs, marker_ye + 4,
|
|
|
|
marker_xs, height);
|
|
|
|
// glBegin(GL_LINES);
|
|
|
|
// glVertex2f( marker_xs, scrn_rect.top);
|
|
|
|
// glVertex2f( marker_xs, marker_ys - 4);
|
|
|
|
// glVertex2f( marker_xs, marker_ye + 4);
|
|
|
|
// glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
|
|
|
|
// glEnd();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if( huds_top(options)) {
|
|
|
|
// draw minor ticks
|
|
|
|
drawOneLine( marker_xs, marker_ys,
|
|
|
|
marker_xs, marker_ye - 4);
|
|
|
|
// patch for angled deck heading
|
|
|
|
if (i == 352) {
|
|
|
|
glBegin(GL_POLYGON);
|
|
|
|
glVertex2f( marker_xs, marker_ys+16);
|
|
|
|
glVertex2f( marker_xs+2, marker_ys+13);
|
|
|
|
glVertex2f( marker_xs, marker_ys+10);
|
|
|
|
glVertex2f( marker_xs-2, marker_ys+13);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
drawOneLine( marker_xs, marker_ys + 4,
|
|
|
|
marker_xs, marker_ye);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// printf("<***> i = %d\n", i);
|
|
|
|
if( div_max()) {
|
|
|
|
// printf("i = %d\n", i);
|
|
|
|
// if( (i%(int)div_max())==0 ) {
|
|
|
|
if( !(i%(int)div_max()) ) {
|
|
|
|
if(modulo()) {
|
|
|
|
if( disp_val < 0) {
|
|
|
|
while(disp_val<0)
|
|
|
|
disp_val += modulo();
|
|
|
|
}
|
|
|
|
disp_val = i % (int) modulo(); // ?????????
|
|
|
|
} else {
|
|
|
|
disp_val = i;
|
|
|
|
}
|
|
|
|
// printf("disp_val = %d\n", disp_val);
|
|
|
|
// printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
|
|
|
|
lenstr = sprintf( TextScale, "%d",
|
|
|
|
// (int)(disp_val * data_scaling() +.5));
|
|
|
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
|
|
|
// Draw major ticks and text only if far enough from the edge.
|
|
|
|
if(( (marker_xs - 10)> scrn_rect.left ) &&
|
|
|
|
( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
|
|
|
|
if( huds_both(options) ) {
|
|
|
|
// drawOneLine( marker_xs, scrn_rect.top,
|
|
|
|
// marker_xs, marker_ys);
|
|
|
|
// drawOneLine( marker_xs, marker_ye,
|
|
|
|
// marker_xs, scrn_rect.top + scrn_rect.bottom);
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( marker_xs, scrn_rect.top);
|
|
|
|
glVertex2f( marker_xs, marker_ye);
|
|
|
|
glVertex2f( marker_xs, height);
|
|
|
|
glEnd();
|
|
|
|
if( !huds_notext(options) ) {
|
|
|
|
textString ( marker_xs - 4 * lenstr,
|
|
|
|
marker_ys + 4,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// draw major ticks
|
|
|
|
drawOneLine( marker_xs, marker_ys,
|
|
|
|
marker_xs, marker_ye );
|
|
|
|
if( !huds_notext(options)) {
|
|
|
|
if( huds_top(options) ) {
|
|
|
|
textString ( marker_xs - 4 * lenstr,
|
|
|
|
height - 10,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
textString( marker_xs - 4 * lenstr,
|
|
|
|
scrn_rect.top,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}//if(condition)
|
|
|
|
// printf("<****> i = %d\n", i);
|
|
|
|
} //if(divmax)
|
|
|
|
} //if(!modulo)
|
|
|
|
} //for
|
|
|
|
} //draw
|
|
|
|
|
|
|
|
#else
|
|
|
|
//$$$ end - VS Renganathan, 13 Oct 2K
|
|
|
|
|
1998-07-03 13:16:27 +00:00
|
|
|
void hud_card ::
|
|
|
|
draw( void ) // (HUD_scale * pscale )
|
|
|
|
{
|
1999-05-12 02:04:38 +00:00
|
|
|
float vmin, vmax;
|
1998-07-03 13:16:27 +00:00
|
|
|
int marker_xs;
|
|
|
|
int marker_xe;
|
|
|
|
int marker_ys;
|
|
|
|
int marker_ye;
|
1999-05-12 02:04:38 +00:00
|
|
|
int lenstr;
|
|
|
|
int height, width;
|
|
|
|
int i, last;
|
1998-07-03 13:16:27 +00:00
|
|
|
char TextScale[80];
|
|
|
|
bool condition;
|
1998-08-22 01:19:27 +00:00
|
|
|
int disp_val = 0;
|
1998-07-03 13:16:27 +00:00
|
|
|
POINT mid_scr = get_centroid();
|
1999-05-12 02:04:38 +00:00
|
|
|
float cur_value = get_value();
|
1998-07-03 13:16:27 +00:00
|
|
|
RECT scrn_rect = get_location();
|
|
|
|
UINT options = get_options();
|
|
|
|
|
1999-05-12 02:04:38 +00:00
|
|
|
height = scrn_rect.top + scrn_rect.bottom;
|
|
|
|
width = scrn_rect.left + scrn_rect.right;
|
|
|
|
|
1998-07-03 13:16:27 +00:00
|
|
|
vmin = cur_value - half_width_units; // width units == needle travel
|
|
|
|
vmax = cur_value + half_width_units; // or picture unit span.
|
1999-05-12 02:04:38 +00:00
|
|
|
|
|
|
|
// Draw the basic markings for the scale...
|
|
|
|
|
|
|
|
if( huds_vert(options) ) { // Vertical scale
|
1998-07-03 13:16:27 +00:00
|
|
|
drawOneLine( scrn_rect.left, // Bottom tick bar
|
|
|
|
scrn_rect.top,
|
1999-05-12 02:04:38 +00:00
|
|
|
width,
|
1998-07-03 13:16:27 +00:00
|
|
|
scrn_rect.top);
|
|
|
|
|
|
|
|
drawOneLine( scrn_rect.left, // Top tick bar
|
1999-05-12 02:04:38 +00:00
|
|
|
height,
|
|
|
|
width,
|
|
|
|
height );
|
|
|
|
|
|
|
|
marker_xs = scrn_rect.left; // x start
|
|
|
|
marker_xe = width; // x extent
|
|
|
|
marker_ye = height;
|
|
|
|
|
|
|
|
// glBegin(GL_LINES);
|
|
|
|
|
|
|
|
// Bottom tick bar
|
|
|
|
// glVertex2f( marker_xs, scrn_rect.top);
|
|
|
|
// glVertex2f( marker_xe, scrn_rect.top);
|
|
|
|
|
|
|
|
// Top tick bar
|
|
|
|
// glVertex2f( marker_xs, marker_ye);
|
|
|
|
// glVertex2f( marker_xe, marker_ye );
|
|
|
|
// glEnd();
|
1998-07-03 13:16:27 +00:00
|
|
|
|
|
|
|
// We do not use else in the following so that combining the two
|
|
|
|
// options produces a "caged" display with double carrots. The
|
|
|
|
// same is done for horizontal card indicators.
|
|
|
|
|
1999-05-12 02:04:38 +00:00
|
|
|
if( huds_left(options) ) { // Calculate x marker offset
|
|
|
|
drawOneLine( marker_xe, scrn_rect.top,
|
|
|
|
marker_xe, marker_ye); // Cap right side
|
1998-07-03 13:16:27 +00:00
|
|
|
|
1999-05-12 02:04:38 +00:00
|
|
|
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
1998-07-03 13:16:27 +00:00
|
|
|
// Indicator carrot
|
1999-05-12 02:04:38 +00:00
|
|
|
// drawOneLine( marker_xs, mid_scr.y,
|
|
|
|
// marker_xe, mid_scr.y + scrn_rect.right / 6);
|
|
|
|
// drawOneLine( marker_xs, mid_scr.y,
|
|
|
|
// marker_xe, mid_scr.y - scrn_rect.right / 6);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( marker_xe, mid_scr.y + scrn_rect.right / 6);
|
|
|
|
glVertex2f( marker_xs, mid_scr.y);
|
|
|
|
glVertex2f( marker_xe, mid_scr.y - scrn_rect.right / 6);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
if( huds_right(options) ) { // We'll default this for now.
|
|
|
|
drawOneLine( scrn_rect.left, scrn_rect.top,
|
|
|
|
scrn_rect.left, marker_ye ); // Cap left side
|
1998-07-03 13:16:27 +00:00
|
|
|
|
1999-05-12 02:04:38 +00:00
|
|
|
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
1998-07-03 13:16:27 +00:00
|
|
|
// Indicator carrot
|
1999-05-12 02:04:38 +00:00
|
|
|
// drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
|
|
|
|
// marker_xe, mid_scr.y );
|
|
|
|
// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
|
|
|
|
// marker_xe, mid_scr.y);
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( scrn_rect.left, mid_scr.y + scrn_rect.right / 6);
|
|
|
|
glVertex2f( marker_xe, mid_scr.y );
|
|
|
|
glVertex2f( scrn_rect.left, mid_scr.y - scrn_rect.right / 6);
|
|
|
|
glEnd();
|
|
|
|
}
|
1998-07-03 13:16:27 +00:00
|
|
|
|
|
|
|
// At this point marker x_start and x_end values are transposed.
|
|
|
|
// To keep this from confusing things they are now interchanged.
|
1999-05-12 02:04:38 +00:00
|
|
|
if(huds_both(options)) {
|
1998-07-03 13:16:27 +00:00
|
|
|
marker_ye = marker_xs;
|
|
|
|
marker_xs = marker_xe;
|
|
|
|
marker_xe = marker_ye;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Work through from bottom to top of scale. Calculating where to put
|
|
|
|
// minor and major ticks.
|
|
|
|
|
1999-05-12 02:04:38 +00:00
|
|
|
// last = FloatToInt(vmax)+1;
|
|
|
|
// i = FloatToInt(vmin);
|
|
|
|
last = (int)vmax + 1;
|
|
|
|
i = (int)vmin;
|
|
|
|
for( ; i <last ; i++ )
|
|
|
|
{
|
1998-07-03 13:16:27 +00:00
|
|
|
condition = true;
|
|
|
|
if( !modulo()) {
|
|
|
|
if( i < min_val()) {
|
|
|
|
condition = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( condition ) { // Show a tick if necessary
|
|
|
|
// Calculate the location of this tick
|
1999-05-12 02:04:38 +00:00
|
|
|
marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
|
|
|
|
// marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
|
1998-07-03 13:16:27 +00:00
|
|
|
// Block calculation artifact from drawing ticks below min coordinate.
|
|
|
|
// Calculation here accounts for text height.
|
|
|
|
|
|
|
|
if(( marker_ys < (scrn_rect.top + 4)) |
|
1999-05-12 02:04:38 +00:00
|
|
|
( marker_ys > (height - 4))) {
|
1998-07-03 13:16:27 +00:00
|
|
|
// Magic numbers!!!
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if( div_min()) {
|
1999-05-12 02:04:38 +00:00
|
|
|
// if( (i%div_min()) == 0) {
|
|
|
|
if( !(i%(int)div_min())) {
|
1998-07-13 21:00:45 +00:00
|
|
|
if((( marker_ys - 5) > scrn_rect.top ) &&
|
1999-05-12 02:04:38 +00:00
|
|
|
(( marker_ys + 5) < (height))){
|
|
|
|
if( huds_both(options) ) {
|
1998-07-03 13:16:27 +00:00
|
|
|
drawOneLine( scrn_rect.left, marker_ys,
|
|
|
|
marker_xs, marker_ys );
|
|
|
|
drawOneLine( marker_xe, marker_ys,
|
1999-05-12 02:04:38 +00:00
|
|
|
width, marker_ys );
|
|
|
|
// glBegin(GL_LINES);
|
|
|
|
// glVertex2f( scrn_rect.left, marker_ys );
|
|
|
|
// glVertex2f( marker_xs, marker_ys );
|
|
|
|
// glVertex2f( marker_xe, marker_ys);
|
|
|
|
// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
|
|
|
|
// glEnd();
|
|
|
|
}
|
1998-07-03 13:16:27 +00:00
|
|
|
else {
|
1999-05-12 02:04:38 +00:00
|
|
|
if( huds_left(options) ) {
|
1998-07-03 13:16:27 +00:00
|
|
|
drawOneLine( marker_xs + 4, marker_ys,
|
|
|
|
marker_xe, marker_ys );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
drawOneLine( marker_xs, marker_ys,
|
|
|
|
marker_xe - 4, marker_ys );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-05-12 02:04:38 +00:00
|
|
|
if( div_max() ) {
|
|
|
|
if( !(i%(int)div_max()) )
|
|
|
|
{
|
1998-07-03 13:16:27 +00:00
|
|
|
if(modulo()) {
|
1999-05-12 02:04:38 +00:00
|
|
|
if( disp_val < 0) {
|
|
|
|
while(disp_val < 0)
|
|
|
|
disp_val += modulo();
|
|
|
|
// } else {
|
|
|
|
// disp_val = i % (int)modulo();
|
1998-07-03 13:16:27 +00:00
|
|
|
}
|
1999-05-12 02:04:38 +00:00
|
|
|
disp_val = i % (int) modulo(); // ?????????
|
|
|
|
} else {
|
|
|
|
disp_val = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
lenstr = sprintf( TextScale, "%d",
|
|
|
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
|
|
|
// (int)(disp_val * data_scaling() +.5));
|
1998-07-13 21:00:45 +00:00
|
|
|
if(( (marker_ys - 8 ) > scrn_rect.top ) &&
|
1999-05-12 02:04:38 +00:00
|
|
|
( (marker_ys + 8) < (height))){
|
|
|
|
if( huds_both(options) ) {
|
|
|
|
// drawOneLine( scrn_rect.left, marker_ys,
|
|
|
|
// marker_xs, marker_ys);
|
|
|
|
// drawOneLine( marker_xs, marker_ys,
|
|
|
|
// scrn_rect.left + scrn_rect.right,
|
|
|
|
// marker_ys);
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( scrn_rect.left, marker_ys );
|
|
|
|
glVertex2f( marker_xs, marker_ys);
|
|
|
|
glVertex2f( width, marker_ys);
|
|
|
|
glEnd();
|
|
|
|
if( !huds_notext(options)) {
|
|
|
|
textString ( marker_xs + 2, marker_ys,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
1998-07-03 13:16:27 +00:00
|
|
|
}
|
1999-05-12 02:04:38 +00:00
|
|
|
}
|
1998-07-03 13:16:27 +00:00
|
|
|
else {
|
|
|
|
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
1999-05-12 02:04:38 +00:00
|
|
|
if( !huds_notext(options) ) {
|
|
|
|
if( huds_left(options) ) {
|
|
|
|
textString( marker_xs - 8 * lenstr - 2,
|
|
|
|
marker_ys - 4,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
1998-07-03 13:16:27 +00:00
|
|
|
}
|
|
|
|
else {
|
1999-05-12 02:04:38 +00:00
|
|
|
textString( marker_xe + 3 * lenstr,
|
|
|
|
marker_ys - 4,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
1998-07-03 13:16:27 +00:00
|
|
|
}
|
1998-07-13 21:00:45 +00:00
|
|
|
}
|
1998-07-03 13:16:27 +00:00
|
|
|
} // Else read oriented right
|
|
|
|
} // End if modulo division by major interval is zero
|
|
|
|
} // End if major interval divisor non-zero
|
|
|
|
} // End if condition
|
|
|
|
} // End for range of i from vmin to vmax
|
|
|
|
} // End if VERTICAL SCALE TYPE
|
|
|
|
else { // Horizontal scale by default
|
1999-05-12 02:04:38 +00:00
|
|
|
// left tick bar
|
|
|
|
drawOneLine( scrn_rect.left, scrn_rect.top,
|
|
|
|
scrn_rect.left, height);
|
|
|
|
|
|
|
|
// right tick bar
|
|
|
|
drawOneLine( width, scrn_rect.top,
|
|
|
|
width,
|
|
|
|
height );
|
|
|
|
|
|
|
|
marker_ys = scrn_rect.top; // Starting point for
|
|
|
|
marker_ye = height; // tick y location calcs
|
|
|
|
marker_xe = width;
|
|
|
|
|
|
|
|
// glBegin(GL_LINES);
|
|
|
|
// left tick bar
|
|
|
|
// glVertex2f( scrn_rect.left, scrn_rect.top);
|
|
|
|
// glVertex2f( scrn_rect.left, marker_ye);
|
|
|
|
|
|
|
|
// right tick bar
|
|
|
|
// glVertex2f( marker_xe, scrn_rect.top);
|
|
|
|
// glVertex2f( marker_xe, marker_ye );
|
|
|
|
// glEnd();
|
|
|
|
|
|
|
|
if( huds_top(options) ) {
|
|
|
|
// Bottom box line
|
|
|
|
drawOneLine( scrn_rect.left,
|
|
|
|
scrn_rect.top,
|
|
|
|
width,
|
|
|
|
scrn_rect.top);
|
|
|
|
|
|
|
|
// Tick point adjust
|
|
|
|
marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
|
|
|
|
|
|
|
|
// Bottom arrow
|
|
|
|
// drawOneLine( mid_scr.x, marker_ye,
|
|
|
|
// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
|
|
|
// drawOneLine( mid_scr.x, marker_ye,
|
|
|
|
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
|
|
|
glVertex2f( mid_scr.x, marker_ye);
|
|
|
|
glVertex2f( mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
if( huds_bottom(options) ) {
|
|
|
|
// Top box line
|
|
|
|
drawOneLine( scrn_rect.left, height,
|
|
|
|
width, height);
|
|
|
|
// Tick point adjust
|
|
|
|
marker_ys = height - scrn_rect.bottom / 2;
|
|
|
|
|
|
|
|
// Top arrow
|
|
|
|
// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
|
|
|
|
// scrn_rect.top + scrn_rect.bottom,
|
|
|
|
// mid_scr.x, marker_ys );
|
|
|
|
// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
|
|
|
|
// scrn_rect.top + scrn_rect.bottom,
|
|
|
|
// mid_scr.x , marker_ys );
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( mid_scr.x + scrn_rect.bottom / 4,
|
|
|
|
height);
|
|
|
|
glVertex2f( mid_scr.x , marker_ys );
|
|
|
|
glVertex2f( mid_scr.x - scrn_rect.bottom / 4,
|
|
|
|
height);
|
|
|
|
glEnd();
|
|
|
|
}
|
1998-07-03 13:16:27 +00:00
|
|
|
|
|
|
|
// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
|
|
|
|
// marker_xe = marker_ys;
|
|
|
|
// marker_ys = marker_ye;
|
|
|
|
// marker_ye = marker_xe;
|
|
|
|
// }
|
|
|
|
|
1998-07-13 21:00:45 +00:00
|
|
|
// printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
|
1999-05-12 02:04:38 +00:00
|
|
|
|
|
|
|
// last = FloatToInt(vmax)+1;
|
|
|
|
// i = FloatToInt(vmin);
|
|
|
|
last = (int)vmax + 1;
|
|
|
|
i = (int)vmin;
|
|
|
|
for(; i <last ; i++ ) {
|
|
|
|
// for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
1998-07-13 21:00:45 +00:00
|
|
|
// printf("<*> i = %d\n", i);
|
1998-07-03 13:16:27 +00:00
|
|
|
condition = true;
|
|
|
|
if( !modulo()) {
|
|
|
|
if( i < min_val()) {
|
|
|
|
condition = false;
|
|
|
|
}
|
|
|
|
}
|
1998-07-13 21:00:45 +00:00
|
|
|
// printf("<**> i = %d\n", i);
|
1998-07-03 13:16:27 +00:00
|
|
|
if( condition ) {
|
1999-05-12 02:04:38 +00:00
|
|
|
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
|
|
|
|
marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
|
1998-07-03 13:16:27 +00:00
|
|
|
if( div_min()){
|
1999-05-12 02:04:38 +00:00
|
|
|
// if( (i%(int)div_min()) == 0 ) {
|
|
|
|
if( !(i%(int)div_min() )) {
|
1998-07-03 13:16:27 +00:00
|
|
|
// draw in ticks only if they aren't too close to the edge.
|
1998-07-13 21:00:45 +00:00
|
|
|
if((( marker_xs - 5) > scrn_rect.left ) &&
|
|
|
|
(( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
|
1998-07-03 13:16:27 +00:00
|
|
|
|
1999-05-12 02:04:38 +00:00
|
|
|
if( huds_both(options) ) {
|
1998-07-03 13:16:27 +00:00
|
|
|
drawOneLine( marker_xs, scrn_rect.top,
|
|
|
|
marker_xs, marker_ys - 4);
|
|
|
|
drawOneLine( marker_xs, marker_ye + 4,
|
1999-05-12 02:04:38 +00:00
|
|
|
marker_xs, height);
|
|
|
|
// glBegin(GL_LINES);
|
|
|
|
// glVertex2f( marker_xs, scrn_rect.top);
|
|
|
|
// glVertex2f( marker_xs, marker_ys - 4);
|
|
|
|
// glVertex2f( marker_xs, marker_ye + 4);
|
|
|
|
// glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
|
|
|
|
// glEnd();
|
|
|
|
}
|
1998-07-03 13:16:27 +00:00
|
|
|
else {
|
1999-05-12 02:04:38 +00:00
|
|
|
if( huds_top(options)) {
|
1998-07-03 13:16:27 +00:00
|
|
|
drawOneLine( marker_xs, marker_ys,
|
|
|
|
marker_xs, marker_ye - 4);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
drawOneLine( marker_xs, marker_ys + 4,
|
|
|
|
marker_xs, marker_ye);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-05-12 02:04:38 +00:00
|
|
|
// printf("<***> i = %d\n", i);
|
1998-07-03 13:16:27 +00:00
|
|
|
if( div_max()) {
|
1999-05-12 02:04:38 +00:00
|
|
|
// printf("i = %d\n", i);
|
|
|
|
// if( (i%(int)div_max())==0 ) {
|
|
|
|
if( !(i%(int)div_max()) ) {
|
1998-07-03 13:16:27 +00:00
|
|
|
if(modulo()) {
|
|
|
|
if( disp_val < 0) {
|
1999-05-12 02:04:38 +00:00
|
|
|
while(disp_val<0)
|
|
|
|
disp_val += modulo();
|
1998-07-03 13:16:27 +00:00
|
|
|
}
|
1999-05-12 02:04:38 +00:00
|
|
|
disp_val = i % (int) modulo(); // ?????????
|
|
|
|
} else {
|
1998-07-03 13:16:27 +00:00
|
|
|
disp_val = i;
|
1999-05-12 02:04:38 +00:00
|
|
|
}
|
|
|
|
// printf("disp_val = %d\n", disp_val);
|
|
|
|
// printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
|
|
|
|
lenstr = sprintf( TextScale, "%d",
|
|
|
|
// (int)(disp_val * data_scaling() +.5));
|
|
|
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
1998-07-03 13:16:27 +00:00
|
|
|
// Draw major ticks and text only if far enough from the edge.
|
|
|
|
if(( (marker_xs - 10)> scrn_rect.left ) &&
|
|
|
|
( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
|
1999-05-12 02:04:38 +00:00
|
|
|
if( huds_both(options) ) {
|
|
|
|
// drawOneLine( marker_xs, scrn_rect.top,
|
|
|
|
// marker_xs, marker_ys);
|
|
|
|
// drawOneLine( marker_xs, marker_ye,
|
|
|
|
// marker_xs, scrn_rect.top + scrn_rect.bottom);
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2f( marker_xs, scrn_rect.top);
|
|
|
|
glVertex2f( marker_xs, marker_ye);
|
|
|
|
glVertex2f( marker_xs, height);
|
|
|
|
glEnd();
|
|
|
|
if( !huds_notext(options) ) {
|
|
|
|
textString ( marker_xs - 4 * lenstr,
|
1998-07-03 13:16:27 +00:00
|
|
|
marker_ys + 4,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
drawOneLine( marker_xs, marker_ys,
|
|
|
|
marker_xs, marker_ye );
|
1999-05-12 02:04:38 +00:00
|
|
|
if( !huds_notext(options)) {
|
|
|
|
if( huds_top(options) ) {
|
|
|
|
textString ( marker_xs - 4 * lenstr,
|
|
|
|
height - 10,
|
1998-07-03 13:16:27 +00:00
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
else {
|
1999-05-12 02:04:38 +00:00
|
|
|
textString( marker_xs - 4 * lenstr,
|
1998-07-03 13:16:27 +00:00
|
|
|
scrn_rect.top,
|
|
|
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-05-12 02:04:38 +00:00
|
|
|
}
|
|
|
|
// printf("<****> i = %d\n", i);
|
1998-07-03 13:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
The following changes were made to flightgear-0.7.5 code to implement the follow
ing features:
a) ADA Flight model - ADA.cxx, ADA.hxx, flight.hxx
b) Fighter a/c HUD - flight.hxx, hud.hxx, hud.cxx, cockpit.cxx, hud_ladr.c
xx, hud_card.cxx
c) 3-window display - options.hxx, options.cxx, viewer.cxx
d) Moving objects (ship) - main.cxx
e) Patches - main.cxx
ADA.cxx, ADA.hxx
--------------------------
Interface to the external ADA flight dynamics package.
flight.hxx
----------
Included prototypes for accepting additional data fron the External flight
model for fighter aircraft HUD
Hud.hxx
-------
Included prototypes for accepting additional data for fighter HUD from Exernal F
light model.
Defined FIGHTER_HUD pre-processor directive to enable compilation of fighter hud
code.
hud.cxx, cockpit.cxx, hud_ladr.cxx, hud_card.cxx
---------------------------------------
Included code to initialise additional reticles/text for fighter HUD which is co
nditionally
compiled if FIGHTER_HUD is defined.
options.hxx
-----------
Added window_offset, and function to retrieve its value for 3 windows
options.cxx
-----------
Changed few options to suit ADA/CEF projection system/screens and checks for win
dow offset.
views.cxx
---------
Added code to retrieve view offset for window.
Main.cxx
--------
Added code to load and move an aircraft carrier.
Patch to enable clouds from command line until Curtis fixes it. By default cloud
s are disabled.
2000-10-19 19:46:13 +00:00
|
|
|
#endif
|