Changes for the MacOS port contributed by Darrell Walisser.
This commit is contained in:
parent
4163e42aad
commit
7f6b697ea6
21 changed files with 204 additions and 65 deletions
|
@ -117,6 +117,9 @@
|
|||
// -rp- please use FG_MEM_COPY everywhere !
|
||||
# define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
|
||||
|
||||
// -dw- currently used glut has no game mode stuff
|
||||
# define GLUT_WRONG_VERSION
|
||||
|
||||
# elif (__MWERKS__ >= 0x0900) && __INTEL__
|
||||
# error still to be supported...
|
||||
# else
|
||||
|
@ -298,4 +301,3 @@ inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
|
|||
#endif // FG_INCOMPLETE_FUNCTIONAL
|
||||
|
||||
#endif // _COMPILER_H
|
||||
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
#ifndef _FG_CALLBACK_HXX
|
||||
#define _FG_CALLBACK_HXX
|
||||
|
||||
// -dw- need size_t for params() function
|
||||
#ifdef __MWERKS__
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Abstract base class for all FlightGear callbacks.
|
||||
|
|
|
@ -78,7 +78,7 @@ string FGBucket::gen_base_path() const {
|
|||
|
||||
FGPath path( raw_path );
|
||||
|
||||
return path.get_path();
|
||||
return path.str();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ FGPath::FGPath() {
|
|||
|
||||
// create a path based on "path"
|
||||
FGPath::FGPath( const string p ) {
|
||||
path = fix_path( p );
|
||||
set( p );
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,13 @@ FGPath::~FGPath() {
|
|||
}
|
||||
|
||||
|
||||
// append to the existing path
|
||||
// set path
|
||||
void FGPath::set( const string p ) {
|
||||
path = fix_path( p );
|
||||
}
|
||||
|
||||
|
||||
// append another piece to the existing path
|
||||
void FGPath::append( const string p ) {
|
||||
string part = fix_path( p );
|
||||
|
||||
|
@ -73,3 +79,16 @@ void FGPath::append( const string p ) {
|
|||
path += part;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// concatenate a string to the end of the path without inserting a
|
||||
// path separator
|
||||
void FGPath::concat( const string p ) {
|
||||
string part = fix_path( p );
|
||||
|
||||
if ( path.size() == 0 ) {
|
||||
path = part;
|
||||
} else {
|
||||
path += part;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,12 +60,19 @@ public:
|
|||
// destructor
|
||||
~FGPath();
|
||||
|
||||
// append to the existing path
|
||||
// set path
|
||||
void set( const string p );
|
||||
|
||||
// append another piece to the existing path
|
||||
void append( const string p );
|
||||
|
||||
// concatenate a string to the end of the path without inserting a
|
||||
// path separator
|
||||
void concat( const string p );
|
||||
|
||||
// get the path string
|
||||
inline string get_path() const { return path; }
|
||||
inline const char *get_path_c_str() { return path.c_str(); }
|
||||
inline string str() const { return path; }
|
||||
inline const char *c_str() { return path.c_str(); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
#include "moon.hxx"
|
||||
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Objects/texload.h>
|
||||
#include <Main/options.hxx>
|
||||
#include <Misc/fgpath.hxx>
|
||||
#include <Objects/texload.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
# define exception c_exception
|
||||
|
@ -53,7 +54,6 @@ Moon::Moon(FGTime *t) :
|
|||
0.054900, 0.000000,
|
||||
115.3654, 13.0649929509, t)
|
||||
{
|
||||
string tpath, fg_tpath;
|
||||
int width, height;
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, "Initializing Moon Texture");
|
||||
|
@ -72,18 +72,21 @@ Moon::Moon(FGTime *t) :
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
// load in the texture data
|
||||
tpath = current_options.get_fg_root() + "/Textures/" + "moon.rgb";
|
||||
|
||||
FGPath tpath( current_options.get_fg_root() );
|
||||
tpath.append( "Textures" );
|
||||
tpath.append( "moon.rgb" );
|
||||
|
||||
if ( (moon_texbuf = read_rgb_texture(tpath.c_str(), &width, &height))
|
||||
== NULL )
|
||||
{
|
||||
// Try compressed
|
||||
fg_tpath = tpath + ".gz";
|
||||
FGPath fg_tpath = tpath;
|
||||
fg_tpath.append( ".gz" );
|
||||
if ( (moon_texbuf = read_rgb_texture(fg_tpath.c_str(), &width, &height))
|
||||
== NULL )
|
||||
{
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
"Error in loading moon texture " << tpath );
|
||||
"Error in loading moon texture " << tpath.str() );
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,10 +51,11 @@
|
|||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Include/fg_constants.h>
|
||||
#include <Misc/fgpath.hxx>
|
||||
#include <Misc/fgstream.hxx>
|
||||
#include <Misc/stopwatch.hxx>
|
||||
#include <Main/options.hxx>
|
||||
#include <Main/views.hxx>
|
||||
#include <Misc/stopwatch.hxx>
|
||||
#include <Time/fg_time.hxx>
|
||||
#include "Misc/stopwatch.hxx"
|
||||
|
||||
|
@ -72,7 +73,9 @@ static GLint stars[FG_STAR_LEVELS];
|
|||
|
||||
// Initialize the Star Management Subsystem
|
||||
int fgStarsInit( void ) {
|
||||
Point3D starlist[FG_MAX_STARS];
|
||||
// -dw- avoid local data > 32k error by dynamic allocation of the
|
||||
// array, problem for some compilers
|
||||
Point3D *starlist = new Point3D[FG_MAX_STARS];
|
||||
// struct CelestialCoord pltPos;
|
||||
double right_ascension, declination, magnitude;
|
||||
double min_magnitude[FG_STAR_LEVELS];
|
||||
|
@ -88,13 +91,13 @@ int fgStarsInit( void ) {
|
|||
}
|
||||
|
||||
// build the full path name to the stars data base file
|
||||
string path = current_options.get_fg_root() + "/Astro/stars" + ".gz";
|
||||
FGPath path ( current_options.get_fg_root() );
|
||||
path.append( "Astro/stars" );
|
||||
FG_LOG( FG_ASTRO, FG_INFO, " Loading stars from " << path.str() );
|
||||
|
||||
FG_LOG( FG_ASTRO, FG_INFO, " Loading stars from " << path );
|
||||
|
||||
fg_gzifstream in( path );
|
||||
fg_gzifstream in( path.str() );
|
||||
if ( ! in ) {
|
||||
FG_LOG( FG_ASTRO, FG_ALERT, "Cannot open star file: " << path );
|
||||
FG_LOG( FG_ASTRO, FG_ALERT, "Cannot open star file: " << path.str() );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@ libCockpit_a_SOURCES = \
|
|||
cockpit.cxx cockpit.hxx \
|
||||
hud.cxx hud.hxx \
|
||||
hud_card.cxx hud_dnst.cxx hud_guag.cxx hud_inst.cxx \
|
||||
hud_labl.cxx hud_ladr.cxx hud_scal.cxx hud_tbi.cxx \
|
||||
hud_labl.cxx hud_ladr.cxx \
|
||||
hud_scal.cxx hud_tbi.cxx \
|
||||
panel.cxx panel.hxx
|
||||
|
||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <GUI/gui.h>
|
||||
#include <Include/fg_constants.h>
|
||||
#include <Include/general.hxx>
|
||||
#include <Main/options.hxx>
|
||||
|
@ -46,6 +47,7 @@
|
|||
#include <Math/mat3.h>
|
||||
#include <Math/polar3d.hxx>
|
||||
#include <Scenery/scenery.hxx>
|
||||
#include <Time/fg_time.hxx>
|
||||
#include <Time/fg_timer.hxx>
|
||||
|
||||
#include "cockpit.hxx"
|
||||
|
@ -63,8 +65,7 @@ static pCockpit ac_cockpit;
|
|||
|
||||
double get_latitude( void )
|
||||
{
|
||||
return((double)((int)( current_aircraft.fdm_state->get_Latitude()
|
||||
* RAD_TO_DEG)) );
|
||||
return (double)((int)(current_aircraft.fdm_state->get_Latitude()*RAD_TO_DEG));
|
||||
}
|
||||
|
||||
double get_lat_min( void )
|
||||
|
@ -97,6 +98,19 @@ double get_long_min( void )
|
|||
return( (a - d) * 60.0);
|
||||
}
|
||||
|
||||
char*
|
||||
get_formated_gmt_time( void )
|
||||
{
|
||||
static char buf[32];
|
||||
FGTime *t = FGTime::cur_time_params;
|
||||
const struct tm *p = t->getGmt();
|
||||
sprintf( buf, "%d/%d/%2d %d:%02d:%02d",
|
||||
p->tm_mon+1, p->tm_mday, p->tm_year,
|
||||
p->tm_hour, p->tm_min, p->tm_sec);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
double get_throttleval( void )
|
||||
{
|
||||
return controls.get_throttle( 0 ); // Hack limiting to one engine
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#endif
|
||||
|
||||
#include <deque> // STL double ended queue
|
||||
#include <vector> // STL vector
|
||||
|
||||
#include <fg_typedefs.h>
|
||||
#include <fg_constants.h>
|
||||
|
@ -53,6 +54,7 @@
|
|||
#include <Controls/controls.hxx>
|
||||
|
||||
FG_USING_STD(deque);
|
||||
FG_USING_STD(vector);
|
||||
|
||||
#ifndef WIN32
|
||||
typedef struct {
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Main/options.hxx>
|
||||
#include <Main/views.hxx>
|
||||
#include <Misc/fgpath.hxx>
|
||||
#include <Objects/texload.h>
|
||||
|
||||
#include "panel.hxx"
|
||||
|
@ -80,13 +81,11 @@ FGPanel* FGPanel::OurPanel = 0;
|
|||
|
||||
// FGPanel::FGPanel() - constructor to initialize the panel.
|
||||
FGPanel::FGPanel(void){
|
||||
|
||||
string tpath;
|
||||
int x, y;
|
||||
FILE *f;
|
||||
char line[256];
|
||||
GLint test;
|
||||
GLubyte tex[262144];
|
||||
GLubyte *tex = new GLubyte[262144];
|
||||
|
||||
OurPanel = this;
|
||||
|
||||
|
@ -133,18 +132,21 @@ test_instr[2] = new FGTexInstrument(462.5, 133, 10, 20, 5.5, 60, 0.0, 1.0,
|
|||
// load in the texture data
|
||||
|
||||
xglPixelStorei(GL_UNPACK_ROW_LENGTH, 256);
|
||||
tpath = current_options.get_fg_root() + "/Textures/gauges.rgb";
|
||||
FGPath tpath( current_options.get_fg_root() );
|
||||
tpath.append( "Textures/gauges.rgb" );
|
||||
if((img = read_rgb_texture( (char *)tpath.c_str(), &img_width, &img_height ))==NULL){
|
||||
}
|
||||
|
||||
xglPixelStorei(GL_UNPACK_ROW_LENGTH, 256);
|
||||
tpath = current_options.get_fg_root() + "/Textures/gauges2.rgb";
|
||||
tpath.set( current_options.get_fg_root() );
|
||||
tpath.append( "Textures/gauges2.rgb" );
|
||||
if((imag = read_rgb_texture( (char *)tpath.c_str(), &imag_width, &imag_height ))==NULL){
|
||||
}
|
||||
|
||||
xglPixelStorei(GL_UNPACK_ROW_LENGTH, 1024);
|
||||
|
||||
tpath = current_options.get_fg_root() + "/Textures/Fullone.rgb";
|
||||
tpath.set( current_options.get_fg_root() );
|
||||
tpath.append( "Textures/Fullone.rgb" );
|
||||
if ((background = read_rgb_texture( (char *)tpath.c_str(), &width, &height ))==NULL ){
|
||||
}
|
||||
|
||||
|
@ -227,7 +229,7 @@ void FGPanel::ReInit( int x, int y, int finx, int finy){
|
|||
xglDrawPixels(finx - x, finy - y, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *)(background));
|
||||
|
||||
// restore original buffer state
|
||||
xglDrawBuffer( buffer );
|
||||
xglDrawBuffer( (GLenum)buffer );
|
||||
xglEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <Include/fg_constants.h>
|
||||
#include <Main/options.hxx>
|
||||
#include <Math/fg_geodesy.hxx>
|
||||
#include <Misc/fgpath.hxx>
|
||||
|
||||
#include <FDM/JSBsim/FGFDMExec.h>
|
||||
#include <FDM/JSBsim/FGAircraft.h>
|
||||
|
@ -54,13 +55,17 @@ int fgJSBsimInit(double dt) {
|
|||
|
||||
FG_LOG( FG_FLIGHT, FG_INFO, " created FDMExec" );
|
||||
|
||||
string aircraft_path = current_options.get_fg_root() + "/Aircraft";
|
||||
string engine_path = current_options.get_fg_root() + "/Engine";
|
||||
FGPath aircraft_path( current_options.get_fg_root() );
|
||||
aircraft_path.append( "Aircraft" );
|
||||
|
||||
FDMExec.GetAircraft()->LoadAircraft(aircraft_path, engine_path, "X15");
|
||||
FGPath engine_path( current_options.get_fg_root() );
|
||||
engine_path.append( "Engine" );
|
||||
|
||||
FDMExec.GetAircraft()->LoadAircraft(aircraft_path.str(),
|
||||
engine_path.str(), "X15");
|
||||
FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft" );
|
||||
|
||||
FDMExec.GetState()->Reset(aircraft_path, "Reset00");
|
||||
FDMExec.GetState()->Reset(aircraft_path.str(), "Reset00");
|
||||
FG_LOG( FG_FLIGHT, FG_INFO, " loaded initial conditions" );
|
||||
|
||||
FDMExec.GetState()->Setdt(dt);
|
||||
|
|
|
@ -231,6 +231,7 @@ $Original log: LaRCsim.c,v $
|
|||
|
||||
#include "ls_types.h"
|
||||
#include "ls_constants.h"
|
||||
#include "ls_geodesy.h"
|
||||
#include "ls_generic.h"
|
||||
#include "ls_sim_control.h"
|
||||
#include "ls_cockpit.h"
|
||||
|
@ -574,8 +575,11 @@ int ls_ForceAltitude(double alt_feet) {
|
|||
/* Flight Gear Modification Log
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.1 1999/04/05 21:32:45 curt
|
||||
* Initial revision
|
||||
* Revision 1.2 1999/04/27 19:28:04 curt
|
||||
* Changes for the MacOS port contributed by Darrell Walisser.
|
||||
*
|
||||
* Revision 1.1.1.1 1999/04/05 21:32:45 curt
|
||||
* Start of 0.6.x branch.
|
||||
*
|
||||
* Revision 1.25 1999/01/19 20:57:02 curt
|
||||
* MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
|
||||
|
|
|
@ -47,7 +47,12 @@ FGInterface base_fdm_state;
|
|||
// Extrapolate fdm based on time_offset (in usec)
|
||||
void FGInterface::extrapolate( int time_offset ) {
|
||||
double dt = time_offset / 1000000.0;
|
||||
|
||||
// -dw- metrowerks complains about ambiguous access, not critical
|
||||
// to keep this ;)
|
||||
#ifndef __MWERKS__
|
||||
cout << "extrapolating FDM by dt = " << dt << endl;
|
||||
#endif
|
||||
|
||||
double lat = geodetic_position_v[0] + geocentric_rates_v[0] * dt;
|
||||
double lat_geoc = geocentric_position_v[0] + geocentric_rates_v[0] * dt;
|
||||
|
@ -79,9 +84,11 @@ int fgFDMInit(int model, FGInterface& f, double dt) {
|
|||
|
||||
if ( model == FGInterface::FG_SLEW ) {
|
||||
// fgSlewInit(dt);
|
||||
#ifndef __MWERKS__ // -dw- 04/22/99 JSB sim not ported yet
|
||||
} else if ( model == FGInterface::FG_JSBSIM ) {
|
||||
fgJSBsimInit(dt);
|
||||
fgJSBsim_2_FGInterface(base_fdm_state);
|
||||
#endif
|
||||
} else if ( model == FGInterface::FG_LARCSIM ) {
|
||||
// lets try to avoid really screwing up the LaRCsim model
|
||||
if ( base_fdm_state.get_Altitude() < -9000.0 ) {
|
||||
|
@ -135,9 +142,11 @@ int fgFDMUpdate(int model, FGInterface& f, int multiloop, int time_offset) {
|
|||
|
||||
if ( model == FGInterface::FG_SLEW ) {
|
||||
// fgSlewUpdate(f, multiloop);
|
||||
#ifndef __MWERKS__ // -dw- 04/22/99 JSB sim not ported yet
|
||||
} else if ( model == FGInterface::FG_JSBSIM ) {
|
||||
fgJSBsimUpdate(base_fdm_state, multiloop);
|
||||
f = base_fdm_state;
|
||||
#endif
|
||||
} else if ( model == FGInterface::FG_LARCSIM ) {
|
||||
fgLaRCsimUpdate(base_fdm_state, multiloop);
|
||||
// extrapolate position based on actual time
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include <Math/mat3.h>
|
||||
#include <Math/polar3d.hxx>
|
||||
#include <Math/fg_random.h>
|
||||
#include <Misc/fgpath.hxx>
|
||||
#include <plib/pu.h>
|
||||
#include <Scenery/scenery.hxx>
|
||||
#include <Scenery/tilemgr.hxx>
|
||||
|
@ -88,6 +89,14 @@
|
|||
#include "fg_serial.hxx"
|
||||
|
||||
|
||||
// -dw- use custom sioux settings so I can see output window
|
||||
#ifdef MACOS
|
||||
# ifndef FG_NDEBUG
|
||||
# include <sioux.h> // settings for output window
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// This is a record containing a bit of global housekeeping information
|
||||
FGGeneral general;
|
||||
|
||||
|
@ -137,10 +146,12 @@ static void fgInitVisuals( void ) {
|
|||
|
||||
l = &cur_light_params;
|
||||
|
||||
#ifndef GLUT_WRONG_VERSION
|
||||
// Go full screen if requested ...
|
||||
if ( current_options.get_fullscreen() ) {
|
||||
glutFullScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
// If enabled, normal vectors specified with glNormal are scaled
|
||||
// to unit length after transformation. See glNormal.
|
||||
|
@ -554,8 +565,10 @@ static void fgMainLoop( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
#if ! defined( MACOS )
|
||||
// Do any serial port work that might need to be done
|
||||
fgSerialProcess();
|
||||
#endif
|
||||
|
||||
// see if we need to load any new scenery tiles
|
||||
fgTileMgrUpdate();
|
||||
|
@ -660,12 +673,14 @@ static void fgIdleFunction ( void ) {
|
|||
#if !defined(WIN32)
|
||||
if ( current_options.get_intro_music() ) {
|
||||
string lockfile = "/tmp/mpg123.running";
|
||||
string mp3file = current_options.get_fg_root() +
|
||||
"/Sounds/intro.mp3";
|
||||
string command = "(touch " + lockfile + "; mpg123 " + mp3file +
|
||||
"> /dev/null 2>&1; /bin/rm " + lockfile + ") &";
|
||||
FGPath mp3file( current_options.get_fg_root() );
|
||||
mp3file.append( "Sounds/intro.mp3" );
|
||||
|
||||
string command = "(touch " + lockfile + "; mpg123 "
|
||||
+ mp3file.str() + "> /dev/null 2>&1; /bin/rm "
|
||||
+ lockfile + ") &";
|
||||
FG_LOG( FG_GENERAL, FG_INFO,
|
||||
"Starting intro music: " << mp3file );
|
||||
"Starting intro music: " << mp3file.str() );
|
||||
system ( command.c_str() );
|
||||
}
|
||||
#endif
|
||||
|
@ -733,7 +748,9 @@ static void fgIdleFunction ( void ) {
|
|||
audio_mixer = new smMixer;
|
||||
audio_mixer -> setMasterVolume ( 80 ) ; /* 80% of max volume. */
|
||||
audio_sched -> setSafetyMargin ( 1.0 ) ;
|
||||
string slfile = current_options.get_fg_root() + "/Sounds/wasp.wav";
|
||||
|
||||
FGPath slfile( current_options.get_fg_root() );
|
||||
slfile.append( "Sounds/wasp.wav" );
|
||||
|
||||
s1 = new slSample ( (char *)slfile.c_str() );
|
||||
FG_LOG( FG_GENERAL, FG_INFO,
|
||||
|
@ -831,6 +848,7 @@ int fgGlutInit( int *argc, char **argv ) {
|
|||
if ( current_options.get_game_mode() == 0 ) {
|
||||
// Open the regular window
|
||||
xglutCreateWindow("Flight Gear");
|
||||
#ifndef GLUT_WRONG_VERSION
|
||||
} else {
|
||||
// Open the cool new 'game mode' window
|
||||
char game_mode_str[256];
|
||||
|
@ -842,6 +860,7 @@ int fgGlutInit( int *argc, char **argv ) {
|
|||
"game mode params = " << game_mode_str );
|
||||
glutGameModeString( game_mode_str );
|
||||
glutEnterGameMode();
|
||||
#endif
|
||||
}
|
||||
|
||||
// This seems to be the absolute earliest in the init sequence
|
||||
|
@ -920,6 +939,18 @@ int fgGlutInitEvents( void ) {
|
|||
|
||||
// Main ...
|
||||
int main( int argc, char **argv ) {
|
||||
#ifdef MACOS
|
||||
# ifndef FG_NDEBUG
|
||||
|
||||
// -dw- this will not work unless called before any standard
|
||||
// output, so why not put it here?
|
||||
SIOUXSettings.toppixel = 540;
|
||||
SIOUXSettings.leftpixel = 50;
|
||||
SIOUXSettings.rows = 15;
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
FGInterface *f;
|
||||
|
||||
f = current_aircraft.fdm_state;
|
||||
|
@ -943,15 +974,16 @@ int main( int argc, char **argv ) {
|
|||
|
||||
// Attempt to locate and parse a config file
|
||||
// First check fg_root
|
||||
string config = current_options.get_fg_root() + "/system.fgfsrc";
|
||||
current_options.parse_config_file( config );
|
||||
FGPath config( current_options.get_fg_root() );
|
||||
config.append( "system.fgfsrc" );
|
||||
current_options.parse_config_file( config.str() );
|
||||
|
||||
// Next check home directory
|
||||
char* envp = ::getenv( "HOME" );
|
||||
if ( envp != NULL ) {
|
||||
config = envp;
|
||||
config += "/.fgfsrc";
|
||||
current_options.parse_config_file( config );
|
||||
config.set( envp );
|
||||
config.append( ".fgfsrc" );
|
||||
current_options.parse_config_file( config.str() );
|
||||
}
|
||||
|
||||
// Parse remaining command line options
|
||||
|
|
|
@ -411,7 +411,9 @@ int fgInitSubsystems( void )
|
|||
fgAPInit(¤t_aircraft);
|
||||
|
||||
// Initialize serial ports
|
||||
#if ! defined( MACOS )
|
||||
fgSerialInit();
|
||||
#endif
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, endl);
|
||||
|
||||
|
|
|
@ -54,13 +54,24 @@ FG_USING_NAMESPACE(std);
|
|||
inline double
|
||||
atof( const string& str )
|
||||
{
|
||||
|
||||
#ifdef __MWERKS__
|
||||
// -dw- if ::atof is called, then we get an infinite loop
|
||||
return std::atof( str.c_str() );
|
||||
#else
|
||||
return ::atof( str.c_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int
|
||||
atoi( const string& str )
|
||||
{
|
||||
#ifdef __MWERKS__
|
||||
// -dw- if ::atoi is called, then we get an infinite loop
|
||||
return std::atoi( str.c_str() );
|
||||
#else
|
||||
return ::atoi( str.c_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
// Defined the shared options class here
|
||||
|
@ -176,8 +187,10 @@ fgOPTIONS::fgOPTIONS() :
|
|||
// $FG_ROOT is not set. This can still be overridden from the
|
||||
// command line or a config file.
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined( WIN32 )
|
||||
fg_root = "\\FlightGear";
|
||||
#elif defined( MACOS )
|
||||
fg_root = ":";
|
||||
#else
|
||||
fg_root = "/usr/local/lib/FlightGear";
|
||||
#endif
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <Debug/logstream.hxx>
|
||||
#include <Main/options.hxx>
|
||||
#include <Math/fg_random.h>
|
||||
#include <Misc/fgpath.hxx>
|
||||
#include <Objects/texload.h>
|
||||
|
||||
#include "splash.hxx"
|
||||
|
@ -50,7 +51,6 @@ static GLubyte *splash_texbuf;
|
|||
|
||||
// Initialize the splash screen
|
||||
void fgSplashInit ( void ) {
|
||||
string tpath, fg_tpath;
|
||||
int width, height;
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, "Initializing splash screen" );
|
||||
|
@ -73,20 +73,23 @@ void fgSplashInit ( void ) {
|
|||
int num = (int)(fg_random() * 4.0 + 1.0);
|
||||
char num_str[256];
|
||||
sprintf(num_str, "%d", num);
|
||||
tpath = current_options.get_fg_root() + "/Textures/Splash";
|
||||
tpath += num_str;
|
||||
tpath += ".rgb";
|
||||
|
||||
FGPath tpath( current_options.get_fg_root() );
|
||||
tpath.append( "Textures/Splash" );
|
||||
tpath.concat( num_str );
|
||||
tpath.concat( ".rgb" );
|
||||
|
||||
if ( (splash_texbuf =
|
||||
read_rgb_texture(tpath.c_str(), &width, &height)) == NULL )
|
||||
{
|
||||
// Try compressed
|
||||
fg_tpath = tpath + ".gz";
|
||||
FGPath fg_tpath = tpath;
|
||||
fg_tpath.concat( ".gz" );
|
||||
if ( (splash_texbuf =
|
||||
read_rgb_texture(fg_tpath.c_str(), &width, &height)) == NULL )
|
||||
{
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
"Error in loading splash screen texture " << tpath );
|
||||
"Error in loading splash screen texture " << tpath.str() );
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
// #include <Bucket/bucketutils.hxx>
|
||||
#include <Main/options.hxx>
|
||||
#include <Main/views.hxx>
|
||||
#include <Misc/fgpath.hxx>
|
||||
#include <Objects/obj.hxx>
|
||||
|
||||
#include "tile.hxx"
|
||||
|
@ -93,19 +94,21 @@ void
|
|||
fgTILECACHE::fill_in( int index, FGBucket& p )
|
||||
{
|
||||
// Load the appropriate data file and build tile fragment list
|
||||
string tile_path = current_options.get_fg_root() +
|
||||
"/Scenery/" + p.gen_base_path() + "/" + p.gen_index_str();
|
||||
FGPath tile_path( current_options.get_fg_root() );
|
||||
tile_path.append( "Scenery" );
|
||||
tile_path.append( p.gen_base_path() );
|
||||
tile_path.append( p.gen_index_str() );
|
||||
|
||||
tile_cache[index].used = true;
|
||||
tile_cache[index].tile_bucket = p;
|
||||
fgObjLoad( tile_path, &tile_cache[index] );
|
||||
fgObjLoad( tile_path.str(), &tile_cache[index] );
|
||||
// tile_cache[ index ].ObjLoad( tile_path, p );
|
||||
|
||||
// cout << " ncount before = " << tile_cache[index].ncount << "\n";
|
||||
// cout << " fragments before = " << tile_cache[index].fragment_list.size()
|
||||
// << "\n";
|
||||
|
||||
string apt_path = tile_path + ".apt";
|
||||
string apt_path = tile_path.str() + ".apt";
|
||||
fgAptGenerate( apt_path, &tile_cache[index] );
|
||||
|
||||
// cout << " ncount after = " << tile_cache[index].ncount << "\n";
|
||||
|
|
|
@ -57,6 +57,7 @@ FG_USING_STD(string);
|
|||
#include <Math/interpolater.hxx>
|
||||
#include <Math/mat3.h>
|
||||
#include <Math/polar3d.hxx>
|
||||
#include <Misc/fgpath.hxx>
|
||||
|
||||
#include "fg_time.hxx"
|
||||
#include "light.hxx"
|
||||
|
@ -77,19 +78,22 @@ void fgLIGHT::Init( void ) {
|
|||
"Initializing Lighting interpolation tables." );
|
||||
|
||||
// build the path name to the ambient lookup table
|
||||
string path = current_options.get_fg_root();
|
||||
string ambient = path + "/Lighting/ambient";
|
||||
string diffuse = path + "/Lighting/diffuse";
|
||||
string sky = path + "/Lighting/sky";
|
||||
FGPath path( current_options.get_fg_root() );
|
||||
FGPath ambient = path;
|
||||
ambient.append( "Lighting/ambient" );
|
||||
FGPath diffuse = path;
|
||||
diffuse.append( "Lighting/diffuse" );
|
||||
FGPath sky = path;
|
||||
sky.append( "Lighting/sky" );
|
||||
|
||||
// initialize ambient table
|
||||
ambient_tbl = new fgINTERPTABLE( ambient );
|
||||
ambient_tbl = new fgINTERPTABLE( ambient.str() );
|
||||
|
||||
// initialize diffuse table
|
||||
diffuse_tbl = new fgINTERPTABLE( diffuse );
|
||||
diffuse_tbl = new fgINTERPTABLE( diffuse.str() );
|
||||
|
||||
// initialize sky table
|
||||
sky_tbl = new fgINTERPTABLE( sky );
|
||||
sky_tbl = new fgINTERPTABLE( sky.str() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -136,6 +136,11 @@ inline void FGTimeStamp::stamp() {
|
|||
ftime(¤t);
|
||||
seconds = current.time;
|
||||
usec = current.millitm * 1000;
|
||||
#elif defined( __MWERKS__ )
|
||||
// -dw- uses system clock to get time stamp... don't know if this works
|
||||
long ticks = clock();
|
||||
seconds = ticks / CLOCKS_PER_SEC;
|
||||
usec = seconds * 100000;
|
||||
#else
|
||||
# error Port me
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue