Esempio n. 1
0
void StartBSP() {
    char exename[256];
    GetFilename( exename, "q3map" );
    UnixToDosPath( exename ); // do we want this done in linux version?

    char mapname[256];
    const char *pn = g_FuncTable.m_pfnReadProjectKey( "mapspath" );

    strcpy( mapname, pn );
    strcat( mapname, "/ac_prt.map" );
    UnixToDosPath( mapname );

    char command[1024];
    sprintf( command, "%s -nowater -fulldetail %s", exename, mapname );

    Q_Exec( command, TRUE );
}
Esempio n. 2
0
void StartBSP()
{
	char exename[256];
	GetFilename(exename, "q3map");
	UnixToDosPath(exename);	// do we want this done in linux version?

	char mapname[256];  
  const char *pn = GlobalRadiant().getMapsPath();
  
	strcpy( mapname, pn );
	strcat( mapname, "/ac_prt.map" );
	UnixToDosPath(mapname);

	char command[1024];
	sprintf(command, "%s -nowater -fulldetail %s", exename, mapname);

	Q_Exec( command, true );
}
Esempio n. 3
0
void CWatchBSP::DoEBeginStep() {

	if ( !SetupListening() ) {
		CString msg;
		msg = _( "Failed to get a listening socket on port 39000.\nTry running with BSP monitoring disabled if you can't fix this.\n" );
		Sys_Printf( msg );
		gtk_MessageBox( g_pParentWnd->m_pWidget, msg, _( "BSP monitoring" ), MB_OK | MB_ICONERROR );
		Reset();
		return;
	}

	// re-initialise the debug window
	if ( m_iCurrentStep == 0 ) {
		g_DbgDlg.Init();
	}

	// set the timer for timeouts and step cancellation
	g_timer_reset( m_pTimer );
	g_timer_start( m_pTimer );

	if ( !m_bBSPPlugin ) {
		Sys_Printf( "=== running BSP command ===\n%s\n", g_ptr_array_index( m_pCmd, m_iCurrentStep ) );

		if ( !Q_Exec( NULL, (char *) g_ptr_array_index( m_pCmd, m_iCurrentStep ), NULL, true ) ) {
			CString msg;
			msg = _( "Failed to execute the following command: " );
			msg += (char *) g_ptr_array_index( m_pCmd, m_iCurrentStep );
			msg += _( "\nCheck that the file exists and that you don't run out of system resources.\n" );
			Sys_Printf( msg );
			gtk_MessageBox( g_pParentWnd->m_pWidget,  msg, _( "BSP monitoring" ), MB_OK | MB_ICONERROR );
			Reset();
			return;
		}

	}

	m_eState = EBeginStep;
}
Esempio n. 4
0
void CWatchBSP::RunQuake() {

	// build the command line
	Str cmd;

	cmd = g_pGameDescription->mExecutablesPath.GetBuffer();
	// this is game dependant
	if ( !strcmp( ValueForKey( g_qeglobals.d_project_entity, "gamemode" ),"mp" ) ) {
		// MP
		cmd += g_pGameDescription->mMultiplayerEngine.GetBuffer();
	}
	else
	{
		// SP
		cmd += g_pGameDescription->mEngine.GetBuffer();
	}
#ifdef _WIN32
	// NOTE: we are using unix pathnames and CreateProcess doesn't like / in the program path
	// FIXME: This isn't true anymore, doesn't it?
	FindReplace( cmd, "/", "\\" );
#endif
	Str cmdline;
	if ( g_pGameDescription->idTech2 ) {
		cmdline = "+exec radiant.cfg +map ";
		cmdline += m_sBSPName;
	}
	else
	// NOTE: idTech3 specific - there used to be some logic depending on engine breed here
	{
		cmdline = "+set sv_pure 0 ";
		// TTimo: a check for vm_* but that's all fine
		//cmdline = "+set sv_pure 0 +set vm_ui 0 +set vm_cgame 0 +set vm_game 0 ";
		if ( *ValueForKey( g_qeglobals.d_project_entity, "gamename" ) != '\0' ) {
			cmdline += "+set fs_game ";
			cmdline += ValueForKey( g_qeglobals.d_project_entity, "gamename" );
			cmdline += " ";
		}
		//!\todo Read the start-map args from a config file.
		if ( g_pGameDescription->mGameFile == "wolf.game" ) {
			if ( !strcmp( ValueForKey( g_qeglobals.d_project_entity, "gamemode" ),"mp" ) ) {
				// MP
				cmdline += "+devmap ";
				cmdline += m_sBSPName;
			}
			else
			{
				// SP
				cmdline += "+set nextmap \"spdevmap ";
				cmdline += m_sBSPName;
				cmdline += "\"";
			}
		}
		else
		{
			cmdline += "+devmap ";
			cmdline += m_sBSPName;
		}
	}

	Sys_Printf( "%s %s\n", cmd.GetBuffer(), cmdline.GetBuffer() );

	// execute now
	if ( !Q_Exec( cmd.GetBuffer(), (char *)cmdline.GetBuffer(), g_pGameDescription->mEnginePath.GetBuffer(), false ) ) {
		CString msg;
		msg = "Failed to execute the following command: ";
		msg += cmd; msg += cmdline;
		Sys_Printf( msg );
		gtk_MessageBox( g_pParentWnd->m_pWidget,  msg, _( "BSP monitoring" ), MB_OK | MB_ICONERROR );
	}
}
Esempio n. 5
0
void RunBSP(const char* name)
{
  // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=503
  // make sure we don't attempt to region compile a map with the camera outside the region
  if (region_active && !Region_cameraValid())
  {
    globalErrorStream() << "The camera must be in the region to start a region compile.\n";
    return;
  }

  SaveMap();

  if(Map_Unnamed(g_map))
  {
    globalOutputStream() << "build cancelled\n";
    return;
  }

  if (g_SnapShots_Enabled && !Map_Unnamed(g_map) && Map_Modified(g_map))
  {
    Map_Snapshot();
  }

  if (region_active)
  {
    const char* mapname = Map_Name(g_map);
    StringOutputStream name(256);
    name << StringRange(mapname, path_get_filename_base_end(mapname)) << ".reg";
    Map_SaveRegion(name.c_str());
  }

  Pointfile_Delete();

  bsp_init();

  if (g_WatchBSP_Enabled)
  {
    ArrayCommandListener listener;
    build_run(name, listener);
    // grab the file name for engine running
    const char* fullname = Map_Name(g_map);
    StringOutputStream bspname(64);
    bspname << StringRange(path_get_filename_start(fullname), path_get_filename_base_end(fullname));
    BuildMonitor_Run( listener.array(), bspname.c_str() );
  }
  else
  {
    char junkpath[PATH_MAX];
    strcpy(junkpath, SettingsPath_get());
    strcat(junkpath, "junk.txt");

    char batpath[PATH_MAX];
#if defined(POSIX)
    strcpy(batpath, SettingsPath_get());
    strcat(batpath, "qe3bsp.sh");
#elif defined(WIN32)
    strcpy(batpath, SettingsPath_get());
    strcat(batpath, "qe3bsp.bat");
#else
#error "unsupported platform"
#endif
    bool written = false;
    {
      TextFileOutputStream batchFile(batpath);
      if(!batchFile.failed())
      {
#if defined (POSIX)
        batchFile << "#!/bin/sh \n\n";
#endif
        BatchCommandListener listener(batchFile, junkpath);
        build_run(name, listener);
        written = true;
      }
    }
    if(written)
    {
#if defined (POSIX)
      chmod (batpath, 0744);
#endif
      globalOutputStream() << "Writing the compile script to '" << batpath << "'\n";
      globalOutputStream() << "The build output will be saved in '" << junkpath << "'\n";
      Q_Exec(batpath, NULL, NULL, true);
    }
  }

  bsp_shutdown();
}