1
0
Fork 0

MacOS changes by Darrell Walisser.

This commit is contained in:
curt 2000-09-13 21:51:07 +00:00
parent 948f6b05d5
commit be88681d69
10 changed files with 242 additions and 94 deletions

View file

@ -93,16 +93,16 @@ bool FGRunways::search( const string& id, FGRunway* r ) {
c4_RowRef row = vRunway->GetAt(index);
r->id = (string) pID(row);
r->rwy_no = (string) pRwy(row);
r->id = (const char *) pID(row);
r->rwy_no = (const char *) pRwy(row);
r->lon = (double) pLon(row);
r->lat = (double) pLat(row);
r->heading = (double) pHdg(row);
r->length = (double) pLen(row);
r->width = (double) pWid(row);
r->surface_flags = (string) pSurf(row);
r->end1_flags = (string) pEnd1(row);
r->end2_flags = (string) pEnd2(row);
r->surface_flags = (const char *) pSurf(row);
r->end1_flags = (const char *) pEnd1(row);
r->end2_flags = (const char *) pEnd2(row);
return true;
}
@ -142,16 +142,16 @@ bool FGRunways::next( FGRunway* r ) {
c4_RowRef row = vRunway->GetAt(index);
r->id = (string) pID(row);
r->rwy_no = (string) pRwy(row);
r->id = (const char *) pID(row);
r->rwy_no = (const char *) pRwy(row);
r->lon = (double) pLon(row);
r->lat = (double) pLat(row);
r->heading = (double) pHdg(row);
r->length = (double) pLen(row);
r->width = (double) pWid(row);
r->surface_flags = (string) pSurf(row);
r->end1_flags = (string) pEnd1(row);
r->end2_flags = (string) pEnd2(row);
r->surface_flags = (const char *) pSurf(row);
r->end1_flags = (const char *) pEnd1(row);
r->end2_flags = (const char *) pEnd2(row);
return true;
}
@ -189,7 +189,7 @@ int FGRunwaysUtil::load( const string& file ) {
#ifdef __MWERKS__
in >> skipws;
in >> ::skipws;
char c = 0;
while ( in.get(c) && c != '\0' ) {
if ( c == 'A' ) {
@ -202,7 +202,7 @@ int FGRunwaysUtil::load( const string& file ) {
} else {
in >> skipeol;
}
in >> skipws;
in >> ::skipws;
}
#else

View file

@ -200,7 +200,7 @@ FGPanel::doMouseAction (int button, int updown, int x, int y)
x = (int)(((float)x / current_view.get_winWidth()) * _w);
y = (int)(_h - (((float)y / current_view.get_winHeight()) * _h));
for (int i = 0; i < _instruments.size(); i++) {
for (int i = 0; i < (int)_instruments.size(); i++) {
FGPanelInstrument *inst = _instruments[i];
int ix = inst->getXPos();
int iy = inst->getYPos();
@ -248,7 +248,7 @@ FGPanelAction::~FGPanelAction ()
FGAdjustAction::FGAdjustAction (int button, int x, int y, int w, int h,
SGValue * value, float increment,
float min, float max, bool wrap=false)
float min, float max, bool wrap)
: FGPanelAction(button, x, y, w, h),
_value(value), _increment(increment), _min(min), _max(max), _wrap(wrap)
{
@ -450,7 +450,7 @@ FGLayeredInstrument::~FGLayeredInstrument ()
void
FGLayeredInstrument::draw ()
{
for (int i = 0; i < _layers.size(); i++) {
for (int i = 0; i < (int)_layers.size(); i++) {
glPushMatrix();
glTranslatef(0.0, 0.0, (i / 100.0) + 0.1);
_layers[i]->draw();
@ -474,7 +474,7 @@ FGLayeredInstrument::addLayer (FGInstrumentLayer *layer)
int
FGLayeredInstrument::addLayer (CroppedTexture &texture,
int w = -1, int h = -1)
int w, int h)
{
return addLayer(new FGTexturedLayer(texture, w, h));
}
@ -551,7 +551,7 @@ FGInstrumentLayer::addTransformation (FGPanelTransformation * transformation)
////////////////////////////////////////////////////////////////////////
FGTexturedLayer::FGTexturedLayer (CroppedTexture &texture, int w, int h)
FGTexturedLayer::FGTexturedLayer (const CroppedTexture &texture, int w, int h)
: FGInstrumentLayer(w, h)
{
setTexture(texture);
@ -585,6 +585,33 @@ FGTexturedLayer::draw ()
}
////////////////////////////////////////////////////////////////////////
// Implementation of FGWindowLayer.
////////////////////////////////////////////////////////////////////////
FGWindowLayer::FGWindowLayer (int w, int h)
: FGTexturedLayer (w, h)
{
}
FGWindowLayer::FGWindowLayer (const CroppedTexture &texture, int w, int h)
: FGTexturedLayer(texture, w, h)
{
}
FGWindowLayer::~FGWindowLayer ()
{
}
void
FGWindowLayer::draw ()
{
// doesn't do anything yet
FGTexturedLayer::draw();
}
////////////////////////////////////////////////////////////////////////
// Implementation of FGTextLayer.
@ -592,7 +619,7 @@ FGTexturedLayer::draw ()
FGTextLayer::FGTextLayer (int w, int h, Chunk * chunk1, Chunk * chunk2,
Chunk * chunk3)
: FGInstrumentLayer(w, h)
: FGInstrumentLayer(w, h), _pointSize(14.0)
{
_color[0] = _color[1] = _color[2] = 0.0;
_color[3] = 1.0;
@ -620,7 +647,7 @@ FGTextLayer::draw ()
glColor4fv(_color);
transform();
_renderer.setFont(guiFntHandle);
_renderer.setPointSize(14);
_renderer.setPointSize(_pointSize);
_renderer.begin();
_renderer.start3f(0, 0, 0);
@ -628,7 +655,7 @@ FGTextLayer::draw ()
chunk_list::const_iterator it = _chunks.begin();
chunk_list::const_iterator last = _chunks.end();
for ( ; it != last; it++) {
_renderer.puts((*it)->getValue());
_renderer.puts((char *)((*it)->getValue()));
}
_renderer.end();
@ -652,9 +679,9 @@ FGTextLayer::setColor (float r, float g, float b)
}
void
FGTextLayer::setPointSize (const float size)
FGTextLayer::setPointSize (float size)
{
_renderer.setPointSize(size);
_pointSize = size;
}
void
@ -669,37 +696,39 @@ FGTextLayer::setFont(fntFont * font)
// Implementation of FGTextLayer::Chunk.
////////////////////////////////////////////////////////////////////////
FGTextLayer::Chunk::Chunk (char * text, char * fmt = "%s")
FGTextLayer::Chunk::Chunk (const string &text, const string &fmt)
: _type(FGTextLayer::TEXT), _fmt(fmt)
{
_value._text = text;
_text = text;
if (_fmt == "")
_fmt = "%s";
}
FGTextLayer::Chunk::Chunk (ChunkType type, const SGValue * value,
char * fmt = 0, float mult = 1.0)
const string &fmt, float mult)
: _type(type), _fmt(fmt), _mult(mult)
{
if (_fmt == 0) {
if (_fmt == "") {
if (type == TEXT_VALUE)
_fmt = "%s";
else
_fmt = "%.2f";
}
_value._value = value;
_value = value;
}
char *
const char *
FGTextLayer::Chunk::getValue () const
{
switch (_type) {
case TEXT:
sprintf(_buf, _fmt, _value._text);
sprintf(_buf, _fmt.c_str(), _text.c_str());
return _buf;
case TEXT_VALUE:
sprintf(_buf, _fmt, _value._value->getStringValue().c_str());
sprintf(_buf, _fmt.c_str(), _value->getStringValue().c_str());
break;
case DOUBLE_VALUE:
sprintf(_buf, _fmt, _value._value->getFloatValue() * _mult);
sprintf(_buf, _fmt.c_str(), _value->getFloatValue() * _mult);
break;
}
return _buf;

View file

@ -1,4 +1,4 @@
// panel.hxx - default, 2D single-engine prop instrument panel
// panel.hxx - generic support classes for a 2D panel.
//
// Written by David Megginson, started January 2000.
//
@ -61,7 +61,7 @@ class FGTextureManager
public:
static ssgTexture * createTexture(const string &relativePath);
private:
static map<string,ssgTexture *>_textureMap;
static map<string,ssgTexture *> _textureMap;
};
@ -69,7 +69,7 @@ private:
////////////////////////////////////////////////////////////////////////
// Cropped texture (should migrate out into FGFS).
//
// This class defines a rectangular cropped area of a texture.
// This structure wraps an SSG texture with cropping information.
////////////////////////////////////////////////////////////////////////
struct CroppedTexture
@ -150,18 +150,21 @@ public:
FGPanelAction (int button, int x, int y, int w, int h);
virtual ~FGPanelAction ();
// Getters.
virtual int getButton () const { return _button; }
virtual int getX () const { return _x; }
virtual int getY () const { return _y; }
virtual int getWidth () const { return _w; }
virtual int getHeight () const { return _h; }
// Setters.
virtual void setButton (int button) { _button = button; }
virtual void setX (int x) { _x = x; }
virtual void setY (int y) { _y = y; }
virtual void setWidth (int w) { _w = w; }
virtual void setHeight (int h) { _h = h; }
// Check whether we're in the area.
virtual bool inArea (int button, int x, int y)
{
return (button == _button &&
@ -171,6 +174,7 @@ public:
y < _y + _h);
}
// Perform the action.
virtual void doAction () = 0;
private:
@ -419,19 +423,50 @@ class FGTexturedLayer : public FGInstrumentLayer
{
public:
FGTexturedLayer (int w = -1, int h = -1) : FGInstrumentLayer(w, h) {}
FGTexturedLayer (CroppedTexture &texture, int w = -1, int h = -1);
FGTexturedLayer (const CroppedTexture &texture, int w = -1, int h = -1);
virtual ~FGTexturedLayer ();
virtual void draw ();
virtual void setTexture (CroppedTexture &texture) { _texture = texture; }
virtual void setTexture (const CroppedTexture &texture) {
_texture = texture;
}
virtual CroppedTexture &getTexture () { return _texture; }
virtual const CroppedTexture &getTexture () const { return _texture; }
private:
mutable CroppedTexture _texture;
};
////////////////////////////////////////////////////////////////////////
// A moving window on a texture.
//
// This layer automatically recrops a cropped texture based on
// property values, creating a moving window over the texture.
////////////////////////////////////////////////////////////////////////
class FGWindowLayer : public FGTexturedLayer
{
public:
FGWindowLayer (int w = -1, int h = -1);
FGWindowLayer (const CroppedTexture &texture, int w = -1, int h = -1);
virtual ~FGWindowLayer ();
virtual void draw ();
virtual const SGValue * getXValue () const { return _xValue; }
virtual void setXValue (const SGValue * value) { _xValue = value; }
virtual const SGValue * getYValue () const { return _yValue; }
virtual void setYValue (const SGValue * value) { _yValue = value; }
private:
const SGValue * _xValue;
const SGValue * _yValue;
};
////////////////////////////////////////////////////////////////////////
// A text layer of an instrument.
@ -452,18 +487,16 @@ public:
class Chunk {
public:
Chunk (char * text, char * fmt = "%s");
Chunk (const string &text, const string &fmt = "%s");
Chunk (ChunkType type, const SGValue * value,
char * fmt = 0, float mult = 1.0);
const string &fmt = "", float mult = 1.0);
char * getValue () const;
const char * getValue () const;
private:
ChunkType _type;
union {
char * _text;
const SGValue * _value;
} _value;
char * _fmt;
string _text;
const SGValue * _value;
string _fmt;
float _mult;
mutable char _buf[1024];
};
@ -484,6 +517,8 @@ private:
typedef vector<Chunk *> chunk_list;
chunk_list _chunks;
float _color[4];
float _pointSize;
// FIXME: need only one globally
mutable fntRenderer _renderer;
};

View file

@ -123,6 +123,8 @@ void FGSteam::update ( int timesteps )
current_properties.tieDouble("/steam/gyro-compass-error",
FGSteam::get_DG_err,
FGSteam::set_DG_err);
current_properties.tieDouble("/steam/mag-compass",
FGSteam::get_MH_deg);
}
_UpdatesPending += timesteps;
}

View file

@ -109,6 +109,69 @@
extern COCKPIT cockpit_;
SCALAR CLadot;
SCALAR CLq;
SCALAR CLde;
SCALAR CLob;
SCALAR Cdob;
SCALAR Cda; /*Not used*/
SCALAR Cdde;
SCALAR Cma;
SCALAR Cmadot;
SCALAR Cmq;
SCALAR Cmob;
SCALAR Cmde;
SCALAR Clbeta;
SCALAR Clp;
SCALAR Clr;
SCALAR Clda;
SCALAR Cldr;
SCALAR Cnbeta;
SCALAR Cnp;
SCALAR Cnr;
SCALAR Cnda;
SCALAR Cndr;
SCALAR Cybeta;
SCALAR Cyp;
SCALAR Cyr;
SCALAR Cyda;
SCALAR Cydr;
/*nondimensionalization quantities*/
/*units here are ft and lbs */
SCALAR cbar; /*mean aero chord ft*/
SCALAR b; /*wing span ft */
SCALAR Sw; /*wing planform surface area ft^2*/
SCALAR rPiARe; /*reciprocal of Pi*AR*e*/
SCALAR lbare; /*elevator moment arm MAC*/
SCALAR Weight; /*lbs*/
SCALAR MaxTakeoffWeight,EmptyWeight;
SCALAR Cg; /*%MAC*/
SCALAR Zcg; /*%MAC*/
SCALAR CLwbh,CL,cm,cd,cn,cy,croll,cbar_2V,b_2V,qS,qScbar,qSb;
SCALAR CLo,Cdo,Cmo;
SCALAR F_X_wind,F_Y_wind,F_Z_wind;
SCALAR long_trim;
SCALAR elevator, aileron, rudder;
SCALAR Flap_Position;
int Flaps_In_Transit;
static SCALAR interp(SCALAR *y_table, SCALAR *x_table, int Ntable, SCALAR x)
{
SCALAR slope;

View file

@ -9,68 +9,68 @@
/*global declarations of aero model parameters*/
SCALAR CLadot;
SCALAR CLq;
SCALAR CLde;
SCALAR CLob;
extern SCALAR CLadot;
extern SCALAR CLq;
extern SCALAR CLde;
extern SCALAR CLob;
SCALAR Cdob;
SCALAR Cda; /*Not used*/
SCALAR Cdde;
extern SCALAR Cdob;
extern SCALAR Cda; /*Not used*/
extern SCALAR Cdde;
SCALAR Cma;
SCALAR Cmadot;
SCALAR Cmq;
SCALAR Cmob;
SCALAR Cmde;
extern SCALAR Cma;
extern SCALAR Cmadot;
extern SCALAR Cmq;
extern SCALAR Cmob;
extern SCALAR Cmde;
SCALAR Clbeta;
SCALAR Clp;
SCALAR Clr;
SCALAR Clda;
SCALAR Cldr;
extern SCALAR Clbeta;
extern SCALAR Clp;
extern SCALAR Clr;
extern SCALAR Clda;
extern SCALAR Cldr;
SCALAR Cnbeta;
SCALAR Cnp;
SCALAR Cnr;
SCALAR Cnda;
SCALAR Cndr;
extern SCALAR Cnbeta;
extern SCALAR Cnp;
extern SCALAR Cnr;
extern SCALAR Cnda;
extern SCALAR Cndr;
SCALAR Cybeta;
SCALAR Cyp;
SCALAR Cyr;
SCALAR Cyda;
SCALAR Cydr;
extern SCALAR Cybeta;
extern SCALAR Cyp;
extern SCALAR Cyr;
extern SCALAR Cyda;
extern SCALAR Cydr;
/*nondimensionalization quantities*/
/*units here are ft and lbs */
SCALAR cbar; /*mean aero chord ft*/
SCALAR b; /*wing span ft */
SCALAR Sw; /*wing planform surface area ft^2*/
SCALAR rPiARe; /*reciprocal of Pi*AR*e*/
SCALAR lbare; /*elevator moment arm MAC*/
extern SCALAR cbar; /*mean aero chord ft*/
extern SCALAR b; /*wing span ft */
extern SCALAR Sw; /*wing planform surface area ft^2*/
extern SCALAR rPiARe; /*reciprocal of Pi*AR*e*/
extern SCALAR lbare; /*elevator moment arm MAC*/
SCALAR Weight; /*lbs*/
SCALAR MaxTakeoffWeight,EmptyWeight;
SCALAR Cg; /*%MAC*/
SCALAR Zcg; /*%MAC*/
extern SCALAR Weight; /*lbs*/
extern SCALAR MaxTakeoffWeight,EmptyWeight;
extern SCALAR Cg; /*%MAC*/
extern SCALAR Zcg; /*%MAC*/
SCALAR CLwbh,CL,cm,cd,cn,cy,croll,cbar_2V,b_2V,qS,qScbar,qSb;
SCALAR CLo,Cdo,Cmo;
extern SCALAR CLwbh,CL,cm,cd,cn,cy,croll,cbar_2V,b_2V,qS,qScbar,qSb;
extern SCALAR CLo,Cdo,Cmo;
SCALAR F_X_wind,F_Y_wind,F_Z_wind;
extern SCALAR F_X_wind,F_Y_wind,F_Z_wind;
SCALAR long_trim;
extern SCALAR long_trim;
SCALAR elevator, aileron, rudder;
extern SCALAR elevator, aileron, rudder;
SCALAR Flap_Position;
extern SCALAR Flap_Position;
int Flaps_In_Transit;
extern int Flaps_In_Transit;

View file

@ -36,6 +36,9 @@
$Header$
$Log$
Revision 1.16 2000/09/13 19:51:09 curt
MacOS changes by Darrell Walisser.
Revision 1.15 2000/06/12 18:52:37 curt
Added differential braking (Alex and David).
@ -226,7 +229,7 @@ char gear_strings[NUM_WHEELS][12]={"nose","right main", "left main", "tail skid"
percent_brake[1] = Brake_pct[0];
percent_brake[2] = Brake_pct[1];
caster_angle_rad[0] = 0.52*Rudder_pedal;
caster_angle_rad[0] = 0.03*Rudder_pedal;
for (i=0;i<num_wheels;i++) /* Loop for each wheel */

View file

@ -253,9 +253,9 @@ fgJoystickInit()
seen_joystick = true;
// Set up range arrays
float minRange[naxes];
float maxRange[naxes];
float center[naxes];
float *minRange = new float[naxes];
float *maxRange = new float[naxes];
float *center = new float[naxes];
// Initialize with default values
js->getMinRange(minRange);
@ -430,6 +430,11 @@ fgJoystickInit()
js->setMinRange(minRange);
js->setMaxRange(maxRange);
js->setCenter(center);
//-dw- clean up
delete minRange;
delete maxRange;
delete center;
}
if (seen_joystick)
@ -451,7 +456,7 @@ fgJoystickRead()
for (int i = 0; i < MAX_JOYSTICKS; i++) {
jsJoystick * js = joysticks[i].js;
float axis_values[joysticks[i].naxes];
float *axis_values = new float[joysticks[i].naxes];
if (js->notWorking()) {
continue;
}
@ -550,6 +555,10 @@ fgJoystickRead()
FG_LOG(FG_INPUT, FG_ALERT, "Failed to set value for "
<< jsNames[i] << ' ' << buttonNames[j]);
}
// -dw- cleanup
delete axis_values;
}
return true;

View file

@ -55,6 +55,7 @@
#include <Cockpit/hud.hxx>
#include <Cockpit/panel.hxx>
#include <Cockpit/panel_io.hxx>
#include <Cockpit/sp_panel.hxx>
#include <GUI/gui.h>
#include <Scenery/tilemgr.hxx>
#include <Objects/matlib.hxx>
@ -461,6 +462,12 @@ void GLUTspecialkey(int k, int x, int y) {
current_panel = new_panel;
return;
}
case GLUT_KEY_F4: {
delete current_panel;
current_panel = fgCreateSmallSinglePropPanel(0, 0, 1024, 768);
FG_LOG(FG_INPUT, FG_INFO, "Reverted to built-in panel");
return;
}
case GLUT_KEY_END: // numeric keypad 1
v->set_goal_view_offset( FG_PI * 0.75 );
return;

View file

@ -61,10 +61,10 @@ bool FGILSList::init( FGPath path ) {
#ifdef __MWERKS__
char c = 0;
while ( in.get(c) && c != '\0' && n.get_ilstype() != '[' ) {
while ( in.get(c) && c != '\0' && ils.get_ilstype() != '[' ) {
in.putback(c);
in >> ils;
if ( ils.get_type() != '[' ) {
if ( ils.get_ilstype() != '[' ) {
ilslist[ils.get_locfreq()].push_back(ils);
}
in >> skipcomment;