22 #if defined (HAVE_SDL)
26 #if defined (WITH_MACOSX_BUNDLE)
66 #if !defined(_WIN32) && !defined (__HAIKU__)
67 #include <sys/signal.h>
70 #if defined (_MSC_VER) && defined (_DEBUG)
74 #if defined (CG_SUPPORT)
149 printf(
"Thank you for playing!\n" );
151 if (_Universe != NULL &&
Network == NULL)
154 #if defined (_MSC_VER) && defined (_DEBUG)
156 _RPT0( _CRT_ERROR,
"WARNING: Vega Strike exit not clean\n" );
164 cout<<
"Number of players"<<_Universe->
numPlayers()<<endl;
170 #if defined (CG_SUPPORT)
171 if (cloak_cg->vertexProgram) cgDestroyProgram( cloak_cg->vertexProgram );
172 if (cloak_cg->shaderContext) cgDestroyContext( cloak_cg->shaderContext );
186 #if defined (WITH_MACOSX_BUNDLE)
193 cout <<
"Creating scene manager..." << endl;
196 cout <<
"Creating template manager..." << endl;
207 cerr <<
" Initializing renderer..." << endl;
212 renderer->setMeterDistance(1.0);
213 renderer->setDopplerFactor(0.0);
234 cerr <<
"Shutting down renderer..." << endl;
241 int main(
int argc,
char *argv[] )
248 if (NULL != getcwd( pwd, 8191 )) {
250 printf(
" In path %s\n", pwd );
252 printf(
" In path <<path too long>>\n" );
258 osvi.dwOSVersionInfoSize =
sizeof (OSVERSIONINFO);
260 GetVersionEx( &osvi );
261 isVista = (osvi.dwMajorVersion == 6);
262 printf(
"Windows version %d %d\n", osvi.dwMajorVersion, osvi.dwMinorVersion );
265 printf(
"Vega Strike " " \n"
266 "See http://www.gnu.org/copyleft/gpl.html for license details.\n\n" );
269 srand( time( NULL ) );
278 cerr<<
"GOT SUBDIR ARG = "<<subdir<<endl;
298 std::string defmis =
vs_config->
getVariable(
"general",
"default_mission",
"test/test1.mission" );
301 cerr<<
"MISSION_NAME is empty using : "<<mission_name<<endl;
318 #if defined(HAVE_SDL)
319 #ifndef NO_SDL_JOYSTICK
320 if ( SDL_InitSubSystem( SDL_INIT_JOYSTICK ) ) {
381 static bool reentryWatchdog =
false;
385 if (SplashScreen == NULL && newSplashScreen == NULL) {
391 reentryWatchdog =
true;
392 if (newSplashScreen != NULL)
393 ani = newSplashScreen;
414 bs_tp->
SetPos( -.99, -.97 );
426 static std::string defaultbootmessage =
vs_config->
getVariable(
"graphics",
"default_boot_message",
"" );
427 static std::string initialbootmessage =
vs_config->
getVariable(
"graphics",
"initial_boot_message",
"Loading..." );
428 bs_tp->
Draw( defaultbootmessage.length() > 0 ? defaultbootmessage : message.length() > 0 ? message : initialbootmessage );
433 reentryWatchdog =
false;
440 static bool isset =
false;
453 static std::string mysys;
454 static bool isset =
false;
467 vector< string > ret;
468 string::size_type
index = 0;
469 while ( ( index = s.find(
" " ) ) != string::npos ) {
470 ret.push_back( s.substr( 0, index ) );
471 s = s.substr( index+1 );
479 static std::string ss =
vs_config->
getVariable(
"graphics",
"splash_screen",
"vega_splash.ani" );
485 int snum = time( NULL )%s.size();
486 SplashScreen =
new Animation( s[snum].c_str(), 0 );
487 if ( sa.size() && sa[0].length() )
muzak->
GotoSong( sa[snum%sa.size()] );
502 static std::string startupview =
vs_config->
getVariable(
"graphics",
"startup_cockpit_view",
"front" );
504 ==
"view_target" ?
CP_TARGET : ( startupview
525 bool setplayerloc =
false;
530 vector< std::string >playername;
531 vector< std::string >playerpasswd;
532 string pname, ppasswd;
533 for (
int p = 0; p < numplayers; p++) {
543 cout<<
"Missing or incomlpete section for player "<<p<<endl;
548 playername.push_back( pname );
549 playerpasswd.push_back( ppasswd );
554 vector< SavedUnits > savedun;
555 vector< string > playersaveunit;
556 vector< StarSystem* >ss;
557 vector< string > starsysname;
558 vector< QVector > playerNloc;
561 vector< vector< std::string > >savefiles;
563 cout<<
"Number of local players = "<<numplayers<<endl;
574 cout<<
"Non-networking mode"<<endl;
582 vector< std::string >::iterator it, jt;
584 for (k = 0, it = playername.begin(), jt = playerpasswd.begin();
589 bool setplayerXloc =
false;
599 vector< SavedUnits >saved;
601 vector< string > packedInfo;
609 if ( !
Network[k].connectLoad( pname, ppasswd, err ) ) {
610 cout<<
"error while connecting: "<<err<<endl;
613 savefiles.push_back( *
Network[k].loginSavedGame( 0 ) );
644 ss.push_back( _Universe->
Init( mysystem,
Vector( 0, 0, 0 ), planetname ) );
646 playerNloc.push_back( pos );
648 playerNloc.push_back(
QVector( FLT_MAX, FLT_MAX, FLT_MAX ) );
649 setplayerloc = setplayerXloc;
650 for (
unsigned int j = 0;
j < saved.size();
j++)
651 savedun.push_back( saved[
j] );
659 while ( !savedun.empty() ) {
671 "Welcome to Vega Strike! Use #8080FFTab#000000 to afterburn (#8080FF+,-#000000 cruise control), #8080FFarrows#000000 to steer." );
672 if ( !str.empty() ) {
677 "The #8080FFt#000000 key targets objects; #8080FFspace#000000 fires at them & #8080FFa#000000 activates the SPEC drive. To" );
678 if ( !str.empty() ) {
683 "go to another star system, buy a jump drive for about 10000 credits, fly to a" );
684 if ( !str.empty() ) {
689 "wireframe jump-point and press #8080FFj#000000 to warp to a near star. Target a base or planet;" );
690 if ( !str.empty() ) {
695 "When you get close a green box will appear. Inside the box, #8080FFd#000000 will land." );
713 cout<<
"Loading completed, now network init"<<endl;
739 "Command line options for vegastrike\n"
741 " -D -d \t Specify data directory\n"
742 " -N -n \t Number of players\n"
743 " -M -m \t Specify a mod to play\n"
744 " -P -p \t Specify player location\n"
745 " -J -j \t Start in a specific system\n"
746 " -A -a \t Normal resolution (800x600)\n"
747 " -H -h \t High resolution (1024x768)\n"
748 " -V -v \t Super high resolution (1280x1024)\n"
749 " --net \t Networking Enabled (Experimental)\n"
750 " --debug[=#] \t Enable debugging output, 1 major warnings, 2 medium, 3 developer notes\n"
751 " --test-audio \t Run audio tests\n"
760 for (
int i = 1;
i < argc;
i++) {
761 if (lpCmdLine[
i][0] ==
'-') {
762 cerr<<
"ARG #"<<
i<<
" = "<<lpCmdLine[
i]<<endl;
763 switch (lpCmdLine[
i][1])
768 if (lpCmdLine[i][2] == 0) {
769 cout<<
"Option -D requires an argument"<<endl;
772 datatmp = &lpCmdLine[i][2];
776 cout<<
"Specified data directory not found... exiting"<<endl;
779 cout<<
"Using data dir specified on command line : "<<datatmp<<endl;
786 if ( !(lpCmdLine[i][2] ==
'1' && lpCmdLine[i][3] ==
'\0') ) {
787 CONFIGFILE =
new char[40+strlen( lpCmdLine[i] )+1];
788 sprintf(
CONFIGFILE,
"vegastrike.config.%splayer", lpCmdLine[i]+2 );
793 retstr = string( lpCmdLine[i]+2 );
808 if ( 3 == sscanf( lpCmdLine[i]+2,
"%lf,%lf,%lf", &PlayerLocation.i, &PlayerLocation.j, &PlayerLocation.k ) )
813 st = string( (lpCmdLine[i])+2 );
836 if (strcmp( lpCmdLine[i],
"--benchmark" ) == 0) {
839 }
else if (strcmp( lpCmdLine[i],
"--net" ) == 0) {
842 }
else if (strcmp( lpCmdLine[i],
"--help" ) == 0) {
845 }
else if (strncmp( lpCmdLine[i],
"--debug", 7 ) == 0) {
846 if (lpCmdLine[i][7] == 0) {
848 }
else if (lpCmdLine[i][8] == 0) {
868 for (
int i=1;
i < argc; ++
i) {
869 if (argv[
i][0] ==
'-') {
870 if (strcmp(
"--test-audio", argv[
i])==0) {